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): avoid reopening completed Stage 3
hugohe3a62705934844
diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.pyindex 5e083dde..ca550ad7 100644--- a/skills/ppt-master/scripts/confirm_ui/server.py+++ b/skills/ppt-master/scripts/confirm_ui/server.py@@ -1103,17 +1103,9 @@ def _wait_only_for_result(logger.info('waiting for browser confirmation stage=%s...', target_stage)deadline = None if timeout <= 0 else time.time() + timeoutwhile True:- current_stage = _result_stage(result_file)- if current_stage == target_stage:- logger.info('confirmation stage=%s received: %s', target_stage, result_file)- return 0- if _result_stage_number(current_stage) > _result_stage_number(target_stage):- logger.error(- 'confirmation skipped expected stage=%s and advanced to %s',- target_stage,- current_stage,- )- return 2+ result_status = _wait_result_status(result_file, target_stage)+ if result_status is not None:+ return result_statusskip_error = _stage_skip_error(result_file.parent)if skip_error:@@ -1136,6 +1128,25 @@ def _wait_only_for_result(time.sleep(0.5)+def _wait_result_status(+ result_file: Path,+ target_stage: str,+) -> Optional[int]:+ """Return a terminal wait status when the persisted result resolves the target."""+ current_stage = _result_stage(result_file)+ if current_stage == target_stage:+ logger.info('confirmation stage=%s received: %s', target_stage, result_file)+ return 0+ if _result_stage_number(current_stage) > _result_stage_number(target_stage):+ logger.error(+ 'confirmation skipped expected stage=%s and advanced to %s',+ target_stage,+ current_stage,+ )+ return 2+ return None++def _shutdown_existing(lock_file: Path) -> int:"""Stop a confirm server left running for this project (idempotent).@@ -1553,8 +1564,9 @@ def build_parser() -> argparse.ArgumentParser:parser.add_argument('--wait-only', action='store_true',help='Attach to the confirm server for this project and wait for an '- 'already-open page to write result.json. If the server died, '- 'recover it on the recorded/default port so browser polling can resume.',+ 'already-open page to write result.json. If the target result is '+ 'already persisted, return without recovery; otherwise recover a '+ 'dead server on the recorded/default port so browser polling can resume.',)parser.add_argument('--wait-stage', default='final', metavar='{stage2,final}',@@ -1607,8 +1619,12 @@ def main(argv: Optional[list[str]] = None) -> int:# until the page writes the requested intermediate or final result.json.if args.wait_only:lock_file = project_path / LOCK_FILE_NAME+ result_file = project_path / CONFIRM_DIR_NAME / RESULT_NAMEif not _live_lock(lock_file):confirm_dir = project_path / CONFIRM_DIR_NAME+ result_status = _wait_result_status(result_file, wait_stage)+ if result_status is not None:+ return result_statusrec_file = _active_recommendations_path(confirm_dir)if not rec_file.exists():logger.error(@@ -1634,7 +1650,7 @@ def main(argv: Optional[list[str]] = None) -> int:_server_url(actual_port),)return _wait_only_for_result(- project_path / CONFIRM_DIR_NAME / RESULT_NAME,+ result_file,lock_file,args.wait_timeout,wait_stage,diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.mdindex 5b9cb128..3766e581 100644--- a/skills/ppt-master/scripts/docs/confirm_ui.md+++ b/skills/ppt-master/scripts/docs/confirm_ui.md@@ -35,7 +35,7 @@ python3 scripts/confirm_ui/server.py <project_path> --shutdown # Step 4 clean- In `--daemon` mode the launcher starts the child server with browser opening suppressed, waits for `GET /api/health` to prove the server is accepting requests, then opens the printed `http://127.0.0.1:<port>` URL. If health never becomes reachable, the command fails before presenting a dead page.- **Shares port 5050 with the live preview server** (`svg_editor/server.py`). The two never run at once: confirm is Step 4, live preview is Step 6, and Step 4 always shuts this server down on exit (see `--shutdown`) so the port is free. One port = one forward rule for the whole pipeline. They still keep **separate processes and locks** (`.confirm_ui.lock` vs `.live_preview.lock`).- `--daemon` starts the Flask process in the background; add `--wait` in the main pipeline so the parent command returns only after the page writes a fresh `result.json`. The `--wait` budget defaults to **590 s** (`--wait-timeout`), kept under the typical 600 s tool ceiling — run the launch with a long tool timeout (≈600000 ms). On timeout the parent returns non-zero but the detached server keeps running, so the caller must re-check `result.json` once before the chat fallback (a slow user may confirm just after the wait returns).-- `--wait-only` attaches to the page already running from the first `--daemon --wait` and blocks until the page writes the requested stage. If the recorded server died, it automatically restarts on the recorded/default port so polling reconnects. Use `--wait-stage stage2` for the complete-solution handoff, then the default `--wait-stage final` for Stage 3. It keys on stage alone (no mtime gate), because a user may submit before the wait command starts.+- `--wait-only` attaches to the page already running from the first `--daemon --wait` and blocks until the page writes the requested stage. If that stage is already persisted, it returns before attempting server recovery, so a fast final confirmation cannot reopen Stage 3 after the page shuts itself down. Otherwise, if the recorded server died, it automatically restarts on the recorded/default port so polling reconnects. Use `--wait-stage stage2` for the complete-solution handoff, then the default `--wait-stage final` for Stage 3. It keys on stage alone (no mtime gate), because a user may submit before the wait command starts.- `--shutdown` stops a confirm server left running for this project and exits — **idempotent** (a no-op when nothing is running). Tries a graceful `/api/shutdown`, falls back to killing the recorded pid, then clears the lock. Generate Step 4 runs this on every path (page-confirm or chat-fallback) so the page never lingers on the shared port before live preview starts.- Refuses to start unless the recommendation file expected from `result.json` exists (initially `<project_path>/confirm_ui/recommendations.stage1.json`; `--shutdown` needs no recommendations).- Per-project lock at `<project_path>/.confirm_ui.lock` — duplicate launches are refused; stale locks (dead pid) are overwritten.