import type { ChatRequestContext, ChatRuntimeOverrides, ChatUiMessage, DurableRootRunDescriptor } from "../../chat/types.js"; import { type HostedChatRequest } from "./chat-request.js"; import type { RuntimeAgentMarkdownDefinition } from "../runtime/agent-definition.js"; import { type HostedRuntimeSourceIdentity } from "./runtime-source-binding.js"; import { type HostedServiceRunEventAppendTokenVerification as RunEventAppendTokenVerification } from "../service/auth.js"; /** Internal control-plane credential for exact-run durable event appends. */ export declare const RUN_EVENT_APPEND_TOKEN_HEADER = "X-Veryfront-Run-Event-Token"; /** Public API contract for hosted chat request principal. */ export type HostedChatRequestPrincipal = { userId: string; authToken: string; }; /** Error shape for hosted chat project access. */ export type HostedChatProjectAccessError = { errorCode: string; message: string; statusCode: number; }; /** Result returned from hosted chat project access. */ export type HostedChatProjectAccessResult = { success: true; projectSlug?: string; } | { success: false; error: HostedChatProjectAccessError; }; /** * Request payload for parsed hosted chat. * * Verified run-event credentials remain in process-private ingress state and * are never exposed on this application-facing request value. */ export type ParsedHostedChatRequest = { agentId: string | undefined; userId: string; authToken: string; /** True only after a server envelope credential is verified and bound to this run. */ serverEnvelopeVerified?: true; /** * Integration tools the control plane resolved for this run, taken from the * verified run-event token rather than the request body. Absent unless a * token verified, so a forged body can never introduce it. */ serverResolvedIntegrationToolNames?: readonly string[]; messages: ChatUiMessage[]; validatedContext: ChatRequestContext; projectId: string | null; projectSlug?: string; conversationId: string | undefined; parentRunId: string | undefined; upstreamParentConversationId: string | undefined; upstreamParentRunId: string | undefined; spawnedFromToolCallId: string | undefined; model: string | undefined; allowDelegation: boolean | undefined; forwardedProps: HostedChatRequest["forwardedProps"]; runtimeOverrides: ChatRuntimeOverrides | undefined; durableRootRun: DurableRootRunDescriptor | undefined; persistLatestUserMessageBeforeDurableRun: boolean; agentConfig?: RuntimeAgentMarkdownDefinition; }; /** Options accepted by parse hosted chat request. */ export type ParseHostedChatRequestOptions = { authenticate: (request: Request) => Promise; verifyProjectAccess?: (input: { projectId: string; authToken: string; }) => Promise; verifyRunEventAppendToken?: (input: { token: string; projectId: string; runId: string; }) => Promise; }; /** Options accepted when parsing a signed control-plane runtime invocation. */ export type ParseRuntimeAgentRunInvocationHostedChatRequestOptions = ParseHostedChatRequestOptions & { runtimeSource: HostedRuntimeSourceIdentity | undefined; }; /** Request payload for build parsed hosted chat. */ type BuildParsedHostedChatRequestInput = { chatRequest: HostedChatRequest; agentId?: string; agentConfig?: RuntimeAgentMarkdownDefinition; authToken: string; userId: string; verifyProjectAccess?: ParseHostedChatRequestOptions["verifyProjectAccess"]; }; /** Builds a public hosted chat request without trusting client-supplied runtime targets. */ export declare function buildParsedHostedChatRequest(input: BuildParsedHostedChatRequestInput): Promise; /** Request payload for parse hosted chat request from. */ export declare function parseHostedChatRequestFromRequest(request: Request, options: ParseHostedChatRequestOptions): Promise; /** Request payload for parse runtime agent run invocation hosted chat request from. */ export declare function parseRuntimeAgentRunInvocationHostedChatRequestFromRequest(request: Request, options: ParseRuntimeAgentRunInvocationHostedChatRequestOptions): Promise; export {}; //# sourceMappingURL=chat-request-parser.d.ts.map