diff --git a/frontend/src/types/ai-session.ts b/frontend/src/types/ai-session.ts index 94bc6d08..0a684871 100644 --- a/frontend/src/types/ai-session.ts +++ b/frontend/src/types/ai-session.ts @@ -195,6 +195,8 @@ export interface AISessionDetail extends AISessionSummary { ticket_data: Record | null steps: AISessionStepResponse[] conversation_messages: Array<{ role: string; content: string }> + is_branching: boolean + active_branch_id: string | null } export interface AISessionSearchResult { diff --git a/frontend/src/types/branching.ts b/frontend/src/types/branching.ts new file mode 100644 index 00000000..f01565a1 --- /dev/null +++ b/frontend/src/types/branching.ts @@ -0,0 +1,160 @@ +// ── Branches ── + +export interface BranchResponse { + id: string + session_id: string + parent_branch_id: string | null + fork_point_step_id: string | null + branch_order: number + label: string + status: 'active' | 'dead_end' | 'solved' | 'untried' | 'revived' + status_reason: string | null + status_changed_at: string | null + context_summary: { + tried: string[] + concluded: string + artifacts: string[] + } | null + evidence_from_branch_id: string | null + evidence_description: string | null + step_count: number + created_at: string + updated_at: string +} + +export interface BranchTreeResponse { + branches: BranchResponse[] + active_branch_id: string | null +} + +export interface ForkOption { + label: string + description: string +} + +export interface ForkCreateRequest { + fork_reason: string + options: ForkOption[] +} + +export interface ForkPointResponse { + id: string + session_id: string + parent_branch_id: string + trigger_step_id: string | null + fork_reason: string + options: Array<{ + label: string + description: string + branch_id: string + status: string + }> + created_at: string +} + +export interface BranchSwitchResponse { + active_branch_id: string + branch: BranchResponse + conversation_messages: Array<{ role: string; content: string }> +} + +export interface ReviveRequest { + evidence_from_branch_id: string + evidence_description: string +} + +export interface BranchMessageRequest { + message: string + upload_ids?: string[] +} + +export interface BranchMessageResponse { + content: string + branch_id: string + step_id: string | null +} + +// ── Handoffs ── + +export interface HandoffCreateRequest { + intent: 'park' | 'escalate' + engineer_notes?: string + priority?: 'normal' | 'elevated' +} + +export interface HandoffResponse { + id: string + session_id: string + handed_off_by: string + intent: 'park' | 'escalate' + source_branch_id: string | null + snapshot: Record + ai_assessment: string | null + ai_assessment_data: { + likely_cause: string + suggested_steps: string[] + confidence: number + } | null + artifacts: Array<{ + name: string + type: string + reference: string + }> | null + engineer_notes: string | null + priority: 'normal' | 'elevated' + claimed_by: string | null + claimed_at: string | null + psa_note_pushed: boolean + notification_sent: boolean + created_at: string +} + +export interface QueueItemResponse { + handoff_id: string + session_id: string + intent: 'park' | 'escalate' + problem_summary: string | null + problem_domain: string | null + priority: 'normal' | 'elevated' + handed_off_by_name: string | null + engineer_notes: string | null + branch_count: number + created_at: string + claimed_by: string | null + claimed_at: string | null +} + +// ── Resolution Outputs ── + +export type ResolutionOutputType = 'psa_ticket_notes' | 'knowledge_base' | 'client_summary' +export type ResolutionOutputStatus = 'draft' | 'approved' | 'pushed' | 'rejected' + +export interface ResolutionOutputResponse { + id: string + session_id: string + output_type: ResolutionOutputType + generated_content: string + structured_data: Record | null + edited_content: string | null + status: ResolutionOutputStatus + pushed_to: string | null + pushed_at: string | null + pushed_reference: string | null + generated_by_model: string + created_at: string + updated_at: string +} + +export interface AllResolutionOutputsResponse { + outputs: ResolutionOutputResponse[] +} + +export interface ResolutionOutputEditRequest { + edited_content: string +} + +export type PushDestination = 'psa' | 'kb_library' | 'clipboard' | 'email' + +export interface ResolutionOutputPushRequest { + destination: PushDestination +} diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 7fffdeb6..b44ccc84 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -13,6 +13,7 @@ export * from './analytics' export * from './copilot' export type { ChatListItem, RetentionSettings, ConclusionOutcome } from './assistant-chat' export * from './ai-session' +export * from './branching' export * from './flow-proposal' export * from './flowpilot-analytics' export * from './upload'