import type { CodeInterpreterConfig, StartSessionParams, SessionInfo, ExecuteCodeParams, ExecuteCommandParams, ReadFilesParams, WriteFilesParams, ListFilesParams, RemoveFilesParams, GetSessionParams, GetSessionResponse, ListSessionsParams, ListSessionsResponse } from './types.js'; /** * Client for AWS Bedrock Code Interpreter. * * Provides functionality to execute Python, JavaScript, and TypeScript code * in isolated sandbox environments with file system access and shell commands. * * Each CodeInterpreter instance manages a single session. Sessions are automatically * created on first use and can be explicitly managed with startSession/stopSession. * * @example * ```typescript * const interpreter = new CodeInterpreter({ region: 'us-east-1' }) * * // Execute code (auto-creates session) * await interpreter.executeCode({ code: 'print("Hello")' }) * * // Explicitly manage session lifecycle * await interpreter.startSession({ sessionName: 'my-session' }) * await interpreter.executeCode({ code: 'x = 1' }) * await interpreter.stopSession() * ``` */ export declare class CodeInterpreter { readonly region: string; readonly identifier: string; private _client; private _session; private _credentialsProvider; /** * Creates a new CodeInterpreter instance. * * @param config - Configuration options */ constructor(config: CodeInterpreterConfig); /** * Start a new code interpreter session. * * @param params - Session configuration * @returns Session information including AWS-assigned session ID * * @example * ```typescript * const session = await interpreter.startSession({ * sessionName: 'data-analysis', * description: 'Processing customer data', * timeout: 1800 * }) * ``` */ startSession(params?: StartSessionParams): Promise; /** * Stop the active code interpreter session. * Gracefully handles non-existent sessions without throwing errors. * * @example * ```typescript * await interpreter.stopSession() * ``` */ stopSession(): Promise; /** * Get detailed information about a code interpreter session. * * @param params - Optional parameters specifying which session to query * @returns Detailed session information * * @example * ```typescript * // Get current active session details * const sessionInfo = await interpreter.getSession() * console.log(`Session status: ${sessionInfo.status}`) * * // Get details for a specific session * const sessionInfo = await interpreter.getSession({ * sessionId: 'specific-session-id' * }) * ``` */ getSession(params?: GetSessionParams): Promise; /** * List code interpreter sessions for this interpreter. * * @param params - Optional filtering and pagination parameters * @returns List of session summaries with optional pagination token * * @example * ```typescript * // List all active sessions * const response = await interpreter.listSessions({ status: 'READY' }) * for (const session of response.items) { * console.log(`Session ${session.sessionId}: ${session.status}`) * } * * // Paginate through results * let response = await interpreter.listSessions({ maxResults: 10 }) * while (response.nextToken) { * response = await interpreter.listSessions({ * maxResults: 10, * nextToken: response.nextToken * }) * } * ``` */ listSessions(params?: ListSessionsParams): Promise; /** * Execute code in a code interpreter session. * Automatically creates a session if one doesn't exist. * * @param params - Execution parameters * @returns Execution result with output or error * * @example * ```typescript * // Auto-creates default session * const result = await interpreter.executeCode({ * code: 'print("Hello")', * language: 'python' * }) * ``` */ executeCode(params: ExecuteCodeParams): Promise; /** * Execute a shell command in a code interpreter session. * Automatically creates a session if one doesn't exist. * * @param params - Command parameters * @returns Command result with output or error * * @example * ```typescript * const result = await interpreter.executeCommand({ * command: 'ls -la' * }) * ``` */ executeCommand(params: ExecuteCommandParams): Promise; /** * Read files from the code interpreter sandbox. * Automatically creates a session if one doesn't exist. * * @param params - Read parameters * @returns Read result with file contents or errors * * @example * ```typescript * const result = await interpreter.readFiles({ * paths: ['data.txt', 'output.json'] * }) * ``` */ readFiles(params: ReadFilesParams): Promise; /** * Write files to the code interpreter sandbox. * Automatically creates a session if one doesn't exist. * * @param params - Write parameters * @returns Write result with written file paths or errors * * @example * ```typescript * await interpreter.writeFiles({ * files: [ * { path: 'script.py', content: 'print("Hello")' }, * { path: 'data.json', content: '{"key": "value"}' } * ] * }) * ``` */ writeFiles(params: WriteFilesParams): Promise; /** * List files in the code interpreter sandbox. * Automatically creates a session if one doesn't exist. * * @param params - List parameters * @returns List result with file information or error * * @example * ```typescript * const result = await interpreter.listFiles({ path: '/tmp' }) * ``` */ listFiles(params?: ListFilesParams): Promise; /** * Remove files from the code interpreter sandbox. * Automatically creates a session if one doesn't exist. * * @param params - Remove parameters * @returns Remove result with removed file paths or errors * * @example * ```typescript * await interpreter.removeFiles({ * paths: ['temp.txt', 'cache.json'] * }) * ``` */ removeFiles(params: RemoveFilesParams): Promise; /** * Extract and parse the streaming response from InvokeCodeInterpreterCommand. * Returns the raw content string from AWS without additional formatting. */ private _parseInvokeResponse; /** * Extract text from AWS content array, handling multiple content types: * - type: "text" - Direct text output (code execution, commands) * - type: "resource" - File content with nested resource object * - type: "resource_link" - File metadata (listFiles) */ private _extractFromContentArray; private _extractContentItem; private _extractResourceContent; } //# sourceMappingURL=client.d.ts.map