import { z } from "zod"; import { type Membership } from "./run-context.js"; /** * THE seam both repos parse: what `GET /api/v1/users/{externalId}/memberships` * answers. The console produces it, the SDK's `cloudDirectory` consumes it, and * there is exactly one definition of it — a second copy is how a permission or * a cap comes to mean two things. */ /** A cap and WHO it applies to. `per-member` counts one person's own usage; `per-tenant` counts the whole company's, against the `org:` pool. The customer picks per cap. Both spellings are the limiter's existing grammar — the scope only decides whether `count` is handed a `pool` (`@vendoai/vendo` limits.ts) — so nothing new enforces anything. */ export type CapScope = "per-member" | "per-tenant"; export interface TenantCap { limit: number; scope: CapScope; } export interface TenantLimits { messagesPerDay?: TenantCap; generationsPerMonth?: TenantCap; } export declare const capScopeSchema: z.ZodEnum<["per-member", "per-tenant"]>; export declare const tenantCapSchema: z.ZodObject<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>; export declare const tenantLimitsSchema: z.ZodObject<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>; /** Applied by the console when a cap is first written and nowhere else, so the wire never carries an implicit scope: reading a cap always tells you both numbers' meaning. */ export declare const DEFAULT_CAP_SCOPE: { readonly messagesPerDay: "per-member"; readonly generationsPerMonth: "per-tenant"; }; /** `memberships` is core's own `Membership[]` verbatim — `org` IS the tenant id, so nothing downstream translates. `limits` is keyed by that same id and already resolved (per-tenant override ?? project default), so the SDK never sees defaults. */ export interface TenantDirectoryPayload { memberships: Membership[]; limits: Record; } export declare const tenantDirectoryPayloadSchema: z.ZodObject<{ memberships: z.ZodArray; teams: z.ZodOptional>; admin: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ org: z.ZodString; display: z.ZodOptional; teams: z.ZodOptional>; admin: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ org: z.ZodString; display: z.ZodOptional; teams: z.ZodOptional>; admin: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, "many">; limits: z.ZodRecord; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ memberships: z.ZodArray; teams: z.ZodOptional>; admin: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ org: z.ZodString; display: z.ZodOptional; teams: z.ZodOptional>; admin: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ org: z.ZodString; display: z.ZodOptional; teams: z.ZodOptional>; admin: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, "many">; limits: z.ZodRecord; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ memberships: z.ZodArray; teams: z.ZodOptional>; admin: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ org: z.ZodString; display: z.ZodOptional; teams: z.ZodOptional>; admin: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ org: z.ZodString; display: z.ZodOptional; teams: z.ZodOptional>; admin: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, "many">; limits: z.ZodRecord; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ messagesPerDay: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; generationsPerMonth: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ limit: z.ZodNumber; scope: z.ZodEnum<["per-member", "per-tenant"]>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>>; }, z.ZodTypeAny, "passthrough">>;