adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
89 lines (88 loc) • 2.16 kB
TypeScript
import { State } from './State';
export interface Part {
text?: string;
data?: Uint8Array;
mimeType?: string;
}
export declare namespace Part {
function fromBytes(data: Uint8Array, mimeType: string): Part;
}
export interface Content {
role: string;
parts: Part[];
}
/**
* Actions that can be triggered by an event
*/
export interface EventActions {
stateDelta?: Record<string, any>;
artifactDelta?: Record<string, any>;
transferToAgent?: string;
escalate?: boolean;
skipSummarization?: boolean;
requestedAuthConfigs?: Record<string, any>;
}
/**
* Represents an event in a session
*/
export interface Event {
id?: string;
invocationId: string;
author: string;
content: Content;
turnComplete?: boolean;
partial?: boolean;
actions?: EventActions;
longRunningToolIds?: Set<string>;
errorCode?: string;
errorMessage?: string;
interrupted?: boolean;
timestamp?: number;
branch?: string;
groundingMetadata?: Record<string, any>;
}
/**
* Represents a session interface (formerly from interfaces.ts)
*/
export interface SessionInterface {
id: string;
appName: string;
userId: string;
state: State;
events: Event[];
}
/**
* Represents a list of sessions
*/
export interface SessionsList {
sessions: SessionInterface[];
}
/**
* Interface for session services
*/
export interface SessionService {
createSession(options: {
appName: string;
userId: string;
sessionId?: string;
state?: Record<string, any>;
}): Promise<SessionInterface> | SessionInterface;
getSession(options: {
appName: string;
userId: string;
sessionId: string;
}): Promise<SessionInterface | null> | SessionInterface | null;
listSessions(options: {
appName: string;
userId: string;
}): Promise<SessionsList> | SessionsList;
deleteSession(options: {
appName: string;
userId: string;
sessionId: string;
}): Promise<void> | void;
appendEvent(options: {
session: SessionInterface;
event: Event;
}): Promise<void> | void;
}