import type { PresenceVerificationRequirements } from "@decionis/agent-safe-pipeline"; import { type PostureConfig } from "../posture/PostureChecks.js"; import type { PrivateKeyJwtAlgorithm } from "../credential/PrivateKeyJwtCredential.js"; import type { SignedRequestAlgorithm } from "../credential/SignedRequestCredential.js"; import type { TlsMinVersion } from "../http/TlsListener.js"; import { type LockoutRule, type RateLimitRule } from "../identity/RateLimiter.js"; import { type HardLimitSettings } from "../limits/HardLimits.js"; import type { PostureMode } from "../posture/HostPosture.js"; import { type SecretName } from "../secrets/SecretStore.js"; export type ExecutorMode = "SHADOW" | "ENFORCEMENT"; export type EscalationMode = "NONE" | "DIRECT" | "MANAGED"; export type VerificationMethod = "WEBAUTHN" | "ACTIVE_LIVENESS"; export type VerificationLevel = "STANDARD" | "HIGH_CONFIDENCE"; /** * How this process proves itself to the downstream. A static header value * from the secret store; an OAuth 2.0 client-credentials token obtained with * a `private_key_jwt` assertion; or an RFC 9421 signature over each request. * The secret each kind needs is named by the kind, never by the caller. */ export type DownstreamCredentialConfig = { readonly kind: "STATIC_HEADER"; readonly header: string; } | { readonly kind: "PRIVATE_KEY_JWT"; readonly tokenUrl: string; readonly clientId: string; readonly keyId: string | null; readonly algorithm: PrivateKeyJwtAlgorithm; readonly audience: string | null; readonly scope: string | null; } | { readonly kind: "SIGNED_REQUEST"; readonly algorithm: SignedRequestAlgorithm; readonly keyId: string; }; export interface DownstreamConfig { readonly url: string; /** Read-only lookup for reconciliation; `{idempotency_key}` is substituted. */ readonly lookupUrl: string | null; readonly system: string; readonly operation: string; readonly environment: string; readonly credential: DownstreamCredentialConfig; /** The header names whose values the redactor treats as credentials. */ readonly redactedHeaders: readonly string[]; readonly timeoutMs: number; } /** Who may call: the principals file, or the one legacy caller the configuration names. */ export interface IdentityConfig { readonly principalsFile: string | null; readonly allowLegacyCaller: boolean; /** The legacy caller's tenant and actor; null when a principals file names the callers. */ readonly legacy: { readonly tenantId: string; readonly actor: { readonly id: string; readonly type: string; readonly runtime?: string; }; } | null; readonly jwt: { readonly audience: string; readonly jwksFile: string; readonly jwksUrl: string | null; readonly jwksCaFile: string | null; readonly refreshSeconds: number; readonly clockToleranceSeconds: number; } | null; readonly unauthenticated: RateLimitRule; readonly lockout: LockoutRule | null; } /** * How an `ESCALATE` is resolved. `NONE` returns the hold and stops. `DIRECT` * has this process open the Presence request and hold the Presence * credential; the receipt goes back to the authority for a fresh decision. * `MANAGED` asks the authority to orchestrate Presence and polls the * authority only; no Presence credential exists here. */ export type EscalationConfig = { readonly mode: "NONE"; } | { readonly mode: "DIRECT"; readonly presence: { readonly baseUrl: string; readonly organization: string; }; readonly approverId: string; readonly requirements: PresenceVerificationRequirements; } | { readonly mode: "MANAGED"; /** * Narrows who may approve to one person. Null leaves it to the policy: * the rule that escalates names its approvers, and the authority asks * them. */ readonly approverId: string | null; readonly approverRole: string | null; readonly requirements: { readonly methods: readonly VerificationMethod[]; readonly level: VerificationLevel; }; }; /** What the posture verifies, and how: declared by the deployment, never defaulted to lenient. */ export interface PostureSettings extends PostureConfig { readonly mode: PostureMode; readonly intervalSeconds: number; } /** How the listener presents itself: TLS with the given material, or plaintext outside production only. */ export interface ListenerConfig { readonly tls: { readonly certFile: string; /** When set, every connection is asked for a client certificate and non-public routes require one. */ readonly clientCaFile: string | null; readonly minVersion: TlsMinVersion; } | null; } /** How a destination is trusted beyond the platform's own store: a CA bundle, SPKI pins, or neither. */ export interface TrustAnchor { readonly caFile: string | null; /** `sha256/` over the DER SubjectPublicKeyInfo; empty, or at least two. */ readonly pins: readonly string[]; } export interface EgressConfig { readonly maxResponseBytes: number; readonly trust: { readonly authority: TrustAnchor; readonly presence: TrustAnchor; readonly downstream: TrustAnchor; }; } /** Where the chain heads and the attempt journal are kept, and how much is kept. */ export interface EvidenceConfig { readonly journalDir: string | null; readonly checkpointLines: number; /** * Whether an attempt must be journaled before it may execute. True by * default: an execution nobody could reconcile afterwards is worse than a * refusal. `SHADOW` never executes, so it never needs one. */ readonly journalRequired: boolean; readonly journalRetainDays: number; /** Whether `/ready` waits while an attempt's outcome is still unknown. */ readonly readyRequiresNoUnknownAttempts: boolean; /** Where an evidence bundle is written; exporting is refused when null. */ readonly exportDir: string | null; /** How many lines of each stream this process keeps for an export. */ readonly windowLines: number; /** * The image digest this deployment believes it is running, as the platform * reported it. Carried into a bundle and marked as not self-verified, * because a process cannot read the digest of its own image. */ readonly imageDigest: string | null; } /** When the executor stops taking work, and what it takes to let it through again. */ export interface HaltConfig { readonly file: string | null; readonly authFailures: RateLimitRule | null; readonly egressRefusals: RateLimitRule | null; } /** The host's own ceilings, above whatever the authority decides; none when null. */ export type LimitsConfig = HardLimitSettings | null; /** * The banking family's settings. `onEffectMismatch` is the institution's * exception policy in one word: an observation that does not match what was * authorised either stops the executor or is recorded and alerted on. */ export interface BankingConfig { readonly adapterId: string; readonly adapterVersion: string; readonly onEffectMismatch: "HALT" | "ALERT"; /** Where a posted effect is read back by the provider's own reference. */ readonly lookupByReferenceUrl: string | null; } /** Where card holds live, and how an issuer may re-present an authorization. */ export interface CardsConfig { /** * `memory` holds within this process and is lost with it. `postgres` is * shared by every replica and survives a restart: the connection string * and the hold key come from the secret store, and what a row keeps of a * grant is sealed under that key. */ readonly holds: { readonly store: "memory"; } | { readonly store: "postgres"; readonly table: string; readonly namespace: string; }; /** * `single`: one authorization spends a hold, and the same authorization id * re-presented for a different amount is refused. `incremental`: the same * authorization id may be re-presented for a higher amount, up to the * grant's ceiling and before its result, against the same claim. */ readonly authorizations: "single" | "incremental"; /** * What the hook does with an authorization that has no hold. `no_match` * (the default) answers `NO_MATCH` with `NO_GRANT`. `evaluate` evaluates * the authorization at the commit boundary as a `card.purchase` intent * of the commit actor: an `ALLOW` is held and claimed in the same call, * an `ESCALATE` is answered `PENDING` with the handoff for a platform that * can pend, a `BLOCK` is `NO_MATCH`. */ readonly noGrant: "no_match" | "evaluate"; /** The tenant and actor a commit-boundary evaluation is captured as; present exactly with `evaluate`. */ readonly commit: { readonly tenantId: string; readonly actor: { readonly id: string; readonly type: string; }; } | null; readonly outcomes: CardOutcomesConfig; } /** * The card purchases' outcome evidence, for the meter Decionis keeps * (`decionis.outcomes.evidence/1`). `off`, the default, records and sends * nothing. `record` keeps what each purchase came to in `dir`, after its * answer was given. `publish` also states it to Decionis as the `agentsafe` * producer, on a timer and never on the request path. Neither changes what * any authorization is answered. */ export type CardOutcomesConfig = { readonly mode: "off"; } | { readonly mode: "record"; readonly dir: string; } | { readonly mode: "publish"; readonly dir: string; /** The Decionis organization the evidence is about. */ readonly orgId: string; readonly intervalSeconds: number; }; /** * Who decides. `hosted` asks Decionis for every decision (`enforce-and-bind`), * which is how the executor has always worked. `edge` decides locally with the * Decionis edge evaluator, a separately licensed WebAssembly module this * package loads but does not contain, and still asks Decionis for every * escalation. */ export type DecisionAuthorityKind = "hosted" | "edge"; /** The edge evaluator's settings; present exactly when the authority is `edge`. */ export interface EdgeConfig { /** The module file (ABI 3); the executor refuses to start without a valid one. */ readonly wasmPath: string; /** The Decionis organisation the bundles are issued to (their audience). */ readonly orgId: string; /** `url`: fetched from Decionis with the API key. `file`: placed by an operator, re-read on change. */ readonly bundle: { readonly source: "url"; } | { readonly source: "file"; readonly file: string; }; readonly refreshSeconds: number; /** No usable bundle, or a module fault: ask Decionis (`hosted`), or refuse (`block`). */ readonly onUnavailable: "hosted" | "block"; /** * Where single use is held. `memory` holds within this process and is * accepted only when the deployment says it runs one replica; `postgres` * is shared by every replica (connection string from the secret store). */ readonly replay: { readonly store: "memory"; readonly singleReplica: true; } | { readonly store: "postgres"; readonly table: string; }; /** Monthly usage reports. Without a signing key nothing is reported, and the licence check warns. */ readonly usage: { /** The installation (one evidence chain); generated and kept with the tally when null. */ readonly installationId: string | null; readonly signing: boolean; readonly keyId: string | null; /** `file` source only: where a signed report is written for an operator to upload. */ readonly reportDir: string | null; }; /** `file` source only: the entitlement an operator placed, and the pinned Decionis JWKS. */ readonly entitlement: { readonly file: string | null; readonly jwksFile: string | null; }; } /** * The executor's configuration: every setting, and the names of the secrets * it needs, but no secret value. Values live in a `SecretStore`, read through * a handle at the moment of use, so a rotation is followed and nothing here * can be printed by mistake. */ export interface ExecutorConfig { readonly mode: ExecutorMode; readonly production: boolean; readonly bindAddress: string; readonly port: number; readonly identity: IdentityConfig; /** How long a proposal stays valid; a ceremony has to finish inside it. */ readonly intentTtlSeconds: number; readonly escalation: EscalationConfig; readonly authority: { readonly baseUrl: string; readonly allowInsecureLoopback: boolean; }; readonly decision: { readonly authority: DecisionAuthorityKind; }; readonly edge: EdgeConfig | null; readonly downstream: DownstreamConfig; readonly listener: ListenerConfig; readonly egress: EgressConfig; readonly evidence: EvidenceConfig; readonly halt: HaltConfig; readonly limits: LimitsConfig; readonly banking: BankingConfig; readonly cards: CardsConfig; /** The most the authority's clock may differ from this host's before the executor halts. */ readonly maxClockSkewMs: number; readonly posture: PostureSettings; readonly secrets: { /** The secrets this configuration needs; each is given as a file or, outside production, a variable. */ readonly required: readonly SecretName[]; }; } type EnvironmentMap = Readonly>; /** * Reads the executor's configuration from an environment map. Every failure * is a refusal to start that names the variable, never its value. There is * no default for anything that identifies a tenant, a system, a person, or * a network path: a deployment states all of it. Secrets are located here * (which variable, which file) and read elsewhere. */ export declare class ExecutorConfigLoader { static load(env: EnvironmentMap): ExecutorConfig; /** * Who may call. A principals file names every caller and excludes the * legacy variables; without one, the legacy caller is synthesised from * them, which production refuses unless asked for by name. */ private static identity; /** * Where card holds live. The shared store needs its namespace by name, so * two deployments on one database can never read each other's holds by * accident, and its settings without it are a contradiction, refused. */ private static cards; /** * The outcome evidence is off unless the deployment names a mode. Recording * needs the directory the facts are kept in; publishing also needs the * organization the evidence is about and the producer token Decionis * registered for this deployment. A setting a mode does not use is a * contradiction, refused rather than ignored. */ private static cardOutcomes; /** * The commit-boundary evaluation needs an identity to capture the * authorization as, named by the deployment: the hook's own principal is * an operator, which carries none. Its settings without it are refused. */ private static cardCommit; /** * The edge evaluator, when the deployment asks for it by name. Its settings * without it are a contradiction and are refused rather than ignored, and * with it the module and the organisation are required: there is no * default for either. The bundle comes from Decionis unless a file is named. */ private static edge; /** * The host's own ceilings. A window needs a length, and a sum without a * per-currency ceiling would be a ceiling on nothing, so the parts are * refused apart rather than silently ignored. */ private static limits; /** The downstream credential kind, with the keys of the other kinds refused by name. */ private static credential; /** * TLS unless plaintext is asked for by name, which production refuses. * A plaintext listener with TLS material beside it is a contradiction * and is refused too, naming what was given. */ private static listener; /** The trust anchors per destination; one origin has one anchor, and a pin set is two or more. */ private static egress; /** * Where each required secret is: a file (`_FILE`) or, outside * production, the variable itself. Given both ways, neither way, or in the * environment under production is a refusal that names the variable. */ private static locateSecrets; private static escalation; /** The ceremony methods both shapes accept, as a comma-separated list. */ private static methods; /** * The same rule the gate applies to the authority address: HTTPS, no * credentials in the URL, no query or fragment. Plain HTTP is accepted for * loopback only, only when asked for, and never in production. */ /** An https URL, or a loopback http one when that is allowed by name; the gateway's loader shares it. */ static serviceUrl(value: string, key: string, allowInsecureLoopback: boolean): string; } export {}; //# sourceMappingURL=ExecutorConfig.d.ts.map