import type { BackboneVersionManifest } from '../contracts/backboneDurableWorkflow.js'; import type { CampaignStoryboard } from '../contracts/storyboard.js'; export declare const CHAT_RUN_SCHEMA_VERSION: "2026-05-14.1"; export type ChatRunStatus = 'queued' | 'running' | 'waiting_for_user' | 'completed' | 'partial_failure' | 'failed' | 'cancelled'; export type ChatRunWaitingReason = 'ask_clarifying_question' | 'select_media_required' | 'cost_approval_required' | 'safety_review_required' | 'other'; export interface ChatRunOwnerScope { ownerWalletAddress: string; apiKeyFingerprint?: string; tokenType?: string; appSource?: string; } export interface ChatRunRuntimeConfig { qualityTier?: 'fast' | 'hq' | 'pro'; safeContentFilter?: boolean; personaNames?: string[]; requireJobConfirmation?: boolean; jobConfirmationThresholdUsd?: number; campaignStoryboard?: CampaignStoryboard; approvedStoryboardScript?: string; generatedStoryboardImageIndex?: number; mediaModelPreferences?: Record; } export interface ChatRunRequestSnapshot { sessionId?: string; clientMessageId?: string; model?: string; messages: unknown[]; tools?: unknown[]; toolChoice?: unknown; sampling?: Record; mediaReferences?: unknown[]; maxEstimatedCapacityUnits?: number; confirmCost?: boolean; idempotencyKey?: string; runtimeConfig?: ChatRunRuntimeConfig; } export interface ChatRunToolCall { toolCallId: string; toolName: string; arguments: Record; sequence: number; } export interface ChatRunToolResultRef { toolCallId: string; status: 'ok' | 'err' | 'cancelled' | 'waiting_for_user'; summary?: string; billingPreview?: unknown; errorCode?: string; sequence: number; } export interface ChatRunMediaContextSnapshot { images: string[]; videos: string[]; audio: string[]; uploadedImages?: string[]; uploadedVideos?: string[]; uploadedAudio?: string[]; } export interface ChatRunFinalResponse { content?: string; pendingToolCalls?: ChatRunToolCall[]; finishReason?: 'stop' | 'tool_calls' | 'length' | 'safety' | 'cancelled' | 'partial_failure' | 'waiting_for_user'; } export interface ChatRunWaitingState { reason: ChatRunWaitingReason; message?: string; details?: Record; } export interface ChatRunCostConfirmationDetails { toolCallId: string; toolName: string; modelKey?: string; modelDisplayName?: string; estimatedCost: number; tokenType?: 'sogni' | 'spark'; estimatedUsdCost?: number; summary?: string; toolArgs?: Record; } export interface ChatRunCostConfirmationDecision { toolCallId: string; decision: 'confirm' | 'cancel'; overrides?: Record; reason?: string; } export interface ChatRunEvent { sequence: number; type: 'run_created' | 'run_resumed' | 'llm_round_started' | 'assistant_message_delta' | 'assistant_message_completed' | 'tool_call_dispatched' | 'tool_call_progress' | 'tool_call_resolved' | 'media_context_updated' | 'media_turn_intent_classified' | 'asset_manifest_updated' | 'billing_preview_updated' | 'run_waiting_for_user' | 'run_awaiting_cost_confirmation' | 'run_cost_confirmation_resolved' | 'run_completed' | 'run_failed' | 'run_partial_failure' | 'run_cancelled'; at: string; payload?: Record; } export interface ChatRunArtifactRef { id: string; workflowId?: string; stepId?: string; url?: string; mediaType?: 'image' | 'video' | 'audio' | 'model'; partial?: boolean; modelKey?: string; modelDisplayName?: string; toolName?: string; } export interface ChatRunMediaItem { url: string; mediaType: NonNullable; modelKey?: string; modelDisplayName?: string; toolName?: string; } export declare function isChatRunMediaType(value: unknown): value is ChatRunMediaItem['mediaType']; export interface DurableMediaViolation { path: string; reason: 'inline_data_url' | 'inline_data_uri_field' | 'non_external_url'; } export interface DurableMediaReferenceInput { messages?: unknown; mediaReferences?: unknown; mediaContext?: unknown; artifacts?: unknown; mediaUrls?: unknown; } export declare function isDurableExternalMediaUrl(value: unknown): value is string; export declare function isInlineDurableMediaUrl(value: unknown): boolean; export declare function collectDurableMediaViolations(input: DurableMediaReferenceInput): DurableMediaViolation[]; export declare function assertDurableMediaIsExternal(input: DurableMediaReferenceInput, label?: string): void; export declare function extractChatRunMediaFromEventPayload(payload: Record | undefined): ChatRunMediaItem[]; export interface ToolCallProgressUpdate { toolCallId?: string; progress?: number; status?: string; etaSeconds?: number; stepLabel?: string; jobLabel?: string; jobIndex?: number; jobProgress?: number; jobEtaSeconds?: number; resultUrl?: string; isVideoResult?: boolean; jobError?: string; mediaUrls?: unknown[]; } export declare function extractToolCallProgressUpdate(payload: Record | undefined): ToolCallProgressUpdate; export declare function extractChatRunMediaFromRecord(record: { artifacts?: unknown; }): ChatRunMediaItem[]; export declare function buildChatRunArtifactRefs(input: { toolCallId: string; artifacts?: Array<{ id?: unknown; kind?: unknown; url?: unknown; }>; mediaUrls?: Array<{ url?: unknown; mediaType?: unknown; }>; workflowId?: string; stepId?: string; partial?: boolean; }): ChatRunArtifactRef[]; export interface ChatRunLeaseState { leaseId: string; ownerId: string; acquiredAt: string; heartbeatAt: string; expiresAt: string; } export interface ChatRunRecoveryState { resumeCount: number; lastResumeAt?: string; lastRecoveredAt?: string; reason?: string; } export interface ChatRunQualityState { postflightAudits?: unknown[]; } export interface ChatRunRecordContract { runId: string; status: ChatRunStatus; schemaVersion: typeof CHAT_RUN_SCHEMA_VERSION; backbone: BackboneVersionManifest; scope: ChatRunOwnerScope; request: ChatRunRequestSnapshot; messages: unknown[]; toolCalls: ChatRunToolCall[]; toolResults: ChatRunToolResultRef[]; mediaContext: ChatRunMediaContextSnapshot; assetManifest?: unknown; childWorkflowIds: string[]; billingPreview?: unknown; billingPreviews: unknown[]; artifacts: ChatRunArtifactRef[]; finalResponse?: ChatRunFinalResponse; waiting?: ChatRunWaitingState; events: ChatRunEvent[]; lease?: ChatRunLeaseState; recovery?: ChatRunRecoveryState; quality?: ChatRunQualityState; failureReason?: string; cancellationReason?: string; timestamps: { createdAt: string; updatedAt: string; completedAt?: string; }; } export interface ChatRunInput { request: ChatRunRequestSnapshot; scope: ChatRunOwnerScope; title?: string; } export declare function buildChatRunRecord(input: ChatRunInput, options: { runId: string; now?: string; backbone: BackboneVersionManifest; }): ChatRunRecordContract; export declare function recordChatRunResume(record: ChatRunRecordContract, options?: { reason: string; now?: string; }): ChatRunRecordContract; export declare function appendChatRunEvent(record: ChatRunRecordContract, event: Omit): ChatRunEvent; export declare function nextEventSequence(record: ChatRunRecordContract): number; export declare function chatRunEventsAfter(record: ChatRunRecordContract, lastSequence: number | undefined): ChatRunEvent[]; export declare function isChatRunTerminal(status: ChatRunStatus): boolean; export declare function isChatRunWaiting(status: ChatRunStatus): boolean; export declare function isChatRunResumable(status: ChatRunStatus): boolean; export { isCostApprovalGatedTool, COST_APPROVAL_OVERRIDE_ALLOWLIST, sanitizeCostApprovalOverride, applyCostApprovalOverridesToToolArguments, } from './costApproval.js'; //# sourceMappingURL=index.d.ts.map