@belvador/mcp 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +824 -515
  2. 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 z32 } from "zod";
217
+ import { z as z33 } 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,
@@ -1225,7 +1189,7 @@ var TELEMETRY_PLAN_DEFAULTS = {
1225
1189
  logs_monthly_bytes: 5 * 1000 ** 3,
1226
1190
  metrics_retention_days: 14,
1227
1191
  metrics_monthly_bytes: 2 * 1000 ** 3,
1228
- metric_series_max: 1e4,
1192
+ metric_series_max: 35000,
1229
1193
  metric_names_max: 1000,
1230
1194
  telemetry_rate_bytes_per_sec: 1024 * 1024,
1231
1195
  telemetry_burst_bytes: 8 * 1024 * 1024,
@@ -1288,7 +1252,8 @@ var METRIC_QUERY = {
1288
1252
  exemplarsMax: 50,
1289
1253
  queryMaxSeconds: 3
1290
1254
  };
1291
- var metricName = z10.string().min(1).max(METRIC_LIMITS.nameMaxChars).regex(METRIC_NAME_RE);
1255
+ var metricNameSchema = z10.string().min(1).max(METRIC_LIMITS.nameMaxChars).regex(METRIC_NAME_RE);
1256
+ var metricName = metricNameSchema;
1292
1257
  var attrKey = z10.string().regex(METRIC_ATTR_KEY_RE);
1293
1258
  var metricFilterSchema = z10.object({
1294
1259
  k: attrKey,
@@ -1665,7 +1630,7 @@ var NUMERIC_OPS = new Set(["lt", "le", "gt", "ge"]);
1665
1630
  var VALUELESS_OPS = new Set(["exists", "not_exists"]);
1666
1631
  var COMPARATORS = ["lt", "gt", "outside"];
1667
1632
  var MISSING_DATA_POLICIES = ["alert", "keep", "resolve", "treat_as_zero"];
1668
- var SEVERITIES = ["critical", "high", "medium", "low"];
1633
+ var SEVERITIES2 = ["critical", "high", "medium", "low"];
1669
1634
  var OCCURRENCE_STATES = [
1670
1635
  "pending",
1671
1636
  "in_progress",
@@ -1754,7 +1719,7 @@ var threshold = z12.number().int().min(0).max(SIGNAL_LIMITS.thresholdMax);
1754
1719
  var recovery = z12.number().int().min(MONITOR_LIMITS.thresholdMin).max(MONITOR_LIMITS.thresholdMax);
1755
1720
  var common = {
1756
1721
  environments: environmentListSchema,
1757
- severity: z12.enum(SEVERITIES),
1722
+ severity: z12.enum(SEVERITIES2),
1758
1723
  recovery_threshold: recovery
1759
1724
  };
1760
1725
  var countSettingsSchema = z12.object({
@@ -1956,7 +1921,7 @@ var incidentRuleInputSchema = z14.object({
1956
1921
  projectIds: z14.array(z14.number().int().positive()).max(50),
1957
1922
  environments: z14.array(z14.string().trim().min(1).max(64)).max(20),
1958
1923
  kinds: z14.array(z14.enum(INCIDENT_KINDS)).min(1).max(4),
1959
- minSeverity: z14.enum(SEVERITIES),
1924
+ minSeverity: z14.enum(SEVERITIES2),
1960
1925
  groupBy: z14.enum(INCIDENT_GROUP_BY),
1961
1926
  windowMinutes: z14.number().int().min(5).max(240),
1962
1927
  recoveryHoldMinutes: z14.number().int().min(0).max(1440)
@@ -2340,7 +2305,7 @@ var TOKEN_IN_TEXT = new RegExp(PING_TOKEN_PATTERN, "g");
2340
2305
  import { z as z17 } from "zod";
2341
2306
 
2342
2307
  // ../src/shared/contracts/vocab/slo.ts
2343
- var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans"];
2308
+ var SLO_SOURCES = ["uptime", "monitor", "heartbeat", "spans", "metric"];
2344
2309
 
2345
2310
  // ../src/shared/contracts/slo.ts
2346
2311
  var SLO_SLIS = ["availability", "latency"];
@@ -2360,6 +2325,8 @@ var SLO_LIMITS = {
2360
2325
  descriptionMaxChars: 1000,
2361
2326
  environmentMaxChars: 64,
2362
2327
  spansLagMinutes: 3,
2328
+ metricsLagMinutes: 3,
2329
+ metricSeenMinutes: 5,
2363
2330
  sliItemsPerMessage: 200,
2364
2331
  maxNodeSlos: 1000
2365
2332
  };
@@ -2367,14 +2334,30 @@ var SLO_SOURCE_META = {
2367
2334
  uptime: { provenance: "managed_probe", estimated: false, slis: ["availability", "latency"], budgeting: "Timeslices" },
2368
2335
  monitor: { provenance: "check_in", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
2369
2336
  heartbeat: { provenance: "ping_token", estimated: false, slis: ["availability"], budgeting: "Occurrences" },
2370
- spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" }
2337
+ spans: { provenance: "ingest_key", estimated: true, slis: ["availability", "latency"], budgeting: "Occurrences" },
2338
+ metric: { provenance: "ingest_key", estimated: false, slis: ["availability"], budgeting: "Occurrences" }
2371
2339
  };
2340
+ var sloMetricSchema = z17.object({
2341
+ name: metricNameSchema,
2342
+ filter: z17.array(metricFilterSchema).max(METRIC_QUERY.filtersMax).default([])
2343
+ }).superRefine((m, ctx) => {
2344
+ m.filter.forEach((f, i) => {
2345
+ if (f.op === "exists" !== (f.v === undefined))
2346
+ ctx.addIssue({ code: "custom", path: ["filter", i, "v"], message: "INVALID_INPUT" });
2347
+ });
2348
+ });
2349
+ function sameSloMetric(a, b) {
2350
+ const key = (m) => JSON.stringify([m.name, [...m.filter].map((f) => [f.k, f.op, f.v ?? null]).sort()]);
2351
+ return key(a) === key(b);
2352
+ }
2372
2353
  var nodeSloSchema = z17.object({
2373
2354
  slo_id: z17.guid(),
2374
2355
  project_id: z17.number().int().positive(),
2375
- source: z17.enum(["monitor", "spans"]),
2356
+ source: z17.enum(["monitor", "spans", "metric"]),
2376
2357
  sli: z17.enum(SLO_SLIS),
2377
2358
  monitor_id: z17.guid().optional(),
2359
+ good_metric: sloMetricSchema.optional(),
2360
+ total_metric: sloMetricSchema.optional(),
2378
2361
  environment: z17.string().min(1).max(SLO_LIMITS.environmentMaxChars).optional(),
2379
2362
  service: z17.string().min(1).max(128).optional(),
2380
2363
  operation: z17.string().min(1).max(256).optional(),
@@ -2385,6 +2368,8 @@ var nodeSloSchema = z17.object({
2385
2368
  ctx.addIssue({ code: "custom", path: ["monitor_id"], message: "INVALID_INPUT" });
2386
2369
  if (v.source === "spans" && !v.service)
2387
2370
  ctx.addIssue({ code: "custom", path: ["service"], message: "INVALID_INPUT" });
2371
+ if (v.source === "metric" !== Boolean(v.good_metric && v.total_metric) || v.source === "metric" && v.sli !== "availability")
2372
+ ctx.addIssue({ code: "custom", path: ["good_metric"], message: "INVALID_INPUT" });
2388
2373
  if (v.sli === "latency" !== (v.latency_threshold_ms !== undefined))
2389
2374
  ctx.addIssue({ code: "custom", path: ["latency_threshold_ms"], message: "INVALID_INPUT" });
2390
2375
  });
@@ -2401,7 +2386,9 @@ var sloInputSchema = z17.object({
2401
2386
  projectId: z17.number().int().positive().optional(),
2402
2387
  service: z17.string().max(128).optional(),
2403
2388
  operation: z17.string().max(256).optional(),
2404
- environment: z17.string().max(SLO_LIMITS.environmentMaxChars).optional()
2389
+ environment: z17.string().max(SLO_LIMITS.environmentMaxChars).optional(),
2390
+ goodMetric: sloMetricSchema.optional(),
2391
+ totalMetric: sloMetricSchema.optional()
2405
2392
  }),
2406
2393
  sli: z17.enum(SLO_SLIS),
2407
2394
  latencyThresholdMs: z17.number().int().min(1).max(60000).nullable(),
@@ -2414,9 +2401,15 @@ var sloInputSchema = z17.object({
2414
2401
  ctx.addIssue({ code: "custom", path: ["sli"], message: "INVALID_INPUT" });
2415
2402
  if (v.sli === "latency" !== Boolean(v.latencyThresholdMs))
2416
2403
  ctx.addIssue({ code: "custom", path: ["latencyThresholdMs"], message: "INVALID_INPUT" });
2417
- if (v.source === "spans" ? !(v.sourceRef.projectId && v.sourceRef.service?.trim()) : !v.sourceRef.id)
2404
+ const ref = v.sourceRef;
2405
+ const refOk = v.source === "spans" ? Boolean(ref.projectId && ref.service?.trim()) : v.source === "metric" ? Boolean(ref.projectId && ref.goodMetric && ref.totalMetric) : Boolean(ref.id);
2406
+ if (!refOk)
2418
2407
  ctx.addIssue({ code: "custom", path: ["sourceRef"], message: "INVALID_INPUT" });
2419
- if (v.sourceRef.environment !== undefined && v.source !== "monitor" && v.source !== "spans")
2408
+ if (v.source === "metric" && ref.goodMetric && ref.totalMetric && sameSloMetric(ref.goodMetric, ref.totalMetric))
2409
+ ctx.addIssue({ code: "custom", path: ["sourceRef", "goodMetric"], message: "INVALID_INPUT" });
2410
+ if (v.source !== "metric" && (ref.goodMetric || ref.totalMetric))
2411
+ ctx.addIssue({ code: "custom", path: ["sourceRef", "goodMetric"], message: "INVALID_INPUT" });
2412
+ if (ref.environment !== undefined && v.source !== "monitor" && v.source !== "spans" && v.source !== "metric")
2420
2413
  ctx.addIssue({ code: "custom", path: ["sourceRef", "environment"], message: "INVALID_INPUT" });
2421
2414
  if (v.allowPublicSources && v.source !== "monitor" && v.source !== "spans")
2422
2415
  ctx.addIssue({ code: "custom", path: ["allowPublicSources"], message: "INVALID_INPUT" });
@@ -3015,7 +3008,7 @@ var MONITOR_OPERATIONS = [
3015
3008
  idempotency: "required",
3016
3009
  status: 201,
3017
3010
  mcp: "configure",
3018
- summary: "Create an SLO over a monitor, an uptime check or spans.",
3011
+ summary: "Create an SLO over a monitor, a heartbeat, an uptime check, spans or two metric counters (good ÷ total).",
3019
3012
  ui: ["slos#createSlo"]
3020
3013
  }),
3021
3014
  op({
@@ -3129,7 +3122,7 @@ var MONITOR_OPERATIONS = [
3129
3122
  ];
3130
3123
 
3131
3124
  // ../src/shared/contracts/api-ops/node-data.ts
3132
- import { z as z23 } from "zod";
3125
+ import { z as z24 } from "zod";
3133
3126
 
3134
3127
  // ../src/shared/contracts/release-health.ts
3135
3128
  import { z as z21 } from "zod";
@@ -3387,8 +3380,310 @@ var fixStatusSchema = z21.object({
3387
3380
  verify_hours: z21.number()
3388
3381
  });
3389
3382
 
3390
- // ../src/shared/contracts/web-vitals.ts
3383
+ // ../src/shared/contracts/telemetry.ts
3391
3384
  import { z as z22 } from "zod";
3385
+ var TELEMETRY_SIGNALS = ["traces", "logs", "metrics"];
3386
+ var TELEMETRY_EDGE_REASONS = [
3387
+ "accepted",
3388
+ "rate_limited",
3389
+ "over_quota",
3390
+ "too_large",
3391
+ "unsupported",
3392
+ "buffer_full",
3393
+ "expired",
3394
+ "auth"
3395
+ ];
3396
+ var TELEMETRY_NODE_REASONS = [
3397
+ "accepted",
3398
+ "malformed",
3399
+ "out_of_window",
3400
+ "scope",
3401
+ "dropped_attributes",
3402
+ "truncated",
3403
+ "evicted_early",
3404
+ "unsupported_type",
3405
+ "cardinality_limited",
3406
+ "sdk_delivery"
3407
+ ];
3408
+ var TELEMETRY_REASONS = [
3409
+ ...TELEMETRY_EDGE_REASONS,
3410
+ ...TELEMETRY_NODE_REASONS.filter((r) => r !== "accepted")
3411
+ ];
3412
+ var TELEMETRY_LIMITS = {
3413
+ edgeBufferNodeMaxBytes: 512 * 1024 * 1024,
3414
+ edgeBufferMetricsMaxBytes: 64 * 1024 * 1024,
3415
+ drainShareWhileErrorsWait: 0.5,
3416
+ nodeSpoolMaxBytes: 1024 * 1024 * 1024,
3417
+ nodeSpoolMaxAgeMs: 30 * 60 * 1000,
3418
+ nodeOverloadRatio: 0.85,
3419
+ diskBudgetRatio: 0.3,
3420
+ diskShareMetrics: 0.1,
3421
+ diskSplitTracesDefault: 0.5,
3422
+ diskSplitMin: 0.2,
3423
+ diskSplitMax: 0.8,
3424
+ diskCheckIntervalMs: 5 * 60 * 1000,
3425
+ servicesPerProject: 200,
3426
+ serviceNameMaxChars: 128,
3427
+ keyUsedReportMs: 60 * 60 * 1000
3428
+ };
3429
+ var TELEMETRY_QUERY = {
3430
+ maxWindowMs: TELEMETRY_MAX_WINDOW_MS,
3431
+ spansDefaultWindowMs: 3600 * 1000,
3432
+ logsDefaultWindowMs: 15 * 60 * 1000,
3433
+ substringMaxWindowMs: 15 * 60 * 1000,
3434
+ spansPageSize: 100,
3435
+ logsPageSize: 200,
3436
+ logsPageMaxBytes: 2 * 1024 * 1024,
3437
+ waterfallMaxSpans: 1e4,
3438
+ waterfallMaxBytes: 8 * 1024 * 1024,
3439
+ waterfallFallbackWindowMs: 15 * 60 * 1000,
3440
+ histogramMaxBuckets: 300,
3441
+ facetsMaxValues: 50,
3442
+ facetsMaxKeys: 5,
3443
+ aroundMaxRows: 100,
3444
+ aroundWindowMs: 5 * 60 * 1000,
3445
+ attrFiltersMax: ATTR_FILTERS_MAX,
3446
+ timeBudgetMs: {
3447
+ waterfall: 1000,
3448
+ spans: 1500,
3449
+ logs: 1000,
3450
+ histogram: 1000,
3451
+ facets: 500,
3452
+ around: 500
3453
+ },
3454
+ maxMemoryBytes: 256 * 1024 * 1024,
3455
+ maxThreads: 2,
3456
+ busyWaitMs: 2000,
3457
+ issueLogsWindowMs: 2 * 60 * 1000
3458
+ };
3459
+ var INCOMPLETE_REASONS = ["time_budget", "row_cap", "byte_cap", "window"];
3460
+ var SPAN_KINDS = [
3461
+ "unspecified",
3462
+ "internal",
3463
+ "server",
3464
+ "client",
3465
+ "producer",
3466
+ "consumer"
3467
+ ];
3468
+ var SPAN_STATUSES = ["unset", "ok", "error"];
3469
+ var SOURCE_PROTOCOLS = ["otlp", "sentry_log"];
3470
+ var traceId = z22.string().regex(TRACE_ID_RE);
3471
+ var spanId = z22.string().regex(SPAN_ID_RE);
3472
+ var optSpanId = z22.union([spanId, z22.literal("")]);
3473
+ var ts2 = z22.string().max(40);
3474
+ var count3 = z22.coerce.number().int().nonnegative().catch(0);
3475
+ var label2 = z22.string().max(256);
3476
+ var attrValue = z22.lazy(() => z22.union([
3477
+ z22.string().max(70000),
3478
+ z22.number(),
3479
+ z22.boolean(),
3480
+ z22.null(),
3481
+ z22.array(attrValue).max(256),
3482
+ z22.record(z22.string(), attrValue)
3483
+ ]));
3484
+ var attrs = z22.record(z22.string().max(256), attrValue).catch({});
3485
+ var spanRowSchema = z22.object({
3486
+ project_id: z22.number().int().positive(),
3487
+ trace_id: traceId,
3488
+ span_id: spanId,
3489
+ parent_span_id: optSpanId,
3490
+ service: label2,
3491
+ operation: z22.string().max(1024),
3492
+ kind: z22.enum(SPAN_KINDS).catch("unspecified"),
3493
+ status: z22.enum(SPAN_STATUSES).catch("unset"),
3494
+ start: ts2,
3495
+ duration_ns: z22.coerce.number().nonnegative().catch(0),
3496
+ environment: z22.string().max(64).catch("")
3497
+ });
3498
+ var traceSummarySchema = z22.object({
3499
+ project_id: z22.number().int().positive(),
3500
+ trace_id: traceId,
3501
+ root_service: label2.catch(""),
3502
+ root_operation: z22.string().max(1024).catch(""),
3503
+ has_root: z22.boolean().catch(false),
3504
+ start: ts2,
3505
+ duration_ns: z22.coerce.number().nonnegative().catch(0),
3506
+ spans: count3,
3507
+ errors: count3,
3508
+ services: count3,
3509
+ environment: z22.string().max(64).catch("")
3510
+ });
3511
+ var completeness2 = {
3512
+ complete: z22.boolean(),
3513
+ reason: z22.enum(INCOMPLETE_REASONS).optional().catch(undefined)
3514
+ };
3515
+ var spanListSchema = z22.object({
3516
+ mode: z22.enum(["spans", "traces"]),
3517
+ spans: z22.array(spanRowSchema).max(TELEMETRY_QUERY.spansPageSize).catch([]),
3518
+ traces: z22.array(traceSummarySchema).max(TELEMETRY_QUERY.spansPageSize).catch([]),
3519
+ next_cursor: z22.string().max(512).nullable(),
3520
+ ...completeness2
3521
+ });
3522
+ var spanHistogramSchema = z22.object({
3523
+ bucket_ms: z22.number().int().positive(),
3524
+ buckets: z22.array(z22.object({
3525
+ t: ts2,
3526
+ spans: count3,
3527
+ errors: count3,
3528
+ p50_ns: z22.coerce.number().nonnegative().catch(0),
3529
+ p95_ns: z22.coerce.number().nonnegative().catch(0)
3530
+ })).max(TELEMETRY_QUERY.histogramMaxBuckets),
3531
+ ...completeness2
3532
+ });
3533
+ var spanEventSchema = z22.object({
3534
+ time: ts2,
3535
+ name: z22.string().max(1024),
3536
+ attributes: attrs
3537
+ });
3538
+ var spanLinkSchema = z22.object({ trace_id: traceId, span_id: spanId, attributes: attrs });
3539
+ var spanDetailSchema = spanRowSchema.extend({
3540
+ status_message: z22.string().max(4096).catch(""),
3541
+ trace_state: z22.string().max(512).catch(""),
3542
+ scope_name: z22.string().max(256).catch(""),
3543
+ scope_version: z22.string().max(64).catch(""),
3544
+ attributes: attrs,
3545
+ resource: attrs,
3546
+ events: z22.array(spanEventSchema).max(128).catch([]),
3547
+ links: z22.array(spanLinkSchema).max(128).catch([]),
3548
+ dropped_attributes_count: count3,
3549
+ dropped_events_count: count3,
3550
+ dropped_links_count: count3,
3551
+ sampling_probability: z22.number().min(0).max(1).nullable().catch(null)
3552
+ });
3553
+ var waterfallSchema = z22.object({
3554
+ trace_id: traceId,
3555
+ spans: z22.array(spanDetailSchema).max(TELEMETRY_QUERY.waterfallMaxSpans),
3556
+ missing_parents: z22.array(spanId).max(TELEMETRY_QUERY.waterfallMaxSpans).catch([]),
3557
+ errors: z22.array(z22.object({
3558
+ project_id: z22.number().int().positive(),
3559
+ event_id: z22.string().regex(/^[0-9a-f]{32}$/),
3560
+ span_id: optSpanId.catch(""),
3561
+ issue_id: z22.number().int().positive(),
3562
+ title: z22.string().max(2000).catch(""),
3563
+ ts: ts2
3564
+ })).max(200).catch([]),
3565
+ log_counts: z22.record(spanId, count3).catch({}),
3566
+ ...completeness2
3567
+ });
3568
+ var traceBriefSchema = z22.object({
3569
+ trace_id: traceId,
3570
+ spans: count3,
3571
+ errors: count3,
3572
+ start: ts2.nullable(),
3573
+ end: ts2.nullable()
3574
+ });
3575
+ var BODY_KINDS = ["string", "json", "empty"];
3576
+ var logRowSchema = z22.object({
3577
+ log_id: z22.guid(),
3578
+ project_id: z22.number().int().positive(),
3579
+ ts: ts2,
3580
+ observed_ts: ts2.catch(""),
3581
+ service: label2,
3582
+ environment: z22.string().max(64).catch(""),
3583
+ severity_number: z22.number().int().min(0).max(24).catch(0),
3584
+ severity_text: z22.string().max(32).catch(""),
3585
+ body: z22.string().max(70000).catch(""),
3586
+ body_kind: z22.enum(BODY_KINDS).catch("string"),
3587
+ trace_id: z22.union([traceId, z22.literal("")]).catch(""),
3588
+ span_id: optSpanId.catch(""),
3589
+ event_name: z22.string().max(256).catch(""),
3590
+ scope_name: z22.string().max(256).catch(""),
3591
+ source_protocol: z22.enum(SOURCE_PROTOCOLS).catch("otlp"),
3592
+ attributes: attrs,
3593
+ resource: attrs
3594
+ });
3595
+ var logListSchema = z22.object({
3596
+ logs: z22.array(logRowSchema).max(TELEMETRY_QUERY.logsPageSize),
3597
+ next_cursor: z22.string().max(512).nullable(),
3598
+ ...completeness2
3599
+ });
3600
+ var logHistogramSchema = z22.object({
3601
+ bucket_ms: z22.number().int().positive(),
3602
+ buckets: z22.array(z22.object({
3603
+ t: ts2,
3604
+ counts: z22.partialRecord(z22.enum([...SEVERITIES, "unspecified"]), count3).catch({})
3605
+ })).max(TELEMETRY_QUERY.histogramMaxBuckets),
3606
+ ...completeness2
3607
+ });
3608
+ var logFacetsSchema = z22.object({
3609
+ facets: z22.array(z22.object({
3610
+ key: z22.string().max(256),
3611
+ values: z22.array(z22.object({ value: z22.string().max(512), count: count3 })).max(TELEMETRY_QUERY.facetsMaxValues),
3612
+ estimated: z22.boolean().catch(false)
3613
+ })).max(TELEMETRY_QUERY.facetsMaxKeys),
3614
+ ...completeness2
3615
+ });
3616
+ var telemetryUsageSchema = z22.object({
3617
+ days: z22.array(z22.object({
3618
+ day: z22.string().regex(/^\d{4}-\d{2}-\d{2}$/),
3619
+ signal: z22.enum(TELEMETRY_SIGNALS),
3620
+ reason: z22.enum(TELEMETRY_REASONS),
3621
+ records: count3,
3622
+ bytes: count3
3623
+ })).max(31 * TELEMETRY_SIGNALS.length * TELEMETRY_REASONS.length),
3624
+ retention_effective_days: z22.object({
3625
+ traces: z22.number().int().nonnegative(),
3626
+ logs: z22.number().int().nonnegative(),
3627
+ metrics: z22.number().int().nonnegative().optional()
3628
+ }),
3629
+ disk: z22.object({
3630
+ budget_bytes: count3,
3631
+ traces_bytes: count3,
3632
+ logs_bytes: count3,
3633
+ metrics_bytes: count3.optional(),
3634
+ traces_share: z22.number().min(0).max(1)
3635
+ }).nullable().catch(null)
3636
+ });
3637
+ var SIGNAL_STALE_MS = 24 * 3600 * 1000;
3638
+ var sdkLabel = z22.string().max(64);
3639
+ var serviceSeenSchema = z22.object({
3640
+ project_id: z22.number().int().positive(),
3641
+ environment: z22.string().max(64),
3642
+ service_name: z22.string().max(TELEMETRY_LIMITS.serviceNameMaxChars),
3643
+ sdk_language: sdkLabel,
3644
+ sdk_name: sdkLabel,
3645
+ sdk_version: sdkLabel,
3646
+ signals: z22.array(z22.enum(TELEMETRY_SIGNALS)).min(1).max(TELEMETRY_SIGNALS.length),
3647
+ first_seen: z22.number().int().positive(),
3648
+ last_seen: z22.number().int().positive()
3649
+ });
3650
+ var servicesSeenReportSchema = z22.object({
3651
+ project_id: z22.number().int().positive(),
3652
+ services: z22.array(serviceSeenSchema.omit({ project_id: true })).max(TELEMETRY_LIMITS.servicesPerProject)
3653
+ });
3654
+ var telemetryUsageReportSchema = z22.object({
3655
+ project_id: z22.number().int().positive(),
3656
+ day: z22.string().regex(/^\d{4}-\d{2}-\d{2}$/),
3657
+ rows: z22.array(z22.object({
3658
+ signal: z22.enum(TELEMETRY_SIGNALS),
3659
+ reason: z22.enum(TELEMETRY_REASONS),
3660
+ records: z22.number().int().nonnegative(),
3661
+ bytes: z22.number().int().nonnegative()
3662
+ })).max(TELEMETRY_SIGNALS.length * TELEMETRY_REASONS.length),
3663
+ retention_effective_days: z22.object({
3664
+ traces: z22.number().int().nonnegative(),
3665
+ logs: z22.number().int().nonnegative(),
3666
+ metrics: z22.number().int().nonnegative().optional()
3667
+ }).optional()
3668
+ });
3669
+ var ingestKeyUsedSchema = z22.object({
3670
+ key_id: z22.guid(),
3671
+ project_id: z22.number().int().positive(),
3672
+ used_at: z22.string().datetime()
3673
+ });
3674
+ var telemetryReceiptSchema = z22.object({
3675
+ project_id: z22.number().int().positive(),
3676
+ verification_id: z22.string().regex(/^bv1_[0-9a-f]{32}$/),
3677
+ signal: z22.enum(TELEMETRY_SIGNALS),
3678
+ environment: z22.string().max(64),
3679
+ service_name: z22.string().max(TELEMETRY_LIMITS.serviceNameMaxChars),
3680
+ sdk_name: sdkLabel,
3681
+ sdk_version: sdkLabel,
3682
+ received_at: z22.string().datetime()
3683
+ });
3684
+
3685
+ // ../src/shared/contracts/web-vitals.ts
3686
+ import { z as z23 } from "zod";
3392
3687
 
3393
3688
  // ../src/shared/contracts/vocab/web-vitals.ts
3394
3689
  var WEB_VITAL_NAMES = ["LCP", "INP", "CLS", "FCP", "TTFB"];
@@ -3407,214 +3702,222 @@ var WEB_VITAL_LIMITS = {
3407
3702
  maxWindowMs: 7 * 24 * 3600 * 1000,
3408
3703
  defaultWindowMs: 24 * 3600 * 1000
3409
3704
  };
3410
- var ratingCounts = z22.object({
3411
- good: z22.number().int().nonnegative(),
3412
- needs_improvement: z22.number().int().nonnegative(),
3413
- poor: z22.number().int().nonnegative()
3414
- });
3415
- var webVitalSummarySchema = z22.object({
3416
- name: z22.enum(WEB_VITAL_NAMES),
3417
- metric: z22.string(),
3418
- unit: z22.enum(["ms", "1"]),
3419
- samples: z22.number().int().nonnegative(),
3420
- p75: z22.number().nullable(),
3421
- rating: z22.enum(WEB_VITAL_RATINGS).nullable(),
3422
- estimate: z22.boolean(),
3705
+ var ratingCounts = z23.object({
3706
+ good: z23.number().int().nonnegative(),
3707
+ needs_improvement: z23.number().int().nonnegative(),
3708
+ poor: z23.number().int().nonnegative()
3709
+ });
3710
+ var webVitalSummarySchema = z23.object({
3711
+ name: z23.enum(WEB_VITAL_NAMES),
3712
+ metric: z23.string(),
3713
+ unit: z23.enum(["ms", "1"]),
3714
+ samples: z23.number().int().nonnegative(),
3715
+ p75: z23.number().nullable(),
3716
+ rating: z23.enum(WEB_VITAL_RATINGS).nullable(),
3717
+ estimate: z23.boolean(),
3423
3718
  ratings: ratingCounts,
3424
- distribution: z22.array(z22.object({ le: z22.number().nullable(), count: z22.number().int().nonnegative() })),
3425
- routes: z22.array(z22.object({
3426
- path: z22.string(),
3427
- samples: z22.number().int().nonnegative(),
3428
- p75: z22.number().nullable(),
3429
- rating: z22.enum(WEB_VITAL_RATINGS).nullable()
3719
+ distribution: z23.array(z23.object({ le: z23.number().nullable(), count: z23.number().int().nonnegative() })),
3720
+ routes: z23.array(z23.object({
3721
+ path: z23.string(),
3722
+ samples: z23.number().int().nonnegative(),
3723
+ p75: z23.number().nullable(),
3724
+ rating: z23.enum(WEB_VITAL_RATINGS).nullable()
3430
3725
  })),
3431
- routes_total: z22.number().int().nonnegative(),
3432
- attribution: z22.array(z22.object({ target: z22.string(), samples: z22.number().int().nonnegative(), p75: z22.number().nullable() }))
3726
+ routes_total: z23.number().int().nonnegative(),
3727
+ attribution: z23.array(z23.object({ target: z23.string(), samples: z23.number().int().nonnegative(), p75: z23.number().nullable() }))
3433
3728
  });
3434
- var webVitalsSummarySchema = z22.object({
3435
- from: z22.string(),
3436
- to: z22.string(),
3437
- path: z22.string().nullable(),
3438
- vitals: z22.array(webVitalSummarySchema),
3439
- complete: z22.boolean()
3729
+ var webVitalsSummarySchema = z23.object({
3730
+ from: z23.string(),
3731
+ to: z23.string(),
3732
+ path: z23.string().nullable(),
3733
+ vitals: z23.array(webVitalSummarySchema),
3734
+ complete: z23.boolean()
3440
3735
  });
3441
3736
 
3442
3737
  // ../src/shared/contracts/api-ops/node-data.ts
3443
- var issueId = z23.number().int().positive();
3444
- var csv = z23.string().min(1).max(2000);
3445
- var projectIds2 = z23.string().max(2000).regex(/^[1-9][0-9]{0,15}(?:,[1-9][0-9]{0,15}){0,99}$/, "comma-separated project ids");
3446
- var name2 = z23.string().min(1).max(256);
3447
- var period = z23.enum(["1h", "24h", "7d", "14d", "30d"]);
3448
- var nodeCursor = z23.string().min(1).max(600).optional();
3738
+ var issueId = z24.number().int().positive();
3739
+ var csv = z24.string().min(1).max(2000);
3740
+ 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");
3741
+ var name2 = z24.string().min(1).max(256);
3742
+ var period = z24.enum(["1h", "24h", "7d", "14d", "30d"]);
3743
+ var nodeCursor = z24.string().min(1).max(600).optional();
3449
3744
  var windowFields = {
3450
- start: z23.string().max(40).optional(),
3451
- end: z23.string().max(40).optional()
3745
+ start: z24.string().max(40).optional(),
3746
+ end: z24.string().max(40).optional()
3452
3747
  };
3453
- var traceId = z23.string().regex(/^[0-9a-fA-F]{32}$/);
3454
- var spanId = z23.string().regex(/^[0-9a-fA-F]{16}$/);
3455
- var attrs = z23.string().max(2000).optional();
3748
+ var traceId2 = z24.string().regex(/^[0-9a-fA-F]{32}$/);
3749
+ var spanId2 = z24.string().regex(/^[0-9a-fA-F]{16}$/);
3750
+ var attrs2 = z24.string().max(2000).optional();
3751
+ var facetKey = ATTR_KEY_RE.source.slice(1, -1);
3752
+ var facetKeysRe = new RegExp(`^${facetKey}(?:,${facetKey}){0,${TELEMETRY_QUERY.facetsMaxKeys - 1}}$`);
3456
3753
  var telemetryCommon = {
3457
3754
  ...windowFields,
3458
3755
  project: projectIds2.optional(),
3459
3756
  environment: csv.optional(),
3460
3757
  service: csv.optional(),
3461
- attrs
3758
+ attrs: attrs2
3462
3759
  };
3463
- var issueChange = z23.union([
3464
- z23.object({
3465
- action: z23.literal("resolve"),
3466
- inNextRelease: z23.boolean().optional(),
3760
+ var issueChange = z24.union([
3761
+ z24.object({
3762
+ action: z24.literal("resolve"),
3763
+ inNextRelease: z24.boolean().optional(),
3467
3764
  inRelease: releaseNameSchema.optional()
3468
3765
  }),
3469
- z23.object({ action: z23.literal("unresolve") }),
3470
- z23.object({ action: z23.literal("archive"), mode: z23.enum(["until_escalating", "forever"]) }),
3471
- z23.object({
3472
- action: z23.literal("archive"),
3473
- mode: z23.literal("until_condition"),
3474
- events: z23.number().int().min(1).max(1e6).optional(),
3475
- users: z23.number().int().min(1).max(1e5).optional(),
3476
- until: z23.string().datetime().optional()
3477
- }),
3478
- z23.object({ action: z23.literal("assign"), userId: z23.guid().nullable() }),
3479
- z23.object({ action: z23.literal("priority"), priority: z23.enum(["low", "medium", "high"]) })
3766
+ z24.object({ action: z24.literal("unresolve") }),
3767
+ z24.object({ action: z24.literal("archive"), mode: z24.enum(["until_escalating", "forever"]) }),
3768
+ z24.object({
3769
+ action: z24.literal("archive"),
3770
+ mode: z24.literal("until_condition"),
3771
+ events: z24.number().int().min(1).max(1e6).optional(),
3772
+ users: z24.number().int().min(1).max(1e5).optional(),
3773
+ until: z24.string().datetime().optional()
3774
+ }),
3775
+ z24.object({ action: z24.literal("assign"), userId: z24.guid().nullable() }),
3776
+ z24.object({ action: z24.literal("priority"), priority: z24.enum(["low", "medium", "high"]) })
3480
3777
  ]);
3481
3778
  var NODE_INPUTS = {
3482
- issuesList: z23.object({
3779
+ issuesList: z24.object({
3483
3780
  project: projectIds2.optional(),
3484
- status: z23.enum(["unresolved", "resolved", "archived", "all"]).optional(),
3781
+ status: z24.enum(["unresolved", "resolved", "archived", "all"]).optional(),
3485
3782
  level: csv.optional(),
3486
3783
  priority: csv.optional(),
3487
3784
  environment: csv.optional(),
3488
3785
  release: csv.optional(),
3489
- assignee: z23.string().max(64).optional(),
3786
+ assignee: z24.string().max(64).optional(),
3490
3787
  period: period.optional(),
3491
- q: z23.string().max(200).optional(),
3492
- sort: z23.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
3788
+ q: z24.string().max(200).optional(),
3789
+ sort: z24.enum(["last_seen", "first_seen", "events", "users", "priority"]).optional(),
3493
3790
  cursor: nodeCursor,
3494
- limit: z23.number().int().min(1).max(100).optional()
3791
+ limit: z24.number().int().min(1).max(100).optional()
3495
3792
  }),
3496
- issue: z23.object({ issueId }),
3497
- issueStats: z23.object({ issueId, range: z23.enum(["24h", "30d"]).optional() }),
3498
- issueEvents: z23.object({ issueId, cursor: nodeCursor }),
3499
- issueEvent: z23.object({
3793
+ issue: z24.object({ issueId }),
3794
+ issueStats: z24.object({ issueId, range: z24.enum(["24h", "30d"]).optional() }),
3795
+ issueEvents: z24.object({ issueId, cursor: nodeCursor }),
3796
+ issueEvent: z24.object({
3500
3797
  issueId,
3501
- eventId: z23.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
3798
+ eventId: z24.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
3502
3799
  }),
3503
- issueUpdate: z23.object({ issueId, change: issueChange }),
3504
- issuesBulk: z23.object({
3505
- issueIds: z23.array(issueId).min(1).max(100),
3800
+ issueUpdate: z24.object({ issueId, change: issueChange }),
3801
+ issuesBulk: z24.object({
3802
+ issueIds: z24.array(issueId).min(1).max(100),
3506
3803
  action: issueChange
3507
3804
  }),
3508
- spansList: z23.object({
3805
+ spansList: z24.object({
3509
3806
  ...telemetryCommon,
3510
- operation: z23.string().min(1).max(1024).optional(),
3511
- status: z23.enum(["unset", "ok", "error"]).optional(),
3512
- kind: z23.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
3513
- minDurationMs: z23.number().min(0).max(86400000).optional(),
3514
- maxDurationMs: z23.number().min(0).max(86400000).optional(),
3515
- mode: z23.enum(["spans", "traces"]).optional(),
3807
+ operation: z24.string().min(1).max(1024).optional(),
3808
+ status: z24.enum(["unset", "ok", "error"]).optional(),
3809
+ kind: z24.enum(["internal", "server", "client", "producer", "consumer"]).optional(),
3810
+ minDurationMs: z24.number().min(0).max(86400000).optional(),
3811
+ maxDurationMs: z24.number().min(0).max(86400000).optional(),
3812
+ mode: z24.enum(["spans", "traces"]).optional(),
3516
3813
  cursor: nodeCursor
3517
3814
  }),
3518
- spansHistogram: z23.object({
3815
+ spansHistogram: z24.object({
3519
3816
  ...telemetryCommon,
3520
- operation: z23.string().min(1).max(1024).optional(),
3521
- status: z23.enum(["unset", "ok", "error"]).optional()
3817
+ operation: z24.string().min(1).max(1024).optional(),
3818
+ status: z24.enum(["unset", "ok", "error"]).optional()
3522
3819
  }),
3523
- trace: z23.object({ traceId }),
3524
- traceSpans: z23.object({ traceId, errorsOnly: z23.enum(["1"]).optional(), ...windowFields }),
3525
- span: z23.object({ traceId, spanId, ...windowFields }),
3526
- logsList: z23.object({
3820
+ trace: z24.object({ traceId: traceId2 }),
3821
+ traceSpans: z24.object({ traceId: traceId2, errorsOnly: z24.enum(["1"]).optional(), ...windowFields }),
3822
+ span: z24.object({ traceId: traceId2, spanId: spanId2, ...windowFields }),
3823
+ logsList: z24.object({
3527
3824
  ...telemetryCommon,
3528
- severityMin: z23.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3529
- traceId: traceId.optional(),
3530
- spanId: spanId.optional(),
3531
- q: z23.string().max(500).optional(),
3532
- order: z23.enum(["asc", "desc"]).optional(),
3825
+ severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3826
+ traceId: traceId2.optional(),
3827
+ spanId: spanId2.optional(),
3828
+ q: z24.string().max(500).optional(),
3829
+ order: z24.enum(["asc", "desc"]).optional(),
3533
3830
  cursor: nodeCursor
3534
3831
  }),
3535
- logsFacets: z23.object({
3832
+ logsHistogram: z24.object({
3536
3833
  ...telemetryCommon,
3537
- severityMin: z23.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3538
- q: z23.string().max(500).optional()
3539
- }),
3540
- logAround: z23.object({
3541
- logId: z23.guid(),
3542
- at: z23.string().max(40),
3543
- same: z23.enum(["service", "trace"]).optional(),
3544
- before: z23.number().int().min(0).max(200).optional(),
3545
- after: z23.number().int().min(0).max(200).optional()
3546
- }),
3547
- metricsNames: z23.object({
3548
- project: z23.number().int().positive(),
3834
+ severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3835
+ q: z24.string().max(500).optional()
3836
+ }),
3837
+ logsFacets: z24.object({
3838
+ ...telemetryCommon,
3839
+ severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3840
+ q: z24.string().max(500).optional(),
3841
+ keys: z24.string().regex(facetKeysRe, `up to ${TELEMETRY_QUERY.facetsMaxKeys} comma-separated keys`).default(LOG_BUILTIN_FACETS.join(","))
3842
+ }),
3843
+ logAround: z24.object({
3844
+ logId: z24.guid(),
3845
+ at: z24.string().max(40),
3846
+ same: z24.enum(["service", "trace"]).optional(),
3847
+ before: z24.number().int().min(0).max(200).optional(),
3848
+ after: z24.number().int().min(0).max(200).optional()
3849
+ }),
3850
+ metricsNames: z24.object({
3851
+ project: z24.number().int().positive(),
3549
3852
  environment: csv.optional(),
3550
- q: z23.string().max(255).optional()
3853
+ q: z24.string().max(255).optional()
3551
3854
  }),
3552
- metricsSeries: z23.object({
3553
- project: z23.number().int().positive(),
3554
- name: z23.string().regex(METRIC_NAME_RE),
3855
+ metricsSeries: z24.object({
3856
+ project: z24.number().int().positive(),
3857
+ name: z24.string().regex(METRIC_NAME_RE),
3555
3858
  environment: csv.optional(),
3556
- attrs,
3557
- cursor: z23.string().regex(/^[0-9a-f]{16}$/).optional()
3859
+ attrs: attrs2,
3860
+ cursor: z24.string().regex(/^[0-9a-f]{16}$/).optional()
3558
3861
  }),
3559
- metricsQuery: z23.object({
3560
- project: z23.number().int().positive(),
3561
- name: z23.string().regex(METRIC_NAME_RE),
3562
- aggregation: z23.enum(METRIC_AGGREGATIONS),
3862
+ metricsQuery: z24.object({
3863
+ project: z24.number().int().positive(),
3864
+ name: z24.string().regex(METRIC_NAME_RE),
3865
+ aggregation: z24.enum(METRIC_AGGREGATIONS),
3563
3866
  ...windowFields,
3564
- step: z23.number().int().min(METRIC_QUERY.minStepSeconds).max(METRIC_QUERY.maxStepSeconds).multipleOf(60).optional(),
3565
- attrs,
3566
- groupBy: z23.string().min(1).max(600).optional(),
3867
+ step: z24.number().int().min(METRIC_QUERY.minStepSeconds).max(METRIC_QUERY.maxStepSeconds).multipleOf(60).optional(),
3868
+ attrs: attrs2,
3869
+ groupBy: z24.string().min(1).max(600).optional(),
3567
3870
  environment: csv.optional()
3568
3871
  }),
3569
- telemetryUsage: z23.object({
3872
+ telemetryUsage: z24.object({
3570
3873
  project: projectIds2.optional(),
3571
- days: z23.number().int().min(1).max(31).optional()
3874
+ days: z24.number().int().min(1).max(31).optional()
3572
3875
  }),
3573
- monitorSignal: z23.object({
3574
- monitorId: z23.guid(),
3575
- hours: z23.number().int().min(1).max(24).optional()
3876
+ monitorSignal: z24.object({
3877
+ monitorId: z24.guid(),
3878
+ hours: z24.number().int().min(1).max(24).optional()
3576
3879
  }),
3577
- monitorOccurrences: z23.object({
3578
- monitorId: z23.guid(),
3579
- state: z23.enum(["open", "finished", "all"]).optional(),
3580
- environment: z23.string().min(1).max(64).optional(),
3880
+ monitorOccurrences: z24.object({
3881
+ monitorId: z24.guid(),
3882
+ state: z24.enum(["open", "finished", "all"]).optional(),
3883
+ environment: z24.string().min(1).max(64).optional(),
3581
3884
  cursor: nodeCursor
3582
3885
  }),
3583
- monitorBacktest: z23.object({
3584
- project: z23.number().int().positive(),
3886
+ monitorBacktest: z24.object({
3887
+ project: z24.number().int().positive(),
3585
3888
  settings: backtestSettingsSchema
3586
3889
  }),
3587
- occurrenceCreate: z23.object({
3588
- project: z23.number().int().positive(),
3890
+ occurrenceCreate: z24.object({
3891
+ project: z24.number().int().positive(),
3589
3892
  monitorSlug: occurrenceInputSchema.shape.monitor_slug,
3590
3893
  occurrenceId: occurrenceInputSchema.shape.occurrence_id,
3591
3894
  dueAt: occurrenceInputSchema.shape.due_at,
3592
3895
  environment: occurrenceInputSchema.shape.environment
3593
3896
  }),
3594
- occurrenceCancel: z23.object({
3595
- project: z23.number().int().positive(),
3596
- monitorSlug: z23.string().regex(SLUG_RE),
3597
- occurrenceId: z23.string().regex(OCCURRENCE_ID_RE),
3598
- environment: z23.string().min(1).max(64).optional()
3897
+ occurrenceCancel: z24.object({
3898
+ project: z24.number().int().positive(),
3899
+ monitorSlug: z24.string().regex(SLUG_RE),
3900
+ occurrenceId: z24.string().regex(OCCURRENCE_ID_RE),
3901
+ environment: z24.string().min(1).max(64).optional()
3599
3902
  }),
3600
- webVitals: z23.object({
3601
- project: z23.number().int().positive(),
3903
+ webVitals: z24.object({
3904
+ project: z24.number().int().positive(),
3602
3905
  ...windowFields,
3603
3906
  environment: csv.optional(),
3604
- path: z23.string().max(WEB_VITAL_LIMITS.pathMaxChars).regex(/^(?:\/[^\s?#]*|other)$/).optional()
3907
+ path: z24.string().max(WEB_VITAL_LIMITS.pathMaxChars).regex(/^(?:\/[^\s?#]*|other)$/).optional()
3605
3908
  }),
3606
- releasesList: z23.object({
3607
- project: z23.number().int().positive(),
3909
+ releasesList: z24.object({
3910
+ project: z24.number().int().positive(),
3608
3911
  environment: environmentNameSchema.optional()
3609
3912
  }),
3610
- releaseHealth: z23.object({
3611
- project: z23.number().int().positive(),
3913
+ releaseHealth: z24.object({
3914
+ project: z24.number().int().positive(),
3612
3915
  version: releaseNameSchema,
3613
3916
  environment: environmentNameSchema.optional(),
3614
3917
  compare: releaseNameSchema.optional()
3615
3918
  }),
3616
- deploymentCreate: z23.object({
3617
- project: z23.number().int().positive(),
3919
+ deploymentCreate: z24.object({
3920
+ project: z24.number().int().positive(),
3618
3921
  version: deploymentInputSchema.shape.version,
3619
3922
  environment: deploymentInputSchema.shape.environment,
3620
3923
  name: deploymentInputSchema.shape.name,
@@ -3623,10 +3926,10 @@ var NODE_INPUTS = {
3623
3926
  finishedAt: deploymentInputSchema.shape.finished_at,
3624
3927
  deployId: deploymentInputSchema.shape.deploy_id
3625
3928
  }),
3626
- ticket: z23.object({
3627
- scope: z23.enum(["read", "write"]).default("read"),
3628
- project: z23.number().int().positive().optional(),
3629
- environment: z23.string().min(1).max(64).optional()
3929
+ ticket: z24.object({
3930
+ scope: z24.enum(["read", "write"]).default("read"),
3931
+ project: z24.number().int().positive().optional(),
3932
+ environment: z24.string().min(1).max(64).optional()
3630
3933
  })
3631
3934
  };
3632
3935
  var N = NODE_INPUTS;
@@ -3766,7 +4069,7 @@ var NODE_OPERATIONS = [
3766
4069
  id: "logs.histogram",
3767
4070
  path: "/v1/logs/histogram",
3768
4071
  scope: "logs:read",
3769
- input: N.logsFacets,
4072
+ input: N.logsHistogram,
3770
4073
  node: { path: "q/logs/histogram", window: true },
3771
4074
  summary: "Log counts by severity over a window."
3772
4075
  }),
@@ -3963,10 +4266,10 @@ var NODE_OPERATIONS = [
3963
4266
  ];
3964
4267
 
3965
4268
  // ../src/shared/contracts/api-ops/privacy.ts
3966
- import { z as z25 } from "zod";
4269
+ import { z as z26 } from "zod";
3967
4270
 
3968
4271
  // ../src/shared/contracts/privacy.ts
3969
- import { z as z24 } from "zod";
4272
+ import { z as z25 } from "zod";
3970
4273
 
3971
4274
  // ../src/shared/privacy/rules.ts
3972
4275
  var PRIVACY_SCHEMA = 1;
@@ -3997,46 +4300,46 @@ var REMOVE = Symbol("remove");
3997
4300
 
3998
4301
  // ../src/shared/contracts/privacy.ts
3999
4302
  var PRIVACY_KEY_MAX_VERSION = 1e6;
4000
- var ruleId = z24.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
4001
- var privacyRuleInputSchema = z24.object({
4303
+ var ruleId = z25.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
4304
+ var privacyRuleInputSchema = z25.object({
4002
4305
  id: ruleId,
4003
- selector: z24.string().min(1).max(PRIVACY_LIMITS.selector),
4004
- type: z24.enum(PRIVACY_RULE_TYPES),
4005
- method: z24.enum(PRIVACY_METHODS),
4006
- pattern: z24.string().min(1).max(PRIVACY_LIMITS.pattern).optional(),
4007
- ignoreCase: z24.boolean().optional(),
4008
- replaceWith: z24.string().max(PRIVACY_LIMITS.replaceWith).optional(),
4009
- enabled: z24.boolean().optional()
4010
- });
4011
- var privacyPolicyInputSchema = z24.object({
4012
- mode: z24.enum(PRIVACY_MODES),
4013
- rules: z24.array(privacyRuleInputSchema).max(PRIVACY_LIMITS.rules),
4014
- allowlist: z24.array(z24.string().min(1).max(PRIVACY_LIMITS.selector)).max(PRIVACY_LIMITS.allowlist)
4015
- });
4016
- var storedPolicySchema = z24.object({
4017
- schema: z24.literal(PRIVACY_SCHEMA),
4018
- version: z24.number().int().min(0),
4019
- mode: z24.enum(PRIVACY_MODES),
4020
- rules: z24.array(z24.record(z24.string(), z24.unknown())).max(PRIVACY_LIMITS.rules),
4021
- allowlist: z24.array(z24.string()).max(PRIVACY_LIMITS.allowlist)
4022
- });
4023
- var nodePrivacyBlockSchema = z24.array(z24.object({ project_id: z24.number().int().positive(), policy: z24.unknown() })).max(1000);
4024
- var privacyRollupSchema = z24.object({
4025
- applied_version: z24.number().int().min(0).nullable(),
4026
- policy_missing_24h: z24.number().int().nonnegative(),
4027
- budget_exceeded_24h: z24.number().int().nonnegative(),
4028
- sdk_versions: z24.array(z24.object({ version: z24.number().int().min(0), last_seen_at: z24.string().datetime() })).max(5),
4029
- key_version: z24.number().int().min(1).max(PRIVACY_KEY_MAX_VERSION).optional(),
4030
- key_created_at: z24.string().datetime().nullable().optional()
4306
+ selector: z25.string().min(1).max(PRIVACY_LIMITS.selector),
4307
+ type: z25.enum(PRIVACY_RULE_TYPES),
4308
+ method: z25.enum(PRIVACY_METHODS),
4309
+ pattern: z25.string().min(1).max(PRIVACY_LIMITS.pattern).optional(),
4310
+ ignoreCase: z25.boolean().optional(),
4311
+ replaceWith: z25.string().max(PRIVACY_LIMITS.replaceWith).optional(),
4312
+ enabled: z25.boolean().optional()
4313
+ });
4314
+ var privacyPolicyInputSchema = z25.object({
4315
+ mode: z25.enum(PRIVACY_MODES),
4316
+ rules: z25.array(privacyRuleInputSchema).max(PRIVACY_LIMITS.rules),
4317
+ allowlist: z25.array(z25.string().min(1).max(PRIVACY_LIMITS.selector)).max(PRIVACY_LIMITS.allowlist)
4318
+ });
4319
+ var storedPolicySchema = z25.object({
4320
+ schema: z25.literal(PRIVACY_SCHEMA),
4321
+ version: z25.number().int().min(0),
4322
+ mode: z25.enum(PRIVACY_MODES),
4323
+ rules: z25.array(z25.record(z25.string(), z25.unknown())).max(PRIVACY_LIMITS.rules),
4324
+ allowlist: z25.array(z25.string()).max(PRIVACY_LIMITS.allowlist)
4325
+ });
4326
+ var nodePrivacyBlockSchema = z25.array(z25.object({ project_id: z25.number().int().positive(), policy: z25.unknown() })).max(1000);
4327
+ var privacyRollupSchema = z25.object({
4328
+ applied_version: z25.number().int().min(0).nullable(),
4329
+ policy_missing_24h: z25.number().int().nonnegative(),
4330
+ budget_exceeded_24h: z25.number().int().nonnegative(),
4331
+ sdk_versions: z25.array(z25.object({ version: z25.number().int().min(0), last_seen_at: z25.string().datetime() })).max(5),
4332
+ key_version: z25.number().int().min(1).max(PRIVACY_KEY_MAX_VERSION).optional(),
4333
+ key_created_at: z25.string().datetime().nullable().optional()
4031
4334
  });
4032
4335
 
4033
4336
  // ../src/shared/contracts/api-ops/privacy.ts
4034
4337
  var PRIVACY_INPUTS = {
4035
- get: z25.object({ workspaceId: uuid, projectId }),
4036
- set: z25.object({
4338
+ get: z26.object({ workspaceId: uuid, projectId }),
4339
+ set: z26.object({
4037
4340
  workspaceId: uuid,
4038
4341
  projectId,
4039
- expectedVersion: z25.number().int().min(0),
4342
+ expectedVersion: z26.number().int().min(0),
4040
4343
  policy: privacyPolicyInputSchema
4041
4344
  })
4042
4345
  };
@@ -4076,105 +4379,109 @@ var PRIVACY_OPERATIONS = [
4076
4379
  ];
4077
4380
 
4078
4381
  // ../src/shared/contracts/api-ops/projects.ts
4079
- import { z as z29 } from "zod";
4382
+ import { z as z30 } from "zod";
4080
4383
 
4081
4384
  // ../src/shared/contracts/ingest-keys.ts
4082
- import { z as z26 } from "zod";
4385
+ import { z as z27 } from "zod";
4083
4386
  var INGEST_KEY_SCOPES = ["traces", "logs", "metrics", "errors", "monitors"];
4084
4387
  var INGEST_KEY_STATES = ["active", "revoked"];
4085
4388
  var INGEST_KEY_LIMITS = {
4086
4389
  nameMaxChars: 80,
4087
4390
  environmentsMax: 20,
4088
4391
  environmentMaxChars: 64,
4089
- edgeCacheSeconds: 60
4392
+ revocationSeconds: 60,
4393
+ publishIntervalSeconds: 10,
4394
+ kvCacheTtlSeconds: 30,
4395
+ isolateCacheSeconds: 15
4090
4396
  };
4397
+ var INGEST_KEY_REVOCATION_WORST_SECONDS = INGEST_KEY_LIMITS.publishIntervalSeconds + INGEST_KEY_LIMITS.kvCacheTtlSeconds + INGEST_KEY_LIMITS.isolateCacheSeconds;
4091
4398
  var CHECKIN_AUTH_MODES = ["public_or_key", "key_only"];
4092
- var ingestKeyConfigSchema = z26.object({
4093
- v: z26.literal(1),
4094
- key_id: z26.guid(),
4095
- project_public_id: z26.number().int().positive(),
4096
- project_id: z26.number().int().positive(),
4097
- workspace_id: z26.guid(),
4399
+ var ingestKeyConfigSchema = z27.object({
4400
+ v: z27.literal(1),
4401
+ key_id: z27.guid(),
4402
+ project_public_id: z27.number().int().positive(),
4403
+ project_id: z27.number().int().positive(),
4404
+ workspace_id: z27.guid(),
4098
4405
  node_id: nodeIdSchema,
4099
- scopes: z26.array(z26.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
4100
- environments: z26.array(z26.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
4101
- expires_at: z26.string().datetime({ offset: true }).nullable(),
4102
- state: z26.enum(INGEST_KEY_STATES),
4103
- workspace_status: z26.enum(["active", "suspended", "deleting"]),
4104
- ingest_kill: z26.boolean(),
4105
- telemetry_kill: z26.boolean(),
4106
- telemetry_rate_bytes_per_sec: z26.number().int().positive(),
4107
- telemetry_burst_bytes: z26.number().int().positive(),
4108
- traces_monthly_bytes: z26.number().int().positive(),
4109
- logs_monthly_bytes: z26.number().int().positive(),
4110
- metrics_monthly_bytes: z26.number().int().positive().optional(),
4111
- telemetry_buffer_minutes: z26.number().int().min(1).max(1440),
4112
- revision: z26.number().int().nonnegative()
4113
- });
4114
- var createIngestKeyInputSchema = z26.object({
4115
- projectId: z26.number().int().positive(),
4116
- name: z26.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
4117
- scopes: z26.array(z26.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
4118
- environments: z26.array(z26.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
4119
- expiresAt: z26.string().datetime({ offset: true }).nullable()
4120
- });
4121
- var ingestKeyRowSchema = z26.object({
4122
- id: z26.guid(),
4123
- project_id: z26.number().int().positive(),
4124
- name: z26.string(),
4125
- prefix: z26.string(),
4126
- scopes: z26.array(z26.enum(INGEST_KEY_SCOPES)),
4127
- environments: z26.array(z26.string()),
4128
- expires_at: z26.string().nullable(),
4129
- state: z26.enum(INGEST_KEY_STATES),
4130
- created_by: z26.guid().nullable(),
4131
- created_at: z26.string(),
4132
- revoked_at: z26.string().nullable(),
4133
- last_used_at: z26.string().nullable()
4406
+ scopes: z27.array(z27.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
4407
+ environments: z27.array(z27.string().max(INGEST_KEY_LIMITS.environmentMaxChars)).max(INGEST_KEY_LIMITS.environmentsMax),
4408
+ expires_at: z27.string().datetime({ offset: true }).nullable(),
4409
+ state: z27.enum(INGEST_KEY_STATES),
4410
+ workspace_status: z27.enum(["active", "suspended", "deleting"]),
4411
+ ingest_kill: z27.boolean(),
4412
+ telemetry_kill: z27.boolean(),
4413
+ telemetry_rate_bytes_per_sec: z27.number().int().positive(),
4414
+ telemetry_burst_bytes: z27.number().int().positive(),
4415
+ traces_monthly_bytes: z27.number().int().positive(),
4416
+ logs_monthly_bytes: z27.number().int().positive(),
4417
+ metrics_monthly_bytes: z27.number().int().positive().optional(),
4418
+ telemetry_buffer_minutes: z27.number().int().min(1).max(1440),
4419
+ revision: z27.number().int().nonnegative()
4420
+ });
4421
+ var createIngestKeyInputSchema = z27.object({
4422
+ projectId: z27.number().int().positive(),
4423
+ name: z27.string().trim().min(1).max(INGEST_KEY_LIMITS.nameMaxChars).refine((s) => !/[\u0000-\u001f\u007f]/.test(s)),
4424
+ scopes: z27.array(z27.enum(INGEST_KEY_SCOPES)).min(1).max(INGEST_KEY_SCOPES.length),
4425
+ environments: z27.array(z27.string().trim().min(1).max(INGEST_KEY_LIMITS.environmentMaxChars).regex(/^[^\s/\u0000-\u001f]+$/)).max(INGEST_KEY_LIMITS.environmentsMax),
4426
+ expiresAt: z27.string().datetime({ offset: true }).nullable()
4427
+ });
4428
+ var ingestKeyRowSchema = z27.object({
4429
+ id: z27.guid(),
4430
+ project_id: z27.number().int().positive(),
4431
+ name: z27.string(),
4432
+ prefix: z27.string(),
4433
+ scopes: z27.array(z27.enum(INGEST_KEY_SCOPES)),
4434
+ environments: z27.array(z27.string()),
4435
+ expires_at: z27.string().nullable(),
4436
+ state: z27.enum(INGEST_KEY_STATES),
4437
+ created_by: z27.guid().nullable(),
4438
+ created_at: z27.string(),
4439
+ revoked_at: z27.string().nullable(),
4440
+ last_used_at: z27.string().nullable()
4134
4441
  });
4135
4442
 
4136
4443
  // ../src/shared/contracts/node-config.ts
4137
- import { z as z28 } from "zod";
4444
+ import { z as z29 } from "zod";
4138
4445
 
4139
4446
  // ../src/shared/contracts/backup.ts
4140
- import { z as z27 } from "zod";
4447
+ import { z as z28 } from "zod";
4141
4448
  var BACKUP_KINDS = ["daily", "weekly", "manual", "pre_upgrade"];
4142
- var ageRecipient = z27.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
4143
- var backupIdSchema = z27.string().regex(/^[a-z0-9-]{8,64}$/);
4144
- var nodeBackupConfigSchema = z27.object({
4145
- enabled: z27.boolean(),
4146
- hour_utc: z27.number().int().min(0).max(23),
4147
- weekly_day: z27.number().int().min(1).max(7),
4449
+ var ageRecipient = z28.string().regex(/^age1[02-9ac-hj-np-z]{58}$/);
4450
+ var backupIdSchema = z28.string().regex(/^[a-z0-9-]{8,64}$/);
4451
+ var nodeBackupConfigSchema = z28.object({
4452
+ enabled: z28.boolean(),
4453
+ hour_utc: z28.number().int().min(0).max(23),
4454
+ weekly_day: z28.number().int().min(1).max(7),
4148
4455
  workspace_recipient: ageRecipient
4149
4456
  });
4150
- var backupCredentialsRequestSchema = z27.object({
4151
- mode: z27.enum(["upload", "download"]),
4457
+ var backupCredentialsRequestSchema = z28.object({
4458
+ mode: z28.enum(["upload", "download"]),
4152
4459
  backup_id: backupIdSchema,
4153
- source_node_id: z27.guid().optional()
4154
- });
4155
- var backupCredentialsSchema = z27.object({
4156
- endpoint: z27.string().url(),
4157
- bucket: z27.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
4158
- prefix: z27.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
4159
- access_key_id: z27.string().min(8).max(200),
4160
- secret_access_key: z27.string().min(8).max(200),
4161
- session_token: z27.string().min(8).max(4000),
4162
- expires_at: z27.string().datetime()
4163
- });
4164
- var rowCountsSchema = z27.record(z27.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z27.number().int().nonnegative());
4165
- var backupManifestSchema = z27.object({
4166
- v: z27.literal(1),
4460
+ source_node_id: z28.guid().optional()
4461
+ });
4462
+ var backupCredentialsSchema = z28.object({
4463
+ endpoint: z28.string().url(),
4464
+ bucket: z28.string().regex(/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/),
4465
+ prefix: z28.string().regex(/^backups\/[0-9a-f-]{36}\/$/),
4466
+ access_key_id: z28.string().min(8).max(200),
4467
+ secret_access_key: z28.string().min(8).max(200),
4468
+ session_token: z28.string().min(8).max(4000),
4469
+ expires_at: z28.string().datetime()
4470
+ });
4471
+ var rowCountsSchema = z28.record(z28.string().regex(/^[a-z_][a-z0-9_]{0,63}$/), z28.number().int().nonnegative());
4472
+ var backupManifestSchema = z28.object({
4473
+ v: z28.literal(1),
4167
4474
  backup_id: backupIdSchema,
4168
- node_id: z27.guid(),
4169
- kind: z27.enum(BACKUP_KINDS),
4170
- created_at: z27.string().datetime(),
4171
- object_key: z27.string(),
4172
- size_bytes: z27.number().int().nonnegative(),
4173
- sha256: z27.string().regex(/^[0-9a-f]{64}$/),
4174
- clickhouse_version: z27.string().max(40),
4175
- schema_version: z27.number().int().nonnegative(),
4475
+ node_id: z28.guid(),
4476
+ kind: z28.enum(BACKUP_KINDS),
4477
+ created_at: z28.string().datetime(),
4478
+ object_key: z28.string(),
4479
+ size_bytes: z28.number().int().nonnegative(),
4480
+ sha256: z28.string().regex(/^[0-9a-f]{64}$/),
4481
+ clickhouse_version: z28.string().max(40),
4482
+ schema_version: z28.number().int().nonnegative(),
4176
4483
  row_counts: rowCountsSchema,
4177
- recipients: z27.array(z27.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
4484
+ recipients: z28.array(z28.string().regex(/^[0-9a-f]{8}$/)).min(1).max(4)
4178
4485
  });
4179
4486
  var BACKUP_ERROR_CODES = [
4180
4487
  "CLICKHOUSE_BACKUP_FAILED",
@@ -4188,51 +4495,51 @@ var BACKUP_ERROR_CODES = [
4188
4495
  "RESTORE_FAILED",
4189
4496
  "ROW_COUNT_MISMATCH"
4190
4497
  ];
4191
- var backupReportSchema = z27.object({
4498
+ var backupReportSchema = z28.object({
4192
4499
  backup_id: backupIdSchema,
4193
- kind: z27.enum(BACKUP_KINDS),
4194
- status: z27.enum(["succeeded", "failed"]),
4195
- started_at: z27.string().datetime(),
4196
- finished_at: z27.string().datetime(),
4500
+ kind: z28.enum(BACKUP_KINDS),
4501
+ status: z28.enum(["succeeded", "failed"]),
4502
+ started_at: z28.string().datetime(),
4503
+ finished_at: z28.string().datetime(),
4197
4504
  manifest: backupManifestSchema.nullable(),
4198
- error_code: z27.enum(BACKUP_ERROR_CODES).nullable()
4505
+ error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
4199
4506
  });
4200
- var drillReportSchema = z27.object({
4507
+ var drillReportSchema = z28.object({
4201
4508
  backup_id: backupIdSchema,
4202
- kind: z27.enum(["weekly_local", "monthly_new_machine"]),
4203
- status: z27.enum(["passed", "failed"]),
4204
- finished_at: z27.string().datetime(),
4205
- detail: z27.string().max(300),
4206
- error_code: z27.enum(BACKUP_ERROR_CODES).nullable()
4509
+ kind: z28.enum(["weekly_local", "monthly_new_machine"]),
4510
+ status: z28.enum(["passed", "failed"]),
4511
+ finished_at: z28.string().datetime(),
4512
+ detail: z28.string().max(300),
4513
+ error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
4207
4514
  });
4208
- var nodeIdentityEscrowSchema = z27.object({
4209
- v: z27.literal(1),
4210
- node_id: z27.guid(),
4211
- seal: z27.object({
4212
- publicKey: z27.string().regex(/^[A-Za-z0-9_-]{43}$/),
4213
- privateKey: z27.string().regex(/^[A-Za-z0-9_-]{43}$/)
4515
+ var nodeIdentityEscrowSchema = z28.object({
4516
+ v: z28.literal(1),
4517
+ node_id: z28.guid(),
4518
+ seal: z28.object({
4519
+ publicKey: z28.string().regex(/^[A-Za-z0-9_-]{43}$/),
4520
+ privateKey: z28.string().regex(/^[A-Za-z0-9_-]{43}$/)
4214
4521
  }),
4215
- created_at: z27.string().datetime()
4522
+ created_at: z28.string().datetime()
4216
4523
  });
4217
- var restoreArgsSchema = z27.object({
4218
- job_id: z27.guid(),
4219
- workspace_id: z27.guid(),
4220
- source_node_id: z27.guid(),
4524
+ var restoreArgsSchema = z28.object({
4525
+ job_id: z28.guid(),
4526
+ workspace_id: z28.guid(),
4527
+ source_node_id: z28.guid(),
4221
4528
  manifest: backupManifestSchema,
4222
- sealed_identity: z27.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
4223
- mode: z27.enum(["rebuild", "drill"])
4529
+ sealed_identity: z28.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
4530
+ mode: z28.enum(["rebuild", "drill"])
4224
4531
  });
4225
- var restoreReportSchema = z27.object({
4226
- job_id: z27.guid(),
4532
+ var restoreReportSchema = z28.object({
4533
+ job_id: z28.guid(),
4227
4534
  backup_id: backupIdSchema,
4228
- mode: z27.enum(["rebuild", "drill"]),
4229
- status: z27.enum(["succeeded", "failed"]),
4230
- finished_at: z27.string().datetime(),
4231
- detail: z27.string().max(300),
4232
- error_code: z27.enum(BACKUP_ERROR_CODES).nullable()
4535
+ mode: z28.enum(["rebuild", "drill"]),
4536
+ status: z28.enum(["succeeded", "failed"]),
4537
+ finished_at: z28.string().datetime(),
4538
+ detail: z28.string().max(300),
4539
+ error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
4233
4540
  });
4234
4541
 
4235
- // ../src/shared/contracts/node-config.ts
4542
+ // ../src/shared/contracts/vocab/node-config.ts
4236
4543
  var SCRUB_GROUPS = [
4237
4544
  "credentials",
4238
4545
  "cards",
@@ -4242,86 +4549,88 @@ var SCRUB_GROUPS = [
4242
4549
  "user_id",
4243
4550
  "headers"
4244
4551
  ];
4552
+
4553
+ // ../src/shared/contracts/node-config.ts
4245
4554
  var MAX_NODE_MONITORS = 5000;
4246
- var kid = z28.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
4247
- var publicKey = z28.string().regex(/^[A-Za-z0-9_-]{43}$/);
4248
- var nodeConfigSchema = z28.object({
4249
- v: z28.literal(1),
4250
- config_version: z28.number().int().positive(),
4251
- node_id: z28.guid(),
4252
- workspace_id: z28.guid(),
4253
- workspace_status: z28.enum(["active", "suspended"]),
4254
- issued_at: z28.string().datetime(),
4255
- retention_days: z28.number().int().min(1).max(3650),
4256
- channel: z28.enum(["stable", "canary"]).optional(),
4257
- projects: z28.array(z28.object({
4258
- project_id: z28.number().int().positive(),
4259
- slug: z28.string().max(64),
4260
- short_prefix: z28.string().regex(/^[A-Z0-9]{1,12}$/),
4261
- user_id_salt: z28.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
4262
- privacy_key_version: z28.number().int().min(1).max(PRIVACY_KEY_MAX_VERSION).optional(),
4263
- scrub_disabled: z28.array(z28.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
4264
- upload_tokens: z28.array(z28.object({
4265
- hash: z28.string().regex(/^[a-f0-9]{64}$/),
4266
- expires_at: z28.string().datetime(),
4267
- scopes: z28.array(z28.enum(UPLOAD_SCOPES)).min(1).max(UPLOAD_SCOPES.length).optional()
4555
+ var kid = z29.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
4556
+ var publicKey = z29.string().regex(/^[A-Za-z0-9_-]{43}$/);
4557
+ var nodeConfigSchema = z29.object({
4558
+ v: z29.literal(1),
4559
+ config_version: z29.number().int().positive(),
4560
+ node_id: z29.guid(),
4561
+ workspace_id: z29.guid(),
4562
+ workspace_status: z29.enum(["active", "suspended"]),
4563
+ issued_at: z29.string().datetime(),
4564
+ retention_days: z29.number().int().min(1).max(3650),
4565
+ channel: z29.enum(["stable", "canary"]).optional(),
4566
+ projects: z29.array(z29.object({
4567
+ project_id: z29.number().int().positive(),
4568
+ slug: z29.string().max(64),
4569
+ short_prefix: z29.string().regex(/^[A-Z0-9]{1,12}$/),
4570
+ user_id_salt: z29.string().regex(/^[A-Za-z0-9_-]{22,64}$/),
4571
+ privacy_key_version: z29.number().int().min(1).max(PRIVACY_KEY_MAX_VERSION).optional(),
4572
+ scrub_disabled: z29.array(z29.enum(SCRUB_GROUPS)).max(SCRUB_GROUPS.length),
4573
+ upload_tokens: z29.array(z29.object({
4574
+ hash: z29.string().regex(/^[a-f0-9]{64}$/),
4575
+ expires_at: z29.string().datetime(),
4576
+ scopes: z29.array(z29.enum(UPLOAD_SCOPES)).min(1).max(UPLOAD_SCOPES.length).optional()
4268
4577
  })).max(10).optional()
4269
4578
  })).max(1000),
4270
- ticket_keys: z28.array(z28.object({ kid, public_key: publicKey, not_after: z28.string().datetime() })).min(1).max(5),
4271
- control_ops_keys: z28.array(z28.object({ kid, public_key: publicKey })).min(1).max(5),
4272
- kill_switches: z28.object({ ingest: z28.boolean(), alerts: z28.boolean() }),
4579
+ ticket_keys: z29.array(z29.object({ kid, public_key: publicKey, not_after: z29.string().datetime() })).min(1).max(5),
4580
+ control_ops_keys: z29.array(z29.object({ kid, public_key: publicKey })).min(1).max(5),
4581
+ kill_switches: z29.object({ ingest: z29.boolean(), alerts: z29.boolean() }),
4273
4582
  backup: nodeBackupConfigSchema.optional(),
4274
- purged_projects: z28.array(z28.number().int().positive()).max(1000).optional(),
4275
- monitors: z28.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
4276
- purged_monitors: z28.array(z28.guid()).max(5000).optional(),
4277
- telemetry: z28.object({
4278
- traces_retention_days: z28.number().int().min(1).max(90),
4279
- logs_retention_days: z28.number().int().min(1).max(90),
4280
- traces_disk_share: z28.number().min(0.2).max(0.8)
4583
+ purged_projects: z29.array(z29.number().int().positive()).max(1000).optional(),
4584
+ monitors: z29.array(monitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
4585
+ purged_monitors: z29.array(z29.guid()).max(5000).optional(),
4586
+ telemetry: z29.object({
4587
+ traces_retention_days: z29.number().int().min(1).max(90),
4588
+ logs_retention_days: z29.number().int().min(1).max(90),
4589
+ traces_disk_share: z29.number().min(0.2).max(0.8)
4281
4590
  }).optional(),
4282
4591
  metrics: metricsConfigSchema.optional(),
4283
- slos: z28.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
4284
- signal_monitors: z28.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
4592
+ slos: z29.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
4593
+ signal_monitors: z29.array(signalMonitorDefinitionSchema).max(MAX_NODE_MONITORS).optional(),
4285
4594
  signal_limits: signalLimitsConfigSchema.optional(),
4286
4595
  privacy: nodePrivacyBlockSchema.optional()
4287
4596
  });
4288
- var signedNodeConfigSchema = z28.object({ config: nodeConfigSchema, kid, sig: z28.string() });
4597
+ var signedNodeConfigSchema = z29.object({ config: nodeConfigSchema, kid, sig: z29.string() });
4289
4598
 
4290
4599
  // ../src/shared/contracts/api-ops/projects.ts
4291
- var slug = z29.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
4292
- var name3 = z29.string().trim().min(1).max(60);
4293
- var label2 = z29.string().trim().min(1).max(40);
4294
- var platform = z29.enum(PLATFORMS);
4295
- var origin = z29.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
4296
- var keyId = z29.number().int().positive();
4600
+ var slug = z30.string().regex(/^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$/);
4601
+ var name3 = z30.string().trim().min(1).max(60);
4602
+ var label3 = z30.string().trim().min(1).max(40);
4603
+ var platform = z30.enum(PLATFORMS);
4604
+ var origin = z30.string().trim().toLowerCase().regex(/^https?:\/\/[a-z0-9.-]+(:[0-9]{1,5})?$/).max(200);
4605
+ var keyId = z30.number().int().positive();
4297
4606
  var PROJECT_INPUTS = {
4298
- create: z29.object({ workspaceId: uuid, name: name3, slug, platform }),
4299
- update: z29.object({ projectId, name: name3, platform, isPinned: z29.boolean() }),
4300
- updateIntake: z29.object({
4607
+ create: z30.object({ workspaceId: uuid, name: name3, slug, platform }),
4608
+ update: z30.object({ projectId, name: name3, platform, isPinned: z30.boolean() }),
4609
+ updateIntake: z30.object({
4301
4610
  projectId,
4302
- rateLimit: z29.number().int().positive().nullable(),
4303
- burst: z29.number().int().positive().nullable(),
4304
- allowedOrigins: z29.array(origin).max(50)
4611
+ rateLimit: z30.number().int().positive().nullable(),
4612
+ burst: z30.number().int().positive().nullable(),
4613
+ allowedOrigins: z30.array(origin).max(50)
4305
4614
  }),
4306
- updateObservability: z29.object({
4615
+ updateObservability: z30.object({
4307
4616
  projectId,
4308
- primaryEnvironment: z29.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
4309
- allowCodeMonitors: z29.boolean()
4617
+ primaryEnvironment: z30.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
4618
+ allowCodeMonitors: z30.boolean()
4310
4619
  }),
4311
- setScrub: z29.object({ projectId, group: z29.enum(SCRUB_GROUPS), enabled: z29.boolean() }),
4312
- setCheckinAuth: z29.object({ projectId, mode: z29.enum(CHECKIN_AUTH_MODES) }),
4313
- setEnvironmentHidden: z29.object({
4620
+ setScrub: z30.object({ projectId, group: z30.enum(SCRUB_GROUPS), enabled: z30.boolean() }),
4621
+ setCheckinAuth: z30.object({ projectId, mode: z30.enum(CHECKIN_AUTH_MODES) }),
4622
+ setEnvironmentHidden: z30.object({
4314
4623
  projectId,
4315
- name: z29.string().min(1).max(64),
4316
- hidden: z29.boolean()
4317
- }),
4318
- scheduleDeletion: z29.object({ projectId, confirmSlug: slug }),
4319
- projectOnly: z29.object({ projectId }),
4320
- labelled: z29.object({ projectId, label: label2 }),
4321
- keyOnly: z29.object({ keyId }),
4322
- tokenOnly: z29.object({ tokenId: keyId }),
4624
+ name: z30.string().min(1).max(64),
4625
+ hidden: z30.boolean()
4626
+ }),
4627
+ scheduleDeletion: z30.object({ projectId, confirmSlug: slug }),
4628
+ projectOnly: z30.object({ projectId }),
4629
+ labelled: z30.object({ projectId, label: label3 }),
4630
+ keyOnly: z30.object({ keyId }),
4631
+ tokenOnly: z30.object({ tokenId: keyId }),
4323
4632
  createIngestKey: createIngestKeyInputSchema,
4324
- ingestKeyOnly: z29.object({ keyId: uuid })
4633
+ ingestKeyOnly: z30.object({ keyId: uuid })
4325
4634
  };
4326
4635
  var P2 = PROJECT_INPUTS;
4327
4636
  var PROJECT_OPERATIONS = [
@@ -4576,24 +4885,24 @@ var PROJECT_OPERATIONS = [
4576
4885
  ];
4577
4886
 
4578
4887
  // ../src/shared/contracts/api-ops/reads.ts
4579
- import { z as z30 } from "zod";
4580
- var list = z30.object({ workspaceId: uuid, limit: pageLimit, cursor });
4888
+ import { z as z31 } from "zod";
4889
+ var list = z31.object({ workspaceId: uuid, limit: pageLimit, cursor });
4581
4890
  var READ_INPUTS = {
4582
- workspace: z30.object({ workspaceId: uuid }),
4891
+ workspace: z31.object({ workspaceId: uuid }),
4583
4892
  list,
4584
- projectsGet: z30.object({ workspaceId: uuid, projectId }),
4893
+ projectsGet: z31.object({ workspaceId: uuid, projectId }),
4585
4894
  monitorsList: list.extend({ projectId: projectId.optional() }),
4586
- monitorsGet: z30.object({ workspaceId: uuid, monitorId: uuid }),
4587
- uptimeGet: z30.object({ workspaceId: uuid, checkId: uuid }),
4588
- slosGet: z30.object({ workspaceId: uuid, sloId: uuid }),
4895
+ monitorsGet: z31.object({ workspaceId: uuid, monitorId: uuid }),
4896
+ uptimeGet: z31.object({ workspaceId: uuid, checkId: uuid }),
4897
+ slosGet: z31.object({ workspaceId: uuid, sloId: uuid }),
4589
4898
  alertsList: list.extend({
4590
- state: z30.enum(["open", "resolved", "all"]).default("all"),
4899
+ state: z31.enum(["open", "resolved", "all"]).default("all"),
4591
4900
  monitorId: uuid.optional()
4592
4901
  }),
4593
- approvalsGet: z30.object({ workspaceId: uuid, approvalId: uuid }),
4902
+ approvalsGet: z31.object({ workspaceId: uuid, approvalId: uuid }),
4594
4903
  monitorsListTyped: list.extend({
4595
4904
  projectId: projectId.optional(),
4596
- type: z30.enum(MONITOR_TYPES).optional()
4905
+ type: z31.enum(MONITOR_TYPES).optional()
4597
4906
  })
4598
4907
  };
4599
4908
  var R = READ_INPUTS;
@@ -4877,14 +5186,14 @@ function approvalRequestSchema(operationId, input) {
4877
5186
  }
4878
5187
 
4879
5188
  // ../src/shared/contracts/api-ops/wire.ts
4880
- import { z as z31 } from "zod";
5189
+ import { z as z32 } from "zod";
4881
5190
  var toSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
4882
5191
  var toCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
4883
5192
  var schemaCache = new WeakMap;
4884
5193
  function inputJsonSchema(op) {
4885
5194
  let js = schemaCache.get(op.input);
4886
5195
  if (!js) {
4887
- js = z31.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
5196
+ js = z32.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
4888
5197
  schemaCache.set(op.input, js);
4889
5198
  }
4890
5199
  return js;
@@ -5098,7 +5407,7 @@ function wireInput(operationId, opts = {}) {
5098
5407
  for (const [k, v] of Object.entries(op.input.shape))
5099
5408
  if (!omit.has(k))
5100
5409
  shape[toSnake(k)] = v;
5101
- return z32.object(shape);
5410
+ return z33.object(shape);
5102
5411
  }
5103
5412
  var BUDGETS = [
5104
5413
  { stringBytes: MCP_LIMITS.untrustedStringMaxBytes, listMax: MCP_LIMITS.listMax },
@@ -5191,52 +5500,52 @@ function errorResult(o) {
5191
5500
  }
5192
5501
  };
5193
5502
  }
5194
- var TOOL_OUTPUT_SCHEMA = z32.object({
5195
- untrusted: z32.object({
5196
- data: z32.unknown(),
5197
- provenance: z32.object({
5198
- source: z32.enum(["node", "control_plane", "docs"]),
5199
- operations: z32.array(z32.string())
5503
+ var TOOL_OUTPUT_SCHEMA = z33.object({
5504
+ untrusted: z33.object({
5505
+ data: z33.unknown(),
5506
+ provenance: z33.object({
5507
+ source: z33.enum(["node", "control_plane", "docs"]),
5508
+ operations: z33.array(z33.string())
5200
5509
  })
5201
5510
  }).optional(),
5202
- doc: z32.object({
5203
- slug: z32.string(),
5204
- locale: z32.enum(["en", "vi"]),
5205
- url: z32.string(),
5206
- markdown: z32.string(),
5207
- truncated: z32.boolean()
5511
+ doc: z33.object({
5512
+ slug: z33.string(),
5513
+ locale: z33.enum(["en", "vi"]),
5514
+ url: z33.string(),
5515
+ markdown: z33.string(),
5516
+ truncated: z33.boolean()
5208
5517
  }).optional(),
5209
- results: z32.array(z32.object({
5210
- slug: z32.string(),
5211
- title: z32.string(),
5212
- description: z32.string(),
5213
- section: z32.string(),
5214
- url: z32.string()
5518
+ results: z33.array(z33.object({
5519
+ slug: z33.string(),
5520
+ title: z33.string(),
5521
+ description: z33.string(),
5522
+ section: z33.string(),
5523
+ url: z33.string()
5215
5524
  })).optional(),
5216
- next_cursor: z32.string().nullable().optional(),
5217
- complete: z32.boolean().optional(),
5218
- omitted: z32.array(z32.object({ part: z32.string(), reason: z32.string(), scope: z32.string().optional() })).optional(),
5219
- truncated: z32.literal(true).optional(),
5220
- suspicious_unicode: z32.literal(true).optional(),
5221
- error: z32.object({
5222
- code: z32.string(),
5223
- status: z32.number(),
5224
- detail: z32.string().optional(),
5225
- scope: z32.string().optional(),
5226
- retry_after: z32.number().optional()
5525
+ next_cursor: z33.string().nullable().optional(),
5526
+ complete: z33.boolean().optional(),
5527
+ omitted: z33.array(z33.object({ part: z33.string(), reason: z33.string(), scope: z33.string().optional() })).optional(),
5528
+ truncated: z33.literal(true).optional(),
5529
+ suspicious_unicode: z33.literal(true).optional(),
5530
+ error: z33.object({
5531
+ code: z33.string(),
5532
+ status: z33.number(),
5533
+ detail: z33.string().optional(),
5534
+ scope: z33.string().optional(),
5535
+ retry_after: z33.number().optional()
5227
5536
  }).optional(),
5228
- operations: z32.array(z32.record(z32.string(), z32.unknown())).optional(),
5229
- operation: z32.record(z32.string(), z32.unknown()).optional(),
5230
- plan: z32.record(z32.string(), z32.unknown()).optional(),
5231
- status: z32.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
5232
- approval: z32.object({
5233
- approval_id: z32.string(),
5234
- approval_url: z32.string(),
5235
- expires_at: z32.string(),
5236
- state: z32.enum(APPROVAL_STATES),
5237
- result_code: z32.string().nullable().optional(),
5238
- result: z32.record(z32.string(), z32.unknown()).optional(),
5239
- next: z32.string().optional()
5537
+ operations: z33.array(z33.record(z33.string(), z33.unknown())).optional(),
5538
+ operation: z33.record(z33.string(), z33.unknown()).optional(),
5539
+ plan: z33.record(z33.string(), z33.unknown()).optional(),
5540
+ status: z33.enum(["done", "approval_required", "approval_pending", ...APPROVAL_STATES]).optional(),
5541
+ approval: z33.object({
5542
+ approval_id: z33.string(),
5543
+ approval_url: z33.string(),
5544
+ expires_at: z33.string(),
5545
+ state: z33.enum(APPROVAL_STATES),
5546
+ result_code: z33.string().nullable().optional(),
5547
+ result: z33.record(z33.string(), z33.unknown()).optional(),
5548
+ next: z33.string().optional()
5240
5549
  }).optional()
5241
5550
  });
5242
5551
  var spec = (name) => {
@@ -5282,10 +5591,10 @@ var has = (rt, operationId) => {
5282
5591
  return !!op && rt.scopes.includes(op.scope);
5283
5592
  };
5284
5593
  var isoWindow = {
5285
- start: z32.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
5286
- end: z32.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
5594
+ start: z33.string().max(40).describe("RFC 3339 start of the window, e.g. 2026-10-26T00:00:00Z. Required with end."),
5595
+ end: z33.string().max(40).describe("RFC 3339 end of the window. The plan limits its length.")
5287
5596
  };
5288
- var traceIdSchema = z32.string().regex(/^[0-9a-fA-F]{32}$/);
5597
+ var traceIdSchema = z33.string().regex(/^[0-9a-fA-F]{32}$/);
5289
5598
  var MONITOR_KINDS2 = {
5290
5599
  cron: { list: "monitors.list", get: "monitors.get", idField: "monitor_id" },
5291
5600
  uptime: { list: "uptime.list", get: "uptime.get", idField: "check_id" },
@@ -5349,8 +5658,8 @@ function describe(op, scopes) {
5349
5658
  destructive: isDestructiveOperation(op)
5350
5659
  };
5351
5660
  }
5352
- var params = z32.record(z32.string(), z32.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
5353
- var operationIdArg = z32.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
5661
+ var params = z33.record(z33.string(), z33.unknown()).default({}).describe("Operation fields in wire names (snake_case), as describe_operation's args_schema shows.");
5662
+ var operationIdArg = z33.string().min(3).max(80).describe("An operation id from search_operations, e.g. `monitors.update`.");
5354
5663
  function approvalBlock(t, next) {
5355
5664
  return {
5356
5665
  approval_id: t.approval_id,
@@ -5370,7 +5679,7 @@ var MCP_TOOL_DEFS = [
5370
5679
  title: "Workspace and node",
5371
5680
  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.",
5372
5681
  operations: ["workspace.get", "node.get"],
5373
- input: z32.object({}),
5682
+ input: z33.object({}),
5374
5683
  async run(_args, rt) {
5375
5684
  const [ws, node] = await Promise.all([rt.call("workspace.get", {}), rt.call("node.get", {})]);
5376
5685
  if (!ws.ok)
@@ -5392,9 +5701,9 @@ var MCP_TOOL_DEFS = [
5392
5701
  title: "Get an issue",
5393
5702
  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.",
5394
5703
  operations: ["issues.get", "events.get", "issues.fix_status"],
5395
- input: z32.object({
5396
- issue_id: z32.number().int().positive().describe("Issue id from search_issues."),
5397
- include_latest_event: z32.boolean().default(true)
5704
+ input: z33.object({
5705
+ issue_id: z33.number().int().positive().describe("Issue id from search_issues."),
5706
+ include_latest_event: z33.boolean().default(true)
5398
5707
  }),
5399
5708
  async run(args, rt) {
5400
5709
  const omitted = [];
@@ -5435,9 +5744,9 @@ var MCP_TOOL_DEFS = [
5435
5744
  title: "Get a trace",
5436
5745
  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).",
5437
5746
  operations: ["traces.get", "traces.spans"],
5438
- input: z32.object({
5747
+ input: z33.object({
5439
5748
  trace_id: traceIdSchema.describe("W3C trace id, 32 hex characters."),
5440
- spans: z32.enum(["none", "errors", "all"]).default("none")
5749
+ spans: z33.enum(["none", "errors", "all"]).default("none")
5441
5750
  }),
5442
5751
  async run(args, rt) {
5443
5752
  const sum = await rt.call("traces.get", { trace_id: args["trace_id"] });
@@ -5469,17 +5778,17 @@ var MCP_TOOL_DEFS = [
5469
5778
  title: "Query metrics",
5470
5779
  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.",
5471
5780
  operations: ["metrics.names", "metrics.query"],
5472
- input: z32.object({
5473
- project: z32.number().int().positive().describe("Numeric project id from list_projects."),
5474
- name: z32.string().regex(METRIC_NAME_RE).optional().describe("Metric name from the catalog, e.g. http.server.request.duration."),
5475
- q: z32.string().max(255).optional().describe("Catalog only: part of a metric name."),
5476
- aggregation: z32.enum(METRIC_AGGREGATIONS).optional(),
5781
+ input: z33.object({
5782
+ project: z33.number().int().positive().describe("Numeric project id from list_projects."),
5783
+ name: z33.string().regex(METRIC_NAME_RE).optional().describe("Metric name from the catalog, e.g. http.server.request.duration."),
5784
+ q: z33.string().max(255).optional().describe("Catalog only: part of a metric name."),
5785
+ aggregation: z33.enum(METRIC_AGGREGATIONS).optional(),
5477
5786
  start: isoWindow.start.optional(),
5478
5787
  end: isoWindow.end.optional(),
5479
- step: z32.number().int().min(60).max(86400).multipleOf(60).optional().describe("Seconds per point (whole minutes); picked from the window when absent."),
5480
- attrs: z32.string().max(2000).optional(),
5481
- group_by: z32.string().max(600).optional(),
5482
- environment: z32.string().max(2000).optional().describe("Comma-separated environments.")
5788
+ step: z33.number().int().min(60).max(86400).multipleOf(60).optional().describe("Seconds per point (whole minutes); picked from the window when absent."),
5789
+ attrs: z33.string().max(2000).optional(),
5790
+ group_by: z33.string().max(600).optional(),
5791
+ environment: z33.string().max(2000).optional().describe("Comma-separated environments.")
5483
5792
  }),
5484
5793
  async run(args, rt) {
5485
5794
  const scope = {
@@ -5534,8 +5843,8 @@ var MCP_TOOL_DEFS = [
5534
5843
  title: "Release health",
5535
5844
  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.",
5536
5845
  operations: ["releases.list", "releases.health"],
5537
- input: z32.object({
5538
- project: z32.number().int().positive().describe("Numeric project id from list_projects."),
5846
+ input: z33.object({
5847
+ project: z33.number().int().positive().describe("Numeric project id from list_projects."),
5539
5848
  version: releaseNameSchema.optional().describe("Release name exactly as the SDK sends it, e.g. web@1.4.2."),
5540
5849
  environment: environmentNameSchema.optional().describe("One environment, e.g. production."),
5541
5850
  compare: releaseNameSchema.optional().describe("With version: compare against this release instead of the previous one.")
@@ -5567,11 +5876,11 @@ var MCP_TOOL_DEFS = [
5567
5876
  title: "Correlate by trace or run",
5568
5877
  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.",
5569
5878
  operations: ["traces.get", "traces.spans", "spans.list", "logs.list"],
5570
- input: z32.object({
5879
+ input: z33.object({
5571
5880
  trace_id: traceIdSchema.optional(),
5572
- run_id: z32.string().min(1).max(128).optional(),
5881
+ run_id: z33.string().min(1).max(128).optional(),
5573
5882
  ...isoWindow,
5574
- project: z32.string().max(2000).optional().describe("Comma-separated project ids.")
5883
+ project: z33.string().max(2000).optional().describe("Comma-separated project ids.")
5575
5884
  }),
5576
5885
  async run(args, rt) {
5577
5886
  const trace = args["trace_id"];
@@ -5630,10 +5939,10 @@ var MCP_TOOL_DEFS = [
5630
5939
  title: "List monitors",
5631
5940
  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).",
5632
5941
  operations: ["monitors.list", "uptime.list", "slos.list"],
5633
- input: z32.object({
5634
- kind: z32.enum(["all", "cron", "uptime", "slo"]).default("all"),
5635
- project_id: z32.number().int().positive().optional(),
5636
- limit: z32.number().int().min(1).max(200).default(50)
5942
+ input: z33.object({
5943
+ kind: z33.enum(["all", "cron", "uptime", "slo"]).default("all"),
5944
+ project_id: z33.number().int().positive().optional(),
5945
+ limit: z33.number().int().min(1).max(200).default(50)
5637
5946
  }),
5638
5947
  async run(args, rt) {
5639
5948
  const kinds = args["kind"] && args["kind"] !== "all" ? [args["kind"]] : ["cron", "uptime", "slo"];
@@ -5668,10 +5977,10 @@ var MCP_TOOL_DEFS = [
5668
5977
  "monitors.occurrences",
5669
5978
  "monitors.backtest"
5670
5979
  ],
5671
- input: z32.object({
5672
- kind: z32.enum(["cron", "uptime", "slo"]),
5673
- id: z32.guid(),
5674
- backtest: z32.boolean().default(false)
5980
+ input: z33.object({
5981
+ kind: z33.enum(["cron", "uptime", "slo"]),
5982
+ id: z33.guid(),
5983
+ backtest: z33.boolean().default(false)
5675
5984
  }),
5676
5985
  async run(args, rt) {
5677
5986
  const k = MONITOR_KINDS2[args["kind"]];
@@ -5731,9 +6040,9 @@ var MCP_TOOL_DEFS = [
5731
6040
  title: "Send a test event",
5732
6041
  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).",
5733
6042
  operations: ["projects.send_test_event"],
5734
- input: z32.object({
5735
- project_id: z32.number().int().positive(),
5736
- idempotency_key: z32.string().min(8).max(255).optional()
6043
+ input: z33.object({
6044
+ project_id: z33.number().int().positive(),
6045
+ idempotency_key: z33.string().min(8).max(255).optional()
5737
6046
  }),
5738
6047
  async run(args, rt) {
5739
6048
  const r = await rt.call("projects.send_test_event", { project_id: args["project_id"] }, { idempotencyKey: args["idempotency_key"] ?? rt.newKey() });
@@ -5751,9 +6060,9 @@ var MCP_TOOL_DEFS = [
5751
6060
  title: "Find a configuration change",
5752
6061
  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.",
5753
6062
  operations: [],
5754
- input: z32.object({
5755
- query: z32.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
5756
- limit: z32.number().int().min(1).max(20).default(10)
6063
+ input: z33.object({
6064
+ query: z33.string().min(1).max(200).describe("Words such as `rotate dsn key`, `heartbeat monitor`, `slack alert`."),
6065
+ limit: z33.number().int().min(1).max(20).default(10)
5757
6066
  }),
5758
6067
  async run(args, rt) {
5759
6068
  const q = words(String(args["query"]));
@@ -5781,7 +6090,7 @@ var MCP_TOOL_DEFS = [
5781
6090
  title: "Describe a configuration change",
5782
6091
  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.",
5783
6092
  operations: [],
5784
- input: z32.object({ operation_id: operationIdArg }),
6093
+ input: z33.object({ operation_id: operationIdArg }),
5785
6094
  async run(args, rt) {
5786
6095
  const op = configureOp(args["operation_id"]);
5787
6096
  if (!op || op.method === "GET")
@@ -5810,7 +6119,7 @@ var MCP_TOOL_DEFS = [
5810
6119
  title: "Check a change before applying it",
5811
6120
  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.",
5812
6121
  operations: [],
5813
- input: z32.object({ operation_id: operationIdArg, params }),
6122
+ input: z33.object({ operation_id: operationIdArg, params }),
5814
6123
  async run(args, rt) {
5815
6124
  const op = configureOp(args["operation_id"]);
5816
6125
  if (!op || op.method === "GET")
@@ -5859,11 +6168,11 @@ var MCP_TOOL_DEFS = [
5859
6168
  title: "Apply a configuration change",
5860
6169
  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.",
5861
6170
  operations: [],
5862
- input: z32.object({
6171
+ input: z33.object({
5863
6172
  operation_id: operationIdArg,
5864
6173
  params,
5865
- idempotency_key: z32.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
5866
- if_match: z32.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
6174
+ idempotency_key: z33.string().min(8).max(255).describe("Unique per change; reuse it to retry or to fetch the result."),
6175
+ if_match: z33.string().max(200).optional().describe("ETag from plan_change, for operations that need it.")
5867
6176
  }),
5868
6177
  async run(args, rt) {
5869
6178
  const op = configureOp(args["operation_id"]);
@@ -5924,7 +6233,7 @@ var MCP_TOOL_DEFS = [
5924
6233
  title: "Follow an approval",
5925
6234
  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).",
5926
6235
  operations: ["approvals.get"],
5927
- input: z32.object({ approval_id: z32.guid().describe("approval_id from apply_change.") }),
6236
+ input: z33.object({ approval_id: z33.guid().describe("approval_id from apply_change.") }),
5928
6237
  async run(args, rt) {
5929
6238
  const r = await rt.call("approvals.get", { approval_id: args["approval_id"] });
5930
6239
  if (!r.ok)
@@ -5944,10 +6253,10 @@ var MCP_TOOL_DEFS = [
5944
6253
  title: "Search Belvador docs",
5945
6254
  description: "Searches the public Belvador documentation (titles and summaries) and returns the best pages with their slugs for get_doc.",
5946
6255
  operations: [],
5947
- input: z32.object({
5948
- query: z32.string().min(1).max(200),
5949
- locale: z32.enum(["en", "vi"]).default("en"),
5950
- limit: z32.number().int().min(1).max(10).default(5)
6256
+ input: z33.object({
6257
+ query: z33.string().min(1).max(200),
6258
+ locale: z33.enum(["en", "vi"]).default("en"),
6259
+ limit: z33.number().int().min(1).max(10).default(5)
5951
6260
  }),
5952
6261
  async run(args, rt) {
5953
6262
  const locale = args["locale"] ?? "en";
@@ -5963,9 +6272,9 @@ var MCP_TOOL_DEFS = [
5963
6272
  title: "Read a docs page",
5964
6273
  description: "The Markdown of one public Belvador docs page by slug (e.g. `quickstart`, `sdk/react`, `reference/api`).",
5965
6274
  operations: [],
5966
- input: z32.object({
5967
- slug: z32.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
5968
- locale: z32.enum(["en", "vi"]).default("en")
6275
+ input: z33.object({
6276
+ slug: z33.string().regex(/^[a-z0-9][a-z0-9/-]{0,120}$/),
6277
+ locale: z33.enum(["en", "vi"]).default("en")
5969
6278
  }),
5970
6279
  async run(args, rt) {
5971
6280
  const locale = args["locale"] ?? "en";
@@ -6159,7 +6468,7 @@ function findToken(env = process.env, keychain = keychainToken) {
6159
6468
  }
6160
6469
 
6161
6470
  // packages/mcp/src/cli.ts
6162
- var PACKAGE_VERSION = "0.7.0";
6471
+ var PACKAGE_VERSION = "0.7.2";
6163
6472
  var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
6164
6473
 
6165
6474
  Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]