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