cavi-ai/
GitHub ↗

@cavi-ai/api-client/testing

Package subpath: ./testing

CapabilityClientConformanceReport#

Kind: type

ts
export type CapabilityClientConformanceReport = {
    ok: boolean;
    probes: CapabilityClientProbe[];
    rejections: CapabilityClientProbe[];
};

CapabilityClientProbe#

Kind: type

ts
export type CapabilityClientProbe = {
    call: string;
    resolved: boolean;
    ok?: boolean;
    error?: unknown;
};

HttpTransportConformanceFixture#

Kind: type

ts
export type HttpTransportConformanceFixture = FixtureFor<"http", HttpTransportConformanceObservation>;

HttpTransportConformanceObservation#

Kind: type

ts
export type HttpTransportConformanceObservation = TransportConformanceSharedObservation & Readonly<{
    kind: "http";
    requests: readonly HttpRequestObservation[];
}>;

inspectCapabilityClientConformance#

Kind: function

ts
/**
 * The non-throwing contract, made checkable: call one representative method
 * per facade surface and verify each RESOLVES (ok:true or ok:false) instead
 * of rejecting. Probes run against an undeclared/unwired client — nothing
 * should escalate to the auth/unknown carve-outs.
 *
 * `events.subscribe` is probed like every other gated surface: it resolves a
 * `CapabilityResult` (`ok:false` on a bare/undeclared client). On the rare
 * client where it resolves `ok:true` (a live subscription), the probe disposes
 * the returned `RuntimeEventSubscription` so the inspector never leaks a live
 * subscription against a real backend.
 */
export declare function inspectCapabilityClientConformance(client: CapabilityClient): Promise<CapabilityClientConformanceReport>;

inspectKanbanConformance#

Kind: function

ts
/**
 * Exercise a KanbanClient's core methods and validate the canonical shape.
 *
 * NOTE: this MUTATES the target backend — it creates a card, updates and moves
 * it, then deletes it. Run it against a disposable board, not production data.
 */
export declare function inspectKanbanConformance(client: KanbanClient): Promise<KanbanConformanceReport>;

inspectRuntimeProviderConformance#

Kind: function

ts
export declare function inspectRuntimeProviderConformance(fixture: RuntimeProviderConformanceFixture): Promise<RuntimeProviderConformanceReport>;

inspectTeamDirectoryConformance#

Kind: function

ts
/** Exercise a TeamDirectory's resolution contract. Read-only (no mutation). */
export declare function inspectTeamDirectoryConformance(directory: TeamDirectory): TeamDirectoryConformanceReport;

inspectTransportConformance#

Kind: function

ts
export declare function inspectTransportConformance(fixture: TransportConformanceFixture): Promise<TransportConformanceReport>;

JsonRpcTransportConformanceFixture#

Kind: type

ts
export type JsonRpcTransportConformanceFixture = FixtureFor<"json-rpc", JsonRpcTransportConformanceObservation>;

JsonRpcTransportConformanceObservation#

Kind: type

ts
export type JsonRpcTransportConformanceObservation = TransportConformanceSharedObservation & Readonly<{
    kind: "json-rpc";
    requests: readonly JsonRpcRequestObservation[];
    responses: readonly JsonRpcResponseObservation[];
    notifications: readonly JsonRpcNotificationObservation[];
}>;

KanbanConformanceCheck#

Kind: interface

ts
export interface KanbanConformanceCheck {
    name: string;
    ok: boolean;
    detail?: string;
}

KanbanConformanceReport#

Kind: interface

ts
export interface KanbanConformanceReport {
    ok: boolean;
    checks: KanbanConformanceCheck[];
}

RawGatewayConformanceFactory#

Kind: type

ts
export type RawGatewayConformanceFactory = () => RawGatewayConformanceFixture | Promise<RawGatewayConformanceFixture>;

RawGatewayConformanceFixture#

Kind: type

