import * as _playwright_test from '@playwright/test';
export { expect } from '@playwright/test';
import { VariableStore } from './VariableStore.js';
import { WebAgent } from './agent/webAgent.js';

/**
 * Per-test auth: path to a login script + optional args passed to the login function.
 * The auth path is resolved relative to process.cwd() (the project root where `playwright test` runs).
 * The login module must export a login(args) function that spawns its own browser,
 * performs the login flow, caches the storageState, and returns the file path.
 *
 * Usage in playwright.config.ts:
 *   use: {
 *     auth: './auth.login.ts',
 *     args: { username: 'admin@example.com', password: '{{ADMIN_PASSWORD}}' },
 *   }
 */
interface AuthSpec {
    auth: string;
    args?: Record<string, unknown>;
}
/**
 * Calls the auth module's login(args) function.
 * The login function is responsible for spawning its own browser/context,
 * performing the login flow, caching/expiring storageState, and returning
 * the path to a storageState JSON file.
 *
 * The module is cached by Node's module system after the first import,
 * so multiple tests sharing the same auth path reuse the same instance.
 */
declare function resolveAuthState(spec: AuthSpec): Promise<string>;
/**
 * TestContext — Proxy-backed object for reading/writing runtime variables.
 * Supports property-style access: testContext.myVar = 'value' / const v = testContext.myVar
 * Shared with the agent's VariableStore so $variableName in YAML resolves the same values.
 */
interface TestContext {
    /** @internal Shared VariableStore instance — used by the agent fixture */
    readonly __variableStore: VariableStore;
    get(key: string): any;
    set(key: string, value: any, sensitive?: boolean): void;
    getAll(): Record<string, any>;
    [key: string]: any;
}
declare function createTestContext(variableStore: VariableStore): TestContext;
/**
 * Explicit allowlist of environment variable names that Shiplight forwards
 * into sdk-core's internal `SdkConfig.env`. sdk-core is strict — it reads
 * env vars only from `SdkConfig.env`, never from `process.env` directly —
 * so this allowlist is the single point where user-visible env state
 * crosses into the agent runtime.
 *
 * Source is `.env`, not `process.env`. Reads go through
 * `getShiplightEnv()` (see `dotenvSource.ts`) so that a stale shell-level
 * `OPENAI_API_KEY` (or any other provider key) cannot silently override
 * the user's `.env` and bypass the Shiplight LLM proxy. CI runners that
 * inject secrets via env vars instead of a `.env` file are still supported
 * via the fallback in `getShiplightEnv()`.
 *
 * To add a new env var that sdk-core should honor, append it here AND make
 * sure a corresponding consumer exists in `packages/sdk-core/src`. Do NOT
 * spread `process.env` into this object — the allowlist exists so that user
 * test code cannot exfiltrate arbitrary shell state through the SDK.
 *
 * **Not on this list: `WEB_AGENT_MODEL` / `COMPUTER_USE_MODEL`.** Those are
 * read by `resolveWebAgentModelFromEnv` / `resolveComputerUseModelFromEnv`
 * from `shiplight-types`, called with `getShiplightEnv()` in the agent
 * fixture below. The resolved model string is passed as a constructor
 * parameter to `createAgentContext`, not through `SdkConfig.env`. They do
 * not need to be on the allowlist.
 *
 * Keep in sync with the "Environment variables" section of the public
 * documentation at `docs.shiplight.ai/local/cli-reference`.
 */
declare const SDK_ENV_ALLOWLIST: readonly ["GOOGLE_API_KEY", "ANTHROPIC_API_KEY", "OPENAI_API_KEY", "OPENAI_BASE_URL", "ANTHROPIC_MODELS_USE_VERTEXAI", "GOOGLE_GENAI_USE_VERTEXAI", "GOOGLE_CLOUD_PROJECT", "GOOGLE_CLOUD_LOCATION", "MAILGUN_API_KEY", "MAILGUN_DOMAIN", "SHIPLIGHT_API_TOKEN", "SHIPLIGHT_API_URL"];
/**
 * Pick the allowlisted env vars out of a source record (defaults to the
 * Shiplight `.env` stash via `getShiplightEnv()`) and return them as a
 * plain object with empty-string fallbacks. The empty-string default is
 * deliberate — sdk-core checks `config.env?.KEY` for truthiness, and an
 * empty string is falsy, so an unset allowlisted key behaves the same as
 * an entirely missing key.
 */
declare function buildSdkEnv(source?: Record<string, string | undefined>): Record<string, string>;
type ShiplightFixtures = {
    agent: WebAgent;
    testContext: TestContext;
    $: TestContext;
    ctx: TestContext;
    account: AuthSpec | undefined;
    extensionDir: string | undefined;
    userDataDir: string | undefined;
    extensionStorageState: string | undefined;
    autoDismissModal: boolean;
};
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & ShiplightFixtures, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;

export { type AuthSpec, SDK_ENV_ALLOWLIST, type TestContext, buildSdkEnv, createTestContext, resolveAuthState, test };
