/** * @license * Copyright 2025 Vybestack LLC * SPDX-License-Identifier: Apache-2.0 */ /** * RuntimeInvocationContext captures immutable, per-call metadata that providers * need to construct stateless requests without reading from Config directly. * * @plan PLAN-20251029-STATELESS8.P01 * @plan PLAN-20260126-SETTINGS-SEPARATION.P06 * @requirement REQ-STAT8-001 */ import type { RedactionConfig } from '../config/config.js'; import type { SettingsService } from '../settings/SettingsService.js'; import type { ProviderTelemetryContext } from '../providers/types/providerRuntime.js'; import type { ProviderRuntimeContext } from './providerRuntimeContext.js'; export interface RuntimeInvocationContext { /** Stable identifier for the invocation/runtime */ readonly runtimeId: string; /** Immutable metadata merged from caller + provider manager layers */ readonly metadata: Readonly>; /** Per-call settings service (stateless view) */ readonly settings: SettingsService; /** Snapshot of global ephemeral overrides for this invocation */ readonly ephemerals: Readonly>; /** CLI-only settings (never sent to API) */ readonly cliSettings: Readonly>; /** Model behavior settings that require provider-specific translation */ readonly modelBehavior: Readonly>; /** Model parameters that pass through unchanged to API */ readonly modelParams: Readonly>; /** Custom HTTP headers for API requests */ readonly customHeaders: Readonly>; /** Optional telemetry context derived during normalization */ readonly telemetry?: ProviderTelemetryContext; /** Optional user memory snapshot for providers that need it */ readonly userMemory?: string; /** Optional redaction configuration for logging/telemetry surfaces */ readonly redaction?: Readonly; /** Helper to read a strongly-typed ephemeral override */ getEphemeral(key: string): T | undefined; /** Helper to read a CLI setting value */ getCliSetting(key: string): T | undefined; /** Helper to read a model behavior value */ getModelBehavior(key: string): T | undefined; /** Helper to read a model parameter value */ getModelParam(key: string): T | undefined; /** Helper to read nested provider-specific overrides (e.g. "openai") */ getProviderOverrides>(providerName: string): T | undefined; } export interface RuntimeInvocationContextInit { runtime: ProviderRuntimeContext; settings: SettingsService; providerName: string; telemetry?: ProviderTelemetryContext; metadata?: Record; ephemeralsSnapshot?: Record; /** Optional snapshot of user memory for downstream prompt resolution */ userMemory?: string; /** Optional redaction configuration override */ redaction?: RedactionConfig; /** Optional fallback runtime id when runtime.runtimeId is missing */ fallbackRuntimeId?: string; } export declare function createRuntimeInvocationContext(init: RuntimeInvocationContextInit): RuntimeInvocationContext;