AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(confirm-ui): keep template use in staged confirmation
hugohe36e2ea64172c1
diff --git a/docs/technical-design.md b/docs/technical-design.mdindex 57d40c3f..4fd8cf72 100644--- a/docs/technical-design.md+++ b/docs/technical-design.md@@ -348,7 +348,7 @@ PPT Master uses **role switching within one main agent** rather than parallel su**Why role-specialized references, not one mega prompt.** Strategist runs in "negotiate with user" mode (open-ended, conversational, willing to back up); Executor runs in "produce strict XML" mode (no improvisation, no missing attributes). Mixing both into one prompt forces the model to hold incompatible discipline in the same turn — every prompt-engineering pathology of mode-mixing shows up. Splitting into per-role files lets each role load only what it needs and discard the rest.-**Strategist confirmation stage as the only blocking gate.** Strategist ends with one gate delivered in three dependency-ordered stages. Stage 1 confirms an open communication contract and canvas. Its prose boxes contain editable recommendations, but none requires a non-empty answer: confirmation persists the current text exactly, and a cleared value stays empty instead of falling back to the recommendation. Stage 2 is authored once from that contract and confirms the complete deck solution: reading mode, narrative mode, page count, coordinated visual system, image sources, and generated-image rendering. When a template is installed, Strategist also derives its page/prototype application plan internally from the actual workspace and current content; the UI exposes no template-mode controls. Reading mode decides how meaning is carried by page, visuals, presenter, and notes; its cards do not present px values. The browser may apply the deterministic `reading mode → body baseline → unpinned role sizes` dependency locally, while manual size edits pin visible values. It never regenerates Stage 2. Stage 3 is authored once and contains production mechanics only: conditional AI acquisition, formula policy, generation mode, and spec refinement. The compatibility key `delivery_purpose` means reading mode. Generated images inherit the selected deck color roles directly; there is no independent image-palette choice. The final visible state in `confirm_ui/result.json` is authoritative—there is no hidden post-confirm repair—and project validation requires the six contract key lines under `spec_lock.md ## communication` (any prose value may be blank) plus an `Audience move` in every §IX Slide block.+**Strategist confirmation stage as the only blocking gate.** Strategist ends with one gate delivered in three dependency-ordered stages. Stage 1 confirms an open communication contract and canvas. Its prose boxes contain editable recommendations, but none requires a non-empty answer: confirmation persists the current text exactly, and a cleared value stays empty instead of falling back to the recommendation. Stage 2 is authored once from that contract and confirms the complete deck solution: reading mode, narrative mode, page count, coordinated visual system, image sources, and generated-image rendering. When a template is installed, Strategist also derives its page/prototype application plan from the actual workspace and current content and exposes that plan as editable natural-language prose; only the internal reuse/adherence modes stay hidden. Reading mode decides how meaning is carried by page, visuals, presenter, and notes; its cards do not present px values. The browser may apply the deterministic `reading mode → body baseline → unpinned role sizes` dependency locally, while manual size edits pin visible values. It never regenerates Stage 2. Stage 3 is authored once and contains production mechanics only: conditional AI acquisition, formula policy, generation mode, and spec refinement. The compatibility key `delivery_purpose` means reading mode. Generated images inherit the selected deck color roles directly; there is no independent image-palette choice. The final visible state in `confirm_ui/result.json` is authoritative—there is no hidden post-confirm repair—and project validation requires the six contract key lines under `spec_lock.md ## communication` (any prose value may be blank) plus an `Audience move` in every §IX Slide block.**Image analysis goes through regenerated metadata, not pixels.** When images exist, Strategist and Executor use `analyze_images.py` output (`analysis/image_analysis.csv`) rather than directly opening image files. The CSV is a regenerated view over the live `images/` folder, not a durable cache. Re-running it before image-sensitive decisions is the staleness strategy: user images, extracted images, web images, AI outputs, formulas, and sliced elements all converge into the same measured fact table.diff --git a/docs/zh/technical-design.md b/docs/zh/technical-design.mdindex 96bf80d1..070cde44 100644--- a/docs/zh/technical-design.md+++ b/docs/zh/technical-design.md@@ -344,7 +344,7 @@ PPT Master 用的是**单主代理内的角色切换**,不是并行子代理**为什么是角色专属 reference 而不是一个超大 prompt。** Strategist 跑的是「跟用户协商」模式(开放式、对话式、可以回退),Executor 跑的是「产出严格 XML」模式(不准即兴、不准漏属性)。把两者塞进同一个 prompt,强迫模型在同一个 turn 里持守相互矛盾的纪律——所有混合模式的 prompt 工程病灶都会出现。按角色拆开,每个角色只加载它需要的、扔掉其他。-**策略师确认阶段是唯一的阻塞 gate。** Strategist 阶段以一个按依赖排序的三阶段 gate 作为核心决策点。第一阶段确认开放式沟通契约与画布。其中的文本框承载可编辑推荐,但没有任何一项要求非空:确认时按当前文本原样保存,清空后的值保持为空,不会回退到推荐内容。第二阶段只从该契约计算一次并确认完整 PPT 方案:阅读模式、叙事 mode、页数、成套视觉系统、图片来源和生成图渲染。存在模板时,Strategist 还会根据真实工作区和当前内容在内部推导页面/原型应用计划,UI 不提供模板模式控件。阅读模式决定信息由页面、视觉、讲者和备注如何共同承担,其选项卡不展示 px 数值。浏览器可以在本地执行确定性的「阅读模式 → 正文基准 → 未锁定角色字号」联动;手动编辑字号即锁定可见值,不会重新计算第二阶段。第三阶段也只计算一次,并且只处理生产机制:条件式 AI 图片获取路径、公式策略、生成模式与规范精修。JSON 为兼容保留 `delivery_purpose` 键,但用户侧统一称为阅读模式。生成图直接继承已选 PPT 色彩角色,不再单设图片调色选择。最终 `confirm_ui/result.json` 中的可见状态是权威输入,不存在确认后的隐藏修正;项目校验还会要求 `spec_lock.md ## communication` 下存在六个沟通契约键(任一文本值都允许留空),并要求 §IX 每个 Slide block 都有 `Audience move`。+**策略师确认阶段是唯一的阻塞 gate。** Strategist 阶段以一个按依赖排序的三阶段 gate 作为核心决策点。第一阶段确认开放式沟通契约与画布。其中的文本框承载可编辑推荐,但没有任何一项要求非空:确认时按当前文本原样保存,清空后的值保持为空,不会回退到推荐内容。第二阶段只从该契约计算一次并确认完整 PPT 方案:阅读模式、叙事 mode、页数、成套视觉系统、图片来源和生成图渲染。存在模板时,Strategist 还会根据真实工作区和当前内容推导页面/原型应用计划,并以可编辑的自然语言文本展示;只有内部复用/遵循模式保持隐藏。阅读模式决定信息由页面、视觉、讲者和备注如何共同承担,其选项卡不展示 px 数值。浏览器可以在本地执行确定性的「阅读模式 → 正文基准 → 未锁定角色字号」联动;手动编辑字号即锁定可见值,不会重新计算第二阶段。第三阶段也只计算一次,并且只处理生产机制:条件式 AI 图片获取路径、公式策略、生成模式与规范精修。JSON 为兼容保留 `delivery_purpose` 键,但用户侧统一称为阅读模式。生成图直接继承已选 PPT 色彩角色,不再单设图片调色选择。最终 `confirm_ui/result.json` 中的可见状态是权威输入,不存在确认后的隐藏修正;项目校验还会要求 `spec_lock.md ## communication` 下存在六个沟通契约键(任一文本值都允许留空),并要求 §IX 每个 Slide block 都有 `Audience move`。**图片分析走重算元数据,不读像素。** 当项目里存在图片时,Strategist 和 Executor 使用 `analyze_images.py` 的输出(`analysis/image_analysis.csv`),而不是直接打开图片文件。这个 CSV 是基于当前 `images/` 目录重算出来的视图,不是持久缓存。每次做图片敏感决策前重跑分析,就是它的防陈旧策略:用户图、抽取图、网络图、AI 图、公式图和切片图最终都会汇入同一张可度量事实表。diff --git a/skills/ppt-master/references/strategist-template.md b/skills/ppt-master/references/strategist-template.mdindex 8148b385..30aa2240 100644--- a/skills/ppt-master/references/strategist-template.md+++ b/skills/ppt-master/references/strategist-template.md@@ -41,7 +41,11 @@ Record the resulting exporter plan internally:| `template_adherence: strict` | Every structured page fits an existing prototype contract without changing its Layout identity or slot topology. Mandatory for `template_reuse_scope: mirror`. || `template_adherence: adaptive` | Structured reuse remains useful, but at least one page needs a new explicit Layout under the selected Master. |-Write the derived values to `design_spec.md §I` and `spec_lock.md pptx_structure`; omit `template_adherence` for `style`. Do not put these values in `recommendations.json`, the Confirm UI, or `result.json`. Stage 2 may summarize the selected page/prototype plan as part of the complete deck solution, but it must not reopen template use as a separate user control.+Write the derived values to `design_spec.md §I` and `spec_lock.md pptx_structure`; omit `template_adherence` for `style`. Do not put these values in `recommendations.json`, the Confirm UI, or `result.json`.++**Mandatory — natural-language Stage-2 plan**: Include one concise natural-language summary of the template application in the complete Stage-2 solution: which pages/prototypes are used, skipped, repeated, or reordered; what remains literal; and what may be replaced or reorganized. Write it to top-level `template_application.value` in Stage-2 `recommendations.json`; omit the field when no template workspace is active. The Confirm UI returns the user's current text as `template_application`. After Stage 2, re-read that confirmed value from `result.json` (or the exact chat answer in chat fallback) before deriving `template_reuse_scope`, `template_adherence`, §IX page plans, and structure mappings; never reuse the initial recommendation after the user edits or clears it. Blank means no explicit user constraint and returns the decision to Strategist. Do not add a template questionnaire, expose internal values, or turn the summary into fixed template-use options.++**Three-stage boundary**: An installed template changes the content of Stage 2, never the confirmation sequence. Run Stage 1 → Stage 2 → Stage 3 in order in both Confirm UI and chat fallback; do not skip a stage or treat template inspection as user confirmation. On browser timeout, return to the same stage in chat.---diff --git a/skills/ppt-master/references/strategist.md b/skills/ppt-master/references/strategist.mdindex 5622758e..c399a209 100644--- a/skills/ppt-master/references/strategist.md+++ b/skills/ppt-master/references/strategist.md@@ -29,10 +29,10 @@ As a top-tier AI presentation strategist, receive source documents, perform cont| Stage | Items | Role ||---|---|---|| **1 — communication contract** | `c` audience · open-ended communication intent · audience outcome · core message / delivery context / artifact afterlife · `content_divergence` (all prose fields may be blank) · `a` canvas | confirmed first |-| **2 — complete deck solution** (authored once from the user's *actual* Stage 1) | reading mode (`delivery_purpose`, PPT only) · `d` mode + visual style · `b` page count · `e` color · `f` icon · `g` typography · `h` image source + generated-image rendering | derived from the confirmed contract; when a template is installed, AI also authors its page/prototype application plan internally |+| **2 — complete deck solution** (authored once from the user's *actual* Stage 1) | reading mode (`delivery_purpose`, PPT only) · `d` mode + visual style · `b` page count · `e` color · `f` icon · `g` typography · `h` image source + generated-image rendering · conditional natural-language template application | derived from the confirmed contract; internal template exporter modes remain hidden || **3 — resources / production** (authored once from the user's *actual* Stage 1 + Stage 2) | formula policy · conditional AI-image acquisition path · generation mode · refine-spec toggle | derived from the confirmed solution |-Do not force communication intent into one catalog label. A deck may report progress, expose risk, and request a decision in the same artifact; Stage 1 records that relationship in prose. Its editable prose fields are recommendation drafts, not required inputs: confirmation accepts the current text exactly, including blanks, and a cleared field must not be repopulated later. Stage 2 then confirms one complete solution: narrative spine, reading density, page budget, visual system, and image direction. When a template workspace is installed, Strategist also inspects its real prototypes and current content and authors the application plan automatically; template modes are not confirmation fields. Present ≥3 coordinated design directions (safe / shifted / bold) so color, type, icons, and generated-image rendering begin coherent; the user may still override each component. Generated images inherit the selected deck colors directly—there is no second image-palette confirmation. Stage 3 asks only how to produce the locked solution. **Page count is derived, not an anchor**—it follows content volume × desired audience outcome × reading mode. Author each stage once: same-stage edits update only visible browser state through documented deterministic dependencies and never trigger a new AI / backend recommendation. The launch / derive / wait mechanics live in [`generate-pptx.md`](../workflows/generate-pptx.md) Step 4; the item specs below keep their `a`–`h` letters.+Do not force communication intent into one catalog label. A deck may report progress, expose risk, and request a decision in the same artifact; Stage 1 records that relationship in prose. Its editable prose fields are recommendation drafts, not required inputs: confirmation accepts the current text exactly, including blanks, and a cleared field must not be repopulated later. Stage 2 then confirms one complete solution: narrative spine, reading density, page budget, visual system, and image direction. When a template workspace is installed, Strategist also inspects its real prototypes and current content, presents one editable natural-language application plan, and keeps only exporter reuse/adherence values internal. Present ≥3 coordinated design directions (safe / shifted / bold) so color, type, icons, and generated-image rendering begin coherent; the user may still override each component. Generated images inherit the selected deck colors directly—there is no second image-palette confirmation. Stage 3 asks only how to produce the locked solution. **Page count is derived, not an anchor**—it follows content volume × desired audience outcome × reading mode. Author each stage once: same-stage edits update only visible browser state through documented deterministic dependencies and never trigger a new AI / backend recommendation. The launch / derive / wait mechanics live in [`generate-pptx.md`](../workflows/generate-pptx.md) Step 4; the item specs below keep their `a`–`h` letters.> **Execution discipline**: This is the last BLOCKING checkpoint in the pipeline. After confirmation, complete the Design Spec and proceed to image generation / SVG / post-processing without further pauses.>@@ -131,7 +131,7 @@ The deck's **visual aesthetic** — shape language, decoration density, whitespaWrite the locked value to `spec_lock.md` `- visual_style:` and the rationale to `design_spec.md`. Executor loads only that one visual-style file.-**Conditional template workspace**: When Generate Step 3 installed an explicit workspace path into `<project_path>/templates/`, read [`strategist-template.md`](./strategist-template.md) before completing Stage 2. It owns AI-authored prototype selection, internal reuse/adherence derivation, inherited design precedence, and structured-lock planning. Bare names, style words, and free-design projects do not trigger it.+**Conditional template workspace**: When Generate Step 3 installed an explicit workspace path into `<project_path>/templates/`, read [`strategist-template.md`](./strategist-template.md) before completing Stage 2. It owns the editable natural-language application plan, confirmed-value consumption, AI-authored prototype selection, internal reuse/adherence derivation, inherited design precedence, and structured-lock planning. Bare names, style words, and free-design projects do not trigger it.**Downstream effect**: e / f / g / h realize the locked mode + visual style. Example: `showcase` + `dark-tech` → e applies one luminous accent on a dark field; g pairs a clean sans with mono; f minimal glow icons; h the `digital-dashboard` rendering.diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.pyindex 8963f619..62f49171 100644--- a/skills/ppt-master/scripts/confirm_ui/server.py+++ b/skills/ppt-master/scripts/confirm_ui/server.py@@ -106,7 +106,6 @@ STARTUP_TIMEOUT = 10# result.json before falling back to chat.WAIT_TIMEOUT_DEFAULT = 590-def _read_json_object(path: Path, retries: int = 2, delay: float = 0.08) -> dict:"""Read a JSON object, retrying briefly around non-atomic external writes."""last_error: Exception = ValueError('unknown JSON read error')@@ -261,6 +260,15 @@ def _wait_for_result(if result_file.exists():try:if result_file.stat().st_mtime >= started_at:+ actual_stage = _result_stage(result_file)+ expected_stage = _expected_result_stage(result_file.parent)+ if actual_stage != expected_stage:+ logger.error(+ 'confirmation stage mismatch: expected %s, found %s',+ expected_stage,+ actual_stage or 'invalid/absent',+ )+ return 2logger.info('confirmation received: %s', result_file)try:proc.wait(timeout=3)@@ -389,6 +397,104 @@ def _stage_skip_error(confirm_dir: Path) -> Optional[str]:)+def _template_confirmation_required(project_path: Path, recommendations: dict) -> bool:+ """Return whether this project must use the staged template confirmation."""+ return (+ 'template_application' in recommendations+ or (project_path / 'templates' / 'design_spec.md').is_file()+ )+++def _template_stage2_error(+ recommendations: dict,+ *,+ template_required: bool,+) -> Optional[str]:+ """Require the natural-language template plan in template Stage 2."""+ if template_required and 'template_application' not in recommendations:+ return (+ 'template Stage 2 recommendations must include '+ 'template_application.value'+ )+ return None+++def _submission_stage_error(+ project_path: Path,+ confirm_dir: Path,+ submitted_stage: Optional[str],+) -> Optional[str]:+ """Reject a confirmation that does not match the staged recommendation."""+ try:+ recommendations = _read_json_object(confirm_dir / RECOMMENDATIONS_NAME)+ except (OSError, json.JSONDecodeError, ValueError) as exc:+ return f'cannot confirm without valid recommendations.json: {exc}'++ rec_stage_number = _recommendation_stage(recommendations)+ template_required = _template_confirmation_required(+ project_path,+ recommendations,+ )+ if rec_stage_number == 0:+ if template_required:+ return (+ 'an installed template requires the Stage 1 → Stage 2 → Stage 3 '+ 'flow; legacy single-pass confirmation is not allowed'+ )+ if submitted_stage not in {None, 'stage3', 'final'}:+ return 'legacy single-pass recommendations accept only a final submission'+ return None++ if rec_stage_number == 2:+ recommendation_error = _template_stage2_error(+ recommendations,+ template_required=template_required,+ )+ if recommendation_error:+ return recommendation_error++ allowed_submissions = {+ 1: {'stage1'},+ 2: {'stage2'},+ 3: {'stage3', 'final'},+ }+ if submitted_stage not in allowed_submissions[rec_stage_number]:+ expected = 'final' if rec_stage_number == 3 else _stage_name(rec_stage_number)+ return (+ f'confirmation stage mismatch: recommendations.json is '+ f'{_stage_name(rec_stage_number)}, so the submitted stage must be '+ f'{expected}'+ )++ previous_stage = _result_stage(confirm_dir / RESULT_NAME)+ allowed_predecessors = {+ 1: {None, 'stage1', 'stage2', 'final'},+ 2: {'stage1', 'stage2'},+ 3: {'stage2', 'final'},+ }+ if previous_stage not in allowed_predecessors[rec_stage_number]:+ expected_previous = 'stage1' if rec_stage_number == 2 else 'stage2'+ return (+ f'confirmation predecessor mismatch: {_stage_name(rec_stage_number)} '+ f'requires a confirmed {expected_previous} result, found '+ f'{previous_stage or "absent"}'+ )+ return None+++def _expected_result_stage(confirm_dir: Path) -> str:+ """Return the result stage expected from the current recommendations."""+ try:+ recommendations = _read_json_object(confirm_dir / RECOMMENDATIONS_NAME)+ except (OSError, json.JSONDecodeError, ValueError):+ return 'final'+ return {+ 1: 'stage1',+ 2: 'stage2',+ 3: 'final',+ }.get(_recommendation_stage(recommendations), 'final')++def _file_version(path: Path) -> Optional[float]:"""Return a cheap file version for polling state, or None when absent."""try:@@ -559,6 +665,10 @@ def _merge_confirmed_choices(data: dict, result_file: Path) -> None:data['page_count'] = {'value': res.get('page_count') or ''}if 'image_notes' in res:data['image_notes'] = {'value': res.get('image_notes') or ''}+ if 'template_application' in res:+ data['template_application'] = {+ 'value': res.get('template_application') or '',+ }if isinstance(res.get('color'), dict):data['color'] = {'selected': 0, 'candidates': [res['color']]}if isinstance(res.get('typography'), dict):@@ -641,9 +751,17 @@ def _wait_only_for_result(logger.info('waiting for browser confirmation stage=%s...', target_stage)deadline = None if timeout <= 0 else time.time() + timeoutwhile True:- if _result_stage(result_file) == target_stage:+ current_stage = _result_stage(result_file)+ if current_stage == target_stage:logger.info('confirmation stage=%s received: %s', target_stage, result_file)return 0+ if _result_stage_number(current_stage) > _result_stage_number(target_stage):+ logger.error(+ 'confirmation skipped expected stage=%s and advanced to %s',+ target_stage,+ current_stage,+ )+ return 2skip_error = _stage_skip_error(result_file.parent)if skip_error:@@ -951,6 +1069,16 @@ def create_app(rec_stage_number = _recommendation_stage(data)if rec_stage_number >= 2 and result_file.exists():_merge_confirmed_choices(data, result_file)+ if rec_stage_number == 2:+ recommendation_error = _template_stage2_error(+ data,+ template_required=_template_confirmation_required(+ project_path,+ data,+ ),+ )+ if recommendation_error:+ return jsonify({'error': recommendation_error}), 409# Template application is authored by Strategist from the installed# workspace and current content. Never expose legacy mode fields as# user-facing confirmation controls.@@ -976,17 +1104,27 @@ def create_app(confirm_dir.mkdir(parents=True, exist_ok=True)result = dict(payload)result_file = confirm_dir / RESULT_NAME+ raw_stage = result.get('stage')+ stage = _stage_key(raw_stage)+ if raw_stage is not None and stage is None:+ return jsonify({'error': 'invalid confirmation stage'}), 400+ stage_error = _submission_stage_error(+ project_path,+ confirm_dir,+ stage,+ )+ if stage_error:+ return jsonify({'error': stage_error}), 409locked_values = _apply_locked_recommendations(result,confirm_dir / RECOMMENDATIONS_NAME,result_file,)- stage = _stage_key(result.get('stage'))result.pop('template_reuse_scope', None)result.pop('template_adherence', None)# Staged flow: Stage 1 / Stage 2 submits record intermediate choices but do# NOT close the page. Only a final submit is a full confirmation. A- # payload with no stage is a single-pass confirmation (chat-opt-out parity).+ # payload with no stage is a legacy free-design single-pass confirmation.if stage in {'stage1', 'stage2'}:result['stage'] = stageresult['status'] = f'{stage}-confirmed'diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.jsindex 0cb1978c..e390580c 100644--- a/skills/ppt-master/scripts/confirm_ui/static/app.js+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js@@ -2,7 +2,8 @@* Stage 1 captures the communication contract, Stage 2 confirms a coherent* deck solution, and Stage 3 resolves production mechanics. Finite fields use* /static/catalogs.json; coordinated design directions seed color, typography,- * icons, and generated-image rendering. Final confirm saves result.json.+ * icons, generated-image rendering, and conditional template-application prose.+ * Final confirm saves result.json.*/(function () {"use strict";@@ -42,6 +43,9 @@sec_refine: "Refine spec first",sec_design_directions: "Coherent design directions",design_directions_hint: "Each direction coordinates style, color, typography, icons, and generated-image rendering. You can fine-tune every field below.",+ sec_template_application: "Template application",+ template_application_hint: "The AI recommends how to apply the installed template to this deck. Revise the plan directly in natural language.",+ placeholder_template_application: "Describe which template pages or prototypes to use, skip, repeat, or reorder; what must stay; and what may be replaced or reorganized.",sub_mode: "Narrative mode",sub_visual: "Visual style",sub_divergence: "Material divergence (how freely to reshape vs. stay close to the source)",@@ -172,6 +176,9 @@sec_refine: "先に設計仕様を精査",sec_design_directions: "統合デザイン方針",design_directions_hint: "各案はスタイル、配色、書体、アイコン、生成画像のレンダリングを一体で提案します。下の各項目で微調整できます。",+ sec_template_application: "テンプレートの適用方法",+ template_application_hint: "AIが現在の内容に合わせたテンプレートの使い方を提案します。自然言語で直接修正できます。",+ placeholder_template_application: "使用・省略・反復・並べ替えするページやプロトタイプ、保持する要素、差し替え・再構成できる内容を記述します。",sub_mode: "ナラティブモード",sub_visual: "ビジュアルスタイル",sub_divergence: "素材からの発散度(どこまで自由に再構成するか、原文に忠実か)",@@ -302,6 +309,9 @@sec_refine: "先精修设计规范",sec_design_directions: "成套设计方向",design_directions_hint: "每套方向会一起协调风格、配色、字体、图标和生成图渲染;你仍可在下方逐项微调。",+ sec_template_application: "模板应用方式",+ template_application_hint: "AI 会根据当前内容推荐如何使用已安装模板;你可以直接用自然语言修改。",+ placeholder_template_application: "说明使用、跳过、重复或重排哪些模板页面/原型,哪些内容必须保留,哪些可以替换或重组。",sub_mode: "叙事模式",sub_visual: "视觉风格",sub_divergence: "材料发散度(多大程度重塑,还是贴近源材料)",@@ -1144,6 +1154,26 @@host.appendChild(sec);}+ function templateApplicationRecommendation() {+ if (!REC || REC.template_application == null) return null;+ var field = REC.template_application;+ if (typeof field === "object") {+ return field.value == null ? "" : String(field.value);+ }+ return String(field);+ }++ function renderTemplateApplication(host) {+ if (templateApplicationRecommendation() == null) return;+ var sec = section("T", "sec_template_application");+ setSectionNote(sec, t("template_application_hint"));+ textareaField(sec,+ function () { return STATE.template_application; },+ function (v) { STATE.template_application = v; },+ "placeholder_template_application", 4);+ host.appendChild(sec);+ }+function renderCommunication(host) {var sec = section(1, "sec_communication");var audienceField = el("div", "subfield");@@ -2324,6 +2354,7 @@if (previewHost) renderImageStrategyPreview(previewHost);// Stage 2 confirms one coherent deck solution. Bundles provide a// coordinated starting point; individual controls remain editable.+ renderTemplateApplication(host);renderDesignDirections(host);renderNarrativeDirection(host);renderVisualDirection(host);@@ -2350,6 +2381,7 @@renderCommunication(host);renderDelivery(host);renderCanvas(host);+ renderTemplateApplication(host);renderDesignDirections(host);renderNarrativeDirection(host);renderVisualDirection(host);@@ -2412,6 +2444,12 @@// across the single-session transition — this never resets the contract.function initStage2State() {resetTypographySizeOverrides();+ var templateApplication = templateApplicationRecommendation();+ if (templateApplication != null) {+ STATE.template_application = templateApplication;+ } else if (stageNumber(REC) === 2) {+ delete STATE.template_application;+ }// Reading mode is a design-density tool, not part of the communication// purpose. Keep the legacy delivery_purpose key for JSON compatibility.STATE.delivery_purpose = recId("delivery_purpose") ||@@ -2513,6 +2551,9 @@function stage2Payload() {var payload = communicationPayload();payload.stage = "stage2";+ if (Object.prototype.hasOwnProperty.call(STATE, "template_application")) {+ payload.template_application = STATE.template_application;+ }payload.mode = STATE.mode;payload.visual_style = STATE.visual_style;payload.page_count = STATE.page_count;diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.mdindex 495a0aa5..a86395a8 100644--- a/skills/ppt-master/scripts/docs/confirm_ui.md+++ b/skills/ppt-master/scripts/docs/confirm_ui.md@@ -1,6 +1,6 @@# Confirm UI — Strategist Confirmation Stage Page-> The interactive, visual surface for [`generate-pptx`](../../workflows/generate-pptx.md) Step 4. Stage 1 is an open communication brief: common purpose paths are prompt text, never checkboxes or a forced single label. Stage 2 offers **≥3 coordinated design directions** and then exposes their component values for deliberate override; color, typography, icons, and generated-image rendering are one system rather than unrelated grids. Generated images inherit the selected deck colors directly—there is no image-palette control. Stage 3 contains production mechanics only. The AI writes `recommendations.json`; confirmed values accumulate into `result.json`. Final confirm saves the result and shuts the server down. The chat path mirrors the same staged semantics.+> The interactive, visual surface for [`generate-pptx`](../../workflows/generate-pptx.md) Step 4. Stage 1 is an open communication brief: common purpose paths are prompt text, never checkboxes or a forced single label. Stage 2 offers **≥3 coordinated design directions** and then exposes their component values for deliberate override; color, typography, icons, and generated-image rendering are one system rather than unrelated grids. When a template workspace is active, Stage 2 also shows one editable natural-language template-application plan—never internal mode controls. Generated images inherit the selected deck colors directly—there is no image-palette control. Stage 3 contains production mechanics only. The AI writes `recommendations.json`; confirmed values accumulate into `result.json`. Final confirm saves the result and shuts the server down. The chat path mirrors the same staged semantics.## Authority and Scope@@ -40,7 +40,7 @@ python3 scripts/confirm_ui/server.py <project_path> --shutdown # Step 4 clean- Refuses to start unless `<project_path>/confirm_ui/recommendations.json` exists (except `--shutdown`, which needs no recommendations).- Per-project lock at `<project_path>/.confirm_ui.lock` — duplicate launches are refused; stale locks (dead pid) are overwritten.- Idle auto-shutdown after 900 s by default; `/api/shutdown` exits gracefully and releases the lock.-- `/api/recommendations` and `/api/confirm` strip legacy `template_reuse_scope` and `template_adherence` fields. Template application is authored by Strategist from the installed workspace and current content; it is not a user-facing confirmation control.+- `/api/recommendations` and `/api/confirm` strip legacy `template_reuse_scope` and `template_adherence` fields. Those exporter values are never user-facing controls; an active template instead exposes the editable natural-language `template_application` field in Stage 2.Dependency:@@ -78,13 +78,13 @@ The page runs as a **three-stage wizard in one browser session**. `recommendatio| `recommendations.json stage` | Page renders | Button | On submit ||---|---|---|---|| `"stage1"` | communication contract — audience; open `communication_intent`; audience outcome; core message / delivery context / artifact afterlife / `content_divergence` (all prose fields may be blank); canvas | **Confirm contract & continue** | writes `result.json` `{ stage: "stage1", status: "stage1-confirmed", <communication contract> }`; the page stays open and polls |-| `"stage2"` | complete deck solution — reading mode, mode, page count, visual direction, color, icons, typography, image usage, generated-image rendering | **Confirm solution & continue** | writes `result.json` `{ stage: "stage2", status: "stage2-confirmed", <contract + solution> }`; the page stays open and polls |+| `"stage2"` | complete deck solution — conditional natural-language template application, reading mode, mode, page count, visual direction, color, icons, typography, image usage, generated-image rendering | **Confirm solution & continue** | writes `result.json` `{ stage: "stage2", status: "stage2-confirmed", <contract + solution> }`; the page stays open and polls || `"stage3"` | production only — confirmed image-source summary, conditional AI acquisition path, formula policy, generation mode, refine spec | **Confirm** | writes `result.json` `{ stage: "final", status: "confirmed", <all fields> }`, then shuts the page down |-| *(absent)* | legacy single-pass — every section on one page | **Confirm** | single final write (`status: "confirmed"`) — backward-compatible |+| *(absent)* | legacy free-design single-pass — every section on one page | **Confirm** | single final write (`status: "confirmed"`) — backward-compatible only when no template workspace / `template_application` is active |The AI launches Stage 1, authors the complete Stage-2 solution once from the user's actual contract, then authors Stage-3 production mechanics once from the confirmed solution. An edit inside the current stage never requests another recommendation. The page preserves earlier answers across transitions. `GET /api/session` is the waiting-state endpoint; `GET /api/recommendations` is `no-store`, and the server folds confirmed earlier-stage choices back into later payloads so refresh / reopen restores the user's actual values—including Stage-2 color, typography, icon, image-source, and rendering choices.-**Stage progression guard.** Stages confirm strictly in order — a staged `recommendations.json` may only run **one** stage past the last confirmed result. A file that skips ahead (e.g. `"stage3"` while only Stage 1 is confirmed) is never rendered: `/api/session` keeps reporting `waiting_agent` with `stage_skip: true`, and `--wait` / `--wait-only` exit `2` with a directive log line naming the expected stage to rewrite. An active deck/layout template does not exempt Stage 2: Strategist still derives its internal page/prototype plan from the confirmed communication contract. Legacy single-pass files (no `stage`) are not staged and bypass the guard.+**Stage progression guard.** Stages confirm strictly in order — a staged `recommendations.json` may only run **one** stage past the last confirmed result, and `/api/confirm` accepts only the submit stage matching that file plus its required predecessor. A file that skips ahead (e.g. `"stage3"` while only Stage 1 is confirmed) is never rendered: `/api/session` keeps reporting `waiting_agent` with `stage_skip: true`, and `--wait` / `--wait-only` exit `2` if a result skips the stage being awaited. An active template does not exempt Stage 2: its Stage-2 recommendations must include `template_application.value`, and an installed workspace or that field disables the no-stage legacy single-pass path. Legacy single-pass remains available only for non-template compatibility payloads.### Input — `recommendations.json` (written by Strategist before launch)@@ -132,6 +132,9 @@ After Stage 1 is confirmed, overwrite the file with the complete Stage-2 solutio"image_usage": ["ai", "provided"]},"page_count": { "value": "12-15" },+ "template_application": {+ "value": "选用封面、章节页和数据页原型;跳过示例内容页。品牌标识和页脚保留,正文可按当前材料重组。"+ },"image_notes": { "value": "封面和章节页用 AI 主视觉;产品页优先用户素材。" },"design_directions": {"selected": 0,@@ -184,6 +187,7 @@ After Stage 2 is confirmed, overwrite it with Stage-3 production recommendations- `recommend.*` names the recommended `id` for each enumerable field (must match a `catalogs.json` id, or be a free string for a recommended custom value). The page badges and pre-selects it. **Guarantee**: if a `recommend.*` is omitted, the page falls back to the first catalog option so every enumerable field always shows one badged recommendation — but the AI should still set them for a meaningful default. Legacy aliases are accepted for old files (`line` → `tabler-outline`, `filled` → `tabler-filled`, `monochrome` → `chunk-filled`, `search` → `web`, `default` → `auto`, `builtin` → `host-native`), but new files should write canonical ids.- `audience`, `communication_intent`, and `audience_outcome` are load-bearing Stage-1 reasoning inputs, so seed concrete recommendations when the evidence supports them; they are not required user inputs. Every Stage-1 prose field may be blank after confirmation, while the six communication keys remain present as key lines in `spec_lock.md communication`. `communication_intent` may preserve several purposes plus priority / sequence; never add a `primary_job` enum.- Do not write `recommend.template_reuse_scope` or `recommend.template_adherence`. Strategist records those internal exporter values later in `design_spec.md` / `spec_lock.md` after inspecting the actual template and current content.+- For an active template workspace, write one editable prose field as top-level `template_application.value`. It summarizes actual page/prototype use and preservation/reorganization decisions. Omit it for free design. The UI returns the current string through Stage 2, Stage 3, and final confirmation; never replace it with internal reuse/adherence ids or a fixed option menu.- `recommend.image_usage` should be an array of source ids when more than one source applies, e.g. `["ai", "provided"]`. A single string is still accepted for backward compatibility. Do not write bare `"custom"` and do not encode a mixed-source plan as prose here; write the prose to top-level `image_notes.value`.- `image_notes` is the initial strategy note shown under the image source chips. Use it for page-role guidance and constraints: which source applies where, what to avoid, which user assets are authoritative, how realistic / abstract the imagery should be, and what can remain as placeholders. It is intent guidance, not a separate finite option.- When confirmed Stage-2 `image_usage` includes `ai`, Stage 3 sets `recommend.image_ai_path` to one of `auto` / `api` / `host-native` / `manual`. Stage 2 never asks for the acquisition mechanism while the user is still deciding the image role.@@ -212,6 +216,7 @@ After Stage 2 is confirmed, overwrite it with Stage-3 production recommendations"delivery_context": "Presenter-led 20-minute leadership review; recording shared afterward","artifact_afterlife": "Approval record, hand-off reference, and audit trail","content_divergence": "freely restructure and expand within the source",+ "template_application": "选用封面、章节页和数据页原型;跳过示例内容页。品牌标识和页脚保留,正文可按当前材料重组。","mode": "pyramid","visual_style": "swiss-minimal","color": { "name": "...", "palette": { "background": "#...", "secondary_bg": "#...", "primary": "#...", "accent": "#...", "secondary_accent": "#...", "body_text": "#..." } },