/** YCode transport types for the restored WorkBuddy view contracts. */ import type { PreviewArtifact } from './artifacts' export type PermissionMode = 'default-sandbox' | 'full-access' /** Conversation behavior, independent of filesystem approval/permission mode. */ export type AgentMode = 'craft' | 'plan' | 'ask' export interface ChatAttachment { id: string name: string mimeType: string size: number previewUrl?: string path?: string } /** * 消息引用(WorkBuddy `message.quote.add`)。 * 表格引用保存 markdown 快照,发送后随用户消息一起持久化。 */ export interface MessageQuote { id: string kind: 'table' /** 稳定来源标识(渲染器 sourceId + table id),用于同一条回复内去重与高亮。 */ sourceId: string /** 产生该引用的助手消息 id,可回溯到原表格。 */ messageId?: string /** 表格 markdown 快照。 */ markdown: string /** 引用来源标题(原版 display.title);未采集到原版取值时留空,不臆造文本。 */ title?: string /** 输入区与消息气泡中的展示摘要。 */ preview: string } export interface QuestionOption { id?: string option?: string label?: string question?: string description?: string hint?: string } export interface QuestionItem { id: string question: string options: Array multiSelect?: boolean } export interface QuestionAnswer { title?: string questions: Array<{ id: string; question: string; answers: string[] }> } export interface PermissionOption { optionId: string; name: string; kind: string } export type InteractionStatus = 'pending' | 'responding' | 'answered' | 'rejected' | 'cancelled' | 'error' interface InteractionBase { id: string runId: string toolCallId: string title: string status: InteractionStatus error?: string } export type ChatInteraction = | (InteractionBase & { kind: 'question'; questions: QuestionItem[]; answer?: QuestionAnswer; skipped?: boolean }) | (InteractionBase & { kind: 'approval'; requestId: string; options: PermissionOption[]; selectedOptionId?: string; scope?: string }) export type InteractionResponse = | { kind: 'question'; answer: QuestionAnswer; skipped?: boolean } | { kind: 'approval'; optionId: string } export interface PlanStep { id: string; text: string; status: 'pending' | 'in_progress' | 'completed' | 'cancelled' } export interface PlanContent { id: string; title: string; steps: PlanStep[]; filePath?: string } export interface TaskContent { id: string title: string description?: string status: 'pending' | 'running' | 'success' | 'error' | 'cancelled' summary?: string toolCount?: number durationMs?: number } export interface ArtifactContent { id: string; name: string; path: string; mimeType?: string; description?: string; preview?: PreviewArtifact }