@openai/agents-core
Version:
The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows.
75 lines (74 loc) • 2.71 kB
TypeScript
import type { Span, Trace } from '../../tracing';
import type { SandboxDirectoryEntry, SandboxSessionLike, SandboxSessionState } from '../session';
import type { Memory } from '../capabilities/memory';
export type PhaseTwoSelectionItem = {
rolloutId: string;
updatedAt: string;
rolloutPath: string;
rolloutSummaryFile: string;
terminalState: string;
};
export type PhaseTwoInputSelection = {
selected: PhaseTwoSelectionItem[];
retainedRolloutIds: Set<string>;
removed: PhaseTwoSelectionItem[];
};
export interface MemoryStore {
read(path: string): Promise<Uint8Array | null>;
write(path: string, data: Uint8Array): Promise<void>;
delete?(path: string): Promise<void>;
list?(prefix: string): Promise<string[]>;
}
export declare class InMemoryMemoryStore implements MemoryStore {
private readonly files;
read(path: string): Promise<Uint8Array | null>;
write(path: string, data: Uint8Array): Promise<void>;
delete(path: string): Promise<void>;
list(prefix: string): Promise<string[]>;
}
export declare class SandboxMemoryStorage {
private readonly session;
private runAs?;
private readonly store?;
private readonly appendQueues;
private tracingParent?;
constructor(args: {
session: SandboxSessionLike<SandboxSessionState>;
runAs?: string;
store?: MemoryStore;
tracingParent?: Span<any> | Trace;
});
updateRuntimeContext(args: {
runAs?: string;
tracingParent?: Span<any> | Trace;
}): void;
ensureLayout(memory: Memory): Promise<void>;
appendJsonl(path: string, payload: unknown): Promise<void>;
readText(path: string): Promise<string | null>;
private readFullText;
private runQueuedAppend;
writeText(path: string, content: string): Promise<void>;
listDir(path: string): Promise<SandboxDirectoryEntry[]>;
hydrateFromStore(prefix: string): Promise<void>;
private listStoreDirectory;
buildPhaseTwoInputSelection(args: {
memoriesDir: string;
maxRawMemoriesForConsolidation: number;
}): Promise<PhaseTwoInputSelection>;
rebuildRawMemories(args: {
memoriesDir: string;
selectedItems: PhaseTwoSelectionItem[];
}): Promise<boolean>;
writePhaseTwoSelection(args: {
memoriesDir: string;
selectedItems: PhaseTwoSelectionItem[];
}): Promise<void>;
private ensureDir;
private ensureFile;
private readTextWithShell;
private appendJsonlWithShell;
private appendJsonlToStore;
private readPhaseTwoSelection;
private listCurrentSelectionItems;
}
export declare function joinRelativePaths(left: string, right: string, ...rest: string[]): string;