import type { ChatRequestContext, ChatSystemMessage, ChatUiMessage } from "../../chat/types.js"; import type { HistoricalToolInputCompactionDiagnostic } from "../../chat/message-prep.js"; import type { AgentRuntimeMessage } from "../runtime/message-adapter.js"; import type { ConversationRunEvent } from "../conversation/run-events.js"; import type { HostedChatRuntimeCreationOptions, HostedChatRuntimeCreationResult } from "./chat-runtime-contract.js"; import type { ParsedHostedChatRequest } from "./chat-request-parser.js"; import { type HostedConversationRootRunContext, type PrepareHostedConversationRootRunContextInput } from "../conversation/root-run-lifecycle.js"; import { type PrepareAgentRuntimeMessagesFromUiMessagesOptions } from "../runtime/message-preparation.js"; import type { RuntimeAgentThinkingConfig } from "../runtime/agent-definition.js"; import { type ResolvedHostedRuntimeRequestConfig } from "./runtime-request-config.js"; import { type RuntimeSkillDefinition } from "../runtime/skill-metadata.js"; import { type ContextBudgetDiagnostics, type ContextBudgetManagerOptions } from "./context-budget-manager.js"; import type { ToolExposureCheckpoint } from "../runtime/tool-exposure.js"; import type { ConversationRunChunkMirror } from "../conversation/run-chunk-mirror.js"; import type { HostedHostToolPolicy } from "./chat-runtime-tool-assembly.js"; /** Request payload for normalized hosted chat. */ export type NormalizedHostedChatRequest = { effectiveMessages: ChatUiMessage[]; effectiveValidatedContext: ChatRequestContext; parentMessageId: string | undefined; }; /** Options accepted by prepare hosted chat runtime messages. */ export type PrepareHostedChatRuntimeMessagesOptions = Pick & { authToken?: string; apiUrl?: string | URL; projectId?: string | null; }; /** Context for hosted chat runtime preparation root run. */ export type HostedChatRuntimePreparationRootRunContext = { durableRootRun?: HostedConversationRootRunContext["durableRootRun"]; effectiveParentRunId?: string; effectiveParentMessageId?: string; publishParentRunEvents?: (events: ConversationRunEvent[]) => Promise; durableRunMirror?: ConversationRunChunkMirror | null; privateDurableRunMirror?: ConversationRunChunkMirror | null; }; /** Public API contract for hosted chat runtime preparation steering. */ export type HostedChatRuntimePreparationSteering = { instructions: string; skills: RuntimeSkillDefinition[]; }; /** Input payload for hosted chat runtime instructions. */ export type HostedChatRuntimeInstructionsInput = { agentConfig: TRuntimeAgentDefinition; projectId: string | null; branchId?: string | null; environmentContext?: string; instructions: string; skills: RuntimeSkillDefinition[]; availableToolNames?: readonly string[]; }; /** Input payload for hosted chat runtime creation preparation. */ export type HostedChatRuntimeCreationPreparationInput = { request: ParsedHostedChatRequest; agentConfig: TRuntimeAgentDefinition & { id: string; model?: string; thinking?: RuntimeAgentThinkingConfig; maxSteps?: number; allowedRemoteTools?: unknown; providerTools?: string[]; tools?: true | string[]; deniedTools?: string[]; skills?: true | false | string[]; }; projectId: string | null; authToken: string; conversationId?: string; branchId?: string | null; runtimeTargetKind?: ChatRequestContext["runtimeTargetKind"]; runtimeTargetEnvironmentId?: string | null; environmentContext?: string; rootRunContext?: HostedChatRuntimePreparationRootRunContext; /** Trusted checkpoint resolved after hosted service authentication. */ serverResolvedToolExposureCheckpoint?: ToolExposureCheckpoint; /** Verified integration tool grant for this run, resolved by the control plane. */ serverResolvedIntegrationToolNames?: readonly string[]; /** Service-owned authorization ceiling for Framework host tools. */ hostToolPolicy?: HostedHostToolPolicy; resolveModelId: (modelId: string | undefined) => string | undefined; resolveModelThinking?: (modelId: string | undefined) => RuntimeAgentThinkingConfig | undefined; fetchSteering: (input: { projectId: string | null; authToken: string; branchId?: string | null; }) => Promise; buildInstructions: (input: HostedChatRuntimeInstructionsInput) => string | ChatSystemMessage[]; }; /** Result returned from hosted chat runtime creation preparation. */ export type HostedChatRuntimeCreationPreparationResult = { creationOptions: HostedChatRuntimeCreationOptions; steering: HostedChatRuntimePreparationSteering & { agentInstructions: string | ChatSystemMessage[]; }; runtimeConfig: ResolvedHostedRuntimeRequestConfig; }; /** Options accepted by hosted chat execution preparation root run. */ export type HostedChatExecutionPreparationRootRunOptions = Pick; /** Public API contract for hosted chat context budget logging. */ export type HostedChatContextBudgetLogger = { debug?: (message: string, metadata?: Record) => void; error?: (message: string, metadata?: Record) => void; }; /** Options accepted by hosted chat context budget management. */ export type HostedChatContextBudgetOptions = ContextBudgetManagerOptions & { logger?: HostedChatContextBudgetLogger; }; /** Input payload for hosted chat execution preparation. */ export type HostedChatExecutionPreparationInput = { request: ParsedHostedChatRequest; agentConfig: TRuntimeAgentDefinition; apiUrl: string | URL; abortSignal: AbortSignal; rootRun?: HostedChatExecutionPreparationRootRunOptions; resolveModelId: (modelId: string | undefined) => string | undefined; resolveModelThinking?: (modelId: string | undefined) => RuntimeAgentThinkingConfig | undefined; fetchSteering: (input: { projectId: string | null; authToken: string; branchId?: string | null; }) => Promise; buildInstructions: (input: HostedChatRuntimeInstructionsInput) => string | ChatSystemMessage[]; createRuntime: (options: HostedChatRuntimeCreationOptions) => Promise; contextBudget?: HostedChatContextBudgetOptions; /** Trusted checkpoint resolved by the authenticated hosted service. */ serverResolvedToolExposureCheckpoint?: ToolExposureCheckpoint; /** Verified integration tool grant for this run, resolved by the control plane. */ serverResolvedIntegrationToolNames?: readonly string[]; /** Service-owned authorization ceiling for Framework host tools. */ hostToolPolicy?: HostedHostToolPolicy; }; /** Result returned from hosted chat execution preparation. */ export type HostedChatExecutionPreparationResult = NormalizedHostedChatRequest & { rootRunContext: HostedConversationRootRunContext; runtime: TRuntimeResult; finalMessages: AgentRuntimeMessage[]; contextBudgetDiagnostics?: ContextBudgetDiagnostics; historicalToolInputCompactions?: HistoricalToolInputCompactionDiagnostic[]; steering: HostedChatRuntimeCreationPreparationResult["steering"]; runtimeConfig: ResolvedHostedRuntimeRequestConfig; }; /** Request payload for normalize parsed hosted chat. */ export declare function normalizeParsedHostedChatRequest(request: ParsedHostedChatRequest): NormalizedHostedChatRequest; /** Options accepted by prepare hosted chat runtime creation. */ export declare function prepareHostedChatRuntimeCreationOptions(input: HostedChatRuntimeCreationPreparationInput): Promise>; /** Prepare hosted chat execution. */ export declare function prepareHostedChatExecution(input: HostedChatExecutionPreparationInput): Promise>; /** Prepare hosted chat runtime messages. */ export declare function prepareHostedChatRuntimeMessages(messages: readonly ChatUiMessage[], options?: PrepareHostedChatRuntimeMessagesOptions): Promise; //# sourceMappingURL=chat-preparation.d.ts.map