@belvador/mcp 0.7.1 → 0.8.0

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