import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol'; import type { Config } from '../../config/schema.js'; import type { InboundAttachmentInput, MediaRef } from '../../channels/attachments/inbound-persist.js'; import { type SessionConfigStore, type SessionStore } from '../../session/index.js'; import type { SessionContext } from '../session/index.js'; import type { AgentInstanceGateway } from '../agent-instance-gateway.js'; import type { CommandHandler } from '../messaging/command-handler.js'; import type { ModelManager } from '../models/index.js'; import { type AgentSourceContextResolver } from '../source-context/types.js'; import { type TranscriptUserMessage } from '../inbound/attachment-pipeline.js'; export type DirectStreamInboundAttachment = InboundAttachmentInput; export type ProcessDirectStreamLog = { info: (obj: Record, msg: string) => void; warn: (obj: Record, msg: string) => void; debug?: (obj: Record, msg: string) => void; }; export interface ProcessDirectStreamingDeps { log: ProcessDirectStreamLog; resolveSessionEndpoint: (sessionKey: string) => Promise<{ channel: string; chatId: string; }>; initDirectStreamingSession: (sessionKey: string, channel: string, chatId: string, origin: TurnOrigin) => SessionContext; registerWebchatStreamPublisher: (sessionKey: string, publisher: (event: { type: string; [key: string]: unknown; }) => void) => void; unregisterWebchatStreamPublisher: (sessionKey: string) => void; agentManager: AgentInstanceGateway; hydrateSessionWorkspaceFromStore: (sessionKey: string) => Promise; hydrateSessionModelFromStore: (sessionKey: string) => Promise; sessionStore: SessionStore; modelManager: ModelManager; applyResolvedThinkingLevel: (sessionKey: string, thinking?: string | null) => Promise; getConfig: () => Config | undefined; sessionConfigStore: SessionConfigStore; commandHandler: Pick; prepareInboundAttachments: (sessionKey: string, attachments?: DirectStreamInboundAttachment[]) => Promise; buildTranscriptUserMessage: (content: string, prepared: MediaRef[] | undefined, sessionKey: string) => Promise; recordTaskReviewStreamHint?: (sessionKey: string, task: { skipTaskReview: boolean; }) => void; onTurnComplete?: (sessionKey: string, lastAssistantText?: string) => void; enqueueProvisionalSessionTitle?: (sessionKey: string, userText: string) => void; /** Disk-only transcript sync (slash receipt already streamed as tokens). */ reloadWebchatTranscript?: (sessionKey: string) => void; maybeEmitWebchatTts: (sessionKey: string, hadInboundVoice: boolean) => Promise<{ type: 'tts_audio'; uri: string; mimeType: string; name: string; } | null>; endDirectRequestContext: () => void; resetSession: (sessionKey: string) => Promise<{ sessionId: string; previousSessionId: string; } | null>; sourceContextResolver?: AgentSourceContextResolver; } export interface ProcessDirectStreamingInput { content: string; sessionKey?: string; origin: TurnOrigin; attachments?: DirectStreamInboundAttachment[]; thinking?: string; signal?: AbortSignal; runId?: string; } export type ProcessDirectStreamEvent = { type: string; [key: string]: unknown; }; export declare function runProcessDirectStreaming(deps: ProcessDirectStreamingDeps, input: ProcessDirectStreamingInput): AsyncGenerator;