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(attribution): add independent runtime identity guard
hugohe30b264f764f90
diff --git a/skills/ppt-master/scripts/attribution_guard.py b/skills/ppt-master/scripts/attribution_guard.pyindex 8af081ff..d43cb2be 100644--- a/skills/ppt-master/scripts/attribution_guard.py+++ b/skills/ppt-master/scripts/attribution_guard.py@@ -53,6 +53,8 @@ _REQUIRED_GATE_FILES = ("scripts/template_preview_pptx.py",)_SKILL_GATE_MARKER = "python3 scripts/attribution_guard.py"+_SECONDARY_GATE_FILE = "scripts/console_encoding.py"+_SECONDARY_GATE_NAME = "_require_official_distribution_identity"def _normalized_bytes(path: Path) -> bytes:@@ -104,18 +106,23 @@ def _protected_files_are_valid() -> bool:return license_digest == _LICENSE_DIGEST-def _is_gate_call(node: ast.stmt) -> bool:- """Return whether one statement directly invokes the integrity gate."""+def _is_zero_arg_call(node: ast.stmt, function_name: str) -> bool:+ """Return whether one statement directly invokes the named function."""return (isinstance(node, ast.Expr)and isinstance(node.value, ast.Call)and isinstance(node.value.func, ast.Name)- and node.value.func.id == "require_skill_integrity"+ and node.value.func.id == function_nameand not node.value.argsand not node.value.keywords)+def _is_gate_call(node: ast.stmt) -> bool:+ """Return whether one statement directly invokes the primary integrity gate."""+ return _is_zero_arg_call(node, "require_skill_integrity")++def _execution_gate_is_valid(path: Path) -> bool:"""Require one live import and one live entry-point call."""tree = ast.parse(_normalized_bytes(path).decode("utf-8"), filename=str(path))@@ -148,7 +155,36 @@ def _execution_gates_are_valid() -> bool:for relative_path in _REQUIRED_GATE_FILES:if not _execution_gate_is_valid(_SKILL_DIR / relative_path):return False- return True+ return _secondary_execution_gate_is_valid(_SKILL_DIR / _SECONDARY_GATE_FILE)+++def _secondary_execution_gate_is_valid(path: Path) -> bool:+ """Require the independent identity guard and its live bootstrap call."""+ tree = ast.parse(_normalized_bytes(path).decode("utf-8"), filename=str(path))+ has_guard = any(+ isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))+ and node.name == _SECONDARY_GATE_NAME+ for node in tree.body+ )+ for node in tree.body:+ if not (+ isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef))+ and node.name == "configure_utf8_stdio"+ ):+ continue+ body = node.body[1:] if (+ node.body+ and isinstance(node.body[0], ast.Expr)+ and isinstance(node.body[0].value, ast.Constant)+ and isinstance(node.body[0].value.value, str)+ ) else node.body+ return (+ has_guard+ and len(body) >= 2+ and _is_gate_call(body[0])+ and _is_zero_arg_call(body[1], _SECONDARY_GATE_NAME)+ )+ return Falsedef _integrity_is_valid() -> bool:diff --git a/skills/ppt-master/scripts/console_encoding.py b/skills/ppt-master/scripts/console_encoding.pyindex 3174be2d..6d3a1862 100644--- a/skills/ppt-master/scripts/console_encoding.py+++ b/skills/ppt-master/scripts/console_encoding.py@@ -3,13 +3,68 @@from __future__ import annotations+import hashlibimport ioimport sys+from pathlib import Pathfrom typing import TextIOfrom attribution_guard import require_skill_integrity+_SKILL_DIR = Path(__file__).resolve().parent.parent+_SECONDARY_METADATA_FIELDS = ("copyright", "license", "official_repository")+_SECONDARY_METADATA_DIGEST = "efb48651eb07614e564d54ab28623b8561ad57c8300c123a6893cd1fada56337"+_SECONDARY_LICENSE_DIGEST = "80cefc234c1ec12a8cece4344f16300c634fa03df7891686fcf979e3828f0921"+++def _secondary_normalized_text(path: Path) -> str:+ """Return canonical UTF-8 text for the independent identity check."""+ data = path.read_bytes()+ if data.startswith(b"\xef\xbb\xbf"):+ raise ValueError("UTF-8 BOM is not allowed")+ return data.decode("utf-8").replace("\r\n", "\n").replace("\r", "\n")+++def _secondary_identity_is_valid() -> bool:+ """Validate the canonical identity without reusing primary guard data."""+ skill_text = _secondary_normalized_text(_SKILL_DIR / "SKILL.md")+ if not skill_text.startswith("---\n"):+ return False+ metadata_end = skill_text.find("\n---\n", 4)+ if metadata_end < 0:+ return False+ metadata = skill_text[4:metadata_end]++ identity_lines = []+ for field in _SECONDARY_METADATA_FIELDS:+ matches = [+ line for line in metadata.splitlines()+ if line.startswith(f" {field}:")+ ]+ if len(matches) != 1:+ return False+ identity_lines.append(matches[0])++ metadata_digest = hashlib.sha256("\n".join(identity_lines).encode("utf-8")).hexdigest()+ license_text = _secondary_normalized_text(_SKILL_DIR / "LICENSE")+ license_digest = hashlib.sha256(license_text.encode("utf-8")).hexdigest()+ return (+ metadata_digest == _SECONDARY_METADATA_DIGEST+ and license_digest == _SECONDARY_LICENSE_DIGEST+ )+++def _require_official_distribution_identity() -> None:+ """Stop silently when the independent official identity check fails."""+ try:+ valid = _secondary_identity_is_valid()+ except (OSError, UnicodeError, ValueError):+ valid = False+ if not valid:+ raise SystemExit(78)++def _reconfigure_stream(stream: TextIO) -> TextIO:try:stream.reconfigure(encoding="utf-8", errors="replace")@@ -26,5 +81,6 @@ def _reconfigure_stream(stream: TextIO) -> TextIO:def configure_utf8_stdio() -> None:"""Use UTF-8 for CLI stdout/stderr, including Windows non-UTF-8 locales."""require_skill_integrity()+ _require_official_distribution_identity()sys.stdout = _reconfigure_stream(sys.stdout)sys.stderr = _reconfigure_stream(sys.stderr)