@belvador/mcp 0.7.1 → 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 +786 -506
  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,
@@ -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)
@@ -3158,7 +3122,7 @@ var MONITOR_OPERATIONS = [
3158
3122
  ];
3159
3123
 
3160
3124
  // ../src/shared/contracts/api-ops/node-data.ts
3161
- import { z as z23 } from "zod";
3125
+ import { z as z24 } from "zod";
3162
3126
 
3163
3127
  // ../src/shared/contracts/release-health.ts
3164
3128
  import { z as z21 } from "zod";
@@ -3416,8 +3380,310 @@ var fixStatusSchema = z21.object({
3416
3380
  verify_hours: z21.number()
3417
3381
  });
3418
3382
 
3419
- // ../src/shared/contracts/web-vitals.ts
3383
+ // ../src/shared/contracts/telemetry.ts
3420
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";
3421
3687
 
3422
3688
  // ../src/shared/contracts/vocab/web-vitals.ts
3423
3689
  var WEB_VITAL_NAMES = ["LCP", "INP", "CLS", "FCP", "TTFB"];
@@ -3436,214 +3702,222 @@ var WEB_VITAL_LIMITS = {
3436
3702
  maxWindowMs: 7 * 24 * 3600 * 1000,
3437
3703
  defaultWindowMs: 24 * 3600 * 1000
3438
3704
  };
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(),
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(),
3452
3718
  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()
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()
3459
3725
  })),
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() }))
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() }))
3462
3728
  });
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()
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()
3469
3735
  });
3470
3736
 
3471
3737
  // ../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();
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();
3478
3744
  var windowFields = {
3479
- start: z23.string().max(40).optional(),
3480
- end: z23.string().max(40).optional()
3745
+ start: z24.string().max(40).optional(),
3746
+ end: z24.string().max(40).optional()
3481
3747
  };
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();
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}}$`);
3485
3753
  var telemetryCommon = {
3486
3754
  ...windowFields,
3487
3755
  project: projectIds2.optional(),
3488
3756
  environment: csv.optional(),
3489
3757
  service: csv.optional(),
3490
- attrs
3758
+ attrs: attrs2
3491
3759
  };
3492
- var issueChange = z23.union([
3493
- z23.object({
3494
- action: z23.literal("resolve"),
3495
- inNextRelease: z23.boolean().optional(),
3760
+ var issueChange = z24.union([
3761
+ z24.object({
3762
+ action: z24.literal("resolve"),
3763
+ inNextRelease: z24.boolean().optional(),
3496
3764
  inRelease: releaseNameSchema.optional()
3497
3765
  }),
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"]) })
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"]) })
3509
3777
  ]);
3510
3778
  var NODE_INPUTS = {
3511
- issuesList: z23.object({
3779
+ issuesList: z24.object({
3512
3780
  project: projectIds2.optional(),
3513
- status: z23.enum(["unresolved", "resolved", "archived", "all"]).optional(),
3781
+ status: z24.enum(["unresolved", "resolved", "archived", "all"]).optional(),
3514
3782
  level: csv.optional(),
3515
3783
  priority: csv.optional(),
3516
3784
  environment: csv.optional(),
3517
3785
  release: csv.optional(),
3518
- assignee: z23.string().max(64).optional(),
3786
+ assignee: z24.string().max(64).optional(),
3519
3787
  period: period.optional(),
3520
- q: z23.string().max(200).optional(),
3521
- 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(),
3522
3790
  cursor: nodeCursor,
3523
- limit: z23.number().int().min(1).max(100).optional()
3791
+ limit: z24.number().int().min(1).max(100).optional()
3524
3792
  }),
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({
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({
3529
3797
  issueId,
3530
- eventId: z23.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
3798
+ eventId: z24.string().regex(/^([0-9a-f]{32}|latest|oldest)$/)
3531
3799
  }),
3532
- issueUpdate: z23.object({ issueId, change: issueChange }),
3533
- issuesBulk: z23.object({
3534
- 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),
3535
3803
  action: issueChange
3536
3804
  }),
3537
- spansList: z23.object({
3805
+ spansList: z24.object({
3538
3806
  ...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(),
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(),
3545
3813
  cursor: nodeCursor
3546
3814
  }),
3547
- spansHistogram: z23.object({
3815
+ spansHistogram: z24.object({
3548
3816
  ...telemetryCommon,
3549
- operation: z23.string().min(1).max(1024).optional(),
3550
- status: z23.enum(["unset", "ok", "error"]).optional()
3817
+ operation: z24.string().min(1).max(1024).optional(),
3818
+ status: z24.enum(["unset", "ok", "error"]).optional()
3551
3819
  }),
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({
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({
3556
3824
  ...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(),
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(),
3562
3830
  cursor: nodeCursor
3563
3831
  }),
3564
- logsFacets: z23.object({
3832
+ logsHistogram: z24.object({
3833
+ ...telemetryCommon,
3834
+ severityMin: z24.enum(["trace", "debug", "info", "warn", "error", "fatal"]).optional(),
3835
+ q: z24.string().max(500).optional()
3836
+ }),
3837
+ logsFacets: z24.object({
3565
3838
  ...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(),
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(),
3578
3852
  environment: csv.optional(),
3579
- q: z23.string().max(255).optional()
3853
+ q: z24.string().max(255).optional()
3580
3854
  }),
3581
- metricsSeries: z23.object({
3582
- project: z23.number().int().positive(),
3583
- 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),
3584
3858
  environment: csv.optional(),
3585
- attrs,
3586
- cursor: z23.string().regex(/^[0-9a-f]{16}$/).optional()
3859
+ attrs: attrs2,
3860
+ cursor: z24.string().regex(/^[0-9a-f]{16}$/).optional()
3587
3861
  }),
3588
- metricsQuery: z23.object({
3589
- project: z23.number().int().positive(),
3590
- name: z23.string().regex(METRIC_NAME_RE),
3591
- 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),
3592
3866
  ...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(),
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(),
3596
3870
  environment: csv.optional()
3597
3871
  }),
3598
- telemetryUsage: z23.object({
3872
+ telemetryUsage: z24.object({
3599
3873
  project: projectIds2.optional(),
3600
- days: z23.number().int().min(1).max(31).optional()
3874
+ days: z24.number().int().min(1).max(31).optional()
3601
3875
  }),
3602
- monitorSignal: z23.object({
3603
- monitorId: z23.guid(),
3604
- 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()
3605
3879
  }),
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(),
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(),
3610
3884
  cursor: nodeCursor
3611
3885
  }),
3612
- monitorBacktest: z23.object({
3613
- project: z23.number().int().positive(),
3886
+ monitorBacktest: z24.object({
3887
+ project: z24.number().int().positive(),
3614
3888
  settings: backtestSettingsSchema
3615
3889
  }),
3616
- occurrenceCreate: z23.object({
3617
- project: z23.number().int().positive(),
3890
+ occurrenceCreate: z24.object({
3891
+ project: z24.number().int().positive(),
3618
3892
  monitorSlug: occurrenceInputSchema.shape.monitor_slug,
3619
3893
  occurrenceId: occurrenceInputSchema.shape.occurrence_id,
3620
3894
  dueAt: occurrenceInputSchema.shape.due_at,
3621
3895
  environment: occurrenceInputSchema.shape.environment
3622
3896
  }),
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()
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()
3628
3902
  }),
3629
- webVitals: z23.object({
3630
- project: z23.number().int().positive(),
3903
+ webVitals: z24.object({
3904
+ project: z24.number().int().positive(),
3631
3905
  ...windowFields,
3632
3906
  environment: csv.optional(),
3633
- 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()
3634
3908
  }),
3635
- releasesList: z23.object({
3636
- project: z23.number().int().positive(),
3909
+ releasesList: z24.object({
3910
+ project: z24.number().int().positive(),
3637
3911
  environment: environmentNameSchema.optional()
3638
3912
  }),
3639
- releaseHealth: z23.object({
3640
- project: z23.number().int().positive(),
3913
+ releaseHealth: z24.object({
3914
+ project: z24.number().int().positive(),
3641
3915
  version: releaseNameSchema,
3642
3916
  environment: environmentNameSchema.optional(),
3643
3917
  compare: releaseNameSchema.optional()
3644
3918
  }),
3645
- deploymentCreate: z23.object({
3646
- project: z23.number().int().positive(),
3919
+ deploymentCreate: z24.object({
3920
+ project: z24.number().int().positive(),
3647
3921
  version: deploymentInputSchema.shape.version,
3648
3922
  environment: deploymentInputSchema.shape.environment,
3649
3923
  name: deploymentInputSchema.shape.name,
@@ -3652,10 +3926,10 @@ var NODE_INPUTS = {
3652
3926
  finishedAt: deploymentInputSchema.shape.finished_at,
3653
3927
  deployId: deploymentInputSchema.shape.deploy_id
3654
3928
  }),
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()
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()
3659
3933
  })
3660
3934
  };
3661
3935
  var N = NODE_INPUTS;
@@ -3795,7 +4069,7 @@ var NODE_OPERATIONS = [
3795
4069
  id: "logs.histogram",
3796
4070
  path: "/v1/logs/histogram",
3797
4071
  scope: "logs:read",
3798
- input: N.logsFacets,
4072
+ input: N.logsHistogram,
3799
4073
  node: { path: "q/logs/histogram", window: true },
3800
4074
  summary: "Log counts by severity over a window."
3801
4075
  }),
@@ -3992,10 +4266,10 @@ var NODE_OPERATIONS = [
3992
4266
  ];
3993
4267
 
3994
4268
  // ../src/shared/contracts/api-ops/privacy.ts
3995
- import { z as z25 } from "zod";
4269
+ import { z as z26 } from "zod";
3996
4270
 
3997
4271
  // ../src/shared/contracts/privacy.ts
3998
- import { z as z24 } from "zod";
4272
+ import { z as z25 } from "zod";
3999
4273
 
4000
4274
  // ../src/shared/privacy/rules.ts
4001
4275
  var PRIVACY_SCHEMA = 1;
@@ -4026,46 +4300,46 @@ var REMOVE = Symbol("remove");
4026
4300
 
4027
4301
  // ../src/shared/contracts/privacy.ts
4028
4302
  var PRIVACY_KEY_MAX_VERSION = 1e6;
4029
- var ruleId = z24.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
4030
- var privacyRuleInputSchema = z24.object({
4303
+ var ruleId = z25.string().regex(/^[A-Za-z0-9_-]{1,64}$/);
4304
+ var privacyRuleInputSchema = z25.object({
4031
4305
  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()
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()
4060
4334
  });
4061
4335
 
4062
4336
  // ../src/shared/contracts/api-ops/privacy.ts
4063
4337
  var PRIVACY_INPUTS = {
4064
- get: z25.object({ workspaceId: uuid, projectId }),
4065
- set: z25.object({
4338
+ get: z26.object({ workspaceId: uuid, projectId }),
4339
+ set: z26.object({
4066
4340
  workspaceId: uuid,
4067
4341
  projectId,
4068
- expectedVersion: z25.number().int().min(0),
4342
+ expectedVersion: z26.number().int().min(0),
4069
4343
  policy: privacyPolicyInputSchema
4070
4344
  })
4071
4345
  };
@@ -4105,105 +4379,109 @@ var PRIVACY_OPERATIONS = [
4105
4379
  ];
4106
4380
 
4107
4381
  // ../src/shared/contracts/api-ops/projects.ts
4108
- import { z as z29 } from "zod";
4382
+ import { z as z30 } from "zod";
4109
4383
 
4110
4384
  // ../src/shared/contracts/ingest-keys.ts
4111
- import { z as z26 } from "zod";
4385
+ import { z as z27 } from "zod";
4112
4386
  var INGEST_KEY_SCOPES = ["traces", "logs", "metrics", "errors", "monitors"];
4113
4387
  var INGEST_KEY_STATES = ["active", "revoked"];
4114
4388
  var INGEST_KEY_LIMITS = {
4115
4389
  nameMaxChars: 80,
4116
4390
  environmentsMax: 20,
4117
4391
  environmentMaxChars: 64,
4118
- edgeCacheSeconds: 60
4392
+ revocationSeconds: 60,
4393
+ publishIntervalSeconds: 10,
4394
+ kvCacheTtlSeconds: 30,
4395
+ isolateCacheSeconds: 15
4119
4396
  };
4397
+ var INGEST_KEY_REVOCATION_WORST_SECONDS = INGEST_KEY_LIMITS.publishIntervalSeconds + INGEST_KEY_LIMITS.kvCacheTtlSeconds + INGEST_KEY_LIMITS.isolateCacheSeconds;
4120
4398
  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(),
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(),
4127
4405
  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()
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()
4163
4441
  });
4164
4442
 
4165
4443
  // ../src/shared/contracts/node-config.ts
4166
- import { z as z28 } from "zod";
4444
+ import { z as z29 } from "zod";
4167
4445
 
4168
4446
  // ../src/shared/contracts/backup.ts
4169
- import { z as z27 } from "zod";
4447
+ import { z as z28 } from "zod";
4170
4448
  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),
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),
4177
4455
  workspace_recipient: ageRecipient
4178
4456
  });
4179
- var backupCredentialsRequestSchema = z27.object({
4180
- mode: z27.enum(["upload", "download"]),
4457
+ var backupCredentialsRequestSchema = z28.object({
4458
+ mode: z28.enum(["upload", "download"]),
4181
4459
  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),
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),
4196
4474
  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(),
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(),
4205
4483
  row_counts: rowCountsSchema,
4206
- 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)
4207
4485
  });
4208
4486
  var BACKUP_ERROR_CODES = [
4209
4487
  "CLICKHOUSE_BACKUP_FAILED",
@@ -4217,51 +4495,51 @@ var BACKUP_ERROR_CODES = [
4217
4495
  "RESTORE_FAILED",
4218
4496
  "ROW_COUNT_MISMATCH"
4219
4497
  ];
4220
- var backupReportSchema = z27.object({
4498
+ var backupReportSchema = z28.object({
4221
4499
  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(),
4500
+ kind: z28.enum(BACKUP_KINDS),
4501
+ status: z28.enum(["succeeded", "failed"]),
4502
+ started_at: z28.string().datetime(),
4503
+ finished_at: z28.string().datetime(),
4226
4504
  manifest: backupManifestSchema.nullable(),
4227
- error_code: z27.enum(BACKUP_ERROR_CODES).nullable()
4505
+ error_code: z28.enum(BACKUP_ERROR_CODES).nullable()
4228
4506
  });
4229
- var drillReportSchema = z27.object({
4507
+ var drillReportSchema = z28.object({
4230
4508
  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()
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()
4236
4514
  });
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}$/)
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}$/)
4243
4521
  }),
4244
- created_at: z27.string().datetime()
4522
+ created_at: z28.string().datetime()
4245
4523
  });
4246
- var restoreArgsSchema = z27.object({
4247
- job_id: z27.guid(),
4248
- workspace_id: z27.guid(),
4249
- 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(),
4250
4528
  manifest: backupManifestSchema,
4251
- sealed_identity: z27.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
4252
- mode: z27.enum(["rebuild", "drill"])
4529
+ sealed_identity: z28.string().regex(/^[A-Za-z0-9_-]{40,2000}$/),
4530
+ mode: z28.enum(["rebuild", "drill"])
4253
4531
  });
4254
- var restoreReportSchema = z27.object({
4255
- job_id: z27.guid(),
4532
+ var restoreReportSchema = z28.object({
4533
+ job_id: z28.guid(),
4256
4534
  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()
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()
4262
4540
  });
4263
4541
 
4264
- // ../src/shared/contracts/node-config.ts
4542
+ // ../src/shared/contracts/vocab/node-config.ts
4265
4543
  var SCRUB_GROUPS = [
4266
4544
  "credentials",
4267
4545
  "cards",
@@ -4271,86 +4549,88 @@ var SCRUB_GROUPS = [
4271
4549
  "user_id",
4272
4550
  "headers"
4273
4551
  ];
4552
+
4553
+ // ../src/shared/contracts/node-config.ts
4274
4554
  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()
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()
4297
4577
  })).max(10).optional()
4298
4578
  })).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() }),
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() }),
4302
4582
  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)
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)
4310
4590
  }).optional(),
4311
4591
  metrics: metricsConfigSchema.optional(),
4312
- slos: z28.array(nodeSloSchema).max(SLO_LIMITS.maxNodeSlos).optional(),
4313
- 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(),
4314
4594
  signal_limits: signalLimitsConfigSchema.optional(),
4315
4595
  privacy: nodePrivacyBlockSchema.optional()
4316
4596
  });
4317
- var signedNodeConfigSchema = z28.object({ config: nodeConfigSchema, kid, sig: z28.string() });
4597
+ var signedNodeConfigSchema = z29.object({ config: nodeConfigSchema, kid, sig: z29.string() });
4318
4598
 
4319
4599
  // ../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();
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();
4326
4606
  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({
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({
4330
4610
  projectId,
4331
- rateLimit: z29.number().int().positive().nullable(),
4332
- burst: z29.number().int().positive().nullable(),
4333
- 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)
4334
4614
  }),
4335
- updateObservability: z29.object({
4615
+ updateObservability: z30.object({
4336
4616
  projectId,
4337
- primaryEnvironment: z29.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
4338
- allowCodeMonitors: z29.boolean()
4617
+ primaryEnvironment: z30.string().trim().min(1).max(64).refine((v) => v !== "*" && ENVIRONMENT_RE.test(v)),
4618
+ allowCodeMonitors: z30.boolean()
4339
4619
  }),
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({
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({
4343
4623
  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 }),
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 }),
4352
4632
  createIngestKey: createIngestKeyInputSchema,
4353
- ingestKeyOnly: z29.object({ keyId: uuid })
4633
+ ingestKeyOnly: z30.object({ keyId: uuid })
4354
4634
  };
4355
4635
  var P2 = PROJECT_INPUTS;
4356
4636
  var PROJECT_OPERATIONS = [
@@ -4605,24 +4885,24 @@ var PROJECT_OPERATIONS = [
4605
4885
  ];
4606
4886
 
4607
4887
  // ../src/shared/contracts/api-ops/reads.ts
4608
- import { z as z30 } from "zod";
4609
- 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 });
4610
4890
  var READ_INPUTS = {
4611
- workspace: z30.object({ workspaceId: uuid }),
4891
+ workspace: z31.object({ workspaceId: uuid }),
4612
4892
  list,
4613
- projectsGet: z30.object({ workspaceId: uuid, projectId }),
4893
+ projectsGet: z31.object({ workspaceId: uuid, projectId }),
4614
4894
  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 }),
4895
+ monitorsGet: z31.object({ workspaceId: uuid, monitorId: uuid }),
4896
+ uptimeGet: z31.object({ workspaceId: uuid, checkId: uuid }),
4897
+ slosGet: z31.object({ workspaceId: uuid, sloId: uuid }),
4618
4898
  alertsList: list.extend({
4619
- state: z30.enum(["open", "resolved", "all"]).default("all"),
4899
+ state: z31.enum(["open", "resolved", "all"]).default("all"),
4620
4900
  monitorId: uuid.optional()
4621
4901
  }),
4622
- approvalsGet: z30.object({ workspaceId: uuid, approvalId: uuid }),
4902
+ approvalsGet: z31.object({ workspaceId: uuid, approvalId: uuid }),
4623
4903
  monitorsListTyped: list.extend({
4624
4904
  projectId: projectId.optional(),
4625
- type: z30.enum(MONITOR_TYPES).optional()
4905
+ type: z31.enum(MONITOR_TYPES).optional()
4626
4906
  })
4627
4907
  };
4628
4908
  var R = READ_INPUTS;
@@ -4906,14 +5186,14 @@ function approvalRequestSchema(operationId, input) {
4906
5186
  }
4907
5187
 
4908
5188
  // ../src/shared/contracts/api-ops/wire.ts
4909
- import { z as z31 } from "zod";
5189
+ import { z as z32 } from "zod";
4910
5190
  var toSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
4911
5191
  var toCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
4912
5192
  var schemaCache = new WeakMap;
4913
5193
  function inputJsonSchema(op) {
4914
5194
  let js = schemaCache.get(op.input);
4915
5195
  if (!js) {
4916
- js = z31.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
5196
+ js = z32.toJSONSchema(op.input, { io: "input", unrepresentable: "any" });
4917
5197
  schemaCache.set(op.input, js);
4918
5198
  }
4919
5199
  return js;
@@ -5127,7 +5407,7 @@ function wireInput(operationId, opts = {}) {
5127
5407
  for (const [k, v] of Object.entries(op.input.shape))
5128
5408
  if (!omit.has(k))
5129
5409
  shape[toSnake(k)] = v;
5130
- return z32.object(shape);
5410
+ return z33.object(shape);
5131
5411
  }
5132
5412
  var BUDGETS = [
5133
5413
  { stringBytes: MCP_LIMITS.untrustedStringMaxBytes, listMax: MCP_LIMITS.listMax },
@@ -5220,52 +5500,52 @@ function errorResult(o) {
5220
5500
  }
5221
5501
  };
5222
5502
  }
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())
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())
5229
5509
  })
5230
5510
  }).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()
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()
5237
5517
  }).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()
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()
5244
5524
  })).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()
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()
5256
5536
  }).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()
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()
5269
5549
  }).optional()
5270
5550
  });
5271
5551
  var spec = (name) => {
@@ -5311,10 +5591,10 @@ var has = (rt, operationId) => {
5311
5591
  return !!op && rt.scopes.includes(op.scope);
5312
5592
  };
5313
5593
  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.")
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.")
5316
5596
  };
5317
- var traceIdSchema = z32.string().regex(/^[0-9a-fA-F]{32}$/);
5597
+ var traceIdSchema = z33.string().regex(/^[0-9a-fA-F]{32}$/);
5318
5598
  var MONITOR_KINDS2 = {
5319
5599
  cron: { list: "monitors.list", get: "monitors.get", idField: "monitor_id" },
5320
5600
  uptime: { list: "uptime.list", get: "uptime.get", idField: "check_id" },
@@ -5378,8 +5658,8 @@ function describe(op, scopes) {
5378
5658
  destructive: isDestructiveOperation(op)
5379
5659
  };
5380
5660
  }
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`.");
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`.");
5383
5663
  function approvalBlock(t, next) {
5384
5664
  return {
5385
5665
  approval_id: t.approval_id,
@@ -5399,7 +5679,7 @@ var MCP_TOOL_DEFS = [
5399
5679
  title: "Workspace and node",
5400
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.",
5401
5681
  operations: ["workspace.get", "node.get"],
5402
- input: z32.object({}),
5682
+ input: z33.object({}),
5403
5683
  async run(_args, rt) {
5404
5684
  const [ws, node] = await Promise.all([rt.call("workspace.get", {}), rt.call("node.get", {})]);
5405
5685
  if (!ws.ok)
@@ -5421,9 +5701,9 @@ var MCP_TOOL_DEFS = [
5421
5701
  title: "Get an issue",
5422
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.",
5423
5703
  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)
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)
5427
5707
  }),
5428
5708
  async run(args, rt) {
5429
5709
  const omitted = [];
@@ -5464,9 +5744,9 @@ var MCP_TOOL_DEFS = [
5464
5744
  title: "Get a trace",
5465
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).",
5466
5746
  operations: ["traces.get", "traces.spans"],
5467
- input: z32.object({
5747
+ input: z33.object({
5468
5748
  trace_id: traceIdSchema.describe("W3C trace id, 32 hex characters."),
5469
- spans: z32.enum(["none", "errors", "all"]).default("none")
5749
+ spans: z33.enum(["none", "errors", "all"]).default("none")
5470
5750
  }),
5471
5751
  async run(args, rt) {
5472
5752
  const sum = await rt.call("traces.get", { trace_id: args["trace_id"] });
@@ -5498,17 +5778,17 @@ var MCP_TOOL_DEFS = [
5498
5778
  title: "Query metrics",
5499
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.",
5500
5780
  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(),
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(),
5506
5786
  start: isoWindow.start.optional(),
5507
5787
  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.")
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.")
5512
5792
  }),
5513
5793
  async run(args, rt) {
5514
5794
  const scope = {
@@ -5563,8 +5843,8 @@ var MCP_TOOL_DEFS = [
5563
5843
  title: "Release health",
5564
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.",
5565
5845
  operations: ["releases.list", "releases.health"],
5566
- input: z32.object({
5567
- 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."),
5568
5848
  version: releaseNameSchema.optional().describe("Release name exactly as the SDK sends it, e.g. web@1.4.2."),
5569
5849
  environment: environmentNameSchema.optional().describe("One environment, e.g. production."),
5570
5850
  compare: releaseNameSchema.optional().describe("With version: compare against this release instead of the previous one.")
@@ -5596,11 +5876,11 @@ var MCP_TOOL_DEFS = [
5596
5876
  title: "Correlate by trace or run",
5597
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.",
5598
5878
  operations: ["traces.get", "traces.spans", "spans.list", "logs.list"],
5599
- input: z32.object({
5879
+ input: z33.object({
5600
5880
  trace_id: traceIdSchema.optional(),
5601
- run_id: z32.string().min(1).max(128).optional(),
5881
+ run_id: z33.string().min(1).max(128).optional(),
5602
5882
  ...isoWindow,
5603
- project: z32.string().max(2000).optional().describe("Comma-separated project ids.")
5883
+ project: z33.string().max(2000).optional().describe("Comma-separated project ids.")
5604
5884
  }),
5605
5885
  async run(args, rt) {
5606
5886
  const trace = args["trace_id"];
@@ -5659,10 +5939,10 @@ var MCP_TOOL_DEFS = [
5659
5939
  title: "List monitors",
5660
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).",
5661
5941
  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)
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)
5666
5946
  }),
5667
5947
  async run(args, rt) {
5668
5948
  const kinds = args["kind"] && args["kind"] !== "all" ? [args["kind"]] : ["cron", "uptime", "slo"];
@@ -5697,10 +5977,10 @@ var MCP_TOOL_DEFS = [
5697
5977
  "monitors.occurrences",
5698
5978
  "monitors.backtest"
5699
5979
  ],
5700
- input: z32.object({
5701
- kind: z32.enum(["cron", "uptime", "slo"]),
5702
- id: z32.guid(),
5703
- 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)
5704
5984
  }),
5705
5985
  async run(args, rt) {
5706
5986
  const k = MONITOR_KINDS2[args["kind"]];
@@ -5760,9 +6040,9 @@ var MCP_TOOL_DEFS = [
5760
6040
  title: "Send a test event",
5761
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).",
5762
6042
  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()
6043
+ input: z33.object({
6044
+ project_id: z33.number().int().positive(),
6045
+ idempotency_key: z33.string().min(8).max(255).optional()
5766
6046
  }),
5767
6047
  async run(args, rt) {
5768
6048
  const r = await rt.call("projects.send_test_event", { project_id: args["project_id"] }, { idempotencyKey: args["idempotency_key"] ?? rt.newKey() });
@@ -5780,9 +6060,9 @@ var MCP_TOOL_DEFS = [
5780
6060
  title: "Find a configuration change",
5781
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.",
5782
6062
  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)
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)
5786
6066
  }),
5787
6067
  async run(args, rt) {
5788
6068
  const q = words(String(args["query"]));
@@ -5810,7 +6090,7 @@ var MCP_TOOL_DEFS = [
5810
6090
  title: "Describe a configuration change",
5811
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.",
5812
6092
  operations: [],
5813
- input: z32.object({ operation_id: operationIdArg }),
6093
+ input: z33.object({ operation_id: operationIdArg }),
5814
6094
  async run(args, rt) {
5815
6095
  const op = configureOp(args["operation_id"]);
5816
6096
  if (!op || op.method === "GET")
@@ -5839,7 +6119,7 @@ var MCP_TOOL_DEFS = [
5839
6119
  title: "Check a change before applying it",
5840
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.",
5841
6121
  operations: [],
5842
- input: z32.object({ operation_id: operationIdArg, params }),
6122
+ input: z33.object({ operation_id: operationIdArg, params }),
5843
6123
  async run(args, rt) {
5844
6124
  const op = configureOp(args["operation_id"]);
5845
6125
  if (!op || op.method === "GET")
@@ -5888,11 +6168,11 @@ var MCP_TOOL_DEFS = [
5888
6168
  title: "Apply a configuration change",
5889
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.",
5890
6170
  operations: [],
5891
- input: z32.object({
6171
+ input: z33.object({
5892
6172
  operation_id: operationIdArg,
5893
6173
  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.")
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.")
5896
6176
  }),
5897
6177
  async run(args, rt) {
5898
6178
  const op = configureOp(args["operation_id"]);
@@ -5953,7 +6233,7 @@ var MCP_TOOL_DEFS = [
5953
6233
  title: "Follow an approval",
5954
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).",
5955
6235
  operations: ["approvals.get"],
5956
- 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.") }),
5957
6237
  async run(args, rt) {
5958
6238
  const r = await rt.call("approvals.get", { approval_id: args["approval_id"] });
5959
6239
  if (!r.ok)
@@ -5973,10 +6253,10 @@ var MCP_TOOL_DEFS = [
5973
6253
  title: "Search Belvador docs",
5974
6254
  description: "Searches the public Belvador documentation (titles and summaries) and returns the best pages with their slugs for get_doc.",
5975
6255
  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)
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)
5980
6260
  }),
5981
6261
  async run(args, rt) {
5982
6262
  const locale = args["locale"] ?? "en";
@@ -5992,9 +6272,9 @@ var MCP_TOOL_DEFS = [
5992
6272
  title: "Read a docs page",
5993
6273
  description: "The Markdown of one public Belvador docs page by slug (e.g. `quickstart`, `sdk/react`, `reference/api`).",
5994
6274
  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")
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")
5998
6278
  }),
5999
6279
  async run(args, rt) {
6000
6280
  const locale = args["locale"] ?? "en";
@@ -6188,7 +6468,7 @@ function findToken(env = process.env, keychain = keychainToken) {
6188
6468
  }
6189
6469
 
6190
6470
  // packages/mcp/src/cli.ts
6191
- var PACKAGE_VERSION = "0.7.1";
6471
+ var PACKAGE_VERSION = "0.7.2";
6192
6472
  var HELP = `belvador-mcp ${PACKAGE_VERSION} — Belvador MCP server (stdio)
6193
6473
 
6194
6474
  Usage: npx -y @belvador/mcp [--toolsets=${MCP_DEFAULT_TOOLSETS.join(",")}]