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: round-trip quality gate reads a validation/ report bound to the authoring-SVG fingerprint; checker enforces the exporter's one-text semantic-shape contract early; --no-notes removes every notes part; negative edge-tts values parse with a space
hugohe373bc51a38007
diff --git a/skills/ppt-master/scripts/authoring_roundtrip.py b/skills/ppt-master/scripts/authoring_roundtrip.pyindex c4db4c80..33f3142f 100644--- a/skills/ppt-master/scripts/authoring_roundtrip.py+++ b/skills/ppt-master/scripts/authoring_roundtrip.py@@ -37,6 +37,7 @@ from extract_svg_assets import ()from hyperlink_contract import ADOPTED_SOURCE_LINK_ATTR, SHAPE_HYPERLINK_ATTR, SOURCE_HREF_ATTRfrom pptx_workspace import (+ AUTHORING_SVG_FLAT_DIR,ROUNDTRIP_MANIFEST_PATH,ROUNDTRIP_PAGE_PLAN_PATH,)@@ -88,6 +89,27 @@ class AuthoringRoundtripError(RuntimeError):"""Reject stale, ambiguous, or incomplete authoring round-trip input."""+def roundtrip_source_fingerprint(project_path: Path) -> dict[str, object]:+ """Bind validation and export to the authoring SVGs and optional page plan."""+ paths = list((project_path / AUTHORING_SVG_FLAT_DIR).glob('*.svg'))+ plan_path = project_path / ROUNDTRIP_PAGE_PLAN_PATH+ if plan_path.is_file():+ paths.append(plan_path)+ files: list[dict[str, str]] = []+ aggregate = hashlib.sha256()+ for path in sorted(paths, key=lambda item: item.relative_to(project_path).as_posix()):+ name = path.relative_to(project_path).as_posix()+ digest = hashlib.sha256(path.read_bytes()).hexdigest()+ files.append({'file': name, 'sha256': digest})+ aggregate.update(name.encode('utf-8') + b'\0' + digest.encode('ascii') + b'\n')+ return {+ 'algorithm': 'sha256',+ 'digest': aggregate.hexdigest(),+ 'file_count': len(files),+ 'files': files,+ }++@dataclass(frozen=True)class SourceRefRecord:source_path: tuple[int, ...]diff --git a/skills/ppt-master/scripts/docs/narration.md b/skills/ppt-master/scripts/docs/narration.mdindex 7950c70e..3eecfd16 100644--- a/skills/ppt-master/scripts/docs/narration.md+++ b/skills/ppt-master/scripts/docs/narration.md@@ -13,7 +13,7 @@ Tool behavior behind the [`generate-audio`](../../workflows/stages/generate-audi```bashpython3 skills/ppt-master/scripts/notes_to_audio.py --list-voices --locale <locale> # edgepython3 skills/ppt-master/scripts/notes_to_audio.py --provider <elevenlabs|minimax|qwen|cosyvoice> --list-voices-python3 skills/ppt-master/scripts/notes_to_audio.py <project_path> --voice <ShortName> --rate=<rate> [--concurrency <N>]+python3 skills/ppt-master/scripts/notes_to_audio.py <project_path> --voice <ShortName> --rate=<rate> [--pitch=<pitch>] [--volume=<volume>] [--concurrency <N>]python3 skills/ppt-master/scripts/notes_to_audio.py <project_path> --provider elevenlabs --voice-id <id> --elevenlabs-model eleven_multilingual_v2python3 skills/ppt-master/scripts/notes_to_audio.py <project_path> --provider minimax --voice-id <id> --minimax-model speech-2.8-hdpython3 skills/ppt-master/scripts/notes_to_audio.py <project_path> --provider qwen --voice-id <voice> --qwen-model qwen3-tts-flash --qwen-language-type Chinese@@ -26,6 +26,8 @@ python3 skills/ppt-master/scripts/notes_to_audio.py <project_path> --provider co- **Edge SRT**: MP3 and page SRT come from the same `edge-tts` stream using `WordBoundary` timing. Sentence-ending punctuation always closes a cue; text over the 20-visible-character default (`--subtitle-max-chars`) splits at commas, semicolons, or colons, then at the nearest word boundary. Adjacent overlap up to 100 ms moves the later cue start to the previous end; larger overlap fails. Each SRT uses a page-local timeline starting at `00:00:00,000` including leading silence. Default concurrency is three slide pairs (`--concurrency 1` for serial troubleshooting); cloud providers stay serial.- **Provider timing**: MiniMax reads word timing from its synchronous subtitle file (a normalized number such as `42` comes back as one row per spoken syllable sharing one original-text span; the adapter merges rows by that span, never by text alone); ElevenLabs uses `/with-timestamps` with original-text character alignment; CosyVoice enables HTTP streaming plus `word_timestamp_enabled` and uses the final audio URL and word timing — unsupported model/voice pairs fail without replacing the prior pair unless `--cosyvoice-audio-only` was explicit (model and voice families must match; cloned voices need a supported v3.5/v3/v2 model or a timestamp-supported system voice); Qwen exposes no timing and never gets estimated SRT. Provider-timed paths share punctuation-first, `--subtitle-max-chars`-bounded regrouping, exact-text validation, and rollback-safe pair publication.+Signed Edge values accept both equals and space forms: `--rate=-5%` / `--rate -5%`, `--pitch=-2Hz` / `--pitch -2Hz`, and `--volume=-10%` / `--volume -10%`. The examples use equals for clarity; omitted pitch and volume remain `+0Hz` and `+0%`. These three options are ignored by cloud providers.+## `narration_sync.py````bashdiff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.mdindex 5566c5de..5edf9ec9 100644--- a/skills/ppt-master/scripts/docs/svg-pipeline.md+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md@@ -185,7 +185,7 @@ notes and an absent file keeps them. Deleting inherited source notes only on acopy is not supported in v1. The same output-stem rule applies to narrationaudio.-When a round-trip recorded-narration export omits `--animation-config`, it uses the workspace `animations.json` when present and otherwise applies no sidecar while preserving source motion.+When a round-trip recorded-narration export omits `--animation-config`, it reads the workspace `animations.json` the importer wrote; that sidecar is part of the workspace contract, so deleting it fails export rather than restoring source motion.Narration audio is keyed by the output SVG stem. A copied output page uses itsown stem-keyed notes when present and otherwise inherits the declared source@@ -210,7 +210,7 @@ while order, notes, or motion may change; `rebuilt` means visible authoring orone of its referenced resources changed.Without `-o`, round-trip export names the deck `<workspace-directory-name>_<timestamp>[<flavor-suffix>].pptx` under `exports/`.-Before export, run `python3 scripts/svg_quality_checker.py <workspace> --roundtrip`+Before export, run `python3 scripts/svg_quality_checker.py <workspace> --roundtrip --json`as the round-trip text-capacity gate. It resolves the output roster from`authoring-svg-flat/` and optional `page_plan.json`, then applies the sharedfont-family, font-size, text-width, and canvas metrics only to new text or@@ -222,6 +222,24 @@ leaving the page canvas remain blocking. Other advisories remain non-blocking.Unchanged source refs, source proxies, and generated-project-only spec,template, canonical-authoring, and resource-manifest checks are excluded.+The checker also enforces the exporter's semantic shape text contract on+converted content: a `data-pptx-semantic-object="shape"` group may contain at+most one direct `<text>`, with `data-pptx-frame` on its owner. Multiple lines+belong in that component's `<tspan>` paragraphs. Ordinary groups are unaffected;+unchanged native source objects remain excluded. Generate checks the same+contract.++`--json` writes `validation/svg_quality_report.json`. Both tools fingerprint+`authoring-svg-flat/*.svg` and the optional `page_plan.json`; changing either+after validation makes the export receipt `quality_gate=stale`. A current+report with no blocking errors yields `quality_gate=passed`. Without a report,+export remains allowed and reports `quality_gate=not-provided`.++`--roundtrip --no-notes` removes all speaker notes slide/master parts, their+relationships, and Content-Type overrides, including on the identity export+without a page plan. `pptx_delivery_check.py` reports unreferenced notes parts+as an advisory.+Regenerate the summary after direct edits that do not pass through one of thein-place normalization tools:diff --git a/skills/ppt-master/scripts/notes_to_audio.py b/skills/ppt-master/scripts/notes_to_audio.pyindex bc07147b..d105d0fa 100644--- a/skills/ppt-master/scripts/notes_to_audio.py+++ b/skills/ppt-master/scripts/notes_to_audio.py@@ -283,6 +283,8 @@ def _provider_manifest_details(if backend.provider == "edge":return "edge-tts", {"rate": args.rate,+ "pitch": args.pitch,+ "volume": args.volume,}if backend.provider == "elevenlabs":return args.elevenlabs_model, {@@ -380,6 +382,8 @@ async def _generate_edge_jobs(*,voice: str,rate: str,+ pitch: str = "+0Hz",+ volume: str = "+0%",subtitle_max_chars: int,concurrency: int,) -> list[BaseException | None]:@@ -393,6 +397,8 @@ async def _generate_edge_jobs(job.output_path,voice=voice,rate=rate,+ pitch=pitch,+ volume=volume,subtitle_path=subtitle_dir / f"{job.output_path.stem}.srt",subtitle_max_chars=subtitle_max_chars,)@@ -407,7 +413,26 @@ async def _generate_edge_jobs(]-def main() -> int:+def _normalize_voice_option_args(argv: list[str]) -> list[str]:+ """Keep signed voice values from being interpreted as argparse options."""+ normalized: list[str] = []+ index = 0+ while index < len(argv):+ option = argv[index]+ if (+ option in {"--rate", "--pitch", "--volume"}+ and index + 1 < len(argv)+ and re.fullmatch(r"-\d+(?:\.\d+)?(?:%|Hz)?", argv[index + 1])+ ):+ normalized.append(f"{option}={argv[index + 1]}")+ index += 2+ else:+ normalized.append(option)+ index += 1+ return normalized+++def main(argv: list[str] | None = None) -> int:_load_tts_env_file()parser = argparse.ArgumentParser(@@ -437,6 +462,14 @@ def main() -> int:default="+0%",help='edge-tts speaking rate, e.g. "+0%%", "-10%%", "+15%%" (default: +0%%). Ignored by cloud providers.',)+ parser.add_argument(+ "--pitch", default="+0Hz",+ help="edge-tts pitch adjustment (default: +0Hz). Ignored by cloud providers.",+ )+ parser.add_argument(+ "--volume", default="+0%",+ help="edge-tts volume adjustment (default: +0%%). Ignored by cloud providers.",+ )parser.add_argument("--concurrency",type=int,@@ -560,12 +593,9 @@ def main() -> int:parser.add_argument("--list-common-voices", action="store_true", help="print a curated voice list and exit")parser.add_argument("--list-voices", action="store_true", help="query provider voices and exit")parser.add_argument("--locale", default=None, help='filter --list-voices by locale, e.g. "zh-CN"')- raw_args = list(sys.argv[1:])- # argparse otherwise interprets a separate negative percentage as an option.- for index in range(len(raw_args) - 2, -1, -1):- if raw_args[index] == "--rate" and re.fullmatch(r"-\d+(?:\.\d+)?%", raw_args[index + 1]):- raw_args[index:index + 2] = [f"--rate={raw_args[index + 1]}"]- args = parser.parse_args(raw_args)+ args = parser.parse_args(_normalize_voice_option_args(+ sys.argv[1:] if argv is None else argv+ ))if args.list_common_voices:backend_edge.print_common_voices()@@ -747,6 +777,8 @@ def main() -> int:subtitle_dir,voice=args.voice,rate=args.rate,+ pitch=args.pitch,+ volume=args.volume,subtitle_max_chars=args.subtitle_max_chars,concurrency=args.concurrency,))diff --git a/skills/ppt-master/scripts/pptx_delivery_check.py b/skills/ppt-master/scripts/pptx_delivery_check.pyindex 5a628167..76e0dd50 100644--- a/skills/ppt-master/scripts/pptx_delivery_check.py+++ b/skills/ppt-master/scripts/pptx_delivery_check.py@@ -883,6 +883,20 @@ def audit_pptx_delivery(path: str | Path) -> dict[str, object]:reference_counts, relationship_types, external_media = (_relationship_inventory(archive, part_names, errors))+ orphan_notes = sorted(+ name for name in part_names+ if _content_type_for_part(name, defaults, overrides) in {+ 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml',+ 'application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml',+ }+ and reference_counts.get(canonical_opc_part_path(name) or '', 0) == 0+ )+ if orphan_notes:+ advisories.append(_issue(+ "orphan_notes_parts",+ "Unreferenced speaker notes parts remain in the package; remove them if no longer needed.",+ parts=orphan_notes,+ ))media_infos = [info_by_name[name]diff --git a/skills/ppt-master/scripts/svg_authoring_view.py b/skills/ppt-master/scripts/svg_authoring_view.pyindex 0b0e61b0..fff8771c 100644--- a/skills/ppt-master/scripts/svg_authoring_view.py+++ b/skills/ppt-master/scripts/svg_authoring_view.py@@ -202,6 +202,31 @@ def _local_name(name: object) -> str:return name.rsplit("}", 1)[-1] if isinstance(name, str) else ""+def semantic_shape_text_component(+ shape: ET.Element,+ *,+ included_text_ids: set[int] | None = None,+) -> ET.Element | None:+ """Validate text compiled into one semantic shape, excluding native restores."""+ def included(element: ET.Element) -> bool:+ return (+ element.tag.replace(f'{{{SVG_NS}}}', '') == 'text'+ and (included_text_ids is None or id(element) in included_text_ids)+ )++ texts = [child for child in shape if included(child)]+ nested_texts = [child for child in shape.iter() if included(child)]+ if nested_texts != texts:+ raise ValueError('Semantic shape text must be one direct SVG text component')+ if not texts:+ return None+ if len(texts) != 1:+ raise ValueError('Semantic shape requires at most one paragraph-based text component')+ if shape.get('data-pptx-frame') is None:+ raise ValueError('Semantic shape text requires data-pptx-frame on its owner')+ return texts[0]++@dataclassclass SourceReference:source_ref: strdiff --git a/skills/ppt-master/scripts/svg_quality/checker.py b/skills/ppt-master/scripts/svg_quality/checker.pyindex 21e38e21..658b7e88 100644--- a/skills/ppt-master/scripts/svg_quality/checker.py+++ b/skills/ppt-master/scripts/svg_quality/checker.py@@ -33,6 +33,11 @@ from pptx_workspace import ()from slide_roster import discover_slide_svgsfrom svg_authoring_contract import canonical_authoring_errors+from svg_authoring_view import (+ SEMANTIC_OBJECT_ATTRIBUTE,+ SEMANTIC_SHAPE_KIND,+ semantic_shape_text_component,+)from . import svg_contractsfrom .xml_support import (@@ -1175,6 +1180,7 @@ class SVGQualityChecker:self.quick_generate = quick_generateself.canonical_authoring = canonical_authoringself.results = []+ self._roundtrip_source_fingerprint: Dict[str, object] | None = Noneself.summary = {'total': 0,'passed': 0,@@ -1399,6 +1405,7 @@ class SVGQualityChecker:# 5. Check text wrapping methodsself._check_text_elements(content, root, result)+ self._check_semantic_shape_text(root, result)# 5b. Validate native hyperlink targets and carrier structure.self._check_hyperlinks(root, result)@@ -1548,6 +1555,7 @@ class SVGQualityChecker:_load_documents,_load_page_plan,_parse_svg,+ roundtrip_source_fingerprint,)project_path = Path(workspace).resolve()@@ -1569,6 +1577,7 @@ class SVGQualityChecker:return []try:+ self._roundtrip_source_fingerprint = roundtrip_source_fingerprint(project_path)source_root, source_proxy_dir, documents, _, _ = _load_documents(project_path,authoring_dir,@@ -1676,6 +1685,9 @@ class SVGQualityChecker:))result['info']['edited_text_elements'] = len(included_text_ids)+ self._check_semantic_shape_text(+ root, result, included_text_ids=included_text_ids,+ )if included_text_ids:scoped_content = self._roundtrip_text_scope_content(root,@@ -1716,6 +1728,27 @@ class SVGQualityChecker:result['passed'] = Falsereturn self._record_result(result)+ @staticmethod+ def _check_semantic_shape_text(+ root: ET.Element,+ result: Dict,+ *,+ included_text_ids: set[int] | None = None,+ ) -> None:+ """Report the exporter's semantic-shape text contract before conversion."""+ parents = {id(child): parent for parent in root.iter() for child in parent}+ for shape in root.iter(f'{{{SVG_NS}}}g'):+ if shape.get(SEMANTIC_OBJECT_ATTRIBUTE) != SEMANTIC_SHAPE_KIND:+ continue+ if _svg_hidden_reason is not None and _svg_hidden_reason(+ shape, parents, preserve_native_carriers=True,+ ) is not None:+ continue+ try:+ semantic_shape_text_component(shape, included_text_ids=included_text_ids)+ except ValueError as exc:+ result['errors'].append(f"{_element_label(shape)}: {exc}")+@staticmethoddef _roundtrip_text_diff_ids(root: ET.Element,@@ -9848,7 +9881,11 @@ class SVGQualityChecker:'schema': 'ppt-master.svg-quality-report.v1','stage': stage,'target': str(Path(target).resolve()),- 'source_fingerprint': _quality_source_fingerprint(self.results),+ 'source_fingerprint': (+ self._roundtrip_source_fingerprint+ if self._roundtrip_source_fingerprint is not None+ else _quality_source_fingerprint(self.results)+ ),'summary': dict(self.summary),'issue_types': dict(sorted(self.issue_types.items())),'categories': {diff --git a/skills/ppt-master/scripts/svg_quality/cli.py b/skills/ppt-master/scripts/svg_quality/cli.pyindex 2d6aec33..fc661777 100644--- a/skills/ppt-master/scripts/svg_quality/cli.py+++ b/skills/ppt-master/scripts/svg_quality/cli.py@@ -90,6 +90,8 @@ def _default_json_report_path(checker: SVGQualityChecker,target: str,stage: str,+ *,+ roundtrip: bool = False,) -> Path:"""Choose a stage-specific report path without overwriting the final gate."""target_path = Path(target)@@ -100,6 +102,8 @@ def _default_json_report_path("early": "svg_quality_early_report.json","page": "svg_quality_page_report.json",}[stage]+ if roundtrip:+ return target_path / "validation" / report_nameif ((project_path / "svg_output").is_dir()or (project_path / "design_spec.md").is_file()@@ -334,7 +338,9 @@ def main() -> None:sys.exit(1)json_output = Path(sys.argv[idx + 1])else:- json_output = _default_json_report_path(checker, target, stage)+ json_output = _default_json_report_path(+ checker, target, stage, roundtrip=roundtrip,+ )checker.export_json_report(str(json_output),target=target,diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex 7d9e3f6d..4fe85259 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -36,6 +36,7 @@ from resource_paths import icon_dir_for_projectfrom svg_authoring_view import (SEMANTIC_OBJECT_ATTRIBUTE,SEMANTIC_SHAPE_KIND,+ semantic_shape_text_component,)from svg_compatibility import normalize_single_child_group_filters@@ -751,33 +752,15 @@ def _semantic_shape_text_body(preserved = _decode_unchanged_txbody(shape, metadata)if preserved is not None:return preserved[0]- texts = [- child- for child in shape- if child.tag.replace(f'{{{SVG_NS}}}', '') == 'text'- ]- nested_texts = [- child- for child in shape.iter()- if child.tag.replace(f'{{{SVG_NS}}}', '') == 'text'- ]- if nested_texts != texts:- raise SvgNativeConversionError(- 'Semantic shape text must be one direct SVG text component'- )- if not texts:+ try:+ component = semantic_shape_text_component(shape)+ except ValueError as exc:+ raise SvgNativeConversionError(str(exc)) from exc+ if component is None:return None- if len(texts) != 1:- raise SvgNativeConversionError(- 'Semantic shape requires at most one paragraph-based text component'- )frame = shape.get('data-pptx-frame')- if frame is None:- raise SvgNativeConversionError(- 'Semantic shape text requires data-pptx-frame on its owner'- )- text = copy.deepcopy(texts[0])+ text = copy.deepcopy(component)text.set('data-pptx-frame', frame)for name in ('data-pptx-shape-id',diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.pyindex 4a9f1153..776ecaee 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py@@ -1896,6 +1896,71 @@ def _unused_part_path(directory: Path, filename: str) -> Path:return candidate+def _remove_all_notes_parts(extract_dir: Path) -> None:+ """Remove notes slides, masters, their relationships, and type overrides."""+ content_types_path = extract_dir / '[Content_Types].xml'+ content_tree = ET.parse(content_types_path)+ content_root = content_tree.getroot()+ notes_content_types = {+ 'application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml',+ _NOTES_MASTER_CONTENT_TYPE,+ }+ notes_parts = {+ _canonical_opc_part_path(node.get('PartName', '').lstrip('/'))+ for node in content_root+ if node.get('ContentType') in notes_content_types+ } - {None}+ notes_files = [+ path for path in extract_dir.rglob('*')+ if path.is_file() and (+ _canonical_opc_part_path(path.relative_to(extract_dir).as_posix()) in notes_parts+ or path.relative_to(extract_dir).as_posix().startswith((+ 'ppt/notesSlides/', 'ppt/notesMasters/',+ ))+ )+ ]+ notes_parts.update(+ _canonical_opc_part_path(path.relative_to(extract_dir).as_posix())+ for path in notes_files+ )+ for rels_path in extract_dir.rglob('*.rels'):+ tree = ET.parse(rels_path)+ root = tree.getroot()+ removed = False+ rels_name = rels_path.relative_to(extract_dir).as_posix()+ for relationship in list(root):+ if (+ relationship.get('Type') in {NOTES_SLIDE_REL_TYPE, _NOTES_MASTER_REL_TYPE}+ or (+ relationship.get('TargetMode', '').lower() != 'external'+ and _resolve_internal_opc_target(+ rels_name, relationship.get('Target', ''),+ ) in notes_parts+ )+ ):+ root.remove(relationship)+ removed = True+ if removed:+ _write_xml_tree(rels_path, tree)+ presentation = extract_dir / 'ppt/presentation.xml'+ tree = ET.parse(presentation)+ notes_masters = tree.getroot().find(f'{{{PML_NS}}}notesMasterIdLst')+ if notes_masters is not None:+ tree.getroot().remove(notes_masters)+ _write_xml_tree(presentation, tree)+ for path in notes_files:+ rels_path = _relationships_path_for_part(extract_dir, path.relative_to(extract_dir).as_posix())+ rels_path.unlink(missing_ok=True)+ path.unlink(missing_ok=True)+ removed = False+ for node in list(content_root):+ if _canonical_opc_part_path(node.get('PartName', '').lstrip('/')) in notes_parts:+ content_root.remove(node)+ removed = True+ if removed:+ _write_xml_tree(content_types_path, content_tree)++def _apply_slide_notes(extract_dir: Path,rels_path: Path,@@ -8371,6 +8436,9 @@ def create_pptx_with_native_svg(f"{reinjected_resources} source package part(s)")+ if not enable_notes:+ _remove_all_notes_parts(extract_dir)+rels_problems = verify_internal_relationships(extract_dir)if rels_problems:details = '\n'.join(f' - {p}' for p in rels_problems)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.pyindex c34bc45d..22112c38 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@@ -31,6 +31,7 @@ from authoring_roundtrip import ( # noqa: E402RoundtripPage,is_flat_authoring_bundle,materialize_flat_authoring_roundtrip,+ roundtrip_source_fingerprint,)from console_encoding import configure_utf8_stdio # noqa: E402from language_tags import ( # noqa: E402@@ -1421,7 +1422,11 @@ def _write_postflight_report(f"{package['slides']} != {len(svg_files)}")source_audit = _source_resource_audit(svg_files)- source_fingerprint = _svg_source_fingerprint(svg_files)+ source_fingerprint = (+ roundtrip_source_fingerprint(project_path)+ if authoring_roundtrip is not None+ else _svg_source_fingerprint(svg_files)+ )quality = _quality_report_context(project_path, source_fingerprint)quality_gate, introduced_warning_count = _quality_gate_status(quality)unresolved_tokens = source_audit['unresolved_template_tokens']@@ -1573,9 +1578,14 @@ def _load_deck_motion_handoff(if report.get('status') not in {'passed', 'passed-with-warnings'}:raise ValueError('deck-motion handoff report is not a successful export')source = _as_dict(report.get('source'))- if source.get('fingerprint') != _svg_source_fingerprint(svg_files):+ current_fingerprint = (+ roundtrip_source_fingerprint(project_path)+ if source.get('authoring_roundtrip') is not None+ else _svg_source_fingerprint(svg_files)+ )+ if source.get('fingerprint') != current_fingerprint:raise ValueError(- 'deck-motion handoff does not match the current svg_output; '+ 'deck-motion handoff does not match the current source inputs; ''run the base export again')motion = report.get('deck_motion')diff --git a/skills/ppt-master/scripts/tests/test_edit_native_batch_c.py b/skills/ppt-master/scripts/tests/test_edit_native_batch_c.pynew file mode 100644index 00000000..9e3bb3e5--- /dev/null+++ b/skills/ppt-master/scripts/tests/test_edit_native_batch_c.py@@ -0,0 +1,270 @@+#!/usr/bin/env python3+"""Regress CLI arguments, round-trip quality receipts, shape text, and notes.++Usage:+ python3 -m unittest tests.test_edit_native_batch_c++Dependencies:+ Standard library and local PPT Master conversion modules.+"""++from __future__ import annotations++import asyncio+import contextlib+import copy+import io+import json+import sys+import tempfile+import unittest+import zipfile+from pathlib import Path+from types import SimpleNamespace+from unittest.mock import AsyncMock, Mock, patch+from xml.etree import ElementTree as ET++SCRIPTS_DIR = Path(__file__).resolve().parents[1]+if str(SCRIPTS_DIR) not in sys.path:+ sys.path.insert(0, str(SCRIPTS_DIR))++import notes_to_audio # noqa: E402+from authoring_roundtrip import SourceRefRecord # noqa: E402+from pptx_delivery_check import audit_pptx_delivery # noqa: E402+from pptx_to_svg.converter import ConvertOptions, convert_pptx_to_svg # noqa: E402+from svg_quality import cli as quality_cli # noqa: E402+from svg_quality.checker import SVGQualityChecker # noqa: E402+from svg_to_pptx.drawingml.converter import convert_svg_to_slide_shapes # noqa: E402+from svg_to_pptx.pptx_package import cli as export_cli # noqa: E402+from svg_to_pptx.pptx_package.builder import create_pptx_with_native_svg # noqa: E402++SVG_NS = "http://www.w3.org/2000/svg"+SVG = (+ f'<svg xmlns="{SVG_NS}" viewBox="0 0 1280 720" font-family="Arial">'+ '<rect x="20" y="20" width="500" height="100" fill="#123456"/>'+ '<text x="40" y="80" font-size="24" fill="#FFFFFF">Example</text></svg>'+)+++def _invoke(main, *args: str) -> tuple[int, str]:+ output = io.StringIO()+ with patch.object(sys, "argv", ["batch-c", *map(str, args)]), \+ contextlib.redirect_stdout(output), contextlib.redirect_stderr(output):+ try:+ code = main()+ except SystemExit as exc:+ code = exc.code+ return code or 0, output.getvalue()+++def _workspace(root: Path, *, notes: bool = False) -> Path:+ pages = []+ for index in (1, 2):+ svg = root / f"slide_{index:02d}.svg"+ svg.write_text(SVG, encoding="utf-8")+ pages.append(svg)+ source = root / "source.pptx"+ with contextlib.redirect_stdout(io.StringIO()):+ success = create_pptx_with_native_svg(+ pages, source, resource_root=root, pptx_structure="flat",+ use_compat_mode=False, transition=None, workers=1, verbose=False,+ notes={"slide_01": "Private speaker note."} if notes else None,+ )+ if not success:+ raise AssertionError("Could not create the minimal source deck")+ workspace = root / "workspace"+ convert_pptx_to_svg(+ source, workspace, ConvertOptions(inheritance_mode="both", roundtrip=True),+ )+ return workspace+++class EditNativeBatchCTests(unittest.TestCase):+ def test_c1_negative_voice_options_accept_space_and_equals(self) -> None:+ for option, value in (("--rate", "-5%"), ("--pitch", "-2Hz"), ("--volume", "-10%")):+ for arguments in ([option, value], [f"{option}={value}"]):+ with self.subTest(arguments=arguments):+ code, output = _invoke(+ notes_to_audio.main, *arguments, "--list-common-voices",+ )+ self.assertEqual(code, 0, output)+ for arguments in (["--rate"], ["--rate", "--unknown"], ["--unknown"]):+ with self.subTest(invalid=arguments):+ code, _ = _invoke(notes_to_audio.main, *arguments, "--list-common-voices")+ self.assertEqual(code, 2)+ job = notes_to_audio.AudioJob(Path("note.md"), "Example", Path("page.mp3"))+ with patch.object(notes_to_audio.backend_edge, "generate", new_callable=AsyncMock) as generate:+ results = asyncio.run(notes_to_audio._generate_edge_jobs(+ [job], Path("subtitles"), voice="en-US-AriaNeural",+ rate="-5%", pitch="-2Hz", volume="-10%",+ subtitle_max_chars=20, concurrency=1,+ ))+ self.assertEqual(results, [None])+ self.assertEqual(generate.await_args.kwargs["rate"], "-5%")+ self.assertEqual(generate.await_args.kwargs["pitch"], "-2Hz")+ self.assertEqual(generate.await_args.kwargs["volume"], "-10%")+ communicate = Mock(return_value=SimpleNamespace(save=AsyncMock()))+ with patch.dict(sys.modules, {"edge_tts": SimpleNamespace(Communicate=communicate)}):+ asyncio.run(notes_to_audio.backend_edge.generate(+ "Example", Path("page.mp3"), voice="en-US-AriaNeural",+ rate="-5%", pitch="-2Hz", volume="-10%",+ ))+ self.assertEqual(communicate.call_args.kwargs["pitch"], "-2Hz")+ self.assertEqual(communicate.call_args.kwargs["volume"], "-10%")+ with patch.object(notes_to_audio.backend_edge, "_generate_with_subtitles", new_callable=AsyncMock) as generate:+ asyncio.run(notes_to_audio.backend_edge.generate(+ "Example", Path("page.mp3"), voice="en-US-AriaNeural",+ rate="-5%", pitch="-2Hz", volume="-10%", subtitle_path=Path("page.srt"),+ ))+ self.assertEqual(generate.await_args.kwargs["pitch"], "-2Hz")+ self.assertEqual(generate.await_args.kwargs["volume"], "-10%")++ def test_c2_roundtrip_quality_receipt_tracks_authoring_and_page_plan(self) -> None:+ with tempfile.TemporaryDirectory() as tmp:+ root = Path(tmp)+ workspace = _workspace(root)+ output = workspace / "exports/result.pptx"+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "-o", output)+ self.assertEqual(code, 0, log)+ self.assertIn("quality_gate=not-provided", log)+ code, log = _invoke(quality_cli.main, workspace, "--roundtrip", "--json")+ self.assertEqual(code, 0, log)+ report_path = workspace / "validation/svg_quality_report.json"+ self.assertTrue(report_path.is_file(), log)+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "-o", output)+ self.assertEqual(code, 0, log)+ self.assertIn("quality_gate=passed", log)+ postflight = workspace / "validation/result.report.json"+ self.assertEqual(+ export_cli._load_deck_motion_handoff(workspace, str(postflight), []),+ json.loads(postflight.read_text(encoding="utf-8"))["deck_motion"],+ )+ plan = workspace / "page_plan.json"+ plan.write_text(json.dumps({+ "schema": "ppt-master.roundtrip-page-plan.v1",+ "pages": [{"source_slide": 2}, {"source_slide": 1}],+ }), encoding="utf-8")+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "-o", output)+ self.assertEqual(code, 0, log)+ self.assertIn("quality_gate=stale", log)+ code, log = _invoke(quality_cli.main, workspace, "--roundtrip", "--json")+ self.assertEqual(code, 0, log)+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "-o", output)+ self.assertEqual(code, 0, log)+ self.assertIn("quality_gate=passed", log)+ plan.write_text(json.dumps({+ "schema": "ppt-master.roundtrip-page-plan.v1",+ "pages": [{"source_slide": 1}, {"source_slide": 2}],+ }), encoding="utf-8")+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "-o", output)+ self.assertEqual(code, 0, log)+ self.assertIn("quality_gate=stale", log)+ code, log = _invoke(quality_cli.main, workspace, "--roundtrip", "--json")+ self.assertEqual(code, 0, log)+ svg = workspace / "authoring-svg-flat/slide_01.svg"+ svg.write_text(svg.read_text(encoding="utf-8") + "\n", encoding="utf-8")+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "-o", output)+ self.assertEqual(code, 0, log)+ self.assertIn("quality_gate=stale", log)++ def test_c3_semantic_text_contract_matches_export_and_skips_unchanged(self) -> None:+ first = '<text x="40" y="60" font-size="20">First</text>'+ second = '<text x="40" y="90" font-size="20">Second</text>'+ cases = (+ (first + second, "Semantic shape requires at most one paragraph-based text component"),+ (f"<g>{first}</g>", "Semantic shape text must be one direct SVG text component"),+ (first, None),+ ('<text x="40" y="60" font-size="20">First<tspan x="40" dy="30">Second</tspan></text>', None),+ ("", None),+ )+ with tempfile.TemporaryDirectory() as tmp:+ svg = Path(tmp) / "slide.svg"+ for body, error in cases:+ with self.subTest(body=body):+ content = (+ f'<svg xmlns="{SVG_NS}" viewBox="0 0 1280 720" font-family="Arial">'+ '<g id="shape" data-pptx-semantic-object="shape" data-pptx-frame="20 20 500 100">'+ '<rect data-pptx-part="geometry" x="20" y="20" width="500" height="100"/>'+ f'{body}</g></svg>'+ )+ svg.write_text(content, encoding="utf-8")+ root = ET.fromstring(content)+ if error:+ with self.assertRaisesRegex(RuntimeError, error):+ convert_svg_to_slide_shapes(str(svg), resource_root=svg.parent)+ else:+ convert_svg_to_slide_shapes(str(svg), resource_root=svg.parent)+ checker = SVGQualityChecker()+ with contextlib.redirect_stdout(io.StringIO()):+ generated = checker.check_file(str(svg))+ roundtrip = SVGQualityChecker()._check_roundtrip_file(+ svg, SimpleNamespace(source_refs={}), root, {}, {},+ output_index=1, source_slide=1,+ )+ for result in (generated, roundtrip):+ errors = "\n".join(result["errors"])+ if error:+ self.assertIn(error, errors)+ else:+ self.assertNotIn("Semantic shape", errors)+ group = root.find(f"{{{SVG_NS}}}g")+ group.set("data-pptx-source-ref", "slide:2")+ svg.write_bytes(ET.tostring(root))+ source = SimpleNamespace(source_refs={+ "slide:2": SourceRefRecord((), "", "semantic-shape"),+ })+ unchanged = SVGQualityChecker()._check_roundtrip_file(+ svg, source, copy.deepcopy(root), {}, {},+ output_index=1, source_slide=1,+ )+ self.assertFalse(unchanged["errors"], unchanged)+ ordinary = (+ f'<svg xmlns="{SVG_NS}" viewBox="0 0 1280 720" font-family="Arial">'+ f'<g id="ordinary">{first}{second}</g></svg>'+ )+ svg.write_text(ordinary, encoding="utf-8")+ convert_svg_to_slide_shapes(str(svg), resource_root=svg.parent)+ with contextlib.redirect_stdout(io.StringIO()):+ result = SVGQualityChecker().check_file(str(svg))+ self.assertNotIn("Semantic shape", "\n".join(result["errors"]))++ def test_c4_no_notes_removes_parts_overrides_and_relationships(self) -> None:+ with tempfile.TemporaryDirectory() as tmp:+ workspace = _workspace(Path(tmp), notes=True)+ self.assertFalse((workspace / "page_plan.json").exists())+ output = workspace / "exports/no_notes.pptx"+ code, log = _invoke(export_cli.main, workspace, "--roundtrip", "--no-notes", "-o", output)+ self.assertEqual(code, 0, log)+ with zipfile.ZipFile(output) as archive:+ self.assertFalse([name for name in archive.namelist() if name.startswith((+ "ppt/notesSlides/", "ppt/notesMasters/",+ ))])+ for name in archive.namelist():+ if name.endswith(".rels") or name == "[Content_Types].xml":+ self.assertNotIn(b"notesSlide", archive.read(name), name)+ self.assertNotIn(b"notesMaster", archive.read(name), name)+ report = audit_pptx_delivery(output)+ self.assertFalse(report["errors"], report)+ orphan = workspace / "exports/orphan.pptx"+ with zipfile.ZipFile(output) as source, zipfile.ZipFile(orphan, "w") as target:+ for name in source.namelist():+ payload = source.read(name)+ if name == "[Content_Types].xml":+ tree = ET.fromstring(payload)+ ET.SubElement(tree, f"{tree.tag.removesuffix('Types')}Override", {+ "PartName": "/ppt/notesSlides/notesSlide1_tf1.xml",+ "ContentType": "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml",+ })+ payload = ET.tostring(tree)+ target.writestr(name, payload)+ target.writestr(+ "ppt/notesSlides/notesSlide1_tf1.xml",+ '<p:notes xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"/>',+ )+ report = audit_pptx_delivery(orphan)+ self.assertFalse(report["errors"], report)+ advisory = next((+ item for item in report["advisories"] if item["code"] == "orphan_notes_parts"+ ), None)+ self.assertIsNotNone(advisory, report)+ self.assertEqual(advisory["parts"], ["ppt/notesSlides/notesSlide1_tf1.xml"])diff --git a/skills/ppt-master/scripts/tts_backends/backend_edge.py b/skills/ppt-master/scripts/tts_backends/backend_edge.pyindex 77506f04..2f5dff5d 100644--- a/skills/ppt-master/scripts/tts_backends/backend_edge.py+++ b/skills/ppt-master/scripts/tts_backends/backend_edge.py@@ -80,6 +80,8 @@ async def generate(*,voice: str,rate: str,+ pitch: str = "+0Hz",+ volume: str = "+0%",subtitle_path: Path | None = None,subtitle_max_chars: int = DEFAULT_SUBTITLE_MAX_CHARS,) -> None:@@ -91,6 +93,8 @@ async def generate(subtitle_path,voice=voice,rate=rate,+ pitch=pitch,+ volume=volume,max_chars=subtitle_max_chars,)return@@ -103,7 +107,9 @@ async def generate("python3 -m pip install edge-tts") from exc- communicate = edge_tts.Communicate(text, voice=voice, rate=normalize_rate(rate))+ communicate = edge_tts.Communicate(+ text, voice=voice, rate=normalize_rate(rate), pitch=pitch, volume=volume,+ )await communicate.save(str(output_path))@@ -439,6 +445,8 @@ async def _generate_with_subtitles(*,voice: str,rate: str,+ pitch: str = "+0Hz",+ volume: str = "+0%",max_chars: int,) -> None:"""Generate one MP3 and compact SRT from the same Edge word-timing stream."""@@ -454,6 +462,8 @@ async def _generate_with_subtitles(text,voice=voice,rate=normalize_rate(rate),+ pitch=pitch,+ volume=volume,boundary="WordBoundary",)audio_descriptor = -1