{
  "messages": [
    {
      "role": "system",
      "content": "You are a screenwriting agent. The program already created a script skeleton and shot plan. Do not change scene_id or shot_id ordering. Keep the number of shots stable. Chronology is program-owned. Use it to keep flashback, dream, rumor, and parallel-line language consistent, but do not rewrite chronology fields. Refine language, dialogue, narration, and shot descriptions while preserving the program structure. Prefer the existing entity display names from the entity context. Do not invent unnecessary new speaker variants when the candidate already provides a stable character name. Return JSON only."
    },
    {
      "role": "user",
      "content": "Given the scene payload, chronology context, entity context, and the program-generated script candidate, refine it into a concise screenplay. Output STRICT JSON with keys: scene_id, shots (list), scene_notes, audio_notes, narrator_profile_id. Shot schema: {shot_id,description,camera,actions,dialogue,narration,on_screen_text,narrator_profile_id,narration_delivery_hint}. dialogue is a list of {speaker,speaker_entity_uid,delivery_hint,line}. speaker_entity_uid and narrator_profile_id are program-owned identity fields: preserve the candidate values when unsure, and do not fabricate random IDs. Keep the same shot count as the candidate unless the candidate is malformed. Keep the narrative presentation order, but make the script language consistent with chronology time_mode, anchor, and ordering hints. Prefer existing characters and locations. Return a single JSON object and nothing else (no markdown, no code fences). If unsure, return {\"scene_id\":\"\",\"shots\":[]}.\n\nSCENE:\n{\"candidate_id\": \"C0001-SC04\", \"title\": \"系统初现\", \"summary\": \"李凡尝试召唤系统，出现心理健康维护系统。\", \"type\": [\"系统/设定\"], \"tone\": [\"中性\", \"诧异\"], \"importance\": \"主线\", \"presentation\": [\"文字卡片\", \"旁白+画面\"], \"key_beats\": [\"李凡尝试召唤系统\", \"系统出现并自我介绍\", \"李凡对系统类型感到困惑\"], \"characters\": [\"李凡\"], \"locations\": [], \"continuation_of_prev\": true, \"source_chunk_id\": \"C0001\", \"source_start_para\": 21, \"source_end_para\": 25, \"text\": \"系统？\\n\\n于是系统就出现了。\\n\\n‘欢迎使用穿越者心理健康维护系统’\\n\\n嗯，还好有……？？\\n\\n心理健康？心理健康是很重要……个鬼啊！\", \"text_preview\": \"系统？ 于是系统就出现了。 ‘欢迎使用穿越者心理健康维护系统’ 嗯，还好有……？？ 心理健康？心理健康是很重要……个鬼啊！\", \"candidate_meta\": {\"candidate_id\": \"C0001-SC04\", \"record_count\": 5, \"char_len\": 65, \"structure_counts\": {\"short_line\": 3, \"dialogue\": 1, \"body\": 1}, \"boundary_reasons_after\": [\"system_switch\"], \"matched_entities\": [{\"entity_id\": \"E000007\", \"name\": \"穿越者心理健康维护系统\", \"type\": \"系统面板\", \"subtype\": \"系统\", \"matched_terms\": [\"穿越者心理健康维护系统\"], \"score\": 5.2}, {\"entity_id\": \"E000002\", \"name\": \"李凡\", \"type\": \"人物\", \"subtype\": \"\", \"matched_terms\": [\"穿越者\"], \"score\": 2.2}], \"heuristic_types\": [\"系统/设定\"], \"heuristic_tones\": [\"中性\"], \"heuristic_presentation\": [\"文字卡片\", \"旁白+画面\"], \"heuristic_importance\": \"主线\"}, \"scene_id\": \"S0004\"}\n\nCHRONOLOGY:\n{\"scene_id\": \"S0004\", \"narrative_order\": 4, \"story_chronology_order\": 2, \"story_chronology_group\": \"CG0003\", \"time_mode\": \"mainline\", \"confidence\": 0.86, \"order_delta\": -2, \"temporal_anchor\": {\"label\": \"\", \"normalized_label\": \"unknown\", \"anchor_type\": \"unknown\", \"relative_direction\": \"unknown\", \"amount\": null, \"unit\": \"\", \"time_of_day\": \"\", \"explicit\": false, \"anchor_scene_id\": \"S0002\"}, \"constraints\": [{\"relation\": \"same_time\", \"target_scene_id\": \"S0003\", \"confidence\": 0.735, \"reason\": \"continuation_similarity\"}], \"evidence\": []}\n\nENTITY CONTEXT:\n{\"registry_entities\": [{\"entity_uid\": \"E000002\", \"canonical_name\": \"李凡\", \"aliases\": [\"穿越者\", \"小童\"], \"type\": \"人物\", \"subtype\": \"\", \"voice_card_id\": \"VO000002\"}], \"kg_entities\": [{\"entity_id\": \"E000002\", \"name\": \"李凡\", \"type\": \"人物\", \"subtype\": \"\", \"aliases\": [\"穿越者\", \"小童\"], \"attributes\": {}, \"descriptions\": [\"二十一名童子中的穿越者\", \"穿越者\", \"拥有系统\"], \"evidence\": [\"二十一人中有一个穿越者\", \"李凡实在是忍不住了\", \"李凡的心情下降了1点\"], \"mentions\": [{\"chunk_id\": \"C0001\", \"summary\": \"童子中的穿越者\", \"evidence\": [\"李凡普普通通的打工人\"], \"attributes\": {}}, {\"chunk_id\": \"C0002\", \"summary\": \"主角情绪波动\", \"evidence\": [\"李凡实在是忍不住了\"], \"attributes\": {}}], \"mention_count\": 2, \"observation_count\": 2, \"first_seen\": \"C0001\", \"last_seen\": \"C0002\"}]}\n\nSCRIPT CANDIDATE:\n{\"scene_id\": \"S0004\", \"scene_notes\": \"李凡尝试召唤系统，出现心理健康维护系统。；重要性：主线；呈现：文字卡片 / 旁白+画面；时间顺序：叙事4->故事2\", \"audio_notes\": \"以旁白驱动\", \"narrator_profile_id\": \"narrator_main_cn\", \"chronology\": {\"scene_id\": \"S0004\", \"narrative_order\": 4, \"story_chronology_order\": 2, \"story_chronology_group\": \"CG0003\", \"time_mode\": \"mainline\", \"confidence\": 0.86, \"order_delta\": -2, \"temporal_anchor\": {\"label\": \"\", \"normalized_label\": \"unknown\", \"anchor_type\": \"unknown\", \"relative_direction\": \"unknown\", \"amount\": null, \"unit\": \"\", \"time_of_day\": \"\", \"explicit\": false, \"anchor_scene_id\": \"S0002\"}, \"constraints\": [{\"relation\": \"same_time\", \"target_scene_id\": \"S0003\", \"confidence\": 0.735, \"reason\": \"continuation_similarity\"}], \"evidence\": []}, \"shots\": [{\"shot_id\": \"S0004_SH01\", \"camera\": \"中景\", \"description\": \"场景建立镜头，带出李凡尝试召唤系统\", \"actions\": [\"李凡尝试召唤系统\"], \"dialogue\": [], \"narration\": \"\", \"on_screen_text\": \"\", \"focus_characters\": [\"李凡\"], \"focus_locations\": [], \"candidate_meta\": {\"shot_role\": \"opening\", \"description_hint\": \"场景建立镜头，带出李凡尝试召唤系统\", \"camera_hint\": \"中景\", \"shot_index\": 1, \"chronology_summary\": {\"narrative_order\": 4, \"story_chronology_order\": 2, \"story_chronology_group\": \"CG0003\", \"time_mode\": \"mainline\", \"confidence\": 0.86, \"order_delta\": -2, \"anchor_label\": \"\", \"anchor_type\": \"unknown\", \"constraint_count\": 1, \"evidence_count\": 0}}, \"narrator_profile_id\": \"narrator_main_cn\"}, {\"shot_id\": \"S0004_SH02\", \"camera\": \"中近景\", \"description\": \"李凡的反应镜头，推进系统出现并自我介绍\", \"actions\": [\"系统出现并自我介绍\"], \"dialogue\": [], \"narration\": \"\", \"on_screen_text\": \"\", \"focus_characters\": [\"李凡\"], \"focus_locations\": [], \"candidate_meta\": {\"shot_role\": \"character\", \"description_hint\": \"李凡的反应镜头，推进系统出现并自我介绍\", \"camera_hint\": \"中近景\", \"shot_index\": 2, \"chronology_summary\": {\"narrative_order\": 4, \"story_chronology_order\": 2, \"story_chronology_group\": \"CG0003\", \"time_mode\": \"mainline\", \"confidence\": 0.86, \"order_delta\": -2, \"anchor_label\": \"\", \"anchor_type\": \"unknown\", \"constraint_count\": 1, \"evidence_count\": 0}}, \"narrator_profile_id\": \"narrator_main_cn\"}, {\"shot_id\": \"S0004_SH03\", \"camera\": \"近景\", \"description\": \"动作或状态变化的推进镜头\", \"actions\": [\"系统出现并自我介绍\", \"李凡对系统类型感到困惑\"], \"dialogue\": [], \"narration\": \"\", \"on_screen_text\": \"李凡尝试召唤系统，出现心理健康维护系统。\", \"focus_characters\": [\"李凡\"], \"focus_locations\": [], \"candidate_meta\": {\"shot_role\": \"dialogue_or_action\", \"description_hint\": \"动作或状态变化的推进镜头\", \"camera_hint\": \"近景\", \"shot_index\": 3, \"chronology_summary\": {\"narrative_order\": 4, \"story_chronology_order\": 2, \"story_chronology_group\": \"CG0003\", \"time_mode\": \"mainline\", \"confidence\": 0.86, \"order_delta\": -2, \"anchor_label\": \"\", \"anchor_type\": \"unknown\", \"constraint_count\": 1, \"evidence_count\": 0}}, \"narrator_profile_id\": \"narrator_main_cn\"}], \"candidate_meta\": {\"scene_id\": \"S0004\", \"source_chunk_id\": \"C0001\", \"source_start_para\": 21, \"source_end_para\": 25, \"characters\": [\"李凡\"], \"locations\": [], \"key_beats\": [\"李凡尝试召唤系统\", \"系统出现并自我介绍\", \"李凡对系统类型感到困惑\"], \"shot_count_hint\": 3, \"scene_summary\": \"李凡尝试召唤系统，出现心理健康维护系统。\", \"scene_text_preview\": \"系统？ 于是系统就出现了。 ‘欢迎使用穿越者心理健康维护系统’ 嗯，还好有……？？ 心理健康？心理健康是很重要……个鬼啊！\", \"chronology_summary\": {\"narrative_order\": 4, \"story_chronology_order\": 2, \"story_chronology_group\": \"CG0003\", \"time_mode\": \"mainline\", \"confidence\": 0.86, \"order_delta\": -2, \"anchor_label\": \"\", \"anchor_type\": \"unknown\", \"constraint_count\": 1, \"evidence_count\": 0}}}"
    }
  ]
}