@belvador/mcp 0.2.0 → 0.3.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 +1620 -827
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -178,7 +178,7 @@ function cleanUntrustedText(raw, maxBytes = MCP_LIMITS.untrustedStringMaxBytes)
|
|
|
178
178
|
const { text, cut } = cutUtf8(escaped, maxBytes);
|
|
179
179
|
return { text, cut, suspicious };
|
|
180
180
|
}
|
|
181
|
-
var MCP_TOOLS_VERSION =
|
|
181
|
+
var MCP_TOOLS_VERSION = 3;
|
|
182
182
|
var MCP_TOOLS = [
|
|
183
183
|
{ name: "get_workspace", toolset: "investigate", scope: "org:read", readOnly: true, destructive: false, idempotent: true },
|
|
184
184
|
{ name: "list_projects", toolset: "investigate", scope: "projects:read", readOnly: true, destructive: false, idempotent: true },
|
|
@@ -210,8 +210,6 @@ var MCP_TOOLS = [
|
|
|
210
210
|
var MCP_TOOLS_PENDING = {
|
|
211
211
|
query_metrics: "P14",
|
|
212
212
|
release_health: "P15",
|
|
213
|
-
list_incidents: "P9",
|
|
214
|
-
get_incident: "P9",
|
|
215
213
|
get_coverage: "P10"
|
|
216
214
|
};
|
|
217
215
|
|
|
@@ -257,7 +255,7 @@ function docsFetcher(siteUrl, fetcher = fetch, now = () => Date.now()) {
|
|
|
257
255
|
import { CLIENT_CAPABILITIES_META_KEY, inputRequired, McpServer } from "@modelcontextprotocol/server";
|
|
258
256
|
|
|
259
257
|
// ../src/shared/contracts/mcp-tools.ts
|
|
260
|
-
import { z as
|
|
258
|
+
import { z as z24 } from "zod";
|
|
261
259
|
|
|
262
260
|
// ../src/shared/contracts/api-ops/access.ts
|
|
263
261
|
import { z as z3 } from "zod";
|
|
@@ -637,7 +635,16 @@ var UPTIME_TRIGGER = "uptime_problem";
|
|
|
637
635
|
var SLO_TRIGGER = "slo_burn";
|
|
638
636
|
var RULE_TRIGGERS = [...ALERT_TRIGGERS, INTEGRATION_TRIGGER, MONITOR_TRIGGER, UPTIME_TRIGGER, SLO_TRIGGER];
|
|
639
637
|
var SOLO_TRIGGERS = [INTEGRATION_TRIGGER, MONITOR_TRIGGER, UPTIME_TRIGGER, SLO_TRIGGER];
|
|
640
|
-
var MONITOR_RULE_KINDS = [
|
|
638
|
+
var MONITOR_RULE_KINDS = [
|
|
639
|
+
"missed",
|
|
640
|
+
"failed",
|
|
641
|
+
"timeout",
|
|
642
|
+
"unknown",
|
|
643
|
+
"count",
|
|
644
|
+
"assertion",
|
|
645
|
+
"deadline",
|
|
646
|
+
"stalled"
|
|
647
|
+
];
|
|
641
648
|
var SLO_RULE_SEVERITIES = ["page", "ticket"];
|
|
642
649
|
function validRuleTriggers(triggers) {
|
|
643
650
|
if (triggers.length === 1 && SOLO_TRIGGERS.includes(triggers[0]))
|
|
@@ -658,8 +665,9 @@ var ruleInputSchema = z4.object({
|
|
|
658
665
|
isEnabled: z4.boolean(),
|
|
659
666
|
notifyAll: z4.boolean(),
|
|
660
667
|
destinationIds: z4.array(z4.guid()).max(20),
|
|
661
|
-
monitorKinds: z4.array(z4.enum(MONITOR_RULE_KINDS)).min(1).max(
|
|
662
|
-
sloSeverities: z4.array(z4.enum(SLO_RULE_SEVERITIES)).min(1).max(2).default([...SLO_RULE_SEVERITIES])
|
|
668
|
+
monitorKinds: z4.array(z4.enum(MONITOR_RULE_KINDS)).min(1).max(MONITOR_RULE_KINDS.length).default([...MONITOR_RULE_KINDS]),
|
|
669
|
+
sloSeverities: z4.array(z4.enum(SLO_RULE_SEVERITIES)).min(1).max(2).default([...SLO_RULE_SEVERITIES]),
|
|
670
|
+
policyId: z4.guid().nullable().default(null)
|
|
663
671
|
});
|
|
664
672
|
|
|
665
673
|
// ../src/shared/contracts/api-ops/alerts.ts
|
|
@@ -676,7 +684,7 @@ var ALERT_INPUTS = {
|
|
|
676
684
|
destinationOnly: z5.object({ destinationId: uuid }),
|
|
677
685
|
createDestination: z5.object({
|
|
678
686
|
workspaceId: uuid,
|
|
679
|
-
provider: z5.enum(["telegram", "slack", "email", "webhook"]),
|
|
687
|
+
provider: z5.enum(["telegram", "slack", "email", "webhook", "pagerduty", "incident_io"]),
|
|
680
688
|
name,
|
|
681
689
|
projectIds,
|
|
682
690
|
locale
|
|
@@ -758,12 +766,14 @@ var ALERT_OPERATIONS = [
|
|
|
758
766
|
idempotency: "required",
|
|
759
767
|
status: 201,
|
|
760
768
|
mcp: "configure",
|
|
761
|
-
summary: "Start adding a Telegram, Slack, email or
|
|
769
|
+
summary: "Start adding a Telegram, Slack, email, webhook, PagerDuty or incident.io destination; a person enters its secrets.",
|
|
762
770
|
ui: [
|
|
763
771
|
"alerts#createSlackDestination",
|
|
764
772
|
"alerts#createWebhookDestination",
|
|
765
773
|
"alerts#createTelegramDestination",
|
|
766
|
-
"alerts#createEmailDestination"
|
|
774
|
+
"alerts#createEmailDestination",
|
|
775
|
+
"alerts#createPagerDutyDestination",
|
|
776
|
+
"alerts#createIncidentIoDestination"
|
|
767
777
|
]
|
|
768
778
|
}),
|
|
769
779
|
op({
|
|
@@ -852,17 +862,78 @@ var ALERT_OPERATIONS = [
|
|
|
852
862
|
})
|
|
853
863
|
];
|
|
854
864
|
|
|
855
|
-
// ../src/shared/contracts/api-ops/
|
|
856
|
-
import { z as
|
|
865
|
+
// ../src/shared/contracts/api-ops/incidents.ts
|
|
866
|
+
import { z as z10 } from "zod";
|
|
857
867
|
|
|
858
|
-
// ../src/shared/contracts/
|
|
868
|
+
// ../src/shared/contracts/notifications.ts
|
|
869
|
+
import { z as z9 } from "zod";
|
|
870
|
+
|
|
871
|
+
// ../src/shared/contracts/maintenance.ts
|
|
872
|
+
import { z as z6 } from "zod";
|
|
873
|
+
var MAINTENANCE_SCOPES = ["workspace", "project", "monitor"];
|
|
874
|
+
var MAINTENANCE_LIMITS = {
|
|
875
|
+
durationMinutesMin: 5,
|
|
876
|
+
durationMinutesMax: 1440,
|
|
877
|
+
reasonMax: 200,
|
|
878
|
+
idsMax: 50,
|
|
879
|
+
onceAheadDays: 366,
|
|
880
|
+
previewStarts: 3
|
|
881
|
+
};
|
|
882
|
+
var weekdaySchema = z6.number().int().min(1).max(7);
|
|
883
|
+
var timeOfDay = z6.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
|
|
884
|
+
var base = {
|
|
885
|
+
scope: z6.enum(MAINTENANCE_SCOPES),
|
|
886
|
+
projectIds: z6.array(z6.number().int().positive()).max(MAINTENANCE_LIMITS.idsMax),
|
|
887
|
+
monitorIds: z6.array(z6.guid()).max(MAINTENANCE_LIMITS.idsMax),
|
|
888
|
+
timezone: z6.string().trim().min(1).max(64),
|
|
889
|
+
durationMinutes: z6.number().int().min(MAINTENANCE_LIMITS.durationMinutesMin).max(MAINTENANCE_LIMITS.durationMinutesMax),
|
|
890
|
+
reason: z6.string().trim().max(MAINTENANCE_LIMITS.reasonMax).regex(/^[^\p{Cc}]*$/u)
|
|
891
|
+
};
|
|
892
|
+
var maintenanceInputSchema = z6.discriminatedUnion("kind", [
|
|
893
|
+
z6.object({ kind: z6.literal("once"), startsAt: z6.string().datetime({ offset: true }), ...base }),
|
|
894
|
+
z6.object({
|
|
895
|
+
kind: z6.literal("weekly"),
|
|
896
|
+
weekdays: z6.array(weekdaySchema).min(1).max(7),
|
|
897
|
+
startTime: timeOfDay,
|
|
898
|
+
...base
|
|
899
|
+
})
|
|
900
|
+
]).superRefine((w, ctx) => {
|
|
901
|
+
const bad = (path) => ctx.addIssue({ code: "custom", path: [path], message: "MAINTENANCE_INVALID" });
|
|
902
|
+
if (w.scope === "workspace" && (w.projectIds.length || w.monitorIds.length))
|
|
903
|
+
bad("scope");
|
|
904
|
+
if (w.scope === "project" && (!w.projectIds.length || w.monitorIds.length))
|
|
905
|
+
bad("projectIds");
|
|
906
|
+
if (w.scope === "monitor" && (!w.monitorIds.length || w.projectIds.length))
|
|
907
|
+
bad("monitorIds");
|
|
908
|
+
if (new Set(w.projectIds).size !== w.projectIds.length)
|
|
909
|
+
bad("projectIds");
|
|
910
|
+
if (new Set(w.monitorIds).size !== w.monitorIds.length)
|
|
911
|
+
bad("monitorIds");
|
|
912
|
+
if (w.kind === "weekly" && new Set(w.weekdays).size !== w.weekdays.length)
|
|
913
|
+
bad("weekdays");
|
|
914
|
+
if (!validTimeZone(w.timezone))
|
|
915
|
+
bad("timezone");
|
|
916
|
+
});
|
|
917
|
+
function validTimeZone(tz) {
|
|
918
|
+
try {
|
|
919
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
920
|
+
return true;
|
|
921
|
+
} catch {
|
|
922
|
+
return false;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
var fmtCache = new Map;
|
|
926
|
+
|
|
927
|
+
// ../src/shared/contracts/signal-monitors.ts
|
|
859
928
|
import { z as z8 } from "zod";
|
|
860
929
|
|
|
861
930
|
// ../src/shared/contracts/monitors.ts
|
|
862
|
-
import { z as
|
|
931
|
+
import { z as z7 } from "zod";
|
|
863
932
|
|
|
864
933
|
// ../src/shared/contracts/vocab/monitors.ts
|
|
865
934
|
var MONITOR_MODES = ["check_in", "heartbeat"];
|
|
935
|
+
var MONITOR_TYPES = ["job", "count", "assertion", "deadline", "progress"];
|
|
936
|
+
var SIGNAL_MONITOR_TYPES = ["count", "assertion", "deadline", "progress"];
|
|
866
937
|
|
|
867
938
|
// ../src/shared/contracts/monitors.ts
|
|
868
939
|
var MONITOR_KINDS = ["crontab", "interval", "on_demand"];
|
|
@@ -872,8 +943,13 @@ var MONITOR_INCIDENT_CODES = [
|
|
|
872
943
|
"MONITOR_MISSED",
|
|
873
944
|
"MONITOR_FAILED",
|
|
874
945
|
"MONITOR_TIMEOUT",
|
|
875
|
-
"MONITOR_UNKNOWN"
|
|
946
|
+
"MONITOR_UNKNOWN",
|
|
947
|
+
"MONITOR_COUNT",
|
|
948
|
+
"MONITOR_ASSERTION",
|
|
949
|
+
"MONITOR_DEADLINE_MISSED",
|
|
950
|
+
"MONITOR_STALLED"
|
|
876
951
|
];
|
|
952
|
+
var FAILURE_INCIDENT_CODES = MONITOR_INCIDENT_CODES.filter((c) => c !== "MONITOR_UNKNOWN");
|
|
877
953
|
var INCIDENT_EVENTS = ["opened", "updated", "resolved"];
|
|
878
954
|
var UNOBSERVABLE_REASONS = [
|
|
879
955
|
"node_offline",
|
|
@@ -924,100 +1000,112 @@ function crontabShapeOk(value) {
|
|
|
924
1000
|
const fields = value.trim().split(/\s+/);
|
|
925
1001
|
return value.length <= 120 && fields.length === 5 && fields.every((f) => /^[0-9A-Za-z*,/?#LW-]+$/.test(f));
|
|
926
1002
|
}
|
|
927
|
-
var crontabScheduleSchema =
|
|
928
|
-
type:
|
|
929
|
-
value:
|
|
1003
|
+
var crontabScheduleSchema = z7.object({
|
|
1004
|
+
type: z7.literal("crontab"),
|
|
1005
|
+
value: z7.string().refine(crontabShapeOk, "crontab")
|
|
930
1006
|
});
|
|
931
|
-
var intervalScheduleSchema =
|
|
932
|
-
type:
|
|
933
|
-
value:
|
|
934
|
-
unit:
|
|
1007
|
+
var intervalScheduleSchema = z7.object({
|
|
1008
|
+
type: z7.literal("interval"),
|
|
1009
|
+
value: z7.number().int().min(1).max(MONITOR_LIMITS.intervalValueMax),
|
|
1010
|
+
unit: z7.enum(INTERVAL_UNITS)
|
|
935
1011
|
});
|
|
936
|
-
var scheduleSchema =
|
|
1012
|
+
var scheduleSchema = z7.discriminatedUnion("type", [
|
|
937
1013
|
crontabScheduleSchema,
|
|
938
1014
|
intervalScheduleSchema
|
|
939
1015
|
]);
|
|
940
|
-
var monitorSettingsSchema =
|
|
1016
|
+
var monitorSettingsSchema = z7.object({
|
|
941
1017
|
schedule: scheduleSchema.nullable(),
|
|
942
|
-
timezone:
|
|
943
|
-
checkin_margin:
|
|
944
|
-
max_runtime:
|
|
945
|
-
failure_issue_threshold:
|
|
946
|
-
recovery_threshold:
|
|
1018
|
+
timezone: z7.string().min(1).max(64),
|
|
1019
|
+
checkin_margin: z7.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
|
|
1020
|
+
max_runtime: z7.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
|
|
1021
|
+
failure_issue_threshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
|
|
1022
|
+
recovery_threshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax)
|
|
947
1023
|
});
|
|
948
|
-
var iso =
|
|
949
|
-
var projectId2 =
|
|
950
|
-
var envName =
|
|
1024
|
+
var iso = z7.string().datetime();
|
|
1025
|
+
var projectId2 = z7.number().int().positive();
|
|
1026
|
+
var envName = z7.string().min(1).max(MONITOR_LIMITS.environmentMax);
|
|
951
1027
|
var monitorDefinitionSchema = monitorSettingsSchema.extend({
|
|
952
|
-
id:
|
|
1028
|
+
id: z7.guid(),
|
|
953
1029
|
project_id: projectId2,
|
|
954
|
-
slug:
|
|
955
|
-
kind:
|
|
956
|
-
expected_environments:
|
|
1030
|
+
slug: z7.string().regex(SLUG_RE),
|
|
1031
|
+
kind: z7.enum(MONITOR_KINDS),
|
|
1032
|
+
expected_environments: z7.array(envName).max(MONITOR_LIMITS.expectedEnvironmentsMax),
|
|
957
1033
|
paused_until: iso.nullable(),
|
|
958
1034
|
created_at: iso,
|
|
959
|
-
config_source:
|
|
960
|
-
config_hash:
|
|
1035
|
+
config_source: z7.enum(CONFIG_SOURCES),
|
|
1036
|
+
config_hash: z7.string().regex(/^[0-9a-f]{64}$/).nullable()
|
|
1037
|
+
});
|
|
1038
|
+
var outcomeCounts = z7.object({
|
|
1039
|
+
ok: z7.number().int().nonnegative(),
|
|
1040
|
+
skipped: z7.number().int().nonnegative(),
|
|
1041
|
+
error: z7.number().int().nonnegative(),
|
|
1042
|
+
timeout: z7.number().int().nonnegative(),
|
|
1043
|
+
missed: z7.number().int().nonnegative(),
|
|
1044
|
+
unknown: z7.number().int().nonnegative()
|
|
961
1045
|
});
|
|
962
|
-
var
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1046
|
+
var signalStatusSchema = z7.object({
|
|
1047
|
+
type: z7.enum(SIGNAL_MONITOR_TYPES),
|
|
1048
|
+
value: z7.number().int().nonnegative().max(1e9).nullable(),
|
|
1049
|
+
threshold: z7.number().int().nonnegative().max(1e9).nullable(),
|
|
1050
|
+
window_end: iso.nullable(),
|
|
1051
|
+
pending: z7.number().int().nonnegative().max(1e6).nullable(),
|
|
1052
|
+
stalled: z7.number().int().nonnegative().max(1e6).nullable(),
|
|
1053
|
+
refused_24h: z7.number().int().nonnegative().max(1e9).nullable()
|
|
969
1054
|
});
|
|
970
|
-
var monitorStatusSchema =
|
|
971
|
-
monitor_id:
|
|
1055
|
+
var monitorStatusSchema = z7.object({
|
|
1056
|
+
monitor_id: z7.guid(),
|
|
972
1057
|
project_id: projectId2,
|
|
973
1058
|
environment: envName,
|
|
974
|
-
open_failure:
|
|
975
|
-
open_unknown:
|
|
976
|
-
unobservable:
|
|
977
|
-
last_outcome:
|
|
1059
|
+
open_failure: z7.enum(FAILURE_INCIDENT_CODES).nullable(),
|
|
1060
|
+
open_unknown: z7.boolean(),
|
|
1061
|
+
unobservable: z7.enum(UNOBSERVABLE_REASONS).nullable(),
|
|
1062
|
+
last_outcome: z7.enum(RUN_OUTCOMES).nullable(),
|
|
978
1063
|
last_check_in_at: iso.nullable(),
|
|
979
1064
|
last_healthy_at: iso.nullable(),
|
|
980
1065
|
next_deadline_at: iso.nullable(),
|
|
981
1066
|
next_due_at: iso.nullable().optional(),
|
|
982
|
-
in_progress:
|
|
1067
|
+
in_progress: z7.boolean(),
|
|
983
1068
|
counts_24h: outcomeCounts,
|
|
1069
|
+
signal: signalStatusSchema.optional(),
|
|
984
1070
|
evaluated_at: iso
|
|
985
1071
|
});
|
|
986
|
-
var monitorIncidentSchema =
|
|
987
|
-
incident_id:
|
|
988
|
-
monitor_id:
|
|
1072
|
+
var monitorIncidentSchema = z7.object({
|
|
1073
|
+
incident_id: z7.guid(),
|
|
1074
|
+
monitor_id: z7.guid(),
|
|
989
1075
|
project_id: projectId2,
|
|
990
1076
|
environment: envName,
|
|
991
|
-
code:
|
|
992
|
-
event:
|
|
1077
|
+
code: z7.enum(MONITOR_INCIDENT_CODES),
|
|
1078
|
+
event: z7.enum(INCIDENT_EVENTS),
|
|
993
1079
|
occurred_at: iso,
|
|
994
|
-
detected_late:
|
|
995
|
-
reason:
|
|
996
|
-
duration_ms:
|
|
997
|
-
consecutive:
|
|
998
|
-
reviewed_by:
|
|
1080
|
+
detected_late: z7.boolean(),
|
|
1081
|
+
reason: z7.string().regex(REASON_RE).nullable(),
|
|
1082
|
+
duration_ms: z7.number().int().nonnegative().nullable(),
|
|
1083
|
+
consecutive: z7.number().int().min(1).max(1e5),
|
|
1084
|
+
reviewed_by: z7.guid().nullable(),
|
|
1085
|
+
observed: z7.number().int().min(0).max(1e9).nullable().optional(),
|
|
1086
|
+
threshold: z7.number().int().min(0).max(1e9).nullable().optional()
|
|
999
1087
|
});
|
|
1000
|
-
var monitorDiscoverySchema =
|
|
1088
|
+
var monitorDiscoverySchema = z7.object({
|
|
1001
1089
|
project_id: projectId2,
|
|
1002
|
-
slug:
|
|
1090
|
+
slug: z7.string().regex(SLUG_RE),
|
|
1003
1091
|
settings: monitorSettingsSchema.nullable(),
|
|
1004
|
-
config_hash:
|
|
1005
|
-
check_ins:
|
|
1092
|
+
config_hash: z7.string().regex(/^[0-9a-f]{64}$/).nullable(),
|
|
1093
|
+
check_ins: z7.number().int().nonnegative(),
|
|
1006
1094
|
last_seen_at: iso
|
|
1007
1095
|
});
|
|
1008
1096
|
var MONITOR_NAME_MAX = MONITOR_LIMITS.nameMax;
|
|
1009
|
-
var environmentName =
|
|
1010
|
-
var monitorInputSchema =
|
|
1011
|
-
name:
|
|
1012
|
-
mode:
|
|
1013
|
-
kind:
|
|
1097
|
+
var environmentName = z7.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/);
|
|
1098
|
+
var monitorInputSchema = z7.object({
|
|
1099
|
+
name: z7.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
|
|
1100
|
+
mode: z7.enum(MONITOR_MODES).default("check_in"),
|
|
1101
|
+
kind: z7.enum(MONITOR_KINDS),
|
|
1014
1102
|
schedule: scheduleSchema.nullable(),
|
|
1015
|
-
timezone:
|
|
1016
|
-
checkinMarginMin:
|
|
1017
|
-
maxRuntimeMin:
|
|
1018
|
-
failureThreshold:
|
|
1019
|
-
recoveryThreshold:
|
|
1020
|
-
expectedEnvironments:
|
|
1103
|
+
timezone: z7.string().trim().min(1).max(64),
|
|
1104
|
+
checkinMarginMin: z7.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
|
|
1105
|
+
maxRuntimeMin: z7.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
|
|
1106
|
+
failureThreshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
|
|
1107
|
+
recoveryThreshold: z7.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
|
|
1108
|
+
expectedEnvironments: z7.array(environmentName).min(1).max(MONITOR_LIMITS.expectedEnvironmentsMax)
|
|
1021
1109
|
}).refine((v) => v.kind === "on_demand" ? v.schedule === null : v.schedule?.type === v.kind, {
|
|
1022
1110
|
path: ["schedule"],
|
|
1023
1111
|
message: "schedule"
|
|
@@ -1032,98 +1120,601 @@ var MONITOR_INPUT_DEFAULTS = {
|
|
|
1032
1120
|
recoveryThreshold: MONITOR_LIMITS.recoveryThresholdDefault,
|
|
1033
1121
|
expectedEnvironments: [DEFAULT_CHECK_IN_ENVIRONMENT]
|
|
1034
1122
|
};
|
|
1035
|
-
var runOutcome =
|
|
1036
|
-
var runFlags =
|
|
1037
|
-
var monitorRunSchema =
|
|
1038
|
-
id:
|
|
1039
|
-
kind:
|
|
1123
|
+
var runOutcome = z7.enum(RUN_OUTCOMES);
|
|
1124
|
+
var runFlags = z7.array(z7.string().max(32)).max(16);
|
|
1125
|
+
var monitorRunSchema = z7.object({
|
|
1126
|
+
id: z7.number().int().positive(),
|
|
1127
|
+
kind: z7.enum(["run", "missed"]),
|
|
1040
1128
|
outcome: runOutcome,
|
|
1041
1129
|
started_at: iso,
|
|
1042
1130
|
ended_at: iso,
|
|
1043
|
-
attempts:
|
|
1044
|
-
duration_ms:
|
|
1045
|
-
reason:
|
|
1046
|
-
check_in_id:
|
|
1047
|
-
trace_id:
|
|
1048
|
-
release:
|
|
1131
|
+
attempts: z7.number().int().nonnegative(),
|
|
1132
|
+
duration_ms: z7.number().int().nonnegative().nullable(),
|
|
1133
|
+
reason: z7.string().max(64).nullable(),
|
|
1134
|
+
check_in_id: z7.string().max(64).nullable(),
|
|
1135
|
+
trace_id: z7.string().max(32).nullable(),
|
|
1136
|
+
release: z7.string().max(MONITOR_LIMITS.releaseMax).nullable(),
|
|
1049
1137
|
flags: runFlags
|
|
1050
1138
|
});
|
|
1051
|
-
var openAttemptSchema =
|
|
1052
|
-
check_in_id:
|
|
1053
|
-
run_key:
|
|
1054
|
-
attempt:
|
|
1055
|
-
state:
|
|
1139
|
+
var openAttemptSchema = z7.object({
|
|
1140
|
+
check_in_id: z7.string().max(64),
|
|
1141
|
+
run_key: z7.string().max(64),
|
|
1142
|
+
attempt: z7.number().int().nonnegative(),
|
|
1143
|
+
state: z7.string().max(16),
|
|
1056
1144
|
started_at: iso,
|
|
1057
1145
|
deadline_at: iso
|
|
1058
1146
|
});
|
|
1059
|
-
var monitorRunsResponseSchema =
|
|
1060
|
-
open:
|
|
1061
|
-
runs:
|
|
1062
|
-
next_cursor:
|
|
1147
|
+
var monitorRunsResponseSchema = z7.object({
|
|
1148
|
+
open: z7.array(openAttemptSchema).max(100),
|
|
1149
|
+
runs: z7.array(monitorRunSchema).max(MONITOR_LIMITS.runsPageSize),
|
|
1150
|
+
next_cursor: z7.string().max(32).nullable()
|
|
1063
1151
|
});
|
|
1064
|
-
var timelineRunSchema =
|
|
1065
|
-
id:
|
|
1066
|
-
kind:
|
|
1152
|
+
var timelineRunSchema = z7.object({
|
|
1153
|
+
id: z7.number().int().positive(),
|
|
1154
|
+
kind: z7.enum(["run", "missed"]),
|
|
1067
1155
|
outcome: runOutcome,
|
|
1068
1156
|
ended_at: iso,
|
|
1069
1157
|
flags: runFlags
|
|
1070
1158
|
});
|
|
1071
|
-
var monitorTimelineResponseSchema =
|
|
1072
|
-
runs:
|
|
1159
|
+
var monitorTimelineResponseSchema = z7.object({
|
|
1160
|
+
runs: z7.array(timelineRunSchema).max(MONITOR_LIMITS.timelineRuns)
|
|
1073
1161
|
});
|
|
1074
|
-
var monitorStripsResponseSchema =
|
|
1075
|
-
strips:
|
|
1076
|
-
monitor_id:
|
|
1162
|
+
var monitorStripsResponseSchema = z7.object({
|
|
1163
|
+
strips: z7.array(z7.object({
|
|
1164
|
+
monitor_id: z7.guid(),
|
|
1077
1165
|
environment: envName,
|
|
1078
|
-
runs:
|
|
1166
|
+
runs: z7.array(timelineRunSchema).max(MONITOR_LIMITS.listStripRuns)
|
|
1079
1167
|
})).max(5000)
|
|
1080
1168
|
});
|
|
1081
|
-
var monitorDiagnosticSchema =
|
|
1082
|
-
id:
|
|
1083
|
-
check_in_id:
|
|
1084
|
-
signal:
|
|
1085
|
-
exit_code:
|
|
1169
|
+
var monitorDiagnosticSchema = z7.object({
|
|
1170
|
+
id: z7.string().regex(/^\d{1,19}$/),
|
|
1171
|
+
check_in_id: z7.string().max(64).nullable(),
|
|
1172
|
+
signal: z7.string().max(16),
|
|
1173
|
+
exit_code: z7.number().int().min(0).max(255).nullable(),
|
|
1086
1174
|
received_at: iso,
|
|
1087
|
-
body:
|
|
1175
|
+
body: z7.string().max(MONITOR_LIMITS.diagnosticMaxBytes * 2)
|
|
1088
1176
|
});
|
|
1089
|
-
var monitorDiagnosticsResponseSchema =
|
|
1090
|
-
diagnostics:
|
|
1091
|
-
next_cursor:
|
|
1177
|
+
var monitorDiagnosticsResponseSchema = z7.object({
|
|
1178
|
+
diagnostics: z7.array(monitorDiagnosticSchema).max(50),
|
|
1179
|
+
next_cursor: z7.string().regex(/^\d{1,19}$/).nullable()
|
|
1092
1180
|
});
|
|
1093
|
-
var checkInDetailSchema =
|
|
1094
|
-
run_key:
|
|
1095
|
-
attempts:
|
|
1096
|
-
check_in_id:
|
|
1097
|
-
attempt:
|
|
1098
|
-
result:
|
|
1181
|
+
var checkInDetailSchema = z7.object({
|
|
1182
|
+
run_key: z7.string().max(64),
|
|
1183
|
+
attempts: z7.array(z7.object({
|
|
1184
|
+
check_in_id: z7.string().max(64),
|
|
1185
|
+
attempt: z7.number().int().nonnegative(),
|
|
1186
|
+
result: z7.string().max(16),
|
|
1099
1187
|
started_at: iso,
|
|
1100
1188
|
ended_at: iso.nullable(),
|
|
1101
|
-
duration_ms:
|
|
1102
|
-
reason:
|
|
1103
|
-
trace_id:
|
|
1104
|
-
release:
|
|
1189
|
+
duration_ms: z7.number().int().nonnegative().nullable(),
|
|
1190
|
+
reason: z7.string().max(64).nullable(),
|
|
1191
|
+
trace_id: z7.string().max(32).nullable(),
|
|
1192
|
+
release: z7.string().max(MONITOR_LIMITS.releaseMax).nullable()
|
|
1105
1193
|
})).max(1000),
|
|
1106
|
-
errors:
|
|
1107
|
-
event_id:
|
|
1108
|
-
issue_id:
|
|
1109
|
-
title:
|
|
1110
|
-
level:
|
|
1194
|
+
errors: z7.array(z7.object({
|
|
1195
|
+
event_id: z7.string().max(64),
|
|
1196
|
+
issue_id: z7.number().int().nonnegative(),
|
|
1197
|
+
title: z7.string().max(1024),
|
|
1198
|
+
level: z7.string().max(16),
|
|
1111
1199
|
timestamp: iso,
|
|
1112
|
-
same_trace:
|
|
1200
|
+
same_trace: z7.boolean()
|
|
1113
1201
|
})).max(50),
|
|
1114
|
-
diagnostics:
|
|
1202
|
+
diagnostics: z7.array(monitorDiagnosticSchema).max(20).default([])
|
|
1203
|
+
});
|
|
1204
|
+
var incidentReviewSchema = z7.object({ incident_id: z7.guid() });
|
|
1205
|
+
|
|
1206
|
+
// ../src/shared/contracts/signal-monitors.ts
|
|
1207
|
+
var isSignalMonitorType = (t) => SIGNAL_MONITOR_TYPES.includes(t);
|
|
1208
|
+
var SIGNAL_KINDS = ["event", "check_in", "span", "log"];
|
|
1209
|
+
var SELECTOR_OPS = ["eq", "ne", "lt", "le", "gt", "ge", "in", "exists", "not_exists", "prefix"];
|
|
1210
|
+
var NUMERIC_OPS = new Set(["lt", "le", "gt", "ge"]);
|
|
1211
|
+
var VALUELESS_OPS = new Set(["exists", "not_exists"]);
|
|
1212
|
+
var COMPARATORS = ["lt", "gt", "outside"];
|
|
1213
|
+
var MISSING_DATA_POLICIES = ["alert", "keep", "resolve", "treat_as_zero"];
|
|
1214
|
+
var SEVERITIES = ["critical", "high", "medium", "low"];
|
|
1215
|
+
var OCCURRENCE_STATES = [
|
|
1216
|
+
"pending",
|
|
1217
|
+
"in_progress",
|
|
1218
|
+
"success",
|
|
1219
|
+
"late_success",
|
|
1220
|
+
"missed",
|
|
1221
|
+
"failed",
|
|
1222
|
+
"cancelled"
|
|
1223
|
+
];
|
|
1224
|
+
var OCCURRENCE_OPEN = new Set(["pending", "in_progress"]);
|
|
1225
|
+
var SIGNAL_LIMITS = {
|
|
1226
|
+
matchMax: 5,
|
|
1227
|
+
assertMax: 5,
|
|
1228
|
+
inValuesMax: 20,
|
|
1229
|
+
valueMax: 256,
|
|
1230
|
+
keyMax: 128,
|
|
1231
|
+
environmentsMax: MONITOR_LIMITS.expectedEnvironmentsMax,
|
|
1232
|
+
windowMinutesMin: 1,
|
|
1233
|
+
windowMinutesMax: 1440,
|
|
1234
|
+
thresholdMax: 1e6,
|
|
1235
|
+
graceMinutesMax: 1440,
|
|
1236
|
+
progressMinutesMin: 1,
|
|
1237
|
+
progressMinutesMax: 1440,
|
|
1238
|
+
occurrenceIdMax: 128,
|
|
1239
|
+
occurrenceDueMaxDays: 35,
|
|
1240
|
+
lateSuccessDays: 7,
|
|
1241
|
+
evaluateEverySeconds: 15,
|
|
1242
|
+
settleSeconds: 20,
|
|
1243
|
+
countMaxDelayMinutes: 10,
|
|
1244
|
+
countMinutesPerTick: 60,
|
|
1245
|
+
windowsPerTick: 120,
|
|
1246
|
+
monitorsPerQuery: 50,
|
|
1247
|
+
bucketRowsPerQuery: 9000,
|
|
1248
|
+
backtestDays: 30,
|
|
1249
|
+
bucketRetentionMinutes: 2 * 1440 + 60,
|
|
1250
|
+
occurrencesKeptFinished: 1000,
|
|
1251
|
+
occurrencesPageSize: 50,
|
|
1252
|
+
runIdsPerQuery: 500,
|
|
1253
|
+
dueJudgedPerTick: 5000,
|
|
1254
|
+
queryMaxSeconds: 5
|
|
1255
|
+
};
|
|
1256
|
+
var SELECTOR_KEY_RE = /^(?:tags\.[A-Za-z0-9_.:-]{1,100}|[A-Za-z_][A-Za-z0-9_.:-]{0,127})$/;
|
|
1257
|
+
var scalar = z8.union([z8.string().max(SIGNAL_LIMITS.valueMax), z8.number().finite(), z8.boolean()]);
|
|
1258
|
+
var selectorConditionSchema = z8.object({
|
|
1259
|
+
key: z8.string().min(1).max(SIGNAL_LIMITS.keyMax).regex(SELECTOR_KEY_RE),
|
|
1260
|
+
op: z8.enum(SELECTOR_OPS),
|
|
1261
|
+
value: z8.union([scalar, z8.array(z8.string().max(SIGNAL_LIMITS.valueMax)).min(1).max(SIGNAL_LIMITS.inValuesMax)]).optional()
|
|
1262
|
+
}).superRefine((c, ctx) => {
|
|
1263
|
+
const bad = (message) => ctx.addIssue({ code: "custom", path: ["value"], message });
|
|
1264
|
+
if (VALUELESS_OPS.has(c.op)) {
|
|
1265
|
+
if (c.value !== undefined)
|
|
1266
|
+
bad("no_value");
|
|
1267
|
+
return;
|
|
1268
|
+
}
|
|
1269
|
+
if (c.value === undefined)
|
|
1270
|
+
return bad("value");
|
|
1271
|
+
if (c.op === "in") {
|
|
1272
|
+
if (!Array.isArray(c.value))
|
|
1273
|
+
bad("list");
|
|
1274
|
+
return;
|
|
1275
|
+
}
|
|
1276
|
+
if (Array.isArray(c.value))
|
|
1277
|
+
return bad("scalar");
|
|
1278
|
+
if (NUMERIC_OPS.has(c.op) && toNumber(c.value) === null)
|
|
1279
|
+
bad("number");
|
|
1280
|
+
if (c.op === "prefix" && (typeof c.value !== "string" || c.value.length === 0))
|
|
1281
|
+
bad("text");
|
|
1282
|
+
});
|
|
1283
|
+
var environmentListSchema = z8.array(z8.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/)).min(1).max(SIGNAL_LIMITS.environmentsMax).refine((v) => new Set(v).size === v.length, "unique");
|
|
1284
|
+
var selectorSchema = z8.object({
|
|
1285
|
+
signal: z8.enum(SIGNAL_KINDS),
|
|
1286
|
+
match: z8.array(selectorConditionSchema).max(SIGNAL_LIMITS.matchMax)
|
|
1287
|
+
});
|
|
1288
|
+
function toNumber(v) {
|
|
1289
|
+
if (typeof v === "number")
|
|
1290
|
+
return Number.isFinite(v) ? v : null;
|
|
1291
|
+
if (typeof v === "string" && v.trim() !== "" && v.length <= 64) {
|
|
1292
|
+
const n = Number(v);
|
|
1293
|
+
return Number.isFinite(n) ? n : null;
|
|
1294
|
+
}
|
|
1295
|
+
return null;
|
|
1296
|
+
}
|
|
1297
|
+
var minutes = (min, max) => z8.number().int().min(min).max(max);
|
|
1298
|
+
var threshold = z8.number().int().min(0).max(SIGNAL_LIMITS.thresholdMax);
|
|
1299
|
+
var recovery = z8.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax);
|
|
1300
|
+
var common = {
|
|
1301
|
+
environments: environmentListSchema,
|
|
1302
|
+
severity: z8.enum(SEVERITIES),
|
|
1303
|
+
recovery_threshold: recovery
|
|
1304
|
+
};
|
|
1305
|
+
var countSettingsSchema = z8.object({
|
|
1306
|
+
type: z8.literal("count"),
|
|
1307
|
+
selector: selectorSchema,
|
|
1308
|
+
window_minutes: minutes(SIGNAL_LIMITS.windowMinutesMin, SIGNAL_LIMITS.windowMinutesMax),
|
|
1309
|
+
comparator: z8.enum(COMPARATORS),
|
|
1310
|
+
threshold,
|
|
1311
|
+
threshold_high: threshold.nullable(),
|
|
1312
|
+
missing_data: z8.enum(MISSING_DATA_POLICIES),
|
|
1313
|
+
...common
|
|
1314
|
+
}).superRefine((s, ctx) => {
|
|
1315
|
+
if (s.comparator === "outside" && (s.threshold_high === null || s.threshold_high <= s.threshold)) {
|
|
1316
|
+
ctx.addIssue({ code: "custom", path: ["threshold_high"], message: "threshold_high" });
|
|
1317
|
+
}
|
|
1318
|
+
if (s.comparator !== "outside" && s.threshold_high !== null) {
|
|
1319
|
+
ctx.addIssue({ code: "custom", path: ["threshold_high"], message: "threshold_high" });
|
|
1320
|
+
}
|
|
1321
|
+
if (s.comparator === "lt" && s.threshold === 0) {
|
|
1322
|
+
ctx.addIssue({ code: "custom", path: ["threshold"], message: "threshold" });
|
|
1323
|
+
}
|
|
1324
|
+
});
|
|
1325
|
+
var assertionSettingsSchema = z8.object({
|
|
1326
|
+
type: z8.literal("assertion"),
|
|
1327
|
+
selector: selectorSchema,
|
|
1328
|
+
assert: z8.array(selectorConditionSchema).min(1).max(SIGNAL_LIMITS.assertMax),
|
|
1329
|
+
window_minutes: minutes(SIGNAL_LIMITS.windowMinutesMin, SIGNAL_LIMITS.windowMinutesMax),
|
|
1330
|
+
threshold: z8.number().int().min(1).max(SIGNAL_LIMITS.thresholdMax),
|
|
1331
|
+
missing_data: z8.enum(MISSING_DATA_POLICIES),
|
|
1332
|
+
...common
|
|
1333
|
+
});
|
|
1334
|
+
var deadlineSettingsSchema = z8.object({
|
|
1335
|
+
type: z8.literal("deadline"),
|
|
1336
|
+
occurrence_grace_minutes: minutes(0, SIGNAL_LIMITS.graceMinutesMax),
|
|
1337
|
+
progress_timeout_minutes: minutes(SIGNAL_LIMITS.progressMinutesMin, SIGNAL_LIMITS.progressMinutesMax).nullable(),
|
|
1338
|
+
...common
|
|
1339
|
+
});
|
|
1340
|
+
var progressSettingsSchema = z8.object({
|
|
1341
|
+
type: z8.literal("progress"),
|
|
1342
|
+
progress_timeout_minutes: minutes(SIGNAL_LIMITS.progressMinutesMin, SIGNAL_LIMITS.progressMinutesMax),
|
|
1343
|
+
...common
|
|
1344
|
+
});
|
|
1345
|
+
var signalSettingsSchema = z8.discriminatedUnion("type", [
|
|
1346
|
+
countSettingsSchema,
|
|
1347
|
+
assertionSettingsSchema,
|
|
1348
|
+
deadlineSettingsSchema,
|
|
1349
|
+
progressSettingsSchema
|
|
1350
|
+
]);
|
|
1351
|
+
function settingsFromRow(row) {
|
|
1352
|
+
if (!isSignalMonitorType(row.type) || !row.signal_settings || typeof row.signal_settings !== "object")
|
|
1353
|
+
return null;
|
|
1354
|
+
const r = signalSettingsSchema.safeParse({
|
|
1355
|
+
...row.signal_settings,
|
|
1356
|
+
type: row.type,
|
|
1357
|
+
environments: [...row.expected_environments],
|
|
1358
|
+
severity: row.severity,
|
|
1359
|
+
recovery_threshold: row.recovery_threshold
|
|
1360
|
+
});
|
|
1361
|
+
return r.success ? r.data : null;
|
|
1362
|
+
}
|
|
1363
|
+
var signalMonitorInputSchema = z8.object({
|
|
1364
|
+
name: z8.string().trim().min(1).max(MONITOR_LIMITS.nameMax),
|
|
1365
|
+
settings: signalSettingsSchema
|
|
1366
|
+
});
|
|
1367
|
+
var signalMonitorDefinitionSchema = z8.object({
|
|
1368
|
+
id: z8.guid(),
|
|
1369
|
+
project_id: z8.number().int().positive(),
|
|
1370
|
+
slug: z8.string().regex(SLUG_RE),
|
|
1371
|
+
settings: signalSettingsSchema,
|
|
1372
|
+
paused_until: z8.string().datetime().nullable(),
|
|
1373
|
+
created_at: z8.string().datetime(),
|
|
1374
|
+
revision: z8.number().int().nonnegative()
|
|
1375
|
+
});
|
|
1376
|
+
var signalLimitsConfigSchema = z8.object({
|
|
1377
|
+
pending_occurrences_per_monitor: z8.number().int().min(1).max(1e6),
|
|
1378
|
+
pending_occurrences_per_project: z8.number().int().min(1).max(1e7)
|
|
1379
|
+
});
|
|
1380
|
+
var OCCURRENCE_ID_RE = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
1381
|
+
var occurrenceInputSchema = z8.object({
|
|
1382
|
+
monitor_slug: z8.string().regex(SLUG_RE),
|
|
1383
|
+
occurrence_id: z8.string().regex(OCCURRENCE_ID_RE),
|
|
1384
|
+
due_at: z8.string().datetime({ offset: true }),
|
|
1385
|
+
environment: z8.string().trim().min(1).max(MONITOR_LIMITS.environmentMax).regex(/^[A-Za-z0-9._-]+$/).optional()
|
|
1386
|
+
});
|
|
1387
|
+
var occurrenceCancelSchema = occurrenceInputSchema.pick({ monitor_slug: true, occurrence_id: true, environment: true });
|
|
1388
|
+
var OCCURRENCE_PAST_SKEW_MS = 5 * 60000;
|
|
1389
|
+
var occurrenceRowSchema = z8.object({
|
|
1390
|
+
occurrence_id: z8.string().max(SIGNAL_LIMITS.occurrenceIdMax),
|
|
1391
|
+
environment: z8.string().max(MONITOR_LIMITS.environmentMax),
|
|
1392
|
+
state: z8.enum(OCCURRENCE_STATES),
|
|
1393
|
+
due_at: z8.string().datetime(),
|
|
1394
|
+
deadline_at: z8.string().datetime(),
|
|
1395
|
+
registered_at: z8.string().datetime(),
|
|
1396
|
+
started_at: z8.string().datetime().nullable(),
|
|
1397
|
+
last_signal_at: z8.string().datetime().nullable(),
|
|
1398
|
+
ended_at: z8.string().datetime().nullable(),
|
|
1399
|
+
stalled: z8.boolean()
|
|
1115
1400
|
});
|
|
1116
|
-
var
|
|
1401
|
+
var occurrencesResponseSchema = z8.object({
|
|
1402
|
+
occurrences: z8.array(occurrenceRowSchema).max(SIGNAL_LIMITS.occurrencesPageSize),
|
|
1403
|
+
pending: z8.number().int().nonnegative(),
|
|
1404
|
+
next_due_at: z8.string().datetime().nullable(),
|
|
1405
|
+
next_cursor: z8.string().max(64).nullable(),
|
|
1406
|
+
refused_24h: z8.number().int().nonnegative()
|
|
1407
|
+
});
|
|
1408
|
+
var signalSeriesSchema = z8.object({
|
|
1409
|
+
environment: z8.string().max(MONITOR_LIMITS.environmentMax),
|
|
1410
|
+
buckets: z8.array(z8.object({ minute: z8.string().datetime(), matched: z8.number().int().nonnegative(), violations: z8.number().int().nonnegative(), lossy: z8.boolean() })).max(1440),
|
|
1411
|
+
counted_through: z8.string().datetime().nullable()
|
|
1412
|
+
});
|
|
1413
|
+
var signalResponseSchema = z8.object({
|
|
1414
|
+
series: z8.array(signalSeriesSchema).max(SIGNAL_LIMITS.environmentsMax),
|
|
1415
|
+
runs: z8.array(z8.object({
|
|
1416
|
+
run_id: z8.string().max(SIGNAL_LIMITS.occurrenceIdMax),
|
|
1417
|
+
environment: z8.string().max(MONITOR_LIMITS.environmentMax),
|
|
1418
|
+
started_at: z8.string().datetime(),
|
|
1419
|
+
last_signal_at: z8.string().datetime(),
|
|
1420
|
+
stalled: z8.boolean()
|
|
1421
|
+
})).max(SIGNAL_LIMITS.occurrencesPageSize)
|
|
1422
|
+
});
|
|
1423
|
+
var backtestSettingsSchema = z8.union([countSettingsSchema, assertionSettingsSchema]);
|
|
1424
|
+
var backtestResponseSchema = z8.object({
|
|
1425
|
+
alerts: z8.number().int().nonnegative(),
|
|
1426
|
+
windows: z8.number().int().nonnegative(),
|
|
1427
|
+
violated_windows: z8.number().int().nonnegative(),
|
|
1428
|
+
first_at: z8.string().datetime().nullable(),
|
|
1429
|
+
last_at: z8.string().datetime().nullable(),
|
|
1430
|
+
days: z8.number().nonnegative(),
|
|
1431
|
+
matched_total: z8.number().int().nonnegative(),
|
|
1432
|
+
violations_total: z8.number().int().nonnegative()
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
// ../src/shared/contracts/notifications.ts
|
|
1436
|
+
var NOTIFY_LIMITS = {
|
|
1437
|
+
policiesMax: 20,
|
|
1438
|
+
nameMax: 80,
|
|
1439
|
+
chainMax: 5,
|
|
1440
|
+
escalateMinutesMin: 5,
|
|
1441
|
+
escalateMinutesMax: 240,
|
|
1442
|
+
digestRowsMax: 50,
|
|
1443
|
+
slotSearchDays: 8
|
|
1444
|
+
};
|
|
1445
|
+
var HOLDABLE_SEVERITIES = ["medium", "low"];
|
|
1446
|
+
var DIGEST_MODES = ["off", "hourly", "daily"];
|
|
1447
|
+
var timeOfDay2 = z9.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/);
|
|
1448
|
+
var unique = (xs) => new Set(xs).size === xs.length;
|
|
1449
|
+
var quietHoursSchema = z9.object({
|
|
1450
|
+
days: z9.array(weekdaySchema).min(1).max(7).refine(unique),
|
|
1451
|
+
start: timeOfDay2,
|
|
1452
|
+
end: timeOfDay2
|
|
1453
|
+
}).refine((q) => q.start !== q.end, { path: ["end"] });
|
|
1454
|
+
var policyInputSchema = z9.object({
|
|
1455
|
+
name: z9.string().trim().min(1).max(NOTIFY_LIMITS.nameMax).regex(/^[^\p{Cc}]*$/u),
|
|
1456
|
+
timezone: z9.string().trim().min(1).max(64).refine(validTimeZone),
|
|
1457
|
+
quietHours: quietHoursSchema.nullable(),
|
|
1458
|
+
quietSeverities: z9.array(z9.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
|
|
1459
|
+
digest: z9.enum(DIGEST_MODES),
|
|
1460
|
+
digestAt: timeOfDay2.nullable(),
|
|
1461
|
+
digestSeverities: z9.array(z9.enum(HOLDABLE_SEVERITIES)).max(2).refine(unique),
|
|
1462
|
+
fallback: z9.array(z9.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique),
|
|
1463
|
+
escalateAfterMinutes: z9.number().int().min(NOTIFY_LIMITS.escalateMinutesMin).max(NOTIFY_LIMITS.escalateMinutesMax).nullable(),
|
|
1464
|
+
escalation: z9.array(z9.guid()).max(NOTIFY_LIMITS.chainMax).refine(unique)
|
|
1465
|
+
}).superRefine((p, ctx) => {
|
|
1466
|
+
if (p.digest === "daily" !== (p.digestAt !== null))
|
|
1467
|
+
ctx.addIssue({ code: "custom", path: ["digestAt"], message: "digest_at" });
|
|
1468
|
+
if (p.escalateAfterMinutes !== null !== p.escalation.length > 0)
|
|
1469
|
+
ctx.addIssue({ code: "custom", path: ["escalation"], message: "escalation" });
|
|
1470
|
+
});
|
|
1471
|
+
var MIN = 60000;
|
|
1472
|
+
var HOUR = 60 * MIN;
|
|
1473
|
+
var DAY = 24 * HOUR;
|
|
1474
|
+
|
|
1475
|
+
// ../src/shared/contracts/api-ops/incidents.ts
|
|
1476
|
+
var incidentOnly = z10.object({ workspaceId: uuid, incidentId: uuid });
|
|
1477
|
+
var note = z10.string().trim().min(1).max(2000).regex(/^[^\u0000-\u0008\u000b\u000c\u000e-\u001f]*$/);
|
|
1478
|
+
var INCIDENT_KINDS = ["monitor", "uptime", "slo", "issue"];
|
|
1479
|
+
var INCIDENT_GROUP_BY = ["monitor", "project_env"];
|
|
1480
|
+
var incidentRuleInputSchema = z10.object({
|
|
1481
|
+
name: z10.string().trim().min(1).max(80).regex(/^[^\p{Cc}]*$/u),
|
|
1482
|
+
isEnabled: z10.boolean(),
|
|
1483
|
+
position: z10.number().int().min(0).max(1000).default(0),
|
|
1484
|
+
projectIds: z10.array(z10.number().int().positive()).max(50),
|
|
1485
|
+
environments: z10.array(z10.string().trim().min(1).max(64)).max(20),
|
|
1486
|
+
kinds: z10.array(z10.enum(INCIDENT_KINDS)).min(1).max(4),
|
|
1487
|
+
minSeverity: z10.enum(SEVERITIES),
|
|
1488
|
+
groupBy: z10.enum(INCIDENT_GROUP_BY),
|
|
1489
|
+
windowMinutes: z10.number().int().min(5).max(240),
|
|
1490
|
+
recoveryHoldMinutes: z10.number().int().min(0).max(1440)
|
|
1491
|
+
});
|
|
1492
|
+
var INCIDENT_INPUTS = {
|
|
1493
|
+
list: z10.object({
|
|
1494
|
+
workspaceId: uuid,
|
|
1495
|
+
limit: pageLimit,
|
|
1496
|
+
cursor,
|
|
1497
|
+
state: z10.enum(["active", "resolved", "all"]).default("all")
|
|
1498
|
+
}),
|
|
1499
|
+
incidentOnly,
|
|
1500
|
+
resolve: incidentOnly.extend({ note: note.max(500) }),
|
|
1501
|
+
note: incidentOnly.extend({ note }),
|
|
1502
|
+
update: incidentOnly.extend({
|
|
1503
|
+
title: z10.string().trim().min(1).max(120).regex(/^[^\p{Cc}]*$/u).optional(),
|
|
1504
|
+
ownerUserId: uuid.nullable().optional()
|
|
1505
|
+
}),
|
|
1506
|
+
workspace: z10.object({ workspaceId: uuid }),
|
|
1507
|
+
saveRule: z10.object({ workspaceId: uuid, ruleId: uuid.nullable(), input: incidentRuleInputSchema }),
|
|
1508
|
+
ruleOnly: z10.object({ workspaceId: uuid, ruleId: uuid }),
|
|
1509
|
+
savePolicy: z10.object({
|
|
1510
|
+
workspaceId: uuid,
|
|
1511
|
+
policyId: uuid.nullable(),
|
|
1512
|
+
isDefault: z10.boolean(),
|
|
1513
|
+
input: policyInputSchema
|
|
1514
|
+
}),
|
|
1515
|
+
policyOnly: z10.object({ workspaceId: uuid, policyId: uuid })
|
|
1516
|
+
};
|
|
1517
|
+
var I = INCIDENT_INPUTS;
|
|
1518
|
+
var w = "incidents:write";
|
|
1519
|
+
var INCIDENT_OPERATIONS = [
|
|
1520
|
+
op({
|
|
1521
|
+
id: "incidents.list",
|
|
1522
|
+
method: "GET",
|
|
1523
|
+
path: "/v1/incidents",
|
|
1524
|
+
scope: "incidents:read",
|
|
1525
|
+
sensitivity: "normal",
|
|
1526
|
+
kind: "read",
|
|
1527
|
+
rpcs: ["api_read_incidents"],
|
|
1528
|
+
input: I.list,
|
|
1529
|
+
workspace: true,
|
|
1530
|
+
idempotency: "none",
|
|
1531
|
+
paged: true,
|
|
1532
|
+
mcp: "reliability",
|
|
1533
|
+
summary: "Incidents (INC-n): state, severity and peak, owner, linked alert count; newest first.",
|
|
1534
|
+
ui: []
|
|
1535
|
+
}),
|
|
1536
|
+
op({
|
|
1537
|
+
id: "incidents.get",
|
|
1538
|
+
method: "GET",
|
|
1539
|
+
path: "/v1/incidents/{incident_id}",
|
|
1540
|
+
scope: "incidents:read",
|
|
1541
|
+
sensitivity: "normal",
|
|
1542
|
+
kind: "read",
|
|
1543
|
+
rpcs: ["api_read_incident"],
|
|
1544
|
+
input: I.incidentOnly,
|
|
1545
|
+
workspace: true,
|
|
1546
|
+
idempotency: "none",
|
|
1547
|
+
mcp: "reliability",
|
|
1548
|
+
summary: "One incident with its linked alerts, timeline (notes included) and message deliveries (`accepted` = the provider took it; only a person acknowledges).",
|
|
1549
|
+
ui: []
|
|
1550
|
+
}),
|
|
1551
|
+
op({
|
|
1552
|
+
id: "incidents.acknowledge",
|
|
1553
|
+
method: "POST",
|
|
1554
|
+
path: "/v1/incidents/{incident_id}/ack",
|
|
1555
|
+
scope: w,
|
|
1556
|
+
sensitivity: "normal",
|
|
1557
|
+
kind: "write",
|
|
1558
|
+
rpcs: ["acknowledge_incident"],
|
|
1559
|
+
input: I.incidentOnly,
|
|
1560
|
+
workspace: true,
|
|
1561
|
+
idempotency: "optional",
|
|
1562
|
+
mcp: "configure",
|
|
1563
|
+
summary: "Take ownership of an open incident; stops its escalation. Members and up.",
|
|
1564
|
+
ui: ["incidents#acknowledgeIncident"]
|
|
1565
|
+
}),
|
|
1566
|
+
op({
|
|
1567
|
+
id: "incidents.resolve",
|
|
1568
|
+
method: "POST",
|
|
1569
|
+
path: "/v1/incidents/{incident_id}/resolve",
|
|
1570
|
+
scope: w,
|
|
1571
|
+
sensitivity: "normal",
|
|
1572
|
+
kind: "write",
|
|
1573
|
+
rpcs: ["resolve_incident"],
|
|
1574
|
+
input: I.resolve,
|
|
1575
|
+
workspace: true,
|
|
1576
|
+
idempotency: "optional",
|
|
1577
|
+
mcp: "configure",
|
|
1578
|
+
summary: 'Close an incident by hand with a reason (1–500 characters); it is labelled "not verified".',
|
|
1579
|
+
ui: ["incidents#resolveIncident"]
|
|
1580
|
+
}),
|
|
1581
|
+
op({
|
|
1582
|
+
id: "incidents.note",
|
|
1583
|
+
method: "POST",
|
|
1584
|
+
path: "/v1/incidents/{incident_id}/notes",
|
|
1585
|
+
scope: w,
|
|
1586
|
+
sensitivity: "normal",
|
|
1587
|
+
kind: "write",
|
|
1588
|
+
rpcs: ["add_incident_note"],
|
|
1589
|
+
input: I.note,
|
|
1590
|
+
workspace: true,
|
|
1591
|
+
idempotency: "optional",
|
|
1592
|
+
mcp: "configure",
|
|
1593
|
+
summary: "Add a note to the incident timeline (plain text, ≤ 2,000 characters).",
|
|
1594
|
+
ui: ["incidents#addIncidentNote"]
|
|
1595
|
+
}),
|
|
1596
|
+
op({
|
|
1597
|
+
id: "incidents.update",
|
|
1598
|
+
method: "PATCH",
|
|
1599
|
+
path: "/v1/incidents/{incident_id}",
|
|
1600
|
+
scope: w,
|
|
1601
|
+
sensitivity: "normal",
|
|
1602
|
+
kind: "write",
|
|
1603
|
+
rpcs: ["update_incident"],
|
|
1604
|
+
input: I.update,
|
|
1605
|
+
workspace: true,
|
|
1606
|
+
idempotency: "none",
|
|
1607
|
+
mcp: "configure",
|
|
1608
|
+
summary: "Rename an incident or assign it to a member (`owner_user_id: null` clears it).",
|
|
1609
|
+
ui: ["incidents#updateIncident"]
|
|
1610
|
+
}),
|
|
1611
|
+
op({
|
|
1612
|
+
id: "incident_rules.list",
|
|
1613
|
+
method: "GET",
|
|
1614
|
+
path: "/v1/incident-rules",
|
|
1615
|
+
scope: "alerts:read",
|
|
1616
|
+
sensitivity: "normal",
|
|
1617
|
+
kind: "read",
|
|
1618
|
+
rpcs: ["api_read_incident_rules"],
|
|
1619
|
+
input: I.workspace,
|
|
1620
|
+
workspace: true,
|
|
1621
|
+
idempotency: "none",
|
|
1622
|
+
mcp: "investigate",
|
|
1623
|
+
summary: "Rules that turn alerts into incidents: match, grouping, window and recovery wait.",
|
|
1624
|
+
ui: []
|
|
1625
|
+
}),
|
|
1626
|
+
op({
|
|
1627
|
+
id: "incident_rules.save",
|
|
1628
|
+
method: "POST",
|
|
1629
|
+
path: "/v1/incident-rules",
|
|
1630
|
+
scope: "alerts:write",
|
|
1631
|
+
sensitivity: "normal",
|
|
1632
|
+
kind: "write",
|
|
1633
|
+
rpcs: ["save_incident_rule"],
|
|
1634
|
+
input: I.saveRule,
|
|
1635
|
+
workspace: true,
|
|
1636
|
+
idempotency: "optional",
|
|
1637
|
+
mcp: "configure",
|
|
1638
|
+
summary: "Create (`rule_id` null) or replace an incident rule. Admins.",
|
|
1639
|
+
ui: ["incidents#saveIncidentRule"]
|
|
1640
|
+
}),
|
|
1641
|
+
op({
|
|
1642
|
+
id: "incident_rules.delete",
|
|
1643
|
+
method: "DELETE",
|
|
1644
|
+
path: "/v1/incident-rules/{rule_id}",
|
|
1645
|
+
scope: "alerts:write",
|
|
1646
|
+
sensitivity: "normal",
|
|
1647
|
+
kind: "write",
|
|
1648
|
+
rpcs: ["delete_incident_rule"],
|
|
1649
|
+
input: I.ruleOnly,
|
|
1650
|
+
workspace: true,
|
|
1651
|
+
idempotency: "none",
|
|
1652
|
+
mcp: "configure",
|
|
1653
|
+
summary: "Delete an incident rule; open incidents stay as they are.",
|
|
1654
|
+
ui: ["incidents#deleteIncidentRule"]
|
|
1655
|
+
}),
|
|
1656
|
+
op({
|
|
1657
|
+
id: "notification_policies.list",
|
|
1658
|
+
method: "GET",
|
|
1659
|
+
path: "/v1/notification-policies",
|
|
1660
|
+
scope: "alerts:read",
|
|
1661
|
+
sensitivity: "normal",
|
|
1662
|
+
kind: "read",
|
|
1663
|
+
rpcs: ["api_read_notification_policies"],
|
|
1664
|
+
input: I.workspace,
|
|
1665
|
+
workspace: true,
|
|
1666
|
+
idempotency: "none",
|
|
1667
|
+
mcp: "investigate",
|
|
1668
|
+
summary: "Notification policies: quiet hours, digest, fallback chain and escalation.",
|
|
1669
|
+
ui: []
|
|
1670
|
+
}),
|
|
1671
|
+
op({
|
|
1672
|
+
id: "notification_policies.save",
|
|
1673
|
+
method: "POST",
|
|
1674
|
+
path: "/v1/notification-policies",
|
|
1675
|
+
scope: "alerts:write",
|
|
1676
|
+
sensitivity: "normal",
|
|
1677
|
+
kind: "write",
|
|
1678
|
+
rpcs: ["save_notification_policy"],
|
|
1679
|
+
input: I.savePolicy,
|
|
1680
|
+
workspace: true,
|
|
1681
|
+
idempotency: "optional",
|
|
1682
|
+
mcp: "configure",
|
|
1683
|
+
summary: "Create (`policy_id` null) or replace a policy. Critical and high are never held; chains use existing destinations only. Admins.",
|
|
1684
|
+
ui: ["incidents#saveNotificationPolicy"]
|
|
1685
|
+
}),
|
|
1686
|
+
op({
|
|
1687
|
+
id: "notification_policies.delete",
|
|
1688
|
+
method: "DELETE",
|
|
1689
|
+
path: "/v1/notification-policies/{policy_id}",
|
|
1690
|
+
scope: "alerts:write",
|
|
1691
|
+
sensitivity: "normal",
|
|
1692
|
+
kind: "write",
|
|
1693
|
+
rpcs: ["delete_notification_policy"],
|
|
1694
|
+
input: I.policyOnly,
|
|
1695
|
+
workspace: true,
|
|
1696
|
+
idempotency: "none",
|
|
1697
|
+
mcp: "configure",
|
|
1698
|
+
summary: "Delete a policy (not the default); its rules fall back to the default policy.",
|
|
1699
|
+
ui: ["incidents#deleteNotificationPolicy"]
|
|
1700
|
+
})
|
|
1701
|
+
];
|
|
1702
|
+
|
|
1703
|
+
// ../src/shared/contracts/api-ops/monitors.ts
|
|
1704
|
+
import { z as z15 } from "zod";
|
|
1705
|
+
|
|
1706
|
+
// ../src/shared/contracts/heartbeat.ts
|
|
1707
|
+
import { z as z12 } from "zod";
|
|
1117
1708
|
|
|
1118
1709
|
// ../src/shared/contracts/signed-message.ts
|
|
1119
|
-
import { z as
|
|
1120
|
-
var nodeIdSchema =
|
|
1121
|
-
var signedEnvelopeSchema =
|
|
1710
|
+
import { z as z11 } from "zod";
|
|
1711
|
+
var nodeIdSchema = z11.guid();
|
|
1712
|
+
var signedEnvelopeSchema = z11.object({
|
|
1122
1713
|
node_id: nodeIdSchema,
|
|
1123
|
-
ts:
|
|
1124
|
-
nonce:
|
|
1125
|
-
payload:
|
|
1126
|
-
sig:
|
|
1714
|
+
ts: z11.number().int().positive(),
|
|
1715
|
+
nonce: z11.string().regex(/^[A-Za-z0-9_-]{16,64}$/),
|
|
1716
|
+
payload: z11.record(z11.string(), z11.unknown()),
|
|
1717
|
+
sig: z11.string().regex(/^[A-Za-z0-9_-]{86}$/)
|
|
1127
1718
|
});
|
|
1128
1719
|
|
|
1129
1720
|
// ../src/shared/contracts/heartbeat.ts
|
|
@@ -1161,78 +1752,78 @@ var HEARTBEAT_LIMITS = {
|
|
|
1161
1752
|
diagnosticsPerRun: 5
|
|
1162
1753
|
};
|
|
1163
1754
|
var PAUSED_FOREVER_MS = Date.parse("9999-12-31T00:00:00.000Z");
|
|
1164
|
-
var uuid2 =
|
|
1165
|
-
var ms =
|
|
1166
|
-
var hex64 =
|
|
1167
|
-
var envName2 =
|
|
1168
|
-
var heartbeatMonitorConfigSchema =
|
|
1755
|
+
var uuid2 = z12.guid();
|
|
1756
|
+
var ms = z12.number().int().nonnegative();
|
|
1757
|
+
var hex64 = z12.string().regex(/^[0-9a-f]{64}$/);
|
|
1758
|
+
var envName2 = z12.string().min(1).max(MONITOR_LIMITS.environmentMax);
|
|
1759
|
+
var heartbeatMonitorConfigSchema = z12.object({
|
|
1169
1760
|
id: uuid2,
|
|
1170
|
-
project_id:
|
|
1171
|
-
slug:
|
|
1761
|
+
project_id: z12.number().int().positive(),
|
|
1762
|
+
slug: z12.string().regex(SLUG_RE),
|
|
1172
1763
|
environment: envName2,
|
|
1173
1764
|
schedule: scheduleSchema,
|
|
1174
|
-
timezone:
|
|
1175
|
-
grace_min:
|
|
1176
|
-
max_runtime_min:
|
|
1177
|
-
failure_threshold:
|
|
1178
|
-
recovery_threshold:
|
|
1765
|
+
timezone: z12.string().min(1).max(64),
|
|
1766
|
+
grace_min: z12.number().int().min(MONITOR_LIMITS.checkinMarginMin).max(MONITOR_LIMITS.checkinMarginMax),
|
|
1767
|
+
max_runtime_min: z12.number().int().min(MONITOR_LIMITS.maxRuntimeMin).max(MONITOR_LIMITS.maxRuntimeMax),
|
|
1768
|
+
failure_threshold: z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
|
|
1769
|
+
recovery_threshold: z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax),
|
|
1179
1770
|
paused_until: ms.nullable(),
|
|
1180
1771
|
created_at: ms
|
|
1181
1772
|
});
|
|
1182
|
-
var heartbeatTokenConfigSchema =
|
|
1773
|
+
var heartbeatTokenConfigSchema = z12.object({
|
|
1183
1774
|
id: uuid2,
|
|
1184
1775
|
monitor_id: uuid2,
|
|
1185
1776
|
hash: hex64,
|
|
1186
1777
|
expires_at: ms.nullable()
|
|
1187
1778
|
});
|
|
1188
|
-
var heartbeatSyncSchema =
|
|
1189
|
-
v:
|
|
1779
|
+
var heartbeatSyncSchema = z12.object({
|
|
1780
|
+
v: z12.literal(1),
|
|
1190
1781
|
workspace_id: uuid2,
|
|
1191
|
-
route:
|
|
1192
|
-
revision:
|
|
1193
|
-
workspace_status:
|
|
1194
|
-
ingest_kill:
|
|
1195
|
-
limits:
|
|
1196
|
-
check_in_rate_per_sec:
|
|
1197
|
-
check_in_burst:
|
|
1198
|
-
monthly_check_in_cap:
|
|
1199
|
-
}),
|
|
1200
|
-
projects:
|
|
1201
|
-
monitors:
|
|
1202
|
-
tokens:
|
|
1782
|
+
route: z12.string().regex(PING_ROUTE_RE),
|
|
1783
|
+
revision: z12.number().int().positive(),
|
|
1784
|
+
workspace_status: z12.enum(["active", "suspended", "deleting"]),
|
|
1785
|
+
ingest_kill: z12.boolean(),
|
|
1786
|
+
limits: z12.object({
|
|
1787
|
+
check_in_rate_per_sec: z12.number().int().positive(),
|
|
1788
|
+
check_in_burst: z12.number().int().positive(),
|
|
1789
|
+
monthly_check_in_cap: z12.number().int().positive()
|
|
1790
|
+
}),
|
|
1791
|
+
projects: z12.array(z12.object({ id: z12.number().int().positive(), node_id: nodeIdSchema.nullable() })).max(1000),
|
|
1792
|
+
monitors: z12.array(heartbeatMonitorConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace),
|
|
1793
|
+
tokens: z12.array(heartbeatTokenConfigSchema).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
|
|
1203
1794
|
});
|
|
1204
|
-
var signedHeartbeatSyncSchema =
|
|
1205
|
-
body:
|
|
1206
|
-
ts:
|
|
1207
|
-
kid:
|
|
1208
|
-
sig:
|
|
1795
|
+
var signedHeartbeatSyncSchema = z12.object({
|
|
1796
|
+
body: z12.string().min(2).max(4 * 1024 * 1024),
|
|
1797
|
+
ts: z12.number().int().positive(),
|
|
1798
|
+
kid: z12.string().regex(/^[A-Za-z0-9_-]{1,40}$/),
|
|
1799
|
+
sig: z12.string().regex(/^[A-Za-z0-9_-]{86}$/)
|
|
1209
1800
|
});
|
|
1210
|
-
var heartbeatHourSchema =
|
|
1801
|
+
var heartbeatHourSchema = z12.object({
|
|
1211
1802
|
monitor_id: uuid2,
|
|
1212
|
-
hour:
|
|
1213
|
-
ok:
|
|
1214
|
-
failed:
|
|
1215
|
-
started:
|
|
1216
|
-
missed:
|
|
1217
|
-
logs:
|
|
1803
|
+
hour: z12.string().datetime(),
|
|
1804
|
+
ok: z12.number().int().nonnegative(),
|
|
1805
|
+
failed: z12.number().int().nonnegative(),
|
|
1806
|
+
started: z12.number().int().nonnegative(),
|
|
1807
|
+
missed: z12.number().int().nonnegative(),
|
|
1808
|
+
logs: z12.number().int().nonnegative()
|
|
1218
1809
|
});
|
|
1219
|
-
var heartbeatReportSchema =
|
|
1220
|
-
v:
|
|
1810
|
+
var heartbeatReportSchema = z12.object({
|
|
1811
|
+
v: z12.literal(1),
|
|
1221
1812
|
workspace_id: uuid2,
|
|
1222
|
-
route:
|
|
1223
|
-
revision:
|
|
1224
|
-
sent_at:
|
|
1225
|
-
incidents:
|
|
1226
|
-
statuses:
|
|
1227
|
-
hours:
|
|
1228
|
-
token_uses:
|
|
1813
|
+
route: z12.string().regex(PING_ROUTE_RE),
|
|
1814
|
+
revision: z12.number().int().nonnegative(),
|
|
1815
|
+
sent_at: z12.string().datetime(),
|
|
1816
|
+
incidents: z12.array(monitorIncidentSchema).max(HEARTBEAT_LIMITS.reportMaxIncidents),
|
|
1817
|
+
statuses: z12.array(monitorStatusSchema).max(HEARTBEAT_LIMITS.reportMaxStatuses),
|
|
1818
|
+
hours: z12.array(heartbeatHourSchema).max(HEARTBEAT_LIMITS.reportMaxHours),
|
|
1819
|
+
token_uses: z12.array(z12.object({ token_id: uuid2, last_used_at: z12.string().datetime() })).max(HEARTBEAT_LIMITS.maxMonitorsPerWorkspace * 2)
|
|
1229
1820
|
});
|
|
1230
1821
|
var ENCODER = new TextEncoder;
|
|
1231
1822
|
var UTF8 = new TextDecoder("utf-8", { fatal: false, ignoreBOM: false });
|
|
1232
1823
|
var TOKEN_IN_TEXT = new RegExp(PING_TOKEN_PATTERN, "g");
|
|
1233
1824
|
|
|
1234
1825
|
// ../src/shared/contracts/slo.ts
|
|
1235
|
-
import { z as
|
|
1826
|
+
import { z as z13 } from "zod";
|
|
1236
1827
|
|
|
1237
1828
|
// ../src/shared/contracts/vocab/slo.ts
|
|
1238
1829
|
var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans"];
|
|
@@ -1264,17 +1855,17 @@ var SLO_SOURCE_META = {
|
|
|
1264
1855
|
heartbeat: { provenance: "ping_token", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
|
|
1265
1856
|
spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" }
|
|
1266
1857
|
};
|
|
1267
|
-
var nodeSloSchema =
|
|
1268
|
-
slo_id:
|
|
1269
|
-
project_id:
|
|
1270
|
-
source:
|
|
1271
|
-
sli:
|
|
1272
|
-
monitor_id:
|
|
1273
|
-
environment:
|
|
1274
|
-
service:
|
|
1275
|
-
operation:
|
|
1276
|
-
latency_threshold_ms:
|
|
1277
|
-
public_sources:
|
|
1858
|
+
var nodeSloSchema = z13.object({
|
|
1859
|
+
slo_id: z13.guid(),
|
|
1860
|
+
project_id: z13.number().int().positive(),
|
|
1861
|
+
source: z13.enum(["monitor", "spans"]),
|
|
1862
|
+
sli: z13.enum(SLO_SLIS),
|
|
1863
|
+
monitor_id: z13.guid().optional(),
|
|
1864
|
+
environment: z13.string().min(1).max(SLO_LIMITS.environmentMaxChars).optional(),
|
|
1865
|
+
service: z13.string().min(1).max(128).optional(),
|
|
1866
|
+
operation: z13.string().min(1).max(256).optional(),
|
|
1867
|
+
latency_threshold_ms: z13.number().int().min(1).max(60000).optional(),
|
|
1868
|
+
public_sources: z13.boolean()
|
|
1278
1869
|
}).superRefine((v, ctx) => {
|
|
1279
1870
|
if (v.source === "monitor" && (!v.monitor_id || v.sli !== "availability"))
|
|
1280
1871
|
ctx.addIssue({ code: "custom", path: ["monitor_id"], message: "INVALID_INPUT" });
|
|
@@ -1283,27 +1874,27 @@ var nodeSloSchema = z9.object({
|
|
|
1283
1874
|
if (v.sli === "latency" !== (v.latency_threshold_ms !== undefined))
|
|
1284
1875
|
ctx.addIssue({ code: "custom", path: ["latency_threshold_ms"], message: "INVALID_INPUT" });
|
|
1285
1876
|
});
|
|
1286
|
-
var sliCountsSchema =
|
|
1287
|
-
minute:
|
|
1288
|
-
items:
|
|
1877
|
+
var sliCountsSchema = z13.object({
|
|
1878
|
+
minute: z13.string().datetime(),
|
|
1879
|
+
items: z13.array(z13.object({ slo_id: z13.guid(), good: z13.number().int().min(0), total: z13.number().int().min(0) }).refine((x) => x.good <= x.total, { message: "INVALID_INPUT" })).max(SLO_LIMITS.sliItemsPerMessage)
|
|
1289
1880
|
});
|
|
1290
|
-
var sloInputSchema =
|
|
1291
|
-
name:
|
|
1292
|
-
description:
|
|
1293
|
-
source:
|
|
1294
|
-
sourceRef:
|
|
1295
|
-
id:
|
|
1296
|
-
projectId:
|
|
1297
|
-
service:
|
|
1298
|
-
operation:
|
|
1299
|
-
environment:
|
|
1300
|
-
}),
|
|
1301
|
-
sli:
|
|
1302
|
-
latencyThresholdMs:
|
|
1303
|
-
objective:
|
|
1304
|
-
windowDays:
|
|
1305
|
-
alertPolicy:
|
|
1306
|
-
allowPublicSources:
|
|
1881
|
+
var sloInputSchema = z13.object({
|
|
1882
|
+
name: z13.string().trim().min(1).max(SLO_LIMITS.nameMaxChars),
|
|
1883
|
+
description: z13.string().max(SLO_LIMITS.descriptionMaxChars).default(""),
|
|
1884
|
+
source: z13.enum(SLO_SOURCES),
|
|
1885
|
+
sourceRef: z13.object({
|
|
1886
|
+
id: z13.guid().optional(),
|
|
1887
|
+
projectId: z13.number().int().positive().optional(),
|
|
1888
|
+
service: z13.string().max(128).optional(),
|
|
1889
|
+
operation: z13.string().max(256).optional(),
|
|
1890
|
+
environment: z13.string().max(SLO_LIMITS.environmentMaxChars).optional()
|
|
1891
|
+
}),
|
|
1892
|
+
sli: z13.enum(SLO_SLIS),
|
|
1893
|
+
latencyThresholdMs: z13.number().int().min(1).max(60000).nullable(),
|
|
1894
|
+
objective: z13.number().min(SLO_LIMITS.objectiveMin).max(SLO_LIMITS.objectiveMax),
|
|
1895
|
+
windowDays: z13.union([z13.literal(7), z13.literal(28), z13.literal(30)]),
|
|
1896
|
+
alertPolicy: z13.enum(SLO_ALERT_POLICIES),
|
|
1897
|
+
allowPublicSources: z13.boolean().default(false)
|
|
1307
1898
|
}).superRefine((v, ctx) => {
|
|
1308
1899
|
if (!SLO_SOURCE_META[v.source].slis.includes(v.sli))
|
|
1309
1900
|
ctx.addIssue({ code: "custom", path: ["sli"], message: "INVALID_INPUT" });
|
|
@@ -1318,7 +1909,7 @@ var sloInputSchema = z9.object({
|
|
|
1318
1909
|
});
|
|
1319
1910
|
|
|
1320
1911
|
// ../src/shared/contracts/uptime.ts
|
|
1321
|
-
import { z as
|
|
1912
|
+
import { z as z14 } from "zod";
|
|
1322
1913
|
|
|
1323
1914
|
// ../src/shared/contracts/vocab/uptime.ts
|
|
1324
1915
|
var UPTIME_STATUSES = ["up", "degraded", "down", "unknown", "paused", "pending"];
|
|
@@ -1391,51 +1982,51 @@ function isForbiddenHeader(name) {
|
|
|
1391
1982
|
const n = name.trim().toLowerCase();
|
|
1392
1983
|
return UPTIME_FORBIDDEN_HEADERS.includes(n) || n.startsWith("proxy-") || n.startsWith("sec-");
|
|
1393
1984
|
}
|
|
1394
|
-
var text =
|
|
1395
|
-
var statusRange =
|
|
1396
|
-
var assertionSchema =
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
type:
|
|
1402
|
-
pointer:
|
|
1403
|
-
op:
|
|
1404
|
-
value:
|
|
1405
|
-
}),
|
|
1406
|
-
|
|
1407
|
-
type:
|
|
1408
|
-
name:
|
|
1409
|
-
op:
|
|
1410
|
-
value:
|
|
1411
|
-
}),
|
|
1412
|
-
|
|
1413
|
-
|
|
1985
|
+
var text = z14.string().min(1).max(UPTIME_LIMITS.assertionTextMax);
|
|
1986
|
+
var statusRange = z14.string().regex(/^[1-5][0-9]{2}(-[1-5][0-9]{2})?$/);
|
|
1987
|
+
var assertionSchema = z14.discriminatedUnion("type", [
|
|
1988
|
+
z14.object({ type: z14.literal("status"), in: z14.array(statusRange).min(1).max(10) }),
|
|
1989
|
+
z14.object({ type: z14.literal("body_contains"), value: text, case_sensitive: z14.boolean().default(true) }),
|
|
1990
|
+
z14.object({ type: z14.literal("body_not_contains"), value: text, case_sensitive: z14.boolean().default(true) }),
|
|
1991
|
+
z14.object({
|
|
1992
|
+
type: z14.literal("json_pointer"),
|
|
1993
|
+
pointer: z14.string().max(256).regex(/^(\/([^~/]|~0|~1)*)*$/),
|
|
1994
|
+
op: z14.enum(["exists", "equals", "type"]),
|
|
1995
|
+
value: z14.string().max(UPTIME_LIMITS.assertionTextMax).optional()
|
|
1996
|
+
}),
|
|
1997
|
+
z14.object({
|
|
1998
|
+
type: z14.literal("header"),
|
|
1999
|
+
name: z14.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
|
|
2000
|
+
op: z14.enum(["equals", "contains", "exists"]),
|
|
2001
|
+
value: z14.string().max(UPTIME_LIMITS.assertionTextMax).optional()
|
|
2002
|
+
}),
|
|
2003
|
+
z14.object({ type: z14.literal("latency_ms"), lt: z14.number().int().min(1).max(60000) }),
|
|
2004
|
+
z14.object({ type: z14.literal("tls_valid") })
|
|
1414
2005
|
]);
|
|
1415
|
-
var header =
|
|
1416
|
-
name:
|
|
1417
|
-
value:
|
|
2006
|
+
var header = z14.object({
|
|
2007
|
+
name: z14.string().min(1).max(UPTIME_LIMITS.headerNameMax).regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),
|
|
2008
|
+
value: z14.string().max(UPTIME_LIMITS.headerValueMax).regex(/^[^\r\n\u0000]*$/)
|
|
1418
2009
|
});
|
|
1419
|
-
var uptimeCheckInputSchema =
|
|
1420
|
-
projectId:
|
|
1421
|
-
name:
|
|
1422
|
-
kind:
|
|
1423
|
-
url:
|
|
1424
|
-
host:
|
|
1425
|
-
port:
|
|
1426
|
-
method:
|
|
1427
|
-
headers:
|
|
1428
|
-
followRedirects:
|
|
1429
|
-
timeoutMs:
|
|
1430
|
-
intervalSeconds:
|
|
1431
|
-
regions:
|
|
1432
|
-
assertions:
|
|
1433
|
-
failureThreshold:
|
|
1434
|
-
recoveryThreshold:
|
|
1435
|
-
certWarningDays:
|
|
1436
|
-
environment:
|
|
1437
|
-
strictMetadata:
|
|
1438
|
-
evidenceOnFailure:
|
|
2010
|
+
var uptimeCheckInputSchema = z14.object({
|
|
2011
|
+
projectId: z14.number().int().positive(),
|
|
2012
|
+
name: z14.string().trim().min(1).max(UPTIME_LIMITS.nameMaxChars),
|
|
2013
|
+
kind: z14.enum(UPTIME_KINDS),
|
|
2014
|
+
url: z14.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
|
|
2015
|
+
host: z14.string().max(253).nullable(),
|
|
2016
|
+
port: z14.number().int().min(1).max(65535).nullable(),
|
|
2017
|
+
method: z14.enum(UPTIME_METHODS).default("GET"),
|
|
2018
|
+
headers: z14.array(header).max(UPTIME_LIMITS.headersMax).default([]),
|
|
2019
|
+
followRedirects: z14.boolean().default(false),
|
|
2020
|
+
timeoutMs: z14.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
|
|
2021
|
+
intervalSeconds: z14.number().int().refine((n) => UPTIME_INTERVALS.includes(n)),
|
|
2022
|
+
regions: z14.array(z14.enum(UPTIME_REGIONS)).min(UPTIME_LIMITS.minRegions).max(UPTIME_REGIONS.length),
|
|
2023
|
+
assertions: z14.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax).default([]),
|
|
2024
|
+
failureThreshold: z14.number().int().min(1).max(5),
|
|
2025
|
+
recoveryThreshold: z14.number().int().min(1).max(5),
|
|
2026
|
+
certWarningDays: z14.number().int().min(1).max(60),
|
|
2027
|
+
environment: z14.string().trim().max(64).default(""),
|
|
2028
|
+
strictMetadata: z14.boolean().default(false),
|
|
2029
|
+
evidenceOnFailure: z14.boolean().default(true)
|
|
1439
2030
|
}).superRefine((v, ctx) => {
|
|
1440
2031
|
if (v.kind === "http" && !v.url)
|
|
1441
2032
|
ctx.addIssue({ code: "custom", path: ["url"], message: "INVALID_INPUT" });
|
|
@@ -1446,237 +2037,243 @@ var uptimeCheckInputSchema = z10.object({
|
|
|
1446
2037
|
if (v.headers.some((h) => isForbiddenHeader(h.name)))
|
|
1447
2038
|
ctx.addIssue({ code: "custom", path: ["headers"], message: "UPTIME_HEADER_FORBIDDEN" });
|
|
1448
2039
|
});
|
|
1449
|
-
var uptimeDefinitionSchema =
|
|
1450
|
-
check_id:
|
|
1451
|
-
workspace_id:
|
|
1452
|
-
project_id:
|
|
1453
|
-
revision:
|
|
1454
|
-
kind:
|
|
1455
|
-
url:
|
|
1456
|
-
host:
|
|
1457
|
-
port:
|
|
1458
|
-
method:
|
|
1459
|
-
headers:
|
|
1460
|
-
follow_redirects:
|
|
1461
|
-
timeout_ms:
|
|
1462
|
-
interval_seconds:
|
|
1463
|
-
regions:
|
|
1464
|
-
assertions:
|
|
1465
|
-
failure_threshold:
|
|
1466
|
-
recovery_threshold:
|
|
1467
|
-
cert_warning_days:
|
|
1468
|
-
strict_metadata:
|
|
1469
|
-
evidence_on_failure:
|
|
1470
|
-
paused_until:
|
|
1471
|
-
muted_until:
|
|
2040
|
+
var uptimeDefinitionSchema = z14.object({
|
|
2041
|
+
check_id: z14.guid(),
|
|
2042
|
+
workspace_id: z14.guid(),
|
|
2043
|
+
project_id: z14.number().int().positive(),
|
|
2044
|
+
revision: z14.number().int().nonnegative(),
|
|
2045
|
+
kind: z14.enum(UPTIME_KINDS),
|
|
2046
|
+
url: z14.string().max(UPTIME_LIMITS.urlMaxChars).nullable(),
|
|
2047
|
+
host: z14.string().max(253).nullable(),
|
|
2048
|
+
port: z14.number().int().min(1).max(65535).nullable(),
|
|
2049
|
+
method: z14.enum(UPTIME_METHODS),
|
|
2050
|
+
headers: z14.array(header).max(UPTIME_LIMITS.headersMax),
|
|
2051
|
+
follow_redirects: z14.boolean(),
|
|
2052
|
+
timeout_ms: z14.number().int().min(UPTIME_LIMITS.timeoutMs.min).max(UPTIME_LIMITS.timeoutMs.max),
|
|
2053
|
+
interval_seconds: z14.number().int().positive(),
|
|
2054
|
+
regions: z14.array(z14.enum(UPTIME_REGIONS)).min(1).max(3),
|
|
2055
|
+
assertions: z14.array(assertionSchema).max(UPTIME_LIMITS.assertionsMax),
|
|
2056
|
+
failure_threshold: z14.number().int().min(1).max(5),
|
|
2057
|
+
recovery_threshold: z14.number().int().min(1).max(5),
|
|
2058
|
+
cert_warning_days: z14.number().int().min(1).max(60),
|
|
2059
|
+
strict_metadata: z14.boolean(),
|
|
2060
|
+
evidence_on_failure: z14.boolean(),
|
|
2061
|
+
paused_until: z14.string().nullable(),
|
|
2062
|
+
muted_until: z14.string().nullable()
|
|
1472
2063
|
});
|
|
1473
|
-
var timingsSchema =
|
|
1474
|
-
dns_ms:
|
|
1475
|
-
connect_ms:
|
|
1476
|
-
tls_ms:
|
|
1477
|
-
ttfb_ms:
|
|
1478
|
-
download_ms:
|
|
1479
|
-
total_ms:
|
|
2064
|
+
var timingsSchema = z14.object({
|
|
2065
|
+
dns_ms: z14.number().nonnegative().max(60000).nullable(),
|
|
2066
|
+
connect_ms: z14.number().nonnegative().max(60000).nullable(),
|
|
2067
|
+
tls_ms: z14.number().nonnegative().max(60000).nullable(),
|
|
2068
|
+
ttfb_ms: z14.number().nonnegative().max(60000).nullable(),
|
|
2069
|
+
download_ms: z14.number().nonnegative().max(60000).nullable(),
|
|
2070
|
+
total_ms: z14.number().nonnegative().max(60000)
|
|
1480
2071
|
});
|
|
1481
|
-
var probeResultSchema =
|
|
1482
|
-
check_id:
|
|
1483
|
-
revision:
|
|
1484
|
-
slot:
|
|
1485
|
-
region:
|
|
1486
|
-
run_now:
|
|
1487
|
-
scheduled_at:
|
|
1488
|
-
started_at:
|
|
1489
|
-
outcome:
|
|
1490
|
-
reason:
|
|
1491
|
-
reason_group:
|
|
1492
|
-
status_code:
|
|
2072
|
+
var probeResultSchema = z14.object({
|
|
2073
|
+
check_id: z14.guid(),
|
|
2074
|
+
revision: z14.number().int().nonnegative(),
|
|
2075
|
+
slot: z14.number().int().nonnegative(),
|
|
2076
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
2077
|
+
run_now: z14.string().max(64).optional(),
|
|
2078
|
+
scheduled_at: z14.number().int().positive(),
|
|
2079
|
+
started_at: z14.number().int().positive(),
|
|
2080
|
+
outcome: z14.enum(UPTIME_OUTCOMES),
|
|
2081
|
+
reason: z14.enum(UPTIME_REASONS).nullable(),
|
|
2082
|
+
reason_group: z14.enum(UPTIME_REASON_GROUPS).nullable(),
|
|
2083
|
+
status_code: z14.number().int().min(100).max(599).nullable(),
|
|
1493
2084
|
timings: timingsSchema.nullable(),
|
|
1494
|
-
ip_family:
|
|
1495
|
-
http_version:
|
|
1496
|
-
cert_not_after:
|
|
1497
|
-
cert_issuer:
|
|
1498
|
-
cert_expiring:
|
|
1499
|
-
evidence_sealed:
|
|
2085
|
+
ip_family: z14.enum(["v4", "v6"]).nullable(),
|
|
2086
|
+
http_version: z14.string().max(8).nullable(),
|
|
2087
|
+
cert_not_after: z14.number().int().positive().nullable(),
|
|
2088
|
+
cert_issuer: z14.string().max(200).nullable(),
|
|
2089
|
+
cert_expiring: z14.boolean(),
|
|
2090
|
+
evidence_sealed: z14.string().max(16384).nullable()
|
|
1500
2091
|
});
|
|
1501
|
-
var probeIdSchema =
|
|
1502
|
-
var resultBatchSchema =
|
|
1503
|
-
v:
|
|
2092
|
+
var probeIdSchema = z14.string().regex(/^probe-(eu|us|ap)-[a-z0-9]{4,16}$/);
|
|
2093
|
+
var resultBatchSchema = z14.object({
|
|
2094
|
+
v: z14.literal(1),
|
|
1504
2095
|
probe_id: probeIdSchema,
|
|
1505
|
-
region:
|
|
1506
|
-
version:
|
|
1507
|
-
sent_at:
|
|
1508
|
-
results:
|
|
1509
|
-
stats:
|
|
2096
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
2097
|
+
version: z14.string().max(40),
|
|
2098
|
+
sent_at: z14.number().int().positive(),
|
|
2099
|
+
results: z14.array(probeResultSchema).max(UPTIME_LIMITS.resultsBatchMax),
|
|
2100
|
+
stats: z14.object({ lag_p99_ms: z14.number().nonnegative(), checks_per_min: z14.number().nonnegative() })
|
|
1510
2101
|
});
|
|
1511
2102
|
var assignmentSchema = uptimeDefinitionSchema.omit({ workspace_id: true, paused_until: true, muted_until: true }).extend({
|
|
1512
|
-
seal_public_key:
|
|
2103
|
+
seal_public_key: z14.string().regex(/^[A-Za-z0-9_-]{43}$/).nullable()
|
|
1513
2104
|
});
|
|
1514
|
-
var assignmentsSchema =
|
|
1515
|
-
v:
|
|
1516
|
-
region:
|
|
1517
|
-
revision:
|
|
1518
|
-
issued_at:
|
|
1519
|
-
checks:
|
|
1520
|
-
denied_hosts:
|
|
1521
|
-
run_now:
|
|
2105
|
+
var assignmentsSchema = z14.object({
|
|
2106
|
+
v: z14.literal(1),
|
|
2107
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
2108
|
+
revision: z14.number().int().nonnegative(),
|
|
2109
|
+
issued_at: z14.number().int().positive(),
|
|
2110
|
+
checks: z14.array(assignmentSchema).max(50000),
|
|
2111
|
+
denied_hosts: z14.array(z14.string().max(253)).max(1e4),
|
|
2112
|
+
run_now: z14.array(z14.object({ id: z14.string().max(64), check_id: z14.guid(), expires_at: z14.number().int() })).max(500)
|
|
1522
2113
|
});
|
|
1523
|
-
var uuid3 =
|
|
1524
|
-
var b64key =
|
|
1525
|
-
var iso2 =
|
|
1526
|
-
var uptimeSyncSchema =
|
|
1527
|
-
v:
|
|
2114
|
+
var uuid3 = z14.guid();
|
|
2115
|
+
var b64key = z14.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
2116
|
+
var iso2 = z14.string().datetime();
|
|
2117
|
+
var uptimeSyncSchema = z14.object({
|
|
2118
|
+
v: z14.literal(1),
|
|
1528
2119
|
workspace_id: uuid3,
|
|
1529
|
-
revision:
|
|
1530
|
-
workspace_status:
|
|
1531
|
-
suspended:
|
|
1532
|
-
checks:
|
|
1533
|
-
projects:
|
|
2120
|
+
revision: z14.number().int().positive(),
|
|
2121
|
+
workspace_status: z14.enum(["active", "suspended", "deleting"]),
|
|
2122
|
+
suspended: z14.boolean(),
|
|
2123
|
+
checks: z14.array(uptimeDefinitionSchema).max(UPTIME_LIMITS.maxChecksPerWorkspace),
|
|
2124
|
+
projects: z14.array(z14.object({ id: z14.number().int().positive(), node_id: z14.guid().nullable(), seal_public_key: b64key.nullable() })).max(1000)
|
|
1534
2125
|
});
|
|
1535
|
-
var uptimeReconcileSchema =
|
|
1536
|
-
v:
|
|
1537
|
-
as_of:
|
|
1538
|
-
workspace_ids:
|
|
1539
|
-
heartbeat_routes:
|
|
2126
|
+
var uptimeReconcileSchema = z14.object({
|
|
2127
|
+
v: z14.literal(1),
|
|
2128
|
+
as_of: z14.number().int().positive(),
|
|
2129
|
+
workspace_ids: z14.array(uuid3).max(UPTIME_LIMITS.reconcileMaxWorkspaces),
|
|
2130
|
+
heartbeat_routes: z14.array(z14.string().regex(PING_ROUTE_RE)).max(UPTIME_LIMITS.reconcileMaxWorkspaces).optional()
|
|
1540
2131
|
});
|
|
1541
|
-
var probeDirectorySyncSchema =
|
|
1542
|
-
v:
|
|
1543
|
-
revision:
|
|
1544
|
-
probes:
|
|
1545
|
-
denied_hosts:
|
|
2132
|
+
var probeDirectorySyncSchema = z14.object({
|
|
2133
|
+
v: z14.literal(1),
|
|
2134
|
+
revision: z14.number().int().positive(),
|
|
2135
|
+
probes: z14.array(z14.object({ probe_id: probeIdSchema, region: z14.enum(UPTIME_REGIONS), public_key: b64key, status: z14.enum(["active", "revoked"]) })).max(30),
|
|
2136
|
+
denied_hosts: z14.array(z14.string().min(1).max(253)).max(1e4)
|
|
1546
2137
|
});
|
|
1547
|
-
var runNowRequestSchema =
|
|
1548
|
-
var signedAssignmentsSchema =
|
|
1549
|
-
var uptimeRegionStateSchema =
|
|
1550
|
-
region:
|
|
1551
|
-
outcome:
|
|
1552
|
-
reason:
|
|
1553
|
-
status_code:
|
|
1554
|
-
total_ms:
|
|
2138
|
+
var runNowRequestSchema = z14.object({ v: z14.literal(1), workspace_id: uuid3, check_id: uuid3, run_id: z14.string().regex(/^[A-Za-z0-9_-]{8,64}$/) });
|
|
2139
|
+
var signedAssignmentsSchema = z14.object({ assignments: assignmentsSchema, sig: z14.string().regex(/^[A-Za-z0-9_-]{86}$/) });
|
|
2140
|
+
var uptimeRegionStateSchema = z14.object({
|
|
2141
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
2142
|
+
outcome: z14.enum(UPTIME_OUTCOMES),
|
|
2143
|
+
reason: z14.enum(UPTIME_REASONS).nullable(),
|
|
2144
|
+
status_code: z14.number().int().min(100).max(599).nullable(),
|
|
2145
|
+
total_ms: z14.number().nonnegative().max(60000).nullable(),
|
|
1555
2146
|
timings: timingsSchema.nullable().optional(),
|
|
1556
2147
|
at: iso2
|
|
1557
2148
|
});
|
|
1558
|
-
var uptimeStatusReportSchema =
|
|
2149
|
+
var uptimeStatusReportSchema = z14.object({
|
|
1559
2150
|
check_id: uuid3,
|
|
1560
|
-
revision:
|
|
1561
|
-
status:
|
|
1562
|
-
last_verdict:
|
|
2151
|
+
revision: z14.number().int().nonnegative(),
|
|
2152
|
+
status: z14.enum(UPTIME_STATUSES),
|
|
2153
|
+
last_verdict: z14.enum(SLOT_VERDICTS).nullable(),
|
|
1563
2154
|
last_slot_at: iso2.nullable(),
|
|
1564
2155
|
incident_id: uuid3.nullable(),
|
|
1565
|
-
down_streak:
|
|
1566
|
-
up_streak:
|
|
1567
|
-
regions:
|
|
1568
|
-
unobserved_regions:
|
|
2156
|
+
down_streak: z14.number().int().nonnegative(),
|
|
2157
|
+
up_streak: z14.number().int().nonnegative(),
|
|
2158
|
+
regions: z14.array(uptimeRegionStateSchema).max(3),
|
|
2159
|
+
unobserved_regions: z14.array(z14.enum(UPTIME_REGIONS)).max(3),
|
|
1569
2160
|
cert_not_after: iso2.nullable(),
|
|
1570
|
-
cert_expiring:
|
|
1571
|
-
run_now:
|
|
2161
|
+
cert_expiring: z14.boolean(),
|
|
2162
|
+
run_now: z14.object({ run_id: z14.string().max(64), results: z14.array(uptimeRegionStateSchema).max(3) }).nullable()
|
|
1572
2163
|
});
|
|
1573
2164
|
var UPTIME_EVENT_KINDS = ["opened", "resolved", "cert_expiring"];
|
|
1574
|
-
var uptimeEventSchema =
|
|
1575
|
-
event_id:
|
|
2165
|
+
var uptimeEventSchema = z14.object({
|
|
2166
|
+
event_id: z14.string().regex(/^[A-Za-z0-9:_-]{8,96}$/),
|
|
1576
2167
|
check_id: uuid3,
|
|
1577
|
-
kind:
|
|
2168
|
+
kind: z14.enum(UPTIME_EVENT_KINDS),
|
|
1578
2169
|
incident_id: uuid3.nullable(),
|
|
1579
2170
|
at: iso2,
|
|
1580
|
-
reason:
|
|
1581
|
-
regions:
|
|
1582
|
-
cert_days_left:
|
|
2171
|
+
reason: z14.enum(UPTIME_REASONS).nullable(),
|
|
2172
|
+
regions: z14.array(z14.enum(UPTIME_REGIONS)).max(3),
|
|
2173
|
+
cert_days_left: z14.number().int().nullable()
|
|
1583
2174
|
});
|
|
1584
|
-
var uptimeMinuteSchema =
|
|
2175
|
+
var uptimeMinuteSchema = z14.object({
|
|
1585
2176
|
check_id: uuid3,
|
|
1586
2177
|
minute: iso2,
|
|
1587
|
-
up:
|
|
1588
|
-
degraded:
|
|
1589
|
-
down:
|
|
1590
|
-
unknown:
|
|
1591
|
-
latency:
|
|
2178
|
+
up: z14.number().int().nonnegative(),
|
|
2179
|
+
degraded: z14.number().int().nonnegative(),
|
|
2180
|
+
down: z14.number().int().nonnegative(),
|
|
2181
|
+
unknown: z14.number().int().nonnegative(),
|
|
2182
|
+
latency: z14.array(z14.object({ region: z14.enum(UPTIME_REGIONS), n: z14.number().int().positive(), p50_ms: z14.number().nonnegative(), p95_ms: z14.number().nonnegative() })).max(3)
|
|
1592
2183
|
});
|
|
1593
|
-
var uptimeReportSchema =
|
|
1594
|
-
v:
|
|
2184
|
+
var uptimeReportSchema = z14.object({
|
|
2185
|
+
v: z14.literal(1),
|
|
1595
2186
|
workspace_id: uuid3,
|
|
1596
|
-
revision:
|
|
2187
|
+
revision: z14.number().int().nonnegative(),
|
|
1597
2188
|
sent_at: iso2,
|
|
1598
|
-
events:
|
|
1599
|
-
statuses:
|
|
1600
|
-
minutes:
|
|
2189
|
+
events: z14.array(uptimeEventSchema).max(UPTIME_LIMITS.reportMaxEvents),
|
|
2190
|
+
statuses: z14.array(uptimeStatusReportSchema).max(UPTIME_LIMITS.reportMaxStatuses),
|
|
2191
|
+
minutes: z14.array(uptimeMinuteSchema).max(UPTIME_LIMITS.reportMaxMinutes)
|
|
1601
2192
|
});
|
|
1602
|
-
var probeFleetReportSchema =
|
|
1603
|
-
v:
|
|
2193
|
+
var probeFleetReportSchema = z14.object({
|
|
2194
|
+
v: z14.literal(1),
|
|
1604
2195
|
sent_at: iso2,
|
|
1605
|
-
probes:
|
|
2196
|
+
probes: z14.array(z14.object({
|
|
1606
2197
|
probe_id: probeIdSchema,
|
|
1607
|
-
region:
|
|
1608
|
-
version:
|
|
2198
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
2199
|
+
version: z14.string().max(40).nullable(),
|
|
1609
2200
|
last_seen_at: iso2.nullable(),
|
|
1610
|
-
lag_p99_ms:
|
|
1611
|
-
checks_per_min:
|
|
2201
|
+
lag_p99_ms: z14.number().nonnegative().nullable(),
|
|
2202
|
+
checks_per_min: z14.number().nonnegative().nullable()
|
|
1612
2203
|
})).max(30),
|
|
1613
|
-
regions_alive:
|
|
2204
|
+
regions_alive: z14.array(z14.enum(UPTIME_REGIONS)).max(3)
|
|
1614
2205
|
});
|
|
1615
|
-
var probeEnrollSchema =
|
|
1616
|
-
v:
|
|
2206
|
+
var probeEnrollSchema = z14.object({
|
|
2207
|
+
v: z14.literal(1),
|
|
1617
2208
|
probe_id: probeIdSchema,
|
|
1618
|
-
public_key:
|
|
1619
|
-
code:
|
|
1620
|
-
ts:
|
|
1621
|
-
sig:
|
|
2209
|
+
public_key: z14.string().regex(/^[A-Za-z0-9_-]{43}$/),
|
|
2210
|
+
code: z14.string().regex(/^[A-Za-z0-9_-]{43}$/),
|
|
2211
|
+
ts: z14.number().int().positive(),
|
|
2212
|
+
sig: z14.string().regex(/^[A-Za-z0-9_-]{86}$/)
|
|
1622
2213
|
});
|
|
1623
|
-
var uptimeEvidenceEnvelopeSchema =
|
|
1624
|
-
v:
|
|
1625
|
-
check_id:
|
|
1626
|
-
slot:
|
|
1627
|
-
region:
|
|
2214
|
+
var uptimeEvidenceEnvelopeSchema = z14.object({
|
|
2215
|
+
v: z14.literal(1),
|
|
2216
|
+
check_id: z14.guid(),
|
|
2217
|
+
slot: z14.number().int().nonnegative(),
|
|
2218
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
1628
2219
|
probe_id: probeIdSchema,
|
|
1629
|
-
at:
|
|
1630
|
-
sealed:
|
|
2220
|
+
at: z14.number().int().positive(),
|
|
2221
|
+
sealed: z14.string().regex(/^[A-Za-z0-9_-]+$/).max(16384)
|
|
1631
2222
|
}).strict();
|
|
1632
|
-
var uptimeEvidenceSchema =
|
|
1633
|
-
v:
|
|
1634
|
-
check_id:
|
|
1635
|
-
slot:
|
|
1636
|
-
region:
|
|
1637
|
-
at:
|
|
1638
|
-
reason:
|
|
1639
|
-
status_line:
|
|
1640
|
-
headers:
|
|
1641
|
-
body:
|
|
1642
|
-
body_truncated:
|
|
2223
|
+
var uptimeEvidenceSchema = z14.object({
|
|
2224
|
+
v: z14.literal(1),
|
|
2225
|
+
check_id: z14.guid(),
|
|
2226
|
+
slot: z14.number().int().nonnegative(),
|
|
2227
|
+
region: z14.enum(UPTIME_REGIONS),
|
|
2228
|
+
at: z14.number().int().positive(),
|
|
2229
|
+
reason: z14.enum(UPTIME_REASONS).nullable(),
|
|
2230
|
+
status_line: z14.string().max(200).nullable(),
|
|
2231
|
+
headers: z14.record(z14.string().max(64), z14.string().max(512)).refine((h) => Object.keys(h).length <= 20),
|
|
2232
|
+
body: z14.string().max(UPTIME_LIMITS.evidenceMaxBytes * 4).nullable(),
|
|
2233
|
+
body_truncated: z14.boolean(),
|
|
1643
2234
|
timings: timingsSchema.nullable(),
|
|
1644
|
-
ip:
|
|
1645
|
-
error:
|
|
2235
|
+
ip: z14.string().max(64).nullable(),
|
|
2236
|
+
error: z14.string().max(300).nullable()
|
|
1646
2237
|
}).strict();
|
|
1647
|
-
var uptimeEvidenceListSchema =
|
|
1648
|
-
items:
|
|
2238
|
+
var uptimeEvidenceListSchema = z14.object({
|
|
2239
|
+
items: z14.array(uptimeEvidenceSchema.extend({ received_at: z14.number().int().positive() })).max(UPTIME_LIMITS.evidenceKeepPerCheck)
|
|
1649
2240
|
});
|
|
1650
2241
|
|
|
1651
2242
|
// ../src/shared/contracts/api-ops/monitors.ts
|
|
2243
|
+
var anyMonitorInputSchema = z15.union([monitorInputSchema, signalMonitorInputSchema]);
|
|
2244
|
+
var MAINTENANCE_INPUTS = {
|
|
2245
|
+
create: z15.object({ workspaceId: uuid, input: maintenanceInputSchema }),
|
|
2246
|
+
update: z15.object({ workspaceId: uuid, windowId: uuid, input: maintenanceInputSchema }),
|
|
2247
|
+
delete: z15.object({ workspaceId: uuid, windowId: uuid })
|
|
2248
|
+
};
|
|
1652
2249
|
var MONITOR_INPUTS = {
|
|
1653
|
-
create:
|
|
1654
|
-
update:
|
|
1655
|
-
delete:
|
|
1656
|
-
setPause:
|
|
1657
|
-
setMuted:
|
|
1658
|
-
dismissDiscovery:
|
|
1659
|
-
rotatePing:
|
|
2250
|
+
create: z15.object({ projectId, slug: z15.string().regex(SLUG_RE), input: anyMonitorInputSchema }),
|
|
2251
|
+
update: z15.object({ monitorId: uuid, input: anyMonitorInputSchema }),
|
|
2252
|
+
delete: z15.object({ monitorId: uuid, confirmSlug: z15.string().max(64) }),
|
|
2253
|
+
setPause: z15.object({ monitorId: uuid, until: holdUntil }),
|
|
2254
|
+
setMuted: z15.object({ monitorId: uuid, muted: z15.boolean() }),
|
|
2255
|
+
dismissDiscovery: z15.object({ discoveryId: uuid }),
|
|
2256
|
+
rotatePing: z15.object({
|
|
1660
2257
|
monitorId: uuid,
|
|
1661
|
-
graceHours:
|
|
2258
|
+
graceHours: z15.number().int().refine((h) => HEARTBEAT_LIMITS.rotationGraceHoursChoices.includes(h))
|
|
1662
2259
|
}),
|
|
1663
|
-
monitorOnly:
|
|
2260
|
+
monitorOnly: z15.object({ monitorId: uuid })
|
|
1664
2261
|
};
|
|
1665
2262
|
var UPTIME_INPUTS = {
|
|
1666
2263
|
create: uptimeCheckInputSchema,
|
|
1667
|
-
update:
|
|
1668
|
-
checkOnly:
|
|
1669
|
-
setHold:
|
|
2264
|
+
update: z15.object({ checkId: uuid, input: uptimeCheckInputSchema }),
|
|
2265
|
+
checkOnly: z15.object({ checkId: uuid }),
|
|
2266
|
+
setHold: z15.object({ checkId: uuid, kind: z15.enum(["pause", "mute"]), until: holdUntil })
|
|
1670
2267
|
};
|
|
1671
2268
|
var SLO_INPUTS = {
|
|
1672
|
-
create:
|
|
1673
|
-
update:
|
|
1674
|
-
sloOnly:
|
|
1675
|
-
setHold:
|
|
1676
|
-
import:
|
|
2269
|
+
create: z15.object({ workspaceId: uuid, input: sloInputSchema }),
|
|
2270
|
+
update: z15.object({ sloId: uuid, input: sloInputSchema }),
|
|
2271
|
+
sloOnly: z15.object({ sloId: uuid }),
|
|
2272
|
+
setHold: z15.object({ sloId: uuid, kind: z15.enum(["pause", "mute"]), until: holdUntil }),
|
|
2273
|
+
import: z15.object({
|
|
1677
2274
|
workspaceId: uuid,
|
|
1678
|
-
text:
|
|
1679
|
-
dryRun:
|
|
2275
|
+
text: z15.string().max(SLO_LIMITS.openSloMaxBytes * 2),
|
|
2276
|
+
dryRun: z15.boolean()
|
|
1680
2277
|
})
|
|
1681
2278
|
};
|
|
1682
2279
|
var m = "monitors:write";
|
|
@@ -1688,13 +2285,13 @@ var MONITOR_OPERATIONS = [
|
|
|
1688
2285
|
scope: m,
|
|
1689
2286
|
sensitivity: "normal",
|
|
1690
2287
|
kind: "write",
|
|
1691
|
-
rpcs: ["create_monitor", "create_heartbeat_monitor"],
|
|
2288
|
+
rpcs: ["create_monitor", "create_heartbeat_monitor", "create_signal_monitor"],
|
|
1692
2289
|
input: MONITOR_INPUTS.create,
|
|
1693
2290
|
bodyField: "input",
|
|
1694
2291
|
idempotency: "required",
|
|
1695
2292
|
status: 201,
|
|
1696
2293
|
mcp: "configure",
|
|
1697
|
-
summary: "Create a cron or heartbeat monitor. A heartbeat monitor returns its ping token once.",
|
|
2294
|
+
summary: "Create a cron or heartbeat monitor, or a signal monitor (`settings.type`: count, assertion, deadline, progress). A heartbeat monitor returns its ping token once.",
|
|
1698
2295
|
secretOutput: ["ping_token"],
|
|
1699
2296
|
ui: ["monitors#createMonitor"]
|
|
1700
2297
|
}),
|
|
@@ -1705,13 +2302,13 @@ var MONITOR_OPERATIONS = [
|
|
|
1705
2302
|
scope: m,
|
|
1706
2303
|
sensitivity: "normal",
|
|
1707
2304
|
kind: "write",
|
|
1708
|
-
rpcs: ["update_monitor"],
|
|
2305
|
+
rpcs: ["update_monitor", "update_signal_monitor"],
|
|
1709
2306
|
input: MONITOR_INPUTS.update,
|
|
1710
2307
|
bodyField: "input",
|
|
1711
2308
|
ifMatch: true,
|
|
1712
2309
|
idempotency: "none",
|
|
1713
2310
|
mcp: "configure",
|
|
1714
|
-
summary: "Replace a monitor's schedule, margins and thresholds.",
|
|
2311
|
+
summary: "Replace a monitor's schedule, margins and thresholds, or a signal monitor's settings (the type stays).",
|
|
1715
2312
|
ui: ["monitors#updateMonitor"]
|
|
1716
2313
|
}),
|
|
1717
2314
|
op({
|
|
@@ -1966,23 +2563,71 @@ var MONITOR_OPERATIONS = [
|
|
|
1966
2563
|
mcp: "configure",
|
|
1967
2564
|
summary: "Import OpenSLO YAML, all or nothing; `dry_run` returns the plan without applying it.",
|
|
1968
2565
|
ui: ["slos#importOpenSlo"]
|
|
2566
|
+
}),
|
|
2567
|
+
op({
|
|
2568
|
+
id: "maintenance.create",
|
|
2569
|
+
method: "POST",
|
|
2570
|
+
path: "/v1/maintenance-windows",
|
|
2571
|
+
scope: m,
|
|
2572
|
+
sensitivity: "normal",
|
|
2573
|
+
kind: "write",
|
|
2574
|
+
rpcs: ["create_maintenance_window"],
|
|
2575
|
+
input: MAINTENANCE_INPUTS.create,
|
|
2576
|
+
bodyField: "input",
|
|
2577
|
+
workspace: true,
|
|
2578
|
+
idempotency: "required",
|
|
2579
|
+
status: 201,
|
|
2580
|
+
mcp: "configure",
|
|
2581
|
+
summary: "Hold back monitor notifications during a one-off or weekly window (workspace, projects or monitors); monitors keep evaluating and recording.",
|
|
2582
|
+
ui: ["maintenance#createMaintenanceWindow"]
|
|
2583
|
+
}),
|
|
2584
|
+
op({
|
|
2585
|
+
id: "maintenance.update",
|
|
2586
|
+
method: "PATCH",
|
|
2587
|
+
path: "/v1/maintenance-windows/{window_id}",
|
|
2588
|
+
scope: m,
|
|
2589
|
+
sensitivity: "normal",
|
|
2590
|
+
kind: "write",
|
|
2591
|
+
rpcs: ["update_maintenance_window"],
|
|
2592
|
+
input: MAINTENANCE_INPUTS.update,
|
|
2593
|
+
bodyField: "input",
|
|
2594
|
+
workspace: true,
|
|
2595
|
+
idempotency: "none",
|
|
2596
|
+
mcp: "configure",
|
|
2597
|
+
summary: "Replace a maintenance window's scope, times and reason.",
|
|
2598
|
+
ui: ["maintenance#updateMaintenanceWindow"]
|
|
2599
|
+
}),
|
|
2600
|
+
op({
|
|
2601
|
+
id: "maintenance.delete",
|
|
2602
|
+
method: "DELETE",
|
|
2603
|
+
path: "/v1/maintenance-windows/{window_id}",
|
|
2604
|
+
scope: m,
|
|
2605
|
+
sensitivity: "normal",
|
|
2606
|
+
kind: "write",
|
|
2607
|
+
rpcs: ["delete_maintenance_window"],
|
|
2608
|
+
input: MAINTENANCE_INPUTS.delete,
|
|
2609
|
+
workspace: true,
|
|
2610
|
+
idempotency: "none",
|
|
2611
|
+
mcp: "configure",
|
|
2612
|
+
summary: "Delete a maintenance window; notifications resume at once.",
|
|
2613
|
+
ui: ["maintenance#deleteMaintenanceWindow"]
|
|
1969
2614
|
})
|
|
1970
2615
|
];
|
|
1971
2616
|
|
|
1972
2617
|
// ../src/shared/contracts/api-ops/node-data.ts
|
|
1973
|
-
import { z as
|
|
1974
|
-
var issueId =
|
|
1975
|
-
var csv =
|
|
1976
|
-
var name2 =
|
|
1977
|
-
var period =
|
|
1978
|
-
var nodeCursor =
|
|
2618
|
+
import { z as z16 } from "zod";
|
|
2619
|
+
var issueId = z16.number().int().positive();
|
|
2620
|
+
var csv = z16.string().min(1).max(2000);
|
|
2621
|
+
var name2 = z16.string().min(1).max(256);
|
|
2622
|
+
var period = z16.enum(["1h", "24h", "7d", "14d", "30d"]);
|
|
2623
|
+
var nodeCursor = z16.string().min(1).max(600).optional();
|
|
1979
2624
|
var windowFields = {
|
|
1980
|
-
start:
|
|
1981
|
-
end:
|
|
2625
|
+
start: z16.string().max(40).optional(),
|
|
2626
|
+
end: z16.string().max(40).optional()
|
|
1982
2627
|
};
|
|
1983
|
-
var traceId =
|
|
1984
|
-
var spanId =
|
|
1985
|
-
var attrs =
|
|
2628
|
+
var traceId = z16.string().regex(/^[0-9a-fA-F]{32}$/);
|
|
2629
|
+
var spanId = z16.string().regex(/^[0-9a-fA-F]{16}$/);
|
|
2630
|
+
var attrs = z16.string().max(2000).optional();
|
|
1986
2631
|
var telemetryCommon = {
|
|
1987
2632
|
...windowFields,
|
|
1988
2633
|
project: csv.optional(),
|
|
@@ -1990,91 +2635,112 @@ var telemetryCommon = {
|
|
|
1990
2635
|
service: csv.optional(),
|
|
1991
2636
|
attrs
|
|
1992
2637
|
};
|
|
1993
|
-
var issueChange =
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
action:
|
|
1999
|
-
mode:
|
|
2000
|
-
events:
|
|
2001
|
-
users:
|
|
2002
|
-
until:
|
|
2003
|
-
}),
|
|
2004
|
-
|
|
2005
|
-
|
|
2638
|
+
var issueChange = z16.union([
|
|
2639
|
+
z16.object({ action: z16.literal("resolve"), inNextRelease: z16.boolean().optional() }),
|
|
2640
|
+
z16.object({ action: z16.literal("unresolve") }),
|
|
2641
|
+
z16.object({ action: z16.literal("archive"), mode: z16.enum(["until_escalating", "forever"]) }),
|
|
2642
|
+
z16.object({
|
|
2643
|
+
action: z16.literal("archive"),
|
|
2644
|
+
mode: z16.literal("until_condition"),
|
|
2645
|
+
events: z16.number().int().min(1).max(1e6).optional(),
|
|
2646
|
+
users: z16.number().int().min(1).max(1e5).optional(),
|
|
2647
|
+
until: z16.string().datetime().optional()
|
|
2648
|
+
}),
|
|
2649
|
+
z16.object({ action: z16.literal("assign"), userId: z16.guid().nullable() }),
|
|
2650
|
+
z16.object({ action: z16.literal("priority"), priority: z16.enum(["low", "medium", "high"]) })
|
|
2006
2651
|
]);
|
|
2007
2652
|
var NODE_INPUTS = {
|
|
2008
|
-
issuesList:
|
|
2653
|
+
issuesList: z16.object({
|
|
2009
2654
|
project: csv.optional(),
|
|
2010
|
-
status:
|
|
2655
|
+
status: z16.enum(["unresolved", "resolved", "archived", "all"]).optional(),
|
|
2011
2656
|
level: csv.optional(),
|
|
2012
2657
|
priority: csv.optional(),
|
|
2013
2658
|
environment: csv.optional(),
|
|
2014
2659
|
release: csv.optional(),
|
|
2015
|
-
assignee:
|
|
2660
|
+
assignee: z16.string().max(64).optional(),
|
|
2016
2661
|
period: period.optional(),
|
|
2017
|
-
q:
|
|
2018
|
-
sort:
|
|
2662
|
+
q: z16.string().max(200).optional(),
|
|
2663
|
+
sort: z16.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
|
|
2019
2664
|
cursor: nodeCursor,
|
|
2020
|
-
limit:
|
|
2665
|
+
limit: z16.number().int().min(1).max(100).optional()
|
|
2021
2666
|
}),
|
|
2022
|
-
issue:
|
|
2023
|
-
issueStats:
|
|
2024
|
-
issueEvents:
|
|
2025
|
-
issueEvent:
|
|
2667
|
+
issue: z16.object({ issueId }),
|
|
2668
|
+
issueStats: z16.object({ issueId, range: z16.enum(["24h", "30d"]).optional() }),
|
|
2669
|
+
issueEvents: z16.object({ issueId, cursor: nodeCursor }),
|
|
2670
|
+
issueEvent: z16.object({
|
|
2026
2671
|
issueId,
|
|
2027
|
-
eventId:
|
|
2672
|
+
eventId: z16.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
|
|
2028
2673
|
}),
|
|
2029
|
-
issueUpdate:
|
|
2030
|
-
issuesBulk:
|
|
2031
|
-
issueIds:
|
|
2674
|
+
issueUpdate: z16.object({ issueId, change: issueChange }),
|
|
2675
|
+
issuesBulk: z16.object({
|
|
2676
|
+
issueIds: z16.array(issueId).min(1).max(100),
|
|
2032
2677
|
action: issueChange
|
|
2033
2678
|
}),
|
|
2034
|
-
spansList:
|
|
2679
|
+
spansList: z16.object({
|
|
2035
2680
|
...telemetryCommon,
|
|
2036
|
-
operation:
|
|
2037
|
-
status:
|
|
2038
|
-
kind:
|
|
2039
|
-
minDurationMs:
|
|
2040
|
-
maxDurationMs:
|
|
2041
|
-
mode:
|
|
2681
|
+
operation: z16.string().min(1).max(1024).optional(),
|
|
2682
|
+
status: z16.enum(["unset", "ok", "error"]).optional(),
|
|
2683
|
+
kind: z16.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
|
|
2684
|
+
minDurationMs: z16.number().min(0).max(86400000).optional(),
|
|
2685
|
+
maxDurationMs: z16.number().min(0).max(86400000).optional(),
|
|
2686
|
+
mode: z16.enum(["spans", "traces"]).optional(),
|
|
2042
2687
|
cursor: nodeCursor
|
|
2043
2688
|
}),
|
|
2044
|
-
spansHistogram:
|
|
2689
|
+
spansHistogram: z16.object({
|
|
2045
2690
|
...telemetryCommon,
|
|
2046
|
-
operation:
|
|
2047
|
-
status:
|
|
2691
|
+
operation: z16.string().min(1).max(1024).optional(),
|
|
2692
|
+
status: z16.enum(["unset", "ok", "error"]).optional()
|
|
2048
2693
|
}),
|
|
2049
|
-
trace:
|
|
2050
|
-
traceSpans:
|
|
2051
|
-
span:
|
|
2052
|
-
logsList:
|
|
2694
|
+
trace: z16.object({ traceId }),
|
|
2695
|
+
traceSpans: z16.object({ traceId, errorsOnly: z16.enum(["1"]).optional(), ...windowFields }),
|
|
2696
|
+
span: z16.object({ traceId, spanId, ...windowFields }),
|
|
2697
|
+
logsList: z16.object({
|
|
2053
2698
|
...telemetryCommon,
|
|
2054
|
-
severityMin:
|
|
2699
|
+
severityMin: z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
|
|
2055
2700
|
traceId: traceId.optional(),
|
|
2056
2701
|
spanId: spanId.optional(),
|
|
2057
|
-
q:
|
|
2058
|
-
order:
|
|
2702
|
+
q: z16.string().max(500).optional(),
|
|
2703
|
+
order: z16.enum(["asc", "desc"]).optional(),
|
|
2059
2704
|
cursor: nodeCursor
|
|
2060
2705
|
}),
|
|
2061
|
-
logsFacets:
|
|
2706
|
+
logsFacets: z16.object({
|
|
2062
2707
|
...telemetryCommon,
|
|
2063
|
-
severityMin:
|
|
2064
|
-
q:
|
|
2708
|
+
severityMin: z16.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
|
|
2709
|
+
q: z16.string().max(500).optional()
|
|
2065
2710
|
}),
|
|
2066
|
-
logAround:
|
|
2711
|
+
logAround: z16.object({
|
|
2067
2712
|
logId: name2,
|
|
2068
|
-
at:
|
|
2069
|
-
same:
|
|
2070
|
-
before:
|
|
2071
|
-
after:
|
|
2072
|
-
}),
|
|
2073
|
-
telemetryUsage:
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2713
|
+
at: z16.string().max(40),
|
|
2714
|
+
same: z16.enum(["service", "trace"]).optional(),
|
|
2715
|
+
before: z16.number().int().min(0).max(200).optional(),
|
|
2716
|
+
after: z16.number().int().min(0).max(200).optional()
|
|
2717
|
+
}),
|
|
2718
|
+
telemetryUsage: z16.object({ project: csv.optional(), days: z16.number().int().min(1).max(31).optional() }),
|
|
2719
|
+
monitorSignal: z16.object({ monitorId: z16.guid(), hours: z16.number().int().min(1).max(24).optional() }),
|
|
2720
|
+
monitorOccurrences: z16.object({
|
|
2721
|
+
monitorId: z16.guid(),
|
|
2722
|
+
state: z16.enum(["open", "finished", "all"]).optional(),
|
|
2723
|
+
environment: z16.string().min(1).max(64).optional(),
|
|
2724
|
+
cursor: nodeCursor
|
|
2725
|
+
}),
|
|
2726
|
+
monitorBacktest: z16.object({ project: z16.number().int().positive(), settings: backtestSettingsSchema }),
|
|
2727
|
+
occurrenceCreate: z16.object({
|
|
2728
|
+
project: z16.number().int().positive(),
|
|
2729
|
+
monitorSlug: occurrenceInputSchema.shape.monitor_slug,
|
|
2730
|
+
occurrenceId: occurrenceInputSchema.shape.occurrence_id,
|
|
2731
|
+
dueAt: occurrenceInputSchema.shape.due_at,
|
|
2732
|
+
environment: occurrenceInputSchema.shape.environment
|
|
2733
|
+
}),
|
|
2734
|
+
occurrenceCancel: z16.object({
|
|
2735
|
+
project: z16.number().int().positive(),
|
|
2736
|
+
monitorSlug: z16.string().regex(SLUG_RE),
|
|
2737
|
+
occurrenceId: z16.string().regex(OCCURRENCE_ID_RE),
|
|
2738
|
+
environment: z16.string().min(1).max(64).optional()
|
|
2739
|
+
}),
|
|
2740
|
+
ticket: z16.object({
|
|
2741
|
+
scope: z16.enum(["read", "write"]).default("read"),
|
|
2742
|
+
project: z16.number().int().positive().optional(),
|
|
2743
|
+
environment: z16.string().min(1).max(64).optional()
|
|
2078
2744
|
})
|
|
2079
2745
|
};
|
|
2080
2746
|
var N = NODE_INPUTS;
|
|
@@ -2245,6 +2911,60 @@ var NODE_OPERATIONS = [
|
|
|
2245
2911
|
node: { path: "q/telemetry/usage" },
|
|
2246
2912
|
summary: "Stored spans and logs per day and project on the node."
|
|
2247
2913
|
}),
|
|
2914
|
+
op({
|
|
2915
|
+
...read,
|
|
2916
|
+
id: "monitors.signal",
|
|
2917
|
+
path: "/v1/monitors/{monitor_id}/signal",
|
|
2918
|
+
scope: "monitors:read",
|
|
2919
|
+
input: N.monitorSignal,
|
|
2920
|
+
node: { path: "q/monitors/{monitor_id}/signal" },
|
|
2921
|
+
mcp: "reliability",
|
|
2922
|
+
summary: "A signal monitor's minute counts (count/assertion) for up to 24 h per environment, and its open runs (progress, deadline)."
|
|
2923
|
+
}),
|
|
2924
|
+
op({
|
|
2925
|
+
...read,
|
|
2926
|
+
id: "monitors.occurrences",
|
|
2927
|
+
path: "/v1/monitors/{monitor_id}/occurrences",
|
|
2928
|
+
scope: "monitors:read",
|
|
2929
|
+
input: N.monitorOccurrences,
|
|
2930
|
+
node: { path: "q/monitors/{monitor_id}/occurrences", list: "occurrences" },
|
|
2931
|
+
paged: true,
|
|
2932
|
+
mcp: "reliability",
|
|
2933
|
+
summary: "Occurrences of a deadline monitor (pending, on time, late, missed, failed, cancelled), newest due first."
|
|
2934
|
+
}),
|
|
2935
|
+
op({
|
|
2936
|
+
...read,
|
|
2937
|
+
id: "monitors.backtest",
|
|
2938
|
+
method: "POST",
|
|
2939
|
+
path: "/v1/monitors/backtest",
|
|
2940
|
+
scope: "monitors:read",
|
|
2941
|
+
input: N.monitorBacktest,
|
|
2942
|
+
node: { path: "q/monitors/backtest" },
|
|
2943
|
+
mcp: "reliability",
|
|
2944
|
+
summary: "How often count/assertion settings would have alerted over the last 30 days of stored data (same rule as the live evaluator)."
|
|
2945
|
+
}),
|
|
2946
|
+
op({
|
|
2947
|
+
...read,
|
|
2948
|
+
id: "occurrences.create",
|
|
2949
|
+
method: "POST",
|
|
2950
|
+
path: "/v1/occurrences",
|
|
2951
|
+
scope: "monitors:write",
|
|
2952
|
+
input: N.occurrenceCreate,
|
|
2953
|
+
node: { path: "w/monitors/occurrences", body: "*" },
|
|
2954
|
+
mcp: "configure",
|
|
2955
|
+
summary: "Register one run a deadline monitor expects (`due_at` within 35 days); the same id again moves its due time while it is pending."
|
|
2956
|
+
}),
|
|
2957
|
+
op({
|
|
2958
|
+
...read,
|
|
2959
|
+
id: "occurrences.cancel",
|
|
2960
|
+
method: "DELETE",
|
|
2961
|
+
path: "/v1/occurrences/{monitor_slug}/{occurrence_id}",
|
|
2962
|
+
scope: "monitors:write",
|
|
2963
|
+
input: N.occurrenceCancel,
|
|
2964
|
+
node: { path: "w/monitors/occurrences/cancel", body: "*" },
|
|
2965
|
+
mcp: "configure",
|
|
2966
|
+
summary: "Cancel a pending occurrence (the app moved or dropped the job); a cancelled occurrence never alerts."
|
|
2967
|
+
}),
|
|
2248
2968
|
op({
|
|
2249
2969
|
...read,
|
|
2250
2970
|
id: "issues.update",
|
|
@@ -2282,10 +3002,10 @@ var NODE_OPERATIONS = [
|
|
|
2282
3002
|
];
|
|
2283
3003
|
|
|
2284
3004
|
// ../src/shared/contracts/api-ops/projects.ts
|
|
2285
|
-
import { z as
|
|
3005
|
+
import { z as z21 } from "zod";
|
|
2286
3006
|
|
|
2287
3007
|
// ../src/shared/contracts/ingest-keys.ts
|
|
2288
|
-
import { z as
|
|
3008
|
+
import { z as z17 } from "zod";
|
|
2289
3009
|
var INGEST_KEY_SCOPES = ["traces", "logs", "errors", "monitors"];
|
|
2290
3010
|
var INGEST_KEY_STATES = ["active", "revoked"];
|
|
2291
3011
|
var INGEST_KEY_LIMITS = {
|
|
@@ -2295,51 +3015,51 @@ var INGEST_KEY_LIMITS = {
|
|
|
2295
3015
|
edgeCacheSeconds: 60
|
|
2296
3016
|
};
|
|
2297
3017
|
var CHECKIN_AUTH_MODES = ["public_or_key", "key_only"];
|
|
2298
|
-
var ingestKeyConfigSchema =
|
|
2299
|
-
v:
|
|
2300
|
-
key_id:
|
|
2301
|
-
project_public_id:
|
|
2302
|
-
project_id:
|
|
2303
|
-
workspace_id:
|
|
3018
|
+
var ingestKeyConfigSchema = z17.object({
|
|
3019
|
+
v: z17.literal(1),
|
|
3020
|
+
key_id: z17.guid(),
|
|
3021
|
+
project_public_id: z17.number().int().positive(),
|
|
3022
|
+
project_id: z17.number().int().positive(),
|
|
3023
|
+
workspace_id: z17.guid(),
|
|
2304
3024
|
node_id: nodeIdSchema,
|
|
2305
|
-
scopes:
|
|
2306
|
-
environments:
|
|
2307
|
-
expires_at:
|
|
2308
|
-
state:
|
|
2309
|
-
workspace_status:
|
|
2310
|
-
ingest_kill:
|
|
2311
|
-
telemetry_kill:
|
|
2312
|
-
telemetry_rate_bytes_per_sec:
|
|
2313
|
-
telemetry_burst_bytes:
|
|
2314
|
-
traces_monthly_bytes:
|
|
2315
|
-
logs_monthly_bytes:
|
|
2316
|
-
telemetry_buffer_minutes:
|
|
2317
|
-
revision:
|
|
3025
|
+
scopes: z17.array(z17.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
|
|
3026
|
+
environments: z17.array(z17.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
|
|
3027
|
+
expires_at: z17.string().datetime({ offset: true }).nullable(),
|
|
3028
|
+
state: z17.enum(INGEST_KEY_STATES),
|
|
3029
|
+
workspace_status: z17.enum(["active", "suspended", "deleting"]),
|
|
3030
|
+
ingest_kill: z17.boolean(),
|
|
3031
|
+
telemetry_kill: z17.boolean(),
|
|
3032
|
+
telemetry_rate_bytes_per_sec: z17.number().int().positive(),
|
|
3033
|
+
telemetry_burst_bytes: z17.number().int().positive(),
|
|
3034
|
+
traces_monthly_bytes: z17.number().int().positive(),
|
|
3035
|
+
logs_monthly_bytes: z17.number().int().positive(),
|
|
3036
|
+
telemetry_buffer_minutes: z17.number().int().min(1).max(1440),
|
|
3037
|
+
revision: z17.number().int().nonnegative()
|
|
2318
3038
|
});
|
|
2319
|
-
var createIngestKeyInputSchema =
|
|
2320
|
-
projectId:
|
|
2321
|
-
name:
|
|
2322
|
-
scopes:
|
|
2323
|
-
environments:
|
|
2324
|
-
expiresAt:
|
|
3039
|
+
var createIngestKeyInputSchema = z17.object({
|
|
3040
|
+
projectId: z17.number().int().positive(),
|
|
3041
|
+
name: z17.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
|
|
3042
|
+
scopes: z17.array(z17.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
|
|
3043
|
+
environments: z17.array(z17.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
|
|
3044
|
+
expiresAt: z17.string().datetime({ offset: true }).nullable()
|
|
2325
3045
|
});
|
|
2326
|
-
var ingestKeyRowSchema =
|
|
2327
|
-
id:
|
|
2328
|
-
project_id:
|
|
2329
|
-
name:
|
|
2330
|
-
prefix:
|
|
2331
|
-
scopes:
|
|
2332
|
-
environments:
|
|
2333
|
-
expires_at:
|
|
2334
|
-
state:
|
|
2335
|
-
created_by:
|
|
2336
|
-
created_at:
|
|
2337
|
-
revoked_at:
|
|
2338
|
-
last_used_at:
|
|
3046
|
+
var ingestKeyRowSchema = z17.object({
|
|
3047
|
+
id: z17.guid(),
|
|
3048
|
+
project_id: z17.number().int().positive(),
|
|
3049
|
+
name: z17.string(),
|
|
3050
|
+
prefix: z17.string(),
|
|
3051
|
+
scopes: z17.array(z17.enum(INGEST_KEY_SCOPES)),
|
|
3052
|
+
environments: z17.array(z17.string()),
|
|
3053
|
+
expires_at: z17.string().nullable(),
|
|
3054
|
+
state: z17.enum(INGEST_KEY_STATES),
|
|
3055
|
+
created_by: z17.guid().nullable(),
|
|
3056
|
+
created_at: z17.string(),
|
|
3057
|
+
revoked_at: z17.string().nullable(),
|
|
3058
|
+
last_used_at: z17.string().nullable()
|
|
2339
3059
|
});
|
|
2340
3060
|
|
|
2341
3061
|
// ../src/shared/contracts/integration-health.ts
|
|
2342
|
-
import { z as
|
|
3062
|
+
import { z as z18 } from "zod";
|
|
2343
3063
|
|
|
2344
3064
|
// ../src/shared/contracts/platforms.ts
|
|
2345
3065
|
var PLATFORMS = [
|
|
@@ -2353,116 +3073,116 @@ var PLATFORMS = [
|
|
|
2353
3073
|
|
|
2354
3074
|
// ../src/shared/contracts/integration-health.ts
|
|
2355
3075
|
var VERIFICATION_ID_RE = /^bv1_[0-9a-f]{32}$/;
|
|
2356
|
-
var verificationIdSchema =
|
|
3076
|
+
var verificationIdSchema = z18.string().regex(VERIFICATION_ID_RE);
|
|
2357
3077
|
var SURFACES = ["browser", "server"];
|
|
2358
3078
|
var RECEIPT_SURFACES = ["browser", "server", "belvador"];
|
|
2359
3079
|
var CHECKS = ["delivery", "uncaught", "pipeline"];
|
|
2360
3080
|
var HOOK_STATES = ["ok", "missing", "unknown"];
|
|
2361
|
-
var verificationContextSchema =
|
|
2362
|
-
v:
|
|
2363
|
-
surface:
|
|
2364
|
-
check:
|
|
2365
|
-
hook:
|
|
2366
|
-
uncaught_expected:
|
|
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()
|
|
2367
3087
|
});
|
|
2368
|
-
var iso3 =
|
|
2369
|
-
var projectId3 =
|
|
2370
|
-
var verificationReceiptSchema =
|
|
3088
|
+
var iso3 = z18.string().datetime();
|
|
3089
|
+
var projectId3 = z18.number().int().positive();
|
|
3090
|
+
var verificationReceiptSchema = z18.object({
|
|
2371
3091
|
project_id: projectId3,
|
|
2372
3092
|
verification_id: verificationIdSchema,
|
|
2373
|
-
surface:
|
|
2374
|
-
check:
|
|
2375
|
-
hook:
|
|
2376
|
-
uncaught_expected:
|
|
2377
|
-
sdk_name:
|
|
2378
|
-
sdk_version:
|
|
2379
|
-
environment:
|
|
2380
|
-
release:
|
|
2381
|
-
source_host:
|
|
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),
|
|
2382
3102
|
received_at: iso3
|
|
2383
3103
|
});
|
|
2384
3104
|
var SDK_DELIVERY_DROP_REASONS = ["network_error", "queue_overflow", "send_error"];
|
|
2385
|
-
var clientDiscardSchema =
|
|
3105
|
+
var clientDiscardSchema = z18.object({
|
|
2386
3106
|
hour: iso3,
|
|
2387
|
-
reason:
|
|
2388
|
-
n:
|
|
3107
|
+
reason: z18.enum(SDK_DELIVERY_DROP_REASONS),
|
|
3108
|
+
n: z18.number().int().nonnegative()
|
|
2389
3109
|
});
|
|
2390
|
-
var edgeVerificationRequestSchema =
|
|
2391
|
-
v:
|
|
3110
|
+
var edgeVerificationRequestSchema = z18.object({
|
|
3111
|
+
v: z18.literal(1),
|
|
2392
3112
|
project_id: projectId3,
|
|
2393
3113
|
verification_id: verificationIdSchema
|
|
2394
3114
|
});
|
|
2395
|
-
var readbackCheckSchema =
|
|
2396
|
-
surface:
|
|
2397
|
-
check:
|
|
2398
|
-
hook:
|
|
3115
|
+
var readbackCheckSchema = z18.object({
|
|
3116
|
+
surface: z18.enum(RECEIPT_SURFACES),
|
|
3117
|
+
check: z18.enum(CHECKS),
|
|
3118
|
+
hook: z18.enum(HOOK_STATES),
|
|
2399
3119
|
received_at: iso3
|
|
2400
3120
|
});
|
|
2401
|
-
var edgeVerificationResponseSchema =
|
|
2402
|
-
checks:
|
|
3121
|
+
var edgeVerificationResponseSchema = z18.object({
|
|
3122
|
+
checks: z18.array(readbackCheckSchema).max(8)
|
|
2403
3123
|
});
|
|
2404
|
-
var readbackResponseSchema =
|
|
2405
|
-
v:
|
|
3124
|
+
var readbackResponseSchema = z18.object({
|
|
3125
|
+
v: z18.literal(1),
|
|
2406
3126
|
verification_id: verificationIdSchema,
|
|
2407
|
-
node:
|
|
2408
|
-
checks:
|
|
3127
|
+
node: z18.enum(["connected", "offline"]),
|
|
3128
|
+
checks: z18.array(readbackCheckSchema).max(8)
|
|
2409
3129
|
});
|
|
2410
3130
|
var ENVIRONMENT_RE = /^[^\u0000-\u001f]{1,64}$/;
|
|
2411
|
-
var projectRuntimeSchema =
|
|
3131
|
+
var projectRuntimeSchema = z18.object({
|
|
2412
3132
|
project_id: projectId3,
|
|
2413
|
-
environment:
|
|
2414
|
-
surface:
|
|
2415
|
-
sdk_name:
|
|
2416
|
-
sdk_version:
|
|
2417
|
-
latest_release:
|
|
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),
|
|
2418
3138
|
first_seen: iso3,
|
|
2419
3139
|
last_seen: iso3,
|
|
2420
|
-
events_24h:
|
|
2421
|
-
check_ins_24h:
|
|
3140
|
+
events_24h: z18.number().int().nonnegative(),
|
|
3141
|
+
check_ins_24h: z18.number().int().nonnegative()
|
|
2422
3142
|
});
|
|
2423
3143
|
|
|
2424
3144
|
// ../src/shared/contracts/node-config.ts
|
|
2425
|
-
import { z as
|
|
3145
|
+
import { z as z20 } from "zod";
|
|
2426
3146
|
|
|
2427
3147
|
// ../src/shared/contracts/backup.ts
|
|
2428
|
-
import { z as
|
|
3148
|
+
import { z as z19 } from "zod";
|
|
2429
3149
|
var BACKUP_KINDS = ["daily", "weekly", "manual", "pre_upgrade"];
|
|
2430
|
-
var ageRecipient =
|
|
2431
|
-
var backupIdSchema =
|
|
2432
|
-
var nodeBackupConfigSchema =
|
|
2433
|
-
enabled:
|
|
2434
|
-
hour_utc:
|
|
2435
|
-
weekly_day:
|
|
3150
|
+
var ageRecipient = z19.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
|
|
3151
|
+
var backupIdSchema = z19.string().regex(/^[a-z0-9-]{8,64}$/);
|
|
3152
|
+
var nodeBackupConfigSchema = z19.object({
|
|
3153
|
+
enabled: z19.boolean(),
|
|
3154
|
+
hour_utc: z19.number().int().min(0).max(23),
|
|
3155
|
+
weekly_day: z19.number().int().min(1).max(7),
|
|
2436
3156
|
workspace_recipient: ageRecipient
|
|
2437
3157
|
});
|
|
2438
|
-
var backupCredentialsRequestSchema =
|
|
2439
|
-
mode:
|
|
3158
|
+
var backupCredentialsRequestSchema = z19.object({
|
|
3159
|
+
mode: z19.enum(["upload", "download"]),
|
|
2440
3160
|
backup_id: backupIdSchema,
|
|
2441
|
-
source_node_id:
|
|
3161
|
+
source_node_id: z19.guid().optional()
|
|
2442
3162
|
});
|
|
2443
|
-
var backupCredentialsSchema =
|
|
2444
|
-
endpoint:
|
|
2445
|
-
bucket:
|
|
2446
|
-
prefix:
|
|
2447
|
-
access_key_id:
|
|
2448
|
-
secret_access_key:
|
|
2449
|
-
session_token:
|
|
2450
|
-
expires_at:
|
|
3163
|
+
var backupCredentialsSchema = z19.object({
|
|
3164
|
+
endpoint: z19.string().url(),
|
|
3165
|
+
bucket: z19.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
|
|
3166
|
+
prefix: z19.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
|
|
3167
|
+
access_key_id: z19.string().min(8).max(200),
|
|
3168
|
+
secret_access_key: z19.string().min(8).max(200),
|
|
3169
|
+
session_token: z19.string().min(8).max(4000),
|
|
3170
|
+
expires_at: z19.string().datetime()
|
|
2451
3171
|
});
|
|
2452
|
-
var rowCountsSchema =
|
|
2453
|
-
var backupManifestSchema =
|
|
2454
|
-
v:
|
|
3172
|
+
var rowCountsSchema = z19.record(z19.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z19.number().int().nonnegative());
|
|
3173
|
+
var backupManifestSchema = z19.object({
|
|
3174
|
+
v: z19.literal(1),
|
|
2455
3175
|
backup_id: backupIdSchema,
|
|
2456
|
-
node_id:
|
|
2457
|
-
kind:
|
|
2458
|
-
created_at:
|
|
2459
|
-
object_key:
|
|
2460
|
-
size_bytes:
|
|
2461
|
-
sha256:
|
|
2462
|
-
clickhouse_version:
|
|
2463
|
-
schema_version:
|
|
3176
|
+
node_id: z19.guid(),
|
|
3177
|
+
kind: z19.enum(BACKUP_KINDS),
|
|
3178
|
+
created_at: z19.string().datetime(),
|
|
3179
|
+
object_key: z19.string(),
|
|
3180
|
+
size_bytes: z19.number().int().nonnegative(),
|
|
3181
|
+
sha256: z19.string().regex(/^[0-9a-f]{64}$/),
|
|
3182
|
+
clickhouse_version: z19.string().max(40),
|
|
3183
|
+
schema_version: z19.number().int().nonnegative(),
|
|
2464
3184
|
row_counts: rowCountsSchema,
|
|
2465
|
-
recipients:
|
|
3185
|
+
recipients: z19.array(z19.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
|
|
2466
3186
|
});
|
|
2467
3187
|
var BACKUP_ERROR_CODES = [
|
|
2468
3188
|
"CLICKHOUSE_BACKUP_FAILED",
|
|
@@ -2476,48 +3196,48 @@ var BACKUP_ERROR_CODES = [
|
|
|
2476
3196
|
"RESTORE_FAILED",
|
|
2477
3197
|
"ROW_COUNT_MISMATCH"
|
|
2478
3198
|
];
|
|
2479
|
-
var backupReportSchema =
|
|
3199
|
+
var backupReportSchema = z19.object({
|
|
2480
3200
|
backup_id: backupIdSchema,
|
|
2481
|
-
kind:
|
|
2482
|
-
status:
|
|
2483
|
-
started_at:
|
|
2484
|
-
finished_at:
|
|
3201
|
+
kind: z19.enum(BACKUP_KINDS),
|
|
3202
|
+
status: z19.enum(["succeeded", "failed"]),
|
|
3203
|
+
started_at: z19.string().datetime(),
|
|
3204
|
+
finished_at: z19.string().datetime(),
|
|
2485
3205
|
manifest: backupManifestSchema.nullable(),
|
|
2486
|
-
error_code:
|
|
3206
|
+
error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
|
|
2487
3207
|
});
|
|
2488
|
-
var drillReportSchema =
|
|
3208
|
+
var drillReportSchema = z19.object({
|
|
2489
3209
|
backup_id: backupIdSchema,
|
|
2490
|
-
kind:
|
|
2491
|
-
status:
|
|
2492
|
-
finished_at:
|
|
2493
|
-
detail:
|
|
2494
|
-
error_code:
|
|
3210
|
+
kind: z19.enum(["weekly_local", "monthly_new_machine"]),
|
|
3211
|
+
status: z19.enum(["passed", "failed"]),
|
|
3212
|
+
finished_at: z19.string().datetime(),
|
|
3213
|
+
detail: z19.string().max(300),
|
|
3214
|
+
error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
|
|
2495
3215
|
});
|
|
2496
|
-
var nodeIdentityEscrowSchema =
|
|
2497
|
-
v:
|
|
2498
|
-
node_id:
|
|
2499
|
-
seal:
|
|
2500
|
-
publicKey:
|
|
2501
|
-
privateKey:
|
|
2502
|
-
}),
|
|
2503
|
-
created_at:
|
|
3216
|
+
var nodeIdentityEscrowSchema = z19.object({
|
|
3217
|
+
v: z19.literal(1),
|
|
3218
|
+
node_id: z19.guid(),
|
|
3219
|
+
seal: z19.object({
|
|
3220
|
+
publicKey: z19.string().regex(/^[A-Za-z0-9_-]{43}$/),
|
|
3221
|
+
privateKey: z19.string().regex(/^[A-Za-z0-9_-]{43}$/)
|
|
3222
|
+
}),
|
|
3223
|
+
created_at: z19.string().datetime()
|
|
2504
3224
|
});
|
|
2505
|
-
var restoreArgsSchema =
|
|
2506
|
-
job_id:
|
|
2507
|
-
workspace_id:
|
|
2508
|
-
source_node_id:
|
|
3225
|
+
var restoreArgsSchema = z19.object({
|
|
3226
|
+
job_id: z19.guid(),
|
|
3227
|
+
workspace_id: z19.guid(),
|
|
3228
|
+
source_node_id: z19.guid(),
|
|
2509
3229
|
manifest: backupManifestSchema,
|
|
2510
|
-
sealed_identity:
|
|
2511
|
-
mode:
|
|
3230
|
+
sealed_identity: z19.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
|
|
3231
|
+
mode: z19.enum(["rebuild", "drill"])
|
|
2512
3232
|
});
|
|
2513
|
-
var restoreReportSchema =
|
|
2514
|
-
job_id:
|
|
3233
|
+
var restoreReportSchema = z19.object({
|
|
3234
|
+
job_id: z19.guid(),
|
|
2515
3235
|
backup_id: backupIdSchema,
|
|
2516
|
-
mode:
|
|
2517
|
-
status:
|
|
2518
|
-
finished_at:
|
|
2519
|
-
detail:
|
|
2520
|
-
error_code:
|
|
3236
|
+
mode: z19.enum(["rebuild", "drill"]),
|
|
3237
|
+
status: z19.enum(["succeeded", "failed"]),
|
|
3238
|
+
finished_at: z19.string().datetime(),
|
|
3239
|
+
detail: z19.string().max(300),
|
|
3240
|
+
error_code: z19.enum(BACKUP_ERROR_CODES).nullable()
|
|
2521
3241
|
});
|
|
2522
3242
|
|
|
2523
3243
|
// ../src/shared/contracts/node-config.ts
|
|
@@ -2531,79 +3251,81 @@ var SCRUB_GROUPS = [
|
|
|
2531
3251
|
"headers"
|
|
2532
3252
|
];
|
|
2533
3253
|
var MAX_NODE_MONITORS = 5000;
|
|
2534
|
-
var kid =
|
|
2535
|
-
var publicKey =
|
|
2536
|
-
var nodeConfigSchema =
|
|
2537
|
-
v:
|
|
2538
|
-
config_version:
|
|
2539
|
-
node_id:
|
|
2540
|
-
workspace_id:
|
|
2541
|
-
workspace_status:
|
|
2542
|
-
issued_at:
|
|
2543
|
-
retention_days:
|
|
2544
|
-
channel:
|
|
2545
|
-
projects:
|
|
2546
|
-
project_id:
|
|
2547
|
-
slug:
|
|
2548
|
-
short_prefix:
|
|
2549
|
-
user_id_salt:
|
|
2550
|
-
scrub_disabled:
|
|
2551
|
-
upload_tokens:
|
|
2552
|
-
hash:
|
|
2553
|
-
expires_at:
|
|
3254
|
+
var kid = z20.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
|
|
3255
|
+
var publicKey = z20.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
3256
|
+
var nodeConfigSchema = z20.object({
|
|
3257
|
+
v: z20.literal(1),
|
|
3258
|
+
config_version: z20.number().int().positive(),
|
|
3259
|
+
node_id: z20.guid(),
|
|
3260
|
+
workspace_id: z20.guid(),
|
|
3261
|
+
workspace_status: z20.enum(["active", "suspended"]),
|
|
3262
|
+
issued_at: z20.string().datetime(),
|
|
3263
|
+
retention_days: z20.number().int().min(1).max(3650),
|
|
3264
|
+
channel: z20.enum(["stable", "canary"]).optional(),
|
|
3265
|
+
projects: z20.array(z20.object({
|
|
3266
|
+
project_id: z20.number().int().positive(),
|
|
3267
|
+
slug: z20.string().max(64),
|
|
3268
|
+
short_prefix: z20.string().regex(/^[A-Z0-9]{1,12}$/),
|
|
3269
|
+
user_id_salt: z20.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
|
|
3270
|
+
scrub_disabled: z20.array(z20.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
|
|
3271
|
+
upload_tokens: z20.array(z20.object({
|
|
3272
|
+
hash: z20.string().regex(/^[a-f0-9]{64}$/),
|
|
3273
|
+
expires_at: z20.string().datetime()
|
|
2554
3274
|
})).max(10).optional()
|
|
2555
3275
|
})).max(1000),
|
|
2556
|
-
ticket_keys:
|
|
2557
|
-
control_ops_keys:
|
|
2558
|
-
kill_switches:
|
|
3276
|
+
ticket_keys: z20.array(z20.object({ kid, public_key: publicKey, not_after: z20.string().datetime() })).min(1).max(5),
|
|
3277
|
+
control_ops_keys: z20.array(z20.object({ kid, public_key: publicKey })).min(1).max(5),
|
|
3278
|
+
kill_switches: z20.object({ ingest: z20.boolean(), alerts: z20.boolean() }),
|
|
2559
3279
|
backup: nodeBackupConfigSchema.optional(),
|
|
2560
|
-
purged_projects:
|
|
2561
|
-
monitors:
|
|
2562
|
-
purged_monitors:
|
|
2563
|
-
telemetry:
|
|
2564
|
-
traces_retention_days:
|
|
2565
|
-
logs_retention_days:
|
|
2566
|
-
traces_disk_share:
|
|
3280
|
+
purged_projects: z20.array(z20.number().int().positive()).max(1000).optional(),
|
|
3281
|
+
monitors: z20.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
|
|
3282
|
+
purged_monitors: z20.array(z20.guid()).max(5000).optional(),
|
|
3283
|
+
telemetry: z20.object({
|
|
3284
|
+
traces_retention_days: z20.number().int().min(1).max(90),
|
|
3285
|
+
logs_retention_days: z20.number().int().min(1).max(90),
|
|
3286
|
+
traces_disk_share: z20.number().min(0.2).max(0.8)
|
|
2567
3287
|
}).optional(),
|
|
2568
|
-
slos:
|
|
3288
|
+
slos: z20.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
|
|
3289
|
+
signal_monitors: z20.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
|
|
3290
|
+
signal_limits: signalLimitsConfigSchema.optional()
|
|
2569
3291
|
});
|
|
2570
|
-
var signedNodeConfigSchema =
|
|
3292
|
+
var signedNodeConfigSchema = z20.object({ config: nodeConfigSchema, kid, sig: z20.string() });
|
|
2571
3293
|
|
|
2572
3294
|
// ../src/shared/contracts/api-ops/projects.ts
|
|
2573
|
-
var slug =
|
|
2574
|
-
var name3 =
|
|
2575
|
-
var label =
|
|
2576
|
-
var platform =
|
|
2577
|
-
var origin =
|
|
2578
|
-
var keyId =
|
|
3295
|
+
var slug = z21.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
|
|
3296
|
+
var name3 = z21.string().trim().min(1).max(60);
|
|
3297
|
+
var label = z21.string().trim().min(1).max(40);
|
|
3298
|
+
var platform = z21.enum(PLATFORMS);
|
|
3299
|
+
var origin = z21.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
|
|
3300
|
+
var keyId = z21.number().int().positive();
|
|
2579
3301
|
var PROJECT_INPUTS = {
|
|
2580
|
-
create:
|
|
2581
|
-
update:
|
|
2582
|
-
updateIntake:
|
|
3302
|
+
create: z21.object({ workspaceId: uuid, name: name3, slug, platform }),
|
|
3303
|
+
update: z21.object({ projectId, name: name3, platform, isPinned: z21.boolean() }),
|
|
3304
|
+
updateIntake: z21.object({
|
|
2583
3305
|
projectId,
|
|
2584
|
-
rateLimit:
|
|
2585
|
-
burst:
|
|
2586
|
-
allowedOrigins:
|
|
3306
|
+
rateLimit: z21.number().int().positive().nullable(),
|
|
3307
|
+
burst: z21.number().int().positive().nullable(),
|
|
3308
|
+
allowedOrigins: z21.array(origin).max(50)
|
|
2587
3309
|
}),
|
|
2588
|
-
updateObservability:
|
|
3310
|
+
updateObservability: z21.object({
|
|
2589
3311
|
projectId,
|
|
2590
|
-
primaryEnvironment:
|
|
2591
|
-
allowCodeMonitors:
|
|
3312
|
+
primaryEnvironment: z21.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
|
|
3313
|
+
allowCodeMonitors: z21.boolean()
|
|
2592
3314
|
}),
|
|
2593
|
-
setScrub:
|
|
2594
|
-
setCheckinAuth:
|
|
2595
|
-
setEnvironmentHidden:
|
|
3315
|
+
setScrub: z21.object({ projectId, group: z21.enum(SCRUB_GROUPS), enabled: z21.boolean() }),
|
|
3316
|
+
setCheckinAuth: z21.object({ projectId, mode: z21.enum(CHECKIN_AUTH_MODES) }),
|
|
3317
|
+
setEnvironmentHidden: z21.object({
|
|
2596
3318
|
projectId,
|
|
2597
|
-
name:
|
|
2598
|
-
hidden:
|
|
2599
|
-
}),
|
|
2600
|
-
scheduleDeletion:
|
|
2601
|
-
projectOnly:
|
|
2602
|
-
labelled:
|
|
2603
|
-
keyOnly:
|
|
2604
|
-
tokenOnly:
|
|
3319
|
+
name: z21.string().min(1).max(64),
|
|
3320
|
+
hidden: z21.boolean()
|
|
3321
|
+
}),
|
|
3322
|
+
scheduleDeletion: z21.object({ projectId, confirmSlug: slug }),
|
|
3323
|
+
projectOnly: z21.object({ projectId }),
|
|
3324
|
+
labelled: z21.object({ projectId, label }),
|
|
3325
|
+
keyOnly: z21.object({ keyId }),
|
|
3326
|
+
tokenOnly: z21.object({ tokenId: keyId }),
|
|
2605
3327
|
createIngestKey: createIngestKeyInputSchema,
|
|
2606
|
-
ingestKeyOnly:
|
|
3328
|
+
ingestKeyOnly: z21.object({ keyId: uuid })
|
|
2607
3329
|
};
|
|
2608
3330
|
var P = PROJECT_INPUTS;
|
|
2609
3331
|
var PROJECT_OPERATIONS = [
|
|
@@ -2858,24 +3580,28 @@ var PROJECT_OPERATIONS = [
|
|
|
2858
3580
|
];
|
|
2859
3581
|
|
|
2860
3582
|
// ../src/shared/contracts/api-ops/reads.ts
|
|
2861
|
-
import { z as
|
|
2862
|
-
var list =
|
|
3583
|
+
import { z as z22 } from "zod";
|
|
3584
|
+
var list = z22.object({ workspaceId: uuid, limit: pageLimit, cursor });
|
|
2863
3585
|
var READ_INPUTS = {
|
|
2864
|
-
workspace:
|
|
3586
|
+
workspace: z22.object({ workspaceId: uuid }),
|
|
2865
3587
|
list,
|
|
2866
|
-
projectsGet:
|
|
3588
|
+
projectsGet: z22.object({ workspaceId: uuid, projectId }),
|
|
2867
3589
|
monitorsList: list.extend({ projectId: projectId.optional() }),
|
|
2868
|
-
monitorsGet:
|
|
2869
|
-
uptimeGet:
|
|
2870
|
-
slosGet:
|
|
3590
|
+
monitorsGet: z22.object({ workspaceId: uuid, monitorId: uuid }),
|
|
3591
|
+
uptimeGet: z22.object({ workspaceId: uuid, checkId: uuid }),
|
|
3592
|
+
slosGet: z22.object({ workspaceId: uuid, sloId: uuid }),
|
|
2871
3593
|
alertsList: list.extend({
|
|
2872
|
-
state:
|
|
3594
|
+
state: z22.enum(["open", "resolved", "all"]).default("all"),
|
|
2873
3595
|
monitorId: uuid.optional()
|
|
2874
3596
|
}),
|
|
2875
|
-
approvalsGet:
|
|
3597
|
+
approvalsGet: z22.object({ workspaceId: uuid, approvalId: uuid }),
|
|
3598
|
+
monitorsListTyped: list.extend({
|
|
3599
|
+
projectId: projectId.optional(),
|
|
3600
|
+
type: z22.enum(MONITOR_TYPES).optional()
|
|
3601
|
+
})
|
|
2876
3602
|
};
|
|
2877
3603
|
var R = READ_INPUTS;
|
|
2878
|
-
var
|
|
3604
|
+
var base2 = {
|
|
2879
3605
|
sensitivity: "normal",
|
|
2880
3606
|
kind: "read",
|
|
2881
3607
|
method: "GET",
|
|
@@ -2885,7 +3611,7 @@ var base = {
|
|
|
2885
3611
|
};
|
|
2886
3612
|
var READ_OPERATIONS = [
|
|
2887
3613
|
op({
|
|
2888
|
-
...
|
|
3614
|
+
...base2,
|
|
2889
3615
|
id: "workspace.get",
|
|
2890
3616
|
path: "/v1/workspace",
|
|
2891
3617
|
scope: "org:read",
|
|
@@ -2895,7 +3621,7 @@ var READ_OPERATIONS = [
|
|
|
2895
3621
|
summary: "The token's workspace, plan and the caller's role."
|
|
2896
3622
|
}),
|
|
2897
3623
|
op({
|
|
2898
|
-
...
|
|
3624
|
+
...base2,
|
|
2899
3625
|
id: "members.list",
|
|
2900
3626
|
path: "/v1/members",
|
|
2901
3627
|
scope: "members:read",
|
|
@@ -2906,7 +3632,7 @@ var READ_OPERATIONS = [
|
|
|
2906
3632
|
summary: "Workspace members and their roles."
|
|
2907
3633
|
}),
|
|
2908
3634
|
op({
|
|
2909
|
-
...
|
|
3635
|
+
...base2,
|
|
2910
3636
|
id: "projects.list",
|
|
2911
3637
|
path: "/v1/projects",
|
|
2912
3638
|
scope: "projects:read",
|
|
@@ -2917,7 +3643,7 @@ var READ_OPERATIONS = [
|
|
|
2917
3643
|
summary: "Projects the token can see."
|
|
2918
3644
|
}),
|
|
2919
3645
|
op({
|
|
2920
|
-
...
|
|
3646
|
+
...base2,
|
|
2921
3647
|
id: "projects.get",
|
|
2922
3648
|
path: "/v1/projects/{project_id}",
|
|
2923
3649
|
scope: "projects:read",
|
|
@@ -2927,18 +3653,18 @@ var READ_OPERATIONS = [
|
|
|
2927
3653
|
summary: "One project."
|
|
2928
3654
|
}),
|
|
2929
3655
|
op({
|
|
2930
|
-
...
|
|
3656
|
+
...base2,
|
|
2931
3657
|
id: "monitors.list",
|
|
2932
3658
|
path: "/v1/monitors",
|
|
2933
3659
|
scope: "monitors:read",
|
|
2934
3660
|
rpcs: ["api_read_monitors"],
|
|
2935
|
-
input: R.
|
|
3661
|
+
input: R.monitorsListTyped,
|
|
2936
3662
|
paged: true,
|
|
2937
3663
|
mcp: "investigate",
|
|
2938
|
-
summary: "
|
|
3664
|
+
summary: "Monitors of every type (cron, heartbeat, count, assertion, deadline, progress); `type` narrows the list."
|
|
2939
3665
|
}),
|
|
2940
3666
|
op({
|
|
2941
|
-
...
|
|
3667
|
+
...base2,
|
|
2942
3668
|
id: "monitors.get",
|
|
2943
3669
|
path: "/v1/monitors/{monitor_id}",
|
|
2944
3670
|
scope: "monitors:read",
|
|
@@ -2948,7 +3674,7 @@ var READ_OPERATIONS = [
|
|
|
2948
3674
|
summary: "One monitor with its ETag."
|
|
2949
3675
|
}),
|
|
2950
3676
|
op({
|
|
2951
|
-
...
|
|
3677
|
+
...base2,
|
|
2952
3678
|
id: "uptime.list",
|
|
2953
3679
|
path: "/v1/uptime-checks",
|
|
2954
3680
|
scope: "monitors:read",
|
|
@@ -2959,7 +3685,7 @@ var READ_OPERATIONS = [
|
|
|
2959
3685
|
summary: "Uptime checks (header values are never returned)."
|
|
2960
3686
|
}),
|
|
2961
3687
|
op({
|
|
2962
|
-
...
|
|
3688
|
+
...base2,
|
|
2963
3689
|
id: "uptime.get",
|
|
2964
3690
|
path: "/v1/uptime-checks/{check_id}",
|
|
2965
3691
|
scope: "monitors:read",
|
|
@@ -2969,7 +3695,7 @@ var READ_OPERATIONS = [
|
|
|
2969
3695
|
summary: "One uptime check."
|
|
2970
3696
|
}),
|
|
2971
3697
|
op({
|
|
2972
|
-
...
|
|
3698
|
+
...base2,
|
|
2973
3699
|
id: "slos.list",
|
|
2974
3700
|
path: "/v1/slos",
|
|
2975
3701
|
scope: "monitors:read",
|
|
@@ -2980,7 +3706,7 @@ var READ_OPERATIONS = [
|
|
|
2980
3706
|
summary: "SLO definitions."
|
|
2981
3707
|
}),
|
|
2982
3708
|
op({
|
|
2983
|
-
...
|
|
3709
|
+
...base2,
|
|
2984
3710
|
id: "slos.get",
|
|
2985
3711
|
path: "/v1/slos/{slo_id}",
|
|
2986
3712
|
scope: "monitors:read",
|
|
@@ -2990,7 +3716,7 @@ var READ_OPERATIONS = [
|
|
|
2990
3716
|
summary: "One SLO definition."
|
|
2991
3717
|
}),
|
|
2992
3718
|
op({
|
|
2993
|
-
...
|
|
3719
|
+
...base2,
|
|
2994
3720
|
id: "alert_rules.list",
|
|
2995
3721
|
path: "/v1/alert-rules",
|
|
2996
3722
|
scope: "alerts:read",
|
|
@@ -3001,7 +3727,7 @@ var READ_OPERATIONS = [
|
|
|
3001
3727
|
summary: "Alert rules."
|
|
3002
3728
|
}),
|
|
3003
3729
|
op({
|
|
3004
|
-
...
|
|
3730
|
+
...base2,
|
|
3005
3731
|
id: "destinations.list",
|
|
3006
3732
|
path: "/v1/destinations",
|
|
3007
3733
|
scope: "alerts:read",
|
|
@@ -3012,7 +3738,7 @@ var READ_OPERATIONS = [
|
|
|
3012
3738
|
summary: "Alert destinations with a masked hint; secrets never leave the server."
|
|
3013
3739
|
}),
|
|
3014
3740
|
op({
|
|
3015
|
-
...
|
|
3741
|
+
...base2,
|
|
3016
3742
|
id: "alerts.list",
|
|
3017
3743
|
path: "/v1/alerts",
|
|
3018
3744
|
scope: "alerts:read",
|
|
@@ -3023,7 +3749,18 @@ var READ_OPERATIONS = [
|
|
|
3023
3749
|
summary: "Alerts: one row per violation episode of a monitor, open or resolved."
|
|
3024
3750
|
}),
|
|
3025
3751
|
op({
|
|
3026
|
-
...
|
|
3752
|
+
...base2,
|
|
3753
|
+
id: "maintenance.list",
|
|
3754
|
+
path: "/v1/maintenance-windows",
|
|
3755
|
+
scope: "monitors:read",
|
|
3756
|
+
rpcs: ["api_read_maintenance_windows"],
|
|
3757
|
+
input: R.list,
|
|
3758
|
+
paged: true,
|
|
3759
|
+
mcp: "reliability",
|
|
3760
|
+
summary: "Maintenance windows and whether each is active now."
|
|
3761
|
+
}),
|
|
3762
|
+
op({
|
|
3763
|
+
...base2,
|
|
3027
3764
|
id: "node.get",
|
|
3028
3765
|
path: "/v1/node",
|
|
3029
3766
|
scope: "org:read",
|
|
@@ -3033,7 +3770,7 @@ var READ_OPERATIONS = [
|
|
|
3033
3770
|
summary: "The node's state, versions and last heartbeat (null before provisioning)."
|
|
3034
3771
|
}),
|
|
3035
3772
|
op({
|
|
3036
|
-
...
|
|
3773
|
+
...base2,
|
|
3037
3774
|
id: "usage.get",
|
|
3038
3775
|
path: "/v1/usage",
|
|
3039
3776
|
scope: "usage:read",
|
|
@@ -3043,7 +3780,7 @@ var READ_OPERATIONS = [
|
|
|
3043
3780
|
summary: "The workspace's plan and limits."
|
|
3044
3781
|
}),
|
|
3045
3782
|
op({
|
|
3046
|
-
...
|
|
3783
|
+
...base2,
|
|
3047
3784
|
id: "audit.list",
|
|
3048
3785
|
path: "/v1/audit-log",
|
|
3049
3786
|
scope: "audit:read",
|
|
@@ -3054,7 +3791,7 @@ var READ_OPERATIONS = [
|
|
|
3054
3791
|
summary: "Audit log, newest first (admins)."
|
|
3055
3792
|
}),
|
|
3056
3793
|
op({
|
|
3057
|
-
...
|
|
3794
|
+
...base2,
|
|
3058
3795
|
id: "approvals.get",
|
|
3059
3796
|
path: "/v1/approvals/{approval_id}",
|
|
3060
3797
|
scope: "org:read",
|
|
@@ -3071,6 +3808,7 @@ var API_OPERATIONS = [
|
|
|
3071
3808
|
...PROJECT_OPERATIONS,
|
|
3072
3809
|
...MONITOR_OPERATIONS,
|
|
3073
3810
|
...ALERT_OPERATIONS,
|
|
3811
|
+
...INCIDENT_OPERATIONS,
|
|
3074
3812
|
...ACCESS_OPERATIONS,
|
|
3075
3813
|
...NODE_OPERATIONS
|
|
3076
3814
|
];
|
|
@@ -3139,14 +3877,14 @@ function approvalRequestSchema(operationId, input) {
|
|
|
3139
3877
|
}
|
|
3140
3878
|
|
|
3141
3879
|
// ../src/shared/contracts/api-ops/wire.ts
|
|
3142
|
-
import { z as
|
|
3880
|
+
import { z as z23 } from "zod";
|
|
3143
3881
|
var toSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
|
|
3144
3882
|
var toCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
3145
3883
|
var schemaCache = new WeakMap;
|
|
3146
3884
|
function inputJsonSchema(op) {
|
|
3147
3885
|
let js = schemaCache.get(op.input);
|
|
3148
3886
|
if (!js) {
|
|
3149
|
-
js =
|
|
3887
|
+
js = z23.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
|
|
3150
3888
|
schemaCache.set(op.input, js);
|
|
3151
3889
|
}
|
|
3152
3890
|
return js;
|
|
@@ -3271,6 +4009,18 @@ function wirePointer(op, path) {
|
|
|
3271
4009
|
segs.shift();
|
|
3272
4010
|
return `/${segs.map((s) => s.replace(/~/g, "~0").replace(/\//g, "~1")).join("/")}`;
|
|
3273
4011
|
}
|
|
4012
|
+
var WIRE_ERRORS_MAX = 20;
|
|
4013
|
+
function wireErrors(op, error) {
|
|
4014
|
+
const flat = (issues, prefix) => issues.flatMap((i) => {
|
|
4015
|
+
if (i.code === "invalid_union" && i.errors && i.errors.length > 0) {
|
|
4016
|
+
const best = i.errors.reduce((a, b) => b.length < a.length ? b : a);
|
|
4017
|
+
if (best.length > 0)
|
|
4018
|
+
return flat(best, [...prefix, ...i.path]);
|
|
4019
|
+
}
|
|
4020
|
+
return [{ ...i, path: [...prefix, ...i.path] }];
|
|
4021
|
+
});
|
|
4022
|
+
return flat(error.issues, []).slice(0, WIRE_ERRORS_MAX).map((i) => ({ pointer: wirePointer(op, i.path), code: i.code }));
|
|
4023
|
+
}
|
|
3274
4024
|
|
|
3275
4025
|
// ../src/shared/contracts/api-ops/openapi.ts
|
|
3276
4026
|
function clean(js) {
|
|
@@ -3348,7 +4098,7 @@ function wireInput(operationId, opts = {}) {
|
|
|
3348
4098
|
for (const [k, v] of Object.entries(op.input.shape))
|
|
3349
4099
|
if (!omit.has(k))
|
|
3350
4100
|
shape[toSnake(k)] = v;
|
|
3351
|
-
return
|
|
4101
|
+
return z24.object(shape);
|
|
3352
4102
|
}
|
|
3353
4103
|
var BUDGETS = [
|
|
3354
4104
|
{ stringBytes: MCP_LIMITS.untrustedStringMaxBytes, listMax: MCP_LIMITS.listMax },
|
|
@@ -3438,40 +4188,40 @@ function errorResult(o) {
|
|
|
3438
4188
|
}
|
|
3439
4189
|
};
|
|
3440
4190
|
}
|
|
3441
|
-
var TOOL_OUTPUT_SCHEMA =
|
|
3442
|
-
untrusted:
|
|
3443
|
-
data:
|
|
3444
|
-
provenance:
|
|
3445
|
-
source:
|
|
3446
|
-
operations:
|
|
4191
|
+
var TOOL_OUTPUT_SCHEMA = z24.object({
|
|
4192
|
+
untrusted: z24.object({
|
|
4193
|
+
data: z24.unknown(),
|
|
4194
|
+
provenance: z24.object({
|
|
4195
|
+
source: z24.enum(["node", "control_plane", "docs"]),
|
|
4196
|
+
operations: z24.array(z24.string())
|
|
3447
4197
|
})
|
|
3448
4198
|
}).optional(),
|
|
3449
|
-
doc:
|
|
3450
|
-
results:
|
|
3451
|
-
next_cursor:
|
|
3452
|
-
complete:
|
|
3453
|
-
omitted:
|
|
3454
|
-
truncated:
|
|
3455
|
-
suspicious_unicode:
|
|
3456
|
-
error:
|
|
3457
|
-
code:
|
|
3458
|
-
status:
|
|
3459
|
-
detail:
|
|
3460
|
-
scope:
|
|
3461
|
-
retry_after:
|
|
4199
|
+
doc: z24.object({ slug: z24.string(), locale: z24.enum(["en", "vi"]), url: z24.string(), markdown: z24.string(), truncated: z24.boolean() }).optional(),
|
|
4200
|
+
results: z24.array(z24.object({ slug: z24.string(), title: z24.string(), description: z24.string(), section: z24.string(), url: z24.string() })).optional(),
|
|
4201
|
+
next_cursor: z24.string().nullable().optional(),
|
|
4202
|
+
complete: z24.boolean().optional(),
|
|
4203
|
+
omitted: z24.array(z24.object({ part: z24.string(), reason: z24.string(), scope: z24.string().optional() })).optional(),
|
|
4204
|
+
truncated: z24.literal(true).optional(),
|
|
4205
|
+
suspicious_unicode: z24.literal(true).optional(),
|
|
4206
|
+
error: z24.object({
|
|
4207
|
+
code: z24.string(),
|
|
4208
|
+
status: z24.number(),
|
|
4209
|
+
detail: z24.string().optional(),
|
|
4210
|
+
scope: z24.string().optional(),
|
|
4211
|
+
retry_after: z24.number().optional()
|
|
3462
4212
|
}).optional(),
|
|
3463
|
-
operations:
|
|
3464
|
-
operation:
|
|
3465
|
-
plan:
|
|
3466
|
-
status:
|
|
3467
|
-
approval:
|
|
3468
|
-
approval_id:
|
|
3469
|
-
approval_url:
|
|
3470
|
-
expires_at:
|
|
3471
|
-
state:
|
|
3472
|
-
result_code:
|
|
3473
|
-
result:
|
|
3474
|
-
next:
|
|
4213
|
+
operations: z24.array(z24.record(z24.string(), z24.unknown())).optional(),
|
|
4214
|
+
operation: z24.record(z24.string(), z24.unknown()).optional(),
|
|
4215
|
+
plan: z24.record(z24.string(), z24.unknown()).optional(),
|
|
4216
|
+
status: z24.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
|
|
4217
|
+
approval: z24.object({
|
|
4218
|
+
approval_id: z24.string(),
|
|
4219
|
+
approval_url: z24.string(),
|
|
4220
|
+
expires_at: z24.string(),
|
|
4221
|
+
state: z24.enum(APPROVAL_STATES),
|
|
4222
|
+
result_code: z24.string().nullable().optional(),
|
|
4223
|
+
result: z24.record(z24.string(), z24.unknown()).optional(),
|
|
4224
|
+
next: z24.string().optional()
|
|
3475
4225
|
}).optional()
|
|
3476
4226
|
});
|
|
3477
4227
|
var spec = (name) => {
|
|
@@ -3517,10 +4267,10 @@ var has = (rt, operationId) => {
|
|
|
3517
4267
|
return !!op && rt.scopes.includes(op.scope);
|
|
3518
4268
|
};
|
|
3519
4269
|
var isoWindow = {
|
|
3520
|
-
start:
|
|
3521
|
-
end:
|
|
4270
|
+
start: z24.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
|
|
4271
|
+
end: z24.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
|
|
3522
4272
|
};
|
|
3523
|
-
var traceIdSchema =
|
|
4273
|
+
var traceIdSchema = z24.string().regex(/^[0-9a-fA-F]{32}$/);
|
|
3524
4274
|
var MONITOR_KINDS2 = {
|
|
3525
4275
|
cron: { list: "monitors.list", get: "monitors.get", idField: "monitor_id" },
|
|
3526
4276
|
uptime: { list: "uptime.list", get: "uptime.get", idField: "check_id" },
|
|
@@ -3569,7 +4319,7 @@ function validateConfigure(op, params) {
|
|
|
3569
4319
|
return { ok: true };
|
|
3570
4320
|
return {
|
|
3571
4321
|
ok: false,
|
|
3572
|
-
errors:
|
|
4322
|
+
errors: wireErrors(op, r.error)
|
|
3573
4323
|
};
|
|
3574
4324
|
}
|
|
3575
4325
|
function describe(op, scopes) {
|
|
@@ -3584,8 +4334,8 @@ function describe(op, scopes) {
|
|
|
3584
4334
|
destructive: isDestructiveOperation(op)
|
|
3585
4335
|
};
|
|
3586
4336
|
}
|
|
3587
|
-
var params =
|
|
3588
|
-
var operationIdArg =
|
|
4337
|
+
var params = z24.record(z24.string(), z24.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
|
|
4338
|
+
var operationIdArg = z24.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
|
|
3589
4339
|
function approvalBlock(t, next) {
|
|
3590
4340
|
return {
|
|
3591
4341
|
approval_id: t.approval_id,
|
|
@@ -3605,7 +4355,7 @@ var MCP_TOOL_DEFS = [
|
|
|
3605
4355
|
title: "Workspace and node",
|
|
3606
4356
|
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.",
|
|
3607
4357
|
operations: ["workspace.get", "node.get"],
|
|
3608
|
-
input:
|
|
4358
|
+
input: z24.object({}),
|
|
3609
4359
|
async run(_args, rt) {
|
|
3610
4360
|
const [ws, node] = await Promise.all([rt.call("workspace.get", {}), rt.call("node.get", {})]);
|
|
3611
4361
|
if (!ws.ok)
|
|
@@ -3623,9 +4373,9 @@ var MCP_TOOL_DEFS = [
|
|
|
3623
4373
|
title: "Get an issue",
|
|
3624
4374
|
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).",
|
|
3625
4375
|
operations: ["issues.get", "events.get"],
|
|
3626
|
-
input:
|
|
3627
|
-
issue_id:
|
|
3628
|
-
include_latest_event:
|
|
4376
|
+
input: z24.object({
|
|
4377
|
+
issue_id: z24.number().int().positive().describe("Issue id from search_issues."),
|
|
4378
|
+
include_latest_event: z24.boolean().default(true)
|
|
3629
4379
|
}),
|
|
3630
4380
|
async run(args, rt) {
|
|
3631
4381
|
const omitted = [];
|
|
@@ -3653,9 +4403,9 @@ var MCP_TOOL_DEFS = [
|
|
|
3653
4403
|
title: "Get a trace",
|
|
3654
4404
|
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).",
|
|
3655
4405
|
operations: ["traces.get", "traces.spans"],
|
|
3656
|
-
input:
|
|
4406
|
+
input: z24.object({
|
|
3657
4407
|
trace_id: traceIdSchema.describe("W3C trace id, 32 hex characters."),
|
|
3658
|
-
spans:
|
|
4408
|
+
spans: z24.enum(["none", "errors", "all"]).default("none")
|
|
3659
4409
|
}),
|
|
3660
4410
|
async run(args, rt) {
|
|
3661
4411
|
const sum = await rt.call("traces.get", { trace_id: args["trace_id"] });
|
|
@@ -3683,11 +4433,11 @@ var MCP_TOOL_DEFS = [
|
|
|
3683
4433
|
title: "Correlate by trace or run",
|
|
3684
4434
|
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.",
|
|
3685
4435
|
operations: ["traces.get", "traces.spans", "spans.list", "logs.list"],
|
|
3686
|
-
input:
|
|
4436
|
+
input: z24.object({
|
|
3687
4437
|
trace_id: traceIdSchema.optional(),
|
|
3688
|
-
run_id:
|
|
4438
|
+
run_id: z24.string().min(1).max(128).optional(),
|
|
3689
4439
|
...isoWindow,
|
|
3690
|
-
project:
|
|
4440
|
+
project: z24.string().max(2000).optional().describe("Comma-separated project ids.")
|
|
3691
4441
|
}),
|
|
3692
4442
|
async run(args, rt) {
|
|
3693
4443
|
const trace = args["trace_id"];
|
|
@@ -3730,12 +4480,12 @@ var MCP_TOOL_DEFS = [
|
|
|
3730
4480
|
{
|
|
3731
4481
|
...spec("list_monitors"),
|
|
3732
4482
|
title: "List monitors",
|
|
3733
|
-
description: "
|
|
4483
|
+
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).",
|
|
3734
4484
|
operations: ["monitors.list", "uptime.list", "slos.list"],
|
|
3735
|
-
input:
|
|
3736
|
-
kind:
|
|
3737
|
-
project_id:
|
|
3738
|
-
limit:
|
|
4485
|
+
input: z24.object({
|
|
4486
|
+
kind: z24.enum(["all", "cron", "uptime", "slo"]).default("all"),
|
|
4487
|
+
project_id: z24.number().int().positive().optional(),
|
|
4488
|
+
limit: z24.number().int().min(1).max(200).default(50)
|
|
3739
4489
|
}),
|
|
3740
4490
|
async run(args, rt) {
|
|
3741
4491
|
const kinds = args["kind"] && args["kind"] !== "all" ? [args["kind"]] : ["cron", "uptime", "slo"];
|
|
@@ -3761,26 +4511,69 @@ var MCP_TOOL_DEFS = [
|
|
|
3761
4511
|
{
|
|
3762
4512
|
...spec("get_monitor_status"),
|
|
3763
4513
|
title: "Get a monitor",
|
|
3764
|
-
description: "One
|
|
3765
|
-
operations: ["monitors.get", "uptime.get", "slos.get"],
|
|
3766
|
-
input:
|
|
4514
|
+
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
|
+
operations: ["monitors.get", "uptime.get", "slos.get", "monitors.signal", "monitors.occurrences", "monitors.backtest"],
|
|
4516
|
+
input: z24.object({
|
|
4517
|
+
kind: z24.enum(["cron", "uptime", "slo"]),
|
|
4518
|
+
id: z24.guid(),
|
|
4519
|
+
backtest: z24.boolean().default(false)
|
|
4520
|
+
}),
|
|
3767
4521
|
async run(args, rt) {
|
|
3768
4522
|
const k = MONITOR_KINDS2[args["kind"]];
|
|
3769
4523
|
const r = await rt.call(k.get, { [k.idField]: args["id"] });
|
|
3770
4524
|
if (!r.ok)
|
|
3771
4525
|
return errorResult(r);
|
|
3772
|
-
|
|
4526
|
+
const row = r.body ?? {};
|
|
4527
|
+
const type = typeof row["type"] === "string" ? row["type"] : "job";
|
|
4528
|
+
if (k.get !== "monitors.get" || !isSignalMonitorType(type)) {
|
|
4529
|
+
return wrapResult({ data: r.body, operations: [k.get], source: "control_plane" });
|
|
4530
|
+
}
|
|
4531
|
+
const ops = [k.get, "monitors.signal"];
|
|
4532
|
+
const calls = [
|
|
4533
|
+
rt.call("monitors.signal", { monitor_id: args["id"], hours: 24 })
|
|
4534
|
+
];
|
|
4535
|
+
const parts = ["signal"];
|
|
4536
|
+
if (type === "deadline") {
|
|
4537
|
+
ops.push("monitors.occurrences");
|
|
4538
|
+
parts.push("occurrences");
|
|
4539
|
+
calls.push(rt.call("monitors.occurrences", { monitor_id: args["id"], state: "all" }));
|
|
4540
|
+
}
|
|
4541
|
+
const settings = args["backtest"] === true && (type === "count" || type === "assertion") ? settingsFromRow({
|
|
4542
|
+
type,
|
|
4543
|
+
signal_settings: row["signal_settings"],
|
|
4544
|
+
expected_environments: Array.isArray(row["expected_environments"]) ? row["expected_environments"] : [],
|
|
4545
|
+
severity: String(row["severity"] ?? "medium"),
|
|
4546
|
+
recovery_threshold: Number(row["recovery_threshold"] ?? 1)
|
|
4547
|
+
}) : null;
|
|
4548
|
+
if (settings) {
|
|
4549
|
+
ops.push("monitors.backtest");
|
|
4550
|
+
parts.push("backtest");
|
|
4551
|
+
calls.push(rt.call("monitors.backtest", { project: row["project_id"], settings }));
|
|
4552
|
+
}
|
|
4553
|
+
const answers = await Promise.all(calls);
|
|
4554
|
+
const data = { monitor: r.body };
|
|
4555
|
+
const omitted = [];
|
|
4556
|
+
for (const [i, part] of parts.entries()) {
|
|
4557
|
+
const a = answers[i];
|
|
4558
|
+
if (a.ok)
|
|
4559
|
+
data[part] = part === "occurrences" ? withoutPaging(a.body) : a.body;
|
|
4560
|
+
else
|
|
4561
|
+
omitted.push({ part, reason: a.code });
|
|
4562
|
+
}
|
|
4563
|
+
return wrapResult({ data, operations: ops, source: omitted.length === parts.length ? "control_plane" : "node" }, { omitted });
|
|
3773
4564
|
}
|
|
3774
4565
|
},
|
|
3775
4566
|
single("list_alerts", "alerts.list", "List alerts", "Alerts Belvador raised (open, resolved or all), newest first, optionally for one monitor."),
|
|
4567
|
+
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
|
+
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."),
|
|
3776
4569
|
{
|
|
3777
4570
|
...spec("verify_integration"),
|
|
3778
4571
|
title: "Send a test event",
|
|
3779
4572
|
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).",
|
|
3780
4573
|
operations: ["projects.send_test_event"],
|
|
3781
|
-
input:
|
|
3782
|
-
project_id:
|
|
3783
|
-
idempotency_key:
|
|
4574
|
+
input: z24.object({
|
|
4575
|
+
project_id: z24.number().int().positive(),
|
|
4576
|
+
idempotency_key: z24.string().min(8).max(255).optional()
|
|
3784
4577
|
}),
|
|
3785
4578
|
async run(args, rt) {
|
|
3786
4579
|
const r = await rt.call("projects.send_test_event", { project_id: args["project_id"] }, { idempotencyKey: args["idempotency_key"] ?? rt.newKey() });
|
|
@@ -3792,11 +4585,11 @@ var MCP_TOOL_DEFS = [
|
|
|
3792
4585
|
{
|
|
3793
4586
|
...spec("search_operations"),
|
|
3794
4587
|
title: "Find a configuration change",
|
|
3795
|
-
description: "Searches what this token can change in its Belvador workspace: projects, keys and tokens, monitors, 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.",
|
|
4588
|
+
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.",
|
|
3796
4589
|
operations: [],
|
|
3797
|
-
input:
|
|
3798
|
-
query:
|
|
3799
|
-
limit:
|
|
4590
|
+
input: z24.object({
|
|
4591
|
+
query: z24.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
|
|
4592
|
+
limit: z24.number().int().min(1).max(20).default(10)
|
|
3800
4593
|
}),
|
|
3801
4594
|
async run(args, rt) {
|
|
3802
4595
|
const q = words(String(args["query"]));
|
|
@@ -3824,7 +4617,7 @@ var MCP_TOOL_DEFS = [
|
|
|
3824
4617
|
title: "Describe a configuration change",
|
|
3825
4618
|
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.",
|
|
3826
4619
|
operations: [],
|
|
3827
|
-
input:
|
|
4620
|
+
input: z24.object({ operation_id: operationIdArg }),
|
|
3828
4621
|
async run(args, rt) {
|
|
3829
4622
|
const op = configureOp(args["operation_id"]);
|
|
3830
4623
|
if (!op || op.method === "GET")
|
|
@@ -3853,7 +4646,7 @@ var MCP_TOOL_DEFS = [
|
|
|
3853
4646
|
title: "Check a change before applying it",
|
|
3854
4647
|
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.",
|
|
3855
4648
|
operations: [],
|
|
3856
|
-
input:
|
|
4649
|
+
input: z24.object({ operation_id: operationIdArg, params }),
|
|
3857
4650
|
async run(args, rt) {
|
|
3858
4651
|
const op = configureOp(args["operation_id"]);
|
|
3859
4652
|
if (!op || op.method === "GET")
|
|
@@ -3902,11 +4695,11 @@ var MCP_TOOL_DEFS = [
|
|
|
3902
4695
|
title: "Apply a configuration change",
|
|
3903
4696
|
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.",
|
|
3904
4697
|
operations: [],
|
|
3905
|
-
input:
|
|
4698
|
+
input: z24.object({
|
|
3906
4699
|
operation_id: operationIdArg,
|
|
3907
4700
|
params,
|
|
3908
|
-
idempotency_key:
|
|
3909
|
-
if_match:
|
|
4701
|
+
idempotency_key: z24.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
|
|
4702
|
+
if_match: z24.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
|
|
3910
4703
|
}),
|
|
3911
4704
|
async run(args, rt) {
|
|
3912
4705
|
const op = configureOp(args["operation_id"]);
|
|
@@ -3957,7 +4750,7 @@ var MCP_TOOL_DEFS = [
|
|
|
3957
4750
|
title: "Follow an approval",
|
|
3958
4751
|
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).",
|
|
3959
4752
|
operations: ["approvals.get"],
|
|
3960
|
-
input:
|
|
4753
|
+
input: z24.object({ approval_id: z24.guid().describe("approval_id from apply_change.") }),
|
|
3961
4754
|
async run(args, rt) {
|
|
3962
4755
|
const r = await rt.call("approvals.get", { approval_id: args["approval_id"] });
|
|
3963
4756
|
if (!r.ok)
|
|
@@ -3977,10 +4770,10 @@ var MCP_TOOL_DEFS = [
|
|
|
3977
4770
|
title: "Search Belvador docs",
|
|
3978
4771
|
description: "Searches the public Belvador documentation (titles and summaries) and returns the best pages with their slugs for get_doc.",
|
|
3979
4772
|
operations: [],
|
|
3980
|
-
input:
|
|
3981
|
-
query:
|
|
3982
|
-
locale:
|
|
3983
|
-
limit:
|
|
4773
|
+
input: z24.object({
|
|
4774
|
+
query: z24.string().min(1).max(200),
|
|
4775
|
+
locale: z24.enum(["en", "vi"]).default("en"),
|
|
4776
|
+
limit: z24.number().int().min(1).max(10).default(5)
|
|
3984
4777
|
}),
|
|
3985
4778
|
async run(args, rt) {
|
|
3986
4779
|
const locale = args["locale"] ?? "en";
|
|
@@ -3996,9 +4789,9 @@ var MCP_TOOL_DEFS = [
|
|
|
3996
4789
|
title: "Read a docs page",
|
|
3997
4790
|
description: "The Markdown of one public Belvador docs page by slug (e.g. `quickstart`, `sdk/react`, `reference/api`).",
|
|
3998
4791
|
operations: [],
|
|
3999
|
-
input:
|
|
4000
|
-
slug:
|
|
4001
|
-
locale:
|
|
4792
|
+
input: z24.object({
|
|
4793
|
+
slug: z24.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
|
|
4794
|
+
locale: z24.enum(["en", "vi"]).default("en")
|
|
4002
4795
|
}),
|
|
4003
4796
|
async run(args, rt) {
|
|
4004
4797
|
const locale = args["locale"] ?? "en";
|
|
@@ -4180,7 +4973,7 @@ function findToken(env = process.env, keychain = keychainToken) {
|
|
|
4180
4973
|
}
|
|
4181
4974
|
|
|
4182
4975
|
// packages/mcp/src/cli.ts
|
|
4183
|
-
var PACKAGE_VERSION = "0.
|
|
4976
|
+
var PACKAGE_VERSION = "0.3.0";
|
|
4184
4977
|
var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
|
|
4185
4978
|
|
|
4186
4979
|
Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]
|