UNPKG

eve

Version:

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

47 lines (46 loc) 2.03 kB
import { type HarnessEmissionState } from "#harness/emission.js"; import type { HarnessModelMessage } from "#harness/messages.js"; import type { HarnessSession, StepResult, ToolLoopHarnessConfig } from "#harness/types.js"; interface SessionLimitPolicyInput { readonly config: ToolLoopHarnessConfig; readonly emit?: ToolLoopHarnessConfig["handleEvent"]; readonly emissionState: HarnessEmissionState; readonly session: HarnessSession; } /** * Acts on a resolved session-limit continuation answer. * * Granted: bumps the runtime token limits via * {@link bumpSessionRuntimeUsageLimits} and lets the step continue * transparently. * Declined: a user decision, not an error — the decline cancels the * in-flight turn tree through the standard cancellation path, settling as * `turn.cancelled` → `session.waiting` with no failure surfaced anywhere. * The harness only declares the intent by throwing * {@link SessionLimitDeclinedError}; the execution layer detects it at the * step boundary and cancels the root turn, whose cancelled arm cascades to * every descendant, so the delegating parent never receives an error result * it could retry against a fresh budget share. * * Returns `result: null` when the step should continue with `session`. */ export declare function applySessionLimitContinuation(input: SessionLimitPolicyInput & { readonly limitContinuation: { readonly granted: boolean; } | undefined; }): Promise<{ readonly result: StepResult | null; readonly session: HarnessSession; }>; /** * Pre-model-call gate for the session token budget. * * Returns `null` when the session is within budget. Over budget, sessions * that can reach a human park on the deterministic continuation prompt; * task-mode sessions without HITL fail fast with * `SESSION_TOKEN_LIMIT_REACHED`. */ export declare function enforceSessionUsageLimit(input: SessionLimitPolicyInput & { readonly messages: readonly HarnessModelMessage[]; }): Promise<StepResult | null>; export {};