adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
68 lines (67 loc) • 1.81 kB
TypeScript
/**
* Constants for state key prefixes
*/
export declare class StatePrefix {
static readonly APP_PREFIX = "app:";
static readonly USER_PREFIX = "user:";
static readonly TEMP_PREFIX = "temp:";
}
/**
* A class for managing session state.
* This is a dictionary-like object with methods similar to the Python version.
*/
export declare class State {
[key: string]: any;
/**
* Creates a new state.
*
* @param initialState Initial state values
*/
constructor(initialState?: Record<string, any>);
/**
* Gets a value from the state.
* Similar to Python's dictionary get method.
*
* @param key The key of the value
* @returns The value, or undefined if not found
*/
get(key: string): any;
/**
* Sets a value in the state.
*
* @param key The key of the value
* @param value The value to set
*/
set(key: string, value: any): void;
/**
* Checks if the state has a value for the key.
*
* @param key The key to check
* @returns True if the state has a value for the key, false otherwise
*/
has(key: string): boolean;
/**
* Deletes a value from the state.
*
* @param key The key of the value to delete
* @returns True if the value was deleted, false otherwise
*/
delete(key: string): boolean;
/**
* Gets all the state as a record.
*
* @returns The state as a record
*/
getAll(): Record<string, any>;
/**
* Update state with new key-value pairs.
* Similar to Python's dictionary update method.
*
* @param data The data to update
*/
update(data: Record<string, any>): void;
/**
* Custom implementation for JSON serialization
*/
toJSON(): Record<string, any>;
}