/**
 * 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 { LanguageModel, ModelMessage, SystemModelMessage } from "ai";
import type { ActivityObserverConfig, ChannelDeliveryMetadata, ChannelInstrumentationProjection, SessionAuthContext, SessionCallback, SessionCapabilities, SessionParent, SessionTraceContext, SessionTurn, TaskDeliveryPolicy } from "#channel/types.js";
import { ContextKey } from "#context/key.js";
import { type SessionInboxAddress } from "#execution/session-inbox/address.js";
import type { InstrumentationChannelDeliveryRef } from "#instrumentation/lifecycle.js";
import type { UserModelMessage } from "#harness/messages.js";
import type { HandleEventFn } from "#harness/types.js";
import type { PersistedDynamicToolMetadata } from "#context/dynamic-tool-metadata.js";
import type { DynamicSubagentAgentConfig } from "#runtime/subagents/dynamic-agent-config.js";
import type { DynamicRemoteAgentConfig } from "#runtime/subagents/dynamic-remote-agent-config.js";
import type { SandboxAccess } from "#sandbox/state.js";
import type { RunMode } from "#shared/run-mode.js";
import type { HistoryViewProjector } from "#shared/history-view.js";
import type { RuntimeModelReference } from "#runtime/agent/bootstrap.js";
import type { PreparedRuntimeDelegationTool } from "#runtime/sessions/turn.js";
import type { MemoryScope, MemoryTurnContext } from "#public/memory/index.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 ConversationIdKey: ContextKey<string>;
export declare const SessionInboxKey: ContextKey<SessionInboxAddress>;
export declare const ContinuationTokenKey: ContextKey<string>;
/** Every channel continuation address requested for this session, in claim order. */
export declare const ContinuationHookTokensKey: ContextKey<readonly string[]>;
export declare const ChannelRequestIdKey: ContextKey<string>;
/**
 * Dev-host-verified originating-client metadata, valid only for the current
 * host secret. It carries the inherited dev-TUI hint, not editing authority.
 */
export interface LocalDevRequestProvenance {
    readonly address: string;
    readonly interactiveClient: boolean;
    readonly signature: string;
}
export declare const LocalDevRequestKey: ContextKey<LocalDevRequestProvenance>;
/** Authored schedule whose dispatch created this session. */
export declare const ScheduleIdKey: ContextKey<string>;
/** Display title derived from the session's initial input. */
export declare const SessionTitleKey: ContextKey<string>;
export declare const ChannelDeliveryKey: ContextKey<ChannelDeliveryMetadata>;
/** Accepted messages whose response owns the current turn's durable stream events. */
export declare const TurnDeliveryIdsKey: ContextKey<readonly string[]>;
/** Resolved task delivery policy, also read by the workflow inbox. */
export declare const TaskDeliveryPolicyKey: ContextKey<TaskDeliveryPolicy>;
/** Task-reporting phase for the active root turn. */
export declare const TurnTaskDeliveryKey: ContextKey<"initiating" | "none" | "pending" | "settled">;
/** Last framework announcements recorded in the retained session history. */
export interface HistoryState {
    readonly availableSkills?: string;
    readonly taskState?: string;
    readonly deliveryInstruction?: string;
}
export declare const HistoryStateKey: ContextKey<HistoryState>;
export interface ActiveChannelDelivery {
    readonly agentName?: string;
    readonly channelType?: string;
    readonly delivery: InstrumentationChannelDeliveryRef;
    readonly policyAgentName?: string;
    readonly rootSessionId: string;
    readonly sequence: number;
    readonly sessionId: string;
    readonly turnId: string;
}
export declare const ActiveChannelDeliveriesKey: ContextKey<readonly ActiveChannelDelivery[]>;
export declare const ChannelInstrumentationKey: ContextKey<ChannelInstrumentationProjection>;
/** Trace ceiling and immutable origin accepted from a trusted forwarding deployment. */
export declare const ModeKey: ContextKey<RunMode>;
export declare const ParentSessionKey: ContextKey<SessionParent>;
/** Separate from {@link ParentSessionKey} so it stays out of what extensions read. */
export declare const ParentTraceContextKey: ContextKey<SessionTraceContext>;
export type SessionTraceSeed = SessionTraceContext;
export declare const SessionTraceSeedKey: ContextKey<SessionTraceContext>;
export declare const OtelTraceEnabledKey: ContextKey<boolean>;
/**
 * 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>;
export declare const ActivityObserverKey: ContextKey<ActivityObserverConfig>;
/** Originating root turn that owns the current user-visible activity artifact. */
export declare const ActivityRootTurnIdKey: ContextKey<string>;
/** Pending HITL request identities that keep the current activity artifact open. */
export declare const ActivityPendingBlockersKey: ContextKey<readonly string[]>;
/**
 * Optional framework-owned caller callback captured when the session is created.
 */
