import type { BreakdownState, EpisodePlan } from '@/features/breakdown/types' import type { CandidateCommitPreview, CandidateRevalidation } from '@/features/breakdown/candidate.types' import type { Checkpoint } from '@/features/workflows/types' /** * 创建含两个主体和两个动作镜头的独立候选,全部内容仅用于测试。 * @param overrides 本次测试状态差异 * @returns 完整候选状态 */ export function candidateState(overrides: Partial = {}): BreakdownState { const plan: EpisodePlan = { episodeNo: 1, episodeTitle: '第一集', storyGoal: '', centralConflict: '', emotionalArc: '', pacing: '', endingHook: '', beats: [{ beatNo: 1, title: '取物', purpose: 'action', description: '', visualFocus: '', narrativeGoal: '', emotionalTone: '', estimatedDurationSeconds: 8, subjectRefs: ['@CH0001', '@PR0001'], isKeyBeat: false }] } return { projectId: 'candidate-project', candidateOnly: true, storyboardPersisted: false, expectedEpisodeFingerprints: { 1: 'fingerprint' }, runConfig: { groupSize: 3, modules: ['character', 'prop'], episodeGroups: [], sourceEpisodes: [{ episodeNo: 1 }] }, subjectCandidates: [ { profileId: 'person', name: '人物', ref: '@CH0001', module: 'character', description: '', appearance_prompt: '' }, { profileId: 'prop', name: '铜铃', ref: '@PR0001', module: 'prop', description: '', appearance_prompt: '' } ], subjectForms: [ { formId: 'person-form', profileId: 'person', type: 'character', name: '人物形态', isDefault: true, description: '', appearancePrompt: '' }, { formId: 'prop-form', profileId: 'prop', type: 'prop', name: '铜铃形态', isDefault: true, description: '', appearancePrompt: '' } ], storyboardPlans: [plan], storyboardEpisodeShots: [{ episodeNo: 1, episodePlan: plan, beatShots: [{ beatNo: 1, shots: [1, 2].map(shotNo => ({ shotNo, title: `动作镜头 ${shotNo}`, description: '人物拿起铜铃', visualFocus: '', durationSeconds: 4, subjectRefs: ['@CH0001'], subjectBindings: [{ subjectRef: '@CH0001', profileId: 'person', formId: 'person-form', formName: '人物形态' }], requiredActions: [{ id: `action-${shotNo}`, description: '铜铃已经在手中', kind: 'state', mustPerformInShot: false }], durationPlanning: { complexity: 'low', phases: [{ action: '铜铃已经在手中', actionIds: [`action-${shotNo}`], estimatedSeconds: 4 }], transitionSeconds: 0, recommendedDurationSeconds: 4, reason: '测试' } })) }] }], storyboardShotValidation: { valid: true, issues: [] }, storyboardPendingQualityEpisodeNos: [], ...overrides } } /** * 构造稳定的当前候选检查点。 * @param state 当前候选状态 * @param checkpointId 当前版本 * @returns 检查点记录 */ export function candidateCheckpoint(state = candidateState(), checkpointId = 'candidate-current'): Checkpoint { return { checkpointId, createdAt: '2026-10-17T09:28:59Z', workflowName: 'breakdown', metadata: { nodeName: 'candidate_action_batch_repair', sourceCheckpointId: 'old' }, state } } /** * 创建完整的只读审核响应,canCommit 固定为 false。 * @param overrides 本次审核差异 * @returns 候选重新审核响应 */ export function candidateReview(overrides: Partial = {}): CandidateRevalidation { return { projectId: 'candidate-project', checkpointId: 'candidate-current', episodeCount: 1, shotCount: 2, previousIssues: [], currentIssues: [], missingSubjectRefs: [], pendingQualityEpisodeNos: [], actionQualityBlocks: [], actionRepairTargets: [], propReferenceDiagnostics: [], pendingWithoutActionBlocks: [], candidateValidation: { valid: true, issues: [] }, canCommit: false, ...overrides } } /** * 创建七项门禁均通过的安全预检查响应。 * @param overrides 本次检查差异 * @returns 只读安全检查 */ export function commitPreview(overrides: Partial = {}): CandidateCommitPreview { return { projectId: 'candidate-project', checkpointId: 'candidate-current', ready: true, readOnly: true, checks: { episodeNumbersMatch: true, episodeFingerprintsMatch: true, noActiveExecutions: true, noActiveVideos: true, noSubjectIdentities: true, noSubjectImages: true, noProtectedShots: true }, counts: { episodes: 1, existingStoryboards: 0, activeExecutions: 0, activeVideos: 0, subjectIdentities: 0, subjectImages: 0, protectedShots: 0 }, ...overrides } }