UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

89 lines (88 loc) 3.47 kB
import type { DurableSession } from "#execution/durable-session-store.js"; import type { HarnessSession } from "#harness/types.js"; import type { RuntimeTurnAgent } from "#runtime/agent/bootstrap.js"; export declare const DEFAULT_ROOT_MAX_INPUT_TOKENS_PER_SESSION = 40000000; /** * Authored session token limits before resolution. `false` means the author * explicitly uncapped the axis (skipping the root default). Resolution maps * this shape onto the numeric {@link SessionLimits} the harness checks. */ export interface AuthoredSessionLimits { readonly maxInputTokensPerSession?: number | false; readonly maxOutputTokensPerSession?: number | false; } /** * Creates the durable compaction configuration used by one harness session. */ export declare function createCompactionConfig(input?: { readonly contextWindowTokens?: number; readonly lastKnownInputTokens?: number; readonly lastKnownPromptMessageCount?: number; readonly thresholdPercent?: number; }): { recentWindowSize: number; threshold: number; } | { recentWindowSize: number; threshold: number; lastKnownInputTokens: number; lastKnownPromptMessageCount: number | undefined; }; export interface CreateSessionInput { readonly continuationToken: string; readonly compactionOverrides?: { readonly thresholdPercent?: number; }; /** * Optional root session id passed in by the runtime when this * session is a delegated subagent child. `undefined` for top-level * sessions — `sessionId` is the root for those. */ readonly rootSessionId?: string; readonly sessionId: string; readonly turnAgent: RuntimeTurnAgent; readonly limits?: AuthoredSessionLimits; readonly outputSchema?: HarnessSession["outputSchema"]; readonly subagentDepth?: number; readonly workflowMaxSubagents?: number; } /** Creates a fresh {@link HarnessSession} from the current `turnAgent`. */ export declare function createSession(input: CreateSessionInput): HarnessSession; /** * Refreshes a session with the latest `turnAgent` — replaces the system * prompt, model/tool metadata, and compaction thresholds while preserving * conversation history and state. */ export declare function refreshSessionFromTurnAgent(input: { readonly session: HarnessSession; readonly turnAgent: RuntimeTurnAgent; readonly compactionOverrides?: { readonly thresholdPercent?: number; }; }): HarnessSession; /** * Mints a continuation token for a delegated subagent session. * Deterministic when `suffix` is provided so retries address the same * child hook. */ export declare function mintSubagentContinuationToken(suffix?: string): string; /** * Projects a {@link HarnessSession} to {@link DurableSession}. * * Drops fields rebuilt every turn from `bundle.turnAgent`; keeps * `agent.system` and `compaction.lastKnown*` so compaction stays * informed after rehydration. */ export declare function projectToDurableSession(session: HarnessSession): DurableSession; /** * Rehydrates a {@link HarnessSession} from a {@link DurableSession} * plus the current `turnAgent`, rebuilding the runtime-only agent and * compaction fields the durable shape omits. */ export declare function hydrateDurableSession(input: { readonly durable: DurableSession; readonly turnAgent: RuntimeTurnAgent; readonly compactionOverrides?: { readonly thresholdPercent?: number; }; }): HarnessSession;