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
fix(confirm-ui): enforce Stage 2 production controls
hugohe34c6b17d2d8f7
diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.pyindex 031efbe2..ed5adf4e 100644--- a/skills/ppt-master/scripts/confirm_ui/server.py+++ b/skills/ppt-master/scripts/confirm_ui/server.py@@ -1217,6 +1217,9 @@ def _read_active_recommendations(f'{filename} must be authored after the current ''Stage-1 confirmation')+ production_error = _stage2_production_recommendations_error(data)+ if production_error:+ raise ValueError(production_error)breakreturn rec_file, data@@ -1272,6 +1275,54 @@ def _uses_ai_images(recommendations: dict) -> bool:return 'ai' in usage if isinstance(usage, list) else usage == 'ai'+def _stage2_production_recommendations_error(+ recommendations: dict,+) -> Optional[str]:+ """Require every production control in current Stage 2 recommendations."""+ recommend = recommendations.get('recommend')+ if not isinstance(recommend, dict):+ recommend = {}+ for field in ('formula_policy', 'generation_mode'):+ value = recommend.get(field)+ if not isinstance(value, str) or not value.strip():+ return (+ 'Stage 2 recommendations must include non-empty '+ f'recommend.{field}'+ )+ refine_spec = recommendations.get('refine_spec')+ if (+ not isinstance(refine_spec, dict)+ or not isinstance(refine_spec.get('value'), bool)+ ):+ return 'Stage 2 recommendations must include refine_spec.value as a boolean'+ if _uses_ai_images(recommendations):+ image_ai_path = recommend.get('image_ai_path')+ if not isinstance(image_ai_path, str) or not image_ai_path.strip():+ return (+ 'Stage 2 recommendations must include non-empty '+ 'recommend.image_ai_path when image_usage includes ai'+ )+ return None+++def _stage2_production_result_error(result: dict) -> Optional[str]:+ """Require every user-confirmed production control in the final payload."""+ for field in ('formula_policy', 'generation_mode'):+ value = result.get(field)+ if not isinstance(value, str) or not value.strip():+ return f'final Stage 2 payload must include non-empty {field}'+ if not isinstance(result.get('refine_spec'), bool):+ return 'final Stage 2 payload must include refine_spec as a boolean'+ if _uses_ai_images(result):+ image_ai_path = result.get('image_ai_path')+ if not isinstance(image_ai_path, str) or not image_ai_path.strip():+ return (+ 'final Stage 2 payload must include non-empty image_ai_path '+ 'when image_usage includes ai'+ )+ return None++def _palette_error(color: object, label: str) -> Optional[str]:"""Validate one complete user-facing palette."""if not isinstance(color, dict):@@ -1574,14 +1625,11 @@ def _submission_stage_error(confirm_dir: Path,submitted_stage: Optional[str],*,+ recommendations_file: Path,+ recommendations: dict,template_required: bool,) -> Optional[str]:"""Reject a confirmation that does not match the staged recommendation."""- try:- rec_file, recommendations = _read_active_recommendations(confirm_dir)- except (OSError, json.JSONDecodeError, ValueError) as exc:- return f'cannot confirm without valid current recommendations: {exc}'-rec_stage_number = _recommendation_stage(recommendations)if rec_stage_number == 0:return 'recommendations must declare stage1 or stage2'@@ -1631,7 +1679,7 @@ def _submission_stage_error(if submitted_stage not in allowed_submissions[rec_stage_number]:expected = 'final' if rec_stage_number == 2 else 'stage1'return (- f'confirmation stage mismatch: {rec_file.name} is '+ f'confirmation stage mismatch: {recommendations_file.name} is 'f'{_stage_name(rec_stage_number)}, so the submitted stage must be 'f'{expected}')@@ -1679,6 +1727,10 @@ def _stage2_solution_error(main_language: object = '',) -> Optional[str]:"""Reject a Stage 2/final payload with an incomplete design system."""+ production_error = _stage2_production_result_error(result)+ if production_error:+ return production_error+color = result.get('color')color_error = _palette_error(color, 'color')color_custom = (@@ -2616,9 +2668,22 @@ def create_app(return jsonify({'error': f'cannot determine active template mode: {exc}',}), 409+ try:+ rec_file, current_recommendations = _read_active_recommendations(+ confirm_dir,+ )+ except (OSError, json.JSONDecodeError, ValueError) as exc:+ return jsonify({+ 'error': (+ 'cannot confirm without valid current recommendations: '+ f'{exc}'+ ),+ }), 409stage_error = _submission_stage_error(confirm_dir,stage,+ recommendations_file=rec_file,+ recommendations=current_recommendations,template_required=template_required,)if stage_error:@@ -2626,13 +2691,6 @@ def create_app(custom_error = _custom_selection_error(result)if custom_error:return jsonify({'error': custom_error}), 400- try:- rec_file, current_recommendations = _read_active_recommendations(- confirm_dir,- )- except (OSError, json.JSONDecodeError, ValueError):- rec_file = _active_recommendations_path(confirm_dir)- current_recommendations = {}rec_stage_number = _recommendation_stage(current_recommendations)previous_result = {}if rec_stage_number >= 2:diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.mdindex 48f3e710..f96653a0 100644--- a/skills/ppt-master/scripts/docs/confirm_ui.md+++ b/skills/ppt-master/scripts/docs/confirm_ui.md@@ -415,6 +415,13 @@ The common paths — inform / explain / persuade / decide / align / teach / repoAfter Stage 1 is confirmed, create `recommendations.stage2.json` with the complete solution; leave Stage 1 unchanged (the server folds confirmed communication fields back in when serving the page):+**Stage-2 production contract**: the server rejects the recommendation file+unless `recommend.formula_policy`, `recommend.generation_mode`, and boolean+`refine_spec.value` are present; `recommend.image_ai_path` is additionally+required when `image_usage` includes `ai`. Final submission must retain the+corresponding direct values (`formula_policy`, `generation_mode`, boolean+`refine_spec`, and conditional `image_ai_path`) or confirmation is rejected.+```json{"stage": "stage2",diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.mdindex 4d45fa01..5185efb1 100644--- a/skills/ppt-master/workflows/generate-pptx.md+++ b/skills/ppt-master/workflows/generate-pptx.md@@ -418,7 +418,7 @@ For a new project, use the reference-first whole-document sequence:Final state → initial Design Spec mismatch, approved Design Spec/context → lock mismatch, or an unapplied revision blocks despite schema validity. `validate` does not prove fidelity. Repair from retained confirmation before refinement; during it, preserve unaffected values and apply explicit revisions. After approval, derive the lock from that Design Spec/context. Resume/refine edits existing files, never scaffolds. Fresh recovery alone may reread persisted final evidence once.-**✅ Internal checkpoint — Phase deliverables complete**: facts read; confirmation consumed once; Design Spec passed Gate 1; enabled refinement approved; lock derived from it; split handling resolved; communication and every §IX `Audience move` validated. Do not print this checklist; auto-proceed.+**✅ Internal checkpoint — Phase deliverables complete**: facts read; confirmation consumed once; final Stage-2 production fields resolved (formula policy, generation mode, refine-spec, proactive choices, and conditional AI path); Design Spec passed Gate 1; enabled refinement approved; lock derived from it; split handling resolved; communication and every §IX `Audience move` validated. Do not print this checklist; auto-proceed.---