adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
100 lines (99 loc) • 3.42 kB
TypeScript
/**
* The persistent context used to configure the code executor.
*/
import { State } from "../sessions/state";
import { File } from "./codeExecutionUtils";
/**
* The persistent context used to configure the code executor.
*/
export declare class CodeExecutorContext {
private context;
private sessionState;
/**
* Initializes the code executor context.
*
* @param sessionState - The session state to get the code executor context from.
*/
constructor(sessionState: State);
/**
* Gets the state delta to update in the persistent session state.
*
* @returns The state delta to update in the persistent session state.
*/
getStateDelta(): Record<string, any>;
/**
* Gets the session ID for the code executor.
*
* @returns The session ID for the code executor context.
*/
getExecutionId(): string | undefined;
/**
* Sets the session ID for the code executor.
*
* @param sessionId - The session ID for the code executor.
*/
setExecutionId(sessionId: string): void;
/**
* Gets the processed file names from the session state.
*
* @returns A list of processed file names in the code executor context.
*/
getProcessedFileNames(): string[];
/**
* Adds the processed file name to the session state.
*
* @param fileNames - The processed file names to add to the session state.
*/
addProcessedFileNames(fileNames: string[]): void;
/**
* Gets the code executor input file names from the session state.
*
* @returns A list of input files in the code executor context.
*/
getInputFiles(): File[];
/**
* Adds the input files to the code executor context.
*
* @param inputFiles - The input files to add to the code executor context.
*/
addInputFiles(inputFiles: File[]): void;
/**
* Removes the input files and processed file names to the code executor context.
*/
clearInputFiles(): void;
/**
* Gets the error count from the session state.
*
* @param invocationId - The invocation ID to get the error count for.
* @returns The error count for the given invocation ID.
*/
getErrorCount(invocationId: string): number;
/**
* Increments the error count from the session state.
*
* @param invocationId - The invocation ID to increment the error count for.
*/
incrementErrorCount(invocationId: string): void;
/**
* Resets the error count from the session state.
*
* @param invocationId - The invocation ID to reset the error count for.
*/
resetErrorCount(invocationId: string): void;
/**
* Updates the code execution result.
*
* @param invocationId - The invocation ID to update the code execution result for.
* @param code - The code to execute.
* @param resultStdout - The standard output of the code execution.
* @param resultStderr - The standard error of the code execution.
*/
updateCodeExecutionResult(invocationId: string, code: string, resultStdout: string, resultStderr: string): void;
/**
* Gets the code executor context from the session state.
*
* @param sessionState - The session state to get the code executor context from.
* @returns A dict of code executor context.
*/
private getCodeExecutorContext;
}