eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
106 lines (105 loc) • 4.66 kB
TypeScript
/**
* Leaf context keys — no codec, no runtime imports. Safe to import from any
* tier. Codec-carrying keys (`ChannelKey`, `BundleKey`) live in
* `#runtime/sessions/runtime-context-keys.ts`.
*/
import type { SystemModelMessage } from "ai";
import type { JsonObject } from "#shared/json.js";
import type { ChannelInstrumentationProjection, SessionAuthContext, SessionCallback, SessionCapabilities, SessionParent, SessionTurn } from "#channel/types.js";
import { ContextKey } from "#context/key.js";
import type { SandboxAccess } from "#sandbox/state.js";
import type { RunMode } from "#shared/run-mode.js";
export type { SessionAuthContext, SessionParent, SessionTurn } from "#channel/types.js";
/**
* Auth metadata on the active session.
*
* `current` is the caller of the most recent request.
* `initiator` is the caller who originally created the session.
*/
export interface SessionAuth {
readonly current: SessionAuthContext | null;
readonly initiator: SessionAuthContext | null;
}
/**
* Internal session metadata seeded into the context container under
* {@link SessionKey}.
*
* This is not the shape authored code observes. Tools, hooks, and channel
* events receive the `SessionContext.session` projection (via `ctx.session`),
* whose session id is exposed as `id`, not `sessionId`.
*/
export interface Session {
readonly auth: SessionAuth;
readonly parent?: SessionParent;
readonly sessionId: string;
readonly turn: SessionTurn;
}
export declare const AuthKey: ContextKey<SessionAuthContext | null>;
export declare const InitiatorAuthKey: ContextKey<SessionAuthContext | null>;
export declare const SessionIdKey: ContextKey<string>;
export declare const ContinuationTokenKey: ContextKey<string>;
export declare const ChannelInstrumentationKey: ContextKey<ChannelInstrumentationProjection>;
export declare const ModeKey: ContextKey<RunMode>;
export declare const ParentSessionKey: ContextKey<SessionParent>;
/**
* Session-level capability flags (see {@link SessionCapabilities}). Set
* on root runs by channel routes and inherited pointwise by subagent
* dispatch so HITL readiness flows through a conversation chain.
*/
export declare const CapabilitiesKey: ContextKey<SessionCapabilities>;
/**
* Optional framework-owned terminal callback metadata for this session.
*/
export declare const SessionCallbackKey: ContextKey<SessionCallback>;
export declare const SessionKey: ContextKey<Session>;
export declare const SandboxKey: ContextKey<SandboxAccess>;
export interface DurableDynamicToolMetadata {
readonly name: string;
readonly description: string;
readonly inputSchema: JsonObject;
readonly outputSchema?: JsonObject;
readonly resolverSlug: string;
readonly entryKey: string;
readonly executeStepFnName?: string;
readonly closureVars?: Record<string, unknown>;
}
/**
* Session-scoped dynamic tool metadata (from `session.started`).
* Persists for the session lifetime.
*/
export declare const SessionDynamicToolMetadataKey: ContextKey<readonly DurableDynamicToolMetadata[]>;
/**
* Turn-scoped dynamic tool metadata (from `turn.started`).
* Replaced each turn.
*/
export declare const TurnDynamicToolMetadataKey: ContextKey<readonly DurableDynamicToolMetadata[]>;
/**
* Virtual (non-serialized) live step-scoped tool definitions from
* `step.started` resolvers. Carries original execute closures so
* framework tools (which lack bundler step-function metadata) work.
* Re-resolved every step — no cross-step persistence needed.
*/
export declare const LiveStepToolsKey: ContextKey<import("#harness/execute-tool.js").HarnessToolDefinition[]>;
/**
* Durable metadata for one session-scoped dynamic skill.
*/
export interface DurableDynamicSkillMetadata {
readonly name: string;
readonly description: string;
}
/**
* Durable map from resolver slug to the qualified skills it last produced.
* Used to diff on re-resolution, clean up removed skills from the sandbox,
* and rebuild the model-visible announcement across turns.
*/
export declare const DynamicSkillManifestKey: ContextKey<Record<string, readonly DurableDynamicSkillMetadata[]>>;
/**
* Durable session-scoped instruction messages (from `session.started`
* resolvers). Keyed by resolver slug. Persists for the session lifetime.
*/
export declare const SessionDynamicInstructionsKey: ContextKey<Record<string, readonly SystemModelMessage[]>>;
/**
* Durable turn-scoped instruction messages (from `turn.started`
* resolvers). Keyed by resolver slug. Replaced each turn.
*/
export declare const TurnDynamicInstructionsKey: ContextKey<Record<string, readonly SystemModelMessage[]>>;