import type { RestrictedDataAuditEvent } from "./restricted-data.js"; export declare const CHAT_ACTOR_KINDS: readonly ["human", "parent_agent", "subagent", "provider_agent", "system", "reviewer", "workflow_event"]; export type ChatActorKind = (typeof CHAT_ACTOR_KINDS)[number]; export interface ChatScope { tenantId: string; workspaceId: string; taskId: string; runId: string; phase: string; sessionId: string; } export type HumanActorSource = "web_console" | "cli" | "api"; export type SystemActorSource = "orchestra" | "storage" | "migration"; export type ChatRuntimeSource = "codex-cli" | "claude-cli" | "cursor-cli" | "generic-runtime"; export interface ChatHumanActor { kind: "human"; actorId: string; displayName: string; source: HumanActorSource; sessionId: string; } export interface ChatParentAgentActor { kind: "parent_agent"; actorId: string; runtime: ChatRuntimeSource; sessionId: string; } export interface ChatSubagentActor { kind: "subagent"; actorId: string; runtime: ChatRuntimeSource; role: string; sessionId: string; parentSessionId: string; } export interface ChatProviderAgentActor { kind: "provider_agent"; actorId: string; provider: string; model: string; requestId: string; } export interface ChatSystemActor { kind: "system"; actorId: string; source: SystemActorSource; } export interface ChatReviewerActor { kind: "reviewer"; actorId: string; role: string; reviewId: string; } export interface ChatWorkflowEventActor { kind: "workflow_event"; actorId: string; sourceEventId: string; eventType: string; } export type ChatActor = ChatHumanActor | ChatParentAgentActor | ChatSubagentActor | ChatProviderAgentActor | ChatSystemActor | ChatReviewerActor | ChatWorkflowEventActor; export type ChatProvenanceSourceKind = "user_input" | "agent_output" | "provider_output" | "workflow_event" | "review" | "storage_projection" | "migration"; export interface ChatProvenance { sourceKind: ChatProvenanceSourceKind; sourceId: string; createdAt: string; observedAt: string; runtime?: ChatRuntimeSource; provider?: string; model?: string; requestId?: string; responseId?: string; inputTokens?: number; outputTokens?: number; estimatedCostUsd?: number; usageSource?: "provider" | "runtime" | "estimated" | "unavailable"; costSource?: "provider" | "pricing_estimate" | "free" | "unavailable"; parentMessageId?: string; policyDecisionId?: string; } export type ChatContentState = "raw" | "redacted" | "tombstoned"; export type ChatContentFormat = "plain_text" | "markdown" | "workflow_event"; export type ChatRetentionStatus = "redacted_only" | "raw_allowed" | "expired" | "denied"; export type ChatRawPersistence = "forbidden" | "allowed"; export type ChatExportStatus = "exportable" | "redacted_only" | "not_exportable"; export type ChatDeleteStatus = "active" | "tombstoned"; export interface ChatRetentionMetadata { policyId: string; status: ChatRetentionStatus; rawPersistence: ChatRawPersistence; decidedAt: string; expiresAt?: string; } export interface ChatExportMetadata { status: ChatExportStatus; rawContentExportable: boolean; policyId: string; decidedAt: string; } export interface ChatDeleteMetadata { status: ChatDeleteStatus; policyId: string; tombstonedAt?: string; tombstonedByActorId?: string; reasonCode?: string; } export interface ChatRedactionMetadata { policyId: string; status: "applied"; redactedAt: string; redactedByActorId: string; markerCount: number; summary: string; } export interface ChatContent { format: ChatContentFormat; text: string; } export type ChatReferenceKind = "workflow_run" | "task" | "evidence" | "review" | "decision" | "provider_request" | "restricted_fragment"; export interface ChatReference { kind: ChatReferenceKind; id: string; label?: string; } export interface ChatWorkflowTimelineEvent { sourceEventId: string; eventType: string; actor: string; summary: string; taskId: string; runId?: string; phase?: string; gateId?: string; result?: string; rationale?: string; sessionId?: string; runtime?: ChatRuntimeSource; actionKind?: string; artifacts: string[]; } export interface ChatThread { schemaVersion: number; id: string; scope: ChatScope; title: string; createdAt: string; updatedAt: string; actor: ChatActor; provenance: ChatProvenance; retention: ChatRetentionMetadata; export: ChatExportMetadata; delete: ChatDeleteMetadata; contentState: ChatContentState; summary?: string; } export interface ChatMessage { schemaVersion: number; id: string; threadId: string; scope: ChatScope; actor: ChatActor; provenance: ChatProvenance; createdAt: string; sequence: number; content: ChatContent; contentState: ChatContentState; retention: ChatRetentionMetadata; redaction?: ChatRedactionMetadata; export: ChatExportMetadata; delete: ChatDeleteMetadata; references?: ChatReference[]; restricted?: RestrictedDataAuditEvent; timelineEvent?: ChatWorkflowTimelineEvent; } export interface ChatStorageState { schemaVersion: number; scope: ChatScope; threads: number; messages: number; } export interface ChatListOptions { limit?: number; cursor?: string; } export interface ChatThreadListResult { threads: ChatThread[]; nextCursor?: string; } export interface ChatMessageListResult { messages: ChatMessage[]; nextCursor?: string; } export interface ChatExportOptions { includeTombstoned: boolean; content: "redacted_only" | "raw_when_allowed"; } export interface ChatExportRecord { schemaVersion: number; scope: ChatScope; thread: ChatThread; messages: ChatMessage[]; exportedAt: string; content: "redacted_only" | "raw_when_allowed"; }