eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
60 lines (59 loc) • 4.35 kB
TypeScript
import type { SessionTraceContext } from "#channel/types.js";
import type { ContextAccessor } from "#context/key.js";
import type { AgentActionTraceState, AgentInvocationTraceState, AgentSessionTraceState, AgentTraceStateStore, AgentTurnTraceState } from "#tracing/agent-trace-state.js";
import type { SessionStateMap } from "#harness/types.js";
import type { InstrumentationDecision } from "#shared/instrumentation-decision.js";
/** Run after task-provider commits, so a returned background receipt keeps its anchor. */
export declare function pruneAgentTraceState(context: ContextAccessor, sessionId: string, sessionState: SessionStateMap | undefined): void;
/** Reads the decision already bound to a session in the current worker context. */
export declare function readCurrentSessionTraceDecision(sessionId: string): InstrumentationDecision | undefined;
export declare function readSessionTraceDecision(context: ContextAccessor, sessionId: string): InstrumentationDecision | undefined;
/** Keeps only framework trace state from an interrupted step's context changes. */
export declare function preserveSerializedAgentTraceState(original: Record<string, unknown>, interrupted: Record<string, unknown>): Record<string, unknown>;
/** Reads the active turn context straight out of a serialized Workflow context. */
export declare function readTurnTraceContext(serializedContext: Readonly<Record<string, unknown>>, sessionId: string, turnId: string): SessionTraceContext | undefined;
/** Reads the durable action span that should parent a dispatched child agent. */
export declare function readActionTraceContext(serializedContext: Readonly<Record<string, unknown>>, sessionId: string, turnId: string, callId: string): SessionTraceContext | undefined;
/** Task IDs already bind the originating call and turn, including after that turn ends. */
export declare function readTaskActionTrace(serializedContext: Readonly<Record<string, unknown>>, sessionId: string, taskId: string): AgentActionTraceState | undefined;
export declare function recordNestedAgentInvocation(input: {
readonly callId: string;
readonly kind: "remote-agent-call" | "subagent-call";
readonly name: string;
readonly outerCallId: string;
readonly recordOutputs?: boolean;
readonly serializedContext: Record<string, unknown>;
readonly sessionId: string;
readonly spanId: string;
readonly startTimeMs: number;
readonly turnId: string;
}): Record<string, unknown>;
export declare function recordActionInvocationKind(input: {
readonly callId: string;
readonly kind: "remote-agent-call" | "subagent-call";
readonly serializedContext: Record<string, unknown>;
readonly sessionId: string;
readonly turnId: string;
}): Record<string, unknown>;
/** Durable trace state backed by eve's serialized Workflow context. */
export declare class ContextAgentTraceStateStore implements AgentTraceStateStore {
deleteAction(idempotencyKey: string): void;
deleteActionAnchors(sessionId: string): void;
deleteActions(sessionId: string, turnId?: string): void;
deleteInvocation(idempotencyKey: string): void;
deleteInvocations(sessionId: string, turnId?: string): void;
deleteSession(sessionId: string): void;
deleteTurn(sessionId: string, turnId: string): void;
findAction(sessionId: string, callId: string): AgentActionTraceState | undefined;
findActionAnchor(sessionId: string, turnId: string, callId: string): AgentActionTraceState | undefined;
findInvocations(sessionId?: string, turnId?: string, parentActionCallId?: string): readonly AgentInvocationTraceState[];
getAction(idempotencyKey: string): AgentActionTraceState | undefined;
getSession(sessionId: string): AgentSessionTraceState | undefined;
getTurn(sessionId: string, turnId: string): AgentTurnTraceState | undefined;
setAction(idempotencyKey: string, value: AgentActionTraceState): void;
setActionAnchor(idempotencyKey: string, value: AgentActionTraceState): void;
setInvocation(idempotencyKey: string, value: AgentInvocationTraceState): void;
setSession(sessionId: string, value: AgentSessionTraceState): void;
setTurn(sessionId: string, turnId: string, value: AgentTurnTraceState): void;
updateTurn(sessionId: string, turnId: string, update: (state: AgentTurnTraceState) => AgentTurnTraceState): void;
}