import type { SECRET_KEYS } from "../config/ConfigKeys.js"; import type { SecretHandle } from "./SecretHandle.js"; /** * A secret a store can hold: the executor's, and the gateway's own, which the * gateway alone opens, each from the file its configuration names: the token * it presents to its upstream, and an acceptance run's key and operator token. */ export type SecretName = (typeof SECRET_KEYS)[number] | "AGENTSAFE_GATEWAY_TOKEN" | "AGENTSAFE_ACCEPTANCE_KEY" | "AGENTSAFE_ACCEPTANCE_TOKEN"; export type ReloadReason = "WATCH" | "POLL" | "SIGHUP" | "OPERATOR"; export interface ReloadReport { readonly reason: ReloadReason; /** Secrets whose value changed and whose new handle is now current. */ readonly rotated: readonly SecretName[]; /** Secrets whose new file was refused; the previous handle stays current. */ readonly refused: readonly { readonly name: SecretName; readonly code: string; }[]; } /** * Where the executor's secrets come from and how they change. A store hands * out the current handle by name; a consumer that must follow rotation reads * the handle at the moment of use, or subscribes. Every failure names the * variable and never a value. */ export interface SecretStore { has(name: SecretName): boolean; /** The current handle; throws `SECRET_UNKNOWN` for a name this store does not hold. */ get(name: SecretName): SecretHandle; /** Notified after a rotation, with the new handle; returns the unsubscribe. */ onRotate(name: SecretName, listener: (next: SecretHandle) => void): () => void; /** Re-reads every source; atomic per secret, never partial. */ reload(reason: ReloadReason): Promise; close(): void; } /** A refusal at start-up or reload: the code and the variable, never the value. */ export declare class SecretError extends Error { readonly code: string; readonly secret: SecretName; constructor(code: string, secret: SecretName); } //# sourceMappingURL=SecretStore.d.ts.map