/** * `agentsafe test --hosted`: the boundary test with Decionis deciding. The * same fixed requests as the local test, sent two ways at the same synthetic * loopback target: directly, and through the gateway in shadow against the * Decionis workspace this machine is logged into. Nothing real is called and * nothing is enforced; what the run produces is what the local test cannot: * a first governed action against Decionis for this workspace, one signed * Decision Dossier per consequential request, and the record itself, * fetched with the run's own key and shown by its proof. * * This is the one test that reads the stored login and the `DECIONIS_*` * variables, and it says so; the local test reads neither. A provisional * workspace evaluates in shadow only, which is the one lane this test runs, * so the free workspace `agentsafe login --provision` mints is enough. */ import { fetchSignedDossier, type SignedDossierSummary } from "@decionis/agent-safe-pipeline"; import { type BoundaryCase, type PassOutcome } from "./BoundaryTest.js"; import { type GatewayDependencies } from "./Gateway.js"; import { type GatewayConfig, type StoredCredentials } from "./GatewayConfig.js"; import type { GatewayState } from "./GatewayReport.js"; import type { InstallSurface } from "./InstallSurface.js"; export declare const HOSTED_BOUNDARY_TEST_VERSION = "agent-safe.hosted-boundary-test/1"; /** What Decionis said about one request sent through the shadow lane. */ export interface HostedDecision { /** Whether the gateway captured the request as an intent and asked; a read is not consequential. */ readonly consequential: boolean; readonly status: number | null; /** The gateway's own state on the answer: `SHADOW` when forwarded and asked, `ERROR` when it refused the request itself, null when passed through. */ readonly state: GatewayState | null; readonly verdict: "ALLOW" | "ESCALATE" | "BLOCK" | null; readonly reason_codes: readonly string[]; readonly decision_id: string | null; readonly dossier_id: string | null; } export interface HostedCaseResult { readonly id: string; readonly title: string; readonly adversarial: boolean; readonly request: { readonly method: string; readonly path: string; readonly body: string | null; }; readonly direct: PassOutcome; readonly decionis: HostedDecision; } export interface HostedBoundaryTestReport { readonly version: typeof HOSTED_BOUNDARY_TEST_VERSION; readonly at: string; readonly runtime: string; readonly authority: { readonly kind: "decionis"; readonly endpoint: string; readonly tenant: string; /** A workspace minted without an account, which decides in shadow only. */ readonly provisional: boolean; readonly mode: "SHADOW"; }; readonly target: "synthetic loopback"; readonly cases: readonly HostedCaseResult[]; /** Of the consequential requests, what Decionis would have decided. */ readonly decided: { readonly consequential: number; readonly would: { readonly ALLOW: number; readonly ESCALATE: number; readonly BLOCK: number; readonly NONE: number; }; }; /** The Decision Dossiers the run left, in the order they were minted. */ readonly dossiers: readonly string[]; /** The first dossier as fetched with the run's key: signed, by whom, under which issuer tier. */ readonly signed: SignedDossierSummary | null; /** Why the record could not be fetched, when it could not. */ readonly signedUnavailable: string | null; /** The adoption milestones the shadow lane reported, in order. */ readonly milestones: readonly string[]; /** * `DECIONIS_DECIDED`: every consequential request got a verdict. * `AUTHORITY_UNREACHABLE`: none did. `PARTLY_DECIDED`: some did. */ readonly verdict: "DECIONIS_DECIDED" | "AUTHORITY_UNREACHABLE" | "PARTLY_DECIDED"; } export declare class HostedTestError extends Error { readonly code: "NO_LOGIN" | "CONFIG_INVALID"; readonly detail: string; constructor(code: "NO_LOGIN" | "CONFIG_INVALID", detail: string); } export interface HostedBoundaryTestOptions { readonly version: string; /** The stored login, when there is one; the environment's key wins over it as it does for `proxy`. */ readonly credentials: StoredCredentials | null; /** The process environment; only the `DECIONIS_*` variables and `NODE_ENV` are read from it. */ readonly env: Readonly>; readonly surface: InstallSurface | null; readonly cases?: readonly BoundaryCase[]; readonly clock?: () => number; /** How long to wait for Decionis's observation of one request. */ readonly observationTimeoutMs?: number; readonly gateway?: Pick; readonly fetchDossier?: typeof fetchSignedDossier; } /** The variables the hosted test reads from the environment, and no others. */ export declare const HOSTED_TEST_ENVIRONMENT: readonly ["DECIONIS_API_KEY", "DECIONIS_API_KEY_FILE", "DECIONIS_API_URL", "DECIONIS_TENANT_ID", "DECIONIS_TIMEOUT_MS", "DECIONIS_ALLOW_INSECURE_LOOPBACK", "NODE_ENV"]; /** * The configuration of the shadow lane: the synthetic target as upstream, * shadow mode, and the authority from the stored login and the `DECIONIS_*` * variables alone. No file, no `AGENTSAFE_*` variable, so nothing of the * operator's own gateway is in play; a provisional login is shadow by rule. */ export declare function hostedConfig(options: Pick, target: string): { readonly config: GatewayConfig; readonly env: Record; }; /** Runs the hosted test and returns the report; nothing is printed here. */ export declare function runHostedBoundaryTest(options: HostedBoundaryTestOptions): Promise; //# sourceMappingURL=HostedBoundaryTest.d.ts.map