@belvador/mcp 0.3.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/cli.js +1366 -1047
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -124,8 +124,12 @@ var API_ERROR_STATUS = {
124
124
  INCIDENT_STATE_INVALID: 409,
125
125
  NOTIFICATION_POLICY_INVALID: 400,
126
126
  COVERAGE_EXPECTATION_INVALID: 400,
127
+ COVERAGE_SIGNAL_UNAVAILABLE: 400,
128
+ COVERAGE_CODE_OWNED: 409,
129
+ COVERAGE_LIMIT: 409,
127
130
  PRIVACY_RULE_INVALID: 400,
128
131
  PRIVACY_REGEX_UNSAFE: 400,
132
+ PRIVACY_VERSION_CONFLICT: 409,
129
133
  METRIC_CARDINALITY_LIMIT: 429,
130
134
  RELEASE_NOT_FOUND: 404,
131
135
  PUBLIC_API_PAUSED: 503,
@@ -178,7 +182,7 @@ function cleanUntrustedText(raw, maxBytes = MCP_LIMITS.untrustedStringMaxBytes)
178
182
  const { text, cut } = cutUtf8(escaped, maxBytes);
179
183
  return { text, cut, suspicious };
180
184
  }
181
- var MCP_TOOLS_VERSION = 3;
185
+ var MCP_TOOLS_VERSION = 4;
182
186
  var MCP_TOOLS = [
183
187
  { name: "get_workspace", toolset: "investigate", scope: "org:read", readOnly: true, destructive: false, idempotent: true },
184
188
  { name: "list_projects", toolset: "investigate", scope: "projects:read", readOnly: true, destructive: false, idempotent: true },
@@ -209,8 +213,7 @@ var MCP_TOOLS = [
209
213
  ];
210
214
  var MCP_TOOLS_PENDING = {
211
215
  query_metrics: "P14",
212
- release_health: "P15",
213
- get_coverage: "P10"
216
+ release_health: "P15"
214
217
  };
215
218
 
216
219
  // ../src/shared/mcp/docs.ts
@@ -255,7 +258,7 @@ function docsFetcher(siteUrl, fetcher = fetch, now = () => Date.now()) {
255
258
  import { CLIENT_CAPABILITIES_META_KEY, inputRequired, McpServer } from "@modelcontextprotocol/server";
256
259
 
257
260
  // ../src/shared/contracts/mcp-tools.ts
258
- import { z as z24 } from "zod";
261
+ import { z as z28 } from "zod";
259
262
 
260
263
  // ../src/shared/contracts/api-ops/access.ts
261
264
  import { z as z3 } from "zod";
@@ -862,14 +865,297 @@ var ALERT_OPERATIONS = [
862
865
  })
863
866
  ];
864
867
 
868
+ // ../src/shared/contracts/api-ops/coverage.ts
869
+ import { z as z8 } from "zod";
870
+
871
+ // ../src/shared/contracts/coverage.ts
872
+ import { z as z7 } from "zod";
873
+
874
+ // ../src/shared/contracts/integration-health.ts
875
+ import { z as z6 } from "zod";
876
+
877
+ // ../src/shared/contracts/platforms.ts
878
+ var PLATFORMS = [
879
+ "javascript-browser",
880
+ "react",
881
+ "node",
882
+ "python",
883
+ "tanstack-start",
884
+ "other"
885
+ ];
886
+
887
+ // ../src/shared/contracts/integration-health.ts
888
+ var VERIFICATION_ID_RE = /^bv1_[0-9a-f]{32}$/;
889
+ var verificationIdSchema = z6.string().regex(VERIFICATION_ID_RE);
890
+ var SURFACES = ["browser", "server"];
891
+ var RECEIPT_SURFACES = ["browser", "server", "belvador"];
892
+ var CHECKS = ["delivery", "uncaught", "pipeline"];
893
+ var HOOK_STATES = ["ok", "missing", "unknown"];
894
+ var verificationContextSchema = z6.object({
895
+ v: z6.literal(1),
896
+ surface: z6.enum(RECEIPT_SURFACES),
897
+ check: z6.enum(CHECKS),
898
+ hook: z6.enum(HOOK_STATES).optional(),
899
+ uncaught_expected: z6.boolean().optional()
900
+ });
901
+ var iso = z6.string().datetime();
902
+ var projectId2 = z6.number().int().positive();
903
+ var verificationReceiptSchema = z6.object({
904
+ project_id: projectId2,
905
+ verification_id: verificationIdSchema,
906
+ surface: z6.enum(RECEIPT_SURFACES),
907
+ check: z6.enum(CHECKS),
908
+ hook: z6.enum(HOOK_STATES),
909
+ uncaught_expected: z6.boolean(),
910
+ sdk_name: z6.string().max(80),
911
+ sdk_version: z6.string().max(40),
912
+ environment: z6.string().max(64),
913
+ release: z6.string().max(200),
914
+ source_host: z6.string().max(253),
915
+ received_at: iso
916
+ });
917
+ var SDK_DELIVERY_DROP_REASONS = ["network_error", "queue_overflow", "send_error"];
918
+ var clientDiscardSchema = z6.object({
919
+ hour: iso,
920
+ reason: z6.enum(SDK_DELIVERY_DROP_REASONS),
921
+ n: z6.number().int().nonnegative()
922
+ });
923
+ var edgeVerificationRequestSchema = z6.object({
924
+ v: z6.literal(1),
925
+ project_id: projectId2,
926
+ verification_id: verificationIdSchema
927
+ });
928
+ var readbackCheckSchema = z6.object({
929
+ surface: z6.enum(RECEIPT_SURFACES),
930
+ check: z6.enum(CHECKS),
931
+ hook: z6.enum(HOOK_STATES),
932
+ received_at: iso
933
+ });
934
+ var edgeVerificationResponseSchema = z6.object({
935
+ checks: z6.array(readbackCheckSchema).max(8)
936
+ });
937
+ var readbackResponseSchema = z6.object({
938
+ v: z6.literal(1),
939
+ verification_id: verificationIdSchema,
940
+ node: z6.enum(["connected", "offline"]),
941
+ checks: z6.array(readbackCheckSchema).max(8)
942
+ });
943
+ var ENVIRONMENT_RE = /^[^\u0000-\u001f]{1,64}$/;
944
+ var projectRuntimeSchema = z6.object({
945
+ project_id: projectId2,
946
+ environment: z6.string().max(64),
947
+ surface: z6.enum(SURFACES),
948
+ sdk_name: z6.string().max(80),
949
+ sdk_version: z6.string().max(40),
950
+ latest_release: z6.string().max(200),
951
+ first_seen: iso,
952
+ last_seen: iso,
953
+ events_24h: z6.number().int().nonnegative(),
954
+ check_ins_24h: z6.number().int().nonnegative()
955
+ });
956
+
957
+ // ../src/shared/contracts/vocab/coverage.ts
958
+ var COVERAGE_SURFACES = [
959
+ "browser",
960
+ "server",
961
+ "worker",
962
+ "job",
963
+ "edge_function",
964
+ "database",
965
+ "uptime"
966
+ ];
967
+ var COVERAGE_SIGNALS = [
968
+ "errors",
969
+ "traces",
970
+ "logs",
971
+ "metrics",
972
+ "check_ins",
973
+ "web_vitals",
974
+ "probes"
975
+ ];
976
+ var COVERAGE_STATUSES = ["verified", "stale", "problem", "unknown"];
977
+ var COVERAGE_SOURCES = ["ui", "code"];
978
+
979
+ // ../src/shared/contracts/coverage.ts
980
+ var SURFACE_SIGNALS = {
981
+ browser: ["errors", "traces", "logs", "web_vitals"],
982
+ server: ["errors", "traces", "logs", "metrics"],
983
+ worker: ["errors", "traces", "logs", "metrics"],
984
+ edge_function: ["errors", "traces", "logs", "metrics"],
985
+ job: ["check_ins", "errors", "traces", "logs"],
986
+ database: ["traces", "metrics"],
987
+ uptime: ["probes"]
988
+ };
989
+ function coveragePairOk(surface, signal) {
990
+ return SURFACE_SIGNALS[surface].includes(signal);
991
+ }
992
+ var COVERAGE_RULES = {
993
+ staleAfterHoursDefault: 168,
994
+ staleAfterHoursMin: 1,
995
+ staleAfterHoursMax: 720,
996
+ noteMax: 200,
997
+ evidenceRowsPerProject: 256,
998
+ undeclaredDays: 30,
999
+ resendMs: 3600000,
1000
+ newKeyFlushMs: 60000,
1001
+ backfillErrorsDays: 30,
1002
+ backfillTelemetryDays: 7,
1003
+ setMaxItems: 1000
1004
+ };
1005
+ var FAAS_CLOUD_PLATFORMS = new Set([
1006
+ "aws_lambda",
1007
+ "azure_functions",
1008
+ "gcp_cloud_functions",
1009
+ "alibaba_cloud_fc",
1010
+ "tencent_cloud_scf"
1011
+ ]);
1012
+ var FUNCTION_RUNTIMES = new Set(["cloudflare", "workerd", "vercel-edge", "edge-light"]);
1013
+ var seconds = z7.number().int().positive();
1014
+ var coverageSeenRowSchema = z7.object({
1015
+ environment: z7.string().max(64),
1016
+ surface: z7.enum(COVERAGE_SURFACES),
1017
+ signal: z7.enum(COVERAGE_SIGNALS),
1018
+ last_seen: seconds,
1019
+ last_verified: seconds.nullable()
1020
+ }).strict();
1021
+ var coverageSeenReportSchema = z7.object({
1022
+ project_id: z7.number().int().positive(),
1023
+ rows: z7.array(coverageSeenRowSchema).max(COVERAGE_RULES.evidenceRowsPerProject)
1024
+ }).strict();
1025
+ var environment = z7.string().trim().regex(ENVIRONMENT_RE);
1026
+ var note = z7.string().trim().max(COVERAGE_RULES.noteMax).regex(/^[^\p{Cc}]*$/u);
1027
+ var coverageExpectationInputSchema = z7.object({
1028
+ environment,
1029
+ surface: z7.enum(COVERAGE_SURFACES),
1030
+ signals: z7.array(z7.enum(COVERAGE_SIGNALS)).min(1).max(COVERAGE_SIGNALS.length),
1031
+ staleAfterHours: z7.number().int().min(COVERAGE_RULES.staleAfterHoursMin).max(COVERAGE_RULES.staleAfterHoursMax).default(COVERAGE_RULES.staleAfterHoursDefault),
1032
+ note: note.default("")
1033
+ }).superRefine((e, ctx) => {
1034
+ const seen = new Set;
1035
+ for (const s of e.signals) {
1036
+ if (seen.has(s))
1037
+ ctx.addIssue({ code: "custom", path: ["signals"], message: "duplicate" });
1038
+ seen.add(s);
1039
+ if (!coveragePairOk(e.surface, s))
1040
+ ctx.addIssue({ code: "custom", path: ["signals"], message: `not_for_${e.surface}` });
1041
+ }
1042
+ });
1043
+ var coverageExpectationListSchema = z7.array(coverageExpectationInputSchema).max(COVERAGE_RULES.setMaxItems).superRefine((list, ctx) => {
1044
+ const keys = new Set;
1045
+ list.forEach((e, i) => {
1046
+ const k = `${e.environment}\x00${e.surface}`;
1047
+ if (keys.has(k))
1048
+ ctx.addIssue({ code: "custom", path: [i, "surface"], message: "duplicate" });
1049
+ keys.add(k);
1050
+ });
1051
+ });
1052
+ var iso2 = z7.string();
1053
+ var count = z7.number().int().nonnegative();
1054
+ var coverageCellSchema = z7.object({
1055
+ expectation_id: z7.string(),
1056
+ project_id: z7.number().int().positive(),
1057
+ environment: z7.string(),
1058
+ surface: z7.enum(COVERAGE_SURFACES),
1059
+ signal: z7.enum(COVERAGE_SIGNALS),
1060
+ status: z7.enum(COVERAGE_STATUSES),
1061
+ source: z7.enum(["receipt", "signal"]).nullable(),
1062
+ last_seen_at: iso2.nullable(),
1063
+ last_verified_at: iso2.nullable(),
1064
+ problem_code: z7.string().nullable()
1065
+ });
1066
+ var coverageExpectationRowSchema = z7.object({
1067
+ expectation_id: z7.string(),
1068
+ project_id: z7.number().int().positive(),
1069
+ environment: z7.string(),
1070
+ surface: z7.enum(COVERAGE_SURFACES),
1071
+ signals: z7.array(z7.enum(COVERAGE_SIGNALS)),
1072
+ stale_after_hours: z7.number().int(),
1073
+ note: z7.string(),
1074
+ config_source: z7.enum(COVERAGE_SOURCES),
1075
+ revision: z7.number().int(),
1076
+ updated_at: iso2
1077
+ });
1078
+ var coverageReportSchema = z7.object({
1079
+ generated_at: iso2,
1080
+ expectations_max: z7.number().int().nonnegative(),
1081
+ summary: z7.object({ total: count, verified: count, stale: count, problem: count, unknown: count }),
1082
+ projects: z7.array(z7.object({
1083
+ project_id: z7.number().int().positive(),
1084
+ slug: z7.string(),
1085
+ name: z7.string(),
1086
+ platform: z7.string(),
1087
+ primary_environment: z7.string(),
1088
+ config_source: z7.enum(COVERAGE_SOURCES).nullable()
1089
+ })),
1090
+ expectations: z7.array(coverageExpectationRowSchema),
1091
+ cells: z7.array(coverageCellSchema),
1092
+ undeclared: z7.array(z7.object({
1093
+ project_id: z7.number().int().positive(),
1094
+ environment: z7.string(),
1095
+ surface: z7.enum(COVERAGE_SURFACES),
1096
+ signal: z7.enum(COVERAGE_SIGNALS),
1097
+ last_seen_at: iso2
1098
+ })),
1099
+ environments: z7.array(z7.string()),
1100
+ node_agent_version: z7.string().nullable()
1101
+ });
1102
+
1103
+ // ../src/shared/contracts/api-ops/coverage.ts
1104
+ var COVERAGE_INPUTS = {
1105
+ get: z8.object({
1106
+ workspaceId: uuid,
1107
+ projectId: projectId.optional(),
1108
+ environment: z8.string().trim().regex(ENVIRONMENT_RE).optional()
1109
+ }),
1110
+ set: z8.object({
1111
+ workspaceId: uuid,
1112
+ projectId,
1113
+ configSource: z8.enum(COVERAGE_SOURCES).default("ui"),
1114
+ expectations: coverageExpectationListSchema
1115
+ })
1116
+ };
1117
+ var C = COVERAGE_INPUTS;
1118
+ var COVERAGE_OPERATIONS = [
1119
+ op({
1120
+ id: "coverage.get",
1121
+ method: "GET",
1122
+ path: "/v1/coverage",
1123
+ scope: "coverage:read",
1124
+ sensitivity: "normal",
1125
+ kind: "read",
1126
+ rpcs: ["api_read_coverage"],
1127
+ input: C.get,
1128
+ workspace: true,
1129
+ idempotency: "none",
1130
+ mcp: "reliability",
1131
+ summary: "What each app is expected to send (surface × signal × environment) against what Belvador saw: `verified`, `stale`, `problem` or `unknown`, the verified rate, and signals seen but not declared. Same numbers as the Coverage page.",
1132
+ ui: []
1133
+ }),
1134
+ op({
1135
+ id: "coverage.set",
1136
+ method: "PUT",
1137
+ path: "/v1/projects/{project_id}/coverage-expectations",
1138
+ scope: "coverage:write",
1139
+ sensitivity: "normal",
1140
+ kind: "write",
1141
+ rpcs: ["set_coverage_expectations"],
1142
+ input: C.set,
1143
+ workspace: true,
1144
+ idempotency: "optional",
1145
+ mcp: "configure",
1146
+ summary: "Replace a project's coverage expectations (one per environment × surface). `config_source: code` locks them in the app; send `ui` once to hand them back. Members and up.",
1147
+ ui: ["coverage#setCoverageExpectations"]
1148
+ })
1149
+ ];
1150
+
865
1151
  // ../src/shared/contracts/api-ops/incidents.ts
866
- import { z as z10 } from "zod";
1152
+ import { z as z13 } from "zod";
867
1153
 
868
1154
  // ../src/shared/contracts/notifications.ts
869
- import { z as z9 } from "zod";
1155
+ import { z as z12 } from "zod";
870
1156
 
871
1157
  // ../src/shared/contracts/maintenance.ts
872
- import { z as z6 } from "zod";
1158
+ import { z as z9 } from "zod";
873
1159
  var MAINTENANCE_SCOPES = ["workspace", "project", "monitor"];
