@belvador/mcp 0.3.0 → 0.5.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 +1667 -1054
  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 = 5;
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 },
@@ -208,9 +212,7 @@ var MCP_TOOLS = [
208
212
  { name: "get_doc", toolset: "docs", scope: null, readOnly: true, destructive: false, idempotent: true }
209
213
  ];
210
214
  var MCP_TOOLS_PENDING = {
211
- query_metrics: "P14",
212
- release_health: "P15",
213
- get_coverage: "P10"
215
+ release_health: "P15"
214
216
  };
215
217
 
216
218
  // ../src/shared/mcp/docs.ts
@@ -255,7 +257,7 @@ function docsFetcher(siteUrl, fetcher = fetch, now = () => Date.now()) {
255
257
  import { CLIENT_CAPABILITIES_META_KEY, inputRequired, McpServer } from "@modelcontextprotocol/server";
256
258
 
257
259
  // ../src/shared/contracts/mcp-tools.ts
258
- import { z as z24 } from "zod";
260
+ import { z as z29 } from "zod";
259
261
 
260
262
  // ../src/shared/contracts/api-ops/access.ts
261
263
  import { z as z3 } from "zod";
@@ -643,7 +645,8 @@ var MONITOR_RULE_KINDS = [
643
645
  "count",
644
646
  "assertion",
645
647
  "deadline",
646
- "stalled"
648
+ "stalled",
649
+ "metric"
647
650
  ];
648
651
  var SLO_RULE_SEVERITIES = ["page", "ticket"];
649
652
  function validRuleTriggers(triggers) {
@@ -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 z14 } from "zod";
867
1153
 
868
1154
  // ../src/shared/contracts/notifications.ts
869
- import { z as z9 } from "zod";
1155
+ import { z as z13 } 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,15 +1211,182 @@ 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 z12 } from "zod";
1215
+
1216
+ // ../src/shared/contracts/metrics.ts
1217
+ import { z as z10 } from "zod";
1218
+
1219
+ // ../src/shared/contracts/vocab/telemetry.ts
1220
+ var TELEMETRY_MAX_WINDOW_MS = 7 * 24 * 3600 * 1000;
1221
+ var ATTR_OPS = ["=", "!=", "exists"];
1222
+ var ATTR_FILTERS_MAX = 5;
1223
+ var TELEMETRY_PLAN_DEFAULTS = {
1224
+ traces_retention_days: 7,
1225
+ logs_retention_days: 7,
1226
+ traces_monthly_bytes: 5 * 1000 ** 3,
1227
+ logs_monthly_bytes: 5 * 1000 ** 3,
1228
+ metrics_retention_days: 14,
1229
+ metrics_monthly_bytes: 2 * 1000 ** 3,
1230
+ metric_series_max: 1e4,
1231
+ metric_names_max: 1000,
1232
+ telemetry_rate_bytes_per_sec: 1024 * 1024,
1233
+ telemetry_burst_bytes: 8 * 1024 * 1024,
1234
+ telemetry_buffer_minutes: 15,
1235
+ max_ingest_keys_per_project: 10
1236
+ };
1237
+
1238
+ // ../src/shared/contracts/vocab/metrics.ts
1239
+ var METRIC_TYPES = ["gauge", "sum", "histogram", "exp_histogram"];
1240
+ var METRIC_KINDS = ["gauge", "counter", "histogram", "exp_histogram"];
1241
+ var METRIC_AGGREGATIONS = ["avg", "sum", "min", "max", "count", "rate", "p50", "p90", "p95", "p99"];
1242
+ var METRIC_NAME_RE = /^[A-Za-z_][A-Za-z0-9_.:\-/]{0,254}$/;
1243
+ var METRIC_ATTR_KEY_RE = /^[A-Za-z0-9_.:\-/@]{1,256}$/;
1244
+ var METRIC_GROUP_BY_MAX = 2;
1245
+ function defaultAggregation(kind) {
1246
+ return kind === "counter" ? "rate" : kind === "histogram" || kind === "exp_histogram" ? "p95" : "avg";
1247
+ }
1248
+
1249
+ // ../src/shared/contracts/metrics.ts
1250
+ var METRIC_TEMPORALITIES = ["unspecified", "delta", "cumulative"];
1251
+ var METRIC_LIMITS = {
1252
+ attributesPerSeries: 32,
1253
+ attributeValueMaxChars: 256,
1254
+ nameMaxChars: 255,
1255
+ unitMaxChars: 63,
1256
+ descriptionMaxChars: 512,
1257
+ bucketsMax: 320,
1258
+ seriesActiveMs: 24 * 3600 * 1000,
1259
+ seriesTouchMs: 3600 * 1000,
1260
+ expMaxStoredScale: 3,
1261
+ expMinScale: -10,
1262
+ expMaxScale: 20,
1263
+ resourceKeys: ["service.name", "service.namespace", "deployment.environment.name", "host.name"],
1264
+ limitedNamesKept: 50
1265
+ };
1266
+ var METRIC_PLAN_DEFAULTS = {
1267
+ metrics_retention_days: TELEMETRY_PLAN_DEFAULTS.metrics_retention_days,
1268
+ metrics_monthly_bytes: TELEMETRY_PLAN_DEFAULTS.metrics_monthly_bytes,
1269
+ metric_series_max: TELEMETRY_PLAN_DEFAULTS.metric_series_max,
1270
+ metric_names_max: TELEMETRY_PLAN_DEFAULTS.metric_names_max
1271
+ };
1272
+ var METRIC_SERIES_MAX_RANGE = { min: 100, max: 1e6 };
1273
+ var METRIC_NAMES_MAX_RANGE = { min: 10, max: 1e5 };
1274
+ var metricsConfigSchema = z10.object({
1275
+ retention_days: z10.number().int().min(1).max(90),
1276
+ series_max: z10.number().int().min(METRIC_SERIES_MAX_RANGE.min).max(METRIC_SERIES_MAX_RANGE.max),
1277
+ names_max: z10.number().int().min(METRIC_NAMES_MAX_RANGE.min).max(METRIC_NAMES_MAX_RANGE.max)
1278
+ });
1279
+ var METRIC_QUERY = {
1280
+ filtersMax: ATTR_FILTERS_MAX,
1281
+ groupByMax: METRIC_GROUP_BY_MAX,
1282
+ minStepSeconds: 60,
1283
+ maxStepSeconds: 86400,
1284
+ maxWindowMs: 7 * 24 * 3600 * 1000,
1285
+ defaultWindowMs: 3600 * 1000,
1286
+ groupsMax: 50,
1287
+ pointsMax: 1e4,
1288
+ namesMax: 1000,
1289
+ seriesPageSize: 100,
1290
+ exemplarsMax: 50,
1291
+ queryMaxSeconds: 3
1292
+ };
1293
+ var metricName = z10.string().min(1).max(METRIC_LIMITS.nameMaxChars).regex(METRIC_NAME_RE);
1294
+ var attrKey = z10.string().regex(METRIC_ATTR_KEY_RE);
1295
+ var metricFilterSchema = z10.object({
1296
+ k: attrKey,
1297
+ op: z10.enum(ATTR_OPS),
1298
+ v: z10.string().max(512).optional()
1299
+ });
1300
+ var metricQuerySchema = z10.object({
1301
+ name: metricName,
1302
+ aggregation: z10.enum(METRIC_AGGREGATIONS),
1303
+ filter: z10.array(metricFilterSchema).max(METRIC_QUERY.filtersMax),
1304
+ group_by: z10.array(attrKey).max(METRIC_QUERY.groupByMax)
1305
+ }).superRefine((q, ctx) => {
1306
+ q.filter.forEach((f, i) => {
1307
+ if (f.op === "exists" !== (f.v === undefined))
1308
+ ctx.addIssue({ code: "custom", path: ["filter", i, "v"], message: "value" });
1309
+ });
1310
+ if (new Set(q.group_by).size !== q.group_by.length)
1311
+ ctx.addIssue({ code: "custom", path: ["group_by"], message: "unique" });
1312
+ });
1313
+ var ts = z10.string().max(40);
1314
+ var count2 = z10.coerce.number().int().nonnegative().catch(0);
1315
+ var label = z10.string().max(METRIC_LIMITS.attributeValueMaxChars);
1316
+ var completeness = {
1317
+ complete: z10.boolean(),
1318
+ reason: z10.enum(["time_budget", "row_cap", "groups", "points"]).optional().catch(undefined)
1319
+ };
1320
+ var metricNameRowSchema = z10.object({
1321
+ name: metricName,
1322
+ type: z10.enum(METRIC_TYPES),
1323
+ kind: z10.enum(METRIC_KINDS),
1324
+ unit: z10.string().max(METRIC_LIMITS.unitMaxChars).catch(""),
1325
+ description: z10.string().max(METRIC_LIMITS.descriptionMaxChars).catch(""),
1326
+ series: count2,
1327
+ last_seen: ts
1328
+ });
1329
+ var metricCardinalitySchema = z10.object({
1330
+ series_active: count2,
1331
+ series_max: count2,
1332
+ names_active: count2,
1333
+ names_max: count2,
1334
+ limited: z10.array(z10.object({ name: z10.string().max(METRIC_LIMITS.nameMaxChars), points: count2 })).max(METRIC_LIMITS.limitedNamesKept).catch([])
1335
+ });
1336
+ var metricNamesSchema = z10.object({
1337
+ names: z10.array(metricNameRowSchema).max(METRIC_QUERY.namesMax),
1338
+ cardinality: metricCardinalitySchema,
1339
+ ...completeness
1340
+ });
1341
+ var metricSeriesRowSchema = z10.object({
1342
+ series_id: z10.string().regex(/^[0-9a-f]{16}$/),
1343
+ name: metricName,
1344
+ type: z10.enum(METRIC_TYPES),
1345
+ kind: z10.enum(METRIC_KINDS),
1346
+ temporality: z10.enum(METRIC_TEMPORALITIES).catch("unspecified"),
1347
+ unit: z10.string().max(METRIC_LIMITS.unitMaxChars).catch(""),
1348
+ service: label.catch(""),
1349
+ environment: z10.string().max(64).catch(""),
1350
+ attributes: z10.record(z10.string().max(256), label).catch({}),
1351
+ first_seen: ts,
1352
+ last_seen: ts
1353
+ });
1354
+ var metricSeriesListSchema = z10.object({
1355
+ series: z10.array(metricSeriesRowSchema).max(METRIC_QUERY.seriesPageSize),
1356
+ next_cursor: z10.string().max(64).nullable(),
1357
+ ...completeness
1358
+ });
1359
+ var metricExemplarSchema = z10.object({
1360
+ t: ts,
1361
+ value: z10.number(),
1362
+ trace_id: z10.string().regex(/^[0-9a-f]{32}$/),
1363
+ span_id: z10.union([z10.string().regex(/^[0-9a-f]{16}$/), z10.literal("")]),
1364
+ group: z10.number().int().nonnegative()
1365
+ });
1366
+ var metricResultSchema = z10.object({
1367
+ name: metricName,
1368
+ aggregation: z10.enum(METRIC_AGGREGATIONS),
1369
+ kind: z10.enum(METRIC_KINDS),
1370
+ unit: z10.string().max(METRIC_LIMITS.unitMaxChars).catch(""),
1371
+ step_seconds: z10.number().int().positive(),
1372
+ from: ts,
1373
+ to: ts,
1374
+ groups: z10.array(z10.object({
1375
+ key: z10.record(z10.string().max(256), label),
1376
+ points: z10.array(z10.object({ t: ts, v: z10.number().nullable() })).max(METRIC_QUERY.pointsMax)
1377
+ })).max(METRIC_QUERY.groupsMax),
1378
+ exemplars: z10.array(metricExemplarSchema).max(METRIC_QUERY.exemplarsMax).catch([]),
1379
+ ...completeness
1380
+ });
1381
+ var HIST_OVERFLOW = Number.MAX_VALUE;
929
1382
 
930
1383
  // ../src/shared/contracts/monitors.ts
931
- import { z as z7 } from "zod";
1384
+ import { z as z11 } from "zod";
932
1385
 
933
1386
  // ../src/shared/contracts/vocab/monitors.ts
934
1387
  var MONITOR_MODES = ["check_in", "heartbeat"];
935
- var MONITOR_TYPES = ["job", "count", "assertion", "deadline", "progress"];
936
- var SIGNAL_MONITOR_TYPES = ["count", "assertion", "deadline", "progress"];
1388
+ var MONITOR_TYPES = ["job", "count", "assertion", "deadline", "progress", "metric"];
1389
+ var SIGNAL_MONITOR_TYPES = ["count", "assertion", "deadline", "progress", "metric"];
937
1390
 
938
1391
  // ../src/shared/contracts/monitors.ts
939
1392
  var MONITOR_KINDS = ["crontab", "interval", "on_demand"];
@@ -947,7 +1400,8 @@ var MONITOR_INCIDENT_CODES = [
947
1400
  "MONITOR_COUNT",
948
1401
  "MONITOR_ASSERTION",
949
1402
  "MONITOR_DEADLINE_MISSED",
950
- "MONITOR_STALLED"
1403
+ "MONITOR_STALLED",
1404
+ "MONITOR_METRIC"
951
1405
  ];
952
1406
  var FAILURE_INCIDENT_CODES = MONITOR_INCIDENT_CODES.filter((c) => c !== "MONITOR_UNKNOWN");
953
1407
  var INCIDENT_EVENTS = ["opened", "updated", "resolved"];