ts
export type RawGatewayConformanceFixture = Readonly<{
    channel: RawGatewayChannel;
    descriptor: RuntimeControlExtensionDescriptor<RawGatewayChannel>;
    response: unknown;
    ordinaryOperationId: string;
    ordinaryError: unknown;
    unsupportedOperationId: string;
    emitEvent: (event: RawGatewayEvent) => void;
    emitState: (state: RawGatewayConnectionState) => void;
    disposalCount: () => number;
    connectCount: () => number;
    /** Optional rejection identity used to prove rejected disposal is still cached exact-once. */
    expectedDisposalError?: unknown;
}>;

RawGatewayConformanceReport#

Kind: type

ts
export type RawGatewayConformanceReport = Readonly<{
    valid: boolean;
    failures: readonly string[];
}>;

runRawGatewayConformance#

Kind: function

ts
/** Exercise the provider-neutral raw gateway contract without selecting a provider. */
export declare function runRawGatewayConformance(createChannel: RawGatewayConformanceFactory): Promise<RawGatewayConformanceReport>;

runRuntimeControlClientConformance#

Kind: function

ts
export declare function runRuntimeControlClientConformance(harness: RuntimeControlClientConformanceHarness): Promise<RuntimeControlClientConformanceReport>;

runRuntimeControlScenarios#

Kind: function

ts
export declare function runRuntimeControlScenarios(environment: RuntimeControlScenarioEnvironment): Promise<RuntimeControlScenarioReport>;

RUNTIME_CONTROL_CLIENT_MODULES#

Kind: variable

ts
export declare const RUNTIME_CONTROL_CLIENT_MODULES: readonly [
    "authStatus",
    "sessions",
    "models",
    "usage",
    "tasks",
    "workspace",
    "events"
];

RUNTIME_CONTROL_CLIENT_OPERATION_CAPABILITIES#

Kind: variable

ts
export declare const RUNTIME_CONTROL_CLIENT_OPERATION_CAPABILITIES: {
    readonly "authStatus.listAuthStatus": "controlPlane.authStatus.list";
    readonly "sessions.listSessions": "controlPlane.sessions.list";
    readonly "sessions.getSession": "controlPlane.sessions.get";
    readonly "sessions.cancelSession": "controlPlane.sessions.cancel";
    readonly "models.listModels": "controlPlane.models.list";
    readonly "usage.getUsage": "controlPlane.usage.get";
    readonly "tasks.listTasks": "controlPlane.tasks.list";
    readonly "tasks.getTask": "controlPlane.tasks.get";
    readonly "tasks.cancelTask": "controlPlane.tasks.cancel";
    readonly "workspace.listWorkspaces": "controlPlane.workspace.list";
    readonly "workspace.getWorkspace": "controlPlane.workspace.get";
    readonly "events.subscribe": "controlPlane.events.subscribe";
};

RUNTIME_CONTROL_SCENARIO_EXTENSION#

Kind: variable

ts
export declare const RUNTIME_CONTROL_SCENARIO_EXTENSION: RuntimeControlExtensionDescriptor<RuntimeControlScenarioExtension>;

RUNTIME_CONTROL_SCENARIOS#

Kind: variable

ts
export declare const RUNTIME_CONTROL_SCENARIOS: readonly RuntimeControlScenarioDefinition[];

RuntimeControlClientConformanceHarness#

Kind: type

ts
export type RuntimeControlClientConformanceHarness = Readonly<{
    /** Provider id every CapabilityUnavailable rejection must identify. */
    providerId: string;
    /** Creates the control plane to exercise. */
    create: () => RuntimeControlClient | Promise<RuntimeControlClient>;
    /** Sensitive values that must never appear in provider errors. */
    secrets?: readonly string[];
    /** Optional provider-backed lifecycle probes for abort and resource ownership. */
    lifecycle?: Readonly<{
        abortReason?: unknown;
        preAbort?: (signal: AbortSignal) => Promise<unknown>;
        inFlightAbort?: (signal: AbortSignal) => Promise<Readonly<{
            operation: Promise<unknown>;
            cleanup?: () => void | Promise<void>;
        }>>;
        ownership?: Readonly<{
            borrowed?: () => Promise<RuntimeControlClientResourceProbe>;
            owned?: () => Promise<RuntimeControlClientResourceProbe>;
        }>;
    }>;
}>;

