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(roundtrip): compact source-backed SVG objects
hugohe3d19669bc63eb
diff --git a/skills/ppt-master/scripts/authoring_roundtrip.py b/skills/ppt-master/scripts/authoring_roundtrip.pyindex 128ab4b6..3eb3039d 100644--- a/skills/ppt-master/scripts/authoring_roundtrip.py+++ b/skills/ppt-master/scripts/authoring_roundtrip.py@@ -36,6 +36,8 @@ from svg_authoring_view import (AUTHORING_MANIFEST_NAME,AUTHORING_SCHEMA,SOURCE_REF_ATTRIBUTE,+ SOURCE_PROXY_ATTRIBUTE,+ SOURCE_PROXY_KIND,project_svg_batch,semantic_subtree_sha256,)@@ -60,6 +62,9 @@ class AuthoringRoundtripError(RuntimeError):class SourceRefRecord:source_path: tuple[int, ...]initial_authoring_subtree_sha256: str+ representation: str+ proxy_asset: Path | None = None+ proxy_asset_sha256: str | None = None@dataclass(frozen=True)@@ -189,7 +194,7 @@ def is_flat_authoring_bundle(authoring_dir: Path) -> bool:def _load_documents(project_path: Path,authoring_dir: Path,-) -> tuple[Path, dict[str, AuthoringDocument], dict[str, Any]]:+) -> tuple[Path, Path, dict[str, AuthoringDocument], dict[str, Any]]:manifest_path = authoring_dir / AUTHORING_MANIFEST_NAMEmanifest = _load_json(manifest_path, context="flat authoring manifest")if manifest.get("schema") != AUTHORING_SCHEMA:@@ -241,6 +246,7 @@ def _load_documents()flat_root_raw = directories.get("flatSvg")layered_root_raw = directories.get("layeredSvg")+ proxy_root_raw = directories.get("sourceObjectPreviews")if not isinstance(flat_root_raw, str) or not flat_root_raw:raise AuthoringRoundtripError("Round-trip workspace manifest has no flat SVG backing directory"@@ -249,6 +255,10 @@ def _load_documents(raise AuthoringRoundtripError("Round-trip workspace manifest has no layered SVG backing directory")+ if not isinstance(proxy_root_raw, str) or not proxy_root_raw:+ raise AuthoringRoundtripError(+ "Round-trip workspace manifest has no source-object preview directory"+ )flat_root = _resolve_inside(project_path,flat_root_raw,@@ -259,6 +269,11 @@ def _load_documents(layered_root_raw,context="round-trip layered SVG backing directory",)+ proxy_root = _resolve_inside(+ project_path,+ proxy_root_raw,+ context="round-trip source-object preview directory",+ )if source_root != flat_root:raise AuthoringRoundtripError("Authoring manifest source_root does not match the round-trip flat "@@ -359,6 +374,46 @@ def _load_documents(raise AuthoringRoundtripError(f"{authoring_name} source ref {source_ref!r} has no initial hash")+ representation = ref_raw.get("representation")+ if representation not in {"inline", "source-proxy"}:+ raise AuthoringRoundtripError(+ f"{authoring_name} source ref {source_ref!r} has an "+ "unsupported representation"+ )+ proxy_asset: Path | None = None+ proxy_asset_sha256: str | None = None+ if representation == "source-proxy":+ proxy_asset_raw = ref_raw.get("proxy_asset")+ proxy_asset_sha256_raw = ref_raw.get("proxy_asset_sha256")+ if (+ not isinstance(proxy_asset_raw, str)+ or not proxy_asset_raw+ or not isinstance(proxy_asset_sha256_raw, str)+ or re.fullmatch(r"[0-9a-f]{64}", proxy_asset_sha256_raw) is None+ ):+ raise AuthoringRoundtripError(+ f"{authoring_name} source proxy {source_ref!r} has "+ "incomplete asset metadata"+ )+ proxy_asset = (authoring_dir / proxy_asset_raw).resolve()+ try:+ proxy_asset.relative_to(proxy_root)+ except ValueError as exc:+ proxy_root_name = proxy_root.relative_to(project_path).as_posix()+ raise AuthoringRoundtripError(+ f"{authoring_name} source proxy {source_ref!r} must use "+ f"{proxy_root_name}/"+ ) from exc+ if (+ not proxy_asset.is_file()+ or proxy_asset.suffix.lower() != ".svg"+ or _sha256_file(proxy_asset) != proxy_asset_sha256_raw+ ):+ raise AuthoringRoundtripError(+ f"{authoring_name} source proxy asset is missing or changed: "+ f"{proxy_asset}"+ )+ proxy_asset_sha256 = proxy_asset_sha256_rawsource_path_tuple = tuple(source_path_raw)source_element = _source_element(flat_root, source_path_tuple)if _source_identity(source_element) != source_ref:@@ -369,6 +424,9 @@ def _load_documents(refs[source_ref] = SourceRefRecord(source_path=source_path_tuple,initial_authoring_subtree_sha256=initial_hash,+ representation=representation,+ proxy_asset=proxy_asset,+ proxy_asset_sha256=proxy_asset_sha256,)documents[authoring_name] = AuthoringDocument(name=authoring_name,@@ -399,7 +457,7 @@ def _load_documents(raise AuthoringRoundtripError("authoring_manifest.json source_ref_count does not match documents")- return source_root, documents, manifest+ return source_root, proxy_root, documents, manifestdef _load_current_assets(@@ -506,6 +564,7 @@ def _baseline_assets(def _generate_baseline_bundle(project_path: Path,source_root: Path,+ source_proxy_dir: Path,documents: dict[str, AuthoringDocument],inventory: dict[str, Any] | None,) -> tuple[tempfile.TemporaryDirectory[str], Path, dict[str, VectorAssetRecord]]:@@ -525,6 +584,8 @@ def _generate_baseline_bundle(baseline_root,force=False,projection_kind="flat",+ source_proxy_dir=source_proxy_dir,+ publish_source_proxies=False,)if inventory is None:return temporary, baseline_root, {}@@ -905,6 +966,22 @@ def _materialize_document(f"{document.name} regenerated baseline has duplicate source refs: "+ ", ".join(baseline_duplicates))+ manifest_proxy_refs = {+ source_ref+ for source_ref, record in document.source_refs.items()+ if record.representation == "source-proxy"+ }+ baseline_proxy_refs = {+ source_ref+ for source_ref, occurrences in baseline_occurrences.items()+ if occurrences[0].element.get(SOURCE_PROXY_ATTRIBUTE) == SOURCE_PROXY_KIND+ }+ if baseline_proxy_refs != manifest_proxy_refs:+ raise AuthoringRoundtripError(+ f"{document.name} regenerated source-proxy roster differs; "+ f"missing={sorted(manifest_proxy_refs - baseline_proxy_refs)}, "+ f"extra={sorted(baseline_proxy_refs - manifest_proxy_refs)}"+ )current_unknown = sorted(set(current_occurrences) - expected_refs)if current_unknown:raise AuthoringRoundtripError(@@ -950,6 +1027,27 @@ def _materialize_document(else:edited_refs.add(source_ref)deleted_refs = expected_refs - set(current_occurrences)+ edited_proxy_refs = sorted(edited_refs & manifest_proxy_refs)+ if edited_proxy_refs:+ raise AuthoringRoundtripError(+ f"{document.name} edits source-backed proxy object(s): "+ + ", ".join(edited_proxy_refs)+ + "; keep each proxy unchanged to restore its native PowerPoint "+ "object; only a complete Slide-local proxy may be removed to "+ "delete that object"+ )+ deleted_inherited_proxy_refs = sorted(+ source_ref+ for source_ref in deleted_refs & manifest_proxy_refs+ if not source_ref.startswith("slide:")+ )+ if deleted_inherited_proxy_refs:+ raise AuthoringRoundtripError(+ f"{document.name} deletes inherited source-backed proxy object(s): "+ + ", ".join(deleted_inherited_proxy_refs)+ + "; Master/Layout proxies must remain unchanged because a flat "+ "slide cannot delete shared structure"+ )baseline_use_counts: Counter[tuple[str, str]] = Counter()for use in baseline_root.iter():@@ -1150,7 +1248,10 @@ def materialize_flat_authoring_roundtrip()output_dir.mkdir(parents=True, exist_ok=True)- source_root, documents, manifest = _load_documents(project_path, authoring_dir)+ source_root, source_proxy_dir, documents, manifest = _load_documents(+ project_path,+ authoring_dir,+ )current_assets, inventory = _load_current_assets(project_path,authoring_dir,@@ -1159,6 +1260,7 @@ def materialize_flat_authoring_roundtrip(baseline_temporary, baseline_root, baseline_assets = _generate_baseline_bundle(project_path,source_root,+ source_proxy_dir,documents,inventory,)diff --git a/skills/ppt-master/scripts/pptx_to_svg/converter.py b/skills/ppt-master/scripts/pptx_to_svg/converter.pyindex 72b5b790..2812a187 100644--- a/skills/ppt-master/scripts/pptx_to_svg/converter.py+++ b/skills/ppt-master/scripts/pptx_to_svg/converter.py@@ -1451,9 +1451,9 @@ def _write_artifact_tree(continuetarget.write_bytes(blob)if result.native_structure is not None:- _write_roundtrip_manifest(output_dir, result, options)flat_dir = output_dir / ROUNDTRIP_FLAT_SVG_DIRauthoring_dir = output_dir / AUTHORING_SVG_FLAT_DIR+ source_proxy_dir = media_dir / "source-object-previews"mapping = [(source, authoring_dir / source.name)for source in sorted(flat_dir.glob("slide_*.svg"))@@ -1468,7 +1468,9 @@ def _write_artifact_tree(authoring_dir,force=False,projection_kind="flat",+ source_proxy_dir=source_proxy_dir,)+ _write_roundtrip_manifest(output_dir, result, options)def _sha256_file(path: Path) -> str:@@ -1583,6 +1585,9 @@ def _write_roundtrip_manifest(row["flatSvg"] = flat_path.as_posix()row["flatSvgSha256"] = _sha256_file(output_dir / flat_path)referenced_svg_paths.append(output_dir / flat_path)+ authoring_path = AUTHORING_SVG_FLAT_DIR / f"slide_{slide.index:02d}.svg"+ if (output_dir / authoring_path).is_file():+ referenced_svg_paths.append(output_dir / authoring_path)derived_paths = sorted(_referenced_local_paths(output_dir, referenced_svg_paths)- materialized_resource_paths,@@ -1642,6 +1647,9 @@ def _write_roundtrip_manifest(else None),"images": options.images_subdir,+ "sourceObjectPreviews": (+ Path(options.images_subdir) / "source-object-previews"+ ).as_posix(),"sounds": options.sound_subdir,"audio": "audio","video": "video",diff --git a/skills/ppt-master/scripts/svg_authoring_view.py b/skills/ppt-master/scripts/svg_authoring_view.pyindex 67c98022..7f2ee21f 100644--- a/skills/ppt-master/scripts/svg_authoring_view.py+++ b/skills/ppt-master/scripts/svg_authoring_view.py@@ -33,9 +33,11 @@ destination set unchanged.from __future__ import annotationsimport argparse+import copyimport hashlibimport jsonimport os+import reimport shutilimport sysimport tempfile@@ -59,6 +61,11 @@ AUTHORING_SUMMARY_NAME = "authoring_summary.json"AUTHORING_SCHEMA = "ppt-master.svg-authoring-ir.v1"AUTHORING_SUMMARY_SCHEMA = "ppt-master.svg-authoring-summary.v1"SOURCE_REF_ATTRIBUTE = "data-pptx-source-ref"+SOURCE_PROXY_ATTRIBUTE = "data-pptx-source-proxy"+SOURCE_PROXY_KIND = "native-restore"+# Keep ordinary text and shape groups inline. Objects beyond one filesystem+# block are treated as atomic source-backed visuals in round-trip flat pages.+SOURCE_PROXY_MIN_BYTES = 4096_DRAWABLE_TAGS = frozenset({"circle","ellipse",@@ -68,6 +75,7 @@ _DRAWABLE_TAGS = frozenset({"polyline","rect",})+_URL_ID_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"\s]+)\1\s*\)")ET.register_namespace("", SVG_NS)ET.register_namespace("xlink", XLINK_NS)@@ -99,12 +107,24 @@ class SourceReference:source_ref: strsource_path: tuple[int, ...]initial_authoring_subtree_sha256: str | None = None+ representation: str = "inline"+ proxy_asset: Path | None = None+ proxy_asset_sha256: str | None = None- def as_dict(self) -> dict[str, object]:- return {+ def as_dict(self, output_dir: Path) -> dict[str, object]:+ payload: dict[str, object] = {"source_path": list(self.source_path),"initial_authoring_subtree_sha256": self.initial_authoring_subtree_sha256,+ "representation": self.representation,}+ if self.representation == "source-proxy":+ if self.proxy_asset is None or self.proxy_asset_sha256 is None:+ raise ValueError(+ f"Source proxy {self.source_ref} has no immutable asset record"+ )+ payload["proxy_asset"] = _portable_path(self.proxy_asset, output_dir)+ payload["proxy_asset_sha256"] = self.proxy_asset_sha256+ return payloaddef _semantic_text(value: str | None) -> str | None:@@ -250,6 +270,9 @@ class ProjectionStats:compatibility_normalizations: int = 0asset_references_rewritten: int = 0coordinate_attributes_compacted: int = 0+ source_object_proxies: int = 0+ source_object_proxy_bytes: int = 0+ unused_definitions_pruned: int = 0source_attributes: Counter[str] = field(default_factory=Counter)def as_dict(self) -> dict[str, object]:@@ -262,6 +285,9 @@ class ProjectionStats:"source_attributes": dict(sorted(self.source_attributes.items())),"asset_references_rewritten": self.asset_references_rewritten,"coordinate_attributes_compacted": self.coordinate_attributes_compacted,+ "source_object_proxies": self.source_object_proxies,+ "source_object_proxy_bytes": self.source_object_proxy_bytes,+ "unused_definitions_pruned": self.unused_definitions_pruned,}def merge(self, other: "ProjectionStats") -> None:@@ -274,6 +300,9 @@ class ProjectionStats:self.coordinate_attributes_compacted += (other.coordinate_attributes_compacted)+ self.source_object_proxies += other.source_object_proxies+ self.source_object_proxy_bytes += other.source_object_proxy_bytes+ self.unused_definitions_pruned += other.unused_definitions_prunedself.source_attributes.update(other.source_attributes)@@ -430,7 +459,258 @@ def _rewrite_asset_references(stats.asset_references_rewritten += 1-def _render_projection(source: Path, output: Path) -> tuple[ProjectionReport, bytes]:+def _definition_references(element: ET.Element) -> set[str]:+ references: set[str] = set()+ for item in element.iter():+ for name, value in item.attrib.items():+ references.update(match.group(2) for match in _URL_ID_RE.finditer(value))+ if _local_name(name) == "href" and value.startswith("#"):+ references.add(value[1:])+ if item.text:+ references.update(+ match.group(2) for match in _URL_ID_RE.finditer(item.text)+ )+ return references+++def _definition_closure(+ root: ET.Element,+ content: list[ET.Element],+) -> tuple[list[ET.Element], set[int]]:+ definitions = [+ child for child in root+ if _local_name(child.tag) == "defs"+ ]+ owner_by_id: dict[str, ET.Element] = {}+ for definitions_root in definitions:+ for child in definitions_root:+ for item in child.iter():+ definition_id = item.get("id")+ if definition_id:+ owner_by_id.setdefault(definition_id, child)++ required_ids: set[str] = set()+ pending = [+ reference+ for element in content+ for reference in _definition_references(element)+ ]+ selected_owners: set[int] = set()+ while pending:+ definition_id = pending.pop()+ if definition_id in required_ids:+ continue+ required_ids.add(definition_id)+ owner = owner_by_id.get(definition_id)+ if owner is None or id(owner) in selected_owners:+ continue+ selected_owners.add(id(owner))+ pending.extend(_definition_references(owner) - required_ids)+ return definitions, selected_owners+++def _selected_definitions(+ root: ET.Element,+ content: list[ET.Element],+) -> list[ET.Element]:+ definitions, selected_owners = _definition_closure(root, content)+ selected: list[ET.Element] = []+ for definitions_root in definitions:+ clone = ET.Element(definitions_root.tag, dict(definitions_root.attrib))+ clone.text = definitions_root.text+ for child in definitions_root:+ always_keep = _local_name(child.tag) == "style" or not child.get("id")+ if always_keep or id(child) in selected_owners:+ clone.append(copy.deepcopy(child))+ if list(clone) or (clone.text and clone.text.strip()):+ selected.append(clone)+ return selected+++def _prune_unreferenced_definitions(+ root: ET.Element,+ stats: ProjectionStats,+) -> None:+ definitions = [+ child for child in root+ if _local_name(child.tag) == "defs"+ ]+ if not definitions:+ return+ visible_content = [child for child in root if child not in definitions]+ _, selected_owners = _definition_closure(root, visible_content)+ for definitions_root in definitions:+ for child in list(definitions_root):+ always_keep = _local_name(child.tag) == "style" or not child.get("id")+ if always_keep or id(child) in selected_owners:+ continue+ definitions_root.remove(child)+ stats.unused_definitions_pruned += 1+ if not list(definitions_root) and not (+ definitions_root.text and definitions_root.text.strip()+ ):+ root.remove(definitions_root)+++def _proxy_canvas_attributes(root: ET.Element) -> dict[str, str]:+ view_box = (root.get("viewBox") or "").split()+ if len(view_box) == 4:+ x, y, width, height = view_box+ else:+ x = y = "0"+ width = root.get("width") or "1"+ height = root.get("height") or "1"+ return {+ "x": x,+ "y": y,+ "width": width,+ "height": height,+ "preserveAspectRatio": "none",+ }+++def _source_proxy_asset_bytes(+ root: ET.Element,+ element: ET.Element,+ authoring_dir: Path,+ proxy_dir: Path,+ stats: ProjectionStats,+) -> bytes:+ asset_root = ET.Element(root.tag, dict(root.attrib))+ for definitions in _selected_definitions(root, [element]):+ asset_root.append(definitions)+ asset_root.append(copy.deepcopy(element))+ for item in asset_root.iter():+ item.attrib.pop(SOURCE_REF_ATTRIBUTE, None)+ item.attrib.pop(SOURCE_PROXY_ATTRIBUTE, None)+ _rewrite_asset_references(+ asset_root,+ authoring_dir,+ proxy_dir,+ stats,+ )+ stats.coordinate_attributes_compacted += compact_svg_tree(+ asset_root,+ ).changed_attributes+ payload = ET.tostring(asset_root, encoding="utf-8", xml_declaration=False)+ return payload if payload.endswith(b"\n") else payload + b"\n"+++def _source_proxy_element(+ root: ET.Element,+ source: ET.Element,+ source_ref: str,+ asset_path: Path,+ output_dir: Path,+) -> ET.Element:+ proxy = ET.Element(f"{{{SVG_NS}}}image")+ for name in (+ "id",+ "data-pptx-object",+ "data-pptx-frame",+ "data-pptx-import-source",+ "data-pptx-replacement-status",+ "data-pptx-replace-with",+ "data-pptx-placeholder",+ "data-pptx-placeholder-type",+ "data-pptx-placeholder-idx",+ "data-pptx-structure-role",+ ):+ value = source.get(name)+ if value is not None:+ proxy.set(name, value)+ proxy.attrib.update(_proxy_canvas_attributes(root))+ proxy.set(+ "href",+ os.path.relpath(asset_path, output_dir).replace(os.sep, "/"),+ )+ proxy.set(SOURCE_REF_ATTRIBUTE, source_ref)+ proxy.set(SOURCE_PROXY_ATTRIBUTE, SOURCE_PROXY_KIND)+ proxy.tail = source.tail+ return proxy+++def _externalize_large_source_objects(+ root: ET.Element,+ references: list[SourceReference],+ output_dir: Path,+ proxy_dir: Path,+ stats: ProjectionStats,+) -> dict[Path, bytes]:+ reference_by_id = {+ reference.source_ref: reference+ for reference in references+ }+ candidates: list[tuple[ET.Element, ET.Element]] = []++ def visit(parent: ET.Element, inside_source_ref: bool) -> None:+ for child in list(parent):+ source_ref = child.get(SOURCE_REF_ATTRIBUTE)+ if source_ref and not inside_source_ref:+ candidates.append((parent, child))+ continue+ visit(child, inside_source_ref or bool(source_ref))++ visit(root, False)+ assets: dict[Path, bytes] = {}+ for parent, element in candidates:+ original_bytes = len(ET.tostring(element, encoding="utf-8"))+ if original_bytes < SOURCE_PROXY_MIN_BYTES:+ continue+ source_ref = element.get(SOURCE_REF_ATTRIBUTE)+ if not source_ref or source_ref not in reference_by_id:+ raise ValueError("Large source object has no manifest reference")+ payload = _source_proxy_asset_bytes(+ root,+ element,+ output_dir,+ proxy_dir,+ stats,+ )+ digest = hashlib.sha256(payload).hexdigest()+ asset_path = proxy_dir / f"source-object-{digest}.svg"+ previous = assets.get(asset_path)+ if previous is not None and previous != payload:+ raise ValueError(f"Source proxy hash collision: {asset_path.name}")+ assets[asset_path] = payload++ reference = reference_by_id[source_ref]+ reference.representation = "source-proxy"+ reference.proxy_asset = asset_path+ reference.proxy_asset_sha256 = digest+ proxy = _source_proxy_element(+ root,+ element,+ source_ref,+ asset_path,+ output_dir,+ )+ siblings = list(parent)+ index = siblings.index(element)+ parent.remove(element)+ parent.insert(index, proxy)+ stats.source_object_proxies += 1+ stats.source_object_proxy_bytes += original_bytes++ _prune_unreferenced_definitions(root, stats)+ active_refs = {+ source_ref+ for element in root.iter()+ if (source_ref := element.get(SOURCE_REF_ATTRIBUTE))+ }+ references[:] = [+ reference+ for reference in references+ if reference.source_ref in active_refs+ ]+ return assets+++def _render_projection(+ source: Path,+ output: Path,+ source_proxy_dir: Path | None = None,+) -> tuple[ProjectionReport, bytes, dict[Path, bytes]]:"""Build one projection in memory without changing source or destination."""original = source.read_bytes()parser = ET.XMLParser(@@ -451,6 +731,15 @@ def _render_projection(source: Path, output: Path) -> tuple[ProjectionReport, bystats.coordinate_attributes_compacted = compact_svg_tree(root,).changed_attributes+ source_proxy_assets: dict[Path, bytes] = {}+ if source_proxy_dir is not None:+ source_proxy_assets = _externalize_large_source_objects(+ root,+ source_references,+ output.parent,+ source_proxy_dir,+ stats,+ )_index_initial_authoring_references(root, source_references)projected = ET.tostring(root, encoding="utf-8", xml_declaration=False)@@ -467,7 +756,7 @@ def _render_projection(source: Path, output: Path) -> tuple[ProjectionReport, byinitial_authoring_sha256=hashlib.sha256(projected).hexdigest(),source_references=source_references,)- return report, projected+ return report, projected, source_proxy_assetsdef _portable_path(path: Path, base: Path) -> str:@@ -491,7 +780,7 @@ def _authoring_manifest_bytes("source_sha256": report.source_sha256,"initial_authoring_sha256": report.initial_authoring_sha256,"source_refs": {- reference.source_ref: reference.as_dict()+ reference.source_ref: reference.as_dict(output_dir)for reference in sorted(report.source_references,key=lambda item: item.source_ref,@@ -579,6 +868,10 @@ def _authoring_summary_document(element.get(SOURCE_REF_ATTRIBUTE) is not Nonefor element in elements),+ "source_proxies": sum(+ element.get(SOURCE_PROXY_ATTRIBUTE) == SOURCE_PROXY_KIND+ for element in elements+ ),}@@ -678,6 +971,10 @@ def _authoring_summary_bytes(authoring_dir: Path) -> bytes:int(document["inline_source_refs"])for document in documents),+ "source_proxies": sum(+ int(document["source_proxies"])+ for document in documents+ ),"machine_source_refs": manifest.get("source_ref_count"),}payload = {@@ -690,6 +987,19 @@ def _authoring_summary_bytes(authoring_dir: Path) -> bytes:"totals": totals,"documents": documents,}+ if totals["source_proxies"]:+ payload["source_proxy_policy"] = {+ "marker": f'{SOURCE_PROXY_ATTRIBUTE}="{SOURCE_PROXY_KIND}"',+ "purpose": (+ "Atomic visual preview of an immutable source-backed "+ "PowerPoint object"+ ),+ "editing": (+ "Keep unchanged to restore the native object; a Slide-local "+ "proxy may be removed to delete it; inherited proxies must "+ "remain; do not edit the proxy or its asset"+ ),+ }return (json.dumps(payload, ensure_ascii=False, indent=2) + "\n").encode("utf-8")@@ -839,9 +1149,32 @@ def project_svg_batch(*,force: bool,projection_kind: str,+ source_proxy_dir: Path | None = None,+ publish_source_proxies: bool = True,) -> list[ProjectionReport]:"""Build and publish one complete authoring bundle transactionally."""- rendered = [_render_projection(source, output) for source, output in mapping]+ if source_proxy_dir is not None and _is_within(+ source_proxy_dir.resolve(),+ output_dir.resolve(),+ ):+ raise ValueError("Source proxy assets must live outside the authoring bundle")+ rendered = [+ _render_projection(source, output, source_proxy_dir)+ for source, output in mapping+ ]+ proxy_assets: dict[Path, bytes] = {}+ for _, _, rendered_assets in rendered:+ for target, payload in rendered_assets.items():+ previous = proxy_assets.get(target)+ if previous is not None and previous != payload:+ raise ValueError(f"Source proxy collision: {target}")+ proxy_assets[target] = payload+ if source_proxy_dir is not None and not publish_source_proxies:+ for target, payload in proxy_assets.items():+ if not target.is_file() or target.read_bytes() != payload:+ raise ValueError(+ f"Source proxy asset is missing or stale: {target}"+ )staging_parent = _nearest_existing_directory(output_dir.parent)with tempfile.TemporaryDirectory(@@ -852,7 +1185,7 @@ def project_svg_batch(new_root = staging_root / "projected"staged: list[tuple[Path, Path]] = []- for report, projected in rendered:+ for report, projected, _ in rendered:relative = report.output.relative_to(output_dir)staged_file = new_root / relativestaged_file.parent.mkdir(parents=True, exist_ok=True)@@ -863,7 +1196,7 @@ def project_svg_batch(staged_manifest = new_root / AUTHORING_MANIFEST_NAMEstaged_manifest.write_bytes(_authoring_manifest_bytes(- [report for report, _ in rendered],+ [report for report, _, _ in rendered],source_root,output_dir,projection_kind,@@ -878,7 +1211,32 @@ def project_svg_batch())- if not output_dir.exists():+ if publish_source_proxies:+ proxy_staging = staging_root / "source-proxies"+ for index, (target, payload) in enumerate(sorted(+ proxy_assets.items(),+ key=lambda item: item[0].as_posix(),+ )):+ if os.path.lexists(target):+ if (+ target.is_symlink()+ or not target.is_file()+ or target.read_bytes() != payload+ ):+ raise FileExistsError(+ f"Source proxy target has different content: {target}"+ )+ continue+ staged_proxy = proxy_staging / f"{index:06d}.svg"+ staged_proxy.parent.mkdir(parents=True, exist_ok=True)+ staged_proxy.write_bytes(payload)+ staged.append((target, staged_proxy))++ has_external_targets = any(+ not _is_within(target.resolve(), output_dir.resolve())+ for target, _ in staged+ )+ if not output_dir.exists() and not has_external_targets:created: list[Path] = []try:_ensure_directory(output_dir.parent, created)@@ -906,7 +1264,7 @@ def project_svg_batch(force=force,)- return [report for report, _ in rendered]+ return [report for report, _, _ in rendered]def _is_within(path: Path, parent: Path) -> bool: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 65884a1e..7b90990c 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@@ -1528,7 +1528,8 @@ Recorded narration:'Source-preserving import export from authoring-svg-flat/ against ''the validated sources/source.pptx and analysis contracts emitted ''by pptx_to_svg.py --roundtrip. Unchanged authoring objects recover '- 'their source semantics; edited objects remain authored SVG. No '+ 'their source semantics; edited inline objects remain authored SVG, '+ 'while atomic source-proxy edits fail closed. No ''other -s/--source directory is accepted in round-trip mode.'),)