@@ -1000,112 +1454,114 @@ function crontabShapeOk(value) {
1000
1454
  const fields = value.trim().split(/\s+/);
1001
1455
  return value.length <= 120 && fields.length === 5 && fields.every((f) => /^[0-9A-Za-z*,/?#LW-]+$/.test(f));
1002
1456
  }
1003
- var crontabScheduleSchema = z7.object({
1004
- type: z7.literal("crontab"),
1005
- value: z7.string().refine(crontabShapeOk, "crontab")
1457
+ var crontabScheduleSchema = z11.object({
1458
+ type: z11.literal("crontab"),
1459
+ value: z11.string().refine(crontabShapeOk, "crontab")
1006
1460
  });
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)
1461
+ var intervalScheduleSchema = z11.object({
1462
+ type: z11.literal("interval"),
1463
+ value: z11.number().int().min(1).max(MONITOR_LIMITS.intervalValueMax),
1464
+ unit: z11.enum(INTERVAL_UNITS)
1011
1465
  });
1012
- var scheduleSchema = z7.discriminatedUnion("type", [
1466
+ var scheduleSchema = z11.discriminatedUnion("type", [
1013
1467
  crontabScheduleSchema,
1014
1468
  intervalScheduleSchema
1015
1469
  ]);
1016
- var monitorSettingsSchema = z7.object({
1470
+ var monitorSettingsSchema = z11.object({
1017
1471
  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)
1472
+ timezone: z11.string().min(1).max(64),
1473
+ checkin_margin: z11.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1474
+ max_runtime: z11.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1475
+ failure_issue_threshold: z11.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1476
+ recovery_threshold: z11.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax)
1023
1477
  });
1024
- var iso = z7.string().datetime();
1025
- var projectId2 = z7.number().int().positive();
1026
- var envName = z7.string().min(1).max(MONITOR_LIMITS.environmentMax);
1478
+ var iso3 = z11.string().datetime();
1479
+ var projectId3 = z11.number().int().positive();
1480
+ var envName = z11.string().min(1).max(MONITOR_LIMITS.environmentMax);
1027
1481
  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()
1482
+ id: z11.guid(),
1483
+ project_id: projectId3,
1484
+ slug: z11.string().regex(SLUG_RE),
1485
+ kind: z11.enum(MONITOR_KINDS),
1486
+ expected_environments: z11.array(envName).max(MONITOR_LIMITS.expectedEnvironmentsMax),
1487
+ paused_until: iso3.nullable(),
1488
+ created_at: iso3,
1489
+ config_source: z11.enum(CONFIG_SOURCES),
1490
+ config_hash: z11.string().regex(/^[0-9a-f]{64}$/).nullable()
1037
1491
  });
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()
1492
+ var outcomeCounts = z11.object({
1493
+ ok: z11.number().int().nonnegative(),
1494
+ skipped: z11.number().int().nonnegative(),
1495
+ error: z11.number().int().nonnegative(),
1496
+ timeout: z11.number().int().nonnegative(),
1497
+ missed: z11.number().int().nonnegative(),
1498
+ unknown: z11.number().int().nonnegative()
1045
1499
  });
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()
1500
+ var MONITOR_NUMBER_MAX = 1000000000000000;
1501
+ var monitorNumber = z11.number().finite().min(-MONITOR_NUMBER_MAX).max(MONITOR_NUMBER_MAX);
1502
+ var signalStatusSchema = z11.object({
1503
+ type: z11.enum(SIGNAL_MONITOR_TYPES),
1504
+ value: monitorNumber.nullable(),
1505
+ threshold: monitorNumber.nullable(),
1506
+ window_end: iso3.nullable(),
1507
+ pending: z11.number().int().nonnegative().max(1e6).nullable(),
1508
+ stalled: z11.number().int().nonnegative().max(1e6).nullable(),
1509
+ refused_24h: z11.number().int().nonnegative().max(1e9).nullable()
1054
1510
  });
1055
- var monitorStatusSchema = z7.object({
1056
- monitor_id: z7.guid(),
1057
- project_id: projectId2,
1511
+ var monitorStatusSchema = z11.object({
1512
+ monitor_id: z11.guid(),
1513
+ project_id: projectId3,
1058
1514
  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(),
1515
+ open_failure: z11.enum(FAILURE_INCIDENT_CODES).nullable(),
1516
+ open_unknown: z11.boolean(),
1517
+ unobservable: z11.enum(UNOBSERVABLE_REASONS).nullable(),
1518
+ last_outcome: z11.enum(RUN_OUTCOMES).nullable(),
1519
+ last_check_in_at: iso3.nullable(),
1520
+ last_healthy_at: iso3.nullable(),
1521
+ next_deadline_at: iso3.nullable(),
1522
+ next_due_at: iso3.nullable().optional(),
1523
+ in_progress: z11.boolean(),
1068
1524
  counts_24h: outcomeCounts,
1069
1525
  signal: signalStatusSchema.optional(),
1070
- evaluated_at: iso
1526
+ evaluated_at: iso3
1071
1527
  });
1072
- var monitorIncidentSchema = z7.object({
1073
- incident_id: z7.guid(),
1074
- monitor_id: z7.guid(),
1075
- project_id: projectId2,
1528
+ var monitorIncidentSchema = z11.object({
1529
+ incident_id: z11.guid(),
1530
+ monitor_id: z11.guid(),
1531
+ project_id: projectId3,
1076
1532
  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()
1533
+ code: z11.enum(MONITOR_INCIDENT_CODES),
1534
+ event: z11.enum(INCIDENT_EVENTS),
1535
+ occurred_at: iso3,
1536
+ detected_late: z11.boolean(),
1537
+ reason: z11.string().regex(REASON_RE).nullable(),
1538
+ duration_ms: z11.number().int().nonnegative().nullable(),
1539
+ consecutive: z11.number().int().min(1).max(1e5),
1540
+ reviewed_by: z11.guid().nullable(),
1541
+ observed: monitorNumber.nullable().optional(),
1542
+ threshold: monitorNumber.nullable().optional()
1087
1543
  });
1088
- var monitorDiscoverySchema = z7.object({
1089
- project_id: projectId2,
1090
- slug: z7.string().regex(SLUG_RE),
1544
+ var monitorDiscoverySchema = z11.object({
1545
+ project_id: projectId3,
1546
+ slug: z11.string().regex(SLUG_RE),
1091
1547
  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
1548
+ config_hash: z11.string().regex(/^[0-9a-f]{64}$/).nullable(),
1549
+ check_ins: z11.number().int().nonnegative(),
1550
+ last_seen_at: iso3
1095
1551
  });
1096
1552
  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),
1553
+ var environmentName = z11.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/);
1554
+ var monitorInputSchema = z11.object({
1555
+ name: z11.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1556
+ mode: z11.enum(MONITOR_MODES).default("check_in"),
1557
+ kind: z11.enum(MONITOR_KINDS),
1102
1558
  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)
1559
+ timezone: z11.string().trim().min(1).max(64),
1560
+ checkinMarginMin: z11.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
1561
+ maxRuntimeMin: z11.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
1562
+ failureThreshold: z11.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1563
+ recoveryThreshold: z11.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1564
+ expectedEnvironments: z11.array(environmentName).min(1).max(MONITOR_LIMITS.expectedEnvironmentsMax)
1109
1565
  }).refine((v) => v.kind === "on_demand" ? v.schedule === null : v.schedule?.type === v.kind, {
1110
1566
  path: ["schedule"],
1111
1567
  message: "schedule"
@@ -1120,88 +1576,88 @@ var MONITOR_INPUT_DEFAULTS = {
1120
1576
  recoveryThreshold: MONITOR_LIMITS.recoveryThresholdDefault,
1121
1577
  expectedEnvironments: [DEFAULT_CHECK_IN_ENVIRONMENT]
1122
1578
  };
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"]),
1579
+ var runOutcome = z11.enum(RUN_OUTCOMES);
1580
+ var runFlags = z11.array(z11.string().max(32)).max(16);
1581
+ var monitorRunSchema = z11.object({
1582
+ id: z11.number().int().positive(),
1583
+ kind: z11.enum(["run", "missed"]),
1128
1584
  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(),
1585
+ started_at: iso3,
1586
+ ended_at: iso3,
1587
+ attempts: z11.number().int().nonnegative(),
1588
+ duration_ms: z11.number().int().nonnegative().nullable(),
1589
+ reason: z11.string().max(64).nullable(),
1590
+ check_in_id: z11.string().max(64).nullable(),
1591
+ trace_id: z11.string().max(32).nullable(),
1592
+ release: z11.string().max(MONITOR_LIMITS.releaseMax).nullable(),
1137
1593
  flags: runFlags
1138
1594
  });
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
1595
+ var openAttemptSchema = z11.object({
1596
+ check_in_id: z11.string().max(64),
1597
+ run_key: z11.string().max(64),
1598
+ attempt: z11.number().int().nonnegative(),
1599
+ state: z11.string().max(16),
1600
+ started_at: iso3,
1601
+ deadline_at: iso3
1146
1602
  });
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()
1603
+ var monitorRunsResponseSchema = z11.object({
1604
+ open: z11.array(openAttemptSchema).max(100),
1605
+ runs: z11.array(monitorRunSchema).max(MONITOR_LIMITS.runsPageSize),
1606
+ next_cursor: z11.string().max(32).nullable()
1151
1607
  });
1152
- var timelineRunSchema = z7.object({
1153
- id: z7.number().int().positive(),
1154
- kind: z7.enum(["run", "missed"]),
1608
+ var timelineRunSchema = z11.object({
1609
+ id: z11.number().int().positive(),
1610
+ kind: z11.enum(["run", "missed"]),
1155
1611
  outcome: runOutcome,
1156
- ended_at: iso,
1612
+ ended_at: iso3,
1157
1613
  flags: runFlags
1158
1614
  });
1159
- var monitorTimelineResponseSchema = z7.object({
1160
- runs: z7.array(timelineRunSchema).max(MONITOR_LIMITS.timelineRuns)
1615
+ var monitorTimelineResponseSchema = z11.object({
1616
+ runs: z11.array(timelineRunSchema).max(MONITOR_LIMITS.timelineRuns)
1161
1617
  });
1162
- var monitorStripsResponseSchema = z7.object({
1163
- strips: z7.array(z7.object({
1164
- monitor_id: z7.guid(),
1618
+ var monitorStripsResponseSchema = z11.object({
1619
+ strips: z11.array(z11.object({
1620
+ monitor_id: z11.guid(),
1165
1621
  environment: envName,
1166
- runs: z7.array(timelineRunSchema).max(MONITOR_LIMITS.listStripRuns)
1622
+ runs: z11.array(timelineRunSchema).max(MONITOR_LIMITS.listStripRuns)
1167
1623
  })).max(5000)
1168
1624
  });
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)
1625
+ var monitorDiagnosticSchema = z11.object({
1626
+ id: z11.string().regex(/^\d{1,19}$/),
1627
+ check_in_id: z11.string().max(64).nullable(),
1628
+ signal: z11.string().max(16),
1629
+ exit_code: z11.number().int().min(0).max(255).nullable(),
1630
+ received_at: iso3,
1631
+ body: z11.string().max(MONITOR_LIMITS.diagnosticMaxBytes * 2)
1176
1632
  });
1177
- var monitorDiagnosticsResponseSchema = z7.object({
1178
- diagnostics: z7.array(monitorDiagnosticSchema).max(50),
1179
- next_cursor: z7.string().regex(/^\d{1,19}$/).nullable()
1633
+ var monitorDiagnosticsResponseSchema = z11.object({
1634
+ diagnostics: z11.array(monitorDiagnosticSchema).max(50),
1635
+ next_cursor: z11.string().regex(/^\d{1,19}$/).nullable()
1180
1636
  });
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()
1637
+ var checkInDetailSchema = z11.object({
1638
+ run_key: z11.string().max(64),
1639
+ attempts: z11.array(z11.object({
1640
+ check_in_id: z11.string().max(64),
1641
+ attempt: z11.number().int().nonnegative(),
1642
+ result: z11.string().max(16),
1643
+ started_at: iso3,
1644
+ ended_at: iso3.nullable(),
1645
+ duration_ms: z11.number().int().nonnegative().nullable(),
1646
+ reason: z11.string().max(64).nullable(),
1647
+ trace_id: z11.string().max(32).nullable(),
1648
+ release: z11.string().max(MONITOR_LIMITS.releaseMax).nullable()
1193
1649
  })).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()
1650
+ errors: z11.array(z11.object({
1651
+ event_id: z11.string().max(64),
1652
+ issue_id: z11.number().int().nonnegative(),
1653
+ title: z11.string().max(1024),
1654
+ level: z11.string().max(16),
1655
+ timestamp: iso3,
1656
+ same_trace: z11.boolean()
1201
1657
  })).max(50),
1202
- diagnostics: z7.array(monitorDiagnosticSchema).max(20).default([])
1658
+ diagnostics: z11.array(monitorDiagnosticSchema).max(20).default([])
1203
1659
  });
1204
- var incidentReviewSchema = z7.object({ incident_id: z7.guid() });
1660
+ var incidentReviewSchema = z11.object({ incident_id: z11.guid() });
1205
1661
 
1206
1662
  // ../src/shared/contracts/signal-monitors.ts
1207
1663
  var isSignalMonitorType = (t) => SIGNAL_MONITOR_TYPES.includes(t);
@@ -1241,6 +1697,7 @@ var SIGNAL_LIMITS = {
1241
1697
  evaluateEverySeconds: 15,
1242
1698
  settleSeconds: 20,
1243
1699
  countMaxDelayMinutes: 10,
1700
+ metricDelaySeconds: 120,
1244
1701
  countMinutesPerTick: 60,
1245
1702
  windowsPerTick: 120,
1246
1703
  monitorsPerQuery: 50,
@@ -1254,11 +1711,11 @@ var SIGNAL_LIMITS = {
1254
1711
  queryMaxSeconds: 5
1255
1712
  };
1256
1713
  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()
1714
+ var scalar = z12.union([z12.string().max(SIGNAL_LIMITS.valueMax), z12.number().finite(), z12.boolean()]);
1715
+ var selectorConditionSchema = z12.object({
1716
+ key: z12.string().min(1).max(SIGNAL_LIMITS.keyMax).regex(SELECTOR_KEY_RE),
1717
+ op: z12.enum(SELECTOR_OPS),
1718
+ value: z12.union([scalar, z12.array(z12.string().max(SIGNAL_LIMITS.valueMax)).min(1).max(SIGNAL_LIMITS.inValuesMax)]).optional()
1262
1719
  }).superRefine((c, ctx) => {
1263
1720
  const bad = (message) => ctx.addIssue({ code: "custom", path: ["value"], message });
1264
1721
  if (VALUELESS_OPS.has(c.op)) {
@@ -1280,10 +1737,10 @@ var selectorConditionSchema = z8.object({
1280
1737
  if (c.op === "prefix" && (typeof c.value !== "string" || c.value.length === 0))
1281
1738
  bad("text");
1282
1739
  });
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)
1740
+ var environmentListSchema = z12.array(z12.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");
1741
+ var selectorSchema = z12.object({
1742
+ signal: z12.enum(SIGNAL_KINDS),
1743
+ match: z12.array(selectorConditionSchema).max(SIGNAL_LIMITS.matchMax)
1287
1744
  });
1288
1745
  function toNumber(v) {
1289
1746
  if (typeof v === "number")
@@ -1294,22 +1751,22 @@ function toNumber(v) {
1294
1751
  }
1295
1752
  return null;
1296
1753
  }
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);
1754
+ var minutes = (min, max) => z12.number().int().min(min).max(max);
1755
+ var threshold = z12.number().int().min(0).max(SIGNAL_LIMITS.thresholdMax);
1756
+ var recovery = z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax);
1300
1757
  var common = {
1301
1758
  environments: environmentListSchema,
1302
- severity: z8.enum(SEVERITIES),
1759
+ severity: z12.enum(SEVERITIES),
1303
1760
  recovery_threshold: recovery
1304
1761
  };
1305
- var countSettingsSchema = z8.object({
1306
- type: z8.literal("count"),
1762
+ var countSettingsSchema = z12.object({
1763
+ type: z12.literal("count"),
1307
1764
  selector: selectorSchema,
1308
1765
  window_minutes: minutes(SIGNAL_LIMITS.windowMinutesMin, SIGNAL_LIMITS.windowMinutesMax),
1309
- comparator: z8.enum(COMPARATORS),
1766
+ comparator: z12.enum(COMPARATORS),
1310
1767
  threshold,
1311
1768
  threshold_high: threshold.nullable(),
1312
- missing_data: z8.enum(MISSING_DATA_POLICIES),
1769
+ missing_data: z12.enum(MISSING_DATA_POLICIES),
1313
1770
  ...common
1314
1771
  }).superRefine((s, ctx) => {
1315
1772
  if (s.comparator === "outside" && (s.threshold_high === null || s.threshold_high <= s.threshold)) {
@@ -1322,31 +1779,48 @@ var countSettingsSchema = z8.object({
1322
1779
  ctx.addIssue({ code: "custom", path: ["threshold"], message: "threshold" });
1323
1780
  }
1324
1781
  });
1325
- var assertionSettingsSchema = z8.object({
1326
- type: z8.literal("assertion"),
1782
+ var assertionSettingsSchema = z12.object({
1783
+ type: z12.literal("assertion"),
1327
1784
  selector: selectorSchema,
1328
- assert: z8.array(selectorConditionSchema).min(1).max(SIGNAL_LIMITS.assertMax),
1785
+ assert: z12.array(selectorConditionSchema).min(1).max(SIGNAL_LIMITS.assertMax),
1329
1786
  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),
1787
+ threshold: z12.number().int().min(1).max(SIGNAL_LIMITS.thresholdMax),
1788
+ missing_data: z12.enum(MISSING_DATA_POLICIES),
1332
1789
  ...common
1333
1790
  });
1334
- var deadlineSettingsSchema = z8.object({
1335
- type: z8.literal("deadline"),
1791
+ var deadlineSettingsSchema = z12.object({
1792
+ type: z12.literal("deadline"),
1336
1793
  occurrence_grace_minutes: minutes(0, SIGNAL_LIMITS.graceMinutesMax),
1337
1794
  progress_timeout_minutes: minutes(SIGNAL_LIMITS.progressMinutesMin, SIGNAL_LIMITS.progressMinutesMax).nullable(),
1338
1795
  ...common
1339
1796
  });
1340
- var progressSettingsSchema = z8.object({
1341
- type: z8.literal("progress"),
1797
+ var progressSettingsSchema = z12.object({
1798
+ type: z12.literal("progress"),
1342
1799
  progress_timeout_minutes: minutes(SIGNAL_LIMITS.progressMinutesMin, SIGNAL_LIMITS.progressMinutesMax),
1343
1800
  ...common
1344
1801
  });
1345
- var signalSettingsSchema = z8.discriminatedUnion("type", [
1802
+ var metricThreshold = z12.number().finite().min(-MONITOR_NUMBER_MAX).max(MONITOR_NUMBER_MAX);
1803
+ var metricSettingsSchema = z12.object({
1804
+ type: z12.literal("metric"),
1805
+ metric_query: metricQuerySchema,
1806
+ window_minutes: minutes(SIGNAL_LIMITS.windowMinutesMin, SIGNAL_LIMITS.windowMinutesMax),
1807
+ comparator: z12.enum(COMPARATORS),
1808
+ threshold: metricThreshold,
1809
+ threshold_high: metricThreshold.nullable(),
1810
+ missing_data: z12.enum(MISSING_DATA_POLICIES),
1811
+ ...common
1812
+ }).superRefine((s, ctx) => {
1813
+ if (s.comparator === "outside" && (s.threshold_high === null || s.threshold_high <= s.threshold))
1814
+ ctx.addIssue({ code: "custom", path: ["threshold_high"], message: "threshold_high" });
1815
+ if (s.comparator !== "outside" && s.threshold_high !== null)
1816
+ ctx.addIssue({ code: "custom", path: ["threshold_high"], message: "threshold_high" });
1817
+ });
1818
+ var signalSettingsSchema = z12.discriminatedUnion("type", [
1346
1819
  countSettingsSchema,
1347
1820
  assertionSettingsSchema,
1348
1821
  deadlineSettingsSchema,
1349
- progressSettingsSchema
1822
+ progressSettingsSchema,
1823
+ metricSettingsSchema
1350
1824
  ]);
1351
1825
  function settingsFromRow(row) {
1352
1826
  if (!isSignalMonitorType(row.type) || !row.signal_settings || typeof row.signal_settings !== "object")
@@ -1360,76 +1834,76 @@ function settingsFromRow(row) {
1360
1834
  });
1361
1835
  return r.success ? r.data : null;
1362
1836
  }
1363
- var signalMonitorInputSchema = z8.object({
1364
- name: z8.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1837
+ var signalMonitorInputSchema = z12.object({
1838
+ name: z12.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
1365
1839
  settings: signalSettingsSchema
1366
1840
  });
1367
- var signalMonitorDefinitionSchema = z8.object({
1368
- id: z8.guid(),
1369
- project_id: z8.number().int().positive(),
1370
- slug: z8.string().regex(SLUG_RE),
1841
+ var signalMonitorDefinitionSchema = z12.object({
1842
+ id: z12.guid(),
1843
+ project_id: z12.number().int().positive(),
1844
+ slug: z12.string().regex(SLUG_RE),
1371
1845
  settings: signalSettingsSchema,
1372
- paused_until: z8.string().datetime().nullable(),
1373
- created_at: z8.string().datetime(),
1374
- revision: z8.number().int().nonnegative()
1846
+ paused_until: z12.string().datetime().nullable(),
1847
+ created_at: z12.string().datetime(),
1848
+ revision: z12.number().int().nonnegative()
1375
1849
  });
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)
1850
+ var signalLimitsConfigSchema = z12.object({
1851
+ pending_occurrences_per_monitor: z12.number().int().min(1).max(1e6),
1852
+ pending_occurrences_per_project: z12.number().int().min(1).max(1e7)
1379
1853
  });
1380
1854
  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()
1855
+ var occurrenceInputSchema = z12.object({
1856
+ monitor_slug: z12.string().regex(SLUG_RE),
1857
+ occurrence_id: z12.string().regex(OCCURRENCE_ID_RE),
1858
+ due_at: z12.string().datetime({ offset: true }),
1859
+ environment: z12.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/).optional()
1386
1860
  });
1387
1861
  var occurrenceCancelSchema = occurrenceInputSchema.pick({ monitor_slug: true, occurrence_id: true, environment: true });
1388
1862
  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()
1863
+ var occurrenceRowSchema = z12.object({
1864
+ occurrence_id: z12.string().max(SIGNAL_LIMITS.occurrenceIdMax),
1865
+ environment: z12.string().max(MONITOR_LIMITS.environmentMax),
1866
+ state: z12.enum(OCCURRENCE_STATES),
1867
+ due_at: z12.string().datetime(),
1868
+ deadline_at: z12.string().datetime(),
1869
+ registered_at: z12.string().datetime(),
1870
+ started_at: z12.string().datetime().nullable(),
1871
+ last_signal_at: z12.string().datetime().nullable(),
1872
+ ended_at: z12.string().datetime().nullable(),
1873
+ stalled: z12.boolean()
1400
1874
  });
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()
1875
+ var occurrencesResponseSchema = z12.object({
1876
+ occurrences: z12.array(occurrenceRowSchema).max(SIGNAL_LIMITS.occurrencesPageSize),
1877
+ pending: z12.number().int().nonnegative(),
1878
+ next_due_at: z12.string().datetime().nullable(),
1879
+ next_cursor: z12.string().max(64).nullable(),
1880
+ refused_24h: z12.number().int().nonnegative()
1407
1881
  });
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()
1882
+ var signalSeriesSchema = z12.object({
1883
+ environment: z12.string().max(MONITOR_LIMITS.environmentMax),
1884
+ buckets: z12.array(z12.object({ minute: z12.string().datetime(), matched: z12.number().int().nonnegative(), violations: z12.number().int().nonnegative(), lossy: z12.boolean() })).max(1440),
1885
+ counted_through: z12.string().datetime().nullable()
1412
1886
  });
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()
1887
+ var signalResponseSchema = z12.object({
1888
+ series: z12.array(signalSeriesSchema).max(SIGNAL_LIMITS.environmentsMax),
1889
+ runs: z12.array(z12.object({
1890
+ run_id: z12.string().max(SIGNAL_LIMITS.occurrenceIdMax),
1891
+ environment: z12.string().max(MONITOR_LIMITS.environmentMax),
1892
+ started_at: z12.string().datetime(),
1893
+ last_signal_at: z12.string().datetime(),
1894
+ stalled: z12.boolean()
1421
1895
  })).max(SIGNAL_LIMITS.occurrencesPageSize)
1422
1896
  });
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()
1897
+ var backtestSettingsSchema = z12.union([countSettingsSchema, assertionSettingsSchema]);
1898
+ var backtestResponseSchema = z12.object({
1899
+ alerts: z12.number().int().nonnegative(),
1900
+ windows: z12.number().int().nonnegative(),
1901
+ violated_windows: z12.number().int().nonnegative(),
1902
+ first_at: z12.string().datetime().nullable(),
1903
+ last_at: z12.string().datetime().nullable(),
1904
+ days: z12.number().nonnegative(),
1905
+ matched_total: z12.number().int().nonnegative(),
1906
+ violations_total: z12.number().int().nonnegative()
1433
1907
  });
1434
1908
 
1435
1909
  // ../src/shared/contracts/notifications.ts
@@ -1444,24 +1918,24 @@ var NOTIFY_LIMITS = {
1444
1918
  };
1445
1919
  var HOLDABLE_SEVERITIES = ["medium", "low"];
1446
1920
  var DIGEST_MODES = ["off", "hourly", "daily"];
1447
- var timeOfDay2 = z9.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
1921
+ var timeOfDay2 = z13.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
1448
1922
  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),
1923
+ var quietHoursSchema = z13.object({
1924
+ days: z13.array(weekdaySchema).min(1).max(7).refine(unique),
1451
1925
  start: timeOfDay2,
1452
1926
  end: timeOfDay2
1453
1927
  }).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),
1928
+ var policyInputSchema = z13.object({
1929
+ name: z13.string().trim().min(1).max(NOTIFY_LIMITS.nameMax).regex(/^[^\p{Cc}]*$/u),
1930
+ timezone: z13.string().trim().min(1).max(64).refine(validTimeZone),
1457
1931
  quietHours: quietHoursSchema.nullable(),
1458
- quietSeverities: z9.array(z9.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1459
- digest: z9.enum(DIGEST_MODES),
1932
+ quietSeverities: z13.array(z13.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1933
+ digest: z13.enum(DIGEST_MODES),
1460
1934
  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)
1935
+ digestSeverities: z13.array(z13.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
1936
+ fallback: z13.array(z13.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique),
1937
+ escalateAfterMinutes: z13.number().int().min(NOTIFY_LIMITS.escalateMinutesMin).max(NOTIFY_LIMITS.escalateMinutesMax).nullable(),
1938
+ escalation: z13.array(z13.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique)
1465
1939
  }).superRefine((p, ctx) => {
1466
1940
  if (p.digest === "daily" !== (p.digestAt !== null))
1467
1941
  ctx.addIssue({ code: "custom", path: ["digestAt"], message: "digest_at" });
@@ -1473,46 +1947,46 @@ var HOUR = 60 * MIN;
1473
1947
  var DAY = 24 * HOUR;
1474
1948
 
1475
1949
  // ../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]*$/);
1950
+ var incidentOnly = z14.object({ workspaceId: uuid, incidentId: uuid });
1951
+ var note2 = z14.string().trim().min(1).max(2000).regex(/^[^\u0000-\u0008\u000b\u000c\u000e-\u001f]*$/);
1478
1952
  var INCIDENT_KINDS = ["monitor", "uptime", "slo", "issue"];
1479
1953
  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)
1954
+ var incidentRuleInputSchema = z14.object({
1955
+ name: z14.string().trim().min(1).max(80).regex(/^[^\p{Cc}]*$/u),
1956
+ isEnabled: z14.boolean(),
1957
+ position: z14.number().int().min(0).max(1000).default(0),
1958
+ projectIds: z14.array(z14.number().int().positive()).max(50),
1959
+ environments: z14.array(z14.string().trim().min(1).max(64)).max(20),
1960
+ kinds: z14.array(z14.enum(INCIDENT_KINDS)).min(1).max(4),
1961
+ minSeverity: z14.enum(SEVERITIES),
1962
+ groupBy: z14.enum(INCIDENT_GROUP_BY),
1963
+ windowMinutes: z14.number().int().min(5).max(240),
1964
+ recoveryHoldMinutes: z14.number().int().min(0).max(1440)
1491
1965
  });
1492
1966
  var INCIDENT_INPUTS = {
1493
- list: z10.object({
1967
+ list: z14.object({
1494
1968
  workspaceId: uuid,
1495
1969
  limit: pageLimit,
1496
1970
  cursor,
1497
- state: z10.enum(["active", "resolved", "all"]).default("all")
1971
+ state: z14.enum(["active", "resolved", "all"]).default("all")
1498
1972
  }),
1499
1973
  incidentOnly,
1500
- resolve: incidentOnly.extend({ note: note.max(500) }),
1501
- note: incidentOnly.extend({ note }),
1974
+ resolve: incidentOnly.extend({ note: note2.max(500) }),
1975
+ note: incidentOnly.extend({ note: note2 }),
1502
1976
  update: incidentOnly.extend({
1503
- title: z10.string().trim().min(1).max(120).regex(/^[^\p{Cc}]*$/u).optional(),
1977
+ title: z14.string().trim().min(1).max(120).regex(/^[^\p{Cc}]*$/u).optional(),
1504
1978
  ownerUserId: uuid.nullable().optional()
1505
1979
  }),
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({
1980
+ workspace: z14.object({ workspaceId: uuid }),
1981
+ saveRule: z14.object({ workspaceId: uuid, ruleId: uuid.nullable(), input: incidentRuleInputSchema }),
1982
+ ruleOnly: z14.object({ workspaceId: uuid, ruleId: uuid }),
1983
+ savePolicy: z14.object({
1510
1984
  workspaceId: uuid,
1511
1985
  policyId: uuid.nullable(),
1512
- isDefault: z10.boolean(),
1986
+ isDefault: z14.boolean(),
1513
1987
  input: policyInputSchema
1514
1988
  }),
1515
- policyOnly: z10.object({ workspaceId: uuid, policyId: uuid })
1989
+ policyOnly: z14.object({ workspaceId: uuid, policyId: uuid })
1516
1990
  };
1517
1991
  var I = INCIDENT_INPUTS;
1518
1992
  var w = "incidents:write";
@@ -1701,20 +2175,20 @@ var INCIDENT_OPERATIONS = [
1701
2175
  ];
1702
2176
 
1703
2177
  // ../src/shared/contracts/api-ops/monitors.ts
1704
- import { z as z15 } from "zod";
2178
+ import { z as z19 } from "zod";
1705
2179
 
1706
2180
  // ../src/shared/contracts/heartbeat.ts
1707
- import { z as z12 } from "zod";
2181
+ import { z as z16 } from "zod";
1708
2182
 
1709
2183
  // ../src/shared/contracts/signed-message.ts
1710
- import { z as z11 } from "zod";
1711
- var nodeIdSchema = z11.guid();
1712
- var signedEnvelopeSchema = z11.object({
2184
+ import { z as z15 } from "zod";
2185
+ var nodeIdSchema = z15.guid();
2186
+ var signedEnvelopeSchema = z15.object({
1713
2187
  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}$/)
2188
+ ts: z15.number().int().positive(),
2189
+ nonce: z15.string().regex(/^[A-Za-z0-9_-]{16,64}$/),
2190
+ payload: z15.record(z15.string(), z15.unknown()),
2191
+ sig: z15.string().regex(/^[A-Za-z0-9_-]{86}$/)
1718
2192
  });
1719
2193
 
1720
2194
  // ../src/shared/contracts/heartbeat.ts
@@ -1752,78 +2226,78 @@ var HEARTBEAT_LIMITS = {
1752
2226
  diagnosticsPerRun: 5
1753
2227
  };
1754
2228
  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({
2229
+ var uuid2 = z16.guid();
2230
+ var ms = z16.number().int().nonnegative();
2231
+ var hex64 = z16.string().regex(/^[0-9a-f]{64}$/);
2232
+ var envName2 = z16.string().min(1).max(MONITOR_LIMITS.environmentMax);
2233
+ var heartbeatMonitorConfigSchema = z16.object({
1760
2234
  id: uuid2,
1761
- project_id: z12.number().int().positive(),
1762
- slug: z12.string().regex(SLUG_RE),
2235
+ project_id: z16.number().int().positive(),
2236
+ slug: z16.string().regex(SLUG_RE),
1763
2237
  environment: envName2,
1764
2238
  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),
2239
+ timezone: z16.string().min(1).max(64),
2240
+ grace_min: z16.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
2241
+ max_runtime_min: z16.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
2242
+ failure_threshold: z16.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
2243
+ recovery_threshold: z16.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
1770
2244
  paused_until: ms.nullable(),
1771
2245
  created_at: ms
1772
2246
  });
1773
- var heartbeatTokenConfigSchema = z12.object({
2247
+ var heartbeatTokenConfigSchema = z16.object({
1774
2248
  id: uuid2,
1775
2249
  monitor_id: uuid2,
1776
2250
  hash: hex64,
1777
2251
  expires_at: ms.nullable()
1778
2252
  });
1779
- var heartbeatSyncSchema = z12.object({
1780
- v: z12.literal(1),
2253
+ var heartbeatSyncSchema = z16.object({
2254
+ v: z16.literal(1),
1781
2255
  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)
2256
+ route: z16.string().regex(PING_ROUTE_RE),
2257
+ revision: z16.number().int().positive(),
2258
+ workspace_status: z16.enum(["active", "suspended", "deleting"]),
2259
+ ingest_kill: z16.boolean(),
2260
+ limits: z16.object({
2261
+ check_in_rate_per_sec: z16.number().int().positive(),
2262
+ check_in_burst: z16.number().int().positive(),
2263
+ monthly_check_in_cap: z16.number().int().positive()
2264
+ }),
2265
+ projects: z16.array(z16.object({ id: z16.number().int().positive(), node_id: nodeIdSchema.nullable() })).max(1000),
2266
+ monitors: z16.array(heartbeatMonitorConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace),
2267
+ tokens: z16.array(heartbeatTokenConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
1794
2268
  });
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}$/)
2269
+ var signedHeartbeatSyncSchema = z16.object({
2270
+ body: z16.string().min(2).max(4 * 1024 * 1024),
2271
+ ts: z16.number().int().positive(),
2272
+ kid: z16.string().regex(/^[A-Za-z0-9_-]{1,40}$/),
2273
+ sig: z16.string().regex(/^[A-Za-z0-9_-]{86}$/)
1800
2274
  });
1801
- var heartbeatHourSchema = z12.object({
2275
+ var heartbeatHourSchema = z16.object({
1802
2276
  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()
2277
+ hour: z16.string().datetime(),
2278
+ ok: z16.number().int().nonnegative(),
2279
+ failed: z16.number().int().nonnegative(),
2280
+ started: z16.number().int().nonnegative(),
2281
+ missed: z16.number().int().nonnegative(),
2282
+ logs: z16.number().int().nonnegative()
1809
2283
  });
1810
- var heartbeatReportSchema = z12.object({
1811
- v: z12.literal(1),
2284
+ var heartbeatReportSchema = z16.object({
2285
+ v: z16.literal(1),
1812
2286
  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)
2287
+ route: z16.string().regex(PING_ROUTE_RE),
2288
+ revision: z16.number().int().nonnegative(),
2289
+ sent_at: z16.string().datetime(),
2290
+ incidents: z16.array(monitorIncidentSchema).max(HEARTBEAT_LIMITS.reportMaxIncidents),
2291
+ statuses: z16.array(monitorStatusSchema).max(HEARTBEAT_LIMITS.reportMaxStatuses),
2292
+ hours: z16.array(heartbeatHourSchema).max(HEARTBEAT_LIMITS.reportMaxHours),
2293
+ token_uses: z16.array(z16.object({ token_id: uuid2, last_used_at: z16.string().datetime() })).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
1820
2294
  });
1821
2295
  var ENCODER = new TextEncoder;
1822
2296
  var UTF8 = new TextDecoder("utf-8", { fatal: false, ignoreBOM: false });
1823
2297
  var TOKEN_IN_TEXT = new RegExp(PING_TOKEN_PATTERN, "g");
1824
2298
 
1825
2299
  // ../src/shared/contracts/slo.ts
1826
- import { z as z13 } from "zod";
2300
+ import { z as z17 } from "zod";
1827
2301
 
1828
2302
  // ../src/shared/contracts/vocab/slo.ts
1829
2303
  var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans"];
@@ -1855,17 +2329,17 @@ var SLO_SOURCE_META = {
1855
2329
  heartbeat: { provenance: "ping_token", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
1856
2330
  spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" }
1857
2331
  };
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()
2332
+ var nodeSloSchema = z17.object({
2333
+ slo_id: z17.guid(),
2334
+ project_id: z17.number().int().positive(),
2335
+ source: z17.enum(["monitor", "spans"]),
2336
+ sli: z17.enum(SLO_SLIS),
2337
+ monitor_id: z17.guid().optional(),
2338
+ environment: z17.string().min(1).max(SLO_LIMITS.environmentMaxChars).optional(),
2339
+ service: z17.string().min(1).max(128).optional(),
2340
+ operation: z17.string().min(1).max(256).optional(),
2341
+ latency_threshold_ms: z17.number().int().min(1).max(60000).optional(),
2342
+ public_sources: z17.boolean()
1869
2343
  }).superRefine((v, ctx) => {
1870
2344
  if (v.source === "monitor" && (!v.monitor_id || v.sli !== "availability"))
1871
2345
  ctx.addIssue({ code: "custom", path: ["monitor_id"], message: "INVALID_INPUT" });
@@ -1874,27 +2348,27 @@ var nodeSloSchema = z13.object({
1874
2348
  if (v.sli === "latency" !== (v.latency_threshold_ms !== undefined))
1875
2349
  ctx.addIssue({ code: "custom", path: ["latency_threshold_ms"], message: "INVALID_INPUT" });
1876
2350
  });
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)
2351
+ var sliCountsSchema = z17.object({
2352
+ minute: z17.string().datetime(),
2353
+ items: z17.array(z17.object({ slo_id: z17.guid(), good: z17.number().int().min(0), total: z17.number().int().min(0) }).refine((x) => x.good <= x.total, { message: "INVALID_INPUT" })).max(SLO_LIMITS.sliItemsPerMessage)
1880
2354
  });
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)
2355
+ var sloInputSchema = z17.object({
2356
+ name: z17.string().trim().min(1).max(SLO_LIMITS.nameMaxChars),
2357
+ description: z17.string().max(SLO_LIMITS.descriptionMaxChars).default(""),
2358
+ source: z17.enum(SLO_SOURCES),
2359
+ sourceRef: z17.object({
2360
+ id: z17.guid().optional(),
2361
+ projectId: z17.number().int().positive().optional(),
2362
+ service: z17.string().max(128).optional(),
2363
+ operation: z17.string().max(256).optional(),
2364
+ environment: z17.string().max(SLO_LIMITS.environmentMaxChars).optional()
2365
+ }),
2366
+ sli: z17.enum(SLO_SLIS),
2367
+ latencyThresholdMs: z17.number().int().min(1).max(60000).nullable(),
2368
+ objective: z17.number().min(SLO_LIMITS.objectiveMin).max(SLO_LIMITS.objectiveMax),
2369
+ windowDays: z17.union([z17.literal(7), z17.literal(28), z17.literal(30)]),
2370
+ alertPolicy: z17.enum(SLO_ALERT_POLICIES),
2371
+ allowPublicSources: z17.boolean().default(false)
1898
2372
  }).superRefine((v, ctx) => {
1899
2373
  if (!SLO_SOURCE_META[v.source].slis.includes(v.sli))
1900
2374
  ctx.addIssue({ code: "custom", path: ["sli"], message: "INVALID_INPUT" });
@@ -1909,7 +2383,7 @@ var sloInputSchema = z13.object({
1909
2383
  });
1910
2384
 
1911
2385
  // ../src/shared/contracts/uptime.ts
1912
- import { z as z14 } from "zod";
2386
+ import { z as z18 } from "zod";
1913
2387
 
1914
2388
  // ../src/shared/contracts/vocab/uptime.ts
1915
2389
  var UPTIME_STATUSES = ["up", "degraded", "down", "unknown", "paused", "pending"];
@@ -1982,51 +2456,51 @@ function isForbiddenHeader(name) {
1982
2456
  const n = name.trim().toLowerCase();
1983
2457
  return UPTIME_FORBIDDEN_HEADERS.includes(n) || n.startsWith("proxy-") || n.startsWith("sec-");
1984
2458
  }
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") })
2459
+ var text = z18.string().min(1).max(UPTIME_LIMITS.assertionTextMax);
2460
+ var statusRange = z18.string().regex(/^[1-5][0-9]{2}(-[1-5][0-9]{2})?$/);
2461
+ var assertionSchema = z18.discriminatedUnion("type", [
2462
+ z18.object({ type: z18.literal("status"), in: z18.array(statusRange).min(1).max(10) }),
2463
+ z18.object({ type: z18.literal("body_contains"), value: text, case_sensitive: z18.boolean().default(true) }),
2464
+ z18.object({ type: z18.literal("body_not_contains"), value: text, case_sensitive: z18.boolean().default(true) }),
2465
+ z18.object({
2466
+ type: z18.literal("json_pointer"),
2467
+ pointer: z18.string().max(256).regex(/^(\/([^~/]|~0|~1)*)*$/),
2468
+ op: z18.enum(["exists", "equals", "type"]),
2469
+ value: z18.string().max(UPTIME_LIMITS.assertionTextMax).optional()
2470
+ }),
2471
+ z18.object({
2472
+ type: z18.literal("header"),
2473
+ name: z18.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
2474
+ op: z18.enum(["equals", "contains", "exists"]),
2475
+ value: z18.string().max(UPTIME_LIMITS.assertionTextMax).optional()
2476
+ }),
2477
+ z18.object({ type: z18.literal("latency_ms"), lt: z18.number().int().min(1).max(60000) }),
2478
+ z18.object({ type: z18.literal("tls_valid") })
2005
2479
  ]);
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]*$/)
2480
+ var header = z18.object({
2481
+ name: z18.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
2482
+ value: z18.string().max(UPTIME_LIMITS.headerValueMax).regex(/^[^\r\n\u0000]*$/)
2009
2483
  });
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)
2484
+ var uptimeCheckInputSchema = z18.object({
2485
+ projectId: z18.number().int().positive(),
2486
+ name: z18.string().trim().min(1).max(UPTIME_LIMITS.nameMaxChars),
2487
+ kind: z18.enum(UPTIME_KINDS),
2488
+ url: z18.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
2489
+ host: z18.string().max(253).nullable(),
2490
+ port: z18.number().int().min(1).max(65535).nullable(),
2491
+ method: z18.enum(UPTIME_METHODS).default("GET"),
2492
+ headers: z18.array(header).max(UPTIME_LIMITS.headersMax).default([]),
2493
+ followRedirects: z18.boolean().default(false),
2494
+ timeoutMs: z18.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
2495
+ intervalSeconds: z18.number().int().refine((n) => UPTIME_INTERVALS.includes(n)),
2496
+ regions: z18.array(z18.enum(UPTIME_REGIONS)).min(UPTIME_LIMITS.minRegions).max(UPTIME_REGIONS.length),
2497
+ assertions: z18.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax).default([]),
2498
+ failureThreshold: z18.number().int().min(1).max(5),
2499
+ recoveryThreshold: z18.number().int().min(1).max(5),
2500
+ certWarningDays: z18.number().int().min(1).max(60),
2501
+ environment: z18.string().trim().max(64).default(""),
2502
+ strictMetadata: z18.boolean().default(false),
2503
+ evidenceOnFailure: z18.boolean().default(true)
2030
2504
  }).superRefine((v, ctx) => {
2031
2505
  if (v.kind === "http" && !v.url)
2032
2506
  ctx.addIssue({ code: "custom", path: ["url"], message: "INVALID_INPUT" });
@@ -2037,243 +2511,243 @@ var uptimeCheckInputSchema = z14.object({
2037
2511
  if (v.headers.some((h) => isForbiddenHeader(h.name)))
2038
2512
  ctx.addIssue({ code: "custom", path: ["headers"], message: "UPTIME_HEADER_FORBIDDEN" });
2039
2513
  });
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()
2514
+ var uptimeDefinitionSchema = z18.object({
2515
+ check_id: z18.guid(),
2516
+ workspace_id: z18.guid(),
2517
+ project_id: z18.number().int().positive(),
2518
+ revision: z18.number().int().nonnegative(),
2519
+ kind: z18.enum(UPTIME_KINDS),
2520
+ url: z18.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
2521
+ host: z18.string().max(253).nullable(),
2522
+ port: z18.number().int().min(1).max(65535).nullable(),
2523
+ method: z18.enum(UPTIME_METHODS),
2524
+ headers: z18.array(header).max(UPTIME_LIMITS.headersMax),
2525
+ follow_redirects: z18.boolean(),
2526
+ timeout_ms: z18.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
2527
+ interval_seconds: z18.number().int().positive(),
2528
+ regions: z18.array(z18.enum(UPTIME_REGIONS)).min(1).max(3),
2529
+ assertions: z18.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax),
2530
+ failure_threshold: z18.number().int().min(1).max(5),
2531
+ recovery_threshold: z18.number().int().min(1).max(5),
2532
+ cert_warning_days: z18.number().int().min(1).max(60),
2533
+ strict_metadata: z18.boolean(),
2534
+ evidence_on_failure: z18.boolean(),
2535
+ paused_until: z18.string().nullable(),
2536
+ muted_until: z18.string().nullable()
2063
2537
  });
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)
2538
+ var timingsSchema = z18.object({
2539
+ dns_ms: z18.number().nonnegative().max(60000).nullable(),
2540
+ connect_ms: z18.number().nonnegative().max(60000).nullable(),
2541
+ tls_ms: z18.number().nonnegative().max(60000).nullable(),
2542
+ ttfb_ms: z18.number().nonnegative().max(60000).nullable(),
2543
+ download_ms: z18.number().nonnegative().max(60000).nullable(),
2544
+ total_ms: z18.number().nonnegative().max(60000)
2071
2545
  });
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(),
2546
+ var probeResultSchema = z18.object({
2547
+ check_id: z18.guid(),
2548
+ revision: z18.number().int().nonnegative(),
2549
+ slot: z18.number().int().nonnegative(),
2550
+ region: z18.enum(UPTIME_REGIONS),
2551
+ run_now: z18.string().max(64).optional(),
2552
+ scheduled_at: z18.number().int().positive(),
2553
+ started_at: z18.number().int().positive(),
2554
+ outcome: z18.enum(UPTIME_OUTCOMES),
2555
+ reason: z18.enum(UPTIME_REASONS).nullable(),
2556
+ reason_group: z18.enum(UPTIME_REASON_GROUPS).nullable(),
2557
+ status_code: z18.number().int().min(100).max(599).nullable(),
2084
2558
  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()
2559
+ ip_family: z18.enum(["v4", "v6"]).nullable(),
2560
+ http_version: z18.string().max(8).nullable(),
2561
+ cert_not_after: z18.number().int().positive().nullable(),
2562
+ cert_issuer: z18.string().max(200).nullable(),
2563
+ cert_expiring: z18.boolean(),
2564
+ evidence_sealed: z18.string().max(16384).nullable()
2091
2565
  });
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),
2566
+ var probeIdSchema = z18.string().regex(/^probe-(eu|us|ap)-[a-z0-9]{4,16}$/);
2567
+ var resultBatchSchema = z18.object({
2568
+ v: z18.literal(1),
2095
2569
  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() })
2570
+ region: z18.enum(UPTIME_REGIONS),
2571
+ version: z18.string().max(40),
2572
+ sent_at: z18.number().int().positive(),
2573
+ results: z18.array(probeResultSchema).max(UPTIME_LIMITS.resultsBatchMax),
2574
+ stats: z18.object({ lag_p99_ms: z18.number().nonnegative(), checks_per_min: z18.number().nonnegative() })
2101
2575
  });
2102
2576
  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()
2577
+ seal_public_key: z18.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable()
2104
2578
  });
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)
2579
+ var assignmentsSchema = z18.object({
2580
+ v: z18.literal(1),
2581
+ region: z18.enum(UPTIME_REGIONS),
2582
+ revision: z18.number().int().nonnegative(),
2583
+ issued_at: z18.number().int().positive(),
2584
+ checks: z18.array(assignmentSchema).max(50000),
2585
+ denied_hosts: z18.array(z18.string().max(253)).max(1e4),
2586
+ run_now: z18.array(z18.object({ id: z18.string().max(64), check_id: z18.guid(), expires_at: z18.number().int() })).max(500)
2113
2587
  });
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),
2588
+ var uuid3 = z18.guid();
2589
+ var b64key = z18.string().regex(/^[A-Za-z0-9_-]{43}$/);
2590
+ var iso4 = z18.string().datetime();
2591
+ var uptimeSyncSchema = z18.object({
2592
+ v: z18.literal(1),
2119
2593
  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)
2594
+ revision: z18.number().int().positive(),
2595
+ workspace_status: z18.enum(["active", "suspended", "deleting"]),
2596
+ suspended: z18.boolean(),
2597
+ checks: z18.array(uptimeDefinitionSchema).max(UPTIME_LIMITS.maxChecksPerWorkspace),
2598
+ projects: z18.array(z18.object({ id: z18.number().int().positive(), node_id: z18.guid().nullable(), seal_public_key: b64key.nullable() })).max(1000)
2125
2599
  });
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()
2600
+ var uptimeReconcileSchema = z18.object({
2601
+ v: z18.literal(1),
2602
+ as_of: z18.number().int().positive(),
2603
+ workspace_ids: z18.array(uuid3).max(UPTIME_LIMITS.reconcileMaxWorkspaces),
2604
+ heartbeat_routes: z18.array(z18.string().regex(PING_ROUTE_RE)).max(UPTIME_LIMITS.reconcileMaxWorkspaces).optional()
2131
2605
  });
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)
2606
+ var probeDirectorySyncSchema = z18.object({
2607
+ v: z18.literal(1),
2608
+ revision: z18.number().int().positive(),
2609
+ probes: z18.array(z18.object({ probe_id: probeIdSchema, region: z18.enum(UPTIME_REGIONS), public_key: b64key, status: z18.enum(["active", "revoked"]) })).max(30),
2610
+ denied_hosts: z18.array(z18.string().min(1).max(253)).max(1e4)
2137
2611
  });
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(),
2612
+ var runNowRequestSchema = z18.object({ v: z18.literal(1), workspace_id: uuid3, check_id: uuid3, run_id: z18.string().regex(/^[A-Za-z0-9_-]{8,64}$/) });
2613
+ var signedAssignmentsSchema = z18.object({ assignments: assignmentsSchema, sig: z18.string().regex(/^[A-Za-z0-9_-]{86}$/) });
2614
+ var uptimeRegionStateSchema = z18.object({
2615
+ region: z18.enum(UPTIME_REGIONS),
2616
+ outcome: z18.enum(UPTIME_OUTCOMES),
2617
+ reason: z18.enum(UPTIME_REASONS).nullable(),
2618
+ status_code: z18.number().int().min(100).max(599).nullable(),
2619
+ total_ms: z18.number().nonnegative().max(60000).nullable(),
2146
2620
  timings: timingsSchema.nullable().optional(),
2147
- at: iso2
2621
+ at: iso4
2148
2622
  });
2149
- var uptimeStatusReportSchema = z14.object({
2623
+ var uptimeStatusReportSchema = z18.object({
2150
2624
  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(),
2625
+ revision: z18.number().int().nonnegative(),
2626
+ status: z18.enum(UPTIME_STATUSES),
2627
+ last_verdict: z18.enum(SLOT_VERDICTS).nullable(),
2628
+ last_slot_at: iso4.nullable(),
2155
2629
  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()
2630
+ down_streak: z18.number().int().nonnegative(),
2631
+ up_streak: z18.number().int().nonnegative(),
2632
+ regions: z18.array(uptimeRegionStateSchema).max(3),
2633
+ unobserved_regions: z18.array(z18.enum(UPTIME_REGIONS)).max(3),
2634
+ cert_not_after: iso4.nullable(),
2635
+ cert_expiring: z18.boolean(),
2636
+ run_now: z18.object({ run_id: z18.string().max(64), results: z18.array(uptimeRegionStateSchema).max(3) }).nullable()
2163
2637
  });
2164
2638
  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}$/),
2639
+ var uptimeEventSchema = z18.object({
2640
+ event_id: z18.string().regex(/^[A-Za-z0-9:_-]{8,96}$/),
2167
2641
  check_id: uuid3,
2168
- kind: z14.enum(UPTIME_EVENT_KINDS),
2642
+ kind: z18.enum(UPTIME_EVENT_KINDS),
2169
2643
  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()
2644
+ at: iso4,
2645
+ reason: z18.enum(UPTIME_REASONS).nullable(),
2646
+ regions: z18.array(z18.enum(UPTIME_REGIONS)).max(3),
2647
+ cert_days_left: z18.number().int().nullable()
2174
2648
  });
2175
- var uptimeMinuteSchema = z14.object({
2649
+ var uptimeMinuteSchema = z18.object({
2176
2650
  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)
2651
+ minute: iso4,
2652
+ up: z18.number().int().nonnegative(),
2653
+ degraded: z18.number().int().nonnegative(),
2654
+ down: z18.number().int().nonnegative(),
2655
+ unknown: z18.number().int().nonnegative(),
2656
+ latency: z18.array(z18.object({ region: z18.enum(UPTIME_REGIONS), n: z18.number().int().positive(), p50_ms: z18.number().nonnegative(), p95_ms: z18.number().nonnegative() })).max(3)
2183
2657
  });
2184
- var uptimeReportSchema = z14.object({
2185
- v: z14.literal(1),
2658
+ var uptimeReportSchema = z18.object({
2659
+ v: z18.literal(1),
2186
2660
  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)
2661
+ revision: z18.number().int().nonnegative(),
2662
+ sent_at: iso4,
2663
+ events: z18.array(uptimeEventSchema).max(UPTIME_LIMITS.reportMaxEvents),
2664
+ statuses: z18.array(uptimeStatusReportSchema).max(UPTIME_LIMITS.reportMaxStatuses),
2665
+ minutes: z18.array(uptimeMinuteSchema).max(UPTIME_LIMITS.reportMaxMinutes)
2192
2666
  });
2193
- var probeFleetReportSchema = z14.object({
2194
- v: z14.literal(1),
2195
- sent_at: iso2,
2196
- probes: z14.array(z14.object({
2667
+ var probeFleetReportSchema = z18.object({
2668
+ v: z18.literal(1),
2669
+ sent_at: iso4,
2670
+ probes: z18.array(z18.object({
2197
2671
  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()
2672
+ region: z18.enum(UPTIME_REGIONS),
2673
+ version: z18.string().max(40).nullable(),
2674
+ last_seen_at: iso4.nullable(),
2675
+ lag_p99_ms: z18.number().nonnegative().nullable(),
2676
+ checks_per_min: z18.number().nonnegative().nullable()
2203
2677
  })).max(30),
2204
- regions_alive: z14.array(z14.enum(UPTIME_REGIONS)).max(3)
2678
+ regions_alive: z18.array(z18.enum(UPTIME_REGIONS)).max(3)
2205
2679
  });
2206
- var probeEnrollSchema = z14.object({
2207
- v: z14.literal(1),
2680
+ var probeEnrollSchema = z18.object({
2681
+ v: z18.literal(1),
2208
2682
  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}$/)
2683
+ public_key: z18.string().regex(/^[A-Za-z0-9_-]{43}$/),
2684
+ code: z18.string().regex(/^[A-Za-z0-9_-]{43}$/),
2685
+ ts: z18.number().int().positive(),
2686
+ sig: z18.string().regex(/^[A-Za-z0-9_-]{86}$/)
2213
2687
  });
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),
2688
+ var uptimeEvidenceEnvelopeSchema = z18.object({
2689
+ v: z18.literal(1),
2690
+ check_id: z18.guid(),
2691
+ slot: z18.number().int().nonnegative(),
2692
+ region: z18.enum(UPTIME_REGIONS),
2219
2693
  probe_id: probeIdSchema,
2220
- at: z14.number().int().positive(),
2221
- sealed: z14.string().regex(/^[A-Za-z0-9_-]+$/).max(16384)
2694
+ at: z18.number().int().positive(),
2695
+ sealed: z18.string().regex(/^[A-Za-z0-9_-]+$/).max(16384)
2222
2696
  }).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(),
2697
+ var uptimeEvidenceSchema = z18.object({
2698
+ v: z18.literal(1),
2699
+ check_id: z18.guid(),
2700
+ slot: z18.number().int().nonnegative(),
2701
+ region: z18.enum(UPTIME_REGIONS),
2702
+ at: z18.number().int().positive(),
2703
+ reason: z18.enum(UPTIME_REASONS).nullable(),
2704
+ status_line: z18.string().max(200).nullable(),
2705
+ headers: z18.record(z18.string().max(64), z18.string().max(512)).refine((h) => Object.keys(h).length <= 20),
2706
+ body: z18.string().max(UPTIME_LIMITS.evidenceMaxBytes * 4).nullable(),
2707
+ body_truncated: z18.boolean(),
2234
2708
  timings: timingsSchema.nullable(),
2235
- ip: z14.string().max(64).nullable(),
2236
- error: z14.string().max(300).nullable()
2709
+ ip: z18.string().max(64).nullable(),
2710
+ error: z18.string().max(300).nullable()
2237
2711
  }).strict();
2238
- var uptimeEvidenceListSchema = z14.object({
2239
- items: z14.array(uptimeEvidenceSchema.extend({ received_at: z14.number().int().positive() })).max(UPTIME_LIMITS.evidenceKeepPerCheck)
2712
+ var uptimeEvidenceListSchema = z18.object({
2713
+ items: z18.array(uptimeEvidenceSchema.extend({ received_at: z18.number().int().positive() })).max(UPTIME_LIMITS.evidenceKeepPerCheck)
2240
2714
  });
2241
2715
 
2242
2716
  // ../src/shared/contracts/api-ops/monitors.ts
2243
- var anyMonitorInputSchema = z15.union([monitorInputSchema, signalMonitorInputSchema]);
2717
+ var anyMonitorInputSchema = z19.union([monitorInputSchema, signalMonitorInputSchema]);
2244
2718
  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 })
2719
+ create: z19.object({ workspaceId: uuid, input: maintenanceInputSchema }),
2720
+ update: z19.object({ workspaceId: uuid, windowId: uuid, input: maintenanceInputSchema }),
2721
+ delete: z19.object({ workspaceId: uuid, windowId: uuid })
2248
2722
  };
2249
2723
  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({
2724
+ create: z19.object({ projectId, slug: z19.string().regex(SLUG_RE), input: anyMonitorInputSchema }),
2725
+ update: z19.object({ monitorId: uuid, input: anyMonitorInputSchema }),
2726
+ delete: z19.object({ monitorId: uuid, confirmSlug: z19.string().max(64) }),
2727
+ setPause: z19.object({ monitorId: uuid, until: holdUntil }),
2728
+ setMuted: z19.object({ monitorId: uuid, muted: z19.boolean() }),
2729
+ dismissDiscovery: z19.object({ discoveryId: uuid }),
2730
+ rotatePing: z19.object({
2257
2731
  monitorId: uuid,
2258
- graceHours: z15.number().int().refine((h) => HEARTBEAT_LIMITS.rotationGraceHoursChoices.includes(h))
2732
+ graceHours: z19.number().int().refine((h) => HEARTBEAT_LIMITS.rotationGraceHoursChoices.includes(h))
2259
2733
  }),
2260
- monitorOnly: z15.object({ monitorId: uuid })
2734
+ monitorOnly: z19.object({ monitorId: uuid })
2261
2735
  };
2262
2736
  var UPTIME_INPUTS = {
2263
2737
  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 })
2738
+ update: z19.object({ checkId: uuid, input: uptimeCheckInputSchema }),
2739
+ checkOnly: z19.object({ checkId: uuid }),
2740
+ setHold: z19.object({ checkId: uuid, kind: z19.enum(["pause", "mute"]), until: holdUntil })
2267
2741
  };
2268
2742
  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({
2743
+ create: z19.object({ workspaceId: uuid, input: sloInputSchema }),
2744
+ update: z19.object({ sloId: uuid, input: sloInputSchema }),
2745
+ sloOnly: z19.object({ sloId: uuid }),
2746
+ setHold: z19.object({ sloId: uuid, kind: z19.enum(["pause", "mute"]), until: holdUntil }),
2747
+ import: z19.object({
2274
2748
  workspaceId: uuid,
2275
- text: z15.string().max(SLO_LIMITS.openSloMaxBytes * 2),
2276
- dryRun: z15.boolean()
2749
+ text: z19.string().max(SLO_LIMITS.openSloMaxBytes * 2),
2750
+ dryRun: z19.boolean()
2277
2751
  })
2278
2752
  };
2279
2753
  var m = "monitors:write";
@@ -2615,19 +3089,19 @@ var MONITOR_OPERATIONS = [
2615
3089
  ];
2616
3090
 
2617
3091
  // ../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();
3092
+ import { z as z20 } from "zod";
3093
+ var issueId = z20.number().int().positive();
3094
+ var csv = z20.string().min(1).max(2000);
3095
+ var name2 = z20.string().min(1).max(256);
3096
+ var period = z20.enum(["1h", "24h", "7d", "14d", "30d"]);
3097
+ var nodeCursor = z20.string().min(1).max(600).optional();
2624
3098
  var windowFields = {
2625
- start: z16.string().max(40).optional(),
2626
- end: z16.string().max(40).optional()
3099
+ start: z20.string().max(40).optional(),
3100
+ end: z20.string().max(40).optional()
2627
3101
  };
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();
3102
+ var traceId = z20.string().regex(/^[0-9a-fA-F]{32}$/);
3103
+ var spanId = z20.string().regex(/^[0-9a-fA-F]{16}$/);
3104
+ var attrs = z20.string().max(2000).optional();
2631
3105
  var telemetryCommon = {
2632
3106
  ...windowFields,
2633
3107
  project: csv.optional(),
@@ -2635,112 +3109,134 @@ var telemetryCommon = {
2635
3109
  service: csv.optional(),
2636
3110
  attrs
2637
3111
  };
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"]) })
3112
+ var issueChange = z20.union([
3113
+ z20.object({ action: z20.literal("resolve"), inNextRelease: z20.boolean().optional() }),
3114
+ z20.object({ action: z20.literal("unresolve") }),
3115
+ z20.object({ action: z20.literal("archive"), mode: z20.enum(["until_escalating", "forever"]) }),
3116
+ z20.object({
3117
+ action: z20.literal("archive"),
3118
+ mode: z20.literal("until_condition"),
3119
+ events: z20.number().int().min(1).max(1e6).optional(),
3120
+ users: z20.number().int().min(1).max(1e5).optional(),
3121
+ until: z20.string().datetime().optional()
3122
+ }),
3123
+ z20.object({ action: z20.literal("assign"), userId: z20.guid().nullable() }),
3124
+ z20.object({ action: z20.literal("priority"), priority: z20.enum(["low", "medium", "high"]) })
2651
3125
  ]);
2652
3126
  var NODE_INPUTS = {
2653
- issuesList: z16.object({
3127
+ issuesList: z20.object({
2654
3128
  project: csv.optional(),
2655
- status: z16.enum(["unresolved", "resolved", "archived", "all"]).optional(),
3129
+ status: z20.enum(["unresolved", "resolved", "archived", "all"]).optional(),
2656
3130
  level: csv.optional(),
2657
3131
  priority: csv.optional(),
2658
3132
  environment: csv.optional(),
2659
3133
  release: csv.optional(),
2660
- assignee: z16.string().max(64).optional(),
3134
+ assignee: z20.string().max(64).optional(),
2661
3135
  period: period.optional(),
2662
- q: z16.string().max(200).optional(),
2663
- sort: z16.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
3136
+ q: z20.string().max(200).optional(),
3137
+ sort: z20.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
2664
3138
  cursor: nodeCursor,
2665
- limit: z16.number().int().min(1).max(100).optional()
3139
+ limit: z20.number().int().min(1).max(100).optional()
2666
3140
  }),
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({
3141
+ issue: z20.object({ issueId }),
3142
+ issueStats: z20.object({ issueId, range: z20.enum(["24h", "30d"]).optional() }),
3143
+ issueEvents: z20.object({ issueId, cursor: nodeCursor }),
3144
+ issueEvent: z20.object({
2671
3145
  issueId,
2672
- eventId: z16.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
3146
+ eventId: z20.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
2673
3147
  }),
2674
- issueUpdate: z16.object({ issueId, change: issueChange }),
2675
- issuesBulk: z16.object({
2676
- issueIds: z16.array(issueId).min(1).max(100),
3148
+ issueUpdate: z20.object({ issueId, change: issueChange }),
3149
+ issuesBulk: z20.object({
3150
+ issueIds: z20.array(issueId).min(1).max(100),
2677
3151
  action: issueChange
2678
3152
  }),
2679
- spansList: z16.object({
3153
+ spansList: z20.object({
2680
3154
  ...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(),
3155
+ operation: z20.string().min(1).max(1024).optional(),
3156
+ status: z20.enum(["unset", "ok", "error"]).optional(),
3157
+ kind: z20.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
3158
+ minDurationMs: z20.number().min(0).max(86400000).optional(),
3159
+ maxDurationMs: z20.number().min(0).max(86400000).optional(),
3160
+ mode: z20.enum(["spans", "traces"]).optional(),
2687
3161
  cursor: nodeCursor
2688
3162
  }),
2689
- spansHistogram: z16.object({
3163
+ spansHistogram: z20.object({
2690
3164
  ...telemetryCommon,
2691
- operation: z16.string().min(1).max(1024).optional(),
2692
- status: z16.enum(["unset", "ok", "error"]).optional()
3165
+ operation: z20.string().min(1).max(1024).optional(),
3166
+ status: z20.enum(["unset", "ok", "error"]).optional()
2693
3167
  }),
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({
3168
+ trace: z20.object({ traceId }),
3169
+ traceSpans: z20.object({ traceId, errorsOnly: z20.enum(["1"]).optional(), ...windowFields }),
3170
+ span: z20.object({ traceId, spanId, ...windowFields }),
3171
+ logsList: z20.object({
2698
3172
  ...telemetryCommon,
2699
- severityMin: z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3173
+ severityMin: z20.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
2700
3174
  traceId: traceId.optional(),
2701
3175
  spanId: spanId.optional(),
2702
- q: z16.string().max(500).optional(),
2703
- order: z16.enum(["asc", "desc"]).optional(),
3176
+ q: z20.string().max(500).optional(),
3177
+ order: z20.enum(["asc", "desc"]).optional(),
2704
3178
  cursor: nodeCursor
2705
3179
  }),
2706
- logsFacets: z16.object({
3180
+ logsFacets: z20.object({
2707
3181
  ...telemetryCommon,
2708
- severityMin: z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
2709
- q: z16.string().max(500).optional()
3182
+ severityMin: z20.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3183
+ q: z20.string().max(500).optional()
2710
3184
  }),
2711
- logAround: z16.object({
3185
+ logAround: z20.object({
2712
3186
  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(),
3187
+ at: z20.string().max(40),
3188
+ same: z20.enum(["service", "trace"]).optional(),
3189
+ before: z20.number().int().min(0).max(200).optional(),
3190
+ after: z20.number().int().min(0).max(200).optional()
3191
+ }),
3192
+ metricsNames: z20.object({
3193
+ project: z20.number().int().positive(),
3194
+ environment: csv.optional(),
3195
+ q: z20.string().max(255).optional()
3196
+ }),
3197
+ metricsSeries: z20.object({
3198
+ project: z20.number().int().positive(),
3199
+ name: z20.string().regex(METRIC_NAME_RE),
3200
+ environment: csv.optional(),
3201
+ attrs,
3202
+ cursor: z20.string().regex(/^[0-9a-f]{16}$/).optional()
3203
+ }),
3204
+ metricsQuery: z20.object({
3205
+ project: z20.number().int().positive(),
3206
+ name: z20.string().regex(METRIC_NAME_RE),
3207
+ aggregation: z20.enum(METRIC_AGGREGATIONS),
3208
+ ...windowFields,
3209
+ step: z20.number().int().min(METRIC_QUERY.minStepSeconds).max(METRIC_QUERY.maxStepSeconds).multipleOf(60).optional(),
3210
+ attrs,
3211
+ groupBy: z20.string().min(1).max(600).optional(),
3212
+ environment: csv.optional()
3213
+ }),
3214
+ telemetryUsage: z20.object({ project: csv.optional(), days: z20.number().int().min(1).max(31).optional() }),
3215
+ monitorSignal: z20.object({ monitorId: z20.guid(), hours: z20.number().int().min(1).max(24).optional() }),
3216
+ monitorOccurrences: z20.object({
3217
+ monitorId: z20.guid(),
3218
+ state: z20.enum(["open", "finished", "all"]).optional(),
3219
+ environment: z20.string().min(1).max(64).optional(),
2724
3220
  cursor: nodeCursor
2725
3221
  }),
2726
- monitorBacktest: z16.object({ project: z16.number().int().positive(), settings: backtestSettingsSchema }),
2727
- occurrenceCreate: z16.object({
2728
- project: z16.number().int().positive(),
3222
+ monitorBacktest: z20.object({ project: z20.number().int().positive(), settings: backtestSettingsSchema }),
3223
+ occurrenceCreate: z20.object({
3224
+ project: z20.number().int().positive(),
2729
3225
  monitorSlug: occurrenceInputSchema.shape.monitor_slug,
2730
3226
  occurrenceId: occurrenceInputSchema.shape.occurrence_id,
2731
3227
  dueAt: occurrenceInputSchema.shape.due_at,
2732
3228
  environment: occurrenceInputSchema.shape.environment
2733
3229
  }),
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()
3230
+ occurrenceCancel: z20.object({
3231
+ project: z20.number().int().positive(),
3232
+ monitorSlug: z20.string().regex(SLUG_RE),
3233
+ occurrenceId: z20.string().regex(OCCURRENCE_ID_RE),
3234
+ environment: z20.string().min(1).max(64).optional()
2739
3235
  }),
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()
3236
+ ticket: z20.object({
3237
+ scope: z20.enum(["read", "write"]).default("read"),
3238
+ project: z20.number().int().positive().optional(),
3239
+ environment: z20.string().min(1).max(64).optional()
2744
3240
  })
2745
3241
  };
2746
3242
  var N = NODE_INPUTS;
@@ -2902,6 +3398,34 @@ var NODE_OPERATIONS = [
2902
3398
  node: { path: "q/logs/{log_id}/around" },
2903
3399
  summary: "Log records just before and after one record."
2904
3400
  }),
3401
+ op({
3402
+ ...read,
3403
+ id: "metrics.names",
3404
+ path: "/v1/metrics/names",
3405
+ scope: "metrics:read",
3406
+ input: N.metricsNames,
3407
+ node: { path: "q/metrics/names" },
3408
+ summary: "The metric catalog of one project (name, type, kind, unit, series count, last seen) and the node's series and name caps with the metrics it is dropping points for."
3409
+ }),
3410
+ op({
3411
+ ...read,
3412
+ id: "metrics.series",
3413
+ path: "/v1/metrics/series",
3414
+ scope: "metrics:read",
3415
+ input: N.metricsSeries,
3416
+ node: { path: "q/metrics/series", list: "series" },
3417
+ paged: true,
3418
+ summary: "The time series of one metric (attributes, service, environment, first and last seen), 100 per page."
3419
+ }),
3420
+ op({
3421
+ ...read,
3422
+ id: "metrics.query",
3423
+ path: "/v1/metrics/query",
3424
+ scope: "metrics:read",
3425
+ input: N.metricsQuery,
3426
+ node: { path: "q/metrics/query", window: true },
3427
+ summary: "One metric aggregated per step (avg, sum, min, max, count, rate, p50–p99) in a window of at most 7 days, optionally grouped by up to two attributes (≤ 50 groups, ≤ 10,000 points), with exemplar trace ids."
3428
+ }),
2905
3429
  op({
2906
3430
  ...read,
2907
3431
  id: "telemetry.usage",
@@ -3001,12 +3525,122 @@ var NODE_OPERATIONS = [
3001
3525
  })
3002
3526
  ];
3003
3527
 
3004
- // ../src/shared/contracts/api-ops/projects.ts
3528
+ // ../src/shared/contracts/api-ops/privacy.ts
3529
+ import { z as z22 } from "zod";
3530
+
3531
+ // ../src/shared/contracts/privacy.ts
3005
3532
  import { z as z21 } from "zod";
3006
3533
 
3534
+ // ../src/shared/privacy/rules.ts
3535
+ var PRIVACY_SCHEMA = 1;
3536
+ var PRIVACY_LIMITS = {
3537
+ rules: 100,
3538
+ allowlist: 100,
3539
+ selector: 256,
3540
+ pattern: 256,
3541
+ replaceWith: 32,
3542
+ ruleId: 64,
3543
+ stringChars: 16384,
3544
+ quantifierMax: 1000,
3545
+ matches: 500,
3546
+ depth: 32
3547
+ };
3548
+ var PRIVACY_MODES = ["standard", "strict"];
3549
+ var PRIVACY_RULE_TYPES = ["pattern", "anything", "creditcard", "ip", "email", "phone_e164"];
3550
+ var PRIVACY_METHODS = ["remove", "replace", "mask", "hash"];
3551
+ var AUTH_HEADER_KEYS = new Set(["authorization", "proxy-authorization", "x-api-key", "x-auth-token", "x-sentry-auth", "x-amz-security-token"]);
3552
+ var COOKIE_KEYS = new Set(["cookie", "cookies", "set-cookie"]);
3553
+ var BODY_KEYS = new Set(["body", "request_body", "response_body", "raw_body", "message_body", "html_body"]);
3554
+ var CARD_KEYS = new Set(["card_number", "cardnumber", "cc_number", "ccnum", "cvv", "cvc", "pan"]);
3555
+ var OCTET = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)";
3556
+ var IPV4_RE = new RegExp(`(^|[^\\d.])(${OCTET}(?:\\.${OCTET}){3})(?![\\d.])`, "g");
3557
+ var H = "[0-9A-Fa-f]{1,4}";
3558
+ 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");
3559
+ var REMOVE = Symbol("remove");
3560
+
3561
+ // ../src/shared/contracts/privacy.ts
3562
+ var ruleId = z21.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
3563
+ var privacyRuleInputSchema = z21.object({
3564
+ id: ruleId,
3565
+ selector: z21.string().min(1).max(PRIVACY_LIMITS.selector),
3566
+ type: z21.enum(PRIVACY_RULE_TYPES),
3567
+ method: z21.enum(PRIVACY_METHODS),
3568
+ pattern: z21.string().min(1).max(PRIVACY_LIMITS.pattern).optional(),
3569
+ ignoreCase: z21.boolean().optional(),
3570
+ replaceWith: z21.string().max(PRIVACY_LIMITS.replaceWith).optional(),
3571
+ enabled: z21.boolean().optional()
3572
+ });
3573
+ var privacyPolicyInputSchema = z21.object({
3574
+ mode: z21.enum(PRIVACY_MODES),
3575
+ rules: z21.array(privacyRuleInputSchema).max(PRIVACY_LIMITS.rules),
3576
+ allowlist: z21.array(z21.string().min(1).max(PRIVACY_LIMITS.selector)).max(PRIVACY_LIMITS.allowlist)
3577
+ });
3578
+ var storedPolicySchema = z21.object({
3579
+ schema: z21.literal(PRIVACY_SCHEMA),
3580
+ version: z21.number().int().min(0),
3581
+ mode: z21.enum(PRIVACY_MODES),
3582
+ rules: z21.array(z21.record(z21.string(), z21.unknown())).max(PRIVACY_LIMITS.rules),
3583
+ allowlist: z21.array(z21.string()).max(PRIVACY_LIMITS.allowlist)
3584
+ });
3585
+ var nodePrivacyBlockSchema = z21.array(z21.object({ project_id: z21.number().int().positive(), policy: z21.unknown() })).max(1000);
3586
+ var privacyRollupSchema = z21.object({
3587
+ applied_version: z21.number().int().min(0).nullable(),
3588
+ policy_missing_24h: z21.number().int().nonnegative(),
3589
+ budget_exceeded_24h: z21.number().int().nonnegative(),
3590
+ sdk_versions: z21.array(z21.object({ version: z21.number().int().min(0), last_seen_at: z21.string().datetime() })).max(5)
3591
+ });
3592
+
3593
+ // ../src/shared/contracts/api-ops/privacy.ts
3594
+ var PRIVACY_INPUTS = {
3595
+ get: z22.object({ workspaceId: uuid, projectId }),
3596
+ set: z22.object({
3597
+ workspaceId: uuid,
3598
+ projectId,
3599
+ expectedVersion: z22.number().int().min(0),
3600
+ policy: privacyPolicyInputSchema
3601
+ })
3602
+ };
3603
+ var P = PRIVACY_INPUTS;
3604
+ var PRIVACY_OPERATIONS = [
3605
+ op({
3606
+ id: "privacy.get",
3607
+ method: "GET",
3608
+ path: "/v1/projects/{project_id}/privacy",
3609
+ scope: "projects:read",
3610
+ sensitivity: "normal",
3611
+ kind: "read",
3612
+ rpcs: ["api_read_privacy"],
3613
+ input: P.get,
3614
+ workspace: true,
3615
+ idempotency: "none",
3616
+ mcp: "configure",
3617
+ 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.",
3618
+ ui: []
3619
+ }),
3620
+ op({
3621
+ id: "privacy.set",
3622
+ method: "PUT",
3623
+ path: "/v1/projects/{project_id}/privacy",
3624
+ scope: "privacy:write",
3625
+ sensitivity: "approval",
3626
+ kind: "write",
3627
+ rpcs: ["set_privacy_policy"],
3628
+ input: P.set,
3629
+ bodyField: "policy",
3630
+ workspace: true,
3631
+ idempotency: "optional",
3632
+ mcp: "configure",
3633
+ 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.",
3634
+ ui: ["privacy#setPrivacyPolicy"]
3635
+ })
3636
+ ];
3637
+
3638
+ // ../src/shared/contracts/api-ops/projects.ts
3639
+ import { z as z26 } from "zod";
3640
+
3007
3641
  // ../src/shared/contracts/ingest-keys.ts
3008
- import { z as z17 } from "zod";
3009
- var INGEST_KEY_SCOPES = ["traces", "logs", "errors", "monitors"];
3642
+ import { z as z23 } from "zod";
3643
+ var INGEST_KEY_SCOPES = ["traces", "logs", "metrics", "errors", "monitors"];
3010
3644
  var INGEST_KEY_STATES = ["active", "revoked"];
3011
3645
  var INGEST_KEY_LIMITS = {
3012
3646
  nameMaxChars: 80,
@@ -3015,174 +3649,92 @@ var INGEST_KEY_LIMITS = {
3015
3649
  edgeCacheSeconds: 60
3016
3650
  };
3017
3651
  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(),
3652
+ var ingestKeyConfigSchema = z23.object({
3653
+ v: z23.literal(1),
3654
+ key_id: z23.guid(),
3655
+ project_public_id: z23.number().int().positive(),
3656
+ project_id: z23.number().int().positive(),
3657
+ workspace_id: z23.guid(),
3024
3658
  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()
3659
+ scopes: z23.array(z23.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
3660
+ environments: z23.array(z23.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
3661
+ expires_at: z23.string().datetime({ offset: true }).nullable(),
3662
+ state: z23.enum(INGEST_KEY_STATES),
3663
+ workspace_status: z23.enum(["active", "suspended", "deleting"]),
3664
+ ingest_kill: z23.boolean(),
3665
+ telemetry_kill: z23.boolean(),
3666
+ telemetry_rate_bytes_per_sec: z23.number().int().positive(),
3667
+ telemetry_burst_bytes: z23.number().int().positive(),
3668
+ traces_monthly_bytes: z23.number().int().positive(),
3669
+ logs_monthly_bytes: z23.number().int().positive(),
3670
+ metrics_monthly_bytes: z23.number().int().positive().optional(),
3671
+ telemetry_buffer_minutes: z23.number().int().min(1).max(1440),
3672
+ revision: z23.number().int().nonnegative()
3038
3673
  });
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()
3674
+ var createIngestKeyInputSchema = z23.object({
3675
+ projectId: z23.number().int().positive(),
3676
+ name: z23.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
3677
+ scopes: z23.array(z23.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
3678
+ environments: z23.array(z23.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
3679
+ expiresAt: z23.string().datetime({ offset: true }).nullable()
3045
3680
  });
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()
3681
+ var ingestKeyRowSchema = z23.object({
3682
+ id: z23.guid(),
3683
+ project_id: z23.number().int().positive(),
3684
+ name: z23.string(),
3685
+ prefix: z23.string(),
3686
+ scopes: z23.array(z23.enum(INGEST_KEY_SCOPES)),
3687
+ environments: z23.array(z23.string()),
3688
+ expires_at: z23.string().nullable(),
3689
+ state: z23.enum(INGEST_KEY_STATES),
3690
+ created_by: z23.guid().nullable(),
3691
+ created_at: z23.string(),
3692
+ revoked_at: z23.string().nullable(),
3693
+ last_used_at: z23.string().nullable()
3142
3694
  });
3143
3695
 
3144
3696
  // ../src/shared/contracts/node-config.ts
3145
- import { z as z20 } from "zod";
3697
+ import { z as z25 } from "zod";
3146
3698
 
3147
3699
  // ../src/shared/contracts/backup.ts
3148
- import { z as z19 } from "zod";
3700
+ import { z as z24 } from "zod";
3149
3701
  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),
3702
+ var ageRecipient = z24.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
3703
+ var backupIdSchema = z24.string().regex(/^[a-z0-9-]{8,64}$/);
3704
+ var nodeBackupConfigSchema = z24.object({
3705
+ enabled: z24.boolean(),
3706
+ hour_utc: z24.number().int().min(0).max(23),
3707
+ weekly_day: z24.number().int().min(1).max(7),
3156
3708
  workspace_recipient: ageRecipient
3157
3709
  });
3158
- var backupCredentialsRequestSchema = z19.object({
3159
- mode: z19.enum(["upload", "download"]),
3710
+ var backupCredentialsRequestSchema = z24.object({
3711
+ mode: z24.enum(["upload", "download"]),
3160
3712
  backup_id: backupIdSchema,
3161
- source_node_id: z19.guid().optional()
3713
+ source_node_id: z24.guid().optional()
3162
3714
  });
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()
3715
+ var backupCredentialsSchema = z24.object({
3716
+ endpoint: z24.string().url(),
3717
+ bucket: z24.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
3718
+ prefix: z24.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
3719
+ access_key_id: z24.string().min(8).max(200),
3720
+ secret_access_key: z24.string().min(8).max(200),
3721
+ session_token: z24.string().min(8).max(4000),
3722
+ expires_at: z24.string().datetime()
3171
3723
  });
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),
3724
+ var rowCountsSchema = z24.record(z24.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z24.number().int().nonnegative());
3725
+ var backupManifestSchema = z24.object({
3726
+ v: z24.literal(1),
3175
3727
  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(),
3728
+ node_id: z24.guid(),
3729
+ kind: z24.enum(BACKUP_KINDS),
3730
+ created_at: z24.string().datetime(),
3731
+ object_key: z24.string(),
3732
+ size_bytes: z24.number().int().nonnegative(),
3733
+ sha256: z24.string().regex(/^[0-9a-f]{64}$/),
3734
+ clickhouse_version: z24.string().max(40),
3735
+ schema_version: z24.number().int().nonnegative(),
3184
3736
  row_counts: rowCountsSchema,
3185
- recipients: z19.array(z19.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
3737
+ recipients: z24.array(z24.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
3186
3738
  });
3187
3739
  var BACKUP_ERROR_CODES = [
3188
3740
  "CLICKHOUSE_BACKUP_FAILED",
@@ -3196,48 +3748,48 @@ var BACKUP_ERROR_CODES = [
3196
3748
  "RESTORE_FAILED",
3197
3749
  "ROW_COUNT_MISMATCH"
3198
3750
  ];
3199
- var backupReportSchema = z19.object({
3751
+ var backupReportSchema = z24.object({
3200
3752
  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(),
3753
+ kind: z24.enum(BACKUP_KINDS),
3754
+ status: z24.enum(["succeeded", "failed"]),
3755
+ started_at: z24.string().datetime(),
3756
+ finished_at: z24.string().datetime(),
3205
3757
  manifest: backupManifestSchema.nullable(),
3206
- error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
3758
+ error_code: z24.enum(BACKUP_ERROR_CODES).nullable()
3207
3759
  });
3208
- var drillReportSchema = z19.object({
3760
+ var drillReportSchema = z24.object({
3209
3761
  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()
3762
+ kind: z24.enum(["weekly_local", "monthly_new_machine"]),
3763
+ status: z24.enum(["passed", "failed"]),
3764
+ finished_at: z24.string().datetime(),
3765
+ detail: z24.string().max(300),
3766
+ error_code: z24.enum(BACKUP_ERROR_CODES).nullable()
3215
3767
  });
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()
3768
+ var nodeIdentityEscrowSchema = z24.object({
3769
+ v: z24.literal(1),
3770
+ node_id: z24.guid(),
3771
+ seal: z24.object({
3772
+ publicKey: z24.string().regex(/^[A-Za-z0-9_-]{43}$/),
3773
+ privateKey: z24.string().regex(/^[A-Za-z0-9_-]{43}$/)
3774
+ }),
3775
+ created_at: z24.string().datetime()
3224
3776
  });
3225
- var restoreArgsSchema = z19.object({
3226
- job_id: z19.guid(),
3227
- workspace_id: z19.guid(),
3228
- source_node_id: z19.guid(),
3777
+ var restoreArgsSchema = z24.object({
3778
+ job_id: z24.guid(),
3779
+ workspace_id: z24.guid(),
3780
+ source_node_id: z24.guid(),
3229
3781
  manifest: backupManifestSchema,
3230
- sealed_identity: z19.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
3231
- mode: z19.enum(["rebuild", "drill"])
3782
+ sealed_identity: z24.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
3783
+ mode: z24.enum(["rebuild", "drill"])
3232
3784
  });
3233
- var restoreReportSchema = z19.object({
3234
- job_id: z19.guid(),
3785
+ var restoreReportSchema = z24.object({
3786
+ job_id: z24.guid(),
3235
3787
  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()
3788
+ mode: z24.enum(["rebuild", "drill"]),
3789
+ status: z24.enum(["succeeded", "failed"]),
3790
+ finished_at: z24.string().datetime(),
3791
+ detail: z24.string().max(300),
3792
+ error_code: z24.enum(BACKUP_ERROR_CODES).nullable()
3241
3793
  });
3242
3794
 
3243
3795
  // ../src/shared/contracts/node-config.ts
@@ -3251,83 +3803,85 @@ var SCRUB_GROUPS = [
3251
3803
  "headers"
3252
3804
  ];
3253
3805
  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()
3806
+ var kid = z25.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
3807
+ var publicKey = z25.string().regex(/^[A-Za-z0-9_-]{43}$/);
3808
+ var nodeConfigSchema = z25.object({
3809
+ v: z25.literal(1),
3810
+ config_version: z25.number().int().positive(),
3811
+ node_id: z25.guid(),
3812
+ workspace_id: z25.guid(),
3813
+ workspace_status: z25.enum(["active", "suspended"]),
3814
+ issued_at: z25.string().datetime(),
3815
+ retention_days: z25.number().int().min(1).max(3650),
3816
+ channel: z25.enum(["stable", "canary"]).optional(),
3817
+ projects: z25.array(z25.object({
3818
+ project_id: z25.number().int().positive(),
3819
+ slug: z25.string().max(64),
3820
+ short_prefix: z25.string().regex(/^[A-Z0-9]{1,12}$/),
3821
+ user_id_salt: z25.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
3822
+ scrub_disabled: z25.array(z25.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
3823
+ upload_tokens: z25.array(z25.object({
3824
+ hash: z25.string().regex(/^[a-f0-9]{64}$/),
3825
+ expires_at: z25.string().datetime()
3274
3826
  })).max(10).optional()
3275
3827
  })).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() }),
3828
+ ticket_keys: z25.array(z25.object({ kid, public_key: publicKey, not_after: z25.string().datetime() })).min(1).max(5),
3829
+ control_ops_keys: z25.array(z25.object({ kid, public_key: publicKey })).min(1).max(5),
3830
+ kill_switches: z25.object({ ingest: z25.boolean(), alerts: z25.boolean() }),
3279
3831
  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)
3832
+ purged_projects: z25.array(z25.number().int().positive()).max(1000).optional(),
3833
+ monitors: z25.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
3834
+ purged_monitors: z25.array(z25.guid()).max(5000).optional(),
3835
+ telemetry: z25.object({
3836
+ traces_retention_days: z25.number().int().min(1).max(90),
3837
+ logs_retention_days: z25.number().int().min(1).max(90),
3838
+ traces_disk_share: z25.number().min(0.2).max(0.8)
3287
3839
  }).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()
3840
+ metrics: metricsConfigSchema.optional(),
3841
+ slos: z25.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
3842
+ signal_monitors: z25.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
3843
+ signal_limits: signalLimitsConfigSchema.optional(),
3844
+ privacy: nodePrivacyBlockSchema.optional()
3291
3845
  });
3292
- var signedNodeConfigSchema = z20.object({ config: nodeConfigSchema, kid, sig: z20.string() });
3846
+ var signedNodeConfigSchema = z25.object({ config: nodeConfigSchema, kid, sig: z25.string() });
3293
3847
 
3294
3848
  // ../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();
3849
+ var slug = z26.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
3850
+ var name3 = z26.string().trim().min(1).max(60);
3851
+ var label2 = z26.string().trim().min(1).max(40);
3852
+ var platform = z26.enum(PLATFORMS);
3853
+ var origin = z26.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
3854
+ var keyId = z26.number().int().positive();
3301
3855
  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({
3856
+ create: z26.object({ workspaceId: uuid, name: name3, slug, platform }),
3857
+ update: z26.object({ projectId, name: name3, platform, isPinned: z26.boolean() }),
3858
+ updateIntake: z26.object({
3305
3859
  projectId,
3306
- rateLimit: z21.number().int().positive().nullable(),
3307
- burst: z21.number().int().positive().nullable(),
3308
- allowedOrigins: z21.array(origin).max(50)
3860
+ rateLimit: z26.number().int().positive().nullable(),
3861
+ burst: z26.number().int().positive().nullable(),
3862
+ allowedOrigins: z26.array(origin).max(50)
3309
3863
  }),
3310
- updateObservability: z21.object({
3864
+ updateObservability: z26.object({
3311
3865
  projectId,
3312
- primaryEnvironment: z21.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
3313
- allowCodeMonitors: z21.boolean()
3866
+ primaryEnvironment: z26.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
3867
+ allowCodeMonitors: z26.boolean()
3314
3868
  }),
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({
3869
+ setScrub: z26.object({ projectId, group: z26.enum(SCRUB_GROUPS), enabled: z26.boolean() }),
3870
+ setCheckinAuth: z26.object({ projectId, mode: z26.enum(CHECKIN_AUTH_MODES) }),
3871
+ setEnvironmentHidden: z26.object({
3318
3872
  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 }),
3873
+ name: z26.string().min(1).max(64),
3874
+ hidden: z26.boolean()
3875
+ }),
3876
+ scheduleDeletion: z26.object({ projectId, confirmSlug: slug }),
3877
+ projectOnly: z26.object({ projectId }),
3878
+ labelled: z26.object({ projectId, label: label2 }),
3879
+ keyOnly: z26.object({ keyId }),
3880
+ tokenOnly: z26.object({ tokenId: keyId }),
3327
3881
  createIngestKey: createIngestKeyInputSchema,
3328
- ingestKeyOnly: z21.object({ keyId: uuid })
3882
+ ingestKeyOnly: z26.object({ keyId: uuid })
3329
3883
  };
3330
- var P = PROJECT_INPUTS;
3884
+ var P2 = PROJECT_INPUTS;
3331
3885
  var PROJECT_OPERATIONS = [
3332
3886
  op({
3333
3887
  id: "projects.create",
@@ -3337,7 +3891,7 @@ var PROJECT_OPERATIONS = [
3337
3891
  sensitivity: "normal",
3338
3892
  kind: "write",
3339
3893
  rpcs: ["create_project"],
3340
- input: P.create,
3894
+ input: P2.create,
3341
3895
  workspace: true,
3342
3896
  idempotency: "required",
3343
3897
  status: 201,
@@ -3353,7 +3907,7 @@ var PROJECT_OPERATIONS = [
3353
3907
  sensitivity: "normal",
3354
3908
  kind: "write",
3355
3909
  rpcs: ["update_project"],
3356
- input: P.update,
3910
+ input: P2.update,
3357
3911
  ifMatch: true,
3358
3912
  idempotency: "none",
3359
3913
  mcp: "configure",
@@ -3368,7 +3922,7 @@ var PROJECT_OPERATIONS = [
3368
3922
  sensitivity: "normal",
3369
3923
  kind: "write",
3370
3924
  rpcs: ["update_project_intake"],
3371
- input: P.updateIntake,
3925
+ input: P2.updateIntake,
3372
3926
  ifMatch: true,
3373
3927
  idempotency: "none",
3374
3928
  mcp: "configure",
@@ -3383,7 +3937,7 @@ var PROJECT_OPERATIONS = [
3383
3937
  sensitivity: "normal",
3384
3938
  kind: "write",
3385
3939
  rpcs: ["update_project_observability"],
3386
- input: P.updateObservability,
3940
+ input: P2.updateObservability,
3387
3941
  ifMatch: true,
3388
3942
  idempotency: "none",
3389
3943
  mcp: "configure",
@@ -3395,10 +3949,10 @@ var PROJECT_OPERATIONS = [
3395
3949
  method: "PUT",
3396
3950
  path: "/v1/projects/{project_id}/scrub/{group}",
3397
3951
  scope: "privacy:write",
3398
- sensitivity: "normal",
3952
+ sensitivity: "approval",
3399
3953
  kind: "write",
3400
3954
  rpcs: ["set_project_scrub"],
3401
- input: P.setScrub,
3955
+ input: P2.setScrub,
3402
3956
  idempotency: "none",
3403
3957
  mcp: "configure",
3404
3958
  summary: "Turn one built-in scrubbing group on or off.",
@@ -3412,7 +3966,7 @@ var PROJECT_OPERATIONS = [
3412
3966
  sensitivity: "approval",
3413
3967
  kind: "write",
3414
3968
  rpcs: ["set_project_checkin_auth"],
3415
- input: P.setCheckinAuth,
3969
+ input: P2.setCheckinAuth,
3416
3970
  idempotency: "none",
3417
3971
  mcp: "configure",
3418
3972
  summary: "Choose which credentials may send check-ins.",
@@ -3426,7 +3980,7 @@ var PROJECT_OPERATIONS = [
3426
3980
  sensitivity: "normal",
3427
3981
  kind: "write",
3428
3982
  rpcs: ["set_environment_hidden"],
3429
- input: P.setEnvironmentHidden,
3983
+ input: P2.setEnvironmentHidden,
3430
3984
  idempotency: "none",
3431
3985
  mcp: "configure",
3432
3986
  summary: "Hide or show an environment in lists.",
@@ -3440,7 +3994,7 @@ var PROJECT_OPERATIONS = [
3440
3994
  sensitivity: "approval",
3441
3995
  kind: "write",
3442
3996
  rpcs: ["schedule_project_deletion"],
3443
- input: P.scheduleDeletion,
3997
+ input: P2.scheduleDeletion,
3444
3998
  idempotency: "none",
3445
3999
  mcp: "configure",
3446
4000
  summary: "Schedule the project's deletion; `confirm_slug` must repeat its slug.",
@@ -3454,7 +4008,7 @@ var PROJECT_OPERATIONS = [
3454
4008
  sensitivity: "normal",
3455
4009
  kind: "write",
3456
4010
  rpcs: ["cancel_project_deletion"],
3457
- input: P.projectOnly,
4011
+ input: P2.projectOnly,
3458
4012
  idempotency: "optional",
3459
4013
  mcp: "configure",
3460
4014
  summary: "Cancel a scheduled project deletion.",
@@ -3468,7 +4022,7 @@ var PROJECT_OPERATIONS = [
3468
4022
  sensitivity: "normal",
3469
4023
  kind: "write",
3470
4024
  rpcs: ["request_test_event"],
3471
- input: P.projectOnly,
4025
+ input: P2.projectOnly,
3472
4026
  idempotency: "optional",
3473
4027
  mcp: "reliability",
3474
4028
  summary: "Ask the node to send one test event through the public intake.",
@@ -3482,7 +4036,7 @@ var PROJECT_OPERATIONS = [
3482
4036
  sensitivity: "approval",
3483
4037
  kind: "write",
3484
4038
  rpcs: ["create_project_key"],
3485
- input: P.labelled,
4039
+ input: P2.labelled,
3486
4040
  idempotency: "required",
3487
4041
  status: 201,
3488
4042
  mcp: "configure",
@@ -3497,7 +4051,7 @@ var PROJECT_OPERATIONS = [
3497
4051
  sensitivity: "approval",
3498
4052
  kind: "write",
3499
4053
  rpcs: ["rotate_project_key"],
3500
- input: P.keyOnly,
4054
+ input: P2.keyOnly,
3501
4055
  idempotency: "optional",
3502
4056
  mcp: "configure",
3503
4057
  summary: "Replace a DSN key.",
@@ -3511,7 +4065,7 @@ var PROJECT_OPERATIONS = [
3511
4065
  sensitivity: "approval",
3512
4066
  kind: "write",
3513
4067
  rpcs: ["revoke_project_key"],
3514
- input: P.keyOnly,
4068
+ input: P2.keyOnly,
3515
4069
  idempotency: "none",
3516
4070
  mcp: "configure",
3517
4071
  summary: "Revoke a DSN key.",
@@ -3525,7 +4079,7 @@ var PROJECT_OPERATIONS = [
3525
4079
  sensitivity: "approval",
3526
4080
  kind: "write",
3527
4081
  rpcs: ["create_upload_token"],
3528
- input: P.labelled,
4082
+ input: P2.labelled,
3529
4083
  idempotency: "required",
3530
4084
  status: 201,
3531
4085
  mcp: "configure",
@@ -3541,7 +4095,7 @@ var PROJECT_OPERATIONS = [
3541
4095
  sensitivity: "approval",
3542
4096
  kind: "write",
3543
4097
  rpcs: ["revoke_upload_token"],
3544
- input: P.tokenOnly,
4098
+ input: P2.tokenOnly,
3545
4099
  idempotency: "none",
3546
4100
  mcp: "configure",
3547
4101
  summary: "Revoke a source map upload token.",
@@ -3555,7 +4109,7 @@ var PROJECT_OPERATIONS = [
3555
4109
  sensitivity: "approval",
3556
4110
  kind: "write",
3557
4111
  rpcs: ["create_ingest_key"],
3558
- input: P.createIngestKey,
4112
+ input: P2.createIngestKey,
3559
4113
  idempotency: "required",
3560
4114
  status: 201,
3561
4115
  mcp: "configure",
@@ -3571,7 +4125,7 @@ var PROJECT_OPERATIONS = [
3571
4125
  sensitivity: "approval",
3572
4126
  kind: "write",
3573
4127
  rpcs: ["revoke_ingest_key"],
3574
- input: P.ingestKeyOnly,
4128
+ input: P2.ingestKeyOnly,
3575
4129
  idempotency: "none",
3576
4130
  mcp: "configure",
3577
4131
  summary: "Revoke an OTLP ingest key.",
@@ -3580,24 +4134,24 @@ var PROJECT_OPERATIONS = [
3580
4134
  ];
3581
4135
 
3582
4136
  // ../src/shared/contracts/api-ops/reads.ts
3583
- import { z as z22 } from "zod";
3584
- var list = z22.object({ workspaceId: uuid, limit: pageLimit, cursor });
4137
+ import { z as z27 } from "zod";
4138
+ var list = z27.object({ workspaceId: uuid, limit: pageLimit, cursor });
3585
4139
  var READ_INPUTS = {
3586
- workspace: z22.object({ workspaceId: uuid }),
4140
+ workspace: z27.object({ workspaceId: uuid }),
3587
4141
  list,
3588
- projectsGet: z22.object({ workspaceId: uuid, projectId }),
4142
+ projectsGet: z27.object({ workspaceId: uuid, projectId }),
3589
4143
  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 }),
4144
+ monitorsGet: z27.object({ workspaceId: uuid, monitorId: uuid }),
4145
+ uptimeGet: z27.object({ workspaceId: uuid, checkId: uuid }),
4146
+ slosGet: z27.object({ workspaceId: uuid, sloId: uuid }),
3593
4147
  alertsList: list.extend({
3594
- state: z22.enum(["open", "resolved", "all"]).default("all"),
4148
+ state: z27.enum(["open", "resolved", "all"]).default("all"),
3595
4149
  monitorId: uuid.optional()
3596
4150
  }),
3597
- approvalsGet: z22.object({ workspaceId: uuid, approvalId: uuid }),
4151
+ approvalsGet: z27.object({ workspaceId: uuid, approvalId: uuid }),
3598
4152
  monitorsListTyped: list.extend({
3599
4153
  projectId: projectId.optional(),
3600
- type: z22.enum(MONITOR_TYPES).optional()
4154
+ type: z27.enum(MONITOR_TYPES).optional()
3601
4155
  })
3602
4156
  };
3603
4157
  var R = READ_INPUTS;
@@ -3809,6 +4363,8 @@ var API_OPERATIONS = [
3809
4363
  ...MONITOR_OPERATIONS,
3810
4364
  ...ALERT_OPERATIONS,
3811
4365
  ...INCIDENT_OPERATIONS,
4366
+ ...COVERAGE_OPERATIONS,
4367
+ ...PRIVACY_OPERATIONS,
3812
4368
  ...ACCESS_OPERATIONS,
3813
4369
  ...NODE_OPERATIONS
3814
4370
  ];
@@ -3833,6 +4389,8 @@ var APPROVAL_LIMITS = {
3833
4389
  var APPROVAL_APPROVER = {
3834
4390
  "projects.set_checkin_auth": "admin",
3835
4391
  "projects.schedule_deletion": "admin",
4392
+ "projects.set_scrub": "admin",
4393
+ "privacy.set": "admin",
3836
4394
  "project_keys.create": "member",
3837
4395
  "project_keys.rotate": "member",
3838
4396
  "project_keys.revoke": "member",
@@ -3877,14 +4435,14 @@ function approvalRequestSchema(operationId, input) {
3877
4435
  }
3878
4436
 
3879
4437
  // ../src/shared/contracts/api-ops/wire.ts
3880
- import { z as z23 } from "zod";
4438
+ import { z as z28 } from "zod";
3881
4439
  var toSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
3882
4440
  var toCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
3883
4441
  var schemaCache = new WeakMap;
3884
4442
  function inputJsonSchema(op) {
3885
4443
  let js = schemaCache.get(op.input);
3886
4444
  if (!js) {
3887
- js = z23.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
4445
+ js = z28.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
3888
4446
  schemaCache.set(op.input, js);
3889
4447
  }
3890
4448
  return js;
@@ -4098,7 +4656,7 @@ function wireInput(operationId, opts = {}) {
4098
4656
  for (const [k, v] of Object.entries(op.input.shape))
4099
4657
  if (!omit.has(k))
4100
4658
  shape[toSnake(k)] = v;
4101
- return z24.object(shape);
4659
+ return z29.object(shape);
4102
4660
  }
4103
4661
  var BUDGETS = [
4104
4662
  { stringBytes: MCP_LIMITS.untrustedStringMaxBytes, listMax: MCP_LIMITS.listMax },
@@ -4188,40 +4746,40 @@ function errorResult(o) {
4188
4746
  }
4189
4747
  };
4190
4748
  }
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())
4749
+ var TOOL_OUTPUT_SCHEMA = z29.object({
4750
+ untrusted: z29.object({
4751
+ data: z29.unknown(),
4752
+ provenance: z29.object({
4753
+ source: z29.enum(["node", "control_plane", "docs"]),
4754
+ operations: z29.array(z29.string())
4197
4755
  })
4198
4756
  }).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()
4757
+ doc: z29.object({ slug: z29.string(), locale: z29.enum(["en", "vi"]), url: z29.string(), markdown: z29.string(), truncated: z29.boolean() }).optional(),
4758
+ results: z29.array(z29.object({ slug: z29.string(), title: z29.string(), description: z29.string(), section: z29.string(), url: z29.string() })).optional(),
4759
+ next_cursor: z29.string().nullable().optional(),
4760
+ complete: z29.boolean().optional(),
4761
+ omitted: z29.array(z29.object({ part: z29.string(), reason: z29.string(), scope: z29.string().optional() })).optional(),
4762
+ truncated: z29.literal(true).optional(),
4763
+ suspicious_unicode: z29.literal(true).optional(),
4764
+ error: z29.object({
4765
+ code: z29.string(),
4766
+ status: z29.number(),
4767
+ detail: z29.string().optional(),
4768
+ scope: z29.string().optional(),
4769
+ retry_after: z29.number().optional()
4212
4770
  }).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()
4771
+ operations: z29.array(z29.record(z29.string(), z29.unknown())).optional(),
4772
+ operation: z29.record(z29.string(), z29.unknown()).optional(),
4773
+ plan: z29.record(z29.string(), z29.unknown()).optional(),
4774
+ status: z29.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
4775
+ approval: z29.object({
4776
+ approval_id: z29.string(),
4777
+ approval_url: z29.string(),
4778
+ expires_at: z29.string(),
4779
+ state: z29.enum(APPROVAL_STATES),
4780
+ result_code: z29.string().nullable().optional(),
4781
+ result: z29.record(z29.string(), z29.unknown()).optional(),
4782
+ next: z29.string().optional()
4225
4783
  }).optional()
4226
4784
  });
4227
4785
  var spec = (name) => {
@@ -4267,10 +4825,10 @@ var has = (rt, operationId) => {
4267
4825
  return !!op && rt.scopes.includes(op.scope);
4268
4826
  };
4269
4827
  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.")
4828
+ start: z29.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
4829
+ end: z29.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
4272
4830
  };
4273
- var traceIdSchema = z24.string().regex(/^[0-9a-fA-F]{32}$/);
4831
+ var traceIdSchema = z29.string().regex(/^[0-9a-fA-F]{32}$/);
4274
4832
  var MONITOR_KINDS2 = {
4275
4833
  cron: { list: "monitors.list", get: "monitors.get", idField: "monitor_id" },
4276
4834
  uptime: { list: "uptime.list", get: "uptime.get", idField: "check_id" },
@@ -4334,8 +4892,8 @@ function describe(op, scopes) {
4334
4892
  destructive: isDestructiveOperation(op)
4335
4893
  };
4336
4894
  }
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`.");
4895
+ var params = z29.record(z29.string(), z29.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
4896
+ var operationIdArg = z29.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
4339
4897
  function approvalBlock(t, next) {
4340
4898
  return {
4341
4899
  approval_id: t.approval_id,
@@ -4355,7 +4913,7 @@ var MCP_TOOL_DEFS = [
4355
4913
  title: "Workspace and node",
4356
4914
  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
4915
  operations: ["workspace.get", "node.get"],
4358
- input: z24.object({}),
4916
+ input: z29.object({}),
4359
4917
  async run(_args, rt) {
4360
4918
  const [ws, node] = await Promise.all([rt.call("workspace.get", {}), rt.call("node.get", {})]);
4361
4919
  if (!ws.ok)
@@ -4373,9 +4931,9 @@ var MCP_TOOL_DEFS = [
4373
4931
  title: "Get an issue",
4374
4932
  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
4933
  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)
4934
+ input: z29.object({
4935
+ issue_id: z29.number().int().positive().describe("Issue id from search_issues."),
4936
+ include_latest_event: z29.boolean().default(true)
4379
4937
  }),
4380
4938
  async run(args, rt) {
4381
4939
  const omitted = [];
@@ -4403,9 +4961,9 @@ var MCP_TOOL_DEFS = [
4403
4961
  title: "Get a trace",
4404
4962
  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
4963
  operations: ["traces.get", "traces.spans"],
4406
- input: z24.object({
4964
+ input: z29.object({
4407
4965
  trace_id: traceIdSchema.describe("W3C trace id, 32 hex characters."),
4408
- spans: z24.enum(["none", "errors", "all"]).default("none")
4966
+ spans: z29.enum(["none", "errors", "all"]).default("none")
4409
4967
  }),
4410
4968
  async run(args, rt) {
4411
4969
  const sum = await rt.call("traces.get", { trace_id: args["trace_id"] });
@@ -4428,16 +4986,70 @@ var MCP_TOOL_DEFS = [
4428
4986
  },
4429
4987
  single("search_spans", "spans.list", "Search spans", "OpenTelemetry spans in a time window (start and end required): filter by project, environment, service, operation, status, kind, duration or attribute filters (`attrs`, JSON list of {k, op, v}). mode=traces returns one row per trace."),
4430
4988
  single("query_logs", "logs.list", "Query logs", "OpenTelemetry logs in a time window (start and end required): filter by project, environment, service, minimum severity, trace or span id, text `q` or attribute filters. Newest first unless order=asc."),
4989
+ {
4990
+ ...spec("query_metrics"),
4991
+ title: "Query metrics",
4992
+ description: "OpenTelemetry metrics of one project. Without `name`: the metric catalog (name, type, unit, series count, last seen; `q` narrows by name) and the node's series caps. With `name` plus start and end: the metric aggregated per step — `aggregation` defaults to rate for counters, p95 for histograms and avg for gauges — optionally filtered by attributes (`attrs`, JSON list of {k, op, v}) and grouped by up to two attribute keys (`group_by`, comma-separated). Exemplar trace ids open with get_trace.",
4993
+ operations: ["metrics.names", "metrics.query"],
4994
+ input: z29.object({
4995
+ project: z29.number().int().positive().describe("Numeric project id from list_projects."),
4996
+ name: z29.string().regex(METRIC_NAME_RE).optional().describe("Metric name from the catalog, e.g. http.server.request.duration."),
4997
+ q: z29.string().max(255).optional().describe("Catalog only: part of a metric name."),
4998
+ aggregation: z29.enum(METRIC_AGGREGATIONS).optional(),
4999
+ start: isoWindow.start.optional(),
5000
+ end: isoWindow.end.optional(),
5001
+ step: z29.number().int().min(60).max(86400).multipleOf(60).optional().describe("Seconds per point (whole minutes); picked from the window when absent."),
5002
+ attrs: z29.string().max(2000).optional(),
5003
+ group_by: z29.string().max(600).optional(),
5004
+ environment: z29.string().max(2000).optional().describe("Comma-separated environments.")
5005
+ }),
5006
+ async run(args, rt) {
5007
+ const scope = { project: args["project"], ...args["environment"] ? { environment: args["environment"] } : {} };
5008
+ const name = args["name"];
5009
+ if (!name) {
5010
+ const r = await rt.call("metrics.names", { ...scope, ...args["q"] ? { q: args["q"] } : {} });
5011
+ if (!r.ok)
5012
+ return errorResult(r);
5013
+ return wrapResult({ data: r.body, operations: ["metrics.names"], source: "node" }, listExtra(r.body));
5014
+ }
5015
+ const ops = ["metrics.query"];
5016
+ let aggregation = args["aggregation"];
5017
+ if (!aggregation) {
5018
+ ops.unshift("metrics.names");
5019
+ const cat = await rt.call("metrics.names", { ...scope, q: name });
5020
+ if (!cat.ok)
5021
+ return errorResult(cat);
5022
+ const rows = cat.body?.names ?? [];
5023
+ const kind = rows.find((n) => n.name === name)?.kind;
5024
+ if (!METRIC_KINDS.includes(kind))
5025
+ return errorResult({ ok: false, status: 404, code: "NOT_FOUND", detail: "unknown_metric" });
5026
+ aggregation = defaultAggregation(kind);
5027
+ }
5028
+ const r = await rt.call("metrics.query", {
5029
+ ...scope,
5030
+ name,
5031
+ aggregation,
5032
+ start: args["start"],
5033
+ end: args["end"],
5034
+ ...args["step"] ? { step: args["step"] } : {},
5035
+ ...args["attrs"] ? { attrs: args["attrs"] } : {},
5036
+ ...args["group_by"] ? { group_by: args["group_by"] } : {}
5037
+ });
5038
+ if (!r.ok)
5039
+ return errorResult(r);
5040
+ return wrapResult({ data: r.body, operations: ops, source: "node" }, listExtra(r.body));
5041
+ }
5042
+ },
4431
5043
  {
4432
5044
  ...spec("correlate"),
4433
5045
  title: "Correlate by trace or run",
4434
5046
  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
5047
  operations: ["traces.get", "traces.spans", "spans.list", "logs.list"],
4436
- input: z24.object({
5048
+ input: z29.object({
4437
5049
  trace_id: traceIdSchema.optional(),
4438
- run_id: z24.string().min(1).max(128).optional(),
5050
+ run_id: z29.string().min(1).max(128).optional(),
4439
5051
  ...isoWindow,
4440
- project: z24.string().max(2000).optional().describe("Comma-separated project ids.")
5052
+ project: z29.string().max(2000).optional().describe("Comma-separated project ids.")
4441
5053
  }),
4442
5054
  async run(args, rt) {
4443
5055
  const trace = args["trace_id"];
@@ -4482,10 +5094,10 @@ var MCP_TOOL_DEFS = [
4482
5094
  title: "List monitors",
4483
5095
  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
5096
  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)
5097
+ input: z29.object({
5098
+ kind: z29.enum(["all", "cron", "uptime", "slo"]).default("all"),
5099
+ project_id: z29.number().int().positive().optional(),
5100
+ limit: z29.number().int().min(1).max(200).default(50)
4489
5101
  }),
4490
5102
  async run(args, rt) {
4491
5103
  const kinds = args["kind"] && args["kind"] !== "all" ? [args["kind"]] : ["cron", "uptime", "slo"];
@@ -4513,10 +5125,10 @@ var MCP_TOOL_DEFS = [
4513
5125
  title: "Get a monitor",
4514
5126
  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
5127
  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)
5128
+ input: z29.object({
5129
+ kind: z29.enum(["cron", "uptime", "slo"]),
5130
+ id: z29.guid(),
5131
+ backtest: z29.boolean().default(false)
4520
5132
  }),
4521
5133
  async run(args, rt) {
4522
5134
  const k = MONITOR_KINDS2[args["kind"]];
@@ -4566,14 +5178,15 @@ var MCP_TOOL_DEFS = [
4566
5178
  single("list_alerts", "alerts.list", "List alerts", "Alerts Belvador raised (open, resolved or all), newest first, optionally for one monitor."),
4567
5179
  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
5180
  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."),
5181
+ 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
5182
  {
4570
5183
  ...spec("verify_integration"),
4571
5184
  title: "Send a test event",
4572
5185
  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
5186
  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()
5187
+ input: z29.object({
5188
+ project_id: z29.number().int().positive(),
5189
+ idempotency_key: z29.string().min(8).max(255).optional()
4577
5190
  }),
4578
5191
  async run(args, rt) {
4579
5192
  const r = await rt.call("projects.send_test_event", { project_id: args["project_id"] }, { idempotencyKey: args["idempotency_key"] ?? rt.newKey() });
@@ -4587,9 +5200,9 @@ var MCP_TOOL_DEFS = [
4587
5200
  title: "Find a configuration change",
4588
5201
  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
5202
  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)
5203
+ input: z29.object({
5204
+ query: z29.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
5205
+ limit: z29.number().int().min(1).max(20).default(10)
4593
5206
  }),
4594
5207
  async run(args, rt) {
4595
5208
  const q = words(String(args["query"]));
@@ -4617,7 +5230,7 @@ var MCP_TOOL_DEFS = [
4617
5230
  title: "Describe a configuration change",
4618
5231
  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
5232
  operations: [],
4620
- input: z24.object({ operation_id: operationIdArg }),
5233
+ input: z29.object({ operation_id: operationIdArg }),
4621
5234
  async run(args, rt) {
4622
5235
  const op = configureOp(args["operation_id"]);
4623
5236
  if (!op || op.method === "GET")
@@ -4646,7 +5259,7 @@ var MCP_TOOL_DEFS = [
4646
5259
  title: "Check a change before applying it",
4647
5260
  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
5261
  operations: [],
4649
- input: z24.object({ operation_id: operationIdArg, params }),
5262
+ input: z29.object({ operation_id: operationIdArg, params }),
4650
5263
  async run(args, rt) {
4651
5264
  const op = configureOp(args["operation_id"]);
4652
5265
  if (!op || op.method === "GET")
@@ -4695,11 +5308,11 @@ var MCP_TOOL_DEFS = [
4695
5308
  title: "Apply a configuration change",
4696
5309
  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
5310
  operations: [],
4698
- input: z24.object({
5311
+ input: z29.object({
4699
5312
  operation_id: operationIdArg,
4700
5313
  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.")
5314
+ idempotency_key: z29.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
5315
+ if_match: z29.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
4703
5316
  }),
4704
5317
  async run(args, rt) {
4705
5318
  const op = configureOp(args["operation_id"]);
@@ -4750,7 +5363,7 @@ var MCP_TOOL_DEFS = [
4750
5363
  title: "Follow an approval",
4751
5364
  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
5365
  operations: ["approvals.get"],
4753
- input: z24.object({ approval_id: z24.guid().describe("approval_id from apply_change.") }),
5366
+ input: z29.object({ approval_id: z29.guid().describe("approval_id from apply_change.") }),
4754
5367
  async run(args, rt) {
4755
5368
  const r = await rt.call("approvals.get", { approval_id: args["approval_id"] });
4756
5369
  if (!r.ok)
@@ -4770,10 +5383,10 @@ var MCP_TOOL_DEFS = [
4770
5383
  title: "Search Belvador docs",
4771
5384
  description: "Searches the public Belvador documentation (titles and summaries) and returns the best pages with their slugs for get_doc.",
4772
5385
  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)
5386
+ input: z29.object({
5387
+ query: z29.string().min(1).max(200),
5388
+ locale: z29.enum(["en", "vi"]).default("en"),
5389
+ limit: z29.number().int().min(1).max(10).default(5)
4777
5390
  }),
4778
5391
  async run(args, rt) {
4779
5392
  const locale = args["locale"] ?? "en";
@@ -4789,9 +5402,9 @@ var MCP_TOOL_DEFS = [
4789
5402
  title: "Read a docs page",
4790
5403
  description: "The Markdown of one public Belvador docs page by slug (e.g. `quickstart`, `sdk/react`, `reference/api`).",
4791
5404
  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")
5405
+ input: z29.object({
5406
+ slug: z29.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
5407
+ locale: z29.enum(["en", "vi"]).default("en")
4795
5408
  }),
4796
5409
  async run(args, rt) {
4797
5410
  const locale = args["locale"] ?? "en";
@@ -4973,7 +5586,7 @@ function findToken(env = process.env, keychain = keychainToken) {
4973
5586
  }
4974
5587
 
4975
5588
  // packages/mcp/src/cli.ts
4976
- var PACKAGE_VERSION = "0.3.0";
5589
+ var PACKAGE_VERSION = "0.5.0";
4977
5590
  var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
4978
5591
 
4979
5592
  Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]