feat: add TypeScript types for branching, handoffs, and resolution outputs

Adds BranchResponse, ForkPointResponse, BranchSwitchResponse, HandoffResponse,
QueueItemResponse, ResolutionOutputResponse and related request/response types.
Extends AISessionDetail with is_branching and active_branch_id fields.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-24 08:50:02 +00:00
parent 5481815173
commit fc8b73f765
3 changed files with 163 additions and 0 deletions

View File

@@ -195,6 +195,8 @@ export interface AISessionDetail extends AISessionSummary {
ticket_data: Record<string, unknown> | null
steps: AISessionStepResponse[]
conversation_messages: Array<{ role: string; content: string }>
is_branching: boolean
active_branch_id: string | null
}
export interface AISessionSearchResult {

View File

@@ -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<string, unknown>
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<string, unknown> | 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
}

View File

@@ -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'