Skip to content

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(workflows): add conditional production controls

hugohe3e815eb563e85
diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.py
index ca550ad7..a2d9a57f 100644
--- a/skills/ppt-master/scripts/confirm_ui/server.py
+++ b/skills/ppt-master/scripts/confirm_ui/server.py
@@ -971,9 +971,49 @@ _PRODUCTION_RECOMMEND_KEYS = (
'image_ai_path',
'generation_mode',
)
+_PROACTIVE_EXECUTION_DEFAULTS = {
+ 'proactive_speaker_notes': True,
+ 'proactive_custom_animations': False,
+ 'proactive_narration_audio': False,
+}
_LOCKED_RECOMMENDATIONS_KEY = '_locked_recommendations'
+def _resolve_proactive_execution_values(
+ source: dict,
+) -> tuple[dict[str, bool], Optional[str]]:
+ """Resolve proactive-execution booleans with backward-compatible defaults."""
+ values = {}
+ for key, default in _PROACTIVE_EXECUTION_DEFAULTS.items():
+ if key not in source:
+ values[key] = default
+ continue
+ raw_value = source[key]
+ if isinstance(raw_value, dict):
+ if 'value' not in raw_value or not isinstance(raw_value['value'], bool):
+ return {}, f'{key}.value must be a boolean'
+ raw_value = raw_value['value']
+ elif not isinstance(raw_value, bool):
+ return {}, f'{key} must be a boolean'
+ values[key] = raw_value
+ return values, None
+
+
+def _normalize_proactive_execution_result(
+ result: dict,
+ defaults: dict[str, bool],
+) -> Optional[str]:
+ """Write the independent raw confirmation booleans to the final result."""
+ values = {}
+ for key, default in defaults.items():
+ value = result.get(key, default)
+ if not isinstance(value, bool):
+ return f'{key} must be a boolean'
+ values[key] = value
+ result.update(values)
+ return None
+
+
def _merge_confirmed_choices(data: dict, result_file: Path) -> None:
"""Fold already-confirmed choices into later-stage recommendations."""
try:
@@ -1044,6 +1084,8 @@ def _merge_confirmed_choices(data: dict, result_file: Path) -> None:
recommend[key] = res[key]
if 'refine_spec' in res:
data['refine_spec'] = {'value': bool(res.get('refine_spec'))}
+ for key, default in _PROACTIVE_EXECUTION_DEFAULTS.items():
+ data[key] = {'value': res.get(key, default)}
def _apply_locked_recommendations(
@@ -1460,6 +1502,14 @@ def create_app(
recommendation_error = _stage2_design_directions_error(data)
if recommendation_error:
return jsonify({'error': recommendation_error}), 409
+ if rec_stage_number in {0, 3}:
+ proactive_values, proactive_error = (
+ _resolve_proactive_execution_values(data)
+ )
+ if proactive_error:
+ return jsonify({'error': proactive_error}), 409
+ for key, value in proactive_values.items():
+ data[key] = {'value': value}
# Template application is authored by Strategist from the installed
# workspace and current content. Never expose legacy mode fields as
# user-facing confirmation controls.
@@ -1509,6 +1559,20 @@ def create_app(
solution_error = _stage2_solution_error(result)
if solution_error:
return jsonify({'error': solution_error}), 400
+ if stage not in {'stage1', 'stage2'}:
+ proactive_defaults, proactive_recommendation_error = (
+ _resolve_proactive_execution_values(current_recommendations)
+ )
+ if proactive_recommendation_error:
+ return jsonify({
+ 'error': proactive_recommendation_error,
+ }), 409
+ proactive_result_error = _normalize_proactive_execution_result(
+ result,
+ proactive_defaults,
+ )
+ if proactive_result_error:
+ return jsonify({'error': proactive_result_error}), 400
_normalize_custom_selections(result)
locked_values = _apply_locked_recommendations(
result,
diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.js
index 3cb96e70..e8d330a0 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/app.js
+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js
@@ -39,6 +39,7 @@
sec_type: "Typography",
sec_images: "Image usage",
sec_image_production: "Image production",
+ sec_proactive_execution: "Proactive execution",
sec_mode: "Generation mode",
sec_refine: "Review the Design Spec first",
sec_design_directions: "Coherent design directions",
@@ -94,6 +95,13 @@
image_usage_notes_placeholder: "e.g. realistic handwashing scenes; avoid cartoon germs; keep product photos untouched.",
image_usage_required: "Select at least one image usage option.",
image_usage_none_exclusive: "No images cannot be combined with other image options.",
+ proactive_execution_hint: "These defaults apply only when you have not explicitly instructed otherwise. Your latest explicit instruction always takes priority.",
+ proactive_speaker_notes: "Proactively generate speaker notes",
+ proactive_speaker_notes_desc: "On by default. The agent generates speaker notes without a separate request.",
+ proactive_custom_animations: "Proactively create custom animations",
+ proactive_custom_animations_desc: "Off by default. Strategist motion suggestions remain available; turn this on to have the agent create custom animations without a separate request.",
+ proactive_narration_audio: "Proactively generate narration audio",
+ proactive_narration_audio_desc: "Off by default. This raw choice does not rewrite the speaker-notes toggle; the Strategist resolves narration's effective notes dependency in the Design Spec.",
font_heading: "Heading",
font_body: "Body",
font_body_size: "Body baseline size",
@@ -178,6 +186,7 @@
sec_type: "タイポグラフィ",
sec_images: "画像の使用",
sec_image_production: "画像制作",
+ sec_proactive_execution: "能動的な実行",
sec_mode: "生成モード",
sec_refine: "先に設計仕様を確認",
sec_design_directions: "統合デザイン方針",
@@ -233,6 +242,13 @@
image_usage_notes_placeholder: "例:リアルな手洗いシーンを優先、漫画調の菌のイラストは避ける、製品写真はそのまま使う。",
image_usage_required: "画像の使用方法を少なくとも1つ選択してください。",
image_usage_none_exclusive: "「画像なし」は他の画像オプションと同時に選択できません。",
+ proactive_execution_hint: "これらの初期設定は、明示的な指示がない場合にのみ適用されます。最新の明示的な指示が常に優先されます。",
+ proactive_speaker_notes: "発表者ノートを能動的に生成",
+ proactive_speaker_notes_desc: "初期設定はオンです。個別の依頼がなくても発表者ノートを生成します。",
+ proactive_custom_animations: "カスタムアニメーションを能動的に作成",
+ proactive_custom_animations_desc: "初期設定はオフです。ストラテジストの動きの提案は維持され、オンにすると個別の依頼がなくてもカスタムアニメーションを作成します。",
+ proactive_narration_audio: "ナレーション音声を能動的に生成",
+ proactive_narration_audio_desc: "初期設定はオフです。この選択は発表者ノートの設定を書き換えません。ナレーションに必要なノートの有効状態は、ストラテジストが設計仕様で解決します。",
font_heading: "見出し",
font_body: "本文",
font_body_size: "本文の基準サイズ",
@@ -317,6 +333,7 @@
sec_type: "字体方案",
sec_images: "图片使用",
sec_image_production: "图片生产",
+ sec_proactive_execution: "主动执行",
sec_mode: "生成模式",
sec_refine: "先审核设计规范",
sec_design_directions: "成套设计方向",
@@ -372,6 +389,13 @@
image_usage_notes_placeholder: "例如:优先真实洗手场景;不要卡通病菌;产品照片保持原样。",
image_usage_required: "请至少选择一种图片使用方式。",
image_usage_none_exclusive: "「不使用图片」不能和其它图片选项同时选择。",
+ proactive_execution_hint: "这些默认开关只在你没有明确要求时生效;你最新的明确指令始终优先。",
+ proactive_speaker_notes: "主动生成演讲者备注",
+ proactive_speaker_notes_desc: "默认开启。无需另行要求,Agent 也会生成演讲者备注。",
+ proactive_custom_animations: "主动生成自定义动画",
+ proactive_custom_animations_desc: "默认关闭。策略师的动画建议仍会保留;开启后,Agent 可在没有另行要求时实际制作自定义动画。",
+ proactive_narration_audio: "主动生成旁白音频",
+ proactive_narration_audio_desc: "默认关闭。这里保留原始选择,不改写演讲者备注开关;策略师会在设计规范中解析旁白所需的最终备注状态。",
font_heading: "标题",
font_body: "正文",
font_body_size: "正文基准字号",
@@ -742,6 +766,13 @@
return (REC && REC.recommend && REC.recommend[field]) || legacyRecId(field);
}
+ function booleanRecommendation(field, fallback) {
+ if (!REC || !Object.prototype.hasOwnProperty.call(REC, field)) return fallback;
+ var spec = REC[field];
+ var value = spec && typeof spec === "object" ? spec.value : spec;
+ return typeof value === "boolean" ? value : fallback;
+ }
+
function recommendationFieldLocked(field) {
return !!(REC && REC[field] && typeof REC[field] === "object" && REC[field].locked === true);
}
@@ -2394,6 +2425,44 @@
host.appendChild(sec);
}
+ function renderProactiveExecution(host) {
+ var sec = section("A", "sec_proactive_execution", t("proactive_execution_hint"));
+ var opts = [{ id: "off", label: t("off_default") }, { id: "on", label: t("on") }];
+
+ function addToggle(labelKey, descKey, stateKey, fallback) {
+ var field = el("div", "subfield");
+ field.appendChild(el("div", "subfield-label", t(labelKey)));
+ field.appendChild(el("div", "toggle-desc", t(descKey)));
+ var recommended = booleanRecommendation(stateKey, fallback);
+ enumField(field, opts, recommended ? "on" : "off",
+ function () { return STATE[stateKey] ? "on" : "off"; },
+ function (value) {
+ STATE[stateKey] = value === "on";
+ });
+ sec.appendChild(field);
+ }
+
+ addToggle(
+ "proactive_speaker_notes",
+ "proactive_speaker_notes_desc",
+ "proactive_speaker_notes",
+ true
+ );
+ addToggle(
+ "proactive_custom_animations",
+ "proactive_custom_animations_desc",
+ "proactive_custom_animations",
+ false
+ );
+ addToggle(
+ "proactive_narration_audio",
+ "proactive_narration_audio_desc",
+ "proactive_narration_audio",
+ false
+ );
+ host.appendChild(sec);
+ }
+
function renderRefine(host) {
var sec = section("R", "sec_refine");
var opts = [{ id: "off", label: t("off_default") }, { id: "on", label: t("on") }];
@@ -2476,6 +2545,7 @@
// confirmed image source but does not reopen aesthetic decisions.
renderImageProduction(host);
renderFormulaPolicy(host);
+ renderProactiveExecution(host);
renderMode(host);
renderRefine(host);
} else {
@@ -2498,6 +2568,7 @@
renderImageDirection(host);
renderImageProduction(host);
renderFormulaPolicy(host);
+ renderProactiveExecution(host);
renderMode(host);
renderRefine(host);
}
@@ -2632,6 +2703,9 @@
function initStage3State() {
STATE.formula_policy = pick("formula_policy", CAT.formula_policy);
STATE.image_ai_path = pick("image_ai_path", CAT.image_ai_path);
+ STATE.proactive_speaker_notes = booleanRecommendation("proactive_speaker_notes", true);
+ STATE.proactive_custom_animations = booleanRecommendation("proactive_custom_animations", false);
+ STATE.proactive_narration_audio = booleanRecommendation("proactive_narration_audio", false);
STATE.generation_mode = pick("generation_mode", CAT.generation_mode);
STATE.refine_spec = !!((REC.refine_spec && REC.refine_spec.value) || (REC.recommend && REC.recommend.refine_spec));
diff --git a/skills/ppt-master/scripts/native_enhance_pptx_core.py b/skills/ppt-master/scripts/native_enhance_pptx_core.py
index 7155bad5..26e52960 100644
--- a/skills/ppt-master/scripts/native_enhance_pptx_core.py
+++ b/skills/ppt-master/scripts/native_enhance_pptx_core.py
@@ -1207,8 +1207,8 @@ def _build_enhancement_plan(
existing_plan: dict | None = None,
) -> dict:
previous = existing_plan or {}
- notes_enabled = _preserved_enabled(previous, "notes", True)
audio_enabled = _preserved_enabled(previous, "audio", True)
+ notes_enabled = _preserved_enabled(previous, "notes", True) or audio_enabled
timings_enabled = _preserved_enabled(previous, "timings", True)
previous_timings = _module_config(previous, "timings")
raw_padding: object
@@ -1411,6 +1411,19 @@ def _validate_plan_modules(plan: dict) -> None:
raise ValueError(
f"enhancement plan module {name}.enabled must be a boolean"
)
+ notes_config = modules_cfg.get("notes")
+ audio_config = modules_cfg.get("audio")
+ if (
+ isinstance(audio_config, dict)
+ and audio_config.get("enabled") is True
+ and (
+ not isinstance(notes_config, dict)
+ or notes_config.get("enabled") is not True
+ )
+ ):
+ raise ValueError(
+ "enhancement plan audio requires notes.enabled: true"
+ )
def _resolve_transition_plan(
diff --git a/skills/ppt-master/scripts/notes_to_audio.py b/skills/ppt-master/scripts/notes_to_audio.py
index 0f57eaec..ec73dd0a 100644
--- a/skills/ppt-master/scripts/notes_to_audio.py
+++ b/skills/ppt-master/scripts/notes_to_audio.py
@@ -26,7 +26,9 @@ from __future__ import annotations
import argparse
import asyncio
+import json
import os
+import re
import sys
from dataclasses import dataclass
from pathlib import Path
@@ -92,21 +94,93 @@ def _prepare_audio_jobs(
output_dir: Path,
extension: str,
) -> list[AudioJob]:
- """Read non-empty per-slide notes into ordered audio jobs."""
+ """Read a complete per-slide notes roster into ordered audio jobs."""
jobs: list[AudioJob] = []
+ invalid: list[str] = []
for note_path in note_files:
- text = spoken_text(note_path.read_text(encoding="utf-8"))
+ if not note_path.is_file():
+ invalid.append(f"{note_path.name} is missing")
+ continue
+ try:
+ text = spoken_text(note_path.read_text(encoding="utf-8"))
+ except (OSError, UnicodeError) as exc:
+ invalid.append(f"{note_path.name} is unreadable: {exc}")
+ continue
if not text:
- print(f"[skip] {note_path.name}: empty spoken text")
+ invalid.append(f"{note_path.name} has no spoken text")
continue
jobs.append(AudioJob(
note_path=note_path,
text=text,
output_path=output_dir / f"{note_path.stem}{extension}",
))
+ if invalid:
+ raise ValueError(
+ "per-slide notes are incomplete: " + "; ".join(invalid)
+ )
return jobs
+def _expected_note_files(project: Path) -> list[Path]:
+ """Resolve the owning route's complete per-slide notes roster."""
+ notes_dir = project / "notes"
+ svg_files = sorted((project / "svg_output").glob("*.svg"))
+ if svg_files:
+ aliases: dict[int, list[Path]] = {}
+ for path in sorted(notes_dir.glob("*.md")):
+ match = re.search(r"slide[_]?(\d+)", path.stem)
+ if match:
+ aliases.setdefault(int(match.group(1)), []).append(path)
+ note_files: list[Path] = []
+ for index, svg_path in enumerate(svg_files, 1):
+ exact = notes_dir / f"{svg_path.stem}.md"
+ if exact.exists():
+ note_files.append(exact)
+ continue
+ matches = aliases.get(index, [])
+ if len(matches) > 1:
+ raise ValueError(
+ f"multiple notes files match slide {index}: "
+ + ", ".join(path.name for path in matches)
+ )
+ note_files.append(matches[0] if matches else exact)
+ return note_files
+
+ slide_index_path = project / "analysis" / "slide_index.json"
+ if slide_index_path.is_file():
+ try:
+ slide_index = json.loads(
+ slide_index_path.read_text(encoding="utf-8")
+ )
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
+ raise ValueError(f"invalid slide index: {exc}") from exc
+ if not isinstance(slide_index, dict):
+ raise ValueError("invalid slide index root")
+ slides = slide_index.get("slides")
+ slide_count = slide_index.get("slide_count")
+ if (
+ not isinstance(slides, list)
+ or isinstance(slide_count, bool)
+ or not isinstance(slide_count, int)
+ or slide_count != len(slides)
+ ):
+ raise ValueError("invalid slide index notes roster")
+ note_files: list[Path] = []
+ for index, slide in enumerate(slides, 1):
+ note_file = slide.get("note_file") if isinstance(slide, dict) else None
+ if not isinstance(note_file, str) or Path(note_file).suffix != ".md":
+ raise ValueError(
+ f"invalid slide index note_file for slide {index}"
+ )
+ note_files.append(notes_dir / Path(note_file).name)
+ return note_files
+
+ return [
+ path for path in sorted(notes_dir.glob("*.md"))
+ if path.name != "total.md"
+ ]
+
+
async def _generate_edge_jobs(
jobs: list[AudioJob],
subtitle_dir: Path,
@@ -373,20 +447,25 @@ def main() -> int:
project = args.project_path
notes_dir = project / "notes"
output_dir = args.output or (project / "audio")
- output_dir.mkdir(parents=True, exist_ok=True)
subtitle_dir = notes_dir / "subtitles"
- if backend.provider == "edge":
- subtitle_dir.mkdir(parents=True, exist_ok=True)
- note_files = [
- path for path in sorted(notes_dir.glob("*.md"))
- if path.name != "total.md"
- ]
- if not note_files:
- print(f"error: no per-slide notes found in {notes_dir}", file=sys.stderr)
+ try:
+ note_files = _expected_note_files(project)
+ if not note_files:
+ raise ValueError(f"no per-slide notes found in {notes_dir}")
+ jobs = _prepare_audio_jobs(
+ note_files,
+ output_dir,
+ backend.extension,
+ )
+ except ValueError as exc:
+ print(f"error: {exc}", file=sys.stderr)
return 2
- jobs = _prepare_audio_jobs(note_files, output_dir, backend.extension)
+ output_dir.mkdir(parents=True, exist_ok=True)
+ if backend.provider == "edge":
+ subtitle_dir.mkdir(parents=True, exist_ok=True)
+
generated = 0
if backend.provider == "edge":
print(
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
index a854dd20..8d60d992 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
@@ -692,6 +692,24 @@ def _recorded_narration_on_click_slides(
return blocked
+def _resolve_animation_config_source(
+ project_path: Path,
+ requested_config: str | None,
+ *,
+ recorded_narration: bool,
+ no_animations: bool,
+) -> str | None:
+ """Resolve the animation sidecar selected for this export."""
+ if requested_config is not None or not recorded_narration or no_animations:
+ return requested_config
+
+ canonical_exists = (project_path / 'animations.json').is_file()
+ narration_exists = (project_path / 'narration_animations.json').is_file()
+ if canonical_exists or narration_exists:
+ return 'narration_animations.json'
+ return None
+
+
def main(argv: list[str] | None = None) -> int:
"""CLI entry point for the SVG to PPTX conversion tool."""
transition_choices = [
@@ -762,7 +780,9 @@ Recorded narration:
- Keeps speaker notes when enabled
- Prepares PowerPoint recorded timings and narrations
- Requires one m4a/mp3/wav file per slide
- - Uses narration_animations.json by default
+ - Uses narration_animations.json when animation sidecars exist
+ - With no animation sidecars, keeps the default fade transition and no
+ per-element builds
- Use --animation-config animations.json for the canonical animation
- Use --no-animations for narration and timings without animation motion
- Embeds per-slide audio matched by SVG filename / slide number
@@ -929,9 +949,10 @@ Recorded narration:
type=str,
default=None,
help=(
- 'Per-slide/per-object animation config. Recorded narration defaults '
- 'to <project>/narration_animations.json; other exports default to '
- '<project>/animations.json when present.'
+ 'Per-slide/per-object animation config. Recorded narration uses '
+ '<project>/narration_animations.json when an animation sidecar exists, '
+ 'or keeps exporter defaults when neither sidecar exists. Other exports '
+ 'default to <project>/animations.json when present.'
),
)
animation_source.add_argument(
@@ -1359,13 +1380,12 @@ Recorded narration:
)
return 1
- effective_animation_config = args.animation_config
- if (
- effective_animation_config is None
- and args.recorded_narration
- and not args.no_animations
- ):
- effective_animation_config = 'narration_animations.json'
+ effective_animation_config = _resolve_animation_config_source(
+ project_path,
+ args.animation_config,
+ recorded_narration=bool(args.recorded_narration),
+ no_animations=args.no_animations,
+ )
if effective_animation_config:
config_path = Path(effective_animation_config)