@belvador/mcp 0.7.1 → 0.8.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 +792 -507
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -96,47 +96,6 @@ var API_LIMITS = {
|
|
|
96
96
|
};
|
|
97
97
|
var idempotencyKeySchema = z.string().min(API_LIMITS.idempotencyKeyMin).max(API_LIMITS.idempotencyKeyMax).regex(/^[\x21-\x7e]+$/);
|
|
98
98
|
var pageLimitSchema = z.coerce.number().int().min(1).max(API_LIMITS.pageMax).default(API_LIMITS.pageDefault);
|
|
99
|
-
var API_ERROR_STATUS = {
|
|
100
|
-
API_CREDENTIAL_INVALID: 401,
|
|
101
|
-
API_SCOPE_INSUFFICIENT: 403,
|
|
102
|
-
API_FORBIDDEN: 403,
|
|
103
|
-
APPROVAL_REQUIRED: 403,
|
|
104
|
-
APPROVAL_EXPIRED: 410,
|
|
105
|
-
APPROVAL_REJECTED: 403,
|
|
106
|
-
APPROVAL_PARAMS_MISMATCH: 409,
|
|
107
|
-
APPROVAL_OUTCOME_UNKNOWN: 409,
|
|
108
|
-
IDEMPOTENCY_KEY_REUSED: 422,
|
|
109
|
-
IDEMPOTENCY_IN_PROGRESS: 409,
|
|
110
|
-
PRECONDITION_REQUIRED: 428,
|
|
111
|
-
PRECONDITION_FAILED: 412,
|
|
112
|
-
QUERY_WINDOW_REQUIRED: 400,
|
|
113
|
-
QUERY_WINDOW_TOO_LARGE: 400,
|
|
114
|
-
CURSOR_INVALID: 400,
|
|
115
|
-
NODE_OFFLINE: 503,
|
|
116
|
-
TOKEN_LIMIT: 409,
|
|
117
|
-
TOKEN_LIFETIME_INVALID: 400,
|
|
118
|
-
SCOPE_UNKNOWN: 400,
|
|
119
|
-
OAUTH_CLIENT_INVALID: 400,
|
|
120
|
-
MONITOR_SELECTOR_INVALID: 400,
|
|
121
|
-
OCCURRENCE_DUE_INVALID: 400,
|
|
122
|
-
OCCURRENCE_LIMIT: 409,
|
|
123
|
-
MAINTENANCE_INVALID: 400,
|
|
124
|
-
INCIDENT_STATE_INVALID: 409,
|
|
125
|
-
NOTIFICATION_POLICY_INVALID: 400,
|
|
126
|
-
COVERAGE_EXPECTATION_INVALID: 400,
|
|
127
|
-
COVERAGE_SIGNAL_UNAVAILABLE: 400,
|
|
128
|
-
COVERAGE_CODE_OWNED: 409,
|
|
129
|
-
COVERAGE_LIMIT: 409,
|
|
130
|
-
PRIVACY_RULE_INVALID: 400,
|
|
131
|
-
PRIVACY_REGEX_UNSAFE: 400,
|
|
132
|
-
PRIVACY_VERSION_CONFLICT: 409,
|
|
133
|
-
METRIC_CARDINALITY_LIMIT: 429,
|
|
134
|
-
RELEASE_NOT_FOUND: 404,
|
|
135
|
-
PUBLIC_API_PAUSED: 503,
|
|
136
|
-
NODE_BUSY: 429,
|
|
137
|
-
QUERY_TIMEOUT: 422
|
|
138
|
-
};
|
|
139
|
-
var API_ERROR_CODES = Object.keys(API_ERROR_STATUS);
|
|
140
99
|
var API_ORIGIN = "https://api.belvador.dev";
|
|
141
100
|
var PROTECTED_RESOURCE_METADATA_URL = `${API_ORIGIN}/.well-known/oauth-protected-resource`;
|
|
142
101
|
var createCredentialInputSchema = z.object({
|
|
@@ -255,7 +214,7 @@ function docsFetcher(siteUrl, fetcher = fetch, now = () => Date.now()) {
|
|
|
255
214
|
import { CLIENT_CAPABILITIES_META_KEY, inputRequired, McpServer } from "@modelcontextprotocol/server";
|
|
256
215
|
|
|
257
216
|
// ../src/shared/contracts/mcp-tools.ts
|
|
258
|
-
import { z as
|
|
217
|
+
import { z as z34 } from "zod";
|
|
259
218
|
|
|
260
219
|
// ../src/shared/contracts/api-ops/access.ts
|
|
261
220
|
import { z as z3 } from "zod";
|
|
@@ -1215,9 +1174,14 @@ import { z as z12 } from "zod";
|
|
|
1215
1174
|
import { z as z10 } from "zod";
|
|
1216
1175
|
|
|
1217
1176
|
// ../src/shared/contracts/vocab/telemetry.ts
|
|
1177
|
+
var SEVERITIES = ["trace", "debug", "info", "warn", "error", "fatal"];
|
|
1178
|
+
var TRACE_ID_RE = /^[0-9a-f]{32}$/;
|
|
1179
|
+
var SPAN_ID_RE = /^[0-9a-f]{16}$/;
|
|
1218
1180
|
var TELEMETRY_MAX_WINDOW_MS = 7 * 24 * 3600 * 1000;
|
|
1219
1181
|
var ATTR_OPS = ["=", "!=", "exists"];
|
|
1220
1182
|
var ATTR_FILTERS_MAX = 5;
|
|
1183
|
+
var ATTR_KEY_RE = /^[A-Za-z0-9_.:\-/@]{1,256}$/;
|
|
1184
|
+
var LOG_BUILTIN_FACETS = ["service", "severity", "environment"];
|
|
1221
1185
|
var TELEMETRY_PLAN_DEFAULTS = {
|
|
1222
1186
|
traces_retention_days: 7,
|
|
1223
1187
|
logs_retention_days: 7,
|
|
@@ -1666,7 +1630,7 @@ var NUMERIC_OPS = new Set(["lt", "le", "gt", "ge"]);
|
|
|
1666
1630
|
var VALUELESS_OPS = new Set(["exists", "not_exists"]);
|
|
1667
1631
|
var COMPARATORS = ["lt", "gt", "outside"];
|
|
1668
1632
|
var MISSING_DATA_POLICIES = ["alert", "keep", "resolve", "treat_as_zero"];
|
|
1669
|
-
var
|
|
1633
|
+
var SEVERITIES2 = ["critical", "high", "medium", "low"];
|
|
1670
1634
|
var OCCURRENCE_STATES = [
|
|
1671
1635
|
"pending",
|
|
1672
1636
|
"in_progress",
|
|
@@ -1755,7 +1719,7 @@ var threshold = z12.number().int().min(0).max(SIGNAL_LIMITS.thresholdMax);
|
|
|
1755
1719
|
var recovery = z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax);
|
|
1756
1720
|
var common = {
|
|
1757
1721
|
environments: environmentListSchema,
|
|
1758
|
-
severity: z12.enum(
|
|
1722
|
+
severity: z12.enum(SEVERITIES2),
|
|
1759
1723
|
recovery_threshold: recovery
|
|
1760
1724
|
};
|
|
1761
1725
|
var countSettingsSchema = z12.object({
|
|
@@ -1957,7 +1921,7 @@ var incidentRuleInputSchema = z14.object({
|
|
|
1957
1921
|
projectIds: z14.array(z14.number().int().positive()).max(50),
|
|
1958
1922
|
environments: z14.array(z14.string().trim().min(1).max(64)).max(20),
|
|
1959
1923
|
kinds: z14.array(z14.enum(INCIDENT_KINDS)).min(1).max(4),
|
|
1960
|
-
minSeverity: z14.enum(
|
|
1924
|
+
minSeverity: z14.enum(SEVERITIES2),
|
|
1961
1925
|
groupBy: z14.enum(INCIDENT_GROUP_BY),
|
|
1962
1926
|
windowMinutes: z14.number().int().min(5).max(240),
|
|
1963
1927
|
recoveryHoldMinutes: z14.number().int().min(0).max(1440)
|
|
@@ -2092,6 +2056,7 @@ var INCIDENT_OPERATIONS = [
|
|
|
2092
2056
|
input: I.workspace,
|
|
2093
2057
|
workspace: true,
|
|
2094
2058
|
idempotency: "none",
|
|
2059
|
+
paged: true,
|
|
2095
2060
|
mcp: "investigate",
|
|
2096
2061
|
summary: "Rules that turn alerts into incidents: match, grouping, window and recovery wait.",
|
|
2097
2062
|
ui: []
|
|
@@ -2137,6 +2102,7 @@ var INCIDENT_OPERATIONS = [
|
|
|
2137
2102
|
input: I.workspace,
|
|
2138
2103
|
workspace: true,
|
|
2139
2104
|
idempotency: "none",
|
|
2105
|
+
paged: true,
|
|
2140
2106
|
mcp: "investigate",
|
|
2141
2107
|
summary: "Notification policies: quiet hours, digest, fallback chain and escalation.",
|
|
2142
2108
|
ui: []
|
|
@@ -3158,7 +3124,7 @@ var MONITOR_OPERATIONS = [
|
|
|
3158
3124
|
];
|
|
3159
3125
|
|
|
3160
3126
|
// ../src/shared/contracts/api-ops/node-data.ts
|
|
3161
|
-
import { z as
|
|
3127
|
+
import { z as z24 } from "zod";
|
|
3162
3128
|
|
|
3163
3129
|
// ../src/shared/contracts/release-health.ts
|
|
3164
3130
|
import { z as z21 } from "zod";
|
|
@@ -3416,8 +3382,310 @@ var fixStatusSchema = z21.object({
|
|
|
3416
3382
|
verify_hours: z21.number()
|
|
3417
3383
|
});
|
|
3418
3384
|
|
|
3419
|
-
// ../src/shared/contracts/
|
|
3385
|
+
// ../src/shared/contracts/telemetry.ts
|
|
3420
3386
|
import { z as z22 } from "zod";
|
|
3387
|
+
var TELEMETRY_SIGNALS = ["traces", "logs", "metrics"];
|
|
3388
|
+
var TELEMETRY_EDGE_REASONS = [
|
|
3389
|
+
"accepted",
|
|
3390
|
+
"rate_limited",
|
|
3391
|
+
"over_quota",
|
|
3392
|
+
"too_large",
|
|
3393
|
+
"unsupported",
|
|
3394
|
+
"buffer_full",
|
|
3395
|
+
"expired",
|
|
3396
|
+
"auth"
|
|
3397
|
+
];
|
|
3398
|
+
var TELEMETRY_NODE_REASONS = [
|
|
3399
|
+
"accepted",
|
|
3400
|
+
"malformed",
|
|
3401
|
+
"out_of_window",
|
|
3402
|
+
"scope",
|
|
3403
|
+
"dropped_attributes",
|
|
3404
|
+
"truncated",
|
|
3405
|
+
"evicted_early",
|
|
3406
|
+
"unsupported_type",
|
|
3407
|
+
"cardinality_limited",
|
|
3408
|
+
"sdk_delivery"
|
|
3409
|
+
];
|
|
3410
|
+
var TELEMETRY_REASONS = [
|
|
3411
|
+
...TELEMETRY_EDGE_REASONS,
|
|
3412
|
+
...TELEMETRY_NODE_REASONS.filter((r) => r !== "accepted")
|
|
3413
|
+
];
|
|
3414
|
+
var TELEMETRY_LIMITS = {
|
|
3415
|
+
edgeBufferNodeMaxBytes: 512 * 1024 * 1024,
|
|
3416
|
+
edgeBufferMetricsMaxBytes: 64 * 1024 * 1024,
|
|
3417
|
+
drainShareWhileErrorsWait: 0.5,
|
|
3418
|
+
nodeSpoolMaxBytes: 1024 * 1024 * 1024,
|
|
3419
|
+
nodeSpoolMaxAgeMs: 30 * 60 * 1000,
|
|
3420
|
+
nodeOverloadRatio: 0.85,
|
|
3421
|
+
diskBudgetRatio: 0.3,
|
|
3422
|
+
diskShareMetrics: 0.1,
|
|
3423
|
+
diskSplitTracesDefault: 0.5,
|
|
3424
|
+
diskSplitMin: 0.2,
|
|
3425
|
+
diskSplitMax: 0.8,
|
|
3426
|
+
diskCheckIntervalMs: 5 * 60 * 1000,
|
|
3427
|
+
servicesPerProject: 200,
|
|
3428
|
+
serviceNameMaxChars: 128,
|
|
3429
|
+
keyUsedReportMs: 60 * 60 * 1000
|
|
3430
|
+
};
|
|
3431
|
+
var TELEMETRY_QUERY = {
|
|
3432
|
+
maxWindowMs: TELEMETRY_MAX_WINDOW_MS,
|
|
3433
|
+
spansDefaultWindowMs: 3600 * 1000,
|
|
3434
|
+
logsDefaultWindowMs: 15 * 60 * 1000,
|
|
3435
|
+
substringMaxWindowMs: 15 * 60 * 1000,
|
|
3436
|
+
spansPageSize: 100,
|
|
3437
|
+
logsPageSize: 200,
|
|
3438
|
+
logsPageMaxBytes: 2 * 1024 * 1024,
|
|
3439
|
+
waterfallMaxSpans: 1e4,
|
|
3440
|
+
waterfallMaxBytes: 8 * 1024 * 1024,
|
|
3441
|
+
waterfallFallbackWindowMs: 15 * 60 * 1000,
|
|
3442
|
+
histogramMaxBuckets: 300,
|
|
3443
|
+
facetsMaxValues: 50,
|
|
3444
|
+
facetsMaxKeys: 5,
|
|
3445
|
+
aroundMaxRows: 100,
|
|
3446
|
+
aroundWindowMs: 5 * 60 * 1000,
|
|
3447
|
+
attrFiltersMax: ATTR_FILTERS_MAX,
|
|
3448
|
+
timeBudgetMs: {
|
|
3449
|
+
waterfall: 1000,
|
|
3450
|
+
spans: 1500,
|
|
3451
|
+
logs: 1000,
|
|
3452
|
+
histogram: 1000,
|
|
3453
|
+
facets: 500,
|
|
3454
|
+
around: 500
|
|
3455
|
+
},
|
|
3456
|
+
maxMemoryBytes: 256 * 1024 * 1024,
|
|
3457
|
+
maxThreads: 2,
|
|
3458
|
+
busyWaitMs: 2000,
|
|
3459
|
+
issueLogsWindowMs: 2 * 60 * 1000
|
|
3460
|
+
};
|
|
3461
|
+
var INCOMPLETE_REASONS = ["time_budget", "row_cap", "byte_cap", "window"];
|
|
3462
|
+
var SPAN_KINDS = [
|
|
3463
|
+
"unspecified",
|
|
3464
|
+
"internal",
|
|
3465
|
+
"server",
|
|
3466
|
+
"client",
|
|
3467
|
+
"producer",
|
|
3468
|
+
"consumer"
|
|
3469
|
+
];
|
|
3470
|
+
var SPAN_STATUSES = ["unset", "ok", "error"];
|
|
3471
|
+
var SOURCE_PROTOCOLS = ["otlp", "sentry_log"];
|
|
3472
|
+
var traceId = z22.string().regex(TRACE_ID_RE);
|
|
3473
|
+
var spanId = z22.string().regex(SPAN_ID_RE);
|
|
3474
|
+
var optSpanId = z22.union([spanId, z22.literal("")]);
|
|
3475
|
+
var ts2 = z22.string().max(40);
|
|
3476
|
+
var count3 = z22.coerce.number().int().nonnegative().catch(0);
|
|
3477
|
+
var label2 = z22.string().max(256);
|
|
3478
|
+
var attrValue = z22.lazy(() => z22.union([
|
|
3479
|
+
z22.string().max(70000),
|
|
3480
|
+
z22.number(),
|
|
3481
|
+
z22.boolean(),
|
|
3482
|
+
z22.null(),
|
|
3483
|
+
z22.array(attrValue).max(256),
|
|
3484
|
+
z22.record(z22.string(), attrValue)
|
|
3485
|
+
]));
|
|
3486
|
+
var attrs = z22.record(z22.string().max(256), attrValue).catch({});
|
|
3487
|
+
var spanRowSchema = z22.object({
|
|
3488
|
+
project_id: z22.number().int().positive(),
|
|
3489
|
+
trace_id: traceId,
|
|
3490
|
+
span_id: spanId,
|
|
3491
|
+
parent_span_id: optSpanId,
|
|
3492
|
+
service: label2,
|
|
3493
|
+
operation: z22.string().max(1024),
|
|
3494
|
+
kind: z22.enum(SPAN_KINDS).catch("unspecified"),
|
|
3495
|
+
status: z22.enum(SPAN_STATUSES).catch("unset"),
|
|
3496
|
+
start: ts2,
|
|
3497
|
+
duration_ns: z22.coerce.number().nonnegative().catch(0),
|
|
3498
|
+
environment: z22.string().max(64).catch("")
|
|
3499
|
+
});
|
|
3500
|
+
var traceSummarySchema = z22.object({
|
|
3501
|
+
project_id: z22.number().int().positive(),
|
|
3502
|
+
trace_id: traceId,
|
|
3503
|
+
root_service: label2.catch(""),
|
|
3504
|
+
root_operation: z22.string().max(1024).catch(""),
|
|
3505
|
+
has_root: z22.boolean().catch(false),
|
|
3506
|
+
start: ts2,
|
|
3507
|
+
duration_ns: z22.coerce.number().nonnegative().catch(0),
|
|
3508
|
+
spans: count3,
|
|
3509
|
+
errors: count3,
|
|
3510
|
+
services: count3,
|
|
3511
|
+
environment: z22.string().max(64).catch("")
|
|
3512
|
+
});
|
|
3513
|
+
var completeness2 = {
|
|
3514
|
+
complete: z22.boolean(),
|
|
3515
|
+
reason: z22.enum(INCOMPLETE_REASONS).optional().catch(undefined)
|
|
3516
|
+
};
|
|
3517
|
+
var spanListSchema = z22.object({
|
|
3518
|
+
mode: z22.enum(["spans", "traces"]),
|
|
3519
|
+
spans: z22.array(spanRowSchema).max(TELEMETRY_QUERY.spansPageSize).catch([]),
|
|
3520
|
+
traces: z22.array(traceSummarySchema).max(TELEMETRY_QUERY.spansPageSize).catch([]),
|
|
3521
|
+
next_cursor: z22.string().max(512).nullable(),
|
|
3522
|
+
...completeness2
|
|
3523
|
+
});
|
|
3524
|
+
var spanHistogramSchema = z22.object({
|
|
3525
|
+
bucket_ms: z22.number().int().positive(),
|
|
3526
|
+
buckets: z22.array(z22.object({
|
|
3527
|
+
t: ts2,
|
|
3528
|
+
spans: count3,
|
|
3529
|
+
errors: count3,
|
|
3530
|
+
p50_ns: z22.coerce.number().nonnegative().catch(0),
|
|
3531
|
+
p95_ns: z22.coerce.number().nonnegative().catch(0)
|
|
3532
|
+
})).max(TELEMETRY_QUERY.histogramMaxBuckets),
|
|
3533
|
+
...completeness2
|
|
3534
|
+
});
|
|
3535
|
+
var spanEventSchema = z22.object({
|
|
3536
|
+
time: ts2,
|
|
3537
|
+
name: z22.string().max(1024),
|
|
3538
|
+
attributes: attrs
|
|
3539
|
+
});
|
|
3540
|
+
var spanLinkSchema = z22.object({ trace_id: traceId, span_id: spanId, attributes: attrs });
|
|
3541
|
+
var spanDetailSchema = spanRowSchema.extend({
|
|
3542
|
+
status_message: z22.string().max(4096).catch(""),
|
|
3543
|
+
trace_state: z22.string().max(512).catch(""),
|
|
3544
|
+
scope_name: z22.string().max(256).catch(""),
|
|
3545
|
+
scope_version: z22.string().max(64).catch(""),
|
|
3546
|
+
attributes: attrs,
|
|
3547
|
+
resource: attrs,
|
|
3548
|
+
events: z22.array(spanEventSchema).max(128).catch([]),
|
|
3549
|
+
links: z22.array(spanLinkSchema).max(128).catch([]),
|
|
3550
|
+
dropped_attributes_count: count3,
|
|
3551
|
+
dropped_events_count: count3,
|
|
3552
|
+
dropped_links_count: count3,
|
|
3553
|
+
sampling_probability: z22.number().min(0).max(1).nullable().catch(null)
|
|
3554
|
+
});
|
|
3555
|
+
var waterfallSchema = z22.object({
|
|
3556
|
+
trace_id: traceId,
|
|
3557
|
+
spans: z22.array(spanDetailSchema).max(TELEMETRY_QUERY.waterfallMaxSpans),
|
|
3558
|
+
missing_parents: z22.array(spanId).max(TELEMETRY_QUERY.waterfallMaxSpans).catch([]),
|
|
3559
|
+
errors: z22.array(z22.object({
|
|
3560
|
+
project_id: z22.number().int().positive(),
|
|
3561
|
+
event_id: z22.string().regex(/^[0-9a-f]{32}$/),
|
|
3562
|
+
span_id: optSpanId.catch(""),
|
|
3563
|
+
issue_id: z22.number().int().positive(),
|
|
3564
|
+
title: z22.string().max(2000).catch(""),
|
|
3565
|
+
ts: ts2
|
|
3566
|
+
})).max(200).catch([]),
|
|
3567
|
+
log_counts: z22.record(spanId, count3).catch({}),
|
|
3568
|
+
...completeness2
|
|
3569
|
+
});
|
|
3570
|
+
var traceBriefSchema = z22.object({
|
|
3571
|
+
trace_id: traceId,
|
|
3572
|
+
spans: count3,
|
|
3573
|
+
errors: count3,
|
|
3574
|
+
start: ts2.nullable(),
|
|
3575
|
+
end: ts2.nullable()
|
|
3576
|
+
});
|
|
3577
|
+
var BODY_KINDS = ["string", "json", "empty"];
|
|
3578
|
+
var logRowSchema = z22.object({
|
|
3579
|
+
log_id: z22.guid(),
|
|
3580
|
+
project_id: z22.number().int().positive(),
|
|
3581
|
+
ts: ts2,
|
|
3582
|
+
observed_ts: ts2.catch(""),
|
|
3583
|
+
service: label2,
|
|
3584
|
+
environment: z22.string().max(64).catch(""),
|
|
3585
|
+
severity_number: z22.number().int().min(0).max(24).catch(0),
|
|
3586
|
+
severity_text: z22.string().max(32).catch(""),
|
|
3587
|
+
body: z22.string().max(70000).catch(""),
|
|
3588
|
+
body_kind: z22.enum(BODY_KINDS).catch("string"),
|
|
3589
|
+
trace_id: z22.union([traceId, z22.literal("")]).catch(""),
|
|
3590
|
+
span_id: optSpanId.catch(""),
|
|
3591
|
+
event_name: z22.string().max(256).catch(""),
|
|
3592
|
+
scope_name: z22.string().max(256).catch(""),
|
|
3593
|
+
source_protocol: z22.enum(SOURCE_PROTOCOLS).catch("otlp"),
|
|
3594
|
+
attributes: attrs,
|
|
3595
|
+
resource: attrs
|
|
3596
|
+
});
|
|
3597
|
+
var logListSchema = z22.object({
|
|
3598
|
+
logs: z22.array(logRowSchema).max(TELEMETRY_QUERY.logsPageSize),
|
|
3599
|
+
next_cursor: z22.string().max(512).nullable(),
|
|
3600
|
+
...completeness2
|
|
3601
|
+
});
|
|
3602
|
+
var logHistogramSchema = z22.object({
|
|
3603
|
+
bucket_ms: z22.number().int().positive(),
|
|
3604
|
+
buckets: z22.array(z22.object({
|
|
3605
|
+
t: ts2,
|
|
3606
|
+
counts: z22.partialRecord(z22.enum([...SEVERITIES, "unspecified"]), count3).catch({})
|
|
3607
|
+
})).max(TELEMETRY_QUERY.histogramMaxBuckets),
|
|
3608
|
+
...completeness2
|
|
3609
|
+
});
|
|
3610
|
+
var logFacetsSchema = z22.object({
|
|
3611
|
+
facets: z22.array(z22.object({
|
|
3612
|
+
key: z22.string().max(256),
|
|
3613
|
+
values: z22.array(z22.object({ value: z22.string().max(512), count: count3 })).max(TELEMETRY_QUERY.facetsMaxValues),
|
|
3614
|
+
estimated: z22.boolean().catch(false)
|
|
3615
|
+
})).max(TELEMETRY_QUERY.facetsMaxKeys),
|
|
3616
|
+
...completeness2
|
|
3617
|
+
});
|
|
3618
|
+
var telemetryUsageSchema = z22.object({
|
|
3619
|
+
days: z22.array(z22.object({
|
|
3620
|
+
day: z22.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
3621
|
+
signal: z22.enum(TELEMETRY_SIGNALS),
|
|
3622
|
+
reason: z22.enum(TELEMETRY_REASONS),
|
|
3623
|
+
records: count3,
|
|
3624
|
+
bytes: count3
|
|
3625
|
+
})).max(31 * TELEMETRY_SIGNALS.length * TELEMETRY_REASONS.length),
|
|
3626
|
+
retention_effective_days: z22.object({
|
|
3627
|
+
traces: z22.number().int().nonnegative(),
|
|
3628
|
+
logs: z22.number().int().nonnegative(),
|
|
3629
|
+
metrics: z22.number().int().nonnegative().optional()
|
|
3630
|
+
}),
|
|
3631
|
+
disk: z22.object({
|
|
3632
|
+
budget_bytes: count3,
|
|
3633
|
+
traces_bytes: count3,
|
|
3634
|
+
logs_bytes: count3,
|
|
3635
|
+
metrics_bytes: count3.optional(),
|
|
3636
|
+
traces_share: z22.number().min(0).max(1)
|
|
3637
|
+
}).nullable().catch(null)
|
|
3638
|
+
});
|
|
3639
|
+
var SIGNAL_STALE_MS = 24 * 3600 * 1000;
|
|
3640
|
+
var sdkLabel = z22.string().max(64);
|
|
3641
|
+
var serviceSeenSchema = z22.object({
|
|
3642
|
+
project_id: z22.number().int().positive(),
|
|
3643
|
+
environment: z22.string().max(64),
|
|
3644
|
+
service_name: z22.string().max(TELEMETRY_LIMITS.serviceNameMaxChars),
|
|
3645
|
+
sdk_language: sdkLabel,
|
|
3646
|
+
sdk_name: sdkLabel,
|
|
3647
|
+
sdk_version: sdkLabel,
|
|
3648
|
+
signals: z22.array(z22.enum(TELEMETRY_SIGNALS)).min(1).max(TELEMETRY_SIGNALS.length),
|
|
3649
|
+
first_seen: z22.number().int().positive(),
|
|
3650
|
+
last_seen: z22.number().int().positive()
|
|
3651
|
+
});
|
|
3652
|
+
var servicesSeenReportSchema = z22.object({
|
|
3653
|
+
project_id: z22.number().int().positive(),
|
|
3654
|
+
services: z22.array(serviceSeenSchema.omit({ project_id: true })).max(TELEMETRY_LIMITS.servicesPerProject)
|
|
3655
|
+
});
|
|
3656
|
+
var telemetryUsageReportSchema = z22.object({
|
|
3657
|
+
project_id: z22.number().int().positive(),
|
|
3658
|
+
day: z22.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
3659
|
+
rows: z22.array(z22.object({
|
|
3660
|
+
signal: z22.enum(TELEMETRY_SIGNALS),
|
|
3661
|
+
reason: z22.enum(TELEMETRY_REASONS),
|
|
3662
|
+
records: z22.number().int().nonnegative(),
|
|
3663
|
+
bytes: z22.number().int().nonnegative()
|
|
3664
|
+
})).max(TELEMETRY_SIGNALS.length * TELEMETRY_REASONS.length),
|
|
3665
|
+
retention_effective_days: z22.object({
|
|
3666
|
+
traces: z22.number().int().nonnegative(),
|
|
3667
|
+
logs: z22.number().int().nonnegative(),
|
|
3668
|
+
metrics: z22.number().int().nonnegative().optional()
|
|
3669
|
+
}).optional()
|
|
3670
|
+
});
|
|
3671
|
+
var ingestKeyUsedSchema = z22.object({
|
|
3672
|
+
key_id: z22.guid(),
|
|
3673
|
+
project_id: z22.number().int().positive(),
|
|
3674
|
+
used_at: z22.string().datetime()
|
|
3675
|
+
});
|
|
3676
|
+
var telemetryReceiptSchema = z22.object({
|
|
3677
|
+
project_id: z22.number().int().positive(),
|
|
3678
|
+
verification_id: z22.string().regex(/^bv1_[0-9a-f]{32}$/),
|
|
3679
|
+
signal: z22.enum(TELEMETRY_SIGNALS),
|
|
3680
|
+
environment: z22.string().max(64),
|
|
3681
|
+
service_name: z22.string().max(TELEMETRY_LIMITS.serviceNameMaxChars),
|
|
3682
|
+
sdk_name: sdkLabel,
|
|
3683
|
+
sdk_version: sdkLabel,
|
|
3684
|
+
received_at: z22.string().datetime()
|
|
3685
|
+
});
|
|
3686
|
+
|
|
3687
|
+
// ../src/shared/contracts/web-vitals.ts
|
|
3688
|
+
import { z as z23 } from "zod";
|
|
3421
3689
|
|
|
3422
3690
|
// ../src/shared/contracts/vocab/web-vitals.ts
|
|
3423
3691
|
var WEB_VITAL_NAMES = ["LCP", "INP", "CLS", "FCP", "TTFB"];
|
|
@@ -3436,214 +3704,222 @@ var WEB_VITAL_LIMITS = {
|
|
|
3436
3704
|
maxWindowMs: 7 * 24 * 3600 * 1000,
|
|
3437
3705
|
defaultWindowMs: 24 * 3600 * 1000
|
|
3438
3706
|
};
|
|
3439
|
-
var ratingCounts =
|
|
3440
|
-
good:
|
|
3441
|
-
needs_improvement:
|
|
3442
|
-
poor:
|
|
3443
|
-
});
|
|
3444
|
-
var webVitalSummarySchema =
|
|
3445
|
-
name:
|
|
3446
|
-
metric:
|
|
3447
|
-
unit:
|
|
3448
|
-
samples:
|
|
3449
|
-
p75:
|
|
3450
|
-
rating:
|
|
3451
|
-
estimate:
|
|
3707
|
+
var ratingCounts = z23.object({
|
|
3708
|
+
good: z23.number().int().nonnegative(),
|
|
3709
|
+
needs_improvement: z23.number().int().nonnegative(),
|
|
3710
|
+
poor: z23.number().int().nonnegative()
|
|
3711
|
+
});
|
|
3712
|
+
var webVitalSummarySchema = z23.object({
|
|
3713
|
+
name: z23.enum(WEB_VITAL_NAMES),
|
|
3714
|
+
metric: z23.string(),
|
|
3715
|
+
unit: z23.enum(["ms", "1"]),
|
|
3716
|
+
samples: z23.number().int().nonnegative(),
|
|
3717
|
+
p75: z23.number().nullable(),
|
|
3718
|
+
rating: z23.enum(WEB_VITAL_RATINGS).nullable(),
|
|
3719
|
+
estimate: z23.boolean(),
|
|
3452
3720
|
ratings: ratingCounts,
|
|
3453
|
-
distribution:
|
|
3454
|
-
routes:
|
|
3455
|
-
path:
|
|
3456
|
-
samples:
|
|
3457
|
-
p75:
|
|
3458
|
-
rating:
|
|
3721
|
+
distribution: z23.array(z23.object({ le: z23.number().nullable(), count: z23.number().int().nonnegative() })),
|
|
3722
|
+
routes: z23.array(z23.object({
|
|
3723
|
+
path: z23.string(),
|
|
3724
|
+
samples: z23.number().int().nonnegative(),
|
|
3725
|
+
p75: z23.number().nullable(),
|
|
3726
|
+
rating: z23.enum(WEB_VITAL_RATINGS).nullable()
|
|
3459
3727
|
})),
|
|
3460
|
-
routes_total:
|
|
3461
|
-
attribution:
|
|
3728
|
+
routes_total: z23.number().int().nonnegative(),
|
|
3729
|
+
attribution: z23.array(z23.object({ target: z23.string(), samples: z23.number().int().nonnegative(), p75: z23.number().nullable() }))
|
|
3462
3730
|
});
|
|
3463
|
-
var webVitalsSummarySchema =
|
|
3464
|
-
from:
|
|
3465
|
-
to:
|
|
3466
|
-
path:
|
|
3467
|
-
vitals:
|
|
3468
|
-
complete:
|
|
3731
|
+
var webVitalsSummarySchema = z23.object({
|
|
3732
|
+
from: z23.string(),
|
|
3733
|
+
to: z23.string(),
|
|
3734
|
+
path: z23.string().nullable(),
|
|
3735
|
+
vitals: z23.array(webVitalSummarySchema),
|
|
3736
|
+
complete: z23.boolean()
|
|
3469
3737
|
});
|
|
3470
3738
|
|
|
3471
3739
|
// ../src/shared/contracts/api-ops/node-data.ts
|
|
3472
|
-
var issueId =
|
|
3473
|
-
var csv =
|
|
3474
|
-
var projectIds2 =
|
|
3475
|
-
var name2 =
|
|
3476
|
-
var period =
|
|
3477
|
-
var nodeCursor =
|
|
3740
|
+
var issueId = z24.number().int().positive();
|
|
3741
|
+
var csv = z24.string().min(1).max(2000);
|
|
3742
|
+
var projectIds2 = z24.string().max(2000).regex(/^[1-9][0-9]{0,15}(?:,[1-9][0-9]{0,15}){0,99}$/, "comma-separated project ids");
|
|
3743
|
+
var name2 = z24.string().min(1).max(256);
|
|
3744
|
+
var period = z24.enum(["1h", "24h", "7d", "14d", "30d"]);
|
|
3745
|
+
var nodeCursor = z24.string().min(1).max(600).optional();
|
|
3478
3746
|
var windowFields = {
|
|
3479
|
-
start:
|
|
3480
|
-
end:
|
|
3747
|
+
start: z24.string().max(40).optional(),
|
|
3748
|
+
end: z24.string().max(40).optional()
|
|
3481
3749
|
};
|
|
3482
|
-
var
|
|
3483
|
-
var
|
|
3484
|
-
var
|
|
3750
|
+
var traceId2 = z24.string().regex(/^[0-9a-fA-F]{32}$/);
|
|
3751
|
+
var spanId2 = z24.string().regex(/^[0-9a-fA-F]{16}$/);
|
|
3752
|
+
var attrs2 = z24.string().max(2000).optional();
|
|
3753
|
+
var facetKey = ATTR_KEY_RE.source.slice(1, -1);
|
|
3754
|
+
var facetKeysRe = new RegExp(`^${facetKey}(?:,${facetKey}){0,${TELEMETRY_QUERY.facetsMaxKeys - 1}}$`);
|
|
3485
3755
|
var telemetryCommon = {
|
|
3486
3756
|
...windowFields,
|
|
3487
3757
|
project: projectIds2.optional(),
|
|
3488
3758
|
environment: csv.optional(),
|
|
3489
3759
|
service: csv.optional(),
|
|
3490
|
-
attrs
|
|
3760
|
+
attrs: attrs2
|
|
3491
3761
|
};
|
|
3492
|
-
var issueChange =
|
|
3493
|
-
|
|
3494
|
-
action:
|
|
3495
|
-
inNextRelease:
|
|
3762
|
+
var issueChange = z24.union([
|
|
3763
|
+
z24.object({
|
|
3764
|
+
action: z24.literal("resolve"),
|
|
3765
|
+
inNextRelease: z24.boolean().optional(),
|
|
3496
3766
|
inRelease: releaseNameSchema.optional()
|
|
3497
3767
|
}),
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
action:
|
|
3502
|
-
mode:
|
|
3503
|
-
events:
|
|
3504
|
-
users:
|
|
3505
|
-
until:
|
|
3506
|
-
}),
|
|
3507
|
-
|
|
3508
|
-
|
|
3768
|
+
z24.object({ action: z24.literal("unresolve") }),
|
|
3769
|
+
z24.object({ action: z24.literal("archive"), mode: z24.enum(["until_escalating", "forever"]) }),
|
|
3770
|
+
z24.object({
|
|
3771
|
+
action: z24.literal("archive"),
|
|
3772
|
+
mode: z24.literal("until_condition"),
|
|
3773
|
+
events: z24.number().int().min(1).max(1e6).optional(),
|
|
3774
|
+
users: z24.number().int().min(1).max(1e5).optional(),
|
|
3775
|
+
until: z24.string().datetime().optional()
|
|
3776
|
+
}),
|
|
3777
|
+
z24.object({ action: z24.literal("assign"), userId: z24.guid().nullable() }),
|
|
3778
|
+
z24.object({ action: z24.literal("priority"), priority: z24.enum(["low", "medium", "high"]) })
|
|
3509
3779
|
]);
|
|
3510
3780
|
var NODE_INPUTS = {
|
|
3511
|
-
issuesList:
|
|
3781
|
+
issuesList: z24.object({
|
|
3512
3782
|
project: projectIds2.optional(),
|
|
3513
|
-
status:
|
|
3783
|
+
status: z24.enum(["unresolved", "resolved", "archived", "all"]).optional(),
|
|
3514
3784
|
level: csv.optional(),
|
|
3515
3785
|
priority: csv.optional(),
|
|
3516
3786
|
environment: csv.optional(),
|
|
3517
3787
|
release: csv.optional(),
|
|
3518
|
-
assignee:
|
|
3788
|
+
assignee: z24.string().max(64).optional(),
|
|
3519
3789
|
period: period.optional(),
|
|
3520
|
-
q:
|
|
3521
|
-
sort:
|
|
3790
|
+
q: z24.string().max(200).optional(),
|
|
3791
|
+
sort: z24.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
|
|
3522
3792
|
cursor: nodeCursor,
|
|
3523
|
-
limit:
|
|
3793
|
+
limit: z24.number().int().min(1).max(100).optional()
|
|
3524
3794
|
}),
|
|
3525
|
-
issue:
|
|
3526
|
-
issueStats:
|
|
3527
|
-
issueEvents:
|
|
3528
|
-
issueEvent:
|
|
3795
|
+
issue: z24.object({ issueId }),
|
|
3796
|
+
issueStats: z24.object({ issueId, range: z24.enum(["24h", "30d"]).optional() }),
|
|
3797
|
+
issueEvents: z24.object({ issueId, cursor: nodeCursor }),
|
|
3798
|
+
issueEvent: z24.object({
|
|
3529
3799
|
issueId,
|
|
3530
|
-
eventId:
|
|
3800
|
+
eventId: z24.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
|
|
3531
3801
|
}),
|
|
3532
|
-
issueUpdate:
|
|
3533
|
-
issuesBulk:
|
|
3534
|
-
issueIds:
|
|
3802
|
+
issueUpdate: z24.object({ issueId, change: issueChange }),
|
|
3803
|
+
issuesBulk: z24.object({
|
|
3804
|
+
issueIds: z24.array(issueId).min(1).max(100),
|
|
3535
3805
|
action: issueChange
|
|
3536
3806
|
}),
|
|
3537
|
-
spansList:
|
|
3807
|
+
spansList: z24.object({
|
|
3538
3808
|
...telemetryCommon,
|
|
3539
|
-
operation:
|
|
3540
|
-
status:
|
|
3541
|
-
kind:
|
|
3542
|
-
minDurationMs:
|
|
3543
|
-
maxDurationMs:
|
|
3544
|
-
mode:
|
|
3809
|
+
operation: z24.string().min(1).max(1024).optional(),
|
|
3810
|
+
status: z24.enum(["unset", "ok", "error"]).optional(),
|
|
3811
|
+
kind: z24.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
|
|
3812
|
+
minDurationMs: z24.number().min(0).max(86400000).optional(),
|
|
3813
|
+
maxDurationMs: z24.number().min(0).max(86400000).optional(),
|
|
3814
|
+
mode: z24.enum(["spans", "traces"]).optional(),
|
|
3545
3815
|
cursor: nodeCursor
|
|
3546
3816
|
}),
|
|
3547
|
-
spansHistogram:
|
|
3817
|
+
spansHistogram: z24.object({
|
|
3548
3818
|
...telemetryCommon,
|
|
3549
|
-
operation:
|
|
3550
|
-
status:
|
|
3819
|
+
operation: z24.string().min(1).max(1024).optional(),
|
|
3820
|
+
status: z24.enum(["unset", "ok", "error"]).optional()
|
|
3551
3821
|
}),
|
|
3552
|
-
trace:
|
|
3553
|
-
traceSpans:
|
|
3554
|
-
span:
|
|
3555
|
-
logsList:
|
|
3822
|
+
trace: z24.object({ traceId: traceId2 }),
|
|
3823
|
+
traceSpans: z24.object({ traceId: traceId2, errorsOnly: z24.enum(["1"]).optional(), ...windowFields }),
|
|
3824
|
+
span: z24.object({ traceId: traceId2, spanId: spanId2, ...windowFields }),
|
|
3825
|
+
logsList: z24.object({
|
|
3556
3826
|
...telemetryCommon,
|
|
3557
|
-
severityMin:
|
|
3558
|
-
traceId:
|
|
3559
|
-
spanId:
|
|
3560
|
-
q:
|
|
3561
|
-
order:
|
|
3827
|
+
severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
|
|
3828
|
+
traceId: traceId2.optional(),
|
|
3829
|
+
spanId: spanId2.optional(),
|
|
3830
|
+
q: z24.string().max(500).optional(),
|
|
3831
|
+
order: z24.enum(["asc", "desc"]).optional(),
|
|
3562
3832
|
cursor: nodeCursor
|
|
3563
3833
|
}),
|
|
3564
|
-
|
|
3834
|
+
logsHistogram: z24.object({
|
|
3565
3835
|
...telemetryCommon,
|
|
3566
|
-
severityMin:
|
|
3567
|
-
q:
|
|
3568
|
-
}),
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3836
|
+
severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
|
|
3837
|
+
q: z24.string().max(500).optional()
|
|
3838
|
+
}),
|
|
3839
|
+
logsFacets: z24.object({
|
|
3840
|
+
...telemetryCommon,
|
|
3841
|
+
severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
|
|
3842
|
+
q: z24.string().max(500).optional(),
|
|
3843
|
+
keys: z24.string().regex(facetKeysRe, `up to ${TELEMETRY_QUERY.facetsMaxKeys} comma-separated keys`).default(LOG_BUILTIN_FACETS.join(","))
|
|
3844
|
+
}),
|
|
3845
|
+
logAround: z24.object({
|
|
3846
|
+
logId: z24.guid(),
|
|
3847
|
+
at: z24.string().max(40),
|
|
3848
|
+
same: z24.enum(["service", "trace"]).optional(),
|
|
3849
|
+
before: z24.number().int().min(0).max(200).optional(),
|
|
3850
|
+
after: z24.number().int().min(0).max(200).optional()
|
|
3851
|
+
}),
|
|
3852
|
+
metricsNames: z24.object({
|
|
3853
|
+
project: z24.number().int().positive(),
|
|
3578
3854
|
environment: csv.optional(),
|
|
3579
|
-
q:
|
|
3855
|
+
q: z24.string().max(255).optional()
|
|
3580
3856
|
}),
|
|
3581
|
-
metricsSeries:
|
|
3582
|
-
project:
|
|
3583
|
-
name:
|
|
3857
|
+
metricsSeries: z24.object({
|
|
3858
|
+
project: z24.number().int().positive(),
|
|
3859
|
+
name: z24.string().regex(METRIC_NAME_RE),
|
|
3584
3860
|
environment: csv.optional(),
|
|
3585
|
-
attrs,
|
|
3586
|
-
cursor:
|
|
3861
|
+
attrs: attrs2,
|
|
3862
|
+
cursor: z24.string().regex(/^[0-9a-f]{16}$/).optional()
|
|
3587
3863
|
}),
|
|
3588
|
-
metricsQuery:
|
|
3589
|
-
project:
|
|
3590
|
-
name:
|
|
3591
|
-
aggregation:
|
|
3864
|
+
metricsQuery: z24.object({
|
|
3865
|
+
project: z24.number().int().positive(),
|
|
3866
|
+
name: z24.string().regex(METRIC_NAME_RE),
|
|
3867
|
+
aggregation: z24.enum(METRIC_AGGREGATIONS),
|
|
3592
3868
|
...windowFields,
|
|
3593
|
-
step:
|
|
3594
|
-
attrs,
|
|
3595
|
-
groupBy:
|
|
3869
|
+
step: z24.number().int().min(METRIC_QUERY.minStepSeconds).max(METRIC_QUERY.maxStepSeconds).multipleOf(60).optional(),
|
|
3870
|
+
attrs: attrs2,
|
|
3871
|
+
groupBy: z24.string().min(1).max(600).optional(),
|
|
3596
3872
|
environment: csv.optional()
|
|
3597
3873
|
}),
|
|
3598
|
-
telemetryUsage:
|
|
3874
|
+
telemetryUsage: z24.object({
|
|
3599
3875
|
project: projectIds2.optional(),
|
|
3600
|
-
days:
|
|
3876
|
+
days: z24.number().int().min(1).max(31).optional()
|
|
3601
3877
|
}),
|
|
3602
|
-
monitorSignal:
|
|
3603
|
-
monitorId:
|
|
3604
|
-
hours:
|
|
3878
|
+
monitorSignal: z24.object({
|
|
3879
|
+
monitorId: z24.guid(),
|
|
3880
|
+
hours: z24.number().int().min(1).max(24).optional()
|
|
3605
3881
|
}),
|
|
3606
|
-
monitorOccurrences:
|
|
3607
|
-
monitorId:
|
|
3608
|
-
state:
|
|
3609
|
-
environment:
|
|
3882
|
+
monitorOccurrences: z24.object({
|
|
3883
|
+
monitorId: z24.guid(),
|
|
3884
|
+
state: z24.enum(["open", "finished", "all"]).optional(),
|
|
3885
|
+
environment: z24.string().min(1).max(64).optional(),
|
|
3610
3886
|
cursor: nodeCursor
|
|
3611
3887
|
}),
|
|
3612
|
-
monitorBacktest:
|
|
3613
|
-
project:
|
|
3888
|
+
monitorBacktest: z24.object({
|
|
3889
|
+
project: z24.number().int().positive(),
|
|
3614
3890
|
settings: backtestSettingsSchema
|
|
3615
3891
|
}),
|
|
3616
|
-
occurrenceCreate:
|
|
3617
|
-
project:
|
|
3892
|
+
occurrenceCreate: z24.object({
|
|
3893
|
+
project: z24.number().int().positive(),
|
|
3618
3894
|
monitorSlug: occurrenceInputSchema.shape.monitor_slug,
|
|
3619
3895
|
occurrenceId: occurrenceInputSchema.shape.occurrence_id,
|
|
3620
3896
|
dueAt: occurrenceInputSchema.shape.due_at,
|
|
3621
3897
|
environment: occurrenceInputSchema.shape.environment
|
|
3622
3898
|
}),
|
|
3623
|
-
occurrenceCancel:
|
|
3624
|
-
project:
|
|
3625
|
-
monitorSlug:
|
|
3626
|
-
occurrenceId:
|
|
3627
|
-
environment:
|
|
3899
|
+
occurrenceCancel: z24.object({
|
|
3900
|
+
project: z24.number().int().positive(),
|
|
3901
|
+
monitorSlug: z24.string().regex(SLUG_RE),
|
|
3902
|
+
occurrenceId: z24.string().regex(OCCURRENCE_ID_RE),
|
|
3903
|
+
environment: z24.string().min(1).max(64).optional()
|
|
3628
3904
|
}),
|
|
3629
|
-
webVitals:
|
|
3630
|
-
project:
|
|
3905
|
+
webVitals: z24.object({
|
|
3906
|
+
project: z24.number().int().positive(),
|
|
3631
3907
|
...windowFields,
|
|
3632
3908
|
environment: csv.optional(),
|
|
3633
|
-
path:
|
|
3909
|
+
path: z24.string().max(WEB_VITAL_LIMITS.pathMaxChars).regex(/^(?:\/[^\s?#]*|other)$/).optional()
|
|
3634
3910
|
}),
|
|
3635
|
-
releasesList:
|
|
3636
|
-
project:
|
|
3911
|
+
releasesList: z24.object({
|
|
3912
|
+
project: z24.number().int().positive(),
|
|
3637
3913
|
environment: environmentNameSchema.optional()
|
|
3638
3914
|
}),
|
|
3639
|
-
releaseHealth:
|
|
3640
|
-
project:
|
|
3915
|
+
releaseHealth: z24.object({
|
|
3916
|
+
project: z24.number().int().positive(),
|
|
3641
3917
|
version: releaseNameSchema,
|
|
3642
3918
|
environment: environmentNameSchema.optional(),
|
|
3643
3919
|
compare: releaseNameSchema.optional()
|
|
3644
3920
|
}),
|
|
3645
|
-
deploymentCreate:
|
|
3646
|
-
project:
|
|
3921
|
+
deploymentCreate: z24.object({
|
|
3922
|
+
project: z24.number().int().positive(),
|
|
3647
3923
|
version: deploymentInputSchema.shape.version,
|
|
3648
3924
|
environment: deploymentInputSchema.shape.environment,
|
|
3649
3925
|
name: deploymentInputSchema.shape.name,
|
|
@@ -3652,10 +3928,10 @@ var NODE_INPUTS = {
|
|
|
3652
3928
|
finishedAt: deploymentInputSchema.shape.finished_at,
|
|
3653
3929
|
deployId: deploymentInputSchema.shape.deploy_id
|
|
3654
3930
|
}),
|
|
3655
|
-
ticket:
|
|
3656
|
-
scope:
|
|
3657
|
-
project:
|
|
3658
|
-
environment:
|
|
3931
|
+
ticket: z24.object({
|
|
3932
|
+
scope: z24.enum(["read", "write"]).default("read"),
|
|
3933
|
+
project: z24.number().int().positive().optional(),
|
|
3934
|
+
environment: z24.string().min(1).max(64).optional()
|
|
3659
3935
|
})
|
|
3660
3936
|
};
|
|
3661
3937
|
var N = NODE_INPUTS;
|
|
@@ -3740,7 +4016,7 @@ var NODE_OPERATIONS = [
|
|
|
3740
4016
|
path: "/v1/spans",
|
|
3741
4017
|
scope: "traces:read",
|
|
3742
4018
|
input: N.spansList,
|
|
3743
|
-
node: { path: "q/spans", list: "spans", window: true },
|
|
4019
|
+
node: { path: "q/spans", list: "spans", modeLists: ["traces"], window: true },
|
|
3744
4020
|
paged: true,
|
|
3745
4021
|
summary: "Spans (or whole traces with `mode=traces`) in a window of at most 7 days."
|
|
3746
4022
|
}),
|
|
@@ -3795,7 +4071,7 @@ var NODE_OPERATIONS = [
|
|
|
3795
4071
|
id: "logs.histogram",
|
|
3796
4072
|
path: "/v1/logs/histogram",
|
|
3797
4073
|
scope: "logs:read",
|
|
3798
|
-
input: N.
|
|
4074
|
+
input: N.logsHistogram,
|
|
3799
4075
|
node: { path: "q/logs/histogram", window: true },
|
|
3800
4076
|
summary: "Log counts by severity over a window."
|
|
3801
4077
|
}),
|
|
@@ -3992,10 +4268,10 @@ var NODE_OPERATIONS = [
|
|
|
3992
4268
|
];
|
|
3993
4269
|
|
|
3994
4270
|
// ../src/shared/contracts/api-ops/privacy.ts
|
|
3995
|
-
import { z as
|
|
4271
|
+
import { z as z26 } from "zod";
|
|
3996
4272
|
|
|
3997
4273
|
// ../src/shared/contracts/privacy.ts
|
|
3998
|
-
import { z as
|
|
4274
|
+
import { z as z25 } from "zod";
|
|
3999
4275
|
|
|
4000
4276
|
// ../src/shared/privacy/rules.ts
|
|
4001
4277
|
var PRIVACY_SCHEMA = 1;
|
|
@@ -4026,46 +4302,46 @@ var REMOVE = Symbol("remove");
|
|
|
4026
4302
|
|
|
4027
4303
|
// ../src/shared/contracts/privacy.ts
|
|
4028
4304
|
var PRIVACY_KEY_MAX_VERSION = 1e6;
|
|
4029
|
-
var ruleId =
|
|
4030
|
-
var privacyRuleInputSchema =
|
|
4305
|
+
var ruleId = z25.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
|
|
4306
|
+
var privacyRuleInputSchema = z25.object({
|
|
4031
4307
|
id: ruleId,
|
|
4032
|
-
selector:
|
|
4033
|
-
type:
|
|
4034
|
-
method:
|
|
4035
|
-
pattern:
|
|
4036
|
-
ignoreCase:
|
|
4037
|
-
replaceWith:
|
|
4038
|
-
enabled:
|
|
4039
|
-
});
|
|
4040
|
-
var privacyPolicyInputSchema =
|
|
4041
|
-
mode:
|
|
4042
|
-
rules:
|
|
4043
|
-
allowlist:
|
|
4044
|
-
});
|
|
4045
|
-
var storedPolicySchema =
|
|
4046
|
-
schema:
|
|
4047
|
-
version:
|
|
4048
|
-
mode:
|
|
4049
|
-
rules:
|
|
4050
|
-
allowlist:
|
|
4051
|
-
});
|
|
4052
|
-
var nodePrivacyBlockSchema =
|
|
4053
|
-
var privacyRollupSchema =
|
|
4054
|
-
applied_version:
|
|
4055
|
-
policy_missing_24h:
|
|
4056
|
-
budget_exceeded_24h:
|
|
4057
|
-
sdk_versions:
|
|
4058
|
-
key_version:
|
|
4059
|
-
key_created_at:
|
|
4308
|
+
selector: z25.string().min(1).max(PRIVACY_LIMITS.selector),
|
|
4309
|
+
type: z25.enum(PRIVACY_RULE_TYPES),
|
|
4310
|
+
method: z25.enum(PRIVACY_METHODS),
|
|
4311
|
+
pattern: z25.string().min(1).max(PRIVACY_LIMITS.pattern).optional(),
|
|
4312
|
+
ignoreCase: z25.boolean().optional(),
|
|
4313
|
+
replaceWith: z25.string().max(PRIVACY_LIMITS.replaceWith).optional(),
|
|
4314
|
+
enabled: z25.boolean().optional()
|
|
4315
|
+
});
|
|
4316
|
+
var privacyPolicyInputSchema = z25.object({
|
|
4317
|
+
mode: z25.enum(PRIVACY_MODES),
|
|
4318
|
+
rules: z25.array(privacyRuleInputSchema).max(PRIVACY_LIMITS.rules),
|
|
4319
|
+
allowlist: z25.array(z25.string().min(1).max(PRIVACY_LIMITS.selector)).max(PRIVACY_LIMITS.allowlist)
|
|
4320
|
+
});
|
|
4321
|
+
var storedPolicySchema = z25.object({
|
|
4322
|
+
schema: z25.literal(PRIVACY_SCHEMA),
|
|
4323
|
+
version: z25.number().int().min(0),
|
|
4324
|
+
mode: z25.enum(PRIVACY_MODES),
|
|
4325
|
+
rules: z25.array(z25.record(z25.string(), z25.unknown())).max(PRIVACY_LIMITS.rules),
|
|
4326
|
+
allowlist: z25.array(z25.string()).max(PRIVACY_LIMITS.allowlist)
|
|
4327
|
+
});
|
|
4328
|
+
var nodePrivacyBlockSchema = z25.array(z25.object({ project_id: z25.number().int().positive(), policy: z25.unknown() })).max(1000);
|
|
4329
|
+
var privacyRollupSchema = z25.object({
|
|
4330
|
+
applied_version: z25.number().int().min(0).nullable(),
|
|
4331
|
+
policy_missing_24h: z25.number().int().nonnegative(),
|
|
4332
|
+
budget_exceeded_24h: z25.number().int().nonnegative(),
|
|
4333
|
+
sdk_versions: z25.array(z25.object({ version: z25.number().int().min(0), last_seen_at: z25.string().datetime() })).max(5),
|
|
4334
|
+
key_version: z25.number().int().min(1).max(PRIVACY_KEY_MAX_VERSION).optional(),
|
|
4335
|
+
key_created_at: z25.string().datetime().nullable().optional()
|
|
4060
4336
|
});
|
|
4061
4337
|
|
|
4062
4338
|
// ../src/shared/contracts/api-ops/privacy.ts
|
|
4063
4339
|
var PRIVACY_INPUTS = {
|
|
4064
|
-
get:
|
|
4065
|
-
set:
|
|
4340
|
+
get: z26.object({ workspaceId: uuid, projectId }),
|
|
4341
|
+
set: z26.object({
|
|
4066
4342
|
workspaceId: uuid,
|
|
4067
4343
|
projectId,
|
|
4068
|
-
expectedVersion:
|
|
4344
|
+
expectedVersion: z26.number().int().min(0),
|
|
4069
4345
|
policy: privacyPolicyInputSchema
|
|
4070
4346
|
})
|
|
4071
4347
|
};
|
|
@@ -4105,105 +4381,109 @@ var PRIVACY_OPERATIONS = [
|
|
|
4105
4381
|
];
|
|
4106
4382
|
|
|
4107
4383
|
// ../src/shared/contracts/api-ops/projects.ts
|
|
4108
|
-
import { z as
|
|
4384
|
+
import { z as z30 } from "zod";
|
|
4109
4385
|
|
|
4110
4386
|
// ../src/shared/contracts/ingest-keys.ts
|
|
4111
|
-
import { z as
|
|
4387
|
+
import { z as z27 } from "zod";
|
|
4112
4388
|
var INGEST_KEY_SCOPES = ["traces", "logs", "metrics", "errors", "monitors"];
|
|
4113
4389
|
var INGEST_KEY_STATES = ["active", "revoked"];
|
|
4114
4390
|
var INGEST_KEY_LIMITS = {
|
|
4115
4391
|
nameMaxChars: 80,
|
|
4116
4392
|
environmentsMax: 20,
|
|
4117
4393
|
environmentMaxChars: 64,
|
|
4118
|
-
|
|
4394
|
+
revocationSeconds: 60,
|
|
4395
|
+
publishIntervalSeconds: 10,
|
|
4396
|
+
kvCacheTtlSeconds: 30,
|
|
4397
|
+
isolateCacheSeconds: 15
|
|
4119
4398
|
};
|
|
4399
|
+
var INGEST_KEY_REVOCATION_WORST_SECONDS = INGEST_KEY_LIMITS.publishIntervalSeconds + INGEST_KEY_LIMITS.kvCacheTtlSeconds + INGEST_KEY_LIMITS.isolateCacheSeconds;
|
|
4120
4400
|
var CHECKIN_AUTH_MODES = ["public_or_key", "key_only"];
|
|
4121
|
-
var ingestKeyConfigSchema =
|
|
4122
|
-
v:
|
|
4123
|
-
key_id:
|
|
4124
|
-
project_public_id:
|
|
4125
|
-
project_id:
|
|
4126
|
-
workspace_id:
|
|
4401
|
+
var ingestKeyConfigSchema = z27.object({
|
|
4402
|
+
v: z27.literal(1),
|
|
4403
|
+
key_id: z27.guid(),
|
|
4404
|
+
project_public_id: z27.number().int().positive(),
|
|
4405
|
+
project_id: z27.number().int().positive(),
|
|
4406
|
+
workspace_id: z27.guid(),
|
|
4127
4407
|
node_id: nodeIdSchema,
|
|
4128
|
-
scopes:
|
|
4129
|
-
environments:
|
|
4130
|
-
expires_at:
|
|
4131
|
-
state:
|
|
4132
|
-
workspace_status:
|
|
4133
|
-
ingest_kill:
|
|
4134
|
-
telemetry_kill:
|
|
4135
|
-
telemetry_rate_bytes_per_sec:
|
|
4136
|
-
telemetry_burst_bytes:
|
|
4137
|
-
traces_monthly_bytes:
|
|
4138
|
-
logs_monthly_bytes:
|
|
4139
|
-
metrics_monthly_bytes:
|
|
4140
|
-
telemetry_buffer_minutes:
|
|
4141
|
-
revision:
|
|
4142
|
-
});
|
|
4143
|
-
var createIngestKeyInputSchema =
|
|
4144
|
-
projectId:
|
|
4145
|
-
name:
|
|
4146
|
-
scopes:
|
|
4147
|
-
environments:
|
|
4148
|
-
expiresAt:
|
|
4149
|
-
});
|
|
4150
|
-
var ingestKeyRowSchema =
|
|
4151
|
-
id:
|
|
4152
|
-
project_id:
|
|
4153
|
-
name:
|
|
4154
|
-
prefix:
|
|
4155
|
-
scopes:
|
|
4156
|
-
environments:
|
|
4157
|
-
expires_at:
|
|
4158
|
-
state:
|
|
4159
|
-
created_by:
|
|
4160
|
-
created_at:
|
|
4161
|
-
revoked_at:
|
|
4162
|
-
last_used_at:
|
|
4408
|
+
scopes: z27.array(z27.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
|
|
4409
|
+
environments: z27.array(z27.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
|
|
4410
|
+
expires_at: z27.string().datetime({ offset: true }).nullable(),
|
|
4411
|
+
state: z27.enum(INGEST_KEY_STATES),
|
|
4412
|
+
workspace_status: z27.enum(["active", "suspended", "deleting"]),
|
|
4413
|
+
ingest_kill: z27.boolean(),
|
|
4414
|
+
telemetry_kill: z27.boolean(),
|
|
4415
|
+
telemetry_rate_bytes_per_sec: z27.number().int().positive(),
|
|
4416
|
+
telemetry_burst_bytes: z27.number().int().positive(),
|
|
4417
|
+
traces_monthly_bytes: z27.number().int().positive(),
|
|
4418
|
+
logs_monthly_bytes: z27.number().int().positive(),
|
|
4419
|
+
metrics_monthly_bytes: z27.number().int().positive().optional(),
|
|
4420
|
+
telemetry_buffer_minutes: z27.number().int().min(1).max(1440),
|
|
4421
|
+
revision: z27.number().int().nonnegative()
|
|
4422
|
+
});
|
|
4423
|
+
var createIngestKeyInputSchema = z27.object({
|
|
4424
|
+
projectId: z27.number().int().positive(),
|
|
4425
|
+
name: z27.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
|
|
4426
|
+
scopes: z27.array(z27.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
|
|
4427
|
+
environments: z27.array(z27.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
|
|
4428
|
+
expiresAt: z27.string().datetime({ offset: true }).nullable()
|
|
4429
|
+
});
|
|
4430
|
+
var ingestKeyRowSchema = z27.object({
|
|
4431
|
+
id: z27.guid(),
|
|
4432
|
+
project_id: z27.number().int().positive(),
|
|
4433
|
+
name: z27.string(),
|
|
4434
|
+
prefix: z27.string(),
|
|
4435
|
+
scopes: z27.array(z27.enum(INGEST_KEY_SCOPES)),
|
|
4436
|
+
environments: z27.array(z27.string()),
|
|
4437
|
+
expires_at: z27.string().nullable(),
|
|
4438
|
+
state: z27.enum(INGEST_KEY_STATES),
|
|
4439
|
+
created_by: z27.guid().nullable(),
|
|
4440
|
+
created_at: z27.string(),
|
|
4441
|
+
revoked_at: z27.string().nullable(),
|
|
4442
|
+
last_used_at: z27.string().nullable()
|
|
4163
4443
|
});
|
|
4164
4444
|
|
|
4165
4445
|
// ../src/shared/contracts/node-config.ts
|
|
4166
|
-
import { z as
|
|
4446
|
+
import { z as z29 } from "zod";
|
|
4167
4447
|
|
|
4168
4448
|
// ../src/shared/contracts/backup.ts
|
|
4169
|
-
import { z as
|
|
4449
|
+
import { z as z28 } from "zod";
|
|
4170
4450
|
var BACKUP_KINDS = ["daily", "weekly", "manual", "pre_upgrade"];
|
|
4171
|
-
var ageRecipient =
|
|
4172
|
-
var backupIdSchema =
|
|
4173
|
-
var nodeBackupConfigSchema =
|
|
4174
|
-
enabled:
|
|
4175
|
-
hour_utc:
|
|
4176
|
-
weekly_day:
|
|
4451
|
+
var ageRecipient = z28.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
|
|
4452
|
+
var backupIdSchema = z28.string().regex(/^[a-z0-9-]{8,64}$/);
|
|
4453
|
+
var nodeBackupConfigSchema = z28.object({
|
|
4454
|
+
enabled: z28.boolean(),
|
|
4455
|
+
hour_utc: z28.number().int().min(0).max(23),
|
|
4456
|
+
weekly_day: z28.number().int().min(1).max(7),
|
|
4177
4457
|
workspace_recipient: ageRecipient
|
|
4178
4458
|
});
|
|
4179
|
-
var backupCredentialsRequestSchema =
|
|
4180
|
-
mode:
|
|
4459
|
+
var backupCredentialsRequestSchema = z28.object({
|
|
4460
|
+
mode: z28.enum(["upload", "download"]),
|
|
4181
4461
|
backup_id: backupIdSchema,
|
|
4182
|
-
source_node_id:
|
|
4183
|
-
});
|
|
4184
|
-
var backupCredentialsSchema =
|
|
4185
|
-
endpoint:
|
|
4186
|
-
bucket:
|
|
4187
|
-
prefix:
|
|
4188
|
-
access_key_id:
|
|
4189
|
-
secret_access_key:
|
|
4190
|
-
session_token:
|
|
4191
|
-
expires_at:
|
|
4192
|
-
});
|
|
4193
|
-
var rowCountsSchema =
|
|
4194
|
-
var backupManifestSchema =
|
|
4195
|
-
v:
|
|
4462
|
+
source_node_id: z28.guid().optional()
|
|
4463
|
+
});
|
|
4464
|
+
var backupCredentialsSchema = z28.object({
|
|
4465
|
+
endpoint: z28.string().url(),
|
|
4466
|
+
bucket: z28.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
|
|
4467
|
+
prefix: z28.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
|
|
4468
|
+
access_key_id: z28.string().min(8).max(200),
|
|
4469
|
+
secret_access_key: z28.string().min(8).max(200),
|
|
4470
|
+
session_token: z28.string().min(8).max(4000),
|
|
4471
|
+
expires_at: z28.string().datetime()
|
|
4472
|
+
});
|
|
4473
|
+
var rowCountsSchema = z28.record(z28.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z28.number().int().nonnegative());
|
|
4474
|
+
var backupManifestSchema = z28.object({
|
|
4475
|
+
v: z28.literal(1),
|
|
4196
4476
|
backup_id: backupIdSchema,
|
|
4197
|
-
node_id:
|
|
4198
|
-
kind:
|
|
4199
|
-
created_at:
|
|
4200
|
-
object_key:
|
|
4201
|
-
size_bytes:
|
|
4202
|
-
sha256:
|
|
4203
|
-
clickhouse_version:
|
|
4204
|
-
schema_version:
|
|
4477
|
+
node_id: z28.guid(),
|
|
4478
|
+
kind: z28.enum(BACKUP_KINDS),
|
|
4479
|
+
created_at: z28.string().datetime(),
|
|
4480
|
+
object_key: z28.string(),
|
|
4481
|
+
size_bytes: z28.number().int().nonnegative(),
|
|
4482
|
+
sha256: z28.string().regex(/^[0-9a-f]{64}$/),
|
|
4483
|
+
clickhouse_version: z28.string().max(40),
|
|
4484
|
+
schema_version: z28.number().int().nonnegative(),
|
|
4205
4485
|
row_counts: rowCountsSchema,
|
|
4206
|
-
recipients:
|
|
4486
|
+
recipients: z28.array(z28.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
|
|
4207
4487
|
});
|
|
4208
4488
|
var BACKUP_ERROR_CODES = [
|
|
4209
4489
|
"CLICKHOUSE_BACKUP_FAILED",
|
|
@@ -4217,51 +4497,51 @@ var BACKUP_ERROR_CODES = [
|
|
|
4217
4497
|
"RESTORE_FAILED",
|
|
4218
4498
|
"ROW_COUNT_MISMATCH"
|
|
4219
4499
|
];
|
|
4220
|
-
var backupReportSchema =
|
|
4500
|
+
var backupReportSchema = z28.object({
|
|
4221
4501
|
backup_id: backupIdSchema,
|
|
4222
|
-
kind:
|
|
4223
|
-
status:
|
|
4224
|
-
started_at:
|
|
4225
|
-
finished_at:
|
|
4502
|
+
kind: z28.enum(BACKUP_KINDS),
|
|
4503
|
+
status: z28.enum(["succeeded", "failed"]),
|
|
4504
|
+
started_at: z28.string().datetime(),
|
|
4505
|
+
finished_at: z28.string().datetime(),
|
|
4226
4506
|
manifest: backupManifestSchema.nullable(),
|
|
4227
|
-
error_code:
|
|
4507
|
+
error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
|
|
4228
4508
|
});
|
|
4229
|
-
var drillReportSchema =
|
|
4509
|
+
var drillReportSchema = z28.object({
|
|
4230
4510
|
backup_id: backupIdSchema,
|
|
4231
|
-
kind:
|
|
4232
|
-
status:
|
|
4233
|
-
finished_at:
|
|
4234
|
-
detail:
|
|
4235
|
-
error_code:
|
|
4511
|
+
kind: z28.enum(["weekly_local", "monthly_new_machine"]),
|
|
4512
|
+
status: z28.enum(["passed", "failed"]),
|
|
4513
|
+
finished_at: z28.string().datetime(),
|
|
4514
|
+
detail: z28.string().max(300),
|
|
4515
|
+
error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
|
|
4236
4516
|
});
|
|
4237
|
-
var nodeIdentityEscrowSchema =
|
|
4238
|
-
v:
|
|
4239
|
-
node_id:
|
|
4240
|
-
seal:
|
|
4241
|
-
publicKey:
|
|
4242
|
-
privateKey:
|
|
4517
|
+
var nodeIdentityEscrowSchema = z28.object({
|
|
4518
|
+
v: z28.literal(1),
|
|
4519
|
+
node_id: z28.guid(),
|
|
4520
|
+
seal: z28.object({
|
|
4521
|
+
publicKey: z28.string().regex(/^[A-Za-z0-9_-]{43}$/),
|
|
4522
|
+
privateKey: z28.string().regex(/^[A-Za-z0-9_-]{43}$/)
|
|
4243
4523
|
}),
|
|
4244
|
-
created_at:
|
|
4524
|
+
created_at: z28.string().datetime()
|
|
4245
4525
|
});
|
|
4246
|
-
var restoreArgsSchema =
|
|
4247
|
-
job_id:
|
|
4248
|
-
workspace_id:
|
|
4249
|
-
source_node_id:
|
|
4526
|
+
var restoreArgsSchema = z28.object({
|
|
4527
|
+
job_id: z28.guid(),
|
|
4528
|
+
workspace_id: z28.guid(),
|
|
4529
|
+
source_node_id: z28.guid(),
|
|
4250
4530
|
manifest: backupManifestSchema,
|
|
4251
|
-
sealed_identity:
|
|
4252
|
-
mode:
|
|
4531
|
+
sealed_identity: z28.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
|
|
4532
|
+
mode: z28.enum(["rebuild", "drill"])
|
|
4253
4533
|
});
|
|
4254
|
-
var restoreReportSchema =
|
|
4255
|
-
job_id:
|
|
4534
|
+
var restoreReportSchema = z28.object({
|
|
4535
|
+
job_id: z28.guid(),
|
|
4256
4536
|
backup_id: backupIdSchema,
|
|
4257
|
-
mode:
|
|
4258
|
-
status:
|
|
4259
|
-
finished_at:
|
|
4260
|
-
detail:
|
|
4261
|
-
error_code:
|
|
4537
|
+
mode: z28.enum(["rebuild", "drill"]),
|
|
4538
|
+
status: z28.enum(["succeeded", "failed"]),
|
|
4539
|
+
finished_at: z28.string().datetime(),
|
|
4540
|
+
detail: z28.string().max(300),
|
|
4541
|
+
error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
|
|
4262
4542
|
});
|
|
4263
4543
|
|
|
4264
|
-
// ../src/shared/contracts/node-config.ts
|
|
4544
|
+
// ../src/shared/contracts/vocab/node-config.ts
|
|
4265
4545
|
var SCRUB_GROUPS = [
|
|
4266
4546
|
"credentials",
|
|
4267
4547
|
"cards",
|
|
@@ -4271,86 +4551,88 @@ var SCRUB_GROUPS = [
|
|
|
4271
4551
|
"user_id",
|
|
4272
4552
|
"headers"
|
|
4273
4553
|
];
|
|
4554
|
+
|
|
4555
|
+
// ../src/shared/contracts/node-config.ts
|
|
4274
4556
|
var MAX_NODE_MONITORS = 5000;
|
|
4275
|
-
var kid =
|
|
4276
|
-
var publicKey =
|
|
4277
|
-
var nodeConfigSchema =
|
|
4278
|
-
v:
|
|
4279
|
-
config_version:
|
|
4280
|
-
node_id:
|
|
4281
|
-
workspace_id:
|
|
4282
|
-
workspace_status:
|
|
4283
|
-
issued_at:
|
|
4284
|
-
retention_days:
|
|
4285
|
-
channel:
|
|
4286
|
-
projects:
|
|
4287
|
-
project_id:
|
|
4288
|
-
slug:
|
|
4289
|
-
short_prefix:
|
|
4290
|
-
user_id_salt:
|
|
4291
|
-
privacy_key_version:
|
|
4292
|
-
scrub_disabled:
|
|
4293
|
-
upload_tokens:
|
|
4294
|
-
hash:
|
|
4295
|
-
expires_at:
|
|
4296
|
-
scopes:
|
|
4557
|
+
var kid = z29.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
|
|
4558
|
+
var publicKey = z29.string().regex(/^[A-Za-z0-9_-]{43}$/);
|
|
4559
|
+
var nodeConfigSchema = z29.object({
|
|
4560
|
+
v: z29.literal(1),
|
|
4561
|
+
config_version: z29.number().int().positive(),
|
|
4562
|
+
node_id: z29.guid(),
|
|
4563
|
+
workspace_id: z29.guid(),
|
|
4564
|
+
workspace_status: z29.enum(["active", "suspended"]),
|
|
4565
|
+
issued_at: z29.string().datetime(),
|
|
4566
|
+
retention_days: z29.number().int().min(1).max(3650),
|
|
4567
|
+
channel: z29.enum(["stable", "canary"]).optional(),
|
|
4568
|
+
projects: z29.array(z29.object({
|
|
4569
|
+
project_id: z29.number().int().positive(),
|
|
4570
|
+
slug: z29.string().max(64),
|
|
4571
|
+
short_prefix: z29.string().regex(/^[A-Z0-9]{1,12}$/),
|
|
4572
|
+
user_id_salt: z29.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
|
|
4573
|
+
privacy_key_version: z29.number().int().min(1).max(PRIVACY_KEY_MAX_VERSION).optional(),
|
|
4574
|
+
scrub_disabled: z29.array(z29.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
|
|
4575
|
+
upload_tokens: z29.array(z29.object({
|
|
4576
|
+
hash: z29.string().regex(/^[a-f0-9]{64}$/),
|
|
4577
|
+
expires_at: z29.string().datetime(),
|
|
4578
|
+
scopes: z29.array(z29.enum(UPLOAD_SCOPES)).min(1).max(UPLOAD_SCOPES.length).optional()
|
|
4297
4579
|
})).max(10).optional()
|
|
4298
4580
|
})).max(1000),
|
|
4299
|
-
ticket_keys:
|
|
4300
|
-
control_ops_keys:
|
|
4301
|
-
kill_switches:
|
|
4581
|
+
ticket_keys: z29.array(z29.object({ kid, public_key: publicKey, not_after: z29.string().datetime() })).min(1).max(5),
|
|
4582
|
+
control_ops_keys: z29.array(z29.object({ kid, public_key: publicKey })).min(1).max(5),
|
|
4583
|
+
kill_switches: z29.object({ ingest: z29.boolean(), alerts: z29.boolean() }),
|
|
4302
4584
|
backup: nodeBackupConfigSchema.optional(),
|
|
4303
|
-
purged_projects:
|
|
4304
|
-
monitors:
|
|
4305
|
-
purged_monitors:
|
|
4306
|
-
telemetry:
|
|
4307
|
-
traces_retention_days:
|
|
4308
|
-
logs_retention_days:
|
|
4309
|
-
traces_disk_share:
|
|
4585
|
+
purged_projects: z29.array(z29.number().int().positive()).max(1000).optional(),
|
|
4586
|
+
monitors: z29.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
|
|
4587
|
+
purged_monitors: z29.array(z29.guid()).max(5000).optional(),
|
|
4588
|
+
telemetry: z29.object({
|
|
4589
|
+
traces_retention_days: z29.number().int().min(1).max(90),
|
|
4590
|
+
logs_retention_days: z29.number().int().min(1).max(90),
|
|
4591
|
+
traces_disk_share: z29.number().min(0.2).max(0.8)
|
|
4310
4592
|
}).optional(),
|
|
4311
4593
|
metrics: metricsConfigSchema.optional(),
|
|
4312
|
-
slos:
|
|
4313
|
-
signal_monitors:
|
|
4594
|
+
slos: z29.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
|
|
4595
|
+
signal_monitors: z29.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
|
|
4314
4596
|
signal_limits: signalLimitsConfigSchema.optional(),
|
|
4315
4597
|
privacy: nodePrivacyBlockSchema.optional()
|
|
4316
4598
|
});
|
|
4317
|
-
var signedNodeConfigSchema =
|
|
4599
|
+
var signedNodeConfigSchema = z29.object({ config: nodeConfigSchema, kid, sig: z29.string() });
|
|
4318
4600
|
|
|
4319
4601
|
// ../src/shared/contracts/api-ops/projects.ts
|
|
4320
|
-
var slug =
|
|
4321
|
-
var name3 =
|
|
4322
|
-
var
|
|
4323
|
-
var platform =
|
|
4324
|
-
var origin =
|
|
4325
|
-
var keyId =
|
|
4602
|
+
var slug = z30.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
|
|
4603
|
+
var name3 = z30.string().trim().min(1).max(60);
|
|
4604
|
+
var label3 = z30.string().trim().min(1).max(40);
|
|
4605
|
+
var platform = z30.enum(PLATFORMS);
|
|
4606
|
+
var origin = z30.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
|
|
4607
|
+
var keyId = z30.number().int().positive();
|
|
4326
4608
|
var PROJECT_INPUTS = {
|
|
4327
|
-
create:
|
|
4328
|
-
update:
|
|
4329
|
-
updateIntake:
|
|
4609
|
+
create: z30.object({ workspaceId: uuid, name: name3, slug, platform }),
|
|
4610
|
+
update: z30.object({ projectId, name: name3, platform, isPinned: z30.boolean() }),
|
|
4611
|
+
updateIntake: z30.object({
|
|
4330
4612
|
projectId,
|
|
4331
|
-
rateLimit:
|
|
4332
|
-
burst:
|
|
4333
|
-
allowedOrigins:
|
|
4613
|
+
rateLimit: z30.number().int().positive().nullable(),
|
|
4614
|
+
burst: z30.number().int().positive().nullable(),
|
|
4615
|
+
allowedOrigins: z30.array(origin).max(50)
|
|
4334
4616
|
}),
|
|
4335
|
-
updateObservability:
|
|
4617
|
+
updateObservability: z30.object({
|
|
4336
4618
|
projectId,
|
|
4337
|
-
primaryEnvironment:
|
|
4338
|
-
allowCodeMonitors:
|
|
4619
|
+
primaryEnvironment: z30.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
|
|
4620
|
+
allowCodeMonitors: z30.boolean()
|
|
4339
4621
|
}),
|
|
4340
|
-
setScrub:
|
|
4341
|
-
setCheckinAuth:
|
|
4342
|
-
setEnvironmentHidden:
|
|
4622
|
+
setScrub: z30.object({ projectId, group: z30.enum(SCRUB_GROUPS), enabled: z30.boolean() }),
|
|
4623
|
+
setCheckinAuth: z30.object({ projectId, mode: z30.enum(CHECKIN_AUTH_MODES) }),
|
|
4624
|
+
setEnvironmentHidden: z30.object({
|
|
4343
4625
|
projectId,
|
|
4344
|
-
name:
|
|
4345
|
-
hidden:
|
|
4346
|
-
}),
|
|
4347
|
-
scheduleDeletion:
|
|
4348
|
-
projectOnly:
|
|
4349
|
-
labelled:
|
|
4350
|
-
keyOnly:
|
|
4351
|
-
tokenOnly:
|
|
4626
|
+
name: z30.string().min(1).max(64),
|
|
4627
|
+
hidden: z30.boolean()
|
|
4628
|
+
}),
|
|
4629
|
+
scheduleDeletion: z30.object({ projectId, confirmSlug: slug }),
|
|
4630
|
+
projectOnly: z30.object({ projectId }),
|
|
4631
|
+
labelled: z30.object({ projectId, label: label3 }),
|
|
4632
|
+
keyOnly: z30.object({ keyId }),
|
|
4633
|
+
tokenOnly: z30.object({ tokenId: keyId }),
|
|
4352
4634
|
createIngestKey: createIngestKeyInputSchema,
|
|
4353
|
-
ingestKeyOnly:
|
|
4635
|
+
ingestKeyOnly: z30.object({ keyId: uuid })
|
|
4354
4636
|
};
|
|
4355
4637
|
var P2 = PROJECT_INPUTS;
|
|
4356
4638
|
var PROJECT_OPERATIONS = [
|
|
@@ -4605,24 +4887,24 @@ var PROJECT_OPERATIONS = [
|
|
|
4605
4887
|
];
|
|
4606
4888
|
|
|
4607
4889
|
// ../src/shared/contracts/api-ops/reads.ts
|
|
4608
|
-
import { z as
|
|
4609
|
-
var list =
|
|
4890
|
+
import { z as z31 } from "zod";
|
|
4891
|
+
var list = z31.object({ workspaceId: uuid, limit: pageLimit, cursor });
|
|
4610
4892
|
var READ_INPUTS = {
|
|
4611
|
-
workspace:
|
|
4893
|
+
workspace: z31.object({ workspaceId: uuid }),
|
|
4612
4894
|
list,
|
|
4613
|
-
projectsGet:
|
|
4895
|
+
projectsGet: z31.object({ workspaceId: uuid, projectId }),
|
|
4614
4896
|
monitorsList: list.extend({ projectId: projectId.optional() }),
|
|
4615
|
-
monitorsGet:
|
|
4616
|
-
uptimeGet:
|
|
4617
|
-
slosGet:
|
|
4897
|
+
monitorsGet: z31.object({ workspaceId: uuid, monitorId: uuid }),
|
|
4898
|
+
uptimeGet: z31.object({ workspaceId: uuid, checkId: uuid }),
|
|
4899
|
+
slosGet: z31.object({ workspaceId: uuid, sloId: uuid }),
|
|
4618
4900
|
alertsList: list.extend({
|
|
4619
|
-
state:
|
|
4901
|
+
state: z31.enum(["open", "resolved", "all"]).default("all"),
|
|
4620
4902
|
monitorId: uuid.optional()
|
|
4621
4903
|
}),
|
|
4622
|
-
approvalsGet:
|
|
4904
|
+
approvalsGet: z31.object({ workspaceId: uuid, approvalId: uuid }),
|
|
4623
4905
|
monitorsListTyped: list.extend({
|
|
4624
4906
|
projectId: projectId.optional(),
|
|
4625
|
-
type:
|
|
4907
|
+
type: z31.enum(MONITOR_TYPES).optional()
|
|
4626
4908
|
})
|
|
4627
4909
|
};
|
|
4628
4910
|
var R = READ_INPUTS;
|
|
@@ -4905,15 +5187,18 @@ function approvalRequestSchema(operationId, input) {
|
|
|
4905
5187
|
return input.omit(Object.fromEntries(human.map((k) => [k, true])));
|
|
4906
5188
|
}
|
|
4907
5189
|
|
|
5190
|
+
// ../src/shared/contracts/api-ops/openapi.ts
|
|
5191
|
+
import { z as z33 } from "zod";
|
|
5192
|
+
|
|
4908
5193
|
// ../src/shared/contracts/api-ops/wire.ts
|
|
4909
|
-
import { z as
|
|
5194
|
+
import { z as z32 } from "zod";
|
|
4910
5195
|
var toSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
|
|
4911
5196
|
var toCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
|
|
4912
5197
|
var schemaCache = new WeakMap;
|
|
4913
5198
|
function inputJsonSchema(op) {
|
|
4914
5199
|
let js = schemaCache.get(op.input);
|
|
4915
5200
|
if (!js) {
|
|
4916
|
-
js =
|
|
5201
|
+
js = z32.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
|
|
4917
5202
|
schemaCache.set(op.input, js);
|
|
4918
5203
|
}
|
|
4919
5204
|
return js;
|
|
@@ -5127,7 +5412,7 @@ function wireInput(operationId, opts = {}) {
|
|
|
5127
5412
|
for (const [k, v] of Object.entries(op.input.shape))
|
|
5128
5413
|
if (!omit.has(k))
|
|
5129
5414
|
shape[toSnake(k)] = v;
|
|
5130
|
-
return
|
|
5415
|
+
return z34.object(shape);
|
|
5131
5416
|
}
|
|
5132
5417
|
var BUDGETS = [
|
|
5133
5418
|
{ stringBytes: MCP_LIMITS.untrustedStringMaxBytes, listMax: MCP_LIMITS.listMax },
|
|
@@ -5220,52 +5505,52 @@ function errorResult(o) {
|
|
|
5220
5505
|
}
|
|
5221
5506
|
};
|
|
5222
5507
|
}
|
|
5223
|
-
var TOOL_OUTPUT_SCHEMA =
|
|
5224
|
-
untrusted:
|
|
5225
|
-
data:
|
|
5226
|
-
provenance:
|
|
5227
|
-
source:
|
|
5228
|
-
operations:
|
|
5508
|
+
var TOOL_OUTPUT_SCHEMA = z34.object({
|
|
5509
|
+
untrusted: z34.object({
|
|
5510
|
+
data: z34.unknown(),
|
|
5511
|
+
provenance: z34.object({
|
|
5512
|
+
source: z34.enum(["node", "control_plane", "docs"]),
|
|
5513
|
+
operations: z34.array(z34.string())
|
|
5229
5514
|
})
|
|
5230
5515
|
}).optional(),
|
|
5231
|
-
doc:
|
|
5232
|
-
slug:
|
|
5233
|
-
locale:
|
|
5234
|
-
url:
|
|
5235
|
-
markdown:
|
|
5236
|
-
truncated:
|
|
5516
|
+
doc: z34.object({
|
|
5517
|
+
slug: z34.string(),
|
|
5518
|
+
locale: z34.enum(["en", "vi"]),
|
|
5519
|
+
url: z34.string(),
|
|
5520
|
+
markdown: z34.string(),
|
|
5521
|
+
truncated: z34.boolean()
|
|
5237
5522
|
}).optional(),
|
|
5238
|
-
results:
|
|
5239
|
-
slug:
|
|
5240
|
-
title:
|
|
5241
|
-
description:
|
|
5242
|
-
section:
|
|
5243
|
-
url:
|
|
5523
|
+
results: z34.array(z34.object({
|
|
5524
|
+
slug: z34.string(),
|
|
5525
|
+
title: z34.string(),
|
|
5526
|
+
description: z34.string(),
|
|
5527
|
+
section: z34.string(),
|
|
5528
|
+
url: z34.string()
|
|
5244
5529
|
})).optional(),
|
|
5245
|
-
next_cursor:
|
|
5246
|
-
complete:
|
|
5247
|
-
omitted:
|
|
5248
|
-
truncated:
|
|
5249
|
-
suspicious_unicode:
|
|
5250
|
-
error:
|
|
5251
|
-
code:
|
|
5252
|
-
status:
|
|
5253
|
-
detail:
|
|
5254
|
-
scope:
|
|
5255
|
-
retry_after:
|
|
5530
|
+
next_cursor: z34.string().nullable().optional(),
|
|
5531
|
+
complete: z34.boolean().optional(),
|
|
5532
|
+
omitted: z34.array(z34.object({ part: z34.string(), reason: z34.string(), scope: z34.string().optional() })).optional(),
|
|
5533
|
+
truncated: z34.literal(true).optional(),
|
|
5534
|
+
suspicious_unicode: z34.literal(true).optional(),
|
|
5535
|
+
error: z34.object({
|
|
5536
|
+
code: z34.string(),
|
|
5537
|
+
status: z34.number(),
|
|
5538
|
+
detail: z34.string().optional(),
|
|
5539
|
+
scope: z34.string().optional(),
|
|
5540
|
+
retry_after: z34.number().optional()
|
|
5256
5541
|
}).optional(),
|
|
5257
|
-
operations:
|
|
5258
|
-
operation:
|
|
5259
|
-
plan:
|
|
5260
|
-
status:
|
|
5261
|
-
approval:
|
|
5262
|
-
approval_id:
|
|
5263
|
-
approval_url:
|
|
5264
|
-
expires_at:
|
|
5265
|
-
state:
|
|
5266
|
-
result_code:
|
|
5267
|
-
result:
|
|
5268
|
-
next:
|
|
5542
|
+
operations: z34.array(z34.record(z34.string(), z34.unknown())).optional(),
|
|
5543
|
+
operation: z34.record(z34.string(), z34.unknown()).optional(),
|
|
5544
|
+
plan: z34.record(z34.string(), z34.unknown()).optional(),
|
|
5545
|
+
status: z34.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
|
|
5546
|
+
approval: z34.object({
|
|
5547
|
+
approval_id: z34.string(),
|
|
5548
|
+
approval_url: z34.string(),
|
|
5549
|
+
expires_at: z34.string(),
|
|
5550
|
+
state: z34.enum(APPROVAL_STATES),
|
|
5551
|
+
result_code: z34.string().nullable().optional(),
|
|
5552
|
+
result: z34.record(z34.string(), z34.unknown()).optional(),
|
|
5553
|
+
next: z34.string().optional()
|
|
5269
5554
|
}).optional()
|
|
5270
5555
|
});
|
|
5271
5556
|
var spec = (name) => {
|
|
@@ -5311,10 +5596,10 @@ var has = (rt, operationId) => {
|
|
|
5311
5596
|
return !!op && rt.scopes.includes(op.scope);
|
|
5312
5597
|
};
|
|
5313
5598
|
var isoWindow = {
|
|
5314
|
-
start:
|
|
5315
|
-
end:
|
|
5599
|
+
start: z34.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
|
|
5600
|
+
end: z34.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
|
|
5316
5601
|
};
|
|
5317
|
-
var traceIdSchema =
|
|
5602
|
+
var traceIdSchema = z34.string().regex(/^[0-9a-fA-F]{32}$/);
|
|
5318
5603
|
var MONITOR_KINDS2 = {
|
|
5319
5604
|
cron: { list: "monitors.list", get: "monitors.get", idField: "monitor_id" },
|
|
5320
5605
|
uptime: { list: "uptime.list", get: "uptime.get", idField: "check_id" },
|
|
@@ -5378,8 +5663,8 @@ function describe(op, scopes) {
|
|
|
5378
5663
|
destructive: isDestructiveOperation(op)
|
|
5379
5664
|
};
|
|
5380
5665
|
}
|
|
5381
|
-
var params =
|
|
5382
|
-
var operationIdArg =
|
|
5666
|
+
var params = z34.record(z34.string(), z34.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
|
|
5667
|
+
var operationIdArg = z34.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
|
|
5383
5668
|
function approvalBlock(t, next) {
|
|
5384
5669
|
return {
|
|
5385
5670
|
approval_id: t.approval_id,
|
|
@@ -5399,7 +5684,7 @@ var MCP_TOOL_DEFS = [
|
|
|
5399
5684
|
title: "Workspace and node",
|
|
5400
5685
|
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.",
|
|
5401
5686
|
operations: ["workspace.get", "node.get"],
|
|
5402
|
-
input:
|
|
5687
|
+
input: z34.object({}),
|
|
5403
5688
|
async run(_args, rt) {
|
|
5404
5689
|
const [ws, node] = await Promise.all([rt.call("workspace.get", {}), rt.call("node.get", {})]);
|
|
5405
5690
|
if (!ws.ok)
|
|
@@ -5421,9 +5706,9 @@ var MCP_TOOL_DEFS = [
|
|
|
5421
5706
|
title: "Get an issue",
|
|
5422
5707
|
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). A resolved issue also carries `fix_status` when the token can read releases: fixed, unverified, not_fixed (with the event that broke it) or unknown, per environment.",
|
|
5423
5708
|
operations: ["issues.get", "events.get", "issues.fix_status"],
|
|
5424
|
-
input:
|
|
5425
|
-
issue_id:
|
|
5426
|
-
include_latest_event:
|
|
5709
|
+
input: z34.object({
|
|
5710
|
+
issue_id: z34.number().int().positive().describe("Issue id from search_issues."),
|
|
5711
|
+
include_latest_event: z34.boolean().default(true)
|
|
5427
5712
|
}),
|
|
5428
5713
|
async run(args, rt) {
|
|
5429
5714
|
const omitted = [];
|
|
@@ -5464,9 +5749,9 @@ var MCP_TOOL_DEFS = [
|
|
|
5464
5749
|
title: "Get a trace",
|
|
5465
5750
|
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).",
|
|
5466
5751
|
operations: ["traces.get", "traces.spans"],
|
|
5467
|
-
input:
|
|
5752
|
+
input: z34.object({
|
|
5468
5753
|
trace_id: traceIdSchema.describe("W3C trace id, 32 hex characters."),
|
|
5469
|
-
spans:
|
|
5754
|
+
spans: z34.enum(["none", "errors", "all"]).default("none")
|
|
5470
5755
|
}),
|
|
5471
5756
|
async run(args, rt) {
|
|
5472
5757
|
const sum = await rt.call("traces.get", { trace_id: args["trace_id"] });
|
|
@@ -5498,17 +5783,17 @@ var MCP_TOOL_DEFS = [
|
|
|
5498
5783
|
title: "Query metrics",
|
|
5499
5784
|
description: "OpenTelemetry metrics of one project. Without `name`: the metric catalog (name, type, unit, series count, last seen; `q` narrows by name) and the node's series caps. With `name` plus start and end: the metric aggregated per step — `aggregation` defaults to rate for counters, p95 for histograms and avg for gauges — optionally filtered by attributes (`attrs`, JSON list of {k, op, v}) and grouped by up to two attribute keys (`group_by`, comma-separated). Exemplar trace ids open with get_trace.",
|
|
5500
5785
|
operations: ["metrics.names", "metrics.query"],
|
|
5501
|
-
input:
|
|
5502
|
-
project:
|
|
5503
|
-
name:
|
|
5504
|
-
q:
|
|
5505
|
-
aggregation:
|
|
5786
|
+
input: z34.object({
|
|
5787
|
+
project: z34.number().int().positive().describe("Numeric project id from list_projects."),
|
|
5788
|
+
name: z34.string().regex(METRIC_NAME_RE).optional().describe("Metric name from the catalog, e.g. http.server.request.duration."),
|
|
5789
|
+
q: z34.string().max(255).optional().describe("Catalog only: part of a metric name."),
|
|
5790
|
+
aggregation: z34.enum(METRIC_AGGREGATIONS).optional(),
|
|
5506
5791
|
start: isoWindow.start.optional(),
|
|
5507
5792
|
end: isoWindow.end.optional(),
|
|
5508
|
-
step:
|
|
5509
|
-
attrs:
|
|
5510
|
-
group_by:
|
|
5511
|
-
environment:
|
|
5793
|
+
step: z34.number().int().min(60).max(86400).multipleOf(60).optional().describe("Seconds per point (whole minutes); picked from the window when absent."),
|
|
5794
|
+
attrs: z34.string().max(2000).optional(),
|
|
5795
|
+
group_by: z34.string().max(600).optional(),
|
|
5796
|
+
environment: z34.string().max(2000).optional().describe("Comma-separated environments.")
|
|
5512
5797
|
}),
|
|
5513
5798
|
async run(args, rt) {
|
|
5514
5799
|
const scope = {
|
|
@@ -5563,8 +5848,8 @@ var MCP_TOOL_DEFS = [
|
|
|
5563
5848
|
title: "Release health",
|
|
5564
5849
|
description: "What changed with a release (spec 13). With `version`: that release in one environment against the previous one (or `compare`) — three lists for its first 24 hours: new issues, regressed issues and increased issues (≥ 2× events per hour and ≥ 10 events), up to 50 each with hourly sparklines, plus its deploy markers. Without `version`: the project's releases, newest deploy first, with those three counts. `environment` defaults to production (else the busiest). Whether a resolved issue is really fixed: get_issue returns its fix status.",
|
|
5565
5850
|
operations: ["releases.list", "releases.health"],
|
|
5566
|
-
input:
|
|
5567
|
-
project:
|
|
5851
|
+
input: z34.object({
|
|
5852
|
+
project: z34.number().int().positive().describe("Numeric project id from list_projects."),
|
|
5568
5853
|
version: releaseNameSchema.optional().describe("Release name exactly as the SDK sends it, e.g. web@1.4.2."),
|
|
5569
5854
|
environment: environmentNameSchema.optional().describe("One environment, e.g. production."),
|
|
5570
5855
|
compare: releaseNameSchema.optional().describe("With version: compare against this release instead of the previous one.")
|
|
@@ -5596,11 +5881,11 @@ var MCP_TOOL_DEFS = [
|
|
|
5596
5881
|
title: "Correlate by trace or run",
|
|
5597
5882
|
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.",
|
|
5598
5883
|
operations: ["traces.get", "traces.spans", "spans.list", "logs.list"],
|
|
5599
|
-
input:
|
|
5884
|
+
input: z34.object({
|
|
5600
5885
|
trace_id: traceIdSchema.optional(),
|
|
5601
|
-
run_id:
|
|
5886
|
+
run_id: z34.string().min(1).max(128).optional(),
|
|
5602
5887
|
...isoWindow,
|
|
5603
|
-
project:
|
|
5888
|
+
project: z34.string().max(2000).optional().describe("Comma-separated project ids.")
|
|
5604
5889
|
}),
|
|
5605
5890
|
async run(args, rt) {
|
|
5606
5891
|
const trace = args["trace_id"];
|
|
@@ -5659,10 +5944,10 @@ var MCP_TOOL_DEFS = [
|
|
|
5659
5944
|
title: "List monitors",
|
|
5660
5945
|
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).",
|
|
5661
5946
|
operations: ["monitors.list", "uptime.list", "slos.list"],
|
|
5662
|
-
input:
|
|
5663
|
-
kind:
|
|
5664
|
-
project_id:
|
|
5665
|
-
limit:
|
|
5947
|
+
input: z34.object({
|
|
5948
|
+
kind: z34.enum(["all", "cron", "uptime", "slo"]).default("all"),
|
|
5949
|
+
project_id: z34.number().int().positive().optional(),
|
|
5950
|
+
limit: z34.number().int().min(1).max(200).default(50)
|
|
5666
5951
|
}),
|
|
5667
5952
|
async run(args, rt) {
|
|
5668
5953
|
const kinds = args["kind"] && args["kind"] !== "all" ? [args["kind"]] : ["cron", "uptime", "slo"];
|
|
@@ -5697,10 +5982,10 @@ var MCP_TOOL_DEFS = [
|
|
|
5697
5982
|
"monitors.occurrences",
|
|
5698
5983
|
"monitors.backtest"
|
|
5699
5984
|
],
|
|
5700
|
-
input:
|
|
5701
|
-
kind:
|
|
5702
|
-
id:
|
|
5703
|
-
backtest:
|
|
5985
|
+
input: z34.object({
|
|
5986
|
+
kind: z34.enum(["cron", "uptime", "slo"]),
|
|
5987
|
+
id: z34.guid(),
|
|
5988
|
+
backtest: z34.boolean().default(false)
|
|
5704
5989
|
}),
|
|
5705
5990
|
async run(args, rt) {
|
|
5706
5991
|
const k = MONITOR_KINDS2[args["kind"]];
|
|
@@ -5760,9 +6045,9 @@ var MCP_TOOL_DEFS = [
|
|
|
5760
6045
|
title: "Send a test event",
|
|
5761
6046
|
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).",
|
|
5762
6047
|
operations: ["projects.send_test_event"],
|
|
5763
|
-
input:
|
|
5764
|
-
project_id:
|
|
5765
|
-
idempotency_key:
|
|
6048
|
+
input: z34.object({
|
|
6049
|
+
project_id: z34.number().int().positive(),
|
|
6050
|
+
idempotency_key: z34.string().min(8).max(255).optional()
|
|
5766
6051
|
}),
|
|
5767
6052
|
async run(args, rt) {
|
|
5768
6053
|
const r = await rt.call("projects.send_test_event", { project_id: args["project_id"] }, { idempotencyKey: args["idempotency_key"] ?? rt.newKey() });
|
|
@@ -5780,9 +6065,9 @@ var MCP_TOOL_DEFS = [
|
|
|
5780
6065
|
title: "Find a configuration change",
|
|
5781
6066
|
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.",
|
|
5782
6067
|
operations: [],
|
|
5783
|
-
input:
|
|
5784
|
-
query:
|
|
5785
|
-
limit:
|
|
6068
|
+
input: z34.object({
|
|
6069
|
+
query: z34.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
|
|
6070
|
+
limit: z34.number().int().min(1).max(20).default(10)
|
|
5786
6071
|
}),
|
|
5787
6072
|
async run(args, rt) {
|
|
5788
6073
|
const q = words(String(args["query"]));
|
|
@@ -5810,7 +6095,7 @@ var MCP_TOOL_DEFS = [
|
|
|
5810
6095
|
title: "Describe a configuration change",
|
|
5811
6096
|
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.",
|
|
5812
6097
|
operations: [],
|
|
5813
|
-
input:
|
|
6098
|
+
input: z34.object({ operation_id: operationIdArg }),
|
|
5814
6099
|
async run(args, rt) {
|
|
5815
6100
|
const op = configureOp(args["operation_id"]);
|
|
5816
6101
|
if (!op || op.method === "GET")
|
|
@@ -5839,7 +6124,7 @@ var MCP_TOOL_DEFS = [
|
|
|
5839
6124
|
title: "Check a change before applying it",
|
|
5840
6125
|
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.",
|
|
5841
6126
|
operations: [],
|
|
5842
|
-
input:
|
|
6127
|
+
input: z34.object({ operation_id: operationIdArg, params }),
|
|
5843
6128
|
async run(args, rt) {
|
|
5844
6129
|
const op = configureOp(args["operation_id"]);
|
|
5845
6130
|
if (!op || op.method === "GET")
|
|
@@ -5888,11 +6173,11 @@ var MCP_TOOL_DEFS = [
|
|
|
5888
6173
|
title: "Apply a configuration change",
|
|
5889
6174
|
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.",
|
|
5890
6175
|
operations: [],
|
|
5891
|
-
input:
|
|
6176
|
+
input: z34.object({
|
|
5892
6177
|
operation_id: operationIdArg,
|
|
5893
6178
|
params,
|
|
5894
|
-
idempotency_key:
|
|
5895
|
-
if_match:
|
|
6179
|
+
idempotency_key: z34.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
|
|
6180
|
+
if_match: z34.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
|
|
5896
6181
|
}),
|
|
5897
6182
|
async run(args, rt) {
|
|
5898
6183
|
const op = configureOp(args["operation_id"]);
|
|
@@ -5953,7 +6238,7 @@ var MCP_TOOL_DEFS = [
|
|
|
5953
6238
|
title: "Follow an approval",
|
|
5954
6239
|
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).",
|
|
5955
6240
|
operations: ["approvals.get"],
|
|
5956
|
-
input:
|
|
6241
|
+
input: z34.object({ approval_id: z34.guid().describe("approval_id from apply_change.") }),
|
|
5957
6242
|
async run(args, rt) {
|
|
5958
6243
|
const r = await rt.call("approvals.get", { approval_id: args["approval_id"] });
|
|
5959
6244
|
if (!r.ok)
|
|
@@ -5973,10 +6258,10 @@ var MCP_TOOL_DEFS = [
|
|
|
5973
6258
|
title: "Search Belvador docs",
|
|
5974
6259
|
description: "Searches the public Belvador documentation (titles and summaries) and returns the best pages with their slugs for get_doc.",
|
|
5975
6260
|
operations: [],
|
|
5976
|
-
input:
|
|
5977
|
-
query:
|
|
5978
|
-
locale:
|
|
5979
|
-
limit:
|
|
6261
|
+
input: z34.object({
|
|
6262
|
+
query: z34.string().min(1).max(200),
|
|
6263
|
+
locale: z34.enum(["en", "vi"]).default("en"),
|
|
6264
|
+
limit: z34.number().int().min(1).max(10).default(5)
|
|
5980
6265
|
}),
|
|
5981
6266
|
async run(args, rt) {
|
|
5982
6267
|
const locale = args["locale"] ?? "en";
|
|
@@ -5992,9 +6277,9 @@ var MCP_TOOL_DEFS = [
|
|
|
5992
6277
|
title: "Read a docs page",
|
|
5993
6278
|
description: "The Markdown of one public Belvador docs page by slug (e.g. `quickstart`, `sdk/react`, `reference/api`).",
|
|
5994
6279
|
operations: [],
|
|
5995
|
-
input:
|
|
5996
|
-
slug:
|
|
5997
|
-
locale:
|
|
6280
|
+
input: z34.object({
|
|
6281
|
+
slug: z34.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
|
|
6282
|
+
locale: z34.enum(["en", "vi"]).default("en")
|
|
5998
6283
|
}),
|
|
5999
6284
|
async run(args, rt) {
|
|
6000
6285
|
const locale = args["locale"] ?? "en";
|
|
@@ -6188,7 +6473,7 @@ function findToken(env = process.env, keychain = keychainToken) {
|
|
|
6188
6473
|
}
|
|
6189
6474
|
|
|
6190
6475
|
// packages/mcp/src/cli.ts
|
|
6191
|
-
var PACKAGE_VERSION = "0.
|
|
6476
|
+
var PACKAGE_VERSION = "0.8.0";
|
|
6192
6477
|
var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
|
|
6193
6478
|
|
|
6194
6479
|
Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]
|