874
1160
  var MAINTENANCE_LIMITS = {
875
1161
  durationMinutesMin: 5,
@@ -879,21 +1165,21 @@ var MAINTENANCE_LIMITS = {
879
1165
  onceAheadDays: 366,
880
1166
  previewStarts: 3
881
1167
  };
882
- var weekdaySchema = z6.number().int().min(1).max(7);
883
- var timeOfDay = z6.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
1168
+ var weekdaySchema = z9.number().int().min(1).max(7);
1169
+ var timeOfDay = z9.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
884
1170
  var base = {
885
- scope: z6.enum(MAINTENANCE_SCOPES),
886
- projectIds: z6.array(z6.number().int().positive()).max(MAINTENANCE_LIMITS.idsMax),
887
- monitorIds: z6.array(z6.guid()).max(MAINTENANCE_LIMITS.idsMax),
888
- timezone: z6.string().trim().min(1).max(64),
889
- durationMinutes: z6.number().int().min(MAINTENANCE_LIMITS.durationMinutesMin).max(MAINTENANCE_LIMITS.durationMinutesMax),
890
- reason: z6.string().trim().max(MAINTENANCE_LIMITS.reasonMax).regex(/^[^\p{Cc}]*$/u)
1171
+ scope: z9.enum(MAINTENANCE_SCOPES),
1172
+ projectIds: z9.array(z9.number().int().positive()).max(MAINTENANCE_LIMITS.idsMax),
1173
+ monitorIds: z9.array(z9.guid()).max(MAINTENANCE_LIMITS.idsMax),
1174
+ timezone: z9.string().trim().min(1).max(64),
1175
+ durationMinutes: z9.number().int().min(MAINTENANCE_LIMITS.durationMinutesMin).max(MAINTENANCE_LIMITS.durationMinutesMax),
1176
+ reason: z9.string().trim().max(MAINTENANCE_LIMITS.reasonMax).regex(/^[^\p{Cc}]*$/u)
891
1177
  };
892
- var maintenanceInputSchema = z6.discriminatedUnion("kind", [
893
- z6.object({ kind: z6.literal("once"), startsAt: z6.string().datetime({ offset: true }), ...base }),
894
- z6.object({
895
- kind: z6.literal("weekly"),
896
- weekdays: z6.array(weekdaySchema).min(1).max(7),
1178
+ var maintenanceInputSchema = z9.discriminatedUnion("kind", [
1179
+ z9.object({ kind: z9.literal("once"), startsAt: z9.string().datetime({ offset: true }), ...base }),
1180
+ z9.object({
1181
+ kind: z9.literal("weekly"),
1182
+ weekdays: z9.array(weekdaySchema).min(1).max(7),
897
1183
  startTime: timeOfDay,
898
1184
  ...base
899
1185
  })
@@ -925,10 +1211,10 @@ function validTimeZone(tz) {
925
1211
  var fmtCache = new Map;
926
1212
 
927
1213
  // ../src/shared/contracts/signal-monitors.ts
928
- import { z as z8 } from "zod";
1214
+ import { z as z11 } from "zod";
929
1215
 
930
1216
  // ../src/shared/contracts/monitors.ts
931
- import { z as z7 } from "zod";
1217
+ import { z as z10 } from "zod";
932
1218
 
933
1219
  // ../src/shared/contracts/vocab/monitors.ts
934
1220
  var MONITOR_MODES = ["check_in", "heartbeat"];
@@ -1000,112 +1286,112 @@ function crontabShapeOk(value) {
1000
1286
  const fields = value.trim().split(/\s+/);
1001
1287
  return value.length <= 120 && fields.length === 5 && fields.every((f) => /^[0-9A-Za-z*,/?#LW-]+$/.test(f));
1002
1288
  }
1003
- var crontabScheduleSchema = z7.object({
1004
- type: z7.literal("crontab"),
1005
- value: z7.string().refine(crontabShapeOk, "crontab")
1289
+ var crontabScheduleSchema = z10.object({
1290
+ type: z10.literal("crontab"),
1291
+ value: z10.string().refine(crontabShapeOk, "crontab")
1006
1292
  });
1007
- var intervalScheduleSchema = z7.object({
1008
- type: z7.literal("interval"),
1009
- value: z7.number().int().min(1).max(MONITOR_LIMITS.intervalValueMax),
1010
- unit: z7.enum(INTERVAL_UNITS)
1293
+ var intervalScheduleSchema = z10.object({
1294
+ type: z10.literal("interval"),
1295
+ value: z10.number().int().min(1).max(MONITOR_LIMITS.intervalValueMax),
1296
+ unit: z10.enum(INTERVAL_UNITS)
1011
1297
  });
1012
- var scheduleSchema = z7.discriminatedUnion("type", [
1298
+ var scheduleSchema = z10.discriminatedUnion("type", [
1013
1299
  crontabScheduleSchema,
1014
1300
  intervalScheduleSchema
1015
1301
  ]);
1016
- var monitorSettingsSchema = z7.object({
1302
+ var monitorSettingsSchema = z10.object({
1017
1303
  schedule: scheduleSchema.nullable(),
1018
- timezone: z7.string().min(1).max(64),
1019
- checkin_margin: z7.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1020
- max_runtime: z7.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1021
- failure_issue_threshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1022
- recovery_threshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax)
1304
+ timezone: z10.string().min(1).max(64),
1305
+ checkin_margin: z10.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1306
+ max_runtime: z10.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1307
+ failure_issue_threshold: z10.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1308
+ recovery_threshold: z10.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax)
1023
1309
  });
1024
- var iso = z7.string().datetime();
1025
- var projectId2 = z7.number().int().positive();
1026
- var envName = z7.string().min(1).max(MONITOR_LIMITS.environmentMax);
1310
+ var iso3 = z10.string().datetime();
1311
+ var projectId3 = z10.number().int().positive();
1312
+ var envName = z10.string().min(1).max(MONITOR_LIMITS.environmentMax);
1027
1313
  var monitorDefinitionSchema = monitorSettingsSchema.extend({
1028
- id: z7.guid(),
1029
- project_id: projectId2,
1030
- slug: z7.string().regex(SLUG_RE),
1031
- kind: z7.enum(MONITOR_KINDS),
1032
- expected_environments: z7.array(envName).max(MONITOR_LIMITS.expectedEnvironmentsMax),
1033
- paused_until: iso.nullable(),
1034
- created_at: iso,
1035
- config_source: z7.enum(CONFIG_SOURCES),
1036
- config_hash: z7.string().regex(/^[0-9a-f]{64}$/).nullable()
1314
+ id: z10.guid(),
1315
+ project_id: projectId3,
1316
+ slug: z10.string().regex(SLUG_RE),
1317
+ kind: z10.enum(MONITOR_KINDS),
1318
+ expected_environments: z10.array(envName).max(MONITOR_LIMITS.expectedEnvironmentsMax),
1319
+ paused_until: iso3.nullable(),
1320
+ created_at: iso3,
1321
+ config_source: z10.enum(CONFIG_SOURCES),
1322
+ config_hash: z10.string().regex(/^[0-9a-f]{64}$/).nullable()
1037
1323
  });
1038
- var outcomeCounts = z7.object({
1039
- ok: z7.number().int().nonnegative(),
1040
- skipped: z7.number().int().nonnegative(),
1041
- error: z7.number().int().nonnegative(),
1042
- timeout: z7.number().int().nonnegative(),
1043
- missed: z7.number().int().nonnegative(),
1044
- unknown: z7.number().int().nonnegative()
1324
+ var outcomeCounts = z10.object({
1325
+ ok: z10.number().int().nonnegative(),
1326
+ skipped: z10.number().int().nonnegative(),
1327
+ error: z10.number().int().nonnegative(),
1328
+ timeout: z10.number().int().nonnegative(),
1329
+ missed: z10.number().int().nonnegative(),
1330
+ unknown: z10.number().int().nonnegative()
1045
1331
  });
1046
- var signalStatusSchema = z7.object({
1047
- type: z7.enum(SIGNAL_MONITOR_TYPES),
1048
- value: z7.number().int().nonnegative().max(1e9).nullable(),
1049
- threshold: z7.number().int().nonnegative().max(1e9).nullable(),
1050
- window_end: iso.nullable(),
1051
- pending: z7.number().int().nonnegative().max(1e6).nullable(),
1052
- stalled: z7.number().int().nonnegative().max(1e6).nullable(),
1053
- refused_24h: z7.number().int().nonnegative().max(1e9).nullable()
1332
+ var signalStatusSchema = z10.object({
1333
+ type: z10.enum(SIGNAL_MONITOR_TYPES),
1334
+ value: z10.number().int().nonnegative().max(1e9).nullable(),
1335
+ threshold: z10.number().int().nonnegative().max(1e9).nullable(),
1336
+ window_end: iso3.nullable(),
1337
+ pending: z10.number().int().nonnegative().max(1e6).nullable(),
1338
+ stalled: z10.number().int().nonnegative().max(1e6).nullable(),
1339
+ refused_24h: z10.number().int().nonnegative().max(1e9).nullable()
1054
1340
  });
1055
- var monitorStatusSchema = z7.object({
1056
- monitor_id: z7.guid(),
1057
- project_id: projectId2,
1341
+ var monitorStatusSchema = z10.object({
1342
+ monitor_id: z10.guid(),
1343
+ project_id: projectId3,
1058
1344
  environment: envName,
1059
- open_failure: z7.enum(FAILURE_INCIDENT_CODES).nullable(),
1060
- open_unknown: z7.boolean(),
1061
- unobservable: z7.enum(UNOBSERVABLE_REASONS).nullable(),
1062
- last_outcome: z7.enum(RUN_OUTCOMES).nullable(),
1063
- last_check_in_at: iso.nullable(),
1064
- last_healthy_at: iso.nullable(),
1065
- next_deadline_at: iso.nullable(),
1066
- next_due_at: iso.nullable().optional(),
1067
- in_progress: z7.boolean(),
1345
+ open_failure: z10.enum(FAILURE_INCIDENT_CODES).nullable(),
1346
+ open_unknown: z10.boolean(),
1347
+ unobservable: z10.enum(UNOBSERVABLE_REASONS).nullable(),
1348
+ last_outcome: z10.enum(RUN_OUTCOMES).nullable(),
1349
+ last_check_in_at: iso3.nullable(),
1350
+ last_healthy_at: iso3.nullable(),
1351
+ next_deadline_at: iso3.nullable(),
1352
+ next_due_at: iso3.nullable().optional(),
1353
+ in_progress: z10.boolean(),
1068
1354
  counts_24h: outcomeCounts,
1069
1355
  signal: signalStatusSchema.optional(),
1070
- evaluated_at: iso
1356
+ evaluated_at: iso3
1071
1357
  });
1072
- var monitorIncidentSchema = z7.object({
1073
- incident_id: z7.guid(),
1074
- monitor_id: z7.guid(),
1075
- project_id: projectId2,
1358
+ var monitorIncidentSchema = z10.object({
1359
+ incident_id: z10.guid(),
1360
+ monitor_id: z10.guid(),
1361
+ project_id: projectId3,
1076
1362
  environment: envName,
1077
- code: z7.enum(MONITOR_INCIDENT_CODES),
1078
- event: z7.enum(INCIDENT_EVENTS),
1079
- occurred_at: iso,
1080
- detected_late: z7.boolean(),
1081
- reason: z7.string().regex(REASON_RE).nullable(),
1082
- duration_ms: z7.number().int().nonnegative().nullable(),
1083
- consecutive: z7.number().int().min(1).max(1e5),
1084
- reviewed_by: z7.guid().nullable(),
1085
- observed: z7.number().int().min(0).max(1e9).nullable().optional(),
1086
- threshold: z7.number().int().min(0).max(1e9).nullable().optional()
1363
+ code: z10.enum(MONITOR_INCIDENT_CODES),
1364
+ event: z10.enum(INCIDENT_EVENTS),
1365
+ occurred_at: iso3,
1366
+ detected_late: z10.boolean(),
1367
+ reason: z10.string().regex(REASON_RE).nullable(),
1368
+ duration_ms: z10.number().int().nonnegative().nullable(),
1369
+ consecutive: z10.number().int().min(1).max(1e5),
1370
+ reviewed_by: z10.guid().nullable(),
1371
+ observed: z10.number().int().min(0).max(1e9).nullable().optional(),
1372
+ threshold: z10.number().int().min(0).max(1e9).nullable().optional()
1087
1373
  });
1088
- var monitorDiscoverySchema = z7.object({
1089
- project_id: projectId2,
1090
- slug: z7.string().regex(SLUG_RE),
1374
+ var monitorDiscoverySchema = z10.object({
1375
+ project_id: projectId3,
1376
+ slug: z10.string().regex(SLUG_RE),
1091
1377
  settings: monitorSettingsSchema.nullable(),
1092
- config_hash: z7.string().regex(/^[0-9a-f]{64}$/).nullable(),
1093
- check_ins: z7.number().int().nonnegative(),
1094
- last_seen_at: iso
1378
+ config_hash: z10.string().regex(/^[0-9a-f]{64}$/).nullable(),
1379
+ check_ins: z10.number().int().nonnegative(),
1380
+ last_seen_at: iso3
1095
1381
  });
1096
1382
  var MONITOR_NAME_MAX = MONITOR_LIMITS.nameMax;
1097
- var environmentName = z7.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/);
1098
- var monitorInputSchema = z7.object({
1099
- name: z7.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1100
- mode: z7.enum(MONITOR_MODES).default("check_in"),
1101
- kind: z7.enum(MONITOR_KINDS),
1383
+ var environmentName = z10.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/);
1384
+ var monitorInputSchema = z10.object({
1385
+ name: z10.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1386
+ mode: z10.enum(MONITOR_MODES).default("check_in"),
1387
+ kind: z10.enum(MONITOR_KINDS),
1102
1388
  schedule: scheduleSchema.nullable(),
1103
- timezone: z7.string().trim().min(1).max(64),
1104
- checkinMarginMin: z7.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1105
- maxRuntimeMin: z7.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1106
- failureThreshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1107
- recoveryThreshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1108
- expectedEnvironments: z7.array(environmentName).min(1).max(MONITOR_LIMITS.expectedEnvironmentsMax)
1389
+ timezone: z10.string().trim().min(1).max(64),
1390
+ checkinMarginMin: z10.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1391
+ maxRuntimeMin: z10.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1392
+ failureThreshold: z10.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1393
+ recoveryThreshold: z10.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1394
+ expectedEnvironments: z10.array(environmentName).min(1).max(MONITOR_LIMITS.expectedEnvironmentsMax)
1109
1395
  }).refine((v) => v.kind === "on_demand" ? v.schedule === null : v.schedule?.type === v.kind, {
1110
1396
  path: ["schedule"],
1111
1397
  message: "schedule"
@@ -1120,88 +1406,88 @@ var MONITOR_INPUT_DEFAULTS = {
1120
1406
  recoveryThreshold: MONITOR_LIMITS.recoveryThresholdDefault,
1121
1407
  expectedEnvironments: [DEFAULT_CHECK_IN_ENVIRONMENT]
1122
1408
  };
1123
- var runOutcome = z7.enum(RUN_OUTCOMES);
1124
- var runFlags = z7.array(z7.string().max(32)).max(16);
1125
- var monitorRunSchema = z7.object({
1126
- id: z7.number().int().positive(),
1127
- kind: z7.enum(["run", "missed"]),
1409
+ var runOutcome = z10.enum(RUN_OUTCOMES);
1410
+ var runFlags = z10.array(z10.string().max(32)).max(16);
1411
+ var monitorRunSchema = z10.object({
1412
+ id: z10.number().int().positive(),
1413
+ kind: z10.enum(["run", "missed"]),
1128
1414
  outcome: runOutcome,
1129
- started_at: iso,
1130
- ended_at: iso,
1131
- attempts: z7.number().int().nonnegative(),
1132
- duration_ms: z7.number().int().nonnegative().nullable(),
1133
- reason: z7.string().max(64).nullable(),
1134
- check_in_id: z7.string().max(64).nullable(),
1135
- trace_id: z7.string().max(32).nullable(),
1136
- release: z7.string().max(MONITOR_LIMITS.releaseMax).nullable(),
1415
+ started_at: iso3,
1416
+ ended_at: iso3,
1417
+ attempts: z10.number().int().nonnegative(),
1418
+ duration_ms: z10.number().int().nonnegative().nullable(),
1419
+ reason: z10.string().max(64).nullable(),
1420
+ check_in_id: z10.string().max(64).nullable(),
1421
+ trace_id: z10.string().max(32).nullable(),
1422
+ release: z10.string().max(MONITOR_LIMITS.releaseMax).nullable(),
1137
1423
  flags: runFlags
1138
1424
  });
1139
- var openAttemptSchema = z7.object({
1140
- check_in_id: z7.string().max(64),
1141
- run_key: z7.string().max(64),
1142
- attempt: z7.number().int().nonnegative(),
1143
- state: z7.string().max(16),
1144
- started_at: iso,
1145
- deadline_at: iso
1425
+ var openAttemptSchema = z10.object({
1426
+ check_in_id: z10.string().max(64),
1427
+ run_key: z10.string().max(64),
1428
+ attempt: z10.number().int().nonnegative(),
1429
+ state: z10.string().max(16),
1430
+ started_at: iso3,
1431
+ deadline_at: iso3
1146
1432
  });
1147
- var monitorRunsResponseSchema = z7.object({
1148
- open: z7.array(openAttemptSchema).max(100),
1149
- runs: z7.array(monitorRunSchema).max(MONITOR_LIMITS.runsPageSize),
1150
- next_cursor: z7.string().max(32).nullable()
1433
+ var monitorRunsResponseSchema = z10.object({
1434
+ open: z10.array(openAttemptSchema).max(100),
1435
+ runs: z10.array(monitorRunSchema).max(MONITOR_LIMITS.runsPageSize),
1436
+ next_cursor: z10.string().max(32).nullable()
1151
1437
  });
1152
- var timelineRunSchema = z7.object({
1153
- id: z7.number().int().positive(),
1154
- kind: z7.enum(["run", "missed"]),
1438
+ var timelineRunSchema = z10.object({
1439
+ id: z10.number().int().positive(),
1440
+ kind: z10.enum(["run", "missed"]),
1155
1441
  outcome: runOutcome,
1156
- ended_at: iso,
1442
+ ended_at: iso3,
1157
1443
  flags: runFlags
1158
1444
  });
1159
- var monitorTimelineResponseSchema = z7.object({
1160
- runs: z7.array(timelineRunSchema).max(MONITOR_LIMITS.timelineRuns)
1445
+ var monitorTimelineResponseSchema = z10.object({
1446
+ runs: z10.array(timelineRunSchema).max(MONITOR_LIMITS.timelineRuns)
1161
1447
  });
1162
- var monitorStripsResponseSchema = z7.object({
1163
- strips: z7.array(z7.object({
1164
- monitor_id: z7.guid(),
1448
+ var monitorStripsResponseSchema = z10.object({
1449
+ strips: z10.array(z10.object({
1450
+ monitor_id: z10.guid(),
1165
1451
  environment: envName,
1166
- runs: z7.array(timelineRunSchema).max(MONITOR_LIMITS.listStripRuns)
1452
+ runs: z10.array(timelineRunSchema).max(MONITOR_LIMITS.listStripRuns)
1167
1453
  })).max(5000)
1168
1454
  });
1169
- var monitorDiagnosticSchema = z7.object({
1170
- id: z7.string().regex(/^\d{1,19}$/),
1171
- check_in_id: z7.string().max(64).nullable(),
1172
- signal: z7.string().max(16),
1173
- exit_code: z7.number().int().min(0).max(255).nullable(),
1174
- received_at: iso,
1175
- body: z7.string().max(MONITOR_LIMITS.diagnosticMaxBytes * 2)
1455
+ var monitorDiagnosticSchema = z10.object({
1456
+ id: z10.string().regex(/^\d{1,19}$/),
1457
+ check_in_id: z10.string().max(64).nullable(),
1458
+ signal: z10.string().max(16),
1459
+ exit_code: z10.number().int().min(0).max(255).nullable(),
1460
+ received_at: iso3,
1461
+ body: z10.string().max(MONITOR_LIMITS.diagnosticMaxBytes * 2)
1176
1462
  });
1177
- var monitorDiagnosticsResponseSchema = z7.object({
1178
- diagnostics: z7.array(monitorDiagnosticSchema).max(50),
1179
- next_cursor: z7.string().regex(/^\d{1,19}$/).nullable()
1463
+ var monitorDiagnosticsResponseSchema = z10.object({
1464
+ diagnostics: z10.array(monitorDiagnosticSchema).max(50),
1465
+ next_cursor: z10.string().regex(/^\d{1,19}$/).nullable()
1180
1466
  });
1181
- var checkInDetailSchema = z7.object({
1182
- run_key: z7.string().max(64),
1183
- attempts: z7.array(z7.object({
1184
- check_in_id: z7.string().max(64),
1185
- attempt: z7.number().int().nonnegative(),
1186
- result: z7.string().max(16),
1187
- started_at: iso,
1188
- ended_at: iso.nullable(),
1189
- duration_ms: z7.number().int().nonnegative().nullable(),
1190
- reason: z7.string().max(64).nullable(),
1191
- trace_id: z7.string().max(32).nullable(),
1192
- release: z7.string().max(MONITOR_LIMITS.releaseMax).nullable()
1467
+ var checkInDetailSchema = z10.object({
1468
+ run_key: z10.string().max(64),
1469
+ attempts: z10.array(z10.object({
1470
+ check_in_id: z10.string().max(64),
1471
+ attempt: z10.number().int().nonnegative(),
1472
+ result: z10.string().max(16),
1473
+ started_at: iso3,
1474
+ ended_at: iso3.nullable(),
1475
+ duration_ms: z10.number().int().nonnegative().nullable(),
1476
+ reason: z10.string().max(64).nullable(),
1477
+ trace_id: z10.string().max(32).nullable(),
1478
+ release: z10.string().max(MONITOR_LIMITS.releaseMax).nullable()
1193
1479
  })).max(1000),
1194
- errors: z7.array(z7.object({
1195
- event_id: z7.string().max(64),
1196
- issue_id: z7.number().int().nonnegative(),
1197
- title: z7.string().max(1024),
1198
- level: z7.string().max(16),
1199
- timestamp: iso,
1200
- same_trace: z7.boolean()
1480
+ errors: z10.array(z10.object({
1481
+ event_id: z10.string().max(64),
1482
+ issue_id: z10.number().int().nonnegative(),
1483
+ title: z10.string().max(1024),
1484
+ level: z10.string().max(16),
1485
+ timestamp: iso3,
1486
+ same_trace: z10.boolean()
1201
1487
  })).max(50),
1202
- diagnostics: z7.array(monitorDiagnosticSchema).max(20).default([])
1488
+ diagnostics: z10.array(monitorDiagnosticSchema).max(20).default([])
1203
1489
  });
1204
- var incidentReviewSchema = z7.object({ incident_id: z7.guid() });
1490
+ var incidentReviewSchema = z10.object({ incident_id: z10.guid() });
1205
1491
 
1206
1492
  // ../src/shared/contracts/signal-monitors.ts
1207
1493
  var isSignalMonitorType = (t) => SIGNAL_MONITOR_TYPES.includes(t);
@@ -1254,11 +1540,11 @@ var SIGNAL_LIMITS = {
1254
1540
  queryMaxSeconds: 5
1255
1541
  };
1256
1542
  var SELECTOR_KEY_RE = /^(?:tags\.[A-Za-z0-9_.:-]{1,100}|[A-Za-z_][A-Za-z0-9_.:-]{0,127})$/;
1257
- var scalar = z8.union([z8.string().max(SIGNAL_LIMITS.valueMax), z8.number().finite(), z8.boolean()]);
1258
- var selectorConditionSchema = z8.object({
1259
- key: z8.string().min(1).max(SIGNAL_LIMITS.keyMax).regex(SELECTOR_KEY_RE),
1260
- op: z8.enum(SELECTOR_OPS),
1261
- value: z8.union([scalar, z8.array(z8.string().max(SIGNAL_LIMITS.valueMax)).min(1).max(SIGNAL_LIMITS.inValuesMax)]).optional()
1543
+ var scalar = z11.union([z11.string().max(SIGNAL_LIMITS.valueMax), z11.number().finite(), z11.boolean()]);
1544
+ var selectorConditionSchema = z11.object({
1545
+ key: z11.string().min(1).max(SIGNAL_LIMITS.keyMax).regex(SELECTOR_KEY_RE),
1546
+ op: z11.enum(SELECTOR_OPS),
1547
+ value: z11.union([scalar, z11.array(z11.string().max(SIGNAL_LIMITS.valueMax)).min(1).max(SIGNAL_LIMITS.inValuesMax)]).optional()
1262
1548
  }).superRefine((c, ctx) => {
1263
1549
  const bad = (message) => ctx.addIssue({ code: "custom", path: ["value"], message });
1264
1550
  if (VALUELESS_OPS.has(c.op)) {
@@ -1280,10 +1566,10 @@ var selectorConditionSchema = z8.object({
1280
1566
  if (c.op === "prefix" && (typeof c.value !== "string" || c.value.length === 0))
1281
1567
  bad("text");
1282
1568
  });
1283
- var environmentListSchema = z8.array(z8.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/)).min(1).max(SIGNAL_LIMITS.environmentsMax).refine((v) => new Set(v).size === v.length, "unique");
1284
- var selectorSchema = z8.object({
1285
- signal: z8.enum(SIGNAL_KINDS),
1286
- match: z8.array(selectorConditionSchema).max(SIGNAL_LIMITS.matchMax)
1569
+ var environmentListSchema = z11.array(z11.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/)).min(1).max(SIGNAL_LIMITS.environmentsMax).refine((v) => new Set(v).size === v.length, "unique");
1570
+ var selectorSchema = z11.object({
1571
+ signal: z11.enum(SIGNAL_KINDS),
1572
+ match: z11.array(selectorConditionSchema).max(SIGNAL_LIMITS.matchMax)
1287
1573
  });
1288
1574
  function toNumber(v) {
1289
1575
  if (typeof v === "number")
@@ -1294,22 +1580,22 @@ function toNumber(v) {
1294
1580
  }
1295
1581
  return null;
1296
1582
  }
1297
- var minutes = (min, max) => z8.number().int().min(min).max(max);
1298
- var threshold = z8.number().int().min(0).max(SIGNAL_LIMITS.thresholdMax);
1299
- var recovery = z8.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax);
1583
+ var minutes = (min, max) => z11.number().int().min(min).max(max);
1584
+ var threshold = z11.number().int().min(0).max(SIGNAL_LIMITS.thresholdMax);
1585
+ var recovery = z11.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax);
1300
1586
  var common = {
1301
1587
  environments: environmentListSchema,
1302
- severity: z8.enum(SEVERITIES),
1588
+ severity: z11.enum(SEVERITIES),
1303
1589
  recovery_threshold: recovery
1304
1590
  };
1305
- var countSettingsSchema = z8.object({
1306
- type: z8.literal("count"),
1591
+ var countSettingsSchema = z11.object({
1592
+ type: z11.literal("count"),
1307
1593
  selector: selectorSchema,
1308
1594
  window_minutes: minutes(SIGNAL_LIMITS.windowMinutesMin, SIGNAL_LIMITS.windowMinutesMax),
1309
- comparator: z8.enum(COMPARATORS),
1595
+ comparator: z11.enum(COMPARATORS),
1310
1596
  threshold,
1311
1597
  threshold_high: threshold.nullable(),
1312
- missing_data: z8.enum(MISSING_DATA_POLICIES),
1598
+ missing_data: z11.enum(MISSING_DATA_POLICIES),
1313
1599
  ...common
1314
1600
  }).superRefine((s, ctx) => {
1315
1601
  if (s.comparator === "outside" && (s.threshold_high === null || s.threshold_high <= s.threshold)) {
@@ -1322,27 +1608,27 @@ var countSettingsSchema = z8.object({
1322
1608
  ctx.addIssue({ code: "custom", path: ["threshold"], message: "threshold" });
1323
1609
  }
1324
1610
  });
1325
- var assertionSettingsSchema = z8.object({
1326
- type: z8.literal("assertion"),
1611
+ var assertionSettingsSchema = z11.object({
1612
+ type: z11.literal("assertion"),
1327
1613
  selector: selectorSchema,
1328
- assert: z8.array(selectorConditionSchema).min(1).max(SIGNAL_LIMITS.assertMax),
1614
+ assert: z11.array(selectorConditionSchema).min(1).max(SIGNAL_LIMITS.assertMax),
1329
1615
  window_minutes: minutes(SIGNAL_LIMITS.windowMinutesMin, SIGNAL_LIMITS.windowMinutesMax),
1330
- threshold: z8.number().int().min(1).max(SIGNAL_LIMITS.thresholdMax),
1331
- missing_data: z8.enum(MISSING_DATA_POLICIES),
1616
+ threshold: z11.number().int().min(1).max(SIGNAL_LIMITS.thresholdMax),
1617
+ missing_data: z11.enum(MISSING_DATA_POLICIES),
1332
1618
  ...common
1333
1619
  });
1334
- var deadlineSettingsSchema = z8.object({
1335
- type: z8.literal("deadline"),
1620
+ var deadlineSettingsSchema = z11.object({
1621
+ type: z11.literal("deadline"),
1336
1622
  occurrence_grace_minutes: minutes(0, SIGNAL_LIMITS.graceMinutesMax),
1337
1623
  progress_timeout_minutes: minutes(SIGNAL_LIMITS.progressMinutesMin, SIGNAL_LIMITS.progressMinutesMax).nullable(),
1338
1624
  ...common
1339
1625
  });
1340
- var progressSettingsSchema = z8.object({
1341
- type: z8.literal("progress"),
1626
+ var progressSettingsSchema = z11.object({
1627
+ type: z11.literal("progress"),
1342
1628
  progress_timeout_minutes: minutes(SIGNAL_LIMITS.progressMinutesMin, SIGNAL_LIMITS.progressMinutesMax),
1343
1629
  ...common
1344
1630
  });
1345
- var signalSettingsSchema = z8.discriminatedUnion("type", [
1631
+ var signalSettingsSchema = z11.discriminatedUnion("type", [
1346
1632
  countSettingsSchema,
1347
1633
  assertionSettingsSchema,
1348
1634
  deadlineSettingsSchema,
@@ -1360,76 +1646,76 @@ function settingsFromRow(row) {
1360
1646
  });
1361
1647
  return r.success ? r.data : null;
1362
1648
  }
1363
- var signalMonitorInputSchema = z8.object({
1364
- name: z8.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1649
+ var signalMonitorInputSchema = z11.object({
1650
+ name: z11.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1365
1651
  settings: signalSettingsSchema
1366
1652
  });
1367
- var signalMonitorDefinitionSchema = z8.object({
1368
- id: z8.guid(),
1369
- project_id: z8.number().int().positive(),
1370
- slug: z8.string().regex(SLUG_RE),
1653
+ var signalMonitorDefinitionSchema = z11.object({
1654
+ id: z11.guid(),
1655
+ project_id: z11.number().int().positive(),
1656
+ slug: z11.string().regex(SLUG_RE),
1371
1657
  settings: signalSettingsSchema,
1372
- paused_until: z8.string().datetime().nullable(),
1373
- created_at: z8.string().datetime(),
1374
- revision: z8.number().int().nonnegative()
1658
+ paused_until: z11.string().datetime().nullable(),
1659
+ created_at: z11.string().datetime(),
1660
+ revision: z11.number().int().nonnegative()
1375
1661
  });
1376
- var signalLimitsConfigSchema = z8.object({
1377
- pending_occurrences_per_monitor: z8.number().int().min(1).max(1e6),
1378
- pending_occurrences_per_project: z8.number().int().min(1).max(1e7)
1662
+ var signalLimitsConfigSchema = z11.object({
1663
+ pending_occurrences_per_monitor: z11.number().int().min(1).max(1e6),
1664
+ pending_occurrences_per_project: z11.number().int().min(1).max(1e7)
1379
1665
  });
1380
1666
  var OCCURRENCE_ID_RE = /^[A-Za-z0-9._:-]{1,128}$/;
1381
- var occurrenceInputSchema = z8.object({
1382
- monitor_slug: z8.string().regex(SLUG_RE),
1383
- occurrence_id: z8.string().regex(OCCURRENCE_ID_RE),
1384
- due_at: z8.string().datetime({ offset: true }),
1385
- environment: z8.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/).optional()
1667
+ var occurrenceInputSchema = z11.object({
1668
+ monitor_slug: z11.string().regex(SLUG_RE),
1669
+ occurrence_id: z11.string().regex(OCCURRENCE_ID_RE),
1670
+ due_at: z11.string().datetime({ offset: true }),
1671
+ environment: z11.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/).optional()
1386
1672
  });
1387
1673
  var occurrenceCancelSchema = occurrenceInputSchema.pick({ monitor_slug: true, occurrence_id: true, environment: true });
1388
1674
  var OCCURRENCE_PAST_SKEW_MS = 5 * 60000;
1389
- var occurrenceRowSchema = z8.object({
1390
- occurrence_id: z8.string().max(SIGNAL_LIMITS.occurrenceIdMax),
1391
- environment: z8.string().max(MONITOR_LIMITS.environmentMax),
1392
- state: z8.enum(OCCURRENCE_STATES),
1393
- due_at: z8.string().datetime(),
1394
- deadline_at: z8.string().datetime(),
1395
- registered_at: z8.string().datetime(),
1396
- started_at: z8.string().datetime().nullable(),
1397
- last_signal_at: z8.string().datetime().nullable(),
1398
- ended_at: z8.string().datetime().nullable(),
1399
- stalled: z8.boolean()
1675
+ var occurrenceRowSchema = z11.object({
1676
+ occurrence_id: z11.string().max(SIGNAL_LIMITS.occurrenceIdMax),
1677
+ environment: z11.string().max(MONITOR_LIMITS.environmentMax),
1678
+ state: z11.enum(OCCURRENCE_STATES),
1679
+ due_at: z11.string().datetime(),
1680
+ deadline_at: z11.string().datetime(),
1681
+ registered_at: z11.string().datetime(),
1682
+ started_at: z11.string().datetime().nullable(),
1683
+ last_signal_at: z11.string().datetime().nullable(),
1684
+ ended_at: z11.string().datetime().nullable(),
1685
+ stalled: z11.boolean()
1400
1686
  });
1401
- var occurrencesResponseSchema = z8.object({
1402
- occurrences: z8.array(occurrenceRowSchema).max(SIGNAL_LIMITS.occurrencesPageSize),
1403
- pending: z8.number().int().nonnegative(),
1404
- next_due_at: z8.string().datetime().nullable(),
1405
- next_cursor: z8.string().max(64).nullable(),
1406
- refused_24h: z8.number().int().nonnegative()
1687
+ var occurrencesResponseSchema = z11.object({
1688
+ occurrences: z11.array(occurrenceRowSchema).max(SIGNAL_LIMITS.occurrencesPageSize),
1689
+ pending: z11.number().int().nonnegative(),
1690
+ next_due_at: z11.string().datetime().nullable(),
1691
+ next_cursor: z11.string().max(64).nullable(),
1692
+ refused_24h: z11.number().int().nonnegative()
1407
1693
  });
1408
- var signalSeriesSchema = z8.object({
1409
- environment: z8.string().max(MONITOR_LIMITS.environmentMax),
1410
- buckets: z8.array(z8.object({ minute: z8.string().datetime(), matched: z8.number().int().nonnegative(), violations: z8.number().int().nonnegative(), lossy: z8.boolean() })).max(1440),
1411
- counted_through: z8.string().datetime().nullable()
1694
+ var signalSeriesSchema = z11.object({
1695
+ environment: z11.string().max(MONITOR_LIMITS.environmentMax),
1696
+ buckets: z11.array(z11.object({ minute: z11.string().datetime(), matched: z11.number().int().nonnegative(), violations: z11.number().int().nonnegative(), lossy: z11.boolean() })).max(1440),
1697
+ counted_through: z11.string().datetime().nullable()
1412
1698
  });
1413
- var signalResponseSchema = z8.object({
1414
- series: z8.array(signalSeriesSchema).max(SIGNAL_LIMITS.environmentsMax),
1415
- runs: z8.array(z8.object({
1416
- run_id: z8.string().max(SIGNAL_LIMITS.occurrenceIdMax),
1417
- environment: z8.string().max(MONITOR_LIMITS.environmentMax),
1418
- started_at: z8.string().datetime(),
1419
- last_signal_at: z8.string().datetime(),
1420
- stalled: z8.boolean()
1699
+ var signalResponseSchema = z11.object({
1700
+ series: z11.array(signalSeriesSchema).max(SIGNAL_LIMITS.environmentsMax),
1701
+ runs: z11.array(z11.object({
1702
+ run_id: z11.string().max(SIGNAL_LIMITS.occurrenceIdMax),
1703
+ environment: z11.string().max(MONITOR_LIMITS.environmentMax),
1704
+ started_at: z11.string().datetime(),
1705
+ last_signal_at: z11.string().datetime(),
1706
+ stalled: z11.boolean()
1421
1707
  })).max(SIGNAL_LIMITS.occurrencesPageSize)
1422
1708
  });
1423
- var backtestSettingsSchema = z8.union([countSettingsSchema, assertionSettingsSchema]);
1424
- var backtestResponseSchema = z8.object({
1425
- alerts: z8.number().int().nonnegative(),
1426
- windows: z8.number().int().nonnegative(),
1427
- violated_windows: z8.number().int().nonnegative(),
1428
- first_at: z8.string().datetime().nullable(),
1429
- last_at: z8.string().datetime().nullable(),
1430
- days: z8.number().nonnegative(),
1431
- matched_total: z8.number().int().nonnegative(),
1432
- violations_total: z8.number().int().nonnegative()
1709
+ var backtestSettingsSchema = z11.union([countSettingsSchema, assertionSettingsSchema]);
1710
+ var backtestResponseSchema = z11.object({
1711
+ alerts: z11.number().int().nonnegative(),
1712
+ windows: z11.number().int().nonnegative(),
1713
+ violated_windows: z11.number().int().nonnegative(),
1714
+ first_at: z11.string().datetime().nullable(),
1715
+ last_at: z11.string().datetime().nullable(),
1716
+ days: z11.number().nonnegative(),
1717
+ matched_total: z11.number().int().nonnegative(),
1718
+ violations_total: z11.number().int().nonnegative()
1433
1719
  });
1434
1720
 
1435
1721
  // ../src/shared/contracts/notifications.ts
@@ -1444,24 +1730,24 @@ var NOTIFY_LIMITS = {
1444
1730
  };
1445
1731
  var HOLDABLE_SEVERITIES = ["medium", "low"];
1446
1732
  var DIGEST_MODES = ["off", "hourly", "daily"];
1447
- var timeOfDay2 = z9.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
1733
+ var timeOfDay2 = z12.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
1448
1734
  var unique = (xs) => new Set(xs).size === xs.length;
1449
- var quietHoursSchema = z9.object({
1450
- days: z9.array(weekdaySchema).min(1).max(7).refine(unique),
1735
+ var quietHoursSchema = z12.object({
1736
+ days: z12.array(weekdaySchema).min(1).max(7).refine(unique),
1451
1737
  start: timeOfDay2,
1452
1738
  end: timeOfDay2
1453
1739
  }).refine((q) => q.start !== q.end, { path: ["end"] });
1454
- var policyInputSchema = z9.object({
1455
- name: z9.string().trim().min(1).max(NOTIFY_LIMITS.nameMax).regex(/^[^\p{Cc}]*$/u),
1456
- timezone: z9.string().trim().min(1).max(64).refine(validTimeZone),
1740
+ var policyInputSchema = z12.object({
1741
+ name: z12.string().trim().min(1).max(NOTIFY_LIMITS.nameMax).regex(/^[^\p{Cc}]*$/u),
1742
+ timezone: z12.string().trim().min(1).max(64).refine(validTimeZone),
1457
1743
  quietHours: quietHoursSchema.nullable(),
1458
- quietSeverities: z9.array(z9.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1459
- digest: z9.enum(DIGEST_MODES),
1744
+ quietSeverities: z12.array(z12.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1745
+ digest: z12.enum(DIGEST_MODES),
1460
1746
  digestAt: timeOfDay2.nullable(),
1461
- digestSeverities: z9.array(z9.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1462
- fallback: z9.array(z9.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique),
1463
- escalateAfterMinutes: z9.number().int().min(NOTIFY_LIMITS.escalateMinutesMin).max(NOTIFY_LIMITS.escalateMinutesMax).nullable(),
1464
- escalation: z9.array(z9.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique)
1747
+ digestSeverities: z12.array(z12.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1748
+ fallback: z12.array(z12.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique),
1749
+ escalateAfterMinutes: z12.number().int().min(NOTIFY_LIMITS.escalateMinutesMin).max(NOTIFY_LIMITS.escalateMinutesMax).nullable(),
1750
+ escalation: z12.array(z12.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique)
1465
1751
  }).superRefine((p, ctx) => {
1466
1752
  if (p.digest === "daily" !== (p.digestAt !== null))
1467
1753
  ctx.addIssue({ code: "custom", path: ["digestAt"], message: "digest_at" });
@@ -1473,46 +1759,46 @@ var HOUR = 60 * MIN;
1473
1759
  var DAY = 24 * HOUR;
1474
1760
 
1475
1761
  // ../src/shared/contracts/api-ops/incidents.ts
1476
- var incidentOnly = z10.object({ workspaceId: uuid, incidentId: uuid });
1477
- var note = z10.string().trim().min(1).max(2000).regex(/^[^\u0000-\u0008\u000b\u000c\u000e-\u001f]*$/);
1762
+ var incidentOnly = z13.object({ workspaceId: uuid, incidentId: uuid });
1763
+ var note2 = z13.string().trim().min(1).max(2000).regex(/^[^\u0000-\u0008\u000b\u000c\u000e-\u001f]*$/);
1478
1764
  var INCIDENT_KINDS = ["monitor", "uptime", "slo", "issue"];
1479
1765
  var INCIDENT_GROUP_BY = ["monitor", "project_env"];
1480
- var incidentRuleInputSchema = z10.object({
1481
- name: z10.string().trim().min(1).max(80).regex(/^[^\p{Cc}]*$/u),
1482
- isEnabled: z10.boolean(),
1483
- position: z10.number().int().min(0).max(1000).default(0),
1484
- projectIds: z10.array(z10.number().int().positive()).max(50),
1485
- environments: z10.array(z10.string().trim().min(1).max(64)).max(20),
1486
- kinds: z10.array(z10.enum(INCIDENT_KINDS)).min(1).max(4),
1487
- minSeverity: z10.enum(SEVERITIES),
1488
- groupBy: z10.enum(INCIDENT_GROUP_BY),
1489
- windowMinutes: z10.number().int().min(5).max(240),
1490
- recoveryHoldMinutes: z10.number().int().min(0).max(1440)
1766
+ var incidentRuleInputSchema = z13.object({
1767
+ name: z13.string().trim().min(1).max(80).regex(/^[^\p{Cc}]*$/u),
1768
+ isEnabled: z13.boolean(),
1769
+ position: z13.number().int().min(0).max(1000).default(0),
1770
+ projectIds: z13.array(z13.number().int().positive()).max(50),
1771
+ environments: z13.array(z13.string().trim().min(1).max(64)).max(20),
1772
+ kinds: z13.array(z13.enum(INCIDENT_KINDS)).min(1).max(4),
1773
+ minSeverity: z13.enum(SEVERITIES),
1774
+ groupBy: z13.enum(INCIDENT_GROUP_BY),
1775
+ windowMinutes: z13.number().int().min(5).max(240),
1776
+ recoveryHoldMinutes: z13.number().int().min(0).max(1440)
1491
1777
  });
1492
1778
  var INCIDENT_INPUTS = {
1493
- list: z10.object({
1779
+ list: z13.object({
1494
1780
  workspaceId: uuid,
1495
1781
  limit: pageLimit,
1496
1782
  cursor,
1497
- state: z10.enum(["active", "resolved", "all"]).default("all")
1783
+ state: z13.enum(["active", "resolved", "all"]).default("all")
1498
1784
  }),
1499
1785
  incidentOnly,
1500
- resolve: incidentOnly.extend({ note: note.max(500) }),
1501
- note: incidentOnly.extend({ note }),
1786
+ resolve: incidentOnly.extend({ note: note2.max(500) }),
1787
+ note: incidentOnly.extend({ note: note2 }),
1502
1788
  update: incidentOnly.extend({
1503
- title: z10.string().trim().min(1).max(120).regex(/^[^\p{Cc}]*$/u).optional(),
1789
+ title: z13.string().trim().min(1).max(120).regex(/^[^\p{Cc}]*$/u).optional(),
1504
1790
  ownerUserId: uuid.nullable().optional()
1505
1791
  }),
1506
- workspace: z10.object({ workspaceId: uuid }),
1507
- saveRule: z10.object({ workspaceId: uuid, ruleId: uuid.nullable(), input: incidentRuleInputSchema }),
1508
- ruleOnly: z10.object({ workspaceId: uuid, ruleId: uuid }),
1509
- savePolicy: z10.object({
1792
+ workspace: z13.object({ workspaceId: uuid }),
1793
+ saveRule: z13.object({ workspaceId: uuid, ruleId: uuid.nullable(), input: incidentRuleInputSchema }),
1794
+ ruleOnly: z13.object({ workspaceId: uuid, ruleId: uuid }),
1795
+ savePolicy: z13.object({
1510
1796
  workspaceId: uuid,
1511
1797
  policyId: uuid.nullable(),
1512
- isDefault: z10.boolean(),
1798
+ isDefault: z13.boolean(),
1513
1799
  input: policyInputSchema
1514
1800
  }),
1515
- policyOnly: z10.object({ workspaceId: uuid, policyId: uuid })
1801
+ policyOnly: z13.object({ workspaceId: uuid, policyId: uuid })
1516
1802
  };
1517
1803
  var I = INCIDENT_INPUTS;
1518
1804
  var w = "incidents:write";
@@ -1701,20 +1987,20 @@ var INCIDENT_OPERATIONS = [
1701
1987
  ];
1702
1988
 
1703
1989
  // ../src/shared/contracts/api-ops/monitors.ts
1704
- import { z as z15 } from "zod";
1990
+ import { z as z18 } from "zod";
1705
1991
 
1706
1992
  // ../src/shared/contracts/heartbeat.ts
1707
- import { z as z12 } from "zod";
1993
+ import { z as z15 } from "zod";
1708
1994
 
1709
1995
  // ../src/shared/contracts/signed-message.ts
1710
- import { z as z11 } from "zod";
1711
- var nodeIdSchema = z11.guid();
1712
- var signedEnvelopeSchema = z11.object({
1996
+ import { z as z14 } from "zod";
1997
+ var nodeIdSchema = z14.guid();
1998
+ var signedEnvelopeSchema = z14.object({
1713
1999
  node_id: nodeIdSchema,
1714
- ts: z11.number().int().positive(),
1715
- nonce: z11.string().regex(/^[A-Za-z0-9_-]{16,64}$/),
1716
- payload: z11.record(z11.string(), z11.unknown()),
1717
- sig: z11.string().regex(/^[A-Za-z0-9_-]{86}$/)
2000
+ ts: z14.number().int().positive(),
2001
+ nonce: z14.string().regex(/^[A-Za-z0-9_-]{16,64}$/),
2002
+ payload: z14.record(z14.string(), z14.unknown()),
2003
+ sig: z14.string().regex(/^[A-Za-z0-9_-]{86}$/)
1718
2004
  });
1719
2005
 
1720
2006
  // ../src/shared/contracts/heartbeat.ts
@@ -1752,78 +2038,78 @@ var HEARTBEAT_LIMITS = {
1752
2038
  diagnosticsPerRun: 5
1753
2039
  };
1754
2040
  var PAUSED_FOREVER_MS = Date.parse("9999-12-31T00:00:00.000Z");
1755
- var uuid2 = z12.guid();
1756
- var ms = z12.number().int().nonnegative();
1757
- var hex64 = z12.string().regex(/^[0-9a-f]{64}$/);
1758
- var envName2 = z12.string().min(1).max(MONITOR_LIMITS.environmentMax);
1759
- var heartbeatMonitorConfigSchema = z12.object({
2041
+ var uuid2 = z15.guid();
2042
+ var ms = z15.number().int().nonnegative();
2043
+ var hex64 = z15.string().regex(/^[0-9a-f]{64}$/);
2044
+ var envName2 = z15.string().min(1).max(MONITOR_LIMITS.environmentMax);
2045
+ var heartbeatMonitorConfigSchema = z15.object({
1760
2046
  id: uuid2,
1761
- project_id: z12.number().int().positive(),
1762
- slug: z12.string().regex(SLUG_RE),
2047
+ project_id: z15.number().int().positive(),
2048
+ slug: z15.string().regex(SLUG_RE),
1763
2049
  environment: envName2,
1764
2050
  schedule: scheduleSchema,
1765
- timezone: z12.string().min(1).max(64),
1766
- grace_min: z12.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1767
- max_runtime_min: z12.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1768
- failure_threshold: z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1769
- recovery_threshold: z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
2051
+ timezone: z15.string().min(1).max(64),
2052
+ grace_min: z15.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
2053
+ max_runtime_min: z15.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
2054
+ failure_threshold: z15.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
2055
+ recovery_threshold: z15.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1770
2056
  paused_until: ms.nullable(),
1771
2057
  created_at: ms
1772
2058
  });
1773
- var heartbeatTokenConfigSchema = z12.object({
2059
+ var heartbeatTokenConfigSchema = z15.object({
1774
2060
  id: uuid2,
1775
2061
  monitor_id: uuid2,
1776
2062
  hash: hex64,
1777
2063
  expires_at: ms.nullable()
1778
2064
  });
1779
- var heartbeatSyncSchema = z12.object({
1780
- v: z12.literal(1),
2065
+ var heartbeatSyncSchema = z15.object({
2066
+ v: z15.literal(1),
1781
2067
  workspace_id: uuid2,
1782
- route: z12.string().regex(PING_ROUTE_RE),
1783
- revision: z12.number().int().positive(),
1784
- workspace_status: z12.enum(["active", "suspended", "deleting"]),
1785
- ingest_kill: z12.boolean(),
1786
- limits: z12.object({
1787
- check_in_rate_per_sec: z12.number().int().positive(),
1788
- check_in_burst: z12.number().int().positive(),
1789
- monthly_check_in_cap: z12.number().int().positive()
1790
- }),
1791
- projects: z12.array(z12.object({ id: z12.number().int().positive(), node_id: nodeIdSchema.nullable() })).max(1000),
1792
- monitors: z12.array(heartbeatMonitorConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace),
1793
- tokens: z12.array(heartbeatTokenConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
2068
+ route: z15.string().regex(PING_ROUTE_RE),
2069
+ revision: z15.number().int().positive(),
2070
+ workspace_status: z15.enum(["active", "suspended", "deleting"]),
2071
+ ingest_kill: z15.boolean(),
2072
+ limits: z15.object({
2073
+ check_in_rate_per_sec: z15.number().int().positive(),
2074
+ check_in_burst: z15.number().int().positive(),
2075
+ monthly_check_in_cap: z15.number().int().positive()
2076
+ }),
2077
+ projects: z15.array(z15.object({ id: z15.number().int().positive(), node_id: nodeIdSchema.nullable() })).max(1000),
2078
+ monitors: z15.array(heartbeatMonitorConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace),
2079
+ tokens: z15.array(heartbeatTokenConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
1794
2080
  });
1795
- var signedHeartbeatSyncSchema = z12.object({
1796
- body: z12.string().min(2).max(4 * 1024 * 1024),
1797
- ts: z12.number().int().positive(),
1798
- kid: z12.string().regex(/^[A-Za-z0-9_-]{1,40}$/),
1799
- sig: z12.string().regex(/^[A-Za-z0-9_-]{86}$/)
2081
+ var signedHeartbeatSyncSchema = z15.object({
2082
+ body: z15.string().min(2).max(4 * 1024 * 1024),
2083
+ ts: z15.number().int().positive(),
2084
+ kid: z15.string().regex(/^[A-Za-z0-9_-]{1,40}$/),
2085
+ sig: z15.string().regex(/^[A-Za-z0-9_-]{86}$/)
1800
2086
  });
1801
- var heartbeatHourSchema = z12.object({
2087
+ var heartbeatHourSchema = z15.object({
1802
2088
  monitor_id: uuid2,
1803
- hour: z12.string().datetime(),
1804
- ok: z12.number().int().nonnegative(),
1805
- failed: z12.number().int().nonnegative(),
1806
- started: z12.number().int().nonnegative(),
1807
- missed: z12.number().int().nonnegative(),
1808
- logs: z12.number().int().nonnegative()
2089
+ hour: z15.string().datetime(),
2090
+ ok: z15.number().int().nonnegative(),
2091
+ failed: z15.number().int().nonnegative(),
2092
+ started: z15.number().int().nonnegative(),
2093
+ missed: z15.number().int().nonnegative(),
2094
+ logs: z15.number().int().nonnegative()
1809
2095
  });
1810
- var heartbeatReportSchema = z12.object({
1811
- v: z12.literal(1),
2096
+ var heartbeatReportSchema = z15.object({
2097
+ v: z15.literal(1),
1812
2098
  workspace_id: uuid2,
1813
- route: z12.string().regex(PING_ROUTE_RE),
1814
- revision: z12.number().int().nonnegative(),
1815
- sent_at: z12.string().datetime(),
1816
- incidents: z12.array(monitorIncidentSchema).max(HEARTBEAT_LIMITS.reportMaxIncidents),
1817
- statuses: z12.array(monitorStatusSchema).max(HEARTBEAT_LIMITS.reportMaxStatuses),
1818
- hours: z12.array(heartbeatHourSchema).max(HEARTBEAT_LIMITS.reportMaxHours),
1819
- token_uses: z12.array(z12.object({ token_id: uuid2, last_used_at: z12.string().datetime() })).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
2099
+ route: z15.string().regex(PING_ROUTE_RE),
2100
+ revision: z15.number().int().nonnegative(),
2101
+ sent_at: z15.string().datetime(),
2102
+ incidents: z15.array(monitorIncidentSchema).max(HEARTBEAT_LIMITS.reportMaxIncidents),
2103
+ statuses: z15.array(monitorStatusSchema).max(HEARTBEAT_LIMITS.reportMaxStatuses),
2104
+ hours: z15.array(heartbeatHourSchema).max(HEARTBEAT_LIMITS.reportMaxHours),
2105
+ token_uses: z15.array(z15.object({ token_id: uuid2, last_used_at: z15.string().datetime() })).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
1820
2106
  });
1821
2107
  var ENCODER = new TextEncoder;
1822
2108
  var UTF8 = new TextDecoder("utf-8", { fatal: false, ignoreBOM: false });
1823
2109
  var TOKEN_IN_TEXT = new RegExp(PING_TOKEN_PATTERN, "g");
1824
2110
 
1825
2111
  // ../src/shared/contracts/slo.ts
1826
- import { z as z13 } from "zod";
2112
+ import { z as z16 } from "zod";
1827
2113
 
1828
2114
  // ../src/shared/contracts/vocab/slo.ts
1829
2115
  var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans"];
@@ -1855,17 +2141,17 @@ var SLO_SOURCE_META = {
1855
2141
  heartbeat: { provenance: "ping_token", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
1856
2142
  spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" }
1857
2143
  };
1858
- var nodeSloSchema = z13.object({
1859
- slo_id: z13.guid(),
1860
- project_id: z13.number().int().positive(),
1861
- source: z13.enum(["monitor", "spans"]),
1862
- sli: z13.enum(SLO_SLIS),
1863
- monitor_id: z13.guid().optional(),
1864
- environment: z13.string().min(1).max(SLO_LIMITS.environmentMaxChars).optional(),
1865
- service: z13.string().min(1).max(128).optional(),
1866
- operation: z13.string().min(1).max(256).optional(),
1867
- latency_threshold_ms: z13.number().int().min(1).max(60000).optional(),
1868
- public_sources: z13.boolean()
2144
+ var nodeSloSchema = z16.object({
2145
+ slo_id: z16.guid(),
2146
+ project_id: z16.number().int().positive(),
2147
+ source: z16.enum(["monitor", "spans"]),
2148
+ sli: z16.enum(SLO_SLIS),
2149
+ monitor_id: z16.guid().optional(),
2150
+ environment: z16.string().min(1).max(SLO_LIMITS.environmentMaxChars).optional(),
2151
+ service: z16.string().min(1).max(128).optional(),
2152
+ operation: z16.string().min(1).max(256).optional(),
2153
+ latency_threshold_ms: z16.number().int().min(1).max(60000).optional(),
2154
+ public_sources: z16.boolean()
1869
2155
  }).superRefine((v, ctx) => {
1870
2156
  if (v.source === "monitor" && (!v.monitor_id || v.sli !== "availability"))
1871
2157
  ctx.addIssue({ code: "custom", path: ["monitor_id"], message: "INVALID_INPUT" });
@@ -1874,27 +2160,27 @@ var nodeSloSchema = z13.object({
1874
2160
  if (v.sli === "latency" !== (v.latency_threshold_ms !== undefined))
1875
2161
  ctx.addIssue({ code: "custom", path: ["latency_threshold_ms"], message: "INVALID_INPUT" });
1876
2162
  });
1877
- var sliCountsSchema = z13.object({
1878
- minute: z13.string().datetime(),
1879
- items: z13.array(z13.object({ slo_id: z13.guid(), good: z13.number().int().min(0), total: z13.number().int().min(0) }).refine((x) => x.good <= x.total, { message: "INVALID_INPUT" })).max(SLO_LIMITS.sliItemsPerMessage)
2163
+ var sliCountsSchema = z16.object({
2164
+ minute: z16.string().datetime(),
2165
+ items: z16.array(z16.object({ slo_id: z16.guid(), good: z16.number().int().min(0), total: z16.number().int().min(0) }).refine((x) => x.good <= x.total, { message: "INVALID_INPUT" })).max(SLO_LIMITS.sliItemsPerMessage)
1880
2166
  });
1881
- var sloInputSchema = z13.object({
1882
- name: z13.string().trim().min(1).max(SLO_LIMITS.nameMaxChars),
1883
- description: z13.string().max(SLO_LIMITS.descriptionMaxChars).default(""),
1884
- source: z13.enum(SLO_SOURCES),
1885
- sourceRef: z13.object({
1886
- id: z13.guid().optional(),
1887
- projectId: z13.number().int().positive().optional(),
1888
- service: z13.string().max(128).optional(),
1889
- operation: z13.string().max(256).optional(),
1890
- environment: z13.string().max(SLO_LIMITS.environmentMaxChars).optional()
1891
- }),
1892
- sli: z13.enum(SLO_SLIS),
1893
- latencyThresholdMs: z13.number().int().min(1).max(60000).nullable(),
1894
- objective: z13.number().min(SLO_LIMITS.objectiveMin).max(SLO_LIMITS.objectiveMax),
1895
- windowDays: z13.union([z13.literal(7), z13.literal(28), z13.literal(30)]),
1896
- alertPolicy: z13.enum(SLO_ALERT_POLICIES),
1897
- allowPublicSources: z13.boolean().default(false)
2167
+ var sloInputSchema = z16.object({
2168
+ name: z16.string().trim().min(1).max(SLO_LIMITS.nameMaxChars),
2169
+ description: z16.string().max(SLO_LIMITS.descriptionMaxChars).default(""),
2170
+ source: z16.enum(SLO_SOURCES),
2171
+ sourceRef: z16.object({
2172
+ id: z16.guid().optional(),
2173
+ projectId: z16.number().int().positive().optional(),
2174
+ service: z16.string().max(128).optional(),
2175
+ operation: z16.string().max(256).optional(),
2176
+ environment: z16.string().max(SLO_LIMITS.environmentMaxChars).optional()
2177
+ }),
2178
+ sli: z16.enum(SLO_SLIS),
2179
+ latencyThresholdMs: z16.number().int().min(1).max(60000).nullable(),
2180
+ objective: z16.number().min(SLO_LIMITS.objectiveMin).max(SLO_LIMITS.objectiveMax),
2181
+ windowDays: z16.union([z16.literal(7), z16.literal(28), z16.literal(30)]),
2182
+ alertPolicy: z16.enum(SLO_ALERT_POLICIES),
2183
+ allowPublicSources: z16.boolean().default(false)
1898
2184
  }).superRefine((v, ctx) => {
1899
2185
  if (!SLO_SOURCE_META[v.source].slis.includes(v.sli))
1900
2186
  ctx.addIssue({ code: "custom", path: ["sli"], message: "INVALID_INPUT" });
@@ -1909,7 +2195,7 @@ var sloInputSchema = z13.object({
1909
2195
  });
1910
2196
 
1911
2197
  // ../src/shared/contracts/uptime.ts
1912
- import { z as z14 } from "zod";
2198
+ import { z as z17 } from "zod";
1913
2199
 
1914
2200
  // ../src/shared/contracts/vocab/uptime.ts
1915
2201
  var UPTIME_STATUSES = ["up", "degraded", "down", "unknown", "paused", "pending"];
@@ -1982,51 +2268,51 @@ function isForbiddenHeader(name) {
1982
2268
  const n = name.trim().toLowerCase();
1983
2269
  return UPTIME_FORBIDDEN_HEADERS.includes(n) || n.startsWith("proxy-") || n.startsWith("sec-");
1984
2270
  }
1985
- var text = z14.string().min(1).max(UPTIME_LIMITS.assertionTextMax);
1986
- var statusRange = z14.string().regex(/^[1-5][0-9]{2}(-[1-5][0-9]{2})?$/);
1987
- var assertionSchema = z14.discriminatedUnion("type", [
1988
- z14.object({ type: z14.literal("status"), in: z14.array(statusRange).min(1).max(10) }),
1989
- z14.object({ type: z14.literal("body_contains"), value: text, case_sensitive: z14.boolean().default(true) }),
1990
- z14.object({ type: z14.literal("body_not_contains"), value: text, case_sensitive: z14.boolean().default(true) }),
1991
- z14.object({
1992
- type: z14.literal("json_pointer"),
1993
- pointer: z14.string().max(256).regex(/^(\/([^~/]|~0|~1)*)*$/),
1994
- op: z14.enum(["exists", "equals", "type"]),
1995
- value: z14.string().max(UPTIME_LIMITS.assertionTextMax).optional()
1996
- }),
1997
- z14.object({
1998
- type: z14.literal("header"),
1999
- name: z14.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
2000
- op: z14.enum(["equals", "contains", "exists"]),
2001
- value: z14.string().max(UPTIME_LIMITS.assertionTextMax).optional()
2002
- }),
2003
- z14.object({ type: z14.literal("latency_ms"), lt: z14.number().int().min(1).max(60000) }),
2004
- z14.object({ type: z14.literal("tls_valid") })
2271
+ var text = z17.string().min(1).max(UPTIME_LIMITS.assertionTextMax);
2272
+ var statusRange = z17.string().regex(/^[1-5][0-9]{2}(-[1-5][0-9]{2})?$/);
2273
+ var assertionSchema = z17.discriminatedUnion("type", [
2274
+ z17.object({ type: z17.literal("status"), in: z17.array(statusRange).min(1).max(10) }),
2275
+ z17.object({ type: z17.literal("body_contains"), value: text, case_sensitive: z17.boolean().default(true) }),
2276
+ z17.object({ type: z17.literal("body_not_contains"), value: text, case_sensitive: z17.boolean().default(true) }),
2277
+ z17.object({
2278
+ type: z17.literal("json_pointer"),
2279
+ pointer: z17.string().max(256).regex(/^(\/([^~/]|~0|~1)*)*$/),
2280
+ op: z17.enum(["exists", "equals", "type"]),
2281
+ value: z17.string().max(UPTIME_LIMITS.assertionTextMax).optional()
2282
+ }),
2283
+ z17.object({
2284
+ type: z17.literal("header"),
2285
+ name: z17.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
2286
+ op: z17.enum(["equals", "contains", "exists"]),
2287
+ value: z17.string().max(UPTIME_LIMITS.assertionTextMax).optional()
2288
+ }),
2289
+ z17.object({ type: z17.literal("latency_ms"), lt: z17.number().int().min(1).max(60000) }),
2290
+ z17.object({ type: z17.literal("tls_valid") })
2005
2291
  ]);
2006
- var header = z14.object({
2007
- name: z14.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
2008
- value: z14.string().max(UPTIME_LIMITS.headerValueMax).regex(/^[^\r\n\u0000]*$/)
2292
+ var header = z17.object({
2293
+ name: z17.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
2294
+ value: z17.string().max(UPTIME_LIMITS.headerValueMax).regex(/^[^\r\n\u0000]*$/)
2009
2295
  });
2010
- var uptimeCheckInputSchema = z14.object({
2011
- projectId: z14.number().int().positive(),
2012
- name: z14.string().trim().min(1).max(UPTIME_LIMITS.nameMaxChars),
2013
- kind: z14.enum(UPTIME_KINDS),
2014
- url: z14.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
2015
- host: z14.string().max(253).nullable(),
2016
- port: z14.number().int().min(1).max(65535).nullable(),
2017
- method: z14.enum(UPTIME_METHODS).default("GET"),
2018
- headers: z14.array(header).max(UPTIME_LIMITS.headersMax).default([]),
2019
- followRedirects: z14.boolean().default(false),
2020
- timeoutMs: z14.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
2021
- intervalSeconds: z14.number().int().refine((n) => UPTIME_INTERVALS.includes(n)),
2022
- regions: z14.array(z14.enum(UPTIME_REGIONS)).min(UPTIME_LIMITS.minRegions).max(UPTIME_REGIONS.length),
2023
- assertions: z14.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax).default([]),
2024
- failureThreshold: z14.number().int().min(1).max(5),
2025
- recoveryThreshold: z14.number().int().min(1).max(5),
2026
- certWarningDays: z14.number().int().min(1).max(60),
2027
- environment: z14.string().trim().max(64).default(""),
2028
- strictMetadata: z14.boolean().default(false),
2029
- evidenceOnFailure: z14.boolean().default(true)
2296
+ var uptimeCheckInputSchema = z17.object({
2297
+ projectId: z17.number().int().positive(),
2298
+ name: z17.string().trim().min(1).max(UPTIME_LIMITS.nameMaxChars),
2299
+ kind: z17.enum(UPTIME_KINDS),
2300
+ url: z17.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
2301
+ host: z17.string().max(253).nullable(),
2302
+ port: z17.number().int().min(1).max(65535).nullable(),
2303
+ method: z17.enum(UPTIME_METHODS).default("GET"),
2304
+ headers: z17.array(header).max(UPTIME_LIMITS.headersMax).default([]),
2305
+ followRedirects: z17.boolean().default(false),
2306
+ timeoutMs: z17.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
2307
+ intervalSeconds: z17.number().int().refine((n) => UPTIME_INTERVALS.includes(n)),
2308
+ regions: z17.array(z17.enum(UPTIME_REGIONS)).min(UPTIME_LIMITS.minRegions).max(UPTIME_REGIONS.length),
2309
+ assertions: z17.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax).default([]),
2310
+ failureThreshold: z17.number().int().min(1).max(5),
2311
+ recoveryThreshold: z17.number().int().min(1).max(5),
2312
+ certWarningDays: z17.number().int().min(1).max(60),
2313
+ environment: z17.string().trim().max(64).default(""),
2314
+ strictMetadata: z17.boolean().default(false),
2315
+ evidenceOnFailure: z17.boolean().default(true)
2030
2316
  }).superRefine((v, ctx) => {
2031
2317
  if (v.kind === "http" && !v.url)
2032
2318
  ctx.addIssue({ code: "custom", path: ["url"], message: "INVALID_INPUT" });
@@ -2037,243 +2323,243 @@ var uptimeCheckInputSchema = z14.object({
2037
2323
  if (v.headers.some((h) => isForbiddenHeader(h.name)))
2038
2324
  ctx.addIssue({ code: "custom", path: ["headers"], message: "UPTIME_HEADER_FORBIDDEN" });
2039
2325
  });
2040
- var uptimeDefinitionSchema = z14.object({
2041
- check_id: z14.guid(),
2042
- workspace_id: z14.guid(),
2043
- project_id: z14.number().int().positive(),
2044
- revision: z14.number().int().nonnegative(),
2045
- kind: z14.enum(UPTIME_KINDS),
2046
- url: z14.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
2047
- host: z14.string().max(253).nullable(),
2048
- port: z14.number().int().min(1).max(65535).nullable(),
2049
- method: z14.enum(UPTIME_METHODS),
2050
- headers: z14.array(header).max(UPTIME_LIMITS.headersMax),
2051
- follow_redirects: z14.boolean(),
2052
- timeout_ms: z14.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
2053
- interval_seconds: z14.number().int().positive(),
2054
- regions: z14.array(z14.enum(UPTIME_REGIONS)).min(1).max(3),
2055
- assertions: z14.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax),
2056
- failure_threshold: z14.number().int().min(1).max(5),
2057
- recovery_threshold: z14.number().int().min(1).max(5),
2058
- cert_warning_days: z14.number().int().min(1).max(60),
2059
- strict_metadata: z14.boolean(),
2060
- evidence_on_failure: z14.boolean(),
2061
- paused_until: z14.string().nullable(),
2062
- muted_until: z14.string().nullable()
2326
+ var uptimeDefinitionSchema = z17.object({
2327
+ check_id: z17.guid(),
2328
+ workspace_id: z17.guid(),
2329
+ project_id: z17.number().int().positive(),
2330
+ revision: z17.number().int().nonnegative(),
2331
+ kind: z17.enum(UPTIME_KINDS),
2332
+ url: z17.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
2333
+ host: z17.string().max(253).nullable(),
2334
+ port: z17.number().int().min(1).max(65535).nullable(),
2335
+ method: z17.enum(UPTIME_METHODS),
2336
+ headers: z17.array(header).max(UPTIME_LIMITS.headersMax),
2337
+ follow_redirects: z17.boolean(),
2338
+ timeout_ms: z17.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
2339
+ interval_seconds: z17.number().int().positive(),
2340
+ regions: z17.array(z17.enum(UPTIME_REGIONS)).min(1).max(3),
2341
+ assertions: z17.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax),
2342
+ failure_threshold: z17.number().int().min(1).max(5),
2343
+ recovery_threshold: z17.number().int().min(1).max(5),
2344
+ cert_warning_days: z17.number().int().min(1).max(60),
2345
+ strict_metadata: z17.boolean(),
2346
+ evidence_on_failure: z17.boolean(),
2347
+ paused_until: z17.string().nullable(),
2348
+ muted_until: z17.string().nullable()
2063
2349
  });
2064
- var timingsSchema = z14.object({
2065
- dns_ms: z14.number().nonnegative().max(60000).nullable(),
2066
- connect_ms: z14.number().nonnegative().max(60000).nullable(),
2067
- tls_ms: z14.number().nonnegative().max(60000).nullable(),
2068
- ttfb_ms: z14.number().nonnegative().max(60000).nullable(),
2069
- download_ms: z14.number().nonnegative().max(60000).nullable(),
2070
- total_ms: z14.number().nonnegative().max(60000)
2350
+ var timingsSchema = z17.object({
2351
+ dns_ms: z17.number().nonnegative().max(60000).nullable(),
2352
+ connect_ms: z17.number().nonnegative().max(60000).nullable(),
2353
+ tls_ms: z17.number().nonnegative().max(60000).nullable(),
2354
+ ttfb_ms: z17.number().nonnegative().max(60000).nullable(),
2355
+ download_ms: z17.number().nonnegative().max(60000).nullable(),
2356
+ total_ms: z17.number().nonnegative().max(60000)
2071
2357
  });
2072
- var probeResultSchema = z14.object({
2073
- check_id: z14.guid(),
2074
- revision: z14.number().int().nonnegative(),
2075
- slot: z14.number().int().nonnegative(),
2076
- region: z14.enum(UPTIME_REGIONS),
2077
- run_now: z14.string().max(64).optional(),
2078
- scheduled_at: z14.number().int().positive(),
2079
- started_at: z14.number().int().positive(),
2080
- outcome: z14.enum(UPTIME_OUTCOMES),
2081
- reason: z14.enum(UPTIME_REASONS).nullable(),
2082
- reason_group: z14.enum(UPTIME_REASON_GROUPS).nullable(),
2083
- status_code: z14.number().int().min(100).max(599).nullable(),
2358
+ var probeResultSchema = z17.object({
2359
+ check_id: z17.guid(),
2360
+ revision: z17.number().int().nonnegative(),
2361
+ slot: z17.number().int().nonnegative(),
2362
+ region: z17.enum(UPTIME_REGIONS),
2363
+ run_now: z17.string().max(64).optional(),
2364
+ scheduled_at: z17.number().int().positive(),
2365
+ started_at: z17.number().int().positive(),
2366
+ outcome: z17.enum(UPTIME_OUTCOMES),
2367
+ reason: z17.enum(UPTIME_REASONS).nullable(),
2368
+ reason_group: z17.enum(UPTIME_REASON_GROUPS).nullable(),
2369
+ status_code: z17.number().int().min(100).max(599).nullable(),
2084
2370
  timings: timingsSchema.nullable(),
2085
- ip_family: z14.enum(["v4", "v6"]).nullable(),
2086
- http_version: z14.string().max(8).nullable(),
2087
- cert_not_after: z14.number().int().positive().nullable(),
2088
- cert_issuer: z14.string().max(200).nullable(),
2089
- cert_expiring: z14.boolean(),
2090
- evidence_sealed: z14.string().max(16384).nullable()
2371
+ ip_family: z17.enum(["v4", "v6"]).nullable(),
2372
+ http_version: z17.string().max(8).nullable(),
2373
+ cert_not_after: z17.number().int().positive().nullable(),
2374
+ cert_issuer: z17.string().max(200).nullable(),
2375
+ cert_expiring: z17.boolean(),
2376
+ evidence_sealed: z17.string().max(16384).nullable()
2091
2377
  });
2092
- var probeIdSchema = z14.string().regex(/^probe-(eu|us|ap)-[a-z0-9]{4,16}$/);
2093
- var resultBatchSchema = z14.object({
2094
- v: z14.literal(1),
2378
+ var probeIdSchema = z17.string().regex(/^probe-(eu|us|ap)-[a-z0-9]{4,16}$/);
2379
+ var resultBatchSchema = z17.object({
2380
+ v: z17.literal(1),
2095
2381
  probe_id: probeIdSchema,
2096
- region: z14.enum(UPTIME_REGIONS),
2097
- version: z14.string().max(40),
2098
- sent_at: z14.number().int().positive(),
2099
- results: z14.array(probeResultSchema).max(UPTIME_LIMITS.resultsBatchMax),
2100
- stats: z14.object({ lag_p99_ms: z14.number().nonnegative(), checks_per_min: z14.number().nonnegative() })
2382
+ region: z17.enum(UPTIME_REGIONS),
2383
+ version: z17.string().max(40),
2384
+ sent_at: z17.number().int().positive(),
2385
+ results: z17.array(probeResultSchema).max(UPTIME_LIMITS.resultsBatchMax),
2386
+ stats: z17.object({ lag_p99_ms: z17.number().nonnegative(), checks_per_min: z17.number().nonnegative() })
2101
2387
  });
2102
2388
  var assignmentSchema = uptimeDefinitionSchema.omit({ workspace_id: true, paused_until: true, muted_until: true }).extend({
2103
- seal_public_key: z14.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable()
2389
+ seal_public_key: z17.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable()
2104
2390
  });
2105
- var assignmentsSchema = z14.object({
2106
- v: z14.literal(1),
2107
- region: z14.enum(UPTIME_REGIONS),
2108
- revision: z14.number().int().nonnegative(),
2109
- issued_at: z14.number().int().positive(),
2110
- checks: z14.array(assignmentSchema).max(50000),
2111
- denied_hosts: z14.array(z14.string().max(253)).max(1e4),
2112
- run_now: z14.array(z14.object({ id: z14.string().max(64), check_id: z14.guid(), expires_at: z14.number().int() })).max(500)
2391
+ var assignmentsSchema = z17.object({
2392
+ v: z17.literal(1),
2393
+ region: z17.enum(UPTIME_REGIONS),
2394
+ revision: z17.number().int().nonnegative(),
2395
+ issued_at: z17.number().int().positive(),
2396
+ checks: z17.array(assignmentSchema).max(50000),
2397
+ denied_hosts: z17.array(z17.string().max(253)).max(1e4),
2398
+ run_now: z17.array(z17.object({ id: z17.string().max(64), check_id: z17.guid(), expires_at: z17.number().int() })).max(500)
2113
2399
  });
2114
- var uuid3 = z14.guid();
2115
- var b64key = z14.string().regex(/^[A-Za-z0-9_-]{43}$/);
2116
- var iso2 = z14.string().datetime();
2117
- var uptimeSyncSchema = z14.object({
2118
- v: z14.literal(1),
2400
+ var uuid3 = z17.guid();
2401
+ var b64key = z17.string().regex(/^[A-Za-z0-9_-]{43}$/);
2402
+ var iso4 = z17.string().datetime();
2403
+ var uptimeSyncSchema = z17.object({
2404
+ v: z17.literal(1),
2119
2405
  workspace_id: uuid3,
2120
- revision: z14.number().int().positive(),
2121
- workspace_status: z14.enum(["active", "suspended", "deleting"]),
2122
- suspended: z14.boolean(),
2123
- checks: z14.array(uptimeDefinitionSchema).max(UPTIME_LIMITS.maxChecksPerWorkspace),
2124
- projects: z14.array(z14.object({ id: z14.number().int().positive(), node_id: z14.guid().nullable(), seal_public_key: b64key.nullable() })).max(1000)
2406
+ revision: z17.number().int().positive(),
2407
+ workspace_status: z17.enum(["active", "suspended", "deleting"]),
2408
+ suspended: z17.boolean(),
2409
+ checks: z17.array(uptimeDefinitionSchema).max(UPTIME_LIMITS.maxChecksPerWorkspace),
2410
+ projects: z17.array(z17.object({ id: z17.number().int().positive(), node_id: z17.guid().nullable(), seal_public_key: b64key.nullable() })).max(1000)
2125
2411
  });
2126
- var uptimeReconcileSchema = z14.object({
2127
- v: z14.literal(1),
2128
- as_of: z14.number().int().positive(),
2129
- workspace_ids: z14.array(uuid3).max(UPTIME_LIMITS.reconcileMaxWorkspaces),
2130
- heartbeat_routes: z14.array(z14.string().regex(PING_ROUTE_RE)).max(UPTIME_LIMITS.reconcileMaxWorkspaces).optional()
2412
+ var uptimeReconcileSchema = z17.object({
2413
+ v: z17.literal(1),
2414
+ as_of: z17.number().int().positive(),
2415
+ workspace_ids: z17.array(uuid3).max(UPTIME_LIMITS.reconcileMaxWorkspaces),
2416
+ heartbeat_routes: z17.array(z17.string().regex(PING_ROUTE_RE)).max(UPTIME_LIMITS.reconcileMaxWorkspaces).optional()
2131
2417
  });
2132
- var probeDirectorySyncSchema = z14.object({
2133
- v: z14.literal(1),
2134
- revision: z14.number().int().positive(),
2135
- probes: z14.array(z14.object({ probe_id: probeIdSchema, region: z14.enum(UPTIME_REGIONS), public_key: b64key, status: z14.enum(["active", "revoked"]) })).max(30),
2136
- denied_hosts: z14.array(z14.string().min(1).max(253)).max(1e4)
2418
+ var probeDirectorySyncSchema = z17.object({
2419
+ v: z17.literal(1),
2420
+ revision: z17.number().int().positive(),
2421
+ probes: z17.array(z17.object({ probe_id: probeIdSchema, region: z17.enum(UPTIME_REGIONS), public_key: b64key, status: z17.enum(["active", "revoked"]) })).max(30),
2422
+ denied_hosts: z17.array(z17.string().min(1).max(253)).max(1e4)
2137
2423
  });
2138
- var runNowRequestSchema = z14.object({ v: z14.literal(1), workspace_id: uuid3, check_id: uuid3, run_id: z14.string().regex(/^[A-Za-z0-9_-]{8,64}$/) });
2139
- var signedAssignmentsSchema = z14.object({ assignments: assignmentsSchema, sig: z14.string().regex(/^[A-Za-z0-9_-]{86}$/) });
2140
- var uptimeRegionStateSchema = z14.object({
2141
- region: z14.enum(UPTIME_REGIONS),
2142
- outcome: z14.enum(UPTIME_OUTCOMES),
2143
- reason: z14.enum(UPTIME_REASONS).nullable(),
2144
- status_code: z14.number().int().min(100).max(599).nullable(),
2145
- total_ms: z14.number().nonnegative().max(60000).nullable(),
2424
+ var runNowRequestSchema = z17.object({ v: z17.literal(1), workspace_id: uuid3, check_id: uuid3, run_id: z17.string().regex(/^[A-Za-z0-9_-]{8,64}$/) });
2425
+ var signedAssignmentsSchema = z17.object({ assignments: assignmentsSchema, sig: z17.string().regex(/^[A-Za-z0-9_-]{86}$/) });
2426
+ var uptimeRegionStateSchema = z17.object({
2427
+ region: z17.enum(UPTIME_REGIONS),
2428
+ outcome: z17.enum(UPTIME_OUTCOMES),
2429
+ reason: z17.enum(UPTIME_REASONS).nullable(),
2430
+ status_code: z17.number().int().min(100).max(599).nullable(),
2431
+ total_ms: z17.number().nonnegative().max(60000).nullable(),
2146
2432
  timings: timingsSchema.nullable().optional(),
2147
- at: iso2
2433
+ at: iso4
2148
2434
  });
2149
- var uptimeStatusReportSchema = z14.object({
2435
+ var uptimeStatusReportSchema = z17.object({
2150
2436
  check_id: uuid3,
2151
- revision: z14.number().int().nonnegative(),
2152
- status: z14.enum(UPTIME_STATUSES),
2153
- last_verdict: z14.enum(SLOT_VERDICTS).nullable(),
2154
- last_slot_at: iso2.nullable(),
2437
+ revision: z17.number().int().nonnegative(),
2438
+ status: z17.enum(UPTIME_STATUSES),
2439
+ last_verdict: z17.enum(SLOT_VERDICTS).nullable(),
2440
+ last_slot_at: iso4.nullable(),
2155
2441
  incident_id: uuid3.nullable(),
2156
- down_streak: z14.number().int().nonnegative(),
2157
- up_streak: z14.number().int().nonnegative(),
2158
- regions: z14.array(uptimeRegionStateSchema).max(3),
2159
- unobserved_regions: z14.array(z14.enum(UPTIME_REGIONS)).max(3),
2160
- cert_not_after: iso2.nullable(),
2161
- cert_expiring: z14.boolean(),
2162
- run_now: z14.object({ run_id: z14.string().max(64), results: z14.array(uptimeRegionStateSchema).max(3) }).nullable()
2442
+ down_streak: z17.number().int().nonnegative(),
2443
+ up_streak: z17.number().int().nonnegative(),
2444
+ regions: z17.array(uptimeRegionStateSchema).max(3),
2445
+ unobserved_regions: z17.array(z17.enum(UPTIME_REGIONS)).max(3),
2446
+ cert_not_after: iso4.nullable(),
2447
+ cert_expiring: z17.boolean(),
2448
+ run_now: z17.object({ run_id: z17.string().max(64), results: z17.array(uptimeRegionStateSchema).max(3) }).nullable()
2163
2449
  });
2164
2450
  var UPTIME_EVENT_KINDS = ["opened", "resolved", "cert_expiring"];
2165
- var uptimeEventSchema = z14.object({
2166
- event_id: z14.string().regex(/^[A-Za-z0-9:_-]{8,96}$/),
2451
+ var uptimeEventSchema = z17.object({
2452
+ event_id: z17.string().regex(/^[A-Za-z0-9:_-]{8,96}$/),
2167
2453
  check_id: uuid3,
2168
- kind: z14.enum(UPTIME_EVENT_KINDS),
2454
+ kind: z17.enum(UPTIME_EVENT_KINDS),
2169
2455
  incident_id: uuid3.nullable(),
2170
- at: iso2,
2171
- reason: z14.enum(UPTIME_REASONS).nullable(),
2172
- regions: z14.array(z14.enum(UPTIME_REGIONS)).max(3),
2173
- cert_days_left: z14.number().int().nullable()
2456
+ at: iso4,
2457
+ reason: z17.enum(UPTIME_REASONS).nullable(),
2458
+ regions: z17.array(z17.enum(UPTIME_REGIONS)).max(3),
2459
+ cert_days_left: z17.number().int().nullable()
2174
2460
  });
2175
- var uptimeMinuteSchema = z14.object({
2461
+ var uptimeMinuteSchema = z17.object({
2176
2462
  check_id: uuid3,
2177
- minute: iso2,
2178
- up: z14.number().int().nonnegative(),
2179
- degraded: z14.number().int().nonnegative(),
2180
- down: z14.number().int().nonnegative(),
2181
- unknown: z14.number().int().nonnegative(),
2182
- latency: z14.array(z14.object({ region: z14.enum(UPTIME_REGIONS), n: z14.number().int().positive(), p50_ms: z14.number().nonnegative(), p95_ms: z14.number().nonnegative() })).max(3)
2463
+ minute: iso4,
2464
+ up: z17.number().int().nonnegative(),
2465
+ degraded: z17.number().int().nonnegative(),
2466
+ down: z17.number().int().nonnegative(),
2467
+ unknown: z17.number().int().nonnegative(),
2468
+ latency: z17.array(z17.object({ region: z17.enum(UPTIME_REGIONS), n: z17.number().int().positive(), p50_ms: z17.number().nonnegative(), p95_ms: z17.number().nonnegative() })).max(3)
2183
2469
  });
2184
- var uptimeReportSchema = z14.object({
2185
- v: z14.literal(1),
2470
+ var uptimeReportSchema = z17.object({
2471
+ v: z17.literal(1),
2186
2472
  workspace_id: uuid3,
2187
- revision: z14.number().int().nonnegative(),
2188
- sent_at: iso2,
2189
- events: z14.array(uptimeEventSchema).max(UPTIME_LIMITS.reportMaxEvents),
2190
- statuses: z14.array(uptimeStatusReportSchema).max(UPTIME_LIMITS.reportMaxStatuses),
2191
- minutes: z14.array(uptimeMinuteSchema).max(UPTIME_LIMITS.reportMaxMinutes)
2473
+ revision: z17.number().int().nonnegative(),
2474
+ sent_at: iso4,
2475
+ events: z17.array(uptimeEventSchema).max(UPTIME_LIMITS.reportMaxEvents),
2476
+ statuses: z17.array(uptimeStatusReportSchema).max(UPTIME_LIMITS.reportMaxStatuses),
2477
+ minutes: z17.array(uptimeMinuteSchema).max(UPTIME_LIMITS.reportMaxMinutes)
2192
2478
  });
2193
- var probeFleetReportSchema = z14.object({
2194
- v: z14.literal(1),
2195
- sent_at: iso2,
2196
- probes: z14.array(z14.object({
2479
+ var probeFleetReportSchema = z17.object({
2480
+ v: z17.literal(1),
2481
+ sent_at: iso4,
2482
+ probes: z17.array(z17.object({
2197
2483
  probe_id: probeIdSchema,
2198
- region: z14.enum(UPTIME_REGIONS),
2199
- version: z14.string().max(40).nullable(),
2200
- last_seen_at: iso2.nullable(),
2201
- lag_p99_ms: z14.number().nonnegative().nullable(),
2202
- checks_per_min: z14.number().nonnegative().nullable()
2484
+ region: z17.enum(UPTIME_REGIONS),
2485
+ version: z17.string().max(40).nullable(),
2486
+ last_seen_at: iso4.nullable(),
2487
+ lag_p99_ms: z17.number().nonnegative().nullable(),
2488
+ checks_per_min: z17.number().nonnegative().nullable()
2203
2489
  })).max(30),
2204
- regions_alive: z14.array(z14.enum(UPTIME_REGIONS)).max(3)
2490
+ regions_alive: z17.array(z17.enum(UPTIME_REGIONS)).max(3)
2205
2491
  });
2206
- var probeEnrollSchema = z14.object({
2207
- v: z14.literal(1),
2492
+ var probeEnrollSchema = z17.object({
2493
+ v: z17.literal(1),
2208
2494
  probe_id: probeIdSchema,
2209
- public_key: z14.string().regex(/^[A-Za-z0-9_-]{43}$/),
2210
- code: z14.string().regex(/^[A-Za-z0-9_-]{43}$/),
2211
- ts: z14.number().int().positive(),
2212
- sig: z14.string().regex(/^[A-Za-z0-9_-]{86}$/)
2495
+ public_key: z17.string().regex(/^[A-Za-z0-9_-]{43}$/),
2496
+ code: z17.string().regex(/^[A-Za-z0-9_-]{43}$/),
2497
+ ts: z17.number().int().positive(),
2498
+ sig: z17.string().regex(/^[A-Za-z0-9_-]{86}$/)
2213
2499
  });
2214
- var uptimeEvidenceEnvelopeSchema = z14.object({
2215
- v: z14.literal(1),
2216
- check_id: z14.guid(),
2217
- slot: z14.number().int().nonnegative(),
2218
- region: z14.enum(UPTIME_REGIONS),
2500
+ var uptimeEvidenceEnvelopeSchema = z17.object({
2501
+ v: z17.literal(1),
2502
+ check_id: z17.guid(),
2503
+ slot: z17.number().int().nonnegative(),
2504
+ region: z17.enum(UPTIME_REGIONS),
2219
2505
  probe_id: probeIdSchema,
2220
- at: z14.number().int().positive(),
2221
- sealed: z14.string().regex(/^[A-Za-z0-9_-]+$/).max(16384)
2506
+ at: z17.number().int().positive(),
2507
+ sealed: z17.string().regex(/^[A-Za-z0-9_-]+$/).max(16384)
2222
2508
  }).strict();
2223
- var uptimeEvidenceSchema = z14.object({
2224
- v: z14.literal(1),
2225
- check_id: z14.guid(),
2226
- slot: z14.number().int().nonnegative(),
2227
- region: z14.enum(UPTIME_REGIONS),
2228
- at: z14.number().int().positive(),
2229
- reason: z14.enum(UPTIME_REASONS).nullable(),
2230
- status_line: z14.string().max(200).nullable(),
2231
- headers: z14.record(z14.string().max(64), z14.string().max(512)).refine((h) => Object.keys(h).length <= 20),
2232
- body: z14.string().max(UPTIME_LIMITS.evidenceMaxBytes * 4).nullable(),
2233
- body_truncated: z14.boolean(),
2509
+ var uptimeEvidenceSchema = z17.object({
2510
+ v: z17.literal(1),
2511
+ check_id: z17.guid(),
2512
+ slot: z17.number().int().nonnegative(),
2513
+ region: z17.enum(UPTIME_REGIONS),
2514
+ at: z17.number().int().positive(),
2515
+ reason: z17.enum(UPTIME_REASONS).nullable(),
2516
+ status_line: z17.string().max(200).nullable(),
2517
+ headers: z17.record(z17.string().max(64), z17.string().max(512)).refine((h) => Object.keys(h).length <= 20),
2518
+ body: z17.string().max(UPTIME_LIMITS.evidenceMaxBytes * 4).nullable(),
2519
+ body_truncated: z17.boolean(),
2234
2520
  timings: timingsSchema.nullable(),
2235
- ip: z14.string().max(64).nullable(),
2236
- error: z14.string().max(300).nullable()
2521
+ ip: z17.string().max(64).nullable(),
2522
+ error: z17.string().max(300).nullable()
2237
2523
  }).strict();
2238
- var uptimeEvidenceListSchema = z14.object({
2239
- items: z14.array(uptimeEvidenceSchema.extend({ received_at: z14.number().int().positive() })).max(UPTIME_LIMITS.evidenceKeepPerCheck)
2524
+ var uptimeEvidenceListSchema = z17.object({
2525
+ items: z17.array(uptimeEvidenceSchema.extend({ received_at: z17.number().int().positive() })).max(UPTIME_LIMITS.evidenceKeepPerCheck)
2240
2526
  });
2241
2527
 
2242
2528
  // ../src/shared/contracts/api-ops/monitors.ts
2243
- var anyMonitorInputSchema = z15.union([monitorInputSchema, signalMonitorInputSchema]);
2529
+ var anyMonitorInputSchema = z18.union([monitorInputSchema, signalMonitorInputSchema]);
2244
2530
  var MAINTENANCE_INPUTS = {
2245
- create: z15.object({ workspaceId: uuid, input: maintenanceInputSchema }),
2246
- update: z15.object({ workspaceId: uuid, windowId: uuid, input: maintenanceInputSchema }),
2247
- delete: z15.object({ workspaceId: uuid, windowId: uuid })
2531
+ create: z18.object({ workspaceId: uuid, input: maintenanceInputSchema }),
2532
+ update: z18.object({ workspaceId: uuid, windowId: uuid, input: maintenanceInputSchema }),
2533
+ delete: z18.object({ workspaceId: uuid, windowId: uuid })
2248
2534
  };
2249
2535
  var MONITOR_INPUTS = {
2250
- create: z15.object({ projectId, slug: z15.string().regex(SLUG_RE), input: anyMonitorInputSchema }),
2251
- update: z15.object({ monitorId: uuid, input: anyMonitorInputSchema }),
2252
- delete: z15.object({ monitorId: uuid, confirmSlug: z15.string().max(64) }),
2253
- setPause: z15.object({ monitorId: uuid, until: holdUntil }),
2254
- setMuted: z15.object({ monitorId: uuid, muted: z15.boolean() }),
2255
- dismissDiscovery: z15.object({ discoveryId: uuid }),
2256
- rotatePing: z15.object({
2536
+ create: z18.object({ projectId, slug: z18.string().regex(SLUG_RE), input: anyMonitorInputSchema }),
2537
+ update: z18.object({ monitorId: uuid, input: anyMonitorInputSchema }),
2538
+ delete: z18.object({ monitorId: uuid, confirmSlug: z18.string().max(64) }),
2539
+ setPause: z18.object({ monitorId: uuid, until: holdUntil }),
2540
+ setMuted: z18.object({ monitorId: uuid, muted: z18.boolean() }),
2541
+ dismissDiscovery: z18.object({ discoveryId: uuid }),
2542
+ rotatePing: z18.object({
2257
2543
  monitorId: uuid,
2258
- graceHours: z15.number().int().refine((h) => HEARTBEAT_LIMITS.rotationGraceHoursChoices.includes(h))
2544
+ graceHours: z18.number().int().refine((h) => HEARTBEAT_LIMITS.rotationGraceHoursChoices.includes(h))
2259
2545
  }),
2260
- monitorOnly: z15.object({ monitorId: uuid })
2546
+ monitorOnly: z18.object({ monitorId: uuid })
2261
2547
  };
2262
2548
  var UPTIME_INPUTS = {
2263
2549
  create: uptimeCheckInputSchema,
2264
- update: z15.object({ checkId: uuid, input: uptimeCheckInputSchema }),
2265
- checkOnly: z15.object({ checkId: uuid }),
2266
- setHold: z15.object({ checkId: uuid, kind: z15.enum(["pause", "mute"]), until: holdUntil })
2550
+ update: z18.object({ checkId: uuid, input: uptimeCheckInputSchema }),
2551
+ checkOnly: z18.object({ checkId: uuid }),
2552
+ setHold: z18.object({ checkId: uuid, kind: z18.enum(["pause", "mute"]), until: holdUntil })
2267
2553
  };
2268
2554
  var SLO_INPUTS = {
2269
- create: z15.object({ workspaceId: uuid, input: sloInputSchema }),
2270
- update: z15.object({ sloId: uuid, input: sloInputSchema }),
2271
- sloOnly: z15.object({ sloId: uuid }),
2272
- setHold: z15.object({ sloId: uuid, kind: z15.enum(["pause", "mute"]), until: holdUntil }),
2273
- import: z15.object({
2555
+ create: z18.object({ workspaceId: uuid, input: sloInputSchema }),
2556
+ update: z18.object({ sloId: uuid, input: sloInputSchema }),
2557
+ sloOnly: z18.object({ sloId: uuid }),
2558
+ setHold: z18.object({ sloId: uuid, kind: z18.enum(["pause", "mute"]), until: holdUntil }),
2559
+ import: z18.object({
2274
2560
  workspaceId: uuid,
2275
- text: z15.string().max(SLO_LIMITS.openSloMaxBytes * 2),
2276
- dryRun: z15.boolean()
2561
+ text: z18.string().max(SLO_LIMITS.openSloMaxBytes * 2),
2562
+ dryRun: z18.boolean()
2277
2563
  })
2278
2564
  };
2279
2565
  var m = "monitors:write";
@@ -2615,19 +2901,19 @@ var MONITOR_OPERATIONS = [
2615
2901
  ];
2616
2902
 
2617
2903
  // ../src/shared/contracts/api-ops/node-data.ts
2618
- import { z as z16 } from "zod";
2619
- var issueId = z16.number().int().positive();
2620
- var csv = z16.string().min(1).max(2000);
2621
- var name2 = z16.string().min(1).max(256);
2622
- var period = z16.enum(["1h", "24h", "7d", "14d", "30d"]);
2623
- var nodeCursor = z16.string().min(1).max(600).optional();
2904
+ import { z as z19 } from "zod";
2905
+ var issueId = z19.number().int().positive();
2906
+ var csv = z19.string().min(1).max(2000);
2907
+ var name2 = z19.string().min(1).max(256);
2908
+ var period = z19.enum(["1h", "24h", "7d", "14d", "30d"]);
2909
+ var nodeCursor = z19.string().min(1).max(600).optional();
2624
2910
  var windowFields = {
2625
- start: z16.string().max(40).optional(),
2626
- end: z16.string().max(40).optional()
2911
+ start: z19.string().max(40).optional(),
2912
+ end: z19.string().max(40).optional()
2627
2913
  };
2628
- var traceId = z16.string().regex(/^[0-9a-fA-F]{32}$/);
2629
- var spanId = z16.string().regex(/^[0-9a-fA-F]{16}$/);
2630
- var attrs = z16.string().max(2000).optional();
2914
+ var traceId = z19.string().regex(/^[0-9a-fA-F]{32}$/);
2915
+ var spanId = z19.string().regex(/^[0-9a-fA-F]{16}$/);
2916
+ var attrs = z19.string().max(2000).optional();
2631
2917
  var telemetryCommon = {
2632
2918
  ...windowFields,
2633
2919
  project: csv.optional(),
@@ -2635,112 +2921,112 @@ var telemetryCommon = {
2635
2921
  service: csv.optional(),
2636
2922
  attrs
2637
2923
  };
2638
- var issueChange = z16.union([
2639
- z16.object({ action: z16.literal("resolve"), inNextRelease: z16.boolean().optional() }),
2640
- z16.object({ action: z16.literal("unresolve") }),
2641
- z16.object({ action: z16.literal("archive"), mode: z16.enum(["until_escalating", "forever"]) }),
2642
- z16.object({
2643
- action: z16.literal("archive"),
2644
- mode: z16.literal("until_condition"),
2645
- events: z16.number().int().min(1).max(1e6).optional(),
2646
- users: z16.number().int().min(1).max(1e5).optional(),
2647
- until: z16.string().datetime().optional()
2648
- }),
2649
- z16.object({ action: z16.literal("assign"), userId: z16.guid().nullable() }),
2650
- z16.object({ action: z16.literal("priority"), priority: z16.enum(["low", "medium", "high"]) })
2924
+ var issueChange = z19.union([
2925
+ z19.object({ action: z19.literal("resolve"), inNextRelease: z19.boolean().optional() }),
2926
+ z19.object({ action: z19.literal("unresolve") }),
2927
+ z19.object({ action: z19.literal("archive"), mode: z19.enum(["until_escalating", "forever"]) }),
2928
+ z19.object({
2929
+ action: z19.literal("archive"),
2930
+ mode: z19.literal("until_condition"),
2931
+ events: z19.number().int().min(1).max(1e6).optional(),
2932
+ users: z19.number().int().min(1).max(1e5).optional(),
2933
+ until: z19.string().datetime().optional()
2934
+ }),
2935
+ z19.object({ action: z19.literal("assign"), userId: z19.guid().nullable() }),
2936
+ z19.object({ action: z19.literal("priority"), priority: z19.enum(["low", "medium", "high"]) })
2651
2937
  ]);
2652
2938
  var NODE_INPUTS = {
2653
- issuesList: z16.object({
2939
+ issuesList: z19.object({
2654
2940
  project: csv.optional(),
2655
- status: z16.enum(["unresolved", "resolved", "archived", "all"]).optional(),
2941
+ status: z19.enum(["unresolved", "resolved", "archived", "all"]).optional(),
2656
2942
  level: csv.optional(),
2657
2943
  priority: csv.optional(),
2658
2944
  environment: csv.optional(),
2659
2945
  release: csv.optional(),
2660
- assignee: z16.string().max(64).optional(),
2946
+ assignee: z19.string().max(64).optional(),
2661
2947
  period: period.optional(),
2662
- q: z16.string().max(200).optional(),
2663
- sort: z16.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
2948
+ q: z19.string().max(200).optional(),
2949
+ sort: z19.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
2664
2950
  cursor: nodeCursor,
2665
- limit: z16.number().int().min(1).max(100).optional()
2951
+ limit: z19.number().int().min(1).max(100).optional()
2666
2952
  }),
2667
- issue: z16.object({ issueId }),
2668
- issueStats: z16.object({ issueId, range: z16.enum(["24h", "30d"]).optional() }),
2669
- issueEvents: z16.object({ issueId, cursor: nodeCursor }),
2670
- issueEvent: z16.object({
2953
+ issue: z19.object({ issueId }),
2954
+ issueStats: z19.object({ issueId, range: z19.enum(["24h", "30d"]).optional() }),
2955
+ issueEvents: z19.object({ issueId, cursor: nodeCursor }),
2956
+ issueEvent: z19.object({
2671
2957
  issueId,
2672
- eventId: z16.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
2958
+ eventId: z19.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
2673
2959
  }),
2674
- issueUpdate: z16.object({ issueId, change: issueChange }),
2675
- issuesBulk: z16.object({
2676
- issueIds: z16.array(issueId).min(1).max(100),
2960
+ issueUpdate: z19.object({ issueId, change: issueChange }),
2961
+ issuesBulk: z19.object({
2962
+ issueIds: z19.array(issueId).min(1).max(100),
2677
2963
  action: issueChange
2678
2964
  }),
2679
- spansList: z16.object({
2965
+ spansList: z19.object({
2680
2966
  ...telemetryCommon,
2681
- operation: z16.string().min(1).max(1024).optional(),
2682
- status: z16.enum(["unset", "ok", "error"]).optional(),
2683
- kind: z16.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
2684
- minDurationMs: z16.number().min(0).max(86400000).optional(),
2685
- maxDurationMs: z16.number().min(0).max(86400000).optional(),
2686
- mode: z16.enum(["spans", "traces"]).optional(),
2967
+ operation: z19.string().min(1).max(1024).optional(),
2968
+ status: z19.enum(["unset", "ok", "error"]).optional(),
2969
+ kind: z19.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
2970
+ minDurationMs: z19.number().min(0).max(86400000).optional(),
2971
+ maxDurationMs: z19.number().min(0).max(86400000).optional(),
2972
+ mode: z19.enum(["spans", "traces"]).optional(),
2687
2973
  cursor: nodeCursor
2688
2974
  }),
2689
- spansHistogram: z16.object({
2975
+ spansHistogram: z19.object({
2690
2976
  ...telemetryCommon,
2691
- operation: z16.string().min(1).max(1024).optional(),
2692
- status: z16.enum(["unset", "ok", "error"]).optional()
2977
+ operation: z19.string().min(1).max(1024).optional(),
2978
+ status: z19.enum(["unset", "ok", "error"]).optional()
2693
2979
  }),
2694
- trace: z16.object({ traceId }),
2695
- traceSpans: z16.object({ traceId, errorsOnly: z16.enum(["1"]).optional(), ...windowFields }),
2696
- span: z16.object({ traceId, spanId, ...windowFields }),
2697
- logsList: z16.object({
2980
+ trace: z19.object({ traceId }),
2981
+ traceSpans: z19.object({ traceId, errorsOnly: z19.enum(["1"]).optional(), ...windowFields }),
2982
+ span: z19.object({ traceId, spanId, ...windowFields }),
2983
+ logsList: z19.object({
2698
2984
  ...telemetryCommon,
2699
- severityMin: z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
2985
+ severityMin: z19.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
2700
2986
  traceId: traceId.optional(),
2701
2987
  spanId: spanId.optional(),
2702
- q: z16.string().max(500).optional(),
2703
- order: z16.enum(["asc", "desc"]).optional(),
2988
+ q: z19.string().max(500).optional(),
2989
+ order: z19.enum(["asc", "desc"]).optional(),
2704
2990
  cursor: nodeCursor
2705
2991
  }),
2706
- logsFacets: z16.object({
2992
+ logsFacets: z19.object({
2707
2993
  ...telemetryCommon,
2708
- severityMin: z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
2709
- q: z16.string().max(500).optional()
2994
+ severityMin: z19.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
2995
+ q: z19.string().max(500).optional()
2710
2996
  }),
2711
- logAround: z16.object({
2997
+ logAround: z19.object({
2712
2998
  logId: name2,
2713
- at: z16.string().max(40),
2714
- same: z16.enum(["service", "trace"]).optional(),
2715
- before: z16.number().int().min(0).max(200).optional(),
2716
- after: z16.number().int().min(0).max(200).optional()
2717
- }),
2718
- telemetryUsage: z16.object({ project: csv.optional(), days: z16.number().int().min(1).max(31).optional() }),
2719
- monitorSignal: z16.object({ monitorId: z16.guid(), hours: z16.number().int().min(1).max(24).optional() }),
2720
- monitorOccurrences: z16.object({
2721
- monitorId: z16.guid(),
2722
- state: z16.enum(["open", "finished", "all"]).optional(),
2723
- environment: z16.string().min(1).max(64).optional(),
2999
+ at: z19.string().max(40),
3000
+ same: z19.enum(["service", "trace"]).optional(),
3001
+ before: z19.number().int().min(0).max(200).optional(),
3002
+ after: z19.number().int().min(0).max(200).optional()
3003
+ }),
3004
+ telemetryUsage: z19.object({ project: csv.optional(), days: z19.number().int().min(1).max(31).optional() }),
3005
+ monitorSignal: z19.object({ monitorId: z19.guid(), hours: z19.number().int().min(1).max(24).optional() }),
3006
+ monitorOccurrences: z19.object({
3007
+ monitorId: z19.guid(),
3008
+ state: z19.enum(["open", "finished", "all"]).optional(),
3009
+ environment: z19.string().min(1).max(64).optional(),
2724
3010
  cursor: nodeCursor
2725
3011
  }),
2726
- monitorBacktest: z16.object({ project: z16.number().int().positive(), settings: backtestSettingsSchema }),
2727
- occurrenceCreate: z16.object({
2728
- project: z16.number().int().positive(),
3012
+ monitorBacktest: z19.object({ project: z19.number().int().positive(), settings: backtestSettingsSchema }),
3013
+ occurrenceCreate: z19.object({
3014
+ project: z19.number().int().positive(),
2729
3015
  monitorSlug: occurrenceInputSchema.shape.monitor_slug,
2730
3016
  occurrenceId: occurrenceInputSchema.shape.occurrence_id,
2731
3017
  dueAt: occurrenceInputSchema.shape.due_at,
2732
3018
  environment: occurrenceInputSchema.shape.environment
2733
3019
  }),
2734
- occurrenceCancel: z16.object({
2735
- project: z16.number().int().positive(),
2736
- monitorSlug: z16.string().regex(SLUG_RE),
2737
- occurrenceId: z16.string().regex(OCCURRENCE_ID_RE),
2738
- environment: z16.string().min(1).max(64).optional()
3020
+ occurrenceCancel: z19.object({
3021
+ project: z19.number().int().positive(),
3022
+ monitorSlug: z19.string().regex(SLUG_RE),
3023
+ occurrenceId: z19.string().regex(OCCURRENCE_ID_RE),
3024
+ environment: z19.string().min(1).max(64).optional()
2739
3025
  }),
2740
- ticket: z16.object({
2741
- scope: z16.enum(["read", "write"]).default("read"),
2742
- project: z16.number().int().positive().optional(),
2743
- environment: z16.string().min(1).max(64).optional()
3026
+ ticket: z19.object({
3027
+ scope: z19.enum(["read", "write"]).default("read"),
3028
+ project: z19.number().int().positive().optional(),
3029
+ environment: z19.string().min(1).max(64).optional()
2744
3030
  })
2745
3031
  };
2746
3032
  var N = NODE_INPUTS;
@@ -3001,11 +3287,121 @@ var NODE_OPERATIONS = [
3001
3287
  })
3002
3288
  ];
3003
3289
 
3004
- // ../src/shared/contracts/api-ops/projects.ts
3290
+ // ../src/shared/contracts/api-ops/privacy.ts
3005
3291
  import { z as z21 } from "zod";
3006
3292
 
3293
+ // ../src/shared/contracts/privacy.ts
3294
+ import { z as z20 } from "zod";
3295
+
3296
+ // ../src/shared/privacy/rules.ts
3297
+ var PRIVACY_SCHEMA = 1;
3298
+ var PRIVACY_LIMITS = {
3299
+ rules: 100,
3300
+ allowlist: 100,
3301
+ selector: 256,
3302
+ pattern: 256,
3303
+ replaceWith: 32,
3304
+ ruleId: 64,
3305
+ stringChars: 16384,
3306
+ quantifierMax: 1000,
3307
+ matches: 500,
3308
+ depth: 32
3309
+ };
3310
+ var PRIVACY_MODES = ["standard", "strict"];
3311
+ var PRIVACY_RULE_TYPES = ["pattern", "anything", "creditcard", "ip", "email", "phone_e164"];
3312
+ var PRIVACY_METHODS = ["remove", "replace", "mask", "hash"];
3313
+ var AUTH_HEADER_KEYS = new Set(["authorization", "proxy-authorization", "x-api-key", "x-auth-token", "x-sentry-auth", "x-amz-security-token"]);
3314
+ var COOKIE_KEYS = new Set(["cookie", "cookies", "set-cookie"]);
3315
+ var BODY_KEYS = new Set(["body", "request_body", "response_body", "raw_body", "message_body", "html_body"]);
3316
+ var CARD_KEYS = new Set(["card_number", "cardnumber", "cc_number", "ccnum", "cvv", "cvc", "pan"]);
3317
+ var OCTET = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)";
3318
+ var IPV4_RE = new RegExp(`(^|[^\\d.])(${OCTET}(?:\\.${OCTET}){3})(?![\\d.])`, "g");
3319
+ var H = "[0-9A-Fa-f]{1,4}";
3320
+ var IPV6_RE = new RegExp(`(^|[^0-9A-Fa-f:])((?:${H}:){7}${H}|(?:${H}:){1,6}:(?:${H}(?::${H}){0,5})?|::(?:${H}(?::${H}){0,6})?)(?![0-9A-Fa-f:])`, "g");
3321
+ var REMOVE = Symbol("remove");
3322
+
3323
+ // ../src/shared/contracts/privacy.ts
3324
+ var ruleId = z20.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
3325
+ var privacyRuleInputSchema = z20.object({
3326
+ id: ruleId,
3327
+ selector: z20.string().min(1).max(PRIVACY_LIMITS.selector),
3328
+ type: z20.enum(PRIVACY_RULE_TYPES),
3329
+ method: z20.enum(PRIVACY_METHODS),
3330
+ pattern: z20.string().min(1).max(PRIVACY_LIMITS.pattern).optional(),
3331
+ ignoreCase: z20.boolean().optional(),
3332
+ replaceWith: z20.string().max(PRIVACY_LIMITS.replaceWith).optional(),
3333
+ enabled: z20.boolean().optional()
3334
+ });
3335
+ var privacyPolicyInputSchema = z20.object({
3336
+ mode: z20.enum(PRIVACY_MODES),
3337
+ rules: z20.array(privacyRuleInputSchema).max(PRIVACY_LIMITS.rules),
3338
+ allowlist: z20.array(z20.string().min(1).max(PRIVACY_LIMITS.selector)).max(PRIVACY_LIMITS.allowlist)
3339
+ });
3340
+ var storedPolicySchema = z20.object({
3341
+ schema: z20.literal(PRIVACY_SCHEMA),
3342
+ version: z20.number().int().min(0),
3343
+ mode: z20.enum(PRIVACY_MODES),
3344
+ rules: z20.array(z20.record(z20.string(), z20.unknown())).max(PRIVACY_LIMITS.rules),
3345
+ allowlist: z20.array(z20.string()).max(PRIVACY_LIMITS.allowlist)
3346
+ });
3347
+ var nodePrivacyBlockSchema = z20.array(z20.object({ project_id: z20.number().int().positive(), policy: z20.unknown() })).max(1000);
3348
+ var privacyRollupSchema = z20.object({
3349
+ applied_version: z20.number().int().min(0).nullable(),
3350
+ policy_missing_24h: z20.number().int().nonnegative(),
3351
+ budget_exceeded_24h: z20.number().int().nonnegative(),
3352
+ sdk_versions: z20.array(z20.object({ version: z20.number().int().min(0), last_seen_at: z20.string().datetime() })).max(5)
3353
+ });
3354
+
3355
+ // ../src/shared/contracts/api-ops/privacy.ts
3356
+ var PRIVACY_INPUTS = {
3357
+ get: z21.object({ workspaceId: uuid, projectId }),
3358
+ set: z21.object({
3359
+ workspaceId: uuid,
3360
+ projectId,
3361
+ expectedVersion: z21.number().int().min(0),
3362
+ policy: privacyPolicyInputSchema
3363
+ })
3364
+ };
3365
+ var P = PRIVACY_INPUTS;
3366
+ var PRIVACY_OPERATIONS = [
3367
+ op({
3368
+ id: "privacy.get",
3369
+ method: "GET",
3370
+ path: "/v1/projects/{project_id}/privacy",
3371
+ scope: "projects:read",
3372
+ sensitivity: "normal",
3373
+ kind: "read",
3374
+ rpcs: ["api_read_privacy"],
3375
+ input: P.get,
3376
+ workspace: true,
3377
+ idempotency: "none",
3378
+ mcp: "configure",
3379
+ summary: "A project's privacy policy (mode, rules, strict allowlist, version), the built-in detectors that are off, whether user ids are pseudonymised, the last 20 versions and what the node applies and counted in the last 24 h.",
3380
+ ui: []
3381
+ }),
3382
+ op({
3383
+ id: "privacy.set",
3384
+ method: "PUT",
3385
+ path: "/v1/projects/{project_id}/privacy",
3386
+ scope: "privacy:write",
3387
+ sensitivity: "approval",
3388
+ kind: "write",
3389
+ rpcs: ["set_privacy_policy"],
3390
+ input: P.set,
3391
+ bodyField: "policy",
3392
+ workspace: true,
3393
+ idempotency: "optional",
3394
+ mcp: "configure",
3395
+ summary: "Replace a project's privacy policy (rules are applied in order on the node before anything is stored). Always needs an admin's approval; loosening (a rule removed or changed, strict off, allowlist grown) also needs their fresh authenticator code and emails owners.",
3396
+ ui: ["privacy#setPrivacyPolicy"]
3397
+ })
3398
+ ];
3399
+
3400
+ // ../src/shared/contracts/api-ops/projects.ts
3401
+ import { z as z25 } from "zod";
3402
+
3007
3403
  // ../src/shared/contracts/ingest-keys.ts
3008
- import { z as z17 } from "zod";
3404
+ import { z as z22 } from "zod";
3009
3405
  var INGEST_KEY_SCOPES = ["traces", "logs", "errors", "monitors"];
3010
3406
  var INGEST_KEY_STATES = ["active", "revoked"];
3011
3407
  var INGEST_KEY_LIMITS = {
@@ -3015,174 +3411,91 @@ var INGEST_KEY_LIMITS = {
3015
3411
  edgeCacheSeconds: 60
3016
3412
  };
3017
3413
  var CHECKIN_AUTH_MODES = ["public_or_key", "key_only"];
3018
- var ingestKeyConfigSchema = z17.object({
3019
- v: z17.literal(1),
3020
- key_id: z17.guid(),
3021
- project_public_id: z17.number().int().positive(),
3022
- project_id: z17.number().int().positive(),
3023
- workspace_id: z17.guid(),
3414
+ var ingestKeyConfigSchema = z22.object({
3415
+ v: z22.literal(1),
3416
+ key_id: z22.guid(),
3417
+ project_public_id: z22.number().int().positive(),
3418
+ project_id: z22.number().int().positive(),
3419
+ workspace_id: z22.guid(),
3024
3420
  node_id: nodeIdSchema,
3025
- scopes: z17.array(z17.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
3026
- environments: z17.array(z17.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
3027
- expires_at: z17.string().datetime({ offset: true }).nullable(),
3028
- state: z17.enum(INGEST_KEY_STATES),
3029
- workspace_status: z17.enum(["active", "suspended", "deleting"]),
3030
- ingest_kill: z17.boolean(),
3031
- telemetry_kill: z17.boolean(),
3032
- telemetry_rate_bytes_per_sec: z17.number().int().positive(),
3033
- telemetry_burst_bytes: z17.number().int().positive(),
3034
- traces_monthly_bytes: z17.number().int().positive(),
3035
- logs_monthly_bytes: z17.number().int().positive(),
3036
- telemetry_buffer_minutes: z17.number().int().min(1).max(1440),
3037
- revision: z17.number().int().nonnegative()
3421
+ scopes: z22.array(z22.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
3422
+ environments: z22.array(z22.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
3423
+ expires_at: z22.string().datetime({ offset: true }).nullable(),
3424
+ state: z22.enum(INGEST_KEY_STATES),
3425
+ workspace_status: z22.enum(["active", "suspended", "deleting"]),
3426
+ ingest_kill: z22.boolean(),
3427
+ telemetry_kill: z22.boolean(),
3428
+ telemetry_rate_bytes_per_sec: z22.number().int().positive(),
3429
+ telemetry_burst_bytes: z22.number().int().positive(),
3430
+ traces_monthly_bytes: z22.number().int().positive(),
3431
+ logs_monthly_bytes: z22.number().int().positive(),
3432
+ telemetry_buffer_minutes: z22.number().int().min(1).max(1440),
3433
+ revision: z22.number().int().nonnegative()
3038
3434
  });
3039
- var createIngestKeyInputSchema = z17.object({
3040
- projectId: z17.number().int().positive(),
3041
- name: z17.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
3042
- scopes: z17.array(z17.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
3043
- environments: z17.array(z17.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
3044
- expiresAt: z17.string().datetime({ offset: true }).nullable()
3435
+ var createIngestKeyInputSchema = z22.object({
3436
+ projectId: z22.number().int().positive(),
3437
+ name: z22.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
3438
+ scopes: z22.array(z22.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
3439
+ environments: z22.array(z22.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
3440
+ expiresAt: z22.string().datetime({ offset: true }).nullable()
3045
3441
  });
3046
- var ingestKeyRowSchema = z17.object({
3047
- id: z17.guid(),
3048
- project_id: z17.number().int().positive(),
3049
- name: z17.string(),
3050
- prefix: z17.string(),
3051
- scopes: z17.array(z17.enum(INGEST_KEY_SCOPES)),
3052
- environments: z17.array(z17.string()),
3053
- expires_at: z17.string().nullable(),
3054
- state: z17.enum(INGEST_KEY_STATES),
3055
- created_by: z17.guid().nullable(),
3056
- created_at: z17.string(),
3057
- revoked_at: z17.string().nullable(),
3058
- last_used_at: z17.string().nullable()
3059
- });
3060
-
3061
- // ../src/shared/contracts/integration-health.ts
3062
- import { z as z18 } from "zod";
3063
-
3064
- // ../src/shared/contracts/platforms.ts
3065
- var PLATFORMS = [
3066
- "javascript-browser",
3067
- "react",
3068
- "node",
3069
- "python",
3070
- "tanstack-start",
3071
- "other"
3072
- ];
3073
-
3074
- // ../src/shared/contracts/integration-health.ts
3075
- var VERIFICATION_ID_RE = /^bv1_[0-9a-f]{32}$/;
3076
- var verificationIdSchema = z18.string().regex(VERIFICATION_ID_RE);
3077
- var SURFACES = ["browser", "server"];
3078
- var RECEIPT_SURFACES = ["browser", "server", "belvador"];
3079
- var CHECKS = ["delivery", "uncaught", "pipeline"];
3080
- var HOOK_STATES = ["ok", "missing", "unknown"];
3081
- var verificationContextSchema = z18.object({
3082
- v: z18.literal(1),
3083
- surface: z18.enum(RECEIPT_SURFACES),
3084
- check: z18.enum(CHECKS),
3085
- hook: z18.enum(HOOK_STATES).optional(),
3086
- uncaught_expected: z18.boolean().optional()
3087
- });
3088
- var iso3 = z18.string().datetime();
3089
- var projectId3 = z18.number().int().positive();
3090
- var verificationReceiptSchema = z18.object({
3091
- project_id: projectId3,
3092
- verification_id: verificationIdSchema,
3093
- surface: z18.enum(RECEIPT_SURFACES),
3094
- check: z18.enum(CHECKS),
3095
- hook: z18.enum(HOOK_STATES),
3096
- uncaught_expected: z18.boolean(),
3097
- sdk_name: z18.string().max(80),
3098
- sdk_version: z18.string().max(40),
3099
- environment: z18.string().max(64),
3100
- release: z18.string().max(200),
3101
- source_host: z18.string().max(253),
3102
- received_at: iso3
3103
- });
3104
- var SDK_DELIVERY_DROP_REASONS = ["network_error", "queue_overflow", "send_error"];
3105
- var clientDiscardSchema = z18.object({
3106
- hour: iso3,
3107
- reason: z18.enum(SDK_DELIVERY_DROP_REASONS),
3108
- n: z18.number().int().nonnegative()
3109
- });
3110
- var edgeVerificationRequestSchema = z18.object({
3111
- v: z18.literal(1),
3112
- project_id: projectId3,
3113
- verification_id: verificationIdSchema
3114
- });
3115
- var readbackCheckSchema = z18.object({
3116
- surface: z18.enum(RECEIPT_SURFACES),
3117
- check: z18.enum(CHECKS),
3118
- hook: z18.enum(HOOK_STATES),
3119
- received_at: iso3
3120
- });
3121
- var edgeVerificationResponseSchema = z18.object({
3122
- checks: z18.array(readbackCheckSchema).max(8)
3123
- });
3124
- var readbackResponseSchema = z18.object({
3125
- v: z18.literal(1),
3126
- verification_id: verificationIdSchema,
3127
- node: z18.enum(["connected", "offline"]),
3128
- checks: z18.array(readbackCheckSchema).max(8)
3129
- });
3130
- var ENVIRONMENT_RE = /^[^\u0000-\u001f]{1,64}$/;
3131
- var projectRuntimeSchema = z18.object({
3132
- project_id: projectId3,
3133
- environment: z18.string().max(64),
3134
- surface: z18.enum(SURFACES),
3135
- sdk_name: z18.string().max(80),
3136
- sdk_version: z18.string().max(40),
3137
- latest_release: z18.string().max(200),
3138
- first_seen: iso3,
3139
- last_seen: iso3,
3140
- events_24h: z18.number().int().nonnegative(),
3141
- check_ins_24h: z18.number().int().nonnegative()
3442
+ var ingestKeyRowSchema = z22.object({
3443
+ id: z22.guid(),
3444
+ project_id: z22.number().int().positive(),
3445
+ name: z22.string(),
3446
+ prefix: z22.string(),
3447
+ scopes: z22.array(z22.enum(INGEST_KEY_SCOPES)),
3448
+ environments: z22.array(z22.string()),
3449
+ expires_at: z22.string().nullable(),
3450
+ state: z22.enum(INGEST_KEY_STATES),
3451
+ created_by: z22.guid().nullable(),
3452
+ created_at: z22.string(),
3453
+ revoked_at: z22.string().nullable(),
3454
+ last_used_at: z22.string().nullable()
3142
3455
  });
3143
3456
 
3144
3457
  // ../src/shared/contracts/node-config.ts
3145
- import { z as z20 } from "zod";
3458
+ import { z as z24 } from "zod";
3146
3459
 
3147
3460
  // ../src/shared/contracts/backup.ts
3148
- import { z as z19 } from "zod";
3461
+ import { z as z23 } from "zod";
3149
3462
  var BACKUP_KINDS = ["daily", "weekly", "manual", "pre_upgrade"];
3150
- var ageRecipient = z19.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
3151
- var backupIdSchema = z19.string().regex(/^[a-z0-9-]{8,64}$/);
3152
- var nodeBackupConfigSchema = z19.object({
3153
- enabled: z19.boolean(),
3154
- hour_utc: z19.number().int().min(0).max(23),
3155
- weekly_day: z19.number().int().min(1).max(7),
3463
+ var ageRecipient = z23.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
3464
+ var backupIdSchema = z23.string().regex(/^[a-z0-9-]{8,64}$/);
3465
+ var nodeBackupConfigSchema = z23.object({
3466
+ enabled: z23.boolean(),
3467
+ hour_utc: z23.number().int().min(0).max(23),
3468
+ weekly_day: z23.number().int().min(1).max(7),
3156
3469
  workspace_recipient: ageRecipient
3157
3470
  });
3158
- var backupCredentialsRequestSchema = z19.object({
3159
- mode: z19.enum(["upload", "download"]),
3471
+ var backupCredentialsRequestSchema = z23.object({
3472
+ mode: z23.enum(["upload", "download"]),
3160
3473
  backup_id: backupIdSchema,
3161
- source_node_id: z19.guid().optional()
3474
+ source_node_id: z23.guid().optional()
3162
3475
  });
3163
- var backupCredentialsSchema = z19.object({
3164
- endpoint: z19.string().url(),
3165
- bucket: z19.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
3166
- prefix: z19.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
3167
- access_key_id: z19.string().min(8).max(200),
3168
- secret_access_key: z19.string().min(8).max(200),
3169
- session_token: z19.string().min(8).max(4000),
3170
- expires_at: z19.string().datetime()
3476
+ var backupCredentialsSchema = z23.object({
3477
+ endpoint: z23.string().url(),
3478
+ bucket: z23.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
3479
+ prefix: z23.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
3480
+ access_key_id: z23.string().min(8).max(200),
3481
+ secret_access_key: z23.string().min(8).max(200),
3482
+ session_token: z23.string().min(8).max(4000),
3483
+ expires_at: z23.string().datetime()
3171
3484
  });
3172
- var rowCountsSchema = z19.record(z19.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z19.number().int().nonnegative());
3173
- var backupManifestSchema = z19.object({
3174
- v: z19.literal(1),
3485
+ var rowCountsSchema = z23.record(z23.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z23.number().int().nonnegative());
3486
+ var backupManifestSchema = z23.object({
3487
+ v: z23.literal(1),
3175
3488
  backup_id: backupIdSchema,
3176
- node_id: z19.guid(),
3177
- kind: z19.enum(BACKUP_KINDS),
3178
- created_at: z19.string().datetime(),
3179
- object_key: z19.string(),
3180
- size_bytes: z19.number().int().nonnegative(),
3181
- sha256: z19.string().regex(/^[0-9a-f]{64}$/),
3182
- clickhouse_version: z19.string().max(40),
3183
- schema_version: z19.number().int().nonnegative(),
3489
+ node_id: z23.guid(),
3490
+ kind: z23.enum(BACKUP_KINDS),
3491
+ created_at: z23.string().datetime(),
3492
+ object_key: z23.string(),
3493
+ size_bytes: z23.number().int().nonnegative(),
3494
+ sha256: z23.string().regex(/^[0-9a-f]{64}$/),
3495
+ clickhouse_version: z23.string().max(40),
3496
+ schema_version: z23.number().int().nonnegative(),
3184
3497
  row_counts: rowCountsSchema,
3185
- recipients: z19.array(z19.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
3498
+ recipients: z23.array(z23.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
3186
3499
  });
3187
3500
  var BACKUP_ERROR_CODES = [
3188
3501
  "CLICKHOUSE_BACKUP_FAILED",
@@ -3196,48 +3509,48 @@ var BACKUP_ERROR_CODES = [
3196
3509
  "RESTORE_FAILED",
3197
3510
  "ROW_COUNT_MISMATCH"
3198
3511
  ];
3199
- var backupReportSchema = z19.object({
3512
+ var backupReportSchema = z23.object({
3200
3513
  backup_id: backupIdSchema,
3201
- kind: z19.enum(BACKUP_KINDS),
3202
- status: z19.enum(["succeeded", "failed"]),
3203
- started_at: z19.string().datetime(),
3204
- finished_at: z19.string().datetime(),
3514
+ kind: z23.enum(BACKUP_KINDS),
3515
+ status: z23.enum(["succeeded", "failed"]),
3516
+ started_at: z23.string().datetime(),
3517
+ finished_at: z23.string().datetime(),
3205
3518
  manifest: backupManifestSchema.nullable(),
3206
- error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
3519
+ error_code: z23.enum(BACKUP_ERROR_CODES).nullable()
3207
3520
  });
3208
- var drillReportSchema = z19.object({
3521
+ var drillReportSchema = z23.object({
3209
3522
  backup_id: backupIdSchema,
3210
- kind: z19.enum(["weekly_local", "monthly_new_machine"]),
3211
- status: z19.enum(["passed", "failed"]),
3212
- finished_at: z19.string().datetime(),
3213
- detail: z19.string().max(300),
3214
- error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
3523
+ kind: z23.enum(["weekly_local", "monthly_new_machine"]),
3524
+ status: z23.enum(["passed", "failed"]),
3525
+ finished_at: z23.string().datetime(),
3526
+ detail: z23.string().max(300),
3527
+ error_code: z23.enum(BACKUP_ERROR_CODES).nullable()
3215
3528
  });
3216
- var nodeIdentityEscrowSchema = z19.object({
3217
- v: z19.literal(1),
3218
- node_id: z19.guid(),
3219
- seal: z19.object({
3220
- publicKey: z19.string().regex(/^[A-Za-z0-9_-]{43}$/),
3221
- privateKey: z19.string().regex(/^[A-Za-z0-9_-]{43}$/)
3222
- }),
3223
- created_at: z19.string().datetime()
3529
+ var nodeIdentityEscrowSchema = z23.object({
3530
+ v: z23.literal(1),
3531
+ node_id: z23.guid(),
3532
+ seal: z23.object({
3533
+ publicKey: z23.string().regex(/^[A-Za-z0-9_-]{43}$/),
3534
+ privateKey: z23.string().regex(/^[A-Za-z0-9_-]{43}$/)
3535
+ }),
3536
+ created_at: z23.string().datetime()
3224
3537
  });
3225
- var restoreArgsSchema = z19.object({
3226
- job_id: z19.guid(),
3227
- workspace_id: z19.guid(),
3228
- source_node_id: z19.guid(),
3538
+ var restoreArgsSchema = z23.object({
3539
+ job_id: z23.guid(),
3540
+ workspace_id: z23.guid(),
3541
+ source_node_id: z23.guid(),
3229
3542
  manifest: backupManifestSchema,
3230
- sealed_identity: z19.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
3231
- mode: z19.enum(["rebuild", "drill"])
3543
+ sealed_identity: z23.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
3544
+ mode: z23.enum(["rebuild", "drill"])
3232
3545
  });
3233
- var restoreReportSchema = z19.object({
3234
- job_id: z19.guid(),
3546
+ var restoreReportSchema = z23.object({
3547
+ job_id: z23.guid(),
3235
3548
  backup_id: backupIdSchema,
3236
- mode: z19.enum(["rebuild", "drill"]),
3237
- status: z19.enum(["succeeded", "failed"]),
3238
- finished_at: z19.string().datetime(),
3239
- detail: z19.string().max(300),
3240
- error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
3549
+ mode: z23.enum(["rebuild", "drill"]),
3550
+ status: z23.enum(["succeeded", "failed"]),
3551
+ finished_at: z23.string().datetime(),
3552
+ detail: z23.string().max(300),
3553
+ error_code: z23.enum(BACKUP_ERROR_CODES).nullable()
3241
3554
  });
3242
3555
 
3243
3556
  // ../src/shared/contracts/node-config.ts
@@ -3251,83 +3564,84 @@ var SCRUB_GROUPS = [
3251
3564
  "headers"
3252
3565
  ];
3253
3566
  var MAX_NODE_MONITORS = 5000;
3254
- var kid = z20.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
3255
- var publicKey = z20.string().regex(/^[A-Za-z0-9_-]{43}$/);
3256
- var nodeConfigSchema = z20.object({
3257
- v: z20.literal(1),
3258
- config_version: z20.number().int().positive(),
3259
- node_id: z20.guid(),
3260
- workspace_id: z20.guid(),
3261
- workspace_status: z20.enum(["active", "suspended"]),
3262
- issued_at: z20.string().datetime(),
3263
- retention_days: z20.number().int().min(1).max(3650),
3264
- channel: z20.enum(["stable", "canary"]).optional(),
3265
- projects: z20.array(z20.object({
3266
- project_id: z20.number().int().positive(),
3267
- slug: z20.string().max(64),
3268
- short_prefix: z20.string().regex(/^[A-Z0-9]{1,12}$/),
3269
- user_id_salt: z20.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
3270
- scrub_disabled: z20.array(z20.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
3271
- upload_tokens: z20.array(z20.object({
3272
- hash: z20.string().regex(/^[a-f0-9]{64}$/),
3273
- expires_at: z20.string().datetime()
3567
+ var kid = z24.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
3568
+ var publicKey = z24.string().regex(/^[A-Za-z0-9_-]{43}$/);
3569
+ var nodeConfigSchema = z24.object({
3570
+ v: z24.literal(1),
3571
+ config_version: z24.number().int().positive(),
3572
+ node_id: z24.guid(),
3573
+ workspace_id: z24.guid(),
3574
+ workspace_status: z24.enum(["active", "suspended"]),
3575
+ issued_at: z24.string().datetime(),
3576
+ retention_days: z24.number().int().min(1).max(3650),
3577
+ channel: z24.enum(["stable", "canary"]).optional(),
3578
+ projects: z24.array(z24.object({
3579
+ project_id: z24.number().int().positive(),
3580
+ slug: z24.string().max(64),
3581
+ short_prefix: z24.string().regex(/^[A-Z0-9]{1,12}$/),
3582
+ user_id_salt: z24.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
3583
+ scrub_disabled: z24.array(z24.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
3584
+ upload_tokens: z24.array(z24.object({
3585
+ hash: z24.string().regex(/^[a-f0-9]{64}$/),
3586
+ expires_at: z24.string().datetime()
3274
3587
  })).max(10).optional()
3275
3588
  })).max(1000),
3276
- ticket_keys: z20.array(z20.object({ kid, public_key: publicKey, not_after: z20.string().datetime() })).min(1).max(5),
3277
- control_ops_keys: z20.array(z20.object({ kid, public_key: publicKey })).min(1).max(5),
3278
- kill_switches: z20.object({ ingest: z20.boolean(), alerts: z20.boolean() }),
3589
+ ticket_keys: z24.array(z24.object({ kid, public_key: publicKey, not_after: z24.string().datetime() })).min(1).max(5),
3590
+ control_ops_keys: z24.array(z24.object({ kid, public_key: publicKey })).min(1).max(5),
3591
+ kill_switches: z24.object({ ingest: z24.boolean(), alerts: z24.boolean() }),
3279
3592
  backup: nodeBackupConfigSchema.optional(),
3280
- purged_projects: z20.array(z20.number().int().positive()).max(1000).optional(),
3281
- monitors: z20.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
3282
- purged_monitors: z20.array(z20.guid()).max(5000).optional(),
3283
- telemetry: z20.object({
3284
- traces_retention_days: z20.number().int().min(1).max(90),
3285
- logs_retention_days: z20.number().int().min(1).max(90),
3286
- traces_disk_share: z20.number().min(0.2).max(0.8)
3593
+ purged_projects: z24.array(z24.number().int().positive()).max(1000).optional(),
3594
+ monitors: z24.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
3595
+ purged_monitors: z24.array(z24.guid()).max(5000).optional(),
3596
+ telemetry: z24.object({
3597
+ traces_retention_days: z24.number().int().min(1).max(90),
3598
+ logs_retention_days: z24.number().int().min(1).max(90),
3599
+ traces_disk_share: z24.number().min(0.2).max(0.8)
3287
3600
  }).optional(),
3288
- slos: z20.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
3289
- signal_monitors: z20.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
3290
- signal_limits: signalLimitsConfigSchema.optional()
3601
+ slos: z24.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
3602
+ signal_monitors: z24.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
3603
+ signal_limits: signalLimitsConfigSchema.optional(),
3604
+ privacy: nodePrivacyBlockSchema.optional()
3291
3605
  });
3292
- var signedNodeConfigSchema = z20.object({ config: nodeConfigSchema, kid, sig: z20.string() });
3606
+ var signedNodeConfigSchema = z24.object({ config: nodeConfigSchema, kid, sig: z24.string() });
3293
3607
 
3294
3608
  // ../src/shared/contracts/api-ops/projects.ts
3295
- var slug = z21.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
3296
- var name3 = z21.string().trim().min(1).max(60);
3297
- var label = z21.string().trim().min(1).max(40);
3298
- var platform = z21.enum(PLATFORMS);
3299
- var origin = z21.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
3300
- var keyId = z21.number().int().positive();
3609
+ var slug = z25.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
3610
+ var name3 = z25.string().trim().min(1).max(60);
3611
+ var label = z25.string().trim().min(1).max(40);
3612
+ var platform = z25.enum(PLATFORMS);
3613
+ var origin = z25.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
3614
+ var keyId = z25.number().int().positive();
3301
3615
  var PROJECT_INPUTS = {
3302
- create: z21.object({ workspaceId: uuid, name: name3, slug, platform }),
3303
- update: z21.object({ projectId, name: name3, platform, isPinned: z21.boolean() }),
3304
- updateIntake: z21.object({
3616
+ create: z25.object({ workspaceId: uuid, name: name3, slug, platform }),
3617
+ update: z25.object({ projectId, name: name3, platform, isPinned: z25.boolean() }),
3618
+ updateIntake: z25.object({
3305
3619
  projectId,
3306
- rateLimit: z21.number().int().positive().nullable(),
3307
- burst: z21.number().int().positive().nullable(),
3308
- allowedOrigins: z21.array(origin).max(50)
3620
+ rateLimit: z25.number().int().positive().nullable(),
3621
+ burst: z25.number().int().positive().nullable(),
3622
+ allowedOrigins: z25.array(origin).max(50)
3309
3623
  }),
3310
- updateObservability: z21.object({
3624
+ updateObservability: z25.object({
3311
3625
  projectId,
3312
- primaryEnvironment: z21.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
3313
- allowCodeMonitors: z21.boolean()
3626
+ primaryEnvironment: z25.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
3627
+ allowCodeMonitors: z25.boolean()
3314
3628
  }),
3315
- setScrub: z21.object({ projectId, group: z21.enum(SCRUB_GROUPS), enabled: z21.boolean() }),
3316
- setCheckinAuth: z21.object({ projectId, mode: z21.enum(CHECKIN_AUTH_MODES) }),
3317
- setEnvironmentHidden: z21.object({
3629
+ setScrub: z25.object({ projectId, group: z25.enum(SCRUB_GROUPS), enabled: z25.boolean() }),
3630
+ setCheckinAuth: z25.object({ projectId, mode: z25.enum(CHECKIN_AUTH_MODES) }),
3631
+ setEnvironmentHidden: z25.object({
3318
3632
  projectId,
3319
- name: z21.string().min(1).max(64),
3320
- hidden: z21.boolean()
3321
- }),
3322
- scheduleDeletion: z21.object({ projectId, confirmSlug: slug }),
3323
- projectOnly: z21.object({ projectId }),
3324
- labelled: z21.object({ projectId, label }),
3325
- keyOnly: z21.object({ keyId }),
3326
- tokenOnly: z21.object({ tokenId: keyId }),
3633
+ name: z25.string().min(1).max(64),
3634
+ hidden: z25.boolean()
3635
+ }),
3636
+ scheduleDeletion: z25.object({ projectId, confirmSlug: slug }),
3637
+ projectOnly: z25.object({ projectId }),
3638
+ labelled: z25.object({ projectId, label }),
3639
+ keyOnly: z25.object({ keyId }),
3640
+ tokenOnly: z25.object({ tokenId: keyId }),
3327
3641
  createIngestKey: createIngestKeyInputSchema,
3328
- ingestKeyOnly: z21.object({ keyId: uuid })
3642
+ ingestKeyOnly: z25.object({ keyId: uuid })
3329
3643
  };
3330
- var P = PROJECT_INPUTS;
3644
+ var P2 = PROJECT_INPUTS;
3331
3645
  var PROJECT_OPERATIONS = [
3332
3646
  op({
3333
3647
  id: "projects.create",
@@ -3337,7 +3651,7 @@ var PROJECT_OPERATIONS = [
3337
3651
  sensitivity: "normal",
3338
3652
  kind: "write",
3339
3653
  rpcs: ["create_project"],
3340
- input: P.create,
3654
+ input: P2.create,
3341
3655
  workspace: true,
3342
3656
  idempotency: "required",
3343
3657
  status: 201,
@@ -3353,7 +3667,7 @@ var PROJECT_OPERATIONS = [
3353
3667
  sensitivity: "normal",
3354
3668
  kind: "write",
3355
3669
  rpcs: ["update_project"],
3356
- input: P.update,
3670
+ input: P2.update,
3357
3671
  ifMatch: true,
3358
3672
  idempotency: "none",
3359
3673
  mcp: "configure",
@@ -3368,7 +3682,7 @@ var PROJECT_OPERATIONS = [
3368
3682
  sensitivity: "normal",
3369
3683
  kind: "write",
3370
3684
  rpcs: ["update_project_intake"],
3371
- input: P.updateIntake,
3685
+ input: P2.updateIntake,
3372
3686
  ifMatch: true,
3373
3687
  idempotency: "none",
3374
3688
  mcp: "configure",
@@ -3383,7 +3697,7 @@ var PROJECT_OPERATIONS = [
3383
3697
  sensitivity: "normal",
3384
3698
  kind: "write",
3385
3699
  rpcs: ["update_project_observability"],
3386
- input: P.updateObservability,
3700
+ input: P2.updateObservability,
3387
3701
  ifMatch: true,
3388
3702
  idempotency: "none",
3389
3703
  mcp: "configure",
@@ -3395,10 +3709,10 @@ var PROJECT_OPERATIONS = [
3395
3709
  method: "PUT",
3396
3710
  path: "/v1/projects/{project_id}/scrub/{group}",
3397
3711
  scope: "privacy:write",
3398
- sensitivity: "normal",
3712
+ sensitivity: "approval",
3399
3713
  kind: "write",
3400
3714
  rpcs: ["set_project_scrub"],
3401
- input: P.setScrub,
3715
+ input: P2.setScrub,
3402
3716
  idempotency: "none",
3403
3717
  mcp: "configure",
3404
3718
  summary: "Turn one built-in scrubbing group on or off.",
@@ -3412,7 +3726,7 @@ var PROJECT_OPERATIONS = [
3412
3726
  sensitivity: "approval",
3413
3727
  kind: "write",
3414
3728
  rpcs: ["set_project_checkin_auth"],
3415
- input: P.setCheckinAuth,
3729
+ input: P2.setCheckinAuth,
3416
3730
  idempotency: "none",
3417
3731
  mcp: "configure",
3418
3732
  summary: "Choose which credentials may send check-ins.",
@@ -3426,7 +3740,7 @@ var PROJECT_OPERATIONS = [
3426
3740
  sensitivity: "normal",
3427
3741
  kind: "write",
3428
3742
  rpcs: ["set_environment_hidden"],
3429
- input: P.setEnvironmentHidden,
3743
+ input: P2.setEnvironmentHidden,
3430
3744
  idempotency: "none",
3431
3745
  mcp: "configure",
3432
3746
  summary: "Hide or show an environment in lists.",
@@ -3440,7 +3754,7 @@ var PROJECT_OPERATIONS = [
3440
3754
  sensitivity: "approval",
3441
3755
  kind: "write",
3442
3756
  rpcs: ["schedule_project_deletion"],
3443
- input: P.scheduleDeletion,
3757
+ input: P2.scheduleDeletion,
3444
3758
  idempotency: "none",
3445
3759
  mcp: "configure",
3446
3760
  summary: "Schedule the project's deletion; `confirm_slug` must repeat its slug.",
@@ -3454,7 +3768,7 @@ var PROJECT_OPERATIONS = [
3454
3768
  sensitivity: "normal",
3455
3769
  kind: "write",
3456
3770
  rpcs: ["cancel_project_deletion"],
3457
- input: P.projectOnly,
3771
+ input: P2.projectOnly,
3458
3772
  idempotency: "optional",
3459
3773
  mcp: "configure",
3460
3774
  summary: "Cancel a scheduled project deletion.",
@@ -3468,7 +3782,7 @@ var PROJECT_OPERATIONS = [
3468
3782
  sensitivity: "normal",
3469
3783
  kind: "write",
3470
3784
  rpcs: ["request_test_event"],
3471
- input: P.projectOnly,
3785
+ input: P2.projectOnly,
3472
3786
  idempotency: "optional",
3473
3787
  mcp: "reliability",
3474
3788
  summary: "Ask the node to send one test event through the public intake.",
@@ -3482,7 +3796,7 @@ var PROJECT_OPERATIONS = [
3482
3796
  sensitivity: "approval",
3483
3797
  kind: "write",
3484
3798
  rpcs: ["create_project_key"],
3485
- input: P.labelled,
3799
+ input: P2.labelled,
3486
3800
  idempotency: "required",
3487
3801
  status: 201,
3488
3802
  mcp: "configure",
@@ -3497,7 +3811,7 @@ var PROJECT_OPERATIONS = [
3497
3811
  sensitivity: "approval",
3498
3812
  kind: "write",
3499
3813
  rpcs: ["rotate_project_key"],
3500
- input: P.keyOnly,
3814
+ input: P2.keyOnly,
3501
3815
  idempotency: "optional",
3502
3816
  mcp: "configure",
3503
3817
  summary: "Replace a DSN key.",
@@ -3511,7 +3825,7 @@ var PROJECT_OPERATIONS = [
3511
3825
  sensitivity: "approval",
3512
3826
  kind: "write",
3513
3827
  rpcs: ["revoke_project_key"],
3514
- input: P.keyOnly,
3828
+ input: P2.keyOnly,
3515
3829
  idempotency: "none",
3516
3830
  mcp: "configure",
3517
3831
  summary: "Revoke a DSN key.",
@@ -3525,7 +3839,7 @@ var PROJECT_OPERATIONS = [
3525
3839
  sensitivity: "approval",
3526
3840
  kind: "write",
3527
3841
  rpcs: ["create_upload_token"],
3528
- input: P.labelled,
3842
+ input: P2.labelled,
3529
3843
  idempotency: "required",
3530
3844
  status: 201,
3531
3845
  mcp: "configure",
@@ -3541,7 +3855,7 @@ var PROJECT_OPERATIONS = [
3541
3855
  sensitivity: "approval",
3542
3856
  kind: "write",
3543
3857
  rpcs: ["revoke_upload_token"],
3544
- input: P.tokenOnly,
3858
+ input: P2.tokenOnly,
3545
3859
  idempotency: "none",
3546
3860
  mcp: "configure",
3547
3861
  summary: "Revoke a source map upload token.",
@@ -3555,7 +3869,7 @@ var PROJECT_OPERATIONS = [
3555
3869
  sensitivity: "approval",
3556
3870
  kind: "write",
3557
3871
  rpcs: ["create_ingest_key"],
3558
- input: P.createIngestKey,
3872
+ input: P2.createIngestKey,
3559
3873
  idempotency: "required",
3560
3874
  status: 201,
3561
3875
  mcp: "configure",
@@ -3571,7 +3885,7 @@ var PROJECT_OPERATIONS = [
3571
3885
  sensitivity: "approval",
3572
3886
  kind: "write",
3573
3887
  rpcs: ["revoke_ingest_key"],
3574
- input: P.ingestKeyOnly,
3888
+ input: P2.ingestKeyOnly,
3575
3889
  idempotency: "none",
3576
3890
  mcp: "configure",
3577
3891
  summary: "Revoke an OTLP ingest key.",
@@ -3580,24 +3894,24 @@ var PROJECT_OPERATIONS = [
3580
3894
  ];
3581
3895
 
3582
3896
  // ../src/shared/contracts/api-ops/reads.ts
3583
- import { z as z22 } from "zod";
3584
- var list = z22.object({ workspaceId: uuid, limit: pageLimit, cursor });
3897
+ import { z as z26 } from "zod";
3898
+ var list = z26.object({ workspaceId: uuid, limit: pageLimit, cursor });
3585
3899
  var READ_INPUTS = {
3586
- workspace: z22.object({ workspaceId: uuid }),
3900
+ workspace: z26.object({ workspaceId: uuid }),
3587
3901
  list,
3588
- projectsGet: z22.object({ workspaceId: uuid, projectId }),
3902
+ projectsGet: z26.object({ workspaceId: uuid, projectId }),
3589
3903
  monitorsList: list.extend({ projectId: projectId.optional() }),
3590
- monitorsGet: z22.object({ workspaceId: uuid, monitorId: uuid }),
3591
- uptimeGet: z22.object({ workspaceId: uuid, checkId: uuid }),
3592
- slosGet: z22.object({ workspaceId: uuid, sloId: uuid }),
3904
+ monitorsGet: z26.object({ workspaceId: uuid, monitorId: uuid }),
3905
+ uptimeGet: z26.object({ workspaceId: uuid, checkId: uuid }),
3906
+ slosGet: z26.object({ workspaceId: uuid, sloId: uuid }),
3593
3907
  alertsList: list.extend({
3594
- state: z22.enum(["open", "resolved", "all"]).default("all"),
3908
+ state: z26.enum(["open", "resolved", "all"]).default("all"),
3595
3909
  monitorId: uuid.optional()
3596
3910
  }),
3597
- approvalsGet: z22.object({ workspaceId: uuid, approvalId: uuid }),
3911
+ approvalsGet: z26.object({ workspaceId: uuid, approvalId: uuid }),
3598
3912
  monitorsListTyped: list.extend({
3599
3913
  projectId: projectId.optional(),
3600
- type: z22.enum(MONITOR_TYPES).optional()
3914
+ type: z26.enum(MONITOR_TYPES).optional()
3601
3915
  })
3602
3916
  };
3603
3917
  var R = READ_INPUTS;
@@ -3809,6 +4123,8 @@ var API_OPERATIONS = [
3809
4123
  ...MONITOR_OPERATIONS,
3810
4124
  ...ALERT_OPERATIONS,
3811
4125
  ...INCIDENT_OPERATIONS,
4126
+ ...COVERAGE_OPERATIONS,
4127
+ ...PRIVACY_OPERATIONS,
3812
4128
  ...ACCESS_OPERATIONS,
3813
4129
  ...NODE_OPERATIONS
3814
4130
  ];
@@ -3833,6 +4149,8 @@ var APPROVAL_LIMITS = {
3833
4149
  var APPROVAL_APPROVER = {
3834
4150
  "projects.set_checkin_auth": "admin",
3835
4151
  "projects.schedule_deletion": "admin",
4152
+ "projects.set_scrub": "admin",
4153
+ "privacy.set": "admin",
3836
4154
  "project_keys.create": "member",
3837
4155
  "project_keys.rotate": "member",
3838
4156
  "project_keys.revoke": "member",
@@ -3877,14 +4195,14 @@ function approvalRequestSchema(operationId, input) {
3877
4195
  }
3878
4196
 
3879
4197
  // ../src/shared/contracts/api-ops/wire.ts
3880
- import { z as z23 } from "zod";
4198
+ import { z as z27 } from "zod";
3881
4199
  var toSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
3882
4200
  var toCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
3883
4201
  var schemaCache = new WeakMap;
3884
4202
  function inputJsonSchema(op) {
3885
4203
  let js = schemaCache.get(op.input);
3886
4204
  if (!js) {
3887
- js = z23.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
4205
+ js = z27.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
3888
4206
  schemaCache.set(op.input, js);
3889
4207
  }
3890
4208
  return js;
@@ -4098,7 +4416,7 @@ function wireInput(operationId, opts = {}) {
4098
4416
  for (const [k, v] of Object.entries(op.input.shape))
4099
4417
  if (!omit.has(k))
4100
4418
  shape[toSnake(k)] = v;
4101
- return z24.object(shape);
4419
+ return z28.object(shape);
4102
4420
  }
4103
4421
  var BUDGETS = [
4104
4422
  { stringBytes: MCP_LIMITS.untrustedStringMaxBytes, listMax: MCP_LIMITS.listMax },
@@ -4188,40 +4506,40 @@ function errorResult(o) {
4188
4506
  }
4189
4507
  };
4190
4508
  }
4191
- var TOOL_OUTPUT_SCHEMA = z24.object({
4192
- untrusted: z24.object({
4193
- data: z24.unknown(),
4194
- provenance: z24.object({
4195
- source: z24.enum(["node", "control_plane", "docs"]),
4196
- operations: z24.array(z24.string())
4509
+ var TOOL_OUTPUT_SCHEMA = z28.object({
4510
+ untrusted: z28.object({
4511
+ data: z28.unknown(),
4512
+ provenance: z28.object({
4513
+ source: z28.enum(["node", "control_plane", "docs"]),
4514
+ operations: z28.array(z28.string())
4197
4515
  })
4198
4516
  }).optional(),
4199
- doc: z24.object({ slug: z24.string(), locale: z24.enum(["en", "vi"]), url: z24.string(), markdown: z24.string(), truncated: z24.boolean() }).optional(),
4200
- results: z24.array(z24.object({ slug: z24.string(), title: z24.string(), description: z24.string(), section: z24.string(), url: z24.string() })).optional(),
4201
- next_cursor: z24.string().nullable().optional(),
4202
- complete: z24.boolean().optional(),
4203
- omitted: z24.array(z24.object({ part: z24.string(), reason: z24.string(), scope: z24.string().optional() })).optional(),
4204
- truncated: z24.literal(true).optional(),
4205
- suspicious_unicode: z24.literal(true).optional(),
4206
- error: z24.object({
4207
- code: z24.string(),
4208
- status: z24.number(),
4209
- detail: z24.string().optional(),
4210
- scope: z24.string().optional(),
4211
- retry_after: z24.number().optional()
4517
+ doc: z28.object({ slug: z28.string(), locale: z28.enum(["en", "vi"]), url: z28.string(), markdown: z28.string(), truncated: z28.boolean() }).optional(),
4518
+ results: z28.array(z28.object({ slug: z28.string(), title: z28.string(), description: z28.string(), section: z28.string(), url: z28.string() })).optional(),
4519
+ next_cursor: z28.string().nullable().optional(),
4520
+ complete: z28.boolean().optional(),
4521
+ omitted: z28.array(z28.object({ part: z28.string(), reason: z28.string(), scope: z28.string().optional() })).optional(),
4522
+ truncated: z28.literal(true).optional(),
4523
+ suspicious_unicode: z28.literal(true).optional(),
4524
+ error: z28.object({
4525
+ code: z28.string(),
4526
+ status: z28.number(),
4527
+ detail: z28.string().optional(),
4528
+ scope: z28.string().optional(),
4529
+ retry_after: z28.number().optional()
4212
4530
  }).optional(),
4213
- operations: z24.array(z24.record(z24.string(), z24.unknown())).optional(),
4214
- operation: z24.record(z24.string(), z24.unknown()).optional(),
4215
- plan: z24.record(z24.string(), z24.unknown()).optional(),
4216
- status: z24.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
4217
- approval: z24.object({
4218
- approval_id: z24.string(),
4219
- approval_url: z24.string(),
4220
- expires_at: z24.string(),
4221
- state: z24.enum(APPROVAL_STATES),
4222
- result_code: z24.string().nullable().optional(),
4223
- result: z24.record(z24.string(), z24.unknown()).optional(),
4224
- next: z24.string().optional()
4531
+ operations: z28.array(z28.record(z28.string(), z28.unknown())).optional(),
4532
+ operation: z28.record(z28.string(), z28.unknown()).optional(),
4533
+ plan: z28.record(z28.string(), z28.unknown()).optional(),
4534
+ status: z28.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
4535
+ approval: z28.object({
4536
+ approval_id: z28.string(),
4537
+ approval_url: z28.string(),
4538
+ expires_at: z28.string(),
4539
+ state: z28.enum(APPROVAL_STATES),
4540
+ result_code: z28.string().nullable().optional(),
4541
+ result: z28.record(z28.string(), z28.unknown()).optional(),
4542
+ next: z28.string().optional()
4225
4543
  }).optional()
4226
4544
  });
4227
4545
  var spec = (name) => {
@@ -4267,10 +4585,10 @@ var has = (rt, operationId) => {
4267
4585
  return !!op && rt.scopes.includes(op.scope);
4268
4586
  };
4269
4587
  var isoWindow = {
4270
- start: z24.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
4271
- end: z24.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
4588
+ start: z28.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
4589
+ end: z28.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
4272
4590
  };
4273
- var traceIdSchema = z24.string().regex(/^[0-9a-fA-F]{32}$/);
4591
+ var traceIdSchema = z28.string().regex(/^[0-9a-fA-F]{32}$/);
4274
4592
  var MONITOR_KINDS2 = {
4275
4593
  cron: { list: "monitors.list", get: "monitors.get", idField: "monitor_id" },
4276
4594
  uptime: { list: "uptime.list", get: "uptime.get", idField: "check_id" },
@@ -4334,8 +4652,8 @@ function describe(op, scopes) {
4334
4652
  destructive: isDestructiveOperation(op)
4335
4653
  };
4336
4654
  }
4337
- var params = z24.record(z24.string(), z24.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
4338
- var operationIdArg = z24.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
4655
+ var params = z28.record(z28.string(), z28.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
4656
+ var operationIdArg = z28.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
4339
4657
  function approvalBlock(t, next) {
4340
4658
  return {
4341
4659
  approval_id: t.approval_id,
@@ -4355,7 +4673,7 @@ var MCP_TOOL_DEFS = [
4355
4673
  title: "Workspace and node",
4356
4674
  description: "The workspace this token belongs to (name, plan, limits) and the state of its node, the server that stores errors, traces and logs. Start here to learn what the token can reach.",
4357
4675
  operations: ["workspace.get", "node.get"],
4358
- input: z24.object({}),
4676
+ input: z28.object({}),
4359
4677
  async run(_args, rt) {
4360
4678
  const [ws, node] = await Promise.all([rt.call("workspace.get", {}), rt.call("node.get", {})]);
4361
4679
  if (!ws.ok)
@@ -4373,9 +4691,9 @@ var MCP_TOOL_DEFS = [
4373
4691
  title: "Get an issue",
4374
4692
  description: "One issue with its 24 h and 30 d counts and, when the token can read events, its latest event (stack trace, request, breadcrumbs — scrubbed on the node).",
4375
4693
  operations: ["issues.get", "events.get"],
4376
- input: z24.object({
4377
- issue_id: z24.number().int().positive().describe("Issue id from search_issues."),
4378
- include_latest_event: z24.boolean().default(true)
4694
+ input: z28.object({
4695
+ issue_id: z28.number().int().positive().describe("Issue id from search_issues."),
4696
+ include_latest_event: z28.boolean().default(true)
4379
4697
  }),
4380
4698
  async run(args, rt) {
4381
4699
  const omitted = [];
@@ -4403,9 +4721,9 @@ var MCP_TOOL_DEFS = [
4403
4721
  title: "Get a trace",
4404
4722
  description: "Summary of one distributed trace (services, duration, errors) by its 32-hex trace id, and optionally its spans (errors only, or the first page).",
4405
4723
  operations: ["traces.get", "traces.spans"],
4406
- input: z24.object({
4724
+ input: z28.object({
4407
4725
  trace_id: traceIdSchema.describe("W3C trace id, 32 hex characters."),
4408
- spans: z24.enum(["none", "errors", "all"]).default("none")
4726
+ spans: z28.enum(["none", "errors", "all"]).default("none")
4409
4727
  }),
4410
4728
  async run(args, rt) {
4411
4729
  const sum = await rt.call("traces.get", { trace_id: args["trace_id"] });
@@ -4433,11 +4751,11 @@ var MCP_TOOL_DEFS = [
4433
4751
  title: "Correlate by trace or run",
4434
4752
  description: "Everything that shares one W3C trace id or one Belvador run id (`belvador.run.id`, set by job monitors) in a time window: the trace summary, its error spans and the logs. Give exactly one of trace_id or run_id.",
4435
4753
  operations: ["traces.get", "traces.spans", "spans.list", "logs.list"],
4436
- input: z24.object({
4754
+ input: z28.object({
4437
4755
  trace_id: traceIdSchema.optional(),
4438
- run_id: z24.string().min(1).max(128).optional(),
4756
+ run_id: z28.string().min(1).max(128).optional(),
4439
4757
  ...isoWindow,
4440
- project: z24.string().max(2000).optional().describe("Comma-separated project ids.")
4758
+ project: z28.string().max(2000).optional().describe("Comma-separated project ids.")
4441
4759
  }),
4442
4760
  async run(args, rt) {
4443
4761
  const trace = args["trace_id"];
@@ -4482,10 +4800,10 @@ var MCP_TOOL_DEFS = [
4482
4800
  title: "List monitors",
4483
4801
  description: "Monitors (cron, heartbeat, count, assertion, deadline, progress), uptime checks and SLOs with their current status. `kind` narrows to one family; `project_id` to one project (cron and uptime).",
4484
4802
  operations: ["monitors.list", "uptime.list", "slos.list"],
4485
- input: z24.object({
4486
- kind: z24.enum(["all", "cron", "uptime", "slo"]).default("all"),
4487
- project_id: z24.number().int().positive().optional(),
4488
- limit: z24.number().int().min(1).max(200).default(50)
4803
+ input: z28.object({
4804
+ kind: z28.enum(["all", "cron", "uptime", "slo"]).default("all"),
4805
+ project_id: z28.number().int().positive().optional(),
4806
+ limit: z28.number().int().min(1).max(200).default(50)
4489
4807
  }),
4490
4808
  async run(args, rt) {
4491
4809
  const kinds = args["kind"] && args["kind"] !== "all" ? [args["kind"]] : ["cron", "uptime", "slo"];
@@ -4513,10 +4831,10 @@ var MCP_TOOL_DEFS = [
4513
4831
  title: "Get a monitor",
4514
4832
  description: "One monitor (any type), uptime check or SLO by id: settings, current status and recent results. For count, assertion, deadline and progress monitors it adds the last 24 h of minute counts or runs from the node, and for deadline monitors the newest occurrences. `backtest: true` (count/assertion only) also replays the current settings over the last 30 days: how often it would have alerted.",
4515
4833
  operations: ["monitors.get", "uptime.get", "slos.get", "monitors.signal", "monitors.occurrences", "monitors.backtest"],
4516
- input: z24.object({
4517
- kind: z24.enum(["cron", "uptime", "slo"]),
4518
- id: z24.guid(),
4519
- backtest: z24.boolean().default(false)
4834
+ input: z28.object({
4835
+ kind: z28.enum(["cron", "uptime", "slo"]),
4836
+ id: z28.guid(),
4837
+ backtest: z28.boolean().default(false)
4520
4838
  }),
4521
4839
  async run(args, rt) {
4522
4840
  const k = MONITOR_KINDS2[args["kind"]];
@@ -4566,14 +4884,15 @@ var MCP_TOOL_DEFS = [
4566
4884
  single("list_alerts", "alerts.list", "List alerts", "Alerts Belvador raised (open, resolved or all), newest first, optionally for one monitor."),
4567
4885
  single("list_incidents", "incidents.list", "List incidents", "Incidents (INC-n): related alerts grouped into one piece of work. State (open, acknowledged, monitoring, resolved), severity and peak, owner, linked and still-firing alert counts; newest first. `state` = active, resolved or all. Returns ids for get_incident."),
4568
4886
  single("get_incident", "incidents.get", "Get an incident", "One incident by id: its linked alerts (monitor, uptime, SLO, issue) with ids for get_monitor_status or get_issue, the timeline (opened, joined, acknowledged, notes, escalation, resolution) and each message's delivery state. `accepted` means the service took the message; only `acknowledged: true` means a person took the incident."),
4887
+ single("get_coverage", "coverage.get", "Get coverage", "What each app is expected to send (part of the app × signal × environment) against what Belvador really received: `verified` (fresh evidence or verification receipt), `stale`, `problem` (open connection problem) or `unknown` (never seen). Same numbers as the Coverage page. `undeclared` lists signals seen without an expectation; they do not count. Optional `project_id` and `environment` narrow it."),
4569
4888
  {
4570
4889
  ...spec("verify_integration"),
4571
4890
  title: "Send a test event",
4572
4891
  description: "Asks the node to send one tagged test error through the public intake of a project, proving the path real errors take. Not read-only: it creates one test event (reuse idempotency_key to retry without a second one).",
4573
4892
  operations: ["projects.send_test_event"],
4574
- input: z24.object({
4575
- project_id: z24.number().int().positive(),
4576
- idempotency_key: z24.string().min(8).max(255).optional()
4893
+ input: z28.object({
4894
+ project_id: z28.number().int().positive(),
4895
+ idempotency_key: z28.string().min(8).max(255).optional()
4577
4896
  }),
4578
4897
  async run(args, rt) {
4579
4898
  const r = await rt.call("projects.send_test_event", { project_id: args["project_id"] }, { idempotencyKey: args["idempotency_key"] ?? rt.newKey() });
@@ -4587,9 +4906,9 @@ var MCP_TOOL_DEFS = [
4587
4906
  title: "Find a configuration change",
4588
4907
  description: "Searches what this token can change in its Belvador workspace: projects, keys and tokens, monitors of every type, maintenance windows, occurrences, uptime checks, SLOs, alert rules and destinations, members, service accounts and the node. Returns operation ids for describe_operation and plan_change, whether a person must approve the change, and whether this token holds the scope.",
4589
4908
  operations: [],
4590
- input: z24.object({
4591
- query: z24.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
4592
- limit: z24.number().int().min(1).max(20).default(10)
4909
+ input: z28.object({
4910
+ query: z28.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
4911
+ limit: z28.number().int().min(1).max(20).default(10)
4593
4912
  }),
4594
4913
  async run(args, rt) {
4595
4914
  const q = words(String(args["query"]));
@@ -4617,7 +4936,7 @@ var MCP_TOOL_DEFS = [
4617
4936
  title: "Describe a configuration change",
4618
4937
  description: "Everything needed to call one operation: its fields (JSON Schema, wire names), the scope, whether it needs If-Match (call plan_change for the current ETag), an idempotency key, or a person's approval, and which fields the approving person types on belvador.dev instead of the agent.",
4619
4938
  operations: [],
4620
- input: z24.object({ operation_id: operationIdArg }),
4939
+ input: z28.object({ operation_id: operationIdArg }),
4621
4940
  async run(args, rt) {
4622
4941
  const op = configureOp(args["operation_id"]);
4623
4942
  if (!op || op.method === "GET")
@@ -4646,7 +4965,7 @@ var MCP_TOOL_DEFS = [
4646
4965
  title: "Check a change before applying it",
4647
4966
  description: "Validates params for one operation without changing anything: field errors, missing scope, whether a person must approve, and — when the resource can be read — its current state, the fields that would change and the ETag to pass as if_match.",
4648
4967
  operations: [],
4649
- input: z24.object({ operation_id: operationIdArg, params }),
4968
+ input: z28.object({ operation_id: operationIdArg, params }),
4650
4969
  async run(args, rt) {
4651
4970
  const op = configureOp(args["operation_id"]);
4652
4971
  if (!op || op.method === "GET")
@@ -4695,11 +5014,11 @@ var MCP_TOOL_DEFS = [
4695
5014
  title: "Apply a configuration change",
4696
5015
  description: "Runs one operation with params (validate first with plan_change). Always send idempotency_key: repeating a call with the same key never applies it twice. Sensitive operations answer approval_required with an approval_url a person opens on belvador.dev; nothing changes until they approve with their authenticator code.",
4697
5016
  operations: [],
4698
- input: z24.object({
5017
+ input: z28.object({
4699
5018
  operation_id: operationIdArg,
4700
5019
  params,
4701
- idempotency_key: z24.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
4702
- if_match: z24.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
5020
+ idempotency_key: z28.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
5021
+ if_match: z28.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
4703
5022
  }),
4704
5023
  async run(args, rt) {
4705
5024
  const op = configureOp(args["operation_id"]);
@@ -4750,7 +5069,7 @@ var MCP_TOOL_DEFS = [
4750
5069
  title: "Follow an approval",
4751
5070
  description: "State of a change waiting for a person's approval: pending, approved, executed (with the ids it produced), rejected, expired or failed (with the error code).",
4752
5071
  operations: ["approvals.get"],
4753
- input: z24.object({ approval_id: z24.guid().describe("approval_id from apply_change.") }),
5072
+ input: z28.object({ approval_id: z28.guid().describe("approval_id from apply_change.") }),
4754
5073
  async run(args, rt) {
4755
5074
  const r = await rt.call("approvals.get", { approval_id: args["approval_id"] });
4756
5075
  if (!r.ok)
@@ -4770,10 +5089,10 @@ var MCP_TOOL_DEFS = [
4770
5089
  title: "Search Belvador docs",
4771
5090
  description: "Searches the public Belvador documentation (titles and summaries) and returns the best pages with their slugs for get_doc.",
4772
5091
  operations: [],
4773
- input: z24.object({
4774
- query: z24.string().min(1).max(200),
4775
- locale: z24.enum(["en", "vi"]).default("en"),
4776
- limit: z24.number().int().min(1).max(10).default(5)
5092
+ input: z28.object({
5093
+ query: z28.string().min(1).max(200),
5094
+ locale: z28.enum(["en", "vi"]).default("en"),
5095
+ limit: z28.number().int().min(1).max(10).default(5)
4777
5096
  }),
4778
5097
  async run(args, rt) {
4779
5098
  const locale = args["locale"] ?? "en";
@@ -4789,9 +5108,9 @@ var MCP_TOOL_DEFS = [
4789
5108
  title: "Read a docs page",
4790
5109
  description: "The Markdown of one public Belvador docs page by slug (e.g. `quickstart`, `sdk/react`, `reference/api`).",
4791
5110
  operations: [],
4792
- input: z24.object({
4793
- slug: z24.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
4794
- locale: z24.enum(["en", "vi"]).default("en")
5111
+ input: z28.object({
5112
+ slug: z28.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
5113
+ locale: z28.enum(["en", "vi"]).default("en")
4795
5114
  }),
4796
5115
  async run(args, rt) {
4797
5116
  const locale = args["locale"] ?? "en";
@@ -4973,7 +5292,7 @@ function findToken(env = process.env, keychain = keychainToken) {
4973
5292
  }
4974
5293
 
4975
5294
  // packages/mcp/src/cli.ts
4976
- var PACKAGE_VERSION = "0.3.0";
5295
+ var PACKAGE_VERSION = "0.4.0";
4977
5296
  var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
4978
5297
 
4979
5298
  Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]