/** * Naming convention for OAuth clients that scai mints via the Deploy * clients API (`./clients.ts`). * * Every scai-minted client is identifiable in the Cloud Portal clients * list by a `scai-` name prefix, and its provenance is recorded in the * description. This module is the single source of truth for that * convention — every mint call and every "is this ours?" check goes * through these helpers rather than hand-building strings. * * Name shape (stable + deterministic, so a list-then-match yields * idempotent reuse — no timestamps): * * - environment-scoped: `scai--` e.g. `scai-cm-production` * - organization-scoped: `scai-` e.g. `scai-deploy` * * The `` segment is the slugified scai environment-profile name. */ /** The `name`-field prefix that marks a client as scai-managed. */ export declare const SCAI_CLIENT_PREFIX = "scai-"; /** Client kinds scai can mint. `deploy` is org-scoped; the rest are env-scoped. */ export type ScaiClientType = "cm" | "deploy" | "edge" | "ehbuild"; /** scai surface that triggered the mint — recorded in the description. */ export type ScaiClientSurface = "CLI" | "MCP" | "SDK"; /** * Slugify a scai environment-profile name for use in a client name: * lowercase, every run of non-alphanumerics collapsed to a single * hyphen, leading/trailing hyphens trimmed. */ export declare const slugifyEnvName: (envName: string) => string; /** * Build the canonical client name for a scai-minted client. * * - env-scoped (`cm` | `edge` | `ehbuild`) → `scai--`; * `envName` is required. * - org-scoped (`deploy`) → `scai-deploy`; `envName` is ignored. * * Throws `INPUT_INVALID` if an env-scoped type is given without a * usable `envName`. */ export declare const buildScaiClientName: (type: ScaiClientType, envName?: string) => string; export interface BuildScaiClientDescriptionOptions { /** Which scai surface minted the client. */ surface: ScaiClientSurface; /** scai package version, e.g. "0.0.4". */ version: string; /** Environment-profile name — for env-scoped clients. */ envName?: string; } /** * The Deploy clients API caps the `description` field at 140 characters * — `POST /api/clients/v1/*` rejects anything longer as a validation * error. `buildScaiClientDescription` keeps its output within this. */ export declare const CLIENT_DESCRIPTION_MAX_LENGTH = 140; /** * Build the human-readable provenance string for a scai-minted client's * `description` field — records the surface, version, scope, and that * the credential is safe to delete. * * Stays within `CLIENT_DESCRIPTION_MAX_LENGTH`, truncating as a * defensive backstop for pathologically long env-profile names. The * project id and creation date are deliberately omitted: the clients * API records `createdAt` itself, and the project is already encoded in * the client name (`scai-cm-`). */ export declare const buildScaiClientDescription: (type: ScaiClientType, options: BuildScaiClientDescriptionOptions) => string; /** True if `name` carries the scai-managed prefix. */ export declare const isScaiManagedClient: (name: string | null | undefined) => boolean; /** * Parse a client name back into its `{ type, envName? }` parts, or * `null` if it is not a canonically-formed scai-managed name. * * Round-trips with `buildScaiClientName` — note `envName` comes back * slugified (the name only ever stored the slug). */ export declare const parseScaiClientName: (name: string | null | undefined) => { type: ScaiClientType; envName?: string; } | null;