RuntimeControlClientConformanceReport#

Kind: type

ts
export type RuntimeControlClientConformanceReport = Readonly<{
    valid: boolean;
    modules: readonly (typeof RUNTIME_CONTROL_CLIENT_MODULES)[number][];
    supported: readonly RuntimeControlClientOperation[];
    unavailable: readonly RuntimeControlClientOperation[];
    failures: readonly string[];
}>;

RuntimeControlClientOperation#

Kind: type

ts
export type RuntimeControlClientOperation = keyof typeof RUNTIME_CONTROL_CLIENT_OPERATION_CAPABILITIES;

RuntimeControlClientResourceProbe#

Kind: type

ts
export type RuntimeControlClientResourceProbe = Readonly<{
    dispose: () => void | Promise<void>;
    releases: () => number;
}>;

RuntimeControlDisposableResource#

Kind: type

ts
export type RuntimeControlDisposableResource = Readonly<{
    cleanup: () => void | Promise<void>;
}>;

RuntimeControlScenarioDefinition#

Kind: type

ts
export type RuntimeControlScenarioDefinition = Readonly<{
    id: string;
    capability: string;
    mutation?: boolean;
}>;

RuntimeControlScenarioEnvironment#

Kind: type

ts
export type RuntimeControlScenarioEnvironment = Readonly<{
    createClient: () => RuntimeControlClient | Promise<RuntimeControlClient>;
    mutationMode: "read-only" | "disposable";
    createResourcePrefix: () => string;
}>;

RuntimeControlScenarioExtension#

Kind: type

ts
export type RuntimeControlScenarioExtension = Readonly<{
    createDisposableResources(prefix: string): readonly RuntimeControlDisposableResource[] | Promise<readonly RuntimeControlDisposableResource[]>;
}>;

RuntimeControlScenarioReport#

Kind: type

ts
export type RuntimeControlScenarioReport = Readonly<{
    scenarios: readonly RuntimeControlScenarioResult[];
    failures: readonly string[];
}>;

RuntimeControlScenarioResult#

Kind: type

ts
export type RuntimeControlScenarioResult = Readonly<{
    id: string;
    status: RuntimeControlScenarioStatus;
    capability: string;
    durationMs: number;
    detail?: string;
}>;

RuntimeControlScenarioStatus#

Kind: type

ts
export type RuntimeControlScenarioStatus = "passed" | "unavailable" | "failed" | "skipped";

RuntimeProviderConformanceCheck#

Kind: type

ts
export type RuntimeProviderConformanceCheck = {
    id: string;
    status: "pass" | "fail" | "skip";
    message: string;
};

RuntimeProviderConformanceFixture#

Kind: type

ts
export type RuntimeProviderConformanceFixture = {
    module: RuntimeProviderModule;
    clientOptions: RuntimeClientOptions;
    /**
     * Required when the client exposes `getRun` and/or `cancelRun`.
     * Also pass `omit` explicitly when methods are intentionally absent.
     */
    runLifecycleSemantics?: RuntimeRunLifecycleSemantics;
};

RuntimeProviderConformanceReport#

Kind: type

ts
export type RuntimeProviderConformanceReport = {
    providerKind: string;
    valid: boolean;
    checks: readonly RuntimeProviderConformanceCheck[];
};

RuntimeRunLifecycleSemantics#

Kind: type

