/** * Zod schemas for the auth-broker wire protocol. * * Shared between the server (validates inbound request bodies) and the client * (validates responses from the broker). Schemas mirror the TypeScript types * in `./types.ts` 1:1; the types remain the source of truth for static typing, * and `z.infer` is asserted-compatible with them where possible. * * Schemas use `.strict()` on objects with a closed set of fields so unknown * keys are rejected — the previous implementation used a hand-rolled * `hasOnlyFields` allowlist for the same effect. */ import * as z from "zod/v4"; export declare const mcpOAuthBindingSchema: z.ZodObject<{ resourceOrigin: z.ZodString; tokenEndpoint: z.ZodString; }, z.core.$strict>; /** Real OAuth credential (broker-side) — refresh token is the actual upstream value. */ export declare const oauthCredentialSchema: z.ZodObject<{ type: z.ZodLiteral<"oauth">; refresh: z.ZodString; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; }, z.core.$strict>; /** OAuth credential as it appears in broker snapshots — refresh replaced with sentinel. */ export declare const remoteOauthCredentialSchema: z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>; export declare const apiKeyCredentialSchema: z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>; /** Discriminated union accepted on POST /v1/credential (writes). */ export declare const writableAuthCredentialSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; refresh: z.ZodString; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; /** Discriminated union returned in snapshots (refresh is sentinel for OAuth). */ export declare const snapshotCredentialSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; export declare const credentialSnapshotEntrySchema: z.ZodObject<{ id: z.ZodNumber; provider: z.ZodString; credential: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; }, z.core.$strict>; export declare const snapshotEntrySchema: z.ZodObject<{ id: z.ZodNumber; provider: z.ZodString; credential: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; rotatesInMs: z.ZodNullable; }, z.core.$strict>; export declare const refresherScheduleSchema: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; export declare const snapshotResponseSchema: z.ZodObject<{ generation: z.ZodNumber; generatedAt: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; credentials: z.ZodArray; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; rotatesInMs: z.ZodNullable; }, z.core.$strict>>; }, z.core.$strict>; /** Closed redacted projection: no token, key, identity object, or extension fields. */ export declare const credentialMetadataRecordSchema: z.ZodObject<{ id: z.ZodNumber; provider: z.ZodString; type: z.ZodEnum<{ api_key: "api_key"; oauth: "oauth"; }>; identity: z.ZodNullable; disabledCause: z.ZodNullable; }, z.core.$strict>; export declare const credentialMetadataResponseSchema: z.ZodObject<{ generation: z.ZodNumber; generatedAt: z.ZodNumber; credentials: z.ZodArray; identity: z.ZodNullable; disabledCause: z.ZodNullable; }, z.core.$strict>>; }, z.core.$strict>; /** First frame on connect — full snapshot embedded inline with a `kind` tag. */ export declare const snapshotStreamSnapshotEventSchema: z.ZodObject<{ generation: z.ZodNumber; generatedAt: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; credentials: z.ZodArray; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; rotatesInMs: z.ZodNullable; }, z.core.$strict>>; kind: z.ZodLiteral<"snapshot">; }, z.core.$strict>; /** Per-credential upsert/refresh delta. */ export declare const snapshotStreamEntryEventSchema: z.ZodObject<{ kind: z.ZodLiteral<"entry">; generation: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; entry: z.ZodObject<{ id: z.ZodNumber; provider: z.ZodString; credential: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; rotatesInMs: z.ZodNullable; }, z.core.$strict>; }, z.core.$strict>; /** Per-credential delete delta. */ export declare const snapshotStreamRemovedEventSchema: z.ZodObject<{ kind: z.ZodLiteral<"removed">; generation: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; id: z.ZodNumber; }, z.core.$strict>; /** Discriminated union over every event frame the snapshot stream emits. */ export declare const snapshotStreamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ generation: z.ZodNumber; generatedAt: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; credentials: z.ZodArray; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; rotatesInMs: z.ZodNullable; }, z.core.$strict>>; kind: z.ZodLiteral<"snapshot">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"entry">; generation: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; entry: z.ZodObject<{ id: z.ZodNumber; provider: z.ZodString; credential: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; rotatesInMs: z.ZodNullable; }, z.core.$strict>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"removed">; generation: z.ZodNumber; serverNowMs: z.ZodNumber; refresher: z.ZodObject<{ enabled: z.ZodBoolean; intervalMs: z.ZodNumber; skewMs: z.ZodNumber; nextSweepInMs: z.ZodNumber; }, z.core.$strict>; id: z.ZodNumber; }, z.core.$strict>], "kind">; export declare const healthzResponseSchema: z.ZodObject<{ ok: z.ZodBoolean; version: z.ZodOptional; }, z.core.$strict>; /** * Broker `/v1/usage` response. Reports are full {@link UsageReport}s minus the * heavy provider-specific `raw` field (the server strips it before send) — we * keep `raw` optional in the underlying schema so a misconfigured broker that * forgot to strip still validates. */ export declare const usageResponseSchema: z.ZodObject<{ generatedAt: z.ZodNumber; reports: z.ZodArray; projectId: z.ZodOptional; orgId: z.ZodOptional; modelId: z.ZodOptional; tier: z.ZodOptional; windowId: z.ZodOptional; shared: z.ZodOptional; }, z.core.$strip>; window: z.ZodOptional; resetsAt: z.ZodOptional; }, z.core.$strip>>; amount: z.ZodObject<{ used: z.ZodOptional; limit: z.ZodOptional; remaining: z.ZodOptional; usedFraction: z.ZodOptional; remainingFraction: z.ZodOptional; unit: z.ZodEnum<{ bytes: "bytes"; minutes: "minutes"; percent: "percent"; requests: "requests"; tokens: "tokens"; unknown: "unknown"; usd: "usd"; }>; }, z.core.$strip>; status: z.ZodOptional>; notes: z.ZodOptional>; }, z.core.$strip>>; metadata: z.ZodOptional>; raw: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strict>; export declare const credentialRefreshRequestSchema: z.ZodObject<{ clientId: z.ZodOptional; clientSecret: z.ZodOptional; }, z.core.$strict>; export declare const credentialRefreshResponseSchema: z.ZodObject<{ entry: z.ZodObject<{ id: z.ZodNumber; provider: z.ZodString; credential: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; }, z.core.$strict>; }, z.core.$strict>; export declare const credentialDisableRequestSchema: z.ZodObject<{ cause: z.ZodOptional; }, z.core.$strict>; export declare const credentialDisableResponseSchema: z.ZodObject<{ ok: z.ZodBoolean; }, z.core.$strict>; export declare const credentialUploadRequestSchema: z.ZodObject<{ provider: z.ZodString; credential: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"oauth">; refresh: z.ZodString; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; }, z.core.$strict>; export declare const credentialUploadResponseSchema: z.ZodObject<{ entries: z.ZodArray; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; }, z.core.$strict>>; }, z.core.$strict>; export declare const credentialIfAbsentUploadResponseSchema: z.ZodObject<{ inserted: z.ZodBoolean; reason: z.ZodEnum<{ inserted: "inserted"; "skipped-existing": "skipped-existing"; "skipped-existing-config": "skipped-existing-config"; "skipped-existing-env": "skipped-existing-env"; "skipped-existing-fallback": "skipped-existing-fallback"; "skipped-existing-runtime": "skipped-existing-runtime"; "skipped-invalid": "skipped-invalid"; "updated-existing": "updated-existing"; }>; entries: z.ZodArray; access: z.ZodString; expires: z.ZodNumber; enterpriseUrl: z.ZodOptional; projectId: z.ZodOptional; email: z.ZodOptional; accountId: z.ZodOptional; mcpBinding: z.ZodOptional>; refresh: z.ZodLiteral<"__remote__">; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"api_key">; key: z.ZodString; }, z.core.$strict>], "type">; identityKey: z.ZodNullable; }, z.core.$strict>>; }, z.core.$strict>;