import { AgentProject } from '../agent-project/index.js';
export interface ScriptRunnerCredentials {
    /** Authentication token */
    token: string;
    /** API URL */
    apiUrl: string;
    /** Workspace ID */
    workspaceId?: string;
}
export interface ScriptRunnerOptions {
    /** Path to the agent project root */
    projectPath: string;
    /** Credentials for API access */
    credentials: ScriptRunnerCredentials;
    /** Whether to regenerate the bot project even if it exists */
    forceRegenerate?: boolean;
    /** Use production bot ID instead of dev bot ID (default: false, uses devId) */
    prod?: boolean;
}
export interface RunScriptOptions extends ScriptRunnerOptions {
    /** Path to the script file to run (relative to project or absolute) */
    scriptPath: string;
    /** Additional arguments to pass to the script */
    args?: string[];
    /** Environment variables to set */
    env?: Record<string, string>;
    /** Whether to inherit stdio */
    inheritStdio?: boolean;
}
export interface RunOptions {
    /** Additional arguments to pass to the script */
    args?: string[];
    /** Environment variables to set */
    env?: Record<string, string>;
    /** Whether to inherit stdio */
    inheritStdio?: boolean;
}
export interface TestRuntimeResult {
    /** Path to the bot project */
    botPath: string;
    /** Path to the adk-runtime module that can be imported */
    runtimePath: string;
    /** Bot ID being used */
    botId: string;
    /** Workspace ID */
    workspaceId: string;
    /** Whether using production bot */
    isProd: boolean;
    /** The prepared project instance */
    project: AgentProject;
    /**
     * Import and initialize the ADK runtime in the current process.
     * Call this once before running tests that need the runtime.
     * Returns the bot instance.
     */
    initialize: () => Promise<unknown>;
}
export declare class ScriptRunner {
    private projectPath;
    private forceRegenerate;
    private prod;
    private credentials;
    constructor(options: ScriptRunnerOptions);
    /**
     * Ensure the bot project is generated and ready for script execution
     */
    prepare(): Promise<{
        botPath: string;
        runnerPath: string;
        project: AgentProject;
    }>;
    /**
     * Run bp build to generate .botpress types needed for the script runner
     */
    private runBpBuild;
    /**
     * Generate the script runner entry point that bootstraps the ADK runtime
     */
    private generateScriptRunner;
    /**
     * Setup the ADK runtime for use in tests (bun test)
     *
     * Unlike `run()`, this doesn't spawn a child process. Instead, it:
     * 1. Prepares the bot project (generates types, etc.)
     * 2. Sets up environment variables in the current process
     * 3. Returns paths and an initialize() function to import the runtime
     *
     * Usage in tests:
     * ```typescript
     * import { ScriptRunner } from '@botpress/adk'
     *
     * const runner = new ScriptRunner({ projectPath: '.', credentials: {...} })
     * const runtime = await runner.setupTestRuntime()
     * await runtime.initialize()
     *
     * // Now you can import and use your actions, tools, etc.
     * ```
     */
    setupTestRuntime(options?: {
        env?: Record<string, string>;
    }): Promise<TestRuntimeResult>;
    /**
     * Run a script with the ADK runtime initialized
     */
    run(scriptPath: string, options?: RunOptions): Promise<number>;
}
/**
 * Convenience function to run a script with the ADK runtime
 */
export declare function runScript(options: RunScriptOptions): Promise<number>;
export interface SetupTestRuntimeOptions {
    /**
     * Path to the agent project root.
     * If not provided, auto-detects by walking up from CWD looking for agent.config.ts
     */
    projectPath?: string;
    /**
     * Credentials for API access.
     * If not provided, loads from the current ADK profile (~/.adk/credentials)
     */
    credentials?: ScriptRunnerCredentials;
    /** Whether to regenerate the bot project even if it exists */
    forceRegenerate?: boolean;
    /** Use production bot ID instead of dev bot ID (default: false, uses devId) */
    prod?: boolean;
    /** Additional environment variables to set */
    env?: Record<string, string>;
}
/**
 * Convenience function to setup the ADK runtime for tests.
 *
 * This is designed to be called from test setup (beforeAll, globalSetup, etc.)
 * to prepare the ADK runtime environment without spawning a child process.
 *
 * Features:
 * - Auto-detects project path by walking up from CWD looking for agent.config.ts
 * - Auto-loads credentials from the current ADK profile (~/.adk/credentials)
 * - Both can be overridden via options
 *
 * @example
 * ```typescript
 * // Minimal usage - auto-detects everything
 * import { setupTestRuntime } from '@botpress/adk'
 *
 * beforeAll(async () => {
 *   const runtime = await setupTestRuntime()
 *   await runtime.initialize()
 * })
 *
 * // With explicit options
 * beforeAll(async () => {
 *   const runtime = await setupTestRuntime({
 *     projectPath: '/path/to/agent',
 *     credentials: { token: 'custom-token', apiUrl: 'https://api.botpress.cloud' },
 *     prod: true,
 *   })
 *   await runtime.initialize()
 * })
 * ```
 */
export declare function setupTestRuntime(options?: SetupTestRuntimeOptions): Promise<TestRuntimeResult>;
//# sourceMappingURL=script-runner.d.ts.map