/** * 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; export declare const InitiatorAuthKey: ContextKey; export declare const SessionIdKey: ContextKey; export declare const ContinuationTokenKey: ContextKey; export declare const ChannelInstrumentationKey: ContextKey; export declare const ModeKey: ContextKey; export declare const ParentSessionKey: ContextKey; /** * 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; /** * Optional framework-owned terminal callback metadata for this session. */ export declare const SessionCallbackKey: ContextKey; export declare const SessionKey: ContextKey; export declare const SandboxKey: ContextKey; 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; } /** * Session-scoped dynamic tool metadata (from `session.started`). * Persists for the session lifetime. */ export declare const SessionDynamicToolMetadataKey: ContextKey; /** * Turn-scoped dynamic tool metadata (from `turn.started`). * Replaced each turn. */ export declare const TurnDynamicToolMetadataKey: ContextKey; /** * 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; /** * 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>; /** * Durable session-scoped instruction messages (from `session.started` * resolvers). Keyed by resolver slug. Persists for the session lifetime. */ export declare const SessionDynamicInstructionsKey: ContextKey>; /** * Durable turn-scoped instruction messages (from `turn.started` * resolvers). Keyed by resolver slug. Replaced each turn. */ export declare const TurnDynamicInstructionsKey: ContextKey>;