ts
/**
 * Declared getRun/cancelRun semantics for conformance fixtures.
 *
 * - `omit` — neither method is present
 * - `server` — real backend get/cancel (methods required)
 * - `sync-store` — SynchronousRunStore degrade (methods required; foreign
 *   getRun must not throw and should return status `"unknown"`)
 * - `unsupported-throw` — methods may be present and throw EndpointNotFound
 */
export type RuntimeRunLifecycleSemantics = "omit" | "server" | "sync-store" | "unsupported-throw";

SseTransportConformanceFixture#

Kind: type

ts
export type SseTransportConformanceFixture = FixtureFor<"sse", SseTransportConformanceObservation>;

SseTransportConformanceObservation#

Kind: type

ts
export type SseTransportConformanceObservation = TransportConformanceSharedObservation & Readonly<{
    kind: "sse";
    connections: readonly SseConnectionObservation[];
    deliveredIds: readonly string[];
}>;

StdioTransportConformanceFixture#

Kind: type

ts
export type StdioTransportConformanceFixture = FixtureFor<"stdio", StdioTransportConformanceObservation>;

StdioTransportConformanceObservation#

Kind: type

ts
export type StdioTransportConformanceObservation = ByteTransportConformanceObservation<"stdio">;

TeamDirectoryConformanceCheck#

Kind: interface

ts
export interface TeamDirectoryConformanceCheck {
    name: string;
    ok: boolean;
    detail?: string;
}

TeamDirectoryConformanceReport#

Kind: interface

ts
export interface TeamDirectoryConformanceReport {
    ok: boolean;
    checks: TeamDirectoryConformanceCheck[];
}

TransportConformanceFixture#

Kind: type

ts
export type TransportConformanceFixture = HttpTransportConformanceFixture | SseTransportConformanceFixture | WebSocketTransportConformanceFixture | JsonRpcTransportConformanceFixture | StdioTransportConformanceFixture | UnixTransportConformanceFixture;

TransportConformanceIssue#

Kind: type

ts
export type TransportConformanceIssue = Readonly<{
    code: "abort_leak" | "unbounded_retry" | "mutation_replayed" | "secret_exposed" | "resource_leak" | "protocol_mismatch";
    message: string;
}>;

TransportConformanceReport#

Kind: type

ts
export type TransportConformanceReport = Readonly<{
    ok: boolean;
    kind: TransportKind;
    issues: readonly TransportConformanceIssue[];
}>;

TransportConformanceSharedObservation#

Kind: type

ts
export type TransportConformanceSharedObservation = Readonly<{
    maxAttempts: number;
    emissionsAfterAbort: number;
    serializedErrors: readonly string[];
    serializedEvents: readonly string[];
    openResources: number;
}>;

TransportKind#

Kind: type

ts
export type TransportKind = "http" | "sse" | "websocket" | "json-rpc" | "stdio" | "unix";

UnixTransportConformanceFixture#

Kind: type

ts
export type UnixTransportConformanceFixture = FixtureFor<"unix", UnixTransportConformanceObservation>;

UnixTransportConformanceObservation#

Kind: type

ts
export type UnixTransportConformanceObservation = ByteTransportConformanceObservation<"unix">;

validateKanbanCard#

Kind: function

ts
/** Return a list of human-readable errors for a card that violates the contract. */
export declare function validateKanbanCard(card: KanbanCard): string[];

validateTeam#

Kind: function

ts
/** Return human-readable errors for a team that violates the canonical shape. */
export declare function validateTeam(team: Team): string[];

WebSocketTransportConformanceFixture#

Kind: type

ts
export type WebSocketTransportConformanceFixture = FixtureFor<"websocket", WebSocketTransportConformanceObservation>;

WebSocketTransportConformanceObservation#

Kind: type

ts
export type WebSocketTransportConformanceObservation = TransportConformanceSharedObservation & Readonly<{
    kind: "websocket";
    lifecycle: readonly WebSocketLifecycleObservation[];
}>;