import type { AgentMessage } from "@apholdings/jensen-agent-core"; import type { ImageContent, TextContent } from "@apholdings/jensen-ai"; export interface MemoryItem { key: string; value: string; timestamp: string; } export interface TodoSnapshotItem { id: string; content: string; activeForm: string; status: "pending" | "in_progress" | "completed"; } export interface SessionMemoryState { items: MemoryItem[]; } export declare const SESSION_MEMORY_CUSTOM_TYPE = "session_memory"; export declare const SESSION_TODOS_CUSTOM_TYPE = "session_todos"; export declare const SESSION_TODO_ENGINE_CUSTOM_TYPE = "session_todo_engine"; export declare const SESSION_TASKS_CUSTOM_TYPE = "session_tasks"; export declare const SESSION_RELIABILITY_CUSTOM_TYPE = "session_reliability"; export declare const SESSION_MEMORY_PREFIX = "Session memory recorded during this conversation. Treat it as active working context, but prefer newer user instructions if they conflict.\n\n\n"; export declare const SESSION_MEMORY_SUFFIX = "\n"; export declare function normalizeMemoryKey(key: string): string; export declare function normalizeMemoryValue(value: string): string; export declare function upsertMemoryItems(items: MemoryItem[], key: string, value: string, timestamp: string): MemoryItem[]; export declare function clearMemoryItems(): MemoryItem[]; export declare function deleteMemoryItem(items: MemoryItem[], key: string): MemoryItem[]; export declare function getMemoryItem(items: readonly MemoryItem[], key: string): MemoryItem | undefined; export declare function memoryItemsToText(items: MemoryItem[]): string; export declare function createMemoryContextMessage(items: MemoryItem[]): AgentMessage | undefined; export declare function serializeMemoryItems(items: MemoryItem[]): string | (TextContent | ImageContent)[]; export declare function parseMemoryItems(data: unknown): MemoryItem[]; export declare function parseTodoSnapshot(data: unknown): TodoSnapshotItem[]; /** Generate a stable, unique todo ID. Not a secret, not content-derived. */ export declare function generateTodoId(): string; /** * Snapshot of session memory at a point in time. * History is derived from persisted session entries with customType === "session_memory". * Because persistence is snapshot-based, not event-sourced, each snapshot represents * the complete memory state at that point, not individual add/update/delete events. */ export interface MemoryHistorySnapshot { /** Session entry id for this snapshot */ entryId: string; /** Parent entry id in the session tree (null for root) */ parentId: string | null; /** When this snapshot was recorded (ISO timestamp) */ recordedAt: string; /** Complete memory state at this point in time */ items: MemoryItem[]; /** True if this is the latest snapshot on the current branch */ isCurrent: boolean; } /** Valid task statuses */ export type TaskStatus = "pending" | "in_progress" | "completed"; /** * Structured task for multi-step work tracking. * Separate from todo_write items; tasks have explicit id, subject, and description * for model-visible work tracking across an extended session. */ export interface Task { /** Unique identifier for this task */ id: string; /** Brief title/subject of the task */ subject: string; /** Detailed description of what the task involves */ description: string; /** Current status */ status: TaskStatus; /** Active-form phrasing shown when task is in_progress (e.g., "Implementing feature X") */ activeForm?: string; /** Optional free-form metadata */ metadata?: Record; } /** Input for creating a new task (excludes auto-assigned fields) */ export interface TaskCreateInput { subject: string; description: string; activeForm?: string; metadata?: Record; } /** Input for updating an existing task */ export interface TaskUpdateInput { subject?: string; description?: string; status?: TaskStatus; activeForm?: string; metadata?: Record; } /** * Generate a unique task ID. * Uses a counter to ensure uniqueness within the session. */ export declare function generateTaskId(): string; /** * Parse a raw session entry data blob into an array of Task objects. * Skips malformed entries. */ export declare function parseTasks(data: unknown): Task[]; /** * Format a task list for display. */ export declare function formatTaskList(tasks: Task[]): string; /** * Format a single task for display. */ export declare function formatTaskDetail(task: Task): string; //# sourceMappingURL=memory.d.ts.map