export declare const SessionCallbackKey: ContextKey<SessionCallback>;
export declare const SessionKey: ContextKey<Session>;
export declare const SandboxKey: ContextKey<SandboxAccess>;
export declare const HandleEventKey: ContextKey<HandleEventFn>;
/** Static model configured for the effective turn agent, or `null` for a dynamic-only agent. */
export declare const StaticModelReferenceKey: ContextKey<Readonly<import("../shared/agent-definition.ts").InternalAgentModelDefinition & {
    reasoning?: import("../index.ts").AgentReasoningDefinition;
}> | null>;
/** Session-scoped dynamic model selection (from `session.started`). */
export declare const SessionDynamicModelReferenceKey: ContextKey<Readonly<import("../shared/agent-definition.ts").InternalAgentModelDefinition & {
    reasoning?: import("../index.ts").AgentReasoningDefinition;
}> | null>;
/** Turn-scoped dynamic model selection (from `turn.started`). */
export declare const TurnDynamicModelReferenceKey: ContextKey<Readonly<import("../shared/agent-definition.ts").InternalAgentModelDefinition & {
    reasoning?: import("../index.ts").AgentReasoningDefinition;
}> | null>;
export interface CachedModelMetadata {
    readonly contextWindowTokens: number;
    readonly expiresAt: number;
    readonly maxOutputTokens?: number;
    readonly resolvedModelId: string;
}
/** Successful runtime catalog selections cached in durable workflow state. */
export declare const RuntimeModelMetadataCacheKey: ContextKey<Readonly<Record<string, CachedModelMetadata>>>;
export interface LiveDynamicModelSelection {
    /** Live provider instance; absent for string selections, which resolve through the reference. */
    readonly model?: LanguageModel;
    readonly reference: RuntimeModelReference;
}
/** Virtual step-scoped dynamic model selection (from `step.started`); never serialized. */
export declare const LiveStepDynamicModelSelectionKey: ContextKey<LiveDynamicModelSelection | null>;
/**
 * Session-scoped dynamic tool metadata (from `session.started`).
 * Persists for the session lifetime.
 */
export declare const SessionDynamicToolMetadataKey: ContextKey<readonly PersistedDynamicToolMetadata[]>;
/**
 * Runtime revision that last resolved session-scoped dynamic tools.
 * Used to refresh their durable metadata after a deploy or development rebuild.
 */
export declare const SessionDynamicToolRuntimeRevisionKey: ContextKey<string>;
/**
 * Turn-scoped dynamic tool metadata (from `turn.started`).
 * Replaced each turn.
 */
export declare const TurnDynamicToolMetadataKey: ContextKey<readonly PersistedDynamicToolMetadata[]>;
export interface LockedMemorySlot {
    readonly scope: MemoryScope;
    readonly slot: string;
    readonly turn: MemoryTurnContext;
    readonly visibility: "scope" | "session";
}
export declare const TurnMemoryLocksKey: ContextKey<Readonly<Record<string, LockedMemorySlot>>>;
export interface PreparedMemoryPreamble {
    readonly projector?: HistoryViewProjector;
    readonly history: readonly ModelMessage[];
    readonly input: readonly ModelMessage[];
    readonly state?: Readonly<Record<string, unknown>>;
}
export interface PendingMemoryCommit {
    readonly history: readonly ModelMessage[];
    readonly projectedMessages: readonly ModelMessage[];
    readonly state: Readonly<Record<string, unknown>>;
}
export declare const PreparedMemoryPreambleKey: ContextKey<PreparedMemoryPreamble>;
export declare const PendingMemoryCommitKey: ContextKey<PendingMemoryCommit>;
export interface PreparedMemoryCompaction {
    readonly history: readonly ModelMessage[];
    readonly state?: Readonly<Record<string, unknown>>;
}
export declare const PreparedMemoryCompactionKey: ContextKey<PreparedMemoryCompaction>;
/** Step-scoped dynamic tool metadata, replaced before each model step. */
export declare const StepDynamicToolMetadataKey: ContextKey<readonly PersistedDynamicToolMetadata[]>;
export type DurableDynamicSubagentSelection = {
    readonly agentConfig: DynamicSubagentAgentConfig;
    readonly kind: "subagent";
    readonly prepared: PreparedRuntimeDelegationTool;
    readonly remoteAgent?: never;
} | {
    readonly agentConfig?: never;
    readonly kind: "remote";
    readonly prepared: PreparedRuntimeDelegationTool;
    readonly remoteAgent: DynamicRemoteAgentConfig;
} | null;
export declare const SessionDynamicSubagentSelectionsKey: ContextKey<Readonly<Record<string, DurableDynamicSubagentSelection>>>;
export declare const TurnDynamicSubagentSelectionsKey: ContextKey<Readonly<Record<string, DurableDynamicSubagentSelection>>>;
export declare const SessionDynamicSubagentRuntimeRevisionKey: ContextKey<string>;
export declare const DynamicSubagentAgentConfigKey: ContextKey<DynamicSubagentAgentConfig>;
/**
 * 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[]>>;
/** Existing history exposed only to instructions resolvers during a preamble. */
export declare const DynamicInstructionResolveMessagesKey: ContextKey<readonly ModelMessage[]>;
/** User-role results waiting to be committed immediately after a preamble. */
export declare const PendingDynamicInstructionUserMessagesKey: ContextKey<readonly UserModelMessage[]>;
