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(confirm-ui): compose template kinds with scoped selectors

hugohe31a3df00adda5
diff --git a/docs/getting-started.md b/docs/getting-started.md
index cda920f8..02050532 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -46,7 +46,7 @@ A created template lives in one of two places:
| **Registered in the skill library** | `skills/ppt-master/templates/<kind>/<id>/` | Portable workspace plus global registration, so it appears when you ask "what templates are available?" |
| **Under projects** | `projects/<name>/` | The same portable workspace without global registration |
-Invoke either result by giving its **workspace-root path** in chat. Step 3 resolves `templates/design_spec.md`; for directory-shape compatibility it also accepts a legacy-flat Brand/Layout/Deck root that satisfies its current kind contract. Layout/Deck additionally require current structured SVGs; Style has no flat form. A create-template run may hand its exact validated workspace root directly to Step 3 in the same conversation. Both cases stay path-based; a bare template name never triggers. The complete workspace can be copied or migrated between the library and `projects/` without restructuring it; only library registration changes.
+Use a registered result from its kind dropdown in Step 3. To offer another result, supply its exact **workspace-root path** in chat: an unregistered root appears in the specified-root dropdown, while an exact registered match resolves back to its kind dropdown. Step 3 resolves `templates/design_spec.md`; for directory-shape compatibility it also accepts a legacy-flat Brand/Layout/Deck root that satisfies its current kind contract. Layout/Deck additionally require current structured SVGs; Style has no flat form. A create-template run may hand its exact validated workspace root directly to Step 3 in the same conversation. Both cases require an exact selection; a bare template name never triggers. The complete workspace can be copied or migrated between the library and `projects/` without restructuring it; only library registration changes.
```
You: Make a deck from sources/report.pdf with template skills/ppt-master/templates/layouts/presentation_core/
@@ -61,20 +61,20 @@ Full guide → [Templates Guide](./templates-guide.md)
The whole loop is three steps. Install first — you only need Python; see [Quick Start](../README.md#quick-start).
1. **Drop your source material** into `projects/` — a PDF, DOCX, Markdown file, a URL, or just text you'll paste.
-2. **Tell the AI in chat** what to turn into a deck (add a template path if you set one up above; otherwise it's free design):
+2. **Tell the AI in chat** what to turn into a deck. Step 3 then lets you choose free design or combine registered templates; add an exact unregistered template root in chat when you want it offered in the specified-root dropdown:
```
You: Make a deck from projects/q3-report/sources/report.pdf
You: Turn this text into a deck: <paste your text>
```
3. **Get an editable `.pptx`** at `exports/<name>_<timestamp>.pptx` — real DrawingML shapes, text boxes, and charts you can click and edit in PowerPoint, Keynote, WPS, or LibreOffice.
-Before it starts, the AI confirms a short design spec (template, format, page count, …); from there it handles content analysis, layout, image acquisition, SVG generation, and export — the core loop everything else builds on. To skip the confirmation step, see [Quick mode](#quick-mode) below.
+Before generation, Step 3 first confirms free design or the template combination. Stage 1 then independently confirms the communication contract and canvas/format; Stage 2 confirms page count, the visual system, and template application when active. From there the AI handles content analysis, layout, image acquisition, SVG generation, and export — the core loop everything else builds on. To skip interactive confirmation, see [Quick mode](#quick-mode) below.
---
## Quick mode
-The default flow confirms a short design spec with you first. To skip that step, explicitly ask for **quick generation**:
+The default flow runs the Step-3 choice and staged design confirmation first. To skip that interaction, explicitly ask for **quick generation**:
```
You: Quickly generate a deck from sources/report.pdf — no need to confirm with me
diff --git a/docs/technical-design.md b/docs/technical-design.md
index 5388e4bd..0e36e3de 100644
--- a/docs/technical-design.md
+++ b/docs/technical-design.md
@@ -365,8 +365,9 @@ The architectural choice worth flagging: **viewBox is in pixels, not absolute un
## Template System & Optional Path
Templates are **opt-in, not inferred**. Before Strategist Stage 1, the default UI
-opens an independent Step-3 choice: free design, registered library workspaces,
-or exact explicit roots supplied for the run. Free design remains the
+opens an independent Step-3 choice: free design, four registered single-select
+dropdowns (Brand / Style / Layout / Deck), and one single-select dropdown for
+exact roots supplied for the run. Free design remains the
content-derived path; the system never chooses a template from topic similarity.
**Why default to free design.** Templates are floors that easily become ceilings: they lock the deck into the template's visual idioms regardless of how the content actually wants to be presented. Free-design layouts derive structure from the source content rather than imposing it from a fixed grammar, so the visual rhythm tracks the content rather than fighting it. Constrained mode is genuinely better in narrow cases (brand-locked decks, strongly-typed scenarios like academic defense or government report), so it stays available — but the AI doesn't proactively reach for it; the user does.
@@ -378,7 +379,8 @@ Brand/Style/Layout/Deck entries only from their four `*_index.json` files;
chat discovery reads the same indexes and returns exact roots. Explicit paths
remain valid, and an exact path matching a registered canonical root may be
displayed as `library`; an unregistered root remains `explicit`. Current
-workspaces resolve `templates/design_spec.md`; compatible flat Brand/Layout/Deck
+workspaces resolve `templates/design_spec.md`; the server parses every explicit
+root's real `kind`, while the source label remains provenance only. Compatible flat Brand/Layout/Deck
packages may resolve direct `design_spec.md` only when they satisfy the current
kind contract, including current structured SVGs for Layout/Deck. Style has no
legacy-flat form. A free-form style brief remains ordinary Stage-2 input and
@@ -405,7 +407,8 @@ input.
another exact workspace root such as `projects/<name>/`. Step 3 validates,
fuses, and installs selected inputs into the current project's `templates/`,
`images/`, and `icons/`; it never copies `exports/`. Strategist and later roles
-read only that project-local copy. The source workspace remains portable between
+read only that project-local copy when template-aware planning begins after
+Stage 1. The source workspace remains portable between
locations without reshaping; global index registration controls whether it
appears as a library choice.
@@ -428,7 +431,7 @@ formatting from those rules plus the confirmed reading mode/type scale;
`mirror` preserves literal source formatting and text topology. Export may
place both rule sets into the same native Master/Layout graph.
-When several workspaces are selected, fusion is segment-level, not field-level. Brand owns identity, Style owns direction/method defaults, Layout owns compatible structure, and Deck supplies descriptive recurring-application context plus fallback identity/structure under the current Stage-1 communication contract. User confirmation remains highest. Style palette/type defaults never override Brand/Deck identity; its method/composition expectations must be compatible with the selected Deck application and Layout/Deck structure or fusion surfaces a conflict. A project-local Brand + Layout composition gets its application context from Stage 1 and is not automatically promoted into a reusable library Deck. Same-kind conflicts are surfaced rather than resolved by implicit ordering. This keeps template composition debuggable: a fused spec can say exactly which bundle owns each segment.
+When several workspaces are selected, fusion is segment-level, not field-level. Brand owns identity, Style owns direction/method defaults, Layout owns compatible structure, and Deck retains descriptive reusable-application context plus any identity/structure not overridden. Library/explicit provenance never changes that order. The current project's application contract comes only from confirmed Stage 1; Deck context is comparison input for Stage 2, not an override. User confirmation remains highest. Style palette/type defaults never override Brand/Deck identity; its method/composition expectations must be compatible with the selected Deck context and Layout/Deck structure or fusion surfaces a conflict. A project-local Brand + Layout composition gets its application context from Stage 1 and is not automatically promoted into a reusable library Deck. Same-kind conflicts are surfaced rather than resolved by implicit ordering. This keeps template composition debuggable: a fused spec can say exactly which bundle owns each segment.
**Raw PPTX files cannot be Step 3 workspaces.** Normal Generate may use a PPTX as source material, and `beautify-pptx` may redesign it while preserving page count, order, and per-page wording 1:1; neither treats the source PPTX as a Step 3 template. When a raw PPTX is used as a template or native slide shell and filled with new material, the default route is Fill Native PPTX. If the request permits splitting, merging, dropping, reordering, or narrative restructuring, it remains Generate. Only a request to create a reusable template workspace and reuse that design system in SVG-route Step 3 first runs Create Template and then supplies the generated workspace root.
@@ -444,7 +447,7 @@ PPT Master uses **role switching within one main agent** rather than parallel su
**Why role-specialized references, not one mega prompt.** Strategist runs in "negotiate with user" mode (open-ended, conversational, willing to back up); Executor runs in "produce strict XML" mode: it may not reselect upstream decisions or omit required attributes, but it still owns geometry, composition, hierarchy, and visual treatment inside implementation dimensions the Design Spec leaves open. Mixing both into one prompt forces the model to hold incompatible discipline in the same turn — every prompt-engineering pathology of mode-mixing shows up. Splitting into per-role files lets each role load only what it needs and discard the rest.
-**The independent Step-3 template choice closes before the Strategist confirmation stage.** It is not Stage 1: the default UI first confirms free design or exact indexed/explicit workspaces, runs the common installation/fusion stage, and only then lets Strategist read the project-local result. Strategist uses one dependency-ordered three-stage gate. Stage 1 confirms an open communication contract and canvas. Its `delivery_context` recommendation distinguishes presenter-led, reader-led, hybrid, and recorded/self-running use in one prose field, names the primary context, and records any secondary use; hybrid never stands alone without its lead mode. The prose boxes remain editable and none requires a non-empty answer: confirmation persists the current text exactly, and a cleared value stays empty instead of falling back to the recommendation. Stage 2 is authored once from that contract and confirms the complete deck solution: reading mode, narrative mode, page count, coordinated visual system, image sources, and generated-image rendering. When a template is installed, Strategist also derives **how to apply it** from the project-local workspace and current content and exposes that plan as editable `template_application` prose; Stage 2 never reselects a template, and the internal reuse/adherence modes stay hidden. Reading mode decides how meaning is carried by page, visuals, presenter, and notes; its cards do not present px values. The browser may apply the deterministic `reading mode → body baseline → unpinned role sizes` dependency locally, while manual size edits pin visible values. It never regenerates Stage 2. Stage 3 is authored once and contains production mechanics only: conditional AI acquisition, formula policy, generation mode, the Design Spec review toggle, and whether the agent should proactively generate speaker notes, custom animations, or narration audio. Those three values are fallback policies, not capability bans: the latest explicit user instruction wins, then Stage 3, then the fixed defaults `true / false / false`. Strategist still records non-binding Motion suggestions when useful; a suggestion alone does not activate custom-animation execution. The compatibility key `delivery_purpose` means reading mode. Generated images inherit the selected deck color anchors directly; there is no independent image-palette choice. Final state has two equivalent carriers: the default UI path reads `confirm_ui/result.json` exactly once after the final wait, while an explicit chat-only or delegated path retains an equivalent final confirmation summary and may produce no `result.json`. Both paths first resolve and persist every effective production outcome into one `design_spec.md` and complete Gate 1 fidelity. With refinement off, lock authoring proceeds immediately. With `refine_spec: true`, the pipeline stops before `spec_lock.md`; the user may revise any part of that same Design Spec through normal chat for any number of rounds, and explicit approval then releases Gate 2 lock authoring. No second Design Spec or parallel lock is maintained. Normal lock authoring and downstream execution do not reread either confirmation channel. Required manual assets may still introduce their own conditional blocking points, so this is not an exclusive claim over every runtime gate. Project validation requires the compact `audience` / `objective` / `core_message` anchor set under `spec_lock.md ## communication` plus an `Audience move` in every §IX Slide block.
+**The independent Step-3 template choice closes before the Strategist confirmation stage.** It is not Stage 1: the default UI first confirms free design or exact indexed/explicit workspaces and runs the common installation/fusion stage. Stage 1 then confirms an open communication contract and canvas using only the current request, source facts, conversation constraints, and project initialization; it must not read the selection, installed template content, or template canvas. Strategist uses one dependency-ordered three-stage gate. Its `delivery_context` recommendation distinguishes presenter-led, reader-led, hybrid, and recorded/self-running use in one prose field, names the primary context, and records any secondary use; hybrid never stands alone without its lead mode. The prose boxes remain editable and none requires a non-empty answer: confirmation persists the current text exactly, and a cleared value stays empty instead of falling back to the recommendation. Stage 2 is authored once from that contract and confirms the complete deck solution: reading mode, narrative mode, page count, coordinated visual system, image sources, and generated-image rendering. Only after Stage 1 is confirmed, when a template is installed, does Strategist read the project-local workspace and current content, derive **how to apply it**, and expose that plan as editable `template_application` prose; Stage 2 never reselects a template, and the internal reuse/adherence modes stay hidden. Reading mode decides how meaning is carried by page, visuals, presenter, and notes; its cards do not present px values. The browser may apply the deterministic `reading mode → body baseline → unpinned role sizes` dependency locally, while manual size edits pin visible values. It never regenerates Stage 2. Stage 3 is authored once and contains production mechanics only: conditional AI acquisition, formula policy, generation mode, the Design Spec review toggle, and whether the agent should proactively generate speaker notes, custom animations, or narration audio. Those three values are fallback policies, not capability bans: the latest explicit user instruction wins, then Stage 3, then the fixed defaults `true / false / false`. Strategist still records non-binding Motion suggestions when useful; a suggestion alone does not activate custom-animation execution. The compatibility key `delivery_purpose` means reading mode. Generated images inherit the selected deck color anchors directly; there is no independent image-palette choice. Final state has two equivalent carriers: the default UI path reads `confirm_ui/result.json` exactly once after the final wait, while an explicit chat-only or delegated path retains an equivalent final confirmation summary and may produce no `result.json`. Both paths first resolve and persist every effective production outcome into one `design_spec.md` and complete Gate 1 fidelity. With refinement off, lock authoring proceeds immediately. With `refine_spec: true`, the pipeline stops before `spec_lock.md`; the user may revise any part of that same Design Spec through normal chat for any number of rounds, and explicit approval then releases Gate 2 lock authoring. No second Design Spec or parallel lock is maintained. Normal lock authoring and downstream execution do not reread either confirmation channel. Required manual assets may still introduce their own conditional blocking points, so this is not an exclusive claim over every runtime gate. Project validation requires the compact `audience` / `objective` / `core_message` anchor set under `spec_lock.md ## communication` plus an `Audience move` in every §IX Slide block.
The three Stage 3 proactive values remain independent raw evidence. In
particular, enabling narration may enable the effective Speaker Notes outcome
diff --git a/docs/templates-architecture.md b/docs/templates-architecture.md
index c2636c78..8bfb740b 100644
--- a/docs/templates-architecture.md
+++ b/docs/templates-architecture.md
@@ -377,15 +377,17 @@ These indexes cover library scope only. A project-root workspace is intentionall
### Segment ownership (implicit dispatch)
-When the user supplies explicit workspace-root paths, Step 3 resolves each
-segment independently and writes one `<project>/templates/design_spec.md`:
+When the user confirms registered and/or specified workspace roots, Step 3
+parses every root's real `kind`, resolves each template segment independently,
+and writes one `<project>/templates/design_spec.md`. `library` / `explicit`
+records discovery provenance only and never changes ownership:
| Segment | Starting owner |
|---|---|
-| Identity | Brand, otherwise Deck, otherwise the current project; Style supplies fallback candidates only |
-| Direction / method | Style, otherwise the current Stage-2 recommendation; actual Deck prototypes and Signature facts inform compatibility only |
-| Structure | Compatible Layout, otherwise Deck, otherwise free design |
-| Application context | The current Stage-1 communication contract, informed by Deck's descriptive recurring-application context |
+| Identity | Brand, otherwise Deck, otherwise unresolved until Stage 2; Style supplies fallback candidates only |
+| Direction / method | Style, otherwise unresolved until Stage 2; actual Deck prototypes and Signature facts inform compatibility only |
+| Structure | Compatible Layout, otherwise Deck, otherwise unresolved/free design until Stage 2 |
+| Reusable application context | Deck only; retained for Stage-2 comparison, never used as the current project's application contract |
Current user instructions and final confirmation override every starting
owner. Brand identity remains authoritative over Style palette/type fallbacks.
@@ -393,12 +395,13 @@ Style alone, or Style with Brand, uses flat page authoring. Style with a Layout
or Deck follows the selected structural source. A Style never upgrades or
downgrades structure by itself.
-Before applying a Layout override to a Deck, compare the Deck application
-contract against the Layout's page roles, slot types, and capacity. Before
-combining Style with Layout/Deck, verify that its communication method and
-composition expectations can be realized by the selected application and
-structure. On mismatch, surface the conflicting segments; do not silently mix
-fields or retain a promise that the selected structure cannot satisfy.
+Before applying a Layout override to a Deck, compare the Deck's reusable
+application roles against the Layout's page roles, slot types, and capacity.
+Before combining Style with Layout/Deck, verify that its communication method
+and composition expectations can be realized by that reusable context and
+structure. On mismatch, surface the conflicting template segments; do not
+silently mix fields or retain a promise that the selected structure cannot
+satisfy. Current-project fit begins only in Stage 2 after Stage 1 is confirmed.
### Whole-segment replacement (default granularity)
@@ -428,6 +431,12 @@ Rules:
- `style × 2`, `layout × 2`, `deck × 2`, `brand × 2` handled the same way
- Max two of any one kind (more than that — ask the user to converge in chat first)
+The default page already narrows this space: Brand/Style/Layout/Deck each have
+one registered single-select dropdown, and one additional specified-root
+dropdown may contribute a second workspace of its parsed kind. The server
+enforces those limits; chat-based composition retains the general maximum of
+two per kind.
+
### Provenance
When fusion happens (any multi-path case), the resulting `<project>/templates/design_spec.md` carries a provenance block immediately under its H1:
@@ -447,7 +456,7 @@ This lets both AI and humans trace which segment came from where.
## 5. Relationship with Generate PPTX Step 3
-**Trigger rule stays path-based** — an explicit workspace-root path is still required (see [Generate PPTX Step 3](../skills/ppt-master/workflows/generate-pptx.md#step-3-template-option)), and bare names never trigger. Step 3 first resolves `<workspace>/templates/design_spec.md`; for directory-shape compatibility, it also accepts a legacy-flat Brand/Layout/Deck root containing `<workspace>/design_spec.md` when the package satisfies its current kind contract. Layout/Deck additionally require current structured SVGs; Style has no flat form. Packages using legacy semantics such as `native_structure_mode: template`, missing Master identity, direct atomic placeholders, or distillation-era markers are rejected; `create-template` must produce a new workspace before generation continues. The only narrow handoff exception is a `create-template` run in the current conversation: after validation, it may pass its exact workspace root directly into Step 3. The `kind` field decides **how AI handles the path after triggering**:
+**Trigger rule stays exact-choice-based** — use a registered Step-3 dropdown choice or an explicit workspace-root path (see [Generate PPTX Step 3](../skills/ppt-master/workflows/generate-pptx.md#step-3-template-option)); bare names never trigger. Step 3 first resolves `<workspace>/templates/design_spec.md`; for directory-shape compatibility, it also accepts a legacy-flat Brand/Layout/Deck root containing `<workspace>/design_spec.md` when the package satisfies its current kind contract. Layout/Deck additionally require current structured SVGs; Style has no flat form. Packages using legacy semantics such as `native_structure_mode: template`, missing Master identity, direct atomic placeholders, or distillation-era markers are rejected; `create-template` must produce a new workspace before generation continues. The only narrow handoff exception is a `create-template` run in the current conversation: after validation, it may pass its exact workspace root directly into Step 3. The `kind` field decides **how AI handles the path after triggering**:
| User path's `kind` | Step 3 action (per-kind branch) |
|---|---|
@@ -462,7 +471,7 @@ Bitmaps share the workspace `images/` pool and template SVGs reference them thro
### Strategist confirmation stage behavior per kind
-Installing a template does not narrow away the communication question. Stage 1 always confirms the same open communication contract independently of the template. Brand supplies identity constraints while structure stays free; Style supplies method and visual-default seeds while remaining flat; Layout exposes structural capability; Deck also contributes descriptive application context. For Style-only use, Strategist does not look for prototypes and deterministically records `template_reuse_scope: style` with flat structure. For Layout/Deck, it inspects the actual prototypes and current content, then authors one page/prototype plan and records `mirror`, `layout`, or `style` only as internal exporter values. A mirror-authored workspace therefore enables literal reuse but never forces it. The Confirm UI exposes no template-mode fields. Planning semantics live in `references/strategist.md` and `references/strategist-template.md`; `templates/schemas/spec_lock.schema.json` owns the machine structure.
+Installing a template does not narrow away the communication question. Stage 1 always confirms the same open communication contract independently of the template, using only the current request, source facts, conversation constraints, and project initialization; even template canvas is excluded. Only after Stage 1 closes does Stage 2 inspect the installed state. Brand supplies identity constraints while structure stays free; Style supplies method and visual-default seeds while remaining flat; Layout exposes structural capability; Deck contributes descriptive reusable application context for comparison, not the current project's contract. For Style-only use, Strategist does not look for prototypes and deterministically records `template_reuse_scope: style` with flat structure. For Layout/Deck, it inspects the actual prototypes and current content, then authors one page/prototype plan and records `mirror`, `layout`, or `style` only as internal exporter values. A mirror-authored workspace therefore enables literal reuse but never forces it. The Confirm UI exposes no template-mode fields. Planning semantics live in `references/strategist.md` and `references/strategist-template.md`; `templates/schemas/spec_lock.schema.json` owns the machine structure.
---
diff --git a/docs/templates-guide.md b/docs/templates-guide.md
index 666763f5..bef443f5 100644
--- a/docs/templates-guide.md
+++ b/docs/templates-guide.md
@@ -44,7 +44,7 @@ stay separate.
The two rules that prevent most mistakes:
1. In the default page, choose free design or an exact registered workspace from [Generate PPTX Step 3](../skills/ppt-master/workflows/generate-pptx.md#step-3-template-selection-and-installation). In chat, use the exact workspace root—not its `templates/` subdirectory or a bare template name.
-2. An explicit path and a Create Template handoff remain valid. Step 3 confirms and installs every selected workspace before Stage 1; later roles use only the project-local copy.
+2. An explicit path and a Create Template handoff remain valid. Step 3 confirms and installs every selected workspace before Stage 1; template-aware reading begins in Stage 2 from the project-local copy.
---
@@ -56,15 +56,15 @@ The default confirmation page opens an independent **Step-3 template-selection p
### How to enter the template flow
-On the default page, select one or more compatible registered workspaces, or choose free design. The registered list comes only from the four kind indexes; the workflow never scans the template directories. You can also send an exact Brand/Style/Layout/Deck workspace root in chat before Step 3. Anywhere in the sentence is fine; the path just has to be unambiguous:
+On the default page, choose free design or compose templates through five compact dropdowns: one each for registered Brand, Style, Layout, and Deck workspaces, plus one for exact roots supplied for this run. Each dropdown is single-select and includes `None`; the four registered kinds can be combined, and the specified-root channel contributes at most one workspace. The registered lists come only from the four kind indexes; the workflow never scans the template directories. You can also send an exact Brand/Style/Layout/Deck workspace root in chat before Step 3. Anywhere in the sentence is fine; the path just has to be unambiguous:
> "use this template: `skills/ppt-master/templates/layouts/presentation_core/`" ✅
> "use last deck's template: `projects/last_deck/`" ✅
> "make a product introduction with `/Users/me/Desktop/our_brand_v3/`" ✅
-For every current template kind, an explicit path is the **template workspace root**. An exact root matching a registered index entry may be displayed as `library`; an unregistered root remains separately labelled `explicit`. Step 3 resolves `templates/design_spec.md`; Brand/Layout/Deck install their package-owned `templates/` plus any real `images/` and `icons/`, while Style installs only its spec and ignores unrelated project scaffolding. It never copies `exports/`. Deck/Layout workspaces additionally validate the structured SVG contract; Brand/Style validate their roster-free specs. The path may point to a built-in library workspace under `skills/ppt-master/templates/<kind>/<id>/`, a project workspace under `projects/<name>/`, or another workspace with the same routing. A Create Template run may hand its exact validated workspace root directly to Step 3 in the same conversation.
+For every current template kind, an explicit path is the **template workspace root**. An exact root matching a registered index entry may be displayed as `library`; an unregistered root remains separately labelled `explicit`. The server parses the latter's actual frontmatter `kind`; `explicit` is provenance, not a fifth kind or a priority tier. Step 3 resolves `templates/design_spec.md`; Brand/Layout/Deck install their package-owned `templates/` plus any real `images/` and `icons/`, while Style installs only its spec and ignores unrelated project scaffolding. It never copies `exports/`. Deck/Layout workspaces additionally validate the structured SVG contract; Brand/Style validate their roster-free specs. The path may point to a built-in library workspace under `skills/ppt-master/templates/<kind>/<id>/`, a project workspace under `projects/<name>/`, or another workspace with the same routing. A Create Template run may hand its exact validated workspace root directly to Step 3 in the same conversation.
-Template selection is not part of Stage 1. After confirmation, Step 3 runs the common apply stage and installs/fuses the selected workspaces into the project's `templates/`, `images/`, and `icons/`. Only then does Strategist begin Stage 1. The Stage-2 `template_application` field describes **how** to use that installed template; it never chooses **which** template to use.
+Template selection is not part of Stage 1. After confirmation, Step 3 runs the common apply stage and installs/fuses the selected workspaces into the project's `templates/`, `images/`, and `icons/`. Only then does Strategist begin Stage 1, using only the current request, source facts, conversation constraints, and project initialization. Template selection, installed content, and template canvas cannot influence that contract. After Stage 1 is confirmed, Stage 2 compares it with the installed state; `template_application` describes **how** to use that state and never chooses **which** template to use.
> **Compatibility preflight:** Step 3 also accepts a legacy-flat Brand/Layout/Deck workspace with `design_spec.md` directly at the supplied root when it satisfies the current kind contract. Layout/Deck additionally require current structured SVGs; Style has no flat form. Former atomic-placeholder, unmapped Master/Layout, and other semantic-legacy packages are rejected; run `create-template` to create a new workspace, then generate new structured pages from that workspace. Nothing upgrades the old package in place.
@@ -102,7 +102,7 @@ Make a deck from projects/annual-report/sources/report.md.
Template workspace: projects/acme_template/
```
-For chat-based explicit selection, path labels are optional but exact roots are mandatory. Page-based library selection already carries exact roots. If two selections have the same kind, the workflow stops at the existing conflict-resolution gate instead of choosing one silently.
+For chat-based explicit selection, path labels are optional but exact roots are mandatory. Page-based library selection already carries exact roots. The page allows one registered selection per kind and one specified root. If the specified root has the same parsed kind as a registered selection, the workflow stops at the existing two-workspace conflict-resolution gate instead of choosing one silently.
You do not need to choose a template-use mode. For Layout/Deck, Strategist reads the actual Master/Layout/prototype roster and current content, then decides which pages to select, repeat, skip, reorder, or reorganize. Brand instead supplies identity constraints, while Style supplies direction/method defaults; both leave pages freely composed unless another workspace supplies structure. If you care about a specific boundary, state it in ordinary language in the same request—for example, “keep the cover and closing page exactly, choose suitable middle pages yourself” or “use only the visual language”. That explicit sentence wins over AI judgment.
diff --git a/docs/zh/getting-started.md b/docs/zh/getting-started.md
index c4f60688..bdfded9f 100644
--- a/docs/zh/getting-started.md
+++ b/docs/zh/getting-started.md
@@ -46,7 +46,7 @@ Create Template 会分析参考材料,确认结果属于 Brand、Style、Layou
| **注册进 skill 库** | `skills/ppt-master/templates/<kind>/<id>/` | 可移植工作区并执行全局注册;问“有哪些模板”时会被列出来 |
| **放在 projects 下** | `projects/<name>/` | 相同的可移植工作区,不执行全局注册 |
-两种结果都通过对话里给出**工作区根目录路径**来引用。Step 3 会解析 `templates/design_spec.md`;为兼容目录形态,也接受满足当前 kind 合同的旧式平铺 Brand/Layout/Deck 根目录,Layout/Deck 还必须带有当前 structured SVG;Style 没有平铺形态。create-template 可在同一对话里把已验证的精确工作区根目录直接交给 Step 3。两种情况都以路径为准,绝不认裸模板名。完整工作区可以在全局库与 `projects/` 之间复制或迁移,无需调整目录结构;只有全局库注册不同。
+已注册结果可在 Step 3 对应 kind 的下拉框中选择。若要提供其他结果,在对话里给出精确的**工作区根目录路径**:未注册 root 会进入指定地址下拉框;与注册 canonical root 完全相同的路径会归回对应 kind 下拉框。Step 3 会解析 `templates/design_spec.md`;为兼容目录形态,也接受满足当前 kind 合同的旧式平铺 Brand/Layout/Deck 根目录,Layout/Deck 还必须带有当前 structured SVG;Style 没有平铺形态。create-template 可在同一对话里把已验证的精确工作区根目录直接交给 Step 3。两种情况都要求精确选择,绝不认裸模板名。完整工作区可以在全局库与 `projects/` 之间复制或迁移,无需调整目录结构;只有全局库注册不同。
```
你:用 sources/report.pdf 做 deck,模板用 skills/ppt-master/templates/layouts/presentation_core/
@@ -61,20 +61,20 @@ Create Template 会分析参考材料,确认结果属于 Brand、Style、Layou
整个流程就三步。先装好环境——只需要 Python,见 [快速开始](../../README_CN.md#快速开始)。
1. **把源材料放进** `projects/` —— PDF、DOCX、Markdown、一个网址,或直接要粘贴的文字。
-2. **在对话里告诉 AI** 要把什么做成 deck(如果上面准备了模板,把它的路径一起给;否则就是自由设计):
+2. **在对话里告诉 AI** 要把什么做成 deck。随后在 Step 3 选择自由设计或组合已注册模板;若要使用未注册模板,把它的精确 root 一并写在对话里,让它出现在指定地址下拉框中:
```
你:用 projects/q3-report/sources/report.pdf 做一份 PPT
你:把这份内容做成 PPT:<粘贴你的文字>
```
3. **拿回可编辑的 `.pptx`**,位于 `exports/<名称>_<时间戳>.pptx` —— 真正的 DrawingML 形状、文本框、图表,在 PowerPoint / Keynote / WPS / LibreOffice 里点开就能改。
-开始前 AI 会先确认一份简短的设计规格(模板、格式、页数……);之后内容分析、排版、配图、SVG 生成、导出都由它完成——这就是其它能力围绕的核心环节。不想走确认这一步,见下方[快速模式](#快速模式)。
+生成前,Step 3 会先确认自由设计或模板组合;Stage 1 再独立确认沟通契约和画布/格式,Stage 2 确认页数、视觉系统,以及启用模板时的应用方式。之后内容分析、排版、配图、SVG 生成、导出都由 AI 完成——这就是其它能力围绕的核心环节。不想走交互确认,见下方[快速模式](#快速模式)。
---
## 快速模式
-默认流程会先跟你确认一份设计规格。不想经过这一步,就显式要求**快速生成**:
+默认流程会先完成 Step 3 选择和分阶段设计确认。不想经过这些交互,就显式要求**快速生成**:
```
你:用 sources/report.pdf 快速生成一份 PPT,不用跟我确认
diff --git a/docs/zh/technical-design.md b/docs/zh/technical-design.md
index 60c6512e..91d26dc7 100644
--- a/docs/zh/technical-design.md
+++ b/docs/zh/technical-design.md
@@ -347,11 +347,11 @@ PPT Master 不只服务 PPT——同一套 SVG → DrawingML 流水线还能产
## 模板系统与可选路径
-模板是**可选项,不会被自动推断**。Strategist Stage 1 之前,默认 UI 会先打开独立 Step 3:选择自由设计、已注册 library 工作区,或本次运行明确提供的 root。自由设计仍是从当前内容推导的路径;系统不会根据主题相似度替用户选模板。
+模板是**可选项,不会被自动推断**。Strategist Stage 1 之前,默认 UI 会先打开独立 Step 3:自由设计、Brand/Style/Layout/Deck 四个已注册模板单选下拉框,以及一个本次运行指定 root 的单选下拉框。自由设计仍是从当前内容推导的路径;系统不会根据主题相似度替用户选模板。
**为什么默认自由设计。** 模板是地板,但很容易变成天花板:它会把整个 deck 锁进模板自有的视觉惯用语,无视内容本身想要怎样被呈现。自由设计的布局从源内容的结构推导而来,而不是从一套固定语法套上去——视觉节奏跟着内容走,而不是跟内容打架。约束模式在窄场景里确实更好(品牌锁定的 deck、强类型场景如学术答辩或政府报告),所以它一直在;但 AI 不主动去抓,是用户去抓。
-**精确选择,不做语义匹配。** 像 `presentation_core` 这样的裸名字、品牌提及,或“麦肯锡风格”这类风格短语,永远不会 fuzzy-match 到目录。默认页面只从四个 `*_index.json` 列出已注册 Brand/Style/Layout/Deck;聊天发现也读取同一组索引并返回精确 root。显式路径仍有效;若它与某个已注册 canonical root 精确相同,可显示为 `library`,未注册 root 仍是 `explicit`。当前工作区均解析 `templates/design_spec.md`;自由文字风格说明仍只是 Stage 2 输入,不会启用 Style 工作区。旧平铺 Brand/Layout/Deck 目录只有在满足当前 kind 合同时,才兼容从根目录读取 `design_spec.md`;Layout/Deck 还必须满足当前 structured SVG 合同。Style 不存在旧平铺形态。目录形态从不授权结构迁移;带旧 Master/Layout/placeholder 语义的包必须先替换为新建的模板工作区。
+**精确选择,不做语义匹配。** 像 `presentation_core` 这样的裸名字、品牌提及,或“麦肯锡风格”这类风格短语,永远不会 fuzzy-match 到目录。默认页面只从四个 `*_index.json` 列出已注册 Brand/Style/Layout/Deck;聊天发现也读取同一组索引并返回精确 root。显式路径仍有效;若它与某个已注册 canonical root 精确相同,可显示为 `library`,未注册 root 仍是 `explicit`。服务端解析每个 explicit root 的真实 `kind`,来源标签本身不参与优先级。当前工作区均解析 `templates/design_spec.md`;自由文字风格说明仍只是 Stage 2 输入,不会启用 Style 工作区。旧平铺 Brand/Layout/Deck 目录只有在满足当前 kind 合同时,才兼容从根目录读取 `design_spec.md`;Layout/Deck 还必须满足当前 structured SVG 合同。Style 不存在旧平铺形态。目录形态从不授权结构迁移;带旧 Master/Layout/placeholder 语义的包必须先替换为新建的模板工作区。
当前 Brand/Style/Layout/Deck 都采用同一工作区路由合同;Brand 与 Style 不含 SVG roster,空的可选目录直接省略:
@@ -367,7 +367,7 @@ PPT Master 不只服务 PPT——同一套 SVG → DrawingML 流水线还能产
Style 将这一路由形态收窄为仅 `templates/design_spec.md`,不携带素材或
审阅 payload;项目中既有的脚手架也不属于 Style 输入。
-`<template_workspace>` 可以是 `skills/ppt-master/templates/<kind>/<id>/`,也可以是 `projects/<name>/` 等其他精确 root。Step 3 会把所选输入校验、合成并安装到当前项目的 `templates/`、`images/`、`icons/`,不复制 `exports/`。Strategist 及后续角色只读该项目本地副本。源工作区可在不同位置间迁移而不改形;全局索引注册决定它是否作为 library 选项出现。
+`<template_workspace>` 可以是 `skills/ppt-master/templates/<kind>/<id>/`,也可以是 `projects/<name>/` 等其他精确 root。Step 3 会把所选输入校验、合成并安装到当前项目的 `templates/`、`images/`、`icons/`,不复制 `exports/`。Stage 1 完成后,模板感知的 Strategist 及后续角色只读该项目本地副本。源工作区可在不同位置间迁移而不改形;全局索引注册决定它是否作为 library 选项出现。
对 Create Layout / Create Deck,`standard` 与 `fidelity` 会重新创作 SVG 和新的 Master/Layout/slot 系统;来源拓扑只作为视觉证据,不保留、也不蒸馏。`mirror` 把来源包内实际存在且已验证的页序、Master/Layout 身份与父子关系、placeholder 事实和受支持视觉物化到新工作区,不做语义归纳或缺口补造。只有被保留的来源本身已经品牌中立且应用中立时,Layout mirror 才合法;否则应重新创作 Layout,或把这些事实保留为 Deck。由于结构层不能是 `<g>`,固定结构层的来源 group wrapper 只允许机械展开成直接原子,同时保持归属、paint order 和视觉一致。Create Brand 只提取身份片段,Create Style 只提取可移植方法/方向;两者都不进入结构复制策略,也不生成 SVG roster。
@@ -382,7 +382,7 @@ Style 将这一路由形态收窄为仅 `templates/design_spec.md`,不携带
Theme、Slide Master、Slide Layout 与 Placeholder 是编译生成的 PowerPoint 原生对象,不是新的模板 kind。Layout 决定拓扑、位置、语义文字角色与空间行为,Brand 决定身份值与资产。`template_reuse_scope: layout` 会结合已确认的阅读模式和字号体系解析最终 placeholder 格式;`mirror` 则保留来源的字面格式与文字拓扑。两类规则都可编译进同一套原生 Master/Layout 图谱。
-当用户选择多个工作区时,融合是**片段级**而不是字段级:Brand 拥有身份,Style 拥有方向/方法默认值,Layout 拥有兼容结构,Deck 在当前 Stage 1 沟通契约下提供描述性的重复应用语境及兜底身份/结构;用户最终确认最高。Style 的色彩/字体 fallback 不覆盖 Brand/Deck 身份,其方法与构图预期必须兼容所选 Deck 应用和 Layout/Deck 结构,否则显式提出冲突。项目内 Brand + Layout 组合的应用语境来自 Stage 1,不会自动升级成可注册的 Deck。同类冲突也会显式列出,而不是按输入顺序默默决定。这样融合后的 spec 能明确说明每个片段来自哪里,便于审计和复现。
+当用户选择多个工作区时,融合是**片段级**而不是字段级:Brand 拥有身份,Style 拥有方向/方法默认值,Layout 拥有兼容结构,Deck 保留描述性的可复用应用语境及未被覆盖的身份/结构;library/explicit 来源不改变这个顺序。当前项目应用契约只来自已确认的 Stage 1,Deck 语境只是 Stage 2 对照输入,不会覆盖它。用户最终确认最高。Style 的色彩/字体 fallback 不覆盖 Brand/Deck 身份,其方法与构图预期必须兼容所选 Deck 语境和 Layout/Deck 结构,否则显式提出冲突。项目内 Brand + Layout 组合的应用语境来自 Stage 1,不会自动升级成可注册的 Deck。同类冲突也会显式列出,而不是按输入顺序默默决定。这样融合后的 spec 能明确说明每个片段来自哪里,便于审计和复现。
**原生 PPTX 不能直接作为 Step 3 工作区。** 普通 Generate 可以把 PPTX 作为源材料使用,`beautify-pptx` 也可以在页数、页序和逐页措辞 1:1 的边界下重新设计;这两种情况都不会把原始 PPTX 当作 Step 3 模板。把原生 PPTX 作为模板或页面壳、再用新材料填充时,默认进入 Fill Native PPTX;若请求允许拆分、合并、删页、重排或叙事重构,则仍属于 Generate。只有当目标是创建可复用模板工作区、并在 SVG 路线的 Step 3 中重复使用其设计系统时,才先运行 Create Template,再传入生成的工作区根目录。
@@ -398,7 +398,7 @@ PPT Master 用的是**单主代理内的角色切换**,不是并行子代理
**为什么是角色专属 reference 而不是一个超大 prompt。** Strategist 跑的是「跟用户协商」模式(开放式、对话式、可以回退),Executor 跑的是「产出严格 XML」模式:不得重选上游方案或漏掉必需属性,但在 Design Spec 留出的范围内仍拥有几何、构图、层级和视觉处理的实现权。把两者塞进同一个 prompt,强迫模型在同一个 turn 里持守相互矛盾的纪律——所有混合模式的 prompt 工程病灶都会出现。按角色拆开,每个角色只加载它需要的、扔掉其他。
-**独立 Step 3 模板选择会在 Strategist 确认阶段前完成。** 它不属于 Stage 1:默认 UI 先确认自由设计,或精确的 indexed/explicit 工作区,运行统一安装/合成阶段,再让 Strategist 读项目本地结果。Strategist 阶段以一个按依赖排序的三阶段 gate 作为核心决策点。第一阶段确认开放式沟通契约与画布。`delivery_context` 在同一个开放文本字段中区分演讲者主导、读者主导、混合、录制/自动播放,明确主要场景并记录可选的次要用途;混合场景不能只写“混合”而不说明由哪一种主导。其中的文本框仍承载可编辑推荐,且没有任何一项要求非空:确认时按当前文本原样保存,清空后的值保持为空,不会回退到推荐内容。第二阶段只从该契约计算一次并确认完整 PPT 方案:阅读模式、叙事 mode、页数、成套视觉系统、图片来源和生成图渲染。存在已安装模板时,Strategist 只从项目本地工作区和当前内容推导**如何应用**,并以可编辑的 `template_application` 自然语言展示;Stage 2 不会重新选模板,只有内部复用/遵循模式保持隐藏。阅读模式决定信息由页面、视觉、讲者和备注如何共同承担,其选项卡不展示 px 数值。浏览器可以在本地执行确定性的「阅读模式 → 正文基准 → 未锁定角色字号」联动;手动编辑字号即锁定可见值,不会重新计算第二阶段。第三阶段也只计算一次,并且只处理生产机制:条件式 AI 图片获取路径、公式策略、生成模式、Design Spec 审核开关,以及 Agent 是否主动生成讲稿、自定义动画和旁白音频。这三项是用户未明确要求时的兜底策略,不是能力禁用开关;优先级固定为「用户最新明确指令 → Stage 3 → `true / false / false` 默认值」。Strategist 仍可按内容给出非绑定的 Motion suggestion,建议本身不会启动自定义动画执行。JSON 为兼容保留 `delivery_purpose` 键,但用户侧统一称为阅读模式。生成图直接继承已选 PPT 色彩锚点,不再单设图片调色选择。最终状态有两个等价载体:默认 UI 路径在最终等待返回后只读取一次 `confirm_ui/result.json`;显式 chat-only 或委托路径保留等价的最终确认摘要,并可不产生 `result.json`。两条路径都会先解析并把生产流程的最终有效结果固化到同一份 `design_spec.md`,再完成 Gate 1 fidelity。未开启 refine 时立即进入 lock 编写;`refine_spec: true` 时,流程会在 `spec_lock.md` 之前暂停,用户可以通过正常聊天任意修改这同一份 Design Spec、迭代任意轮次,明确批准后才释放 Gate 2 并编写 lock。流程不会维护第二份 Design Spec 或并行 lock。正常的 lock 编写与下游执行不再回读确认通道。必需人工素材未就绪仍可能引入条件式阻塞点,因此这里不是对所有 runtime gate 的排他声明。项目校验要求 `spec_lock.md ## communication` 下存在紧凑的 `audience` / `objective` / `core_message` 锚点,并要求 §IX 每个 Slide block 都有 `Audience move`。
+**独立 Step 3 模板选择会在 Strategist 确认阶段前完成。** 它不属于 Stage 1:默认 UI 先确认自由设计,或精确的 indexed/explicit 工作区,并运行统一安装/合成阶段。Stage 1 随后只使用当前请求、源材料事实、对话约束和项目初始化状态确认开放式沟通契约与画布;不得读取选择结果、已安装模板内容或模板画布。Strategist 阶段以一个按依赖排序的三阶段 gate 作为核心决策点。`delivery_context` 在同一个开放文本字段中区分演讲者主导、读者主导、混合、录制/自动播放,明确主要场景并记录可选的次要用途;混合场景不能只写“混合”而不说明由哪一种主导。其中的文本框仍承载可编辑推荐,且没有任何一项要求非空:确认时按当前文本原样保存,清空后的值保持为空,不会回退到推荐内容。第二阶段只从该契约计算一次并确认完整 PPT 方案:阅读模式、叙事 mode、页数、成套视觉系统、图片来源和生成图渲染。仅在 Stage 1 确认后,存在已安装模板时,Strategist 才读取项目本地工作区和当前内容,推导**如何应用**并以可编辑的 `template_application` 自然语言展示;Stage 2 不会重新选模板,内部复用/遵循模式保持隐藏。阅读模式决定信息由页面、视觉、讲者和备注如何共同承担,其选项卡不展示 px 数值。浏览器可以在本地执行确定性的「阅读模式 → 正文基准 → 未锁定角色字号」联动;手动编辑字号即锁定可见值,不会重新计算第二阶段。第三阶段也只计算一次,并且只处理生产机制:条件式 AI 图片获取路径、公式策略、生成模式、Design Spec 审核开关,以及 Agent 是否主动生成讲稿、自定义动画和旁白音频。这三项是用户未明确要求时的兜底策略,不是能力禁用开关;优先级固定为「用户最新明确指令 → Stage 3 → `true / false / false` 默认值」。Strategist 仍可按内容给出非绑定的 Motion suggestion,建议本身不会启动自定义动画执行。JSON 为兼容保留 `delivery_purpose` 键,但用户侧统一称为阅读模式。生成图直接继承已选 PPT 色彩锚点,不再单设图片调色选择。最终状态有两个等价载体:默认 UI 路径在最终等待返回后只读取一次 `confirm_ui/result.json`;显式 chat-only 或委托路径保留等价的最终确认摘要,并可不产生 `result.json`。两条路径都会先解析并把生产流程的最终有效结果固化到同一份 `design_spec.md`,再完成 Gate 1 fidelity。未开启 refine 时立即进入 lock 编写;`refine_spec: true` 时,流程会在 `spec_lock.md` 之前暂停,用户可以通过正常聊天任意修改这同一份 Design Spec、迭代任意轮次,明确批准后才释放 Gate 2 并编写 lock。流程不会维护第二份 Design Spec 或并行 lock。正常的 lock 编写与下游执行不再回读确认通道。必需人工素材未就绪仍可能引入条件式阻塞点,因此这里不是对所有 runtime gate 的排他声明。项目校验要求 `spec_lock.md ## communication` 下存在紧凑的 `audience` / `objective` / `core_message` 锚点,并要求 §IX 每个 Slide block 都有 `Audience move`。
Stage 3 的三个主动执行值始终保留为相互独立的原始证据。尤其是,
启用旁白可以在 Design Spec 中启用 Speaker Notes 的最终有效结果,
diff --git a/docs/zh/templates-architecture.md b/docs/zh/templates-architecture.md
index 5c56fc34..c262f689 100644
--- a/docs/zh/templates-architecture.md
+++ b/docs/zh/templates-architecture.md
@@ -336,24 +336,26 @@ Template Overview 写明可重复演示类型、目标受众与结果、交付/
### 片段所有权(隐式触发)
-用户给出显式工作区根目录路径后,Step 3 分片段解析并写入一份
-`<project>/templates/design_spec.md`:
+用户确认已注册和/或指定工作区根目录后,Step 3 会解析每个 root 的真实
+`kind`,再分片段写入一份 `<project>/templates/design_spec.md`。
+`library` / `explicit` 只记录发现来源,不改变所有权:
| 片段 | 起始所有者 |
|---|---|
-| 身份 | Brand,其次 Deck,再其次当前项目;Style 只提供 fallback 候选 |
-| 方向/方法 | Style,否则为当前 Stage 2 推荐;Deck 的真实原型与 Signature 事实只提供兼容性依据 |
-| 结构 | 兼容 Layout,其次 Deck,再其次自由设计 |
-| 应用语境 | 当前 Stage 1 沟通契约;如有 Deck,则吸收其描述性的重复应用语境 |
+| 身份 | Brand,其次 Deck,否则留到 Stage 2;Style 只提供 fallback 候选 |
+| 方向/方法 | Style,否则留到 Stage 2;Deck 的真实原型与 Signature 事实只提供兼容性依据 |
+| 结构 | 兼容 Layout,其次 Deck,否则留到 Stage 2 / 自由设计 |
+| 可复用应用语境 | 仅 Deck;保留供 Stage 2 对照,绝不充当当前项目的应用契约 |
用户当前明确指令和最终确认高于所有起始所有者。Brand 身份高于 Style
的色彩/字体 fallback。Style-only 或 Style + Brand 使用 flat 创作;Style
与 Layout/Deck 合成时沿用所选结构源。Style 自身不升级或降级结构。
-Layout 覆盖 Deck 前,必须把 Deck 应用契约与 Layout 的页面角色、槽位
-类型和容量对照;Style 与 Layout/Deck 合成前,也要确认其沟通方法和
-构图预期能够被应用语境与结构兑现。不兼容时显式报告冲突,不能静默
-混合字段或保留一份当前结构无法兑现的承诺。
+Layout 覆盖 Deck 前,必须把 Deck 的可复用应用角色与 Layout 的页面角色、
+槽位类型和容量对照;Style 与 Layout/Deck 合成前,也要确认其沟通方法和
+构图预期能够被该可复用语境与结构兑现。不兼容时显式报告模板片段冲突,
+不能静默混合字段或保留一份当前结构无法兑现的承诺。当前项目的适配只在
+Stage 1 确认后的 Stage 2 开始。
### 段级整段替换(默认粒度)
@@ -381,6 +383,10 @@ AI: 你给了两个 brand,检测到段级冲突:
- `style × 2`、`layout × 2`、`deck × 2`、`brand × 2` 同处理
- 每类最多两份(再多让用户先在 chat 里收敛)
+默认页面已经把组合空间收窄:Brand/Style/Layout/Deck 各有一个已注册模板
+单选下拉框,另有一个指定地址下拉框;指定地址按解析出的 kind,最多给该类
+增加第二份。服务端强制同一限制;聊天组合仍保留每类最多两份的通用边界。
+
### Provenance 记录
合成后的 `<project>/templates/design_spec.md` 顶部必须加:
@@ -400,7 +406,7 @@ AI: 你给了两个 brand,检测到段级冲突:
## 五、与 Generate PPTX Step 3 的关系
-**触发规则仍以路径为准**——仍需显式工作区根目录路径(见 [Generate PPTX Step 3](../../skills/ppt-master/workflows/generate-pptx.md#step-3-template-option)),裸名称绝不触发。Step 3 先解析 `<workspace>/templates/design_spec.md`;为兼容目录形态,也接受根目录直接包含 `<workspace>/design_spec.md`、且满足当前 kind 合同的旧式平铺 Brand/Layout/Deck 工作区。Layout/Deck 还必须带有当前 structured SVG;Style 没有平铺形态。若包仍使用 `native_structure_mode: template`、缺 Master 身份、原子 placeholder 或蒸馏时代标记等旧语义,Step 3 必须拒绝;先由 `create-template` 产出新工作区,再继续生成。唯一的窄例外是当前对话刚完成 `create-template`:验证通过后可把精确的工作区根目录直接交给 Step 3。`kind` 字段决定**触发后 AI 怎么处理**:
+**触发规则仍以精确选择为准**——使用 Step 3 已注册模板下拉选项或显式工作区根目录路径(见 [Generate PPTX Step 3](../../skills/ppt-master/workflows/generate-pptx.md#step-3-template-option));裸名称绝不触发。Step 3 先解析 `<workspace>/templates/design_spec.md`;为兼容目录形态,也接受根目录直接包含 `<workspace>/design_spec.md`、且满足当前 kind 合同的旧式平铺 Brand/Layout/Deck 工作区。Layout/Deck 还必须带有当前 structured SVG;Style 没有平铺形态。若包仍使用 `native_structure_mode: template`、缺 Master 身份、原子 placeholder 或蒸馏时代标记等旧语义,Step 3 必须拒绝;先由 `create-template` 产出新工作区,再继续生成。唯一的窄例外是当前对话刚完成 `create-template`:验证通过后可把精确的工作区根目录直接交给 Step 3。`kind` 字段决定**触发后 AI 怎么处理**:
| 用户路径指向 | Step 3 行为(按 kind 分支)|
|---|---|
@@ -415,7 +421,7 @@ AI: 你给了两个 brand,检测到段级冲突:
### 策略师确认阶段在不同 kind 下的行为
-安装模板不会让沟通问题消失。Stage 1 始终独立确认同一份开放式沟通契约。Brand 提供身份约束、结构仍然自由;Style 提供方法和视觉默认值候选并保持 flat;Layout 提供结构能力;Deck 还提供描述性应用语境。Style-only 时 Strategist 不读取原型,固定写入 `template_reuse_scope: style` 与 flat 结构;Layout/Deck 才读取真实原型和当前内容,生成页面/原型计划,并把 `mirror`、`layout` 或 `style` 记录为内部导出值。按 mirror 创建的工作区因此只提供原样复用能力,不会强制使用;Confirm UI 不显示模板模式字段。规划语义由 `references/strategist.md` 与 `references/strategist-template.md` 负责,机器结构由 `templates/schemas/spec_lock.schema.json` 负责。
+安装模板不会让沟通问题消失。Stage 1 始终独立确认同一份开放式沟通契约,只使用当前请求、源材料事实、对话约束和项目初始化状态,连模板画布也不能参与。Stage 1 完成后,Stage 2 才读取已安装状态。Brand 提供身份约束、结构仍然自由;Style 提供方法和视觉默认值候选并保持 flat;Layout 提供结构能力;Deck 提供描述性的可复用应用语境供对照,但不充当当前项目契约。Style-only 时 Strategist 不读取原型,固定写入 `template_reuse_scope: style` 与 flat 结构;Layout/Deck 才读取真实原型和当前内容,生成页面/原型计划,并把 `mirror`、`layout` 或 `style` 记录为内部导出值。按 mirror 创建的工作区因此只提供原样复用能力,不会强制使用;Confirm UI 不显示模板模式字段。规划语义由 `references/strategist.md` 与 `references/strategist-template.md` 负责,机器结构由 `templates/schemas/spec_lock.schema.json` 负责。
---
diff --git a/docs/zh/templates-guide.md b/docs/zh/templates-guide.md
index 03e56c3b..3e9babc3 100644
--- a/docs/zh/templates-guide.md
+++ b/docs/zh/templates-guide.md
@@ -38,7 +38,7 @@ Theme、Slide Master、Slide Layout 与 Placeholder 是 PowerPoint 原生对象
最容易避免误用的两条规则:
1. 默认页面会在 [Generate PPTX Step 3](../../skills/ppt-master/workflows/generate-pptx.md#step-3-template-selection-and-installation) 选择自由设计或精确的已注册工作区;若在聊天中选择,请给出工作区根目录,不要只给 `templates/` 子目录,也不要只写模板名。
-2. 显式路径和 Create Template 的精确交接仍然有效。Step 3 会先确认并安装全部所选工作区,再进入 Stage 1;后续角色只读项目本地副本。
+2. 显式路径和 Create Template 的精确交接仍然有效。Step 3 会先确认并安装全部所选工作区,再进入 Stage 1;模板感知读取从 Stage 2 开始,且只读项目本地副本。
---
@@ -50,15 +50,15 @@ Theme、Slide Master、Slide Layout 与 Placeholder 是 PowerPoint 原生对象
### 怎么触发模板流程
-在默认页面中,可选择一个或多个兼容的已注册工作区,也可以选择自由设计。已注册列表只来自四类索引,工作流不会扫描模板目录。也可以在 Generate PPTX 进入 Step 3 前,于对话里写出 Brand/Style/Layout/Deck 工作区根目录(位置不重要,只要明确即可):
+默认页面提供自由设计,以及五个紧凑下拉框:Brand、Style、Layout、Deck 各一个已注册工作区单选框,再加一个本次运行指定地址单选框。每个下拉框都有“无”;四类已注册模板可跨类型组合,指定地址最多选一个。已注册列表只来自四类索引,工作流不会扫描模板目录。也可以在 Generate PPTX 进入 Step 3 前,于对话里写出 Brand/Style/Layout/Deck 工作区根目录(位置不重要,只要明确即可):
> "用这个模板做:`skills/ppt-master/templates/layouts/presentation_core/`" ✅
> "用上次那个模板:`projects/last_deck/`" ✅
> "做一份产品介绍,模板用 `/Users/me/Desktop/our_brand_v3/`" ✅
-对于当前所有模板类型,显式路径都是**模板工作区根目录**。若精确路径与索引中的注册 root 一致,页面可以把它显示为 `library`;未注册 root 则单独标为 `explicit`。Step 3 会解析其中的 `templates/design_spec.md`;Brand/Layout/Deck 安装其包自有 `templates/` 及真实存在的 `images/`、`icons/`,Style 只安装 spec,并忽略项目中无关的脚手架。如果工作区本来就是该项目根目录,则原地消费,并且始终不复制 `exports/`。Deck/Layout 还会校验 structured SVG 合同;Brand/Style 校验各自无 roster 的 spec。路径可以指向 `skills/ppt-master/templates/<kind>/<id>/` 下的内置库工作区、`projects/<name>/` 下的项目工作区,或其他保持同样路由的工作区。当前对话刚完成 Create Template 时,可把精确的已验证工作区根目录直接交给 Step 3。
+对于当前所有模板类型,显式路径都是**模板工作区根目录**。若精确路径与索引中的注册 root 一致,页面可以把它显示为 `library`;未注册 root 则单独标为 `explicit`,并由服务端解析其 frontmatter 中的真实 `kind`。`explicit` 只是来源,不是第五种类型,也不提高优先级。Step 3 会解析其中的 `templates/design_spec.md`;Brand/Layout/Deck 安装其包自有 `templates/` 及真实存在的 `images/`、`icons/`,Style 只安装 spec,并忽略项目中无关的脚手架。如果工作区本来就是该项目根目录,则原地消费,并且始终不复制 `exports/`。Deck/Layout 还会校验 structured SVG 合同;Brand/Style 校验各自无 roster 的 spec。路径可以指向 `skills/ppt-master/templates/<kind>/<id>/` 下的内置库工作区、`projects/<name>/` 下的项目工作区,或其他保持同样路由的工作区。当前对话刚完成 Create Template 时,可把精确的已验证工作区根目录直接交给 Step 3。
-模板选择不属于 Stage 1。确认后,Step 3 会运行统一 apply 阶段,把所选工作区校验、合成并安装到当前项目的 `templates/`、`images/`、`icons/`;完成后 Strategist 才开始 Stage 1。Stage 2 的 `template_application` 只描述**如何使用**已安装模板,不负责决定**选哪个模板**。
+模板选择不属于 Stage 1。确认后,Step 3 会运行统一 apply 阶段,把所选工作区校验、合成并安装到当前项目的 `templates/`、`images/`、`icons/`;完成后 Strategist 才开始 Stage 1。Stage 1 只使用当前请求、源材料事实、对话约束和项目初始化状态,模板选择、已安装内容及模板画布均不得影响这份契约。Stage 1 确认后,Stage 2 才把它与已安装状态进行适配;`template_application` 只描述**如何使用**,不负责决定**选哪个模板**。
> **兼容性预检:** Step 3 也接受 `design_spec.md` 直接位于所给根目录、且满足当前 kind 合同的旧式平铺 Brand/Layout/Deck 工作区。Layout/Deck 还必须带有当前 structured SVG;Style 没有平铺形态。旧的原子 placeholder、未映射 Master/Layout 等语义旧包会被拒绝。先运行 `create-template` 创建新工作区,再从该工作区生成新的 structured 页面;不会原地升级旧包。
@@ -96,7 +96,7 @@ Layout 工作区:skills/ppt-master/templates/layouts/presentation_core/
模板工作区:projects/acme_template/
```
-在聊天中显式选择时,“模板工作区”这些标签可以不写,但 root 必须精确;页面中的 library 选择已自带精确 root。如果选择两个相同 kind 的工作区,工作流会进入既有冲突解决门,不会静默替你选一个。
+在聊天中显式选择时,“模板工作区”这些标签可以不写,但 root 必须精确;页面中的 library 选择已自带精确 root。页面中每个注册 kind 最多选一个,指定地址最多选一个;若指定地址解析出的 kind 与某个注册选择相同,工作流会进入既有的两份同类冲突解决门,不会静默替你选一个。
你不需要选择模板使用模式。对 Layout/Deck,Strategist 会读取真实的 Master/Layout/原型集合和当前内容,决定选哪些页、哪些重复/跳过/重排,以及是否重组。Brand 只提供身份约束,Style 只提供方向/方法默认值;除非另一个工作区提供结构,否则两者都保持页面自由编排。如果你在意某个边界,直接在同一句请求里用普通语言说明即可,例如“封面和结束页原样保留,中间页由你选择”或“只参考视觉语言”;明确文字优先于 AI 判断。
diff --git a/skills/ppt-master/references/artifact-ownership.md b/skills/ppt-master/references/artifact-ownership.md
index 3c94f5b0..055a144d 100644
--- a/skills/ppt-master/references/artifact-ownership.md
+++ b/skills/ppt-master/references/artifact-ownership.md
@@ -34,7 +34,7 @@ the default profile, but it does not create `svg_final/`.
| `images/image_prompts.json`, `image_queries.json`, `image_sources.json`, `formula_manifest.json` | Conditional resource contracts | AI/web/formula execution status and provenance | Create only for a triggered path, including Quick. They guide preparation/attribution, never page design. |
| `icons/` | Prepared project icon pool | Bundled icons copied by `icon_sync.py` plus user-provided, template, imported, or custom icon SVGs | SVG authoring may use any icon in this project-local pool; `spec_lock.icons.inventory` records the default plan's bundled choices rather than an exhaustive whitelist. Exporter global fallback is legacy compatibility only. |
| `${SKILL_DIR}/templates/{brands,styles,layouts,decks}/*_index.json` | Library discovery indexes | The complete registered option source for Step-3 UI selection and chat listing | Read the four index files only; never scan kind directories to add options. Derive a library root from kind + entry id. Exact unregistered roots remain explicit inputs and never enter an index implicitly. |
-| `templates/` | Project template reference | Step 3 installed/fused specs, optional Layout/Deck SVG prototypes, and non-image assets | After selection, Strategist and every later role read this project-local state only, never the library/external installation root. Strategist reads every installed template Design Spec and an actual SVG roster only for Layout/Deck; Brand and Style are intentionally roster-free. Continuous Executor reuses that context; fresh Executor reads the Design Spec once and each selected complete SVG, when any, only before first use or after its SHA changes. |
+| `templates/` | Project template reference | Step 3 installed/fused specs, optional Layout/Deck SVG prototypes, and non-image assets | From Stage 2 onward, template-aware Strategist work and every later role read this project-local state only, never the library/external installation root. Strategist reads every installed template Design Spec and an actual SVG roster only for Layout/Deck; Brand and Style are intentionally roster-free. Continuous Executor reuses that context; fresh Executor reads the Design Spec once and each selected complete SVG, when any, only before first use or after its SHA changes. |
| `templates/template_execution_manifest.json` (`v1`) + `templates/template_execution/*.text-slots.json` (`v2-min`) | Derived template index | Compact prototype/source-import summary plus per-prototype text-slot diagnostics; the sidecar integrity hash is tool-only | Materialization may publish these deterministic records, but page-context does not inject or require them and models do not read them during page authoring. The complete prototype SVG is the sole visual/template authority; never author from either JSON artifact. |
| `<import_workspace>/svg/` | Imported native-payload backing | Complete PPTX-derived metadata, hidden carriers, fallback evidence, and source structure | Keep immutable; create-template materialization may resolve a validated source ref against these files, but models do not edit or bulk-read them |
| `<import_workspace>/svg-flat/` | Optional complete-page verification backing | Self-contained visual composition generated only by explicit `--inheritance-mode both` | Keep immutable when requested; never use as authoring or materialization input |
diff --git a/skills/ppt-master/references/strategist-template.md b/skills/ppt-master/references/strategist-template.md
index e1023b56..cb81e0e1 100644
--- a/skills/ppt-master/references/strategist-template.md
+++ b/skills/ppt-master/references/strategist-template.md
@@ -4,24 +4,26 @@
Conditional extension for applying an installed Brand/Style/Layout/Deck workspace to Stage 2 recommendations and the execution lock.
-**Trigger**: Load only when Generate Step 3 validated an explicit workspace path and either installed it into `<project_path>/templates/` or confirmed that the target project is consuming it in place. Bare template names, style words, and free-design projects do not trigger this module.
+**Trigger**: Load only after Stage 1 is confirmed, when Generate Step 3 validated a library or explicit workspace path and either installed it into `<project_path>/templates/` or confirmed that the target project is consuming it in place. Bare template names, style words, and free-design projects do not trigger this module.
---
## 1. AI-Authored Template Application Plan
-**Template vs preset**: A style mention and a Style workspace are different inputs. Bare names and style words remain interpretive input and never resolve to a local path; only an explicitly installed workspace activates the rules below. Its fused `<project_path>/templates/design_spec.md` is the template-design source. Treat `kind: style` or a fused provenance entry for `style` as an active Direction / method segment.
+**Template vs preset**: A style mention and a Style workspace are different inputs. Bare names and style words remain interpretive input and never resolve to a local path; only a selected and installed workspace activates the rules below. Its fused `<project_path>/templates/design_spec.md` is the template-design source. Treat `kind: style` or a fused provenance entry for `style` as an active Direction / method segment. Whether a source root was labelled `library` or `explicit` is installation provenance only and never affects Stage-2 precedence.
**Legacy template boundary**: A Layout/Deck template containing `native_structure.json`, `source_template.pptx`, missing root Master identity, direct atomic placeholders, or old `baseline` / `preserve` / distillation metadata is not a Generate Step 3 input. Create a current workspace through [`create-template`](../workflows/create-template.md), preferably from the original PPTX when native topology matters. Brand and Style are intentionally roster-free; never reject either for omitting SVG or Master identity. Do not mutate the input in place.
**No template-mode confirmation**: Never ask the user to select `template_reuse_scope`, `template_adherence`, `mirror`, `layout`, `style`, `strict`, or `adaptive`. These are internal execution values for the current exporter. The user communicates intent in natural language; explicit instructions such as “全部原样保留”, “从中选合适的页面”, “可以重组”, or “只参考视觉” are authoritative. Without an explicit instruction, Strategist decides.
+**Hard rule — no Stage-1 influence**: Do not load this module, the installed template spec, prototypes, assets, or template canvas while authoring Stage 1. Stage 1 is already confirmed when this module begins; never revise it to match the workspace.
+
Immediately before authoring the Stage-2 solution, load each relevant template
resource once per path + SHA and inspect:
- every installed `design_spec.md`; for Layout/Deck only, also inspect the actual Page Roster and relevant SVG prototypes;
-- the resolved Identity, Structure, Application, and Direction / method segment owners from the Step-3 fusion receipt;
-- the current communication contract, source obligations, planned page count, and content shape of every planned page;
+- the resolved Identity, Structure, Reusable Application Context, and Direction / method segment owners from the Step-3 fusion receipt;
+- the confirmed current communication contract, source obligations, planned page count, and content shape of every planned page;
- the user's natural-language instructions, including any page names/numbers or elements they explicitly require.
Then author one plan that decides all of the following without presenting an option menu:
@@ -54,7 +56,7 @@ Write only the derived values to `spec_lock.md pptx_structure`; omit `template_a
## 2. Scenario Fit and Inherited Design
-**Mandatory — decide from the §1 inspection**: For an installed `kind: deck`, compare the retained Template Overview with the confirmed audience, intent, outcome, delivery context, artifact afterlife, and source obligations. Compare the retained Page Roster/relevant SVG prototypes with required narrative roles, content shapes, slots, and capacity. Reopen a resource only when its path + SHA changed. The template describes what exists; it never overrides the current project or own required/optional/repeatable or fixed/replaceable/example-only policy. For `kind: layout`, compare only structural roles, slots, and capacity. For an active Style segment, compare its communication method with the current contract and its composition requirements with any selected Layout/Deck structure. Surface a material incompatibility; never silently weaken one segment to make it fit.
+**Mandatory — decide from the §1 inspection**: For an installed `kind: deck`, compare the retained Template Overview with the confirmed audience, intent, outcome, delivery context, artifact afterlife, and source obligations. Deck application is reusable context for this comparison, never the current project's application contract and never an override. Compare the retained Page Roster/relevant SVG prototypes with required narrative roles, content shapes, slots, and capacity. Reopen a resource only when its path + SHA changed. The template describes what exists; it never overrides the current project or own required/optional/repeatable or fixed/replaceable/example-only policy. For `kind: layout`, compare only structural roles, slots, and capacity. For an active Style segment, compare its communication method with the current contract and its composition requirements with any selected Layout/Deck structure. Surface a material incompatibility; never silently weaken one segment to make it fit.
| Internal scope | Appropriate when |
|---|---|
@@ -66,7 +68,7 @@ When the communication contract conflicts with the workspace, choose and state t
> Internal note: `content_divergence` controls source reorganization; the AI-derived `template_reuse_scope` records the reused layer; `template_adherence` records whether a structured plan keeps or extends existing Layout identities.
-**Template design precedence**: Explicit current user instructions and final confirmation win. Brand identity overrides Deck identity, and either is fixed starting truth rather than an industry default. Style owns Direction / method only: its color, typography, icon, and image values are candidate defaults and never override resolved Brand/Deck identity or become official facts. Preferred Mode / Visual Style values seed Stage 2; the Style overlay must resolve into the final single `mode` and `visual_style` lock rather than create a parallel narrative or aesthetic authority. Style takes this segment ahead of ordinary Stage-2 defaults; actual Deck prototypes and Signature facts remain compatibility constraints, not a second method owner. Each of ≥3 directions still carries six palette roles and complete fonts: repeat fixed Brand/Deck values with `typography.fixed: true`; adapt Style candidates to that identity and vary only open roles. Keep resolved icon and image constraints. Style Review Focus never activates [`visual-review`](../workflows/stages/visual-review.md); only an explicit user request does.
+**Template design precedence**: Explicit current user instructions and final confirmation win. Brand identity overrides Deck identity, Layout structure overrides Deck structure, and Deck retains only its non-overridden integrated segments plus reusable application context. Style owns Direction / method only: its color, typography, icon, and image values are candidate defaults and never override resolved Brand/Deck identity or become official facts. Preferred Mode / Visual Style values seed Stage 2; the Style overlay must resolve into the final single `mode` and `visual_style` lock rather than create a parallel narrative or aesthetic authority. Style takes this segment ahead of ordinary Stage-2 defaults; actual Deck prototypes and Signature facts remain compatibility constraints, not a second method owner. Library/explicit provenance never changes this order. Each of ≥3 directions still carries six palette roles and complete fonts: repeat fixed Brand/Deck values with `typography.fixed: true`; adapt Style candidates to that identity and vary only open roles. Keep resolved icon and image constraints. Style Review Focus never activates [`visual-review`](../workflows/stages/visual-review.md); only an explicit user request does.
---
diff --git a/skills/ppt-master/references/strategist.md b/skills/ppt-master/references/strategist.md
index 13b5cd4a..4b0f4f02 100644
--- a/skills/ppt-master/references/strategist.md
+++ b/skills/ppt-master/references/strategist.md
@@ -38,6 +38,8 @@ second, production third:
Do not force communication intent into one catalog label; Stage 1 records composite intent in prose. Editable prose fields are recommendation drafts, not required inputs: confirmation preserves current text and blanks; never repopulate a cleared field. Stage 2 confirms narrative spine, reading density, page budget, visual system, image direction, and how the already installed template should be used. It never chooses or installs a template. Inspect only the project-local template spec/prototypes, present one editable application plan, and keep exporter reuse/adherence internal. Present ≥3 coordinated safe / shifted / bold directions so color, type, icons, and generated-image rendering begin coherent; the user may override each component. Generated images inherit deck colors—there is no second image palette. Stage 3 covers production. Its proactive defaults are speaker notes `true`, custom animations `false`, and narration audio `false`; a prior explicit user instruction overrides the matching recommendation, and effective narration audio requires effective speaker notes. Author each stage once; same-stage edits update only visible browser state through documented deterministic dependencies, without another AI/backend recommendation. Launch/derive/wait mechanics live in [`generate-pptx.md`](../workflows/generate-pptx.md) Step 4; item specs keep `a`–`h`.
+**Hard rule — Stage-1 source boundary**: Build Stage 1 only from the current user request, source facts, conversation constraints, and project-initialization state. Ignore the selected template roots, installed/fused template state, template assets/prototypes, and template-owned canvas. Do not load or apply [`strategist-template.md`](./strategist-template.md) until the confirmed Stage-1 contract is available for Stage 2. Early installation is storage preparation, not planning evidence for Stage 1.
+
> **Execution discipline**: Step 3 template selection was the preceding independent BLOCKING checkpoint. This is the last always-on checkpoint. After confirmation, proceed without another pause unless spec refinement is enabled.
>
> **One opt-in exception**: present the refinement line with the split-mode note ([`generate-pptx.md`](../workflows/generate-pptx.md) Step 4). Only explicit opt-in runs [`refine-spec`](../workflows/stages/refine-spec.md): write the Design Spec once, pass Gate 1, then stop before the lock for unrestricted chat revision. Never enter it unprompted.
@@ -62,7 +64,7 @@ Explicit *must*, *only*, *exactly*, *verbatim*, *do not*, or `no-crop` wording m
### a. Canvas Format Confirmation
-Recommend format based on scenario (see [`canvas-formats.md`](canvas-formats.md)).
+Recommend format from the current scenario and project initialization (see [`canvas-formats.md`](canvas-formats.md)). A template canvas is not Stage-1 evidence; Stage 2 later checks whether selected structure can serve the confirmed current-project canvas.
### b. Page Count Confirmation
diff --git a/skills/ppt-master/scripts/confirm_ui/server.py b/skills/ppt-master/scripts/confirm_ui/server.py
index 9fe74b81..8330a0fe 100644
--- a/skills/ppt-master/scripts/confirm_ui/server.py
+++ b/skills/ppt-master/scripts/confirm_ui/server.py
@@ -124,6 +124,10 @@ _TEMPLATE_LIBRARY_CONFIG = {
'layout': ('layouts', 'layouts_index.json'),
'deck': ('decks', 'decks_index.json'),
}
+_TEMPLATE_KIND_LINE_RE = re.compile(
+ r'''kind\s*:\s*(?:'([^']*)'|"([^"]*)"|([A-Za-z][A-Za-z0-9_-]*))'''
+ r'''\s*(?:#.*)?\Z'''
+)
_ICON_PREVIEW_SAMPLES = {
'chunk-filled': ('home', 'chart-line', 'users', 'target'),
'tabler-filled': ('home', 'chart-dots', 'user', 'bulb'),
@@ -199,6 +203,61 @@ def _safe_template_id(template_id: object) -> bool:
)
+def _template_design_spec_path(workspace_root: Path) -> Path:
+ """Return the current or legacy Design Spec for one workspace root."""
+ current = workspace_root / 'templates' / 'design_spec.md'
+ if current.is_file():
+ return current
+ legacy = workspace_root / 'design_spec.md'
+ if legacy.is_file():
+ return legacy
+ raise ValueError(
+ 'template workspace is missing templates/design_spec.md '
+ f'or legacy design_spec.md: {workspace_root}'
+ )
+
+
+def _template_kind_from_spec(spec_path: Path) -> str:
+ """Read one supported top-level ``kind`` from Design Spec frontmatter."""
+ try:
+ lines = spec_path.read_text(encoding='utf-8-sig').splitlines()
+ except OSError as exc:
+ raise ValueError(f'cannot read template Design Spec {spec_path}: {exc}') from exc
+ if not lines or lines[0] != '---':
+ raise ValueError(f'{spec_path} must start with YAML frontmatter')
+ try:
+ frontmatter_end = lines.index('---', 1)
+ except ValueError as exc:
+ raise ValueError(f'{spec_path} has unterminated YAML frontmatter') from exc
+
+ declared_kind = None
+ for line_number, line in enumerate(lines[1:frontmatter_end], start=2):
+ if re.match(r'^\s*kind\s*:', line) is None:
+ continue
+ if line != line.lstrip():
+ raise ValueError(
+ f'{spec_path}:{line_number} kind must be a top-level frontmatter field'
+ )
+ match = _TEMPLATE_KIND_LINE_RE.fullmatch(line)
+ if match is None:
+ raise ValueError(
+ f'{spec_path}:{line_number} has an invalid kind declaration'
+ )
+ if declared_kind is not None:
+ raise ValueError(f'{spec_path} frontmatter declares kind more than once')
+ declared_kind = next(value for value in match.groups() if value is not None)
+
+ if declared_kind is None:
+ raise ValueError(f'{spec_path} frontmatter must declare kind')
+ if declared_kind not in _TEMPLATE_LIBRARY_CONFIG:
+ supported = ', '.join(_TEMPLATE_LIBRARY_CONFIG)
+ raise ValueError(
+ f'{spec_path} frontmatter kind must be one of {supported}; '
+ f'got {declared_kind!r}'
+ )
+ return declared_kind
+
+
def _read_template_options_input(confirm_dir: Path) -> tuple[dict, list[Path]]:
"""Read and validate the agent-authored Step-3 template input."""
options_file = confirm_dir / TEMPLATE_OPTIONS_NAME
@@ -250,14 +309,7 @@ def _read_template_options_input(confirm_dir: Path) -> tuple[dict, list[Path]]:
)
if not root.is_dir():
raise ValueError(f'explicit workspace root is not a directory: {canonical}')
- if not (
- (root / 'templates' / 'design_spec.md').is_file()
- or (root / 'design_spec.md').is_file()
- ):
- raise ValueError(
- 'explicit workspace root is missing templates/design_spec.md '
- f'or legacy design_spec.md: {canonical}'
- )
+ _template_design_spec_path(root)
seen.add(canonical)
roots.append(root)
return data, roots
@@ -300,6 +352,12 @@ def _build_template_library() -> tuple[dict, dict[str, dict], dict[str, dict], d
raise ValueError(
f'{index_path} entry {template_id!r} is missing {spec_path}'
)
+ declared_kind = _template_kind_from_spec(spec_path)
+ if declared_kind != kind:
+ raise ValueError(
+ f'{index_path} entry {template_id!r} declares kind '
+ f'{declared_kind!r}, expected {kind!r}'
+ )
summary = metadata.get('summary', '')
if not isinstance(summary, str):
raise ValueError(
@@ -334,26 +392,33 @@ def _build_template_options(confirm_dir: Path) -> tuple[dict, dict[str, dict]]:
source, explicit_roots = _read_template_options_input(confirm_dir)
library, candidates, registered_roots, index_contracts = _build_template_library()
explicit = []
- preselected_keys = []
+ suggested_keys = []
for root in explicit_roots:
canonical_root = str(root)
registered = registered_roots.get(canonical_root)
if registered is not None:
- preselected_keys.append(registered['key'])
+ suggested_keys.append(registered['key'])
continue
digest = hashlib.sha256(canonical_root.encode('utf-8')).hexdigest()
key = f'explicit:{digest}'
if key in candidates:
raise ValueError(f'duplicate template candidate key: {key}')
+ kind = _template_kind_from_spec(_template_design_spec_path(root))
candidate = {
'key': key,
'source': 'explicit',
+ 'kind': kind,
'label': root.name or canonical_root,
'workspace_root': canonical_root,
}
explicit.append(candidate)
candidates[key] = candidate
- preselected_keys.append(key)
+ suggested_keys.append(key)
+
+ # One supplied exact root is an unambiguous convenience default. Multiple
+ # roots are candidates for the single-select controls, not an instruction
+ # to select all of them.
+ preselected_keys = suggested_keys if len(suggested_keys) == 1 else []
response = {
'schema_version': TEMPLATE_SCHEMA_VERSION,
@@ -381,11 +446,11 @@ def _template_selection_from_candidate(candidate: dict) -> dict:
"""Project one trusted browser candidate into the persisted selection."""
selection = {
'source': candidate['source'],
- 'workspace_root': candidate['workspace_root'],
+ 'kind': candidate['kind'],
}
if candidate['source'] == 'library':
- selection['kind'] = candidate['kind']
selection['id'] = candidate['id']
+ selection['workspace_root'] = candidate['workspace_root']
return selection
@@ -445,27 +510,42 @@ def _validate_template_selection(data: dict) -> None:
raise ValueError(f'{TEMPLATE_SELECTION_NAME} selection_sha256 is invalid')
seen_roots = set()
+ seen_library_kinds = set()
+ explicit_count = 0
for index, selection in enumerate(selections):
if not isinstance(selection, dict):
raise ValueError(
f'{TEMPLATE_SELECTION_NAME} selections[{index}] must be an object'
)
source = selection.get('source')
- expected_keys = {'source', 'workspace_root'}
+ if source not in {'library', 'explicit'}:
+ raise ValueError(
+ f'{TEMPLATE_SELECTION_NAME} selections[{index}] has invalid source'
+ )
+ kind = selection.get('kind')
+ if kind not in _TEMPLATE_LIBRARY_CONFIG:
+ raise ValueError(
+ f'{TEMPLATE_SELECTION_NAME} selections[{index}] has invalid kind'
+ )
+ expected_keys = {'source', 'kind', 'workspace_root'}
if source == 'library':
- expected_keys.update({'kind', 'id'})
- if selection.get('kind') not in _TEMPLATE_LIBRARY_CONFIG:
+ expected_keys.add('id')
+ if kind in seen_library_kinds:
raise ValueError(
- f'{TEMPLATE_SELECTION_NAME} selections[{index}] has invalid kind'
+ 'template selection allows at most one library workspace '
+ f'for kind {kind!r}'
)
+ seen_library_kinds.add(kind)
if not _safe_template_id(selection.get('id')):
raise ValueError(
f'{TEMPLATE_SELECTION_NAME} selections[{index}] has invalid id'
)
- elif source != 'explicit':
- raise ValueError(
- f'{TEMPLATE_SELECTION_NAME} selections[{index}] has invalid source'
- )
+ else:
+ explicit_count += 1
+ if explicit_count > 1:
+ raise ValueError(
+ 'template selection allows at most one explicit workspace'
+ )
if set(selection) != expected_keys:
raise ValueError(
f'{TEMPLATE_SELECTION_NAME} selections[{index}] has invalid fields'
@@ -1134,12 +1214,16 @@ def _stage_skip_error(confirm_dir: Path) -> Optional[str]:
)
-def _template_confirmation_required(project_path: Path, recommendations: dict) -> bool:
- """Return whether this project must use the staged template confirmation."""
- return (
- 'template_application' in recommendations
- or (project_path / 'templates' / 'design_spec.md').is_file()
- )
+def _template_confirmation_required(project_path: Path) -> bool:
+ """Return whether the confirmed project state has an active template."""
+ confirm_dir = project_path / CONFIRM_DIR_NAME
+ if (confirm_dir / TEMPLATE_OPTIONS_NAME).is_file():
+ handoff = _read_template_handoff(
+ project_path,
+ confirm_dir / TEMPLATE_HANDOFF_NAME,
+ )
+ return handoff['mode'] == 'templates'
+ return (project_path / 'templates' / 'design_spec.md').is_file()
def _template_stage2_error(
@@ -1480,9 +1564,10 @@ def _stage2_custom_candidates_error(recommendations: dict) -> Optional[str]:
def _submission_stage_error(
- project_path: Path,
confirm_dir: Path,
submitted_stage: Optional[str],
+ *,
+ template_required: bool,
) -> Optional[str]:
"""Reject a confirmation that does not match the staged recommendation."""
try:
@@ -1491,10 +1576,6 @@ def _submission_stage_error(
return f'cannot confirm without valid current recommendations: {exc}'
rec_stage_number = _recommendation_stage(recommendations)
- template_required = _template_confirmation_required(
- project_path,
- recommendations,
- )
if rec_stage_number == 0:
if template_required:
return (
@@ -2497,6 +2578,19 @@ def create_app(
return jsonify({
'error': f'invalid current recommendation file: {exc}',
}), 400
+ rec_stage_number = _recommendation_stage(data)
+ if rec_stage_number == 1 and (confirm_dir / TEMPLATE_OPTIONS_NAME).exists():
+ template_error = _template_stage1_ready_error(
+ project_path,
+ confirm_dir,
+ )
+ if template_error:
+ return jsonify({
+ 'error': (
+ 'template phase is not ready for Stage 1: '
+ f'{template_error}'
+ ),
+ }), 409
# Report whether a result already exists (re-open after confirm).
result_file = confirm_dir / RESULT_NAME
if _stage_skip(
@@ -2510,7 +2604,6 @@ def create_app(
# Later stages render only downstream sections, so fold earlier confirmed
# choices from result.json back in. A refresh / reopen then re-inits from
# the user's choices instead of catalog defaults.
- rec_stage_number = _recommendation_stage(data)
if rec_stage_number >= 2 and result_file.exists():
_merge_confirmed_choices(data, result_file)
if rec_stage_number > 0:
@@ -2525,13 +2618,18 @@ def create_app(
# aliases/tags the shared helper already understands; an old prose
# value must never prevent the compatibility UI from opening.
_canonicalize_primary_language(data, required=False)
+ try:
+ template_required = _template_confirmation_required(project_path)
+ except (OSError, json.JSONDecodeError, ValueError) as exc:
+ return jsonify({
+ 'error': f'cannot determine active template mode: {exc}',
+ }), 409
+ if not template_required:
+ data.pop('template_application', None)
if rec_stage_number == 2:
recommendation_error = _template_stage2_error(
data,
- template_required=_template_confirmation_required(
- project_path,
- data,
- ),
+ template_required=template_required,
)
if recommendation_error:
return jsonify({'error': recommendation_error}), 409
@@ -2586,10 +2684,16 @@ def create_app(
return jsonify({
'error': f'template phase is not ready for Stage 1: {template_error}',
}), 409
+ try:
+ template_required = _template_confirmation_required(project_path)
+ except (OSError, json.JSONDecodeError, ValueError) as exc:
+ return jsonify({
+ 'error': f'cannot determine active template mode: {exc}',
+ }), 409
stage_error = _submission_stage_error(
- project_path,
confirm_dir,
stage,
+ template_required=template_required,
)
if stage_error:
return jsonify({'error': stage_error}), 409
@@ -2657,6 +2761,9 @@ def create_app(
rec_file,
result_file,
)
+ if not template_required:
+ result.pop('template_application', None)
+ locked_values.pop('template_application', None)
if stage not in {'stage1', 'stage2'}:
proactive_result_error = _normalize_proactive_execution_result(
result,
diff --git a/skills/ppt-master/scripts/confirm_ui/static/app.js b/skills/ppt-master/scripts/confirm_ui/static/app.js
index 65306bba..004b21de 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/app.js
+++ b/skills/ppt-master/scripts/confirm_ui/static/app.js
@@ -15,7 +15,7 @@
page_title: "PPT Master - Confirm Design",
topbar_hint: "Answer the open questions, or pick and customize recommendations, then continue.",
template_stage_title: "Choose a template",
- template_stage_hint: "Choose free design or one or more exact templates. This selection is separate from Stage 1.",
+ template_stage_hint: "Choose free design, or combine one registered template per type plus one specified path. This selection is separate from Stage 1.",
stage_anchors: "Stage 1 · Communication contract",
stage_design: "Stage 2 · Deck direction & visual system",
stage_images: "Stage 3 · Resources & production",
@@ -40,17 +40,18 @@
sec_template_free: "Free design",
template_free_title: "Design from the current content",
template_free_desc: "Use no reusable template workspace. The Strategist will derive the visual system from this project.",
- sec_template_library: "Existing templates",
- template_library_hint: "Select any compatible registered Brand, Style, Layout, or Deck workspaces. Multiple selections are allowed.",
+ sec_template_library: "Template combination",
+ template_library_hint: "Choose at most one registered template for each type. Brand, Style, Layout, and Deck can be combined.",
sec_template_explicit: "Specified templates",
- template_explicit_hint: "Exact unregistered workspace roots supplied for this run. Their source paths are shown for verification.",
+ template_explicit_hint: "Choose at most one exact workspace supplied for this run. Its source path is shown for verification.",
template_kind_brand: "Brand",
template_kind_style: "Style",
template_kind_layout: "Layout",
template_kind_deck: "Deck",
template_source_library: "Library",
- template_source_explicit: "Specified",
+ template_source_explicit: "Specified path",
template_source_path: "Source path",
+ template_select_none: "None",
template_none_registered: "No registered templates",
template_none_explicit: "No specified templates for this run",
sec_canvas: "Canvas format",
@@ -200,7 +201,7 @@
page_title: "PPT Master - デザイン確認",
topbar_hint: "自由記述の質問に答えるか、提案を選択・調整して次へ進んでください。",
template_stage_title: "テンプレートを選択",
- template_stage_hint: "自由デザイン、または使用する正確なテンプレートを選択します。この選択はステージ1とは独立しています。",
+ template_stage_hint: "自由デザイン、または種類ごとに登録済み1件と指定パス1件までを組み合わせます。この選択はステージ1とは独立しています。",
stage_anchors: "ステージ 1 · コミュニケーション契約",
stage_design: "ステージ 2 · 全体方針とビジュアルシステム",
stage_images: "ステージ 3 · リソースと制作",
@@ -225,17 +226,18 @@
sec_template_free: "自由デザイン",
template_free_title: "現在の内容からデザインする",
template_free_desc: "再利用テンプレートを使わず、Strategist がこのプロジェクトからビジュアルシステムを組み立てます。",
- sec_template_library: "既存のテンプレート",
- template_library_hint: "登録済みの Brand、Style、Layout、Deck から互換性のあるものを選択します。複数選択できます。",
+ sec_template_library: "テンプレートの組み合わせ",
+ template_library_hint: "登録済みテンプレートは種類ごとに1件まで選択でき、Brand、Style、Layout、Deck を組み合わせられます。",
sec_template_explicit: "指定テンプレート",
- template_explicit_hint: "この実行で指定された未登録の正確なワークスペースです。確認用に参照元パスを表示します。",
+ template_explicit_hint: "この実行で指定された正確なワークスペースを1件まで選択できます。確認用に参照元パスを表示します。",
template_kind_brand: "Brand",
template_kind_style: "Style",
template_kind_layout: "Layout",
template_kind_deck: "Deck",
template_source_library: "ライブラリ",
- template_source_explicit: "指定テンプレート",
+ template_source_explicit: "指定パス",
template_source_path: "参照元パス",
+ template_select_none: "なし",
template_none_registered: "登録済みテンプレートはありません",
template_none_explicit: "この実行で指定されたテンプレートはありません",
sec_canvas: "キャンバス形式",
@@ -385,7 +387,7 @@
page_title: "确认设计方案",
topbar_hint: "回答开放问题,或选择并调整推荐项,然后继续。",
template_stage_title: "选择模板",
- template_stage_hint: "选择自由设计或一个/多个精确模板。这个选择独立于 Stage 1。",
+ template_stage_hint: "选择自由设计,或组合每类一个已注册模板与一个指定地址。这个选择独立于 Stage 1。",
stage_anchors: "第一阶段 · 沟通契约",
stage_design: "第二阶段 · 完整方案与视觉系统",
stage_images: "第三阶段 · 资源与生产执行",
@@ -410,17 +412,18 @@
sec_template_free: "自由设计",
template_free_title: "根据当前内容从零设计",
template_free_desc: "不使用可复用模板工作区,由 Strategist 根据当前项目推导视觉系统。",
- sec_template_library: "已有模板",
- template_library_hint: "从已注册的 Brand、Style、Layout、Deck 中选择兼容模板;支持多选。",
+ sec_template_library: "模板组合",
+ template_library_hint: "每种已注册模板最多选择一个;Brand、Style、Layout、Deck 可以组合使用。",
sec_template_explicit: "指定模板",
- template_explicit_hint: "本次运行明确提供的未注册工作区;显示来源路径供你核对。",
+ template_explicit_hint: "本次运行明确提供的精确工作区最多选择一个;显示来源路径供你核对。",
template_kind_brand: "Brand",
template_kind_style: "Style",
template_kind_layout: "Layout",
template_kind_deck: "Deck",
template_source_library: "模板库",
- template_source_explicit: "指定模板",
+ template_source_explicit: "指定地址",
template_source_path: "来源路径",
+ template_select_none: "无",
template_none_registered: "暂无已注册模板",
template_none_explicit: "本次运行没有指定模板",
sec_canvas: "画布格式",
@@ -698,6 +701,7 @@
var TEMPLATE_OPTIONS = null;
var TEMPLATE_CANDIDATES = [];
var TEMPLATE_SELECTED_KEYS = [];
+ var TEMPLATE_SELECTIONS = { brand: "", style: "", layout: "", deck: "", explicit: "" };
var TEMPLATE_MODE = "free_design";
var TEMPLATE_PHASE = false;
var TEMPLATE_SUBMITTING = false;
@@ -884,14 +888,61 @@
});
normalized.explicit = normalizeTemplateCandidates(data && data.explicit, "explicit", "");
TEMPLATE_CANDIDATES = TEMPLATE_CANDIDATES.concat(normalized.explicit);
- var validKeys = TEMPLATE_CANDIDATES.map(function (candidate) { return candidate.key; });
- TEMPLATE_SELECTED_KEYS = normalized.preselected_keys.filter(function (key, index, all) {
- return validKeys.indexOf(key) >= 0 && all.indexOf(key) === index;
+ var candidatesByKey = Object.create(null);
+ TEMPLATE_CANDIDATES.forEach(function (candidate) {
+ if (candidatesByKey[candidate.key]) {
+ throw new Error("Duplicate template option key: " + candidate.key);
+ }
+ candidatesByKey[candidate.key] = candidate;
});
- TEMPLATE_MODE = TEMPLATE_SELECTED_KEYS.length ? "templates" : "free_design";
+ TEMPLATE_SELECTIONS = emptyTemplateSelections();
+ normalized.preselected_keys.filter(function (key, index, all) {
+ return all.indexOf(key) === index;
+ }).forEach(function (key) {
+ var candidate = candidatesByKey[key];
+ var slot = templateSelectionSlot(candidate);
+ if (!candidate || !slot) {
+ throw new Error("Invalid preselected template key: " + key);
+ }
+ if (TEMPLATE_SELECTIONS[slot]) {
+ throw new Error("Multiple preselected templates for slot: " + slot);
+ }
+ TEMPLATE_SELECTIONS[slot] = key;
+ });
+ syncTemplateSelectionState();
TEMPLATE_OPTIONS = normalized;
}
+ function emptyTemplateSelections() {
+ return { brand: "", style: "", layout: "", deck: "", explicit: "" };
+ }
+
+ function templateSelectionSlot(candidate) {
+ if (!candidate) return "";
+ if (candidate.source === "explicit") return "explicit";
+ if (candidate.source === "library" && TEMPLATE_KINDS.indexOf(candidate.kind) >= 0) {
+ return candidate.kind;
+ }
+ return "";
+ }
+
+ function templateCandidateByKey(key) {
+ key = String(key || "");
+ for (var i = 0; i < TEMPLATE_CANDIDATES.length; i += 1) {
+ if (TEMPLATE_CANDIDATES[i].key === key) return TEMPLATE_CANDIDATES[i];
+ }
+ return null;
+ }
+
+ function syncTemplateSelectionState() {
+ TEMPLATE_SELECTED_KEYS = TEMPLATE_KINDS.map(function (kind) {
+ return TEMPLATE_SELECTIONS[kind];
+ });
+ TEMPLATE_SELECTED_KEYS.push(TEMPLATE_SELECTIONS.explicit);
+ TEMPLATE_SELECTED_KEYS = TEMPLATE_SELECTED_KEYS.filter(Boolean);
+ TEMPLATE_MODE = TEMPLATE_SELECTED_KEYS.length ? "templates" : "free_design";
+ }
+
function templateCandidateTitle(candidate) {
return localized(candidate, "label") || candidate.label || candidate.id || candidate.key;
}
@@ -904,108 +955,127 @@
return t("template_kind_" + kind);
}
- function templateKeySelected(key) {
- return TEMPLATE_SELECTED_KEYS.indexOf(String(key)) >= 0;
- }
-
function chooseFreeDesign() {
- TEMPLATE_MODE = "free_design";
- TEMPLATE_SELECTED_KEYS = [];
- renderTemplatePhase();
+ TEMPLATE_SELECTIONS = emptyTemplateSelections();
+ syncTemplateSelectionState();
+ updateTemplateSelectionControls();
}
- function toggleTemplateKey(key) {
- key = String(key);
- var index = TEMPLATE_SELECTED_KEYS.indexOf(key);
- if (index >= 0) TEMPLATE_SELECTED_KEYS.splice(index, 1);
- else TEMPLATE_SELECTED_KEYS.push(key);
- TEMPLATE_MODE = TEMPLATE_SELECTED_KEYS.length ? "templates" : "free_design";
- renderTemplatePhase();
+ function chooseTemplateForSlot(slot, key) {
+ TEMPLATE_SELECTIONS[slot] = String(key || "");
+ syncTemplateSelectionState();
+ updateTemplateSelectionControls();
}
- function templateSourceBadge(source) {
- return el(
- "span",
- "template-source-badge template-source-" + source,
- t(source === "explicit" ? "template_source_explicit" : "template_source_library")
- );
- }
-
- function templateCandidateCard(candidate) {
- var selected = templateKeySelected(candidate.key);
- var card = el("button", "template-card" + (selected ? " selected" : ""));
- card.type = "button";
- card.setAttribute("aria-pressed", selected ? "true" : "false");
- card.setAttribute("data-template-key", candidate.key);
-
- var head = el("span", "template-card-head");
- head.appendChild(el("span", "template-card-title", templateCandidateTitle(candidate)));
- var badges = el("span", "template-card-badges");
- badges.appendChild(templateSourceBadge(candidate.source));
- if (candidate.source === "library" && candidate.kind) {
- badges.appendChild(el("span", "template-kind-badge", templateKindLabel(candidate.kind)));
- }
- head.appendChild(badges);
- card.appendChild(head);
-
+ function templateOptionTitle(candidate) {
+ var details = [];
var summary = templateCandidateSummary(candidate);
- if (summary) card.appendChild(el("span", "template-card-summary", summary));
- if (candidate.source === "explicit") {
- var path = el("span", "template-card-path");
- path.appendChild(el("span", "template-card-path-label", t("template_source_path") + ":"));
- path.appendChild(el("code", "template-card-path-value", candidate.workspace_root || ""));
- card.appendChild(path);
+ if (summary) details.push(summary);
+ if (candidate.workspace_root) details.push(candidate.workspace_root);
+ return details.join(" · ");
+ }
+
+ function renderTemplateSelectField(slot, label, candidates) {
+ var field = el("div", "template-select-field template-select-field-" + slot);
+ var selectId = "template-select-" + slot;
+ var fieldLabel = el("label", "template-select-label", label);
+ fieldLabel.setAttribute("for", selectId);
+ field.appendChild(fieldLabel);
+
+ var select = el("select", "template-select");
+ select.id = selectId;
+ select.setAttribute("data-template-slot", slot);
+ var none = el("option", "", t("template_select_none"));
+ none.value = "";
+ select.appendChild(none);
+ candidates.forEach(function (candidate) {
+ var option = el("option", "", templateCandidateTitle(candidate));
+ option.value = candidate.key;
+ var title = templateOptionTitle(candidate);
+ if (title) option.title = title;
+ select.appendChild(option);
+ });
+ select.value = TEMPLATE_SELECTIONS[slot] || "";
+ select.disabled = !candidates.length;
+ select.addEventListener("change", function () {
+ chooseTemplateForSlot(slot, select.value);
+ });
+ field.appendChild(select);
+
+ if (slot === "explicit") {
+ field.appendChild(el(
+ "div",
+ "template-select-help",
+ candidates.length ? t("template_explicit_hint") : t("template_none_explicit")
+ ));
+ var path = el("div", "template-selected-path");
+ path.id = "template-explicit-path";
+ path.appendChild(el("span", "template-selected-path-label", t("template_source_path") + ":"));
+ var code = el("code", "template-selected-path-value");
+ code.id = "template-explicit-path-value";
+ path.appendChild(code);
+ field.appendChild(path);
}
- card.addEventListener("click", function () { toggleTemplateKey(candidate.key); });
- return card;
+ return field;
}
function renderTemplateFreeDesign(host) {
var sec = section("F", "sec_template_free");
var selected = TEMPLATE_MODE === "free_design";
- var card = el("button", "template-card template-free-card" + (selected ? " selected" : ""));
- card.type = "button";
- card.setAttribute("aria-pressed", selected ? "true" : "false");
- card.appendChild(el("span", "template-card-title", t("template_free_title")));
- card.appendChild(el("span", "template-card-summary", t("template_free_desc")));
- card.addEventListener("click", chooseFreeDesign);
- sec.appendChild(card);
+ var choice = el("button", "template-free-choice" + (selected ? " selected" : ""));
+ choice.id = "template-free-choice";
+ choice.type = "button";
+ choice.setAttribute("aria-pressed", selected ? "true" : "false");
+ choice.appendChild(el("span", "template-choice-radio"));
+ var copy = el("span", "template-free-copy");
+ copy.appendChild(el("span", "template-free-title", t("template_free_title")));
+ copy.appendChild(el("span", "template-free-desc", t("template_free_desc")));
+ choice.appendChild(copy);
+ choice.addEventListener("click", chooseFreeDesign);
+ sec.appendChild(choice);
host.appendChild(sec);
}
- function renderTemplateLibrary(host) {
+ function renderTemplateSelectors(host) {
var sec = section("L", "sec_template_library", t("template_library_hint"));
+ var grid = el("div", "template-select-grid");
TEMPLATE_KINDS.forEach(function (kind) {
- var group = el("div", "template-kind-group");
- group.appendChild(el("h3", "template-kind-title", templateKindLabel(kind)));
var candidates = TEMPLATE_OPTIONS.library[kind] || [];
- if (!candidates.length) {
- group.appendChild(el("div", "template-empty", t("template_none_registered")));
- } else {
- var grid = el("div", "template-card-grid");
- candidates.forEach(function (candidate) {
- grid.appendChild(templateCandidateCard(candidate));
- });
- group.appendChild(grid);
- }
- sec.appendChild(group);
+ grid.appendChild(renderTemplateSelectField(kind, templateKindLabel(kind), candidates));
});
+ grid.appendChild(renderTemplateSelectField(
+ "explicit",
+ t("template_source_explicit"),
+ TEMPLATE_OPTIONS.explicit || []
+ ));
+ sec.appendChild(grid);
host.appendChild(sec);
}
- function renderTemplateExplicit(host) {
- var sec = section("E", "sec_template_explicit", t("template_explicit_hint"));
- var candidates = TEMPLATE_OPTIONS.explicit || [];
- if (!candidates.length) {
- sec.appendChild(el("div", "template-empty", t("template_none_explicit")));
- } else {
- var grid = el("div", "template-card-grid template-explicit-grid");
- candidates.forEach(function (candidate) {
- grid.appendChild(templateCandidateCard(candidate));
- });
- sec.appendChild(grid);
+ function updateTemplateExplicitPath() {
+ var path = document.getElementById("template-explicit-path");
+ var value = document.getElementById("template-explicit-path-value");
+ if (!path || !value) return;
+ var candidate = templateCandidateByKey(TEMPLATE_SELECTIONS.explicit);
+ var workspaceRoot = candidate && candidate.workspace_root ? candidate.workspace_root : "";
+ path.hidden = !workspaceRoot;
+ value.textContent = workspaceRoot;
+ value.title = workspaceRoot;
+ }
+
+ function updateTemplateSelectionControls() {
+ var freeChoice = document.getElementById("template-free-choice");
+ var freeSelected = TEMPLATE_MODE === "free_design";
+ if (freeChoice) {
+ freeChoice.classList.toggle("selected", freeSelected);
+ freeChoice.setAttribute("aria-pressed", freeSelected ? "true" : "false");
}
- host.appendChild(sec);
+ TEMPLATE_KINDS.concat(["explicit"]).forEach(function (slot) {
+ var select = document.getElementById("template-select-" + slot);
+ if (select) select.value = TEMPLATE_SELECTIONS[slot] || "";
+ });
+ updateTemplateExplicitPath();
+ updateTemplateSelectionStatus();
}
function updateTemplateSelectionStatus() {
@@ -1029,8 +1099,7 @@
host.innerHTML = "";
_secCounter = 0;
renderTemplateFreeDesign(host);
- renderTemplateLibrary(host);
- renderTemplateExplicit(host);
+ renderTemplateSelectors(host);
document.getElementById("error").style.display = "none";
document.getElementById("loading").style.display = "none";
host.style.display = "block";
@@ -1038,7 +1107,7 @@
var btn = document.getElementById("btn-confirm");
btn.disabled = false;
btn.textContent = t("btn_confirm_template");
- updateTemplateSelectionStatus();
+ updateTemplateSelectionControls();
}
function normalizeRecId(field, value) {
diff --git a/skills/ppt-master/scripts/confirm_ui/static/style.css b/skills/ppt-master/scripts/confirm_ui/static/style.css
index 4904b3c1..1165ec85 100644
--- a/skills/ppt-master/scripts/confirm_ui/static/style.css
+++ b/skills/ppt-master/scripts/confirm_ui/static/style.css
@@ -602,136 +602,130 @@ textarea.text-input { resize: vertical; line-height: 1.5; }
.subfield-label { font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
/* ---- Step 3 template selection ---- */
-.template-kind-group + .template-kind-group {
- margin-top: 18px;
- padding-top: 18px;
- border-top: 1px solid var(--line);
-}
-.template-kind-title {
- margin: 0 0 9px;
- color: var(--ink);
- font-size: 13px;
- font-weight: 700;
-}
-.template-card-grid {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
- gap: 10px;
-}
-.template-card {
+.template-free-choice {
width: 100%;
- min-width: 0;
+ display: flex;
+ align-items: flex-start;
+ gap: 11px;
border: 1px solid var(--line);
- border-radius: 10px;
+ border-radius: 9px;
background: var(--card);
color: var(--ink);
- padding: 13px 14px;
+ padding: 11px 13px;
text-align: left;
cursor: pointer;
transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
-.template-card:hover {
+.template-free-choice:hover {
border-color: var(--accent);
}
-.template-card:focus-visible {
+.template-free-choice:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
-.template-card.selected {
+.template-free-choice.selected {
border-color: var(--accent);
background: var(--accent-soft);
box-shadow: 0 0 0 1px var(--accent);
}
-.template-free-card {
- display: flex;
- flex-direction: column;
- gap: 5px;
+.template-choice-radio {
+ flex: none;
+ width: 17px;
+ height: 17px;
+ margin-top: 2px;
+ border: 2px solid #aeb5bf;
+ border-radius: 50%;
+ background: #fff;
+ box-shadow: inset 0 0 0 3px #fff;
}
-.template-card-head {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: 10px;
+.template-free-choice.selected .template-choice-radio {
+ border-color: var(--accent);
+ background: var(--accent);
}
-.template-card-title {
- display: block;
+.template-free-copy {
min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+}
+.template-free-title {
font-size: 13.5px;
font-weight: 700;
line-height: 1.4;
- overflow-wrap: anywhere;
}
-.template-card-badges {
- display: flex;
- flex: none;
- align-items: center;
- justify-content: flex-end;
- gap: 5px;
- flex-wrap: wrap;
+.template-free-desc {
+ color: var(--muted);
+ font-size: 12.5px;
+ line-height: 1.45;
}
-.template-source-badge,
-.template-kind-badge {
- display: inline-flex;
- align-items: center;
- min-height: 20px;
- border-radius: 999px;
- padding: 2px 7px;
- font-size: 10.5px;
+.template-select-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
+ gap: 13px 16px;
+}
+.template-select-field {
+ min-width: 0;
+}
+.template-select-label {
+ display: block;
+ margin-bottom: 6px;
+ color: var(--ink);
+ font-size: 12.5px;
font-weight: 700;
- line-height: 1.3;
}
-.template-source-library,
-.template-kind-badge {
- background: #eef2f7;
- color: #475569;
+.template-select {
+ width: 100%;
+ min-width: 0;
+ height: 40px;
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ padding: 0 34px 0 11px;
+ background: var(--card);
+ color: var(--ink);
+ font-size: 13.5px;
}
-.template-source-explicit {
- background: #fff3d6;
- color: #8a5a00;
+.template-select:hover:not(:disabled) {
+ border-color: var(--accent);
}
-.template-card-summary {
- display: block;
- margin-top: 7px;
+.template-select:focus {
+ outline: none;
+ border-color: var(--accent);
+ box-shadow: 0 0 0 2px var(--accent-soft);
+}
+.template-select:disabled {
+ background: #f4f6f8;
+ color: #9aa1aa;
+ cursor: not-allowed;
+}
+.template-select-help {
+ margin-top: 6px;
color: var(--muted);
- font-size: 12.5px;
- line-height: 1.55;
+ font-size: 11.5px;
+ line-height: 1.45;
}
-.template-card-path {
- display: block;
- margin-top: 10px;
- padding-top: 9px;
- border-top: 1px dashed #d9dde3;
+.template-selected-path {
+ margin-top: 7px;
+ min-width: 0;
}
-.template-card-path-label {
+.template-selected-path[hidden] {
+ display: none;
+}
+.template-selected-path-label {
display: block;
- margin-bottom: 3px;
+ margin-bottom: 2px;
color: var(--muted);
font-size: 10.5px;
font-weight: 700;
}
-.template-card-path-value {
+.template-selected-path-value {
display: block;
color: #475569;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 11px;
- line-height: 1.45;
+ line-height: 1.4;
overflow-wrap: anywhere;
white-space: normal;
}
-.template-explicit-grid .template-card {
- border-style: dashed;
-}
-.template-explicit-grid .template-card.selected {
- border-style: solid;
-}
-.template-empty {
- border: 1px dashed var(--line);
- border-radius: 9px;
- padding: 12px 14px;
- color: var(--muted);
- background: #f8fafc;
- font-size: 12.5px;
-}
/* ---- toggles ---- */
.toggle-row { display: flex; align-items: center; gap: 12px; }
diff --git a/skills/ppt-master/scripts/docs/confirm_ui.md b/skills/ppt-master/scripts/docs/confirm_ui.md
index 39cdd4c2..9186f54d 100644
--- a/skills/ppt-master/scripts/docs/confirm_ui.md
+++ b/skills/ppt-master/scripts/docs/confirm_ui.md
@@ -71,9 +71,11 @@ starts, or after it times out while the server remains live:
**Always-on Step-3 chat handoff**: After writing `template_options.json`, launch
the healthy daemon without `--wait`. Immediately post its actual URL plus a
-compact localized summary: free design is available; registered options come
-only from the four kind indexes; and every supplied exact root is shown as a
-library or explicit candidate according to exact canonical-root equality. End
+compact localized summary: free design is available; the page has one
+single-select dropdown for each registered kind plus one for supplied exact
+roots; registered options come only from the four kind indexes; and every
+supplied exact root is shown as a library or explicit candidate according to
+exact canonical-root equality. End
with a localized line saying the user may select on the page or reply in chat
with free design / exact roots if the page did not open. Only then run
`--wait-only --wait-stage template`. Silence confirms nothing.
@@ -121,7 +123,7 @@ python3 scripts/confirm_ui/server.py <project_path> --shutdown # Step 4 clean
- Initial Step-3 launch requires valid `<project_path>/confirm_ui/template_options.json`. After template selection, the same service exposes Stage 1 only when a matching handoff exists and the Stage-1 recommendation is no older than that handoff. Compatibility launches without a template phase still require the recommendation file expected from `result.json`; `--shutdown` needs neither input.
- Per-project lock at `<project_path>/.confirm_ui.lock` — duplicate launches are refused; stale locks (dead pid) are overwritten.
- Idle auto-shutdown after 900 s by default; `/api/shutdown` exits gracefully and releases the lock.
-- `/api/template-options` serves the server-built Step-3 catalog and `/api/template-confirm` accepts only current candidate keys, then writes the trusted receipt. `/api/recommendations` and `/api/confirm` own only the later Strategist stages and strip legacy `template_reuse_scope` / `template_adherence` fields. Those exporter values are never user-facing controls; an installed template instead exposes editable natural-language `template_application` in Stage 2.
+- `/api/template-options` serves the server-built Step-3 catalog and `/api/template-confirm` accepts only current candidate keys, then writes the trusted receipt. `/api/recommendations` and `/api/confirm` own only the later Strategist stages and strip legacy `template_reuse_scope` / `template_adherence` fields. The completed template handoff is authoritative: `free_design` also strips a stray `template_application`, while `templates` exposes that editable natural-language field in Stage 2.
Dependency:
@@ -152,6 +154,8 @@ Template selection is a separate pre-Strategist phase. Its files live under
- `explicit_workspace_roots` is required even when empty. Every item is a
unique absolute path resolving to an existing directory with
`templates/design_spec.md` or compatible legacy `design_spec.md`.
+- The array supplies candidates for the one specified-root dropdown; it does
+ not authorize selecting several explicit roots in one confirmation.
- Do not write library entries into this file. The server reads only
`templates/brands/brands_index.json`,
`templates/styles/styles_index.json`,
@@ -181,13 +185,29 @@ Template selection is a separate pre-Strategist phase. Its files live under
A library candidate has `key`, `source: "library"`, `kind`, `id`, `label`,
`summary`, and canonical absolute `workspace_root`. An unregistered explicit
-candidate has `key`, `source: "explicit"`, `label`, and canonical absolute
-`workspace_root`. If a supplied root exactly equals a registered canonical
+candidate has `key`, `source: "explicit"`, parsed `kind`, `label`, and
+canonical absolute `workspace_root`. If a supplied root exactly equals a registered canonical
root, the server reuses the library candidate/key instead of duplicating it as
explicit. Candidate keys are server-owned; the page posts only
`{ "mode": "free_design"|"templates", "selection_keys": [...] }` to
`POST /api/template-confirm`.
+When the input supplies exactly one root, `preselected_keys` contains its
+resolved candidate key as a convenience default, including when exact equality
+reclassifies it as library. When several roots are supplied, all remain
+candidates but none is preselected; one specified-root dropdown cannot encode
+an instruction to use all of them.
+
+**Page selection model**: The first control is exclusive free design. Below it,
+Brand, Style, Layout, and Deck each have one registered single-select dropdown,
+and Specified has one explicit-root single-select dropdown. Every dropdown
+starts with `None`. Selecting any template exits free design; selecting free
+design clears all dropdowns. The registered kinds may be combined, but each
+contributes at most one root and the specified channel contributes at most one.
+The server enforces the same limits. Because an explicit candidate carries its
+parsed kind, it may coexist with one registered root of that kind and enter the
+two-workspace same-kind conflict gate. Source provenance never grants priority.
+
### Output — `template_selection.json` (written on confirmation)
```json
@@ -205,6 +225,7 @@ explicit. Candidate keys are server-owned; the page posts only
},
{
"source": "explicit",
+ "kind": "deck",
"workspace_root": "/canonical/unregistered/workspace/root"
}
],
@@ -217,7 +238,10 @@ explicit. Candidate keys are server-owned; the page posts only
`mode: "free_design"` requires `selections: []`; `mode: "templates"` requires
at least one selection. Roots are unique canonical absolute paths. A library
selection contains exactly `source`, `kind`, `id`, and `workspace_root`; an
-explicit selection contains exactly `source` and `workspace_root`. The browser
+explicit selection contains exactly `source`, `kind`, and `workspace_root`.
+There is at most one library selection per kind and at most one explicit
+selection overall; cross-kind composition remains valid, and one explicit plus
+one library selection may share a kind. The browser
cannot submit arbitrary paths because the server resolves posted keys against
the catalog it just built. `options_sha256` binds the receipt to the current
input, four index files, and resolved candidates. `selection_sha256` binds the
@@ -228,7 +252,9 @@ After `--wait-only --wait-stage template` returns, Generate reads this receipt
once. Free design skips installation but still completes the agent handoff
below before Stage 1. Template mode runs `apply-template-workspace` against all
selected roots, waits for complete project-local installation/fusion, and only
-then completes that handoff. Strategist never reads the source roots.
+then completes that handoff. Step 3 resolves only template-to-template segment
+ownership and installation; it does not evaluate current-project fit.
+Strategist never reads the source roots.
### Agent handoff — `template_handoff.json`
@@ -305,8 +331,12 @@ from `result.json`; `template_selection.json` is its separate prerequisite.
| `recommendations.json` | stage or legacy no-stage payload | read-only compatibility when no stage-specific file exists | matching legacy behavior | preserves the former staged or single-pass behavior; new projects never create this file |
The AI launches the template phase, applies its confirmed receipt, and only then
-authors Stage 1. It authors the complete Stage-2 solution once from the user's
-actual communication contract, then authors Stage-3 production mechanics once
+authors Stage 1. Stage-1 recommendations use only the current user request,
+source facts, conversation constraints, and project initialization; the
+selection, installed template content/assets, and template canvas are excluded.
+After Stage 1 is confirmed, the AI inspects the installed project-local state
+and authors the complete Stage-2 solution once from the user's actual
+communication contract, then authors Stage-3 production mechanics once
from the confirmed solution. An edit inside the current stage never requests
another recommendation. The page preserves earlier answers across transitions.
`GET /api/session` reports `phase: "template"` until selection closes, its
@@ -329,12 +359,17 @@ match the filename. A later file that skips ahead (for example
`recommendations.stage3.json` while only Stage 1 is confirmed and Stage 2 is
absent) is never rendered: `/api/session` keeps reporting `waiting_agent` with
`stage_skip: true`, and `--wait` / `--wait-only` exit `2` if a result skips the
-stage being awaited. An installed template does not exempt Stage 2: its
-recommendations must include `template_application.value`, and an installed
-workspace or that field disables the no-stage legacy single-pass path. Legacy
+stage being awaited. A confirmed templates-mode workspace does not exempt
+Stage 2: its
+recommendations must include `template_application.value`, and that completed
+mode disables the no-stage legacy single-pass path. Legacy
single-pass remains available only for non-template compatibility payloads.
-### Input — `recommendations.stage1.json` (created after Step 3 installation)
+### Input — `recommendations.stage1.json` (created after the Step 3 handoff)
+
+Installation is only the ordering prerequisite. Do not read template selection,
+specs, prototypes, assets, fused segment owners, or template canvas when
+authoring this file.
```json
{
@@ -381,9 +416,6 @@ After Stage 1 is confirmed, create `recommendations.stage2.json` with the comple
"image_usage": ["ai", "provided"]
},
"page_count": { "value": "12-15" },
- "template_application": {
- "value": "选用封面、章节页和数据页原型;跳过示例内容页。品牌标识和页脚保留,正文可按当前材料重组。"
- },
"image_notes": { "value": "封面和章节页用 AI 主视觉;产品页优先用户素材。" },
"custom_candidates": {
"mode": {
@@ -458,7 +490,18 @@ After Stage 2 is confirmed, create `recommendations.stage3.json` with production
- `custom_candidates` is recommendation-only. Mode / style carry localized `name` + `behavior`; conditional image strategy also carries `rendering: "custom"`, `visual`, and `mood`. When a proposal combines or borrows existing catalog entries, the visible behavior names every exact id and Strategist reads every corresponding file before authoring it; a genuinely novel proposal names none. The server rejects missing required candidates; the UI shows full copy, edits it only after selection, rejects a selected blank, and omits unselected candidates from `result.json`. Template-backed proposals obey inherited identity, prototype capacity, and `template_application`.
- Seed `audience`, `communication_intent`, `audience_outcome`, and `delivery_context` when evidence supports them; users need not supply them, and every Stage-1 prose field may end blank. The contract and `primary_language` stay in `result.json` and `design_spec.md`; `spec_lock.md communication` receives `primary_language`, compact `audience` / `objective` / `core_message`, and reading mode. `communication_intent` may preserve multiple purposes and priority/sequence; never add a `primary_job` enum.
- Do not write `recommend.template_reuse_scope` or `recommend.template_adherence`. Strategist records those internal exporter values later in `spec_lock.md` after inspecting the actual template and current content.
-- For an installed template workspace, write one editable prose field as top-level `template_application.value`. It summarizes **how to use** the already selected project-local template: actual page/prototype use and preservation/reorganization decisions. It never chooses, changes, or reinstalls a workspace. Omit it for free design. The UI returns the current string through Stage 2, Stage 3, and final confirmation; Strategist then persists the final effective plan as `- **Template Application**: ...` in `design_spec.md §I`, which Executor reads from the retained Design Spec. Never replace it with internal reuse/adherence ids or a fixed option menu.
+- For a confirmed templates-mode handoff, write one editable prose field as top-level `template_application.value`. It summarizes **how to use** the already selected project-local template: actual page/prototype use and preservation/reorganization decisions. It never chooses, changes, or reinstalls a workspace. Omit it for free design. The UI returns the current string through Stage 2, Stage 3, and final confirmation; Strategist then persists the final effective plan as `- **Template Application**: ...` in `design_spec.md §I`, which Executor reads from the retained Design Spec. Never replace it with internal reuse/adherence ids or a fixed option menu.
+
+Template-mode-only Stage-2 fragment:
+
+```json
+{
+ "template_application": {
+ "value": "选用封面、章节页和数据页原型;跳过示例内容页。品牌标识和页脚保留,正文可按当前材料重组。"
+ }
+}
+```
+
- `recommend.image_usage` should be an array of source ids when more than one source applies, e.g. `["ai", "provided"]`. A single string is still accepted for backward compatibility. Do not write bare `"custom"` and do not encode a mixed-source plan as prose here; write the prose to top-level `image_notes.value`.
- `image_notes` is the initial strategy note shown under the image source chips. Use it for page-role guidance and constraints: which source applies where, what to avoid, which user assets are authoritative, how realistic / abstract the imagery should be, and what can remain as placeholders. It is intent guidance, not a separate finite option.
- When confirmed Stage-2 `image_usage` includes `ai`, Stage 3 sets `recommend.image_ai_path` to one of `auto` / `api` / `host-native` / `manual`. Stage 2 never asks for the acquisition mechanism while the user is still deciding the image role.
@@ -488,7 +531,6 @@ After Stage 2 is confirmed, create `recommendations.stage3.json` with production
"delivery_context": "Primary: presenter-led 20-minute leadership review; secondary: reader-led approval copy shared afterward",
"artifact_afterlife": "Approval record, hand-off reference, and audit trail",
"content_divergence": "freely restructure and expand within the source",
- "template_application": "选用封面、章节页和数据页原型;跳过示例内容页。品牌标识和页脚保留,正文可按当前材料重组。",
"mode": "pyramid",
"visual_style": "swiss-minimal",
"color": { "name": "...", "palette": { "background": "#...", "secondary_bg": "#...", "primary": "#...", "accent": "#...", "secondary_accent": "#...", "body_text": "#..." } },
diff --git a/skills/ppt-master/templates/README.md b/skills/ppt-master/templates/README.md
index 84bfaa2d..4d107b41 100644
--- a/skills/ppt-master/templates/README.md
+++ b/skills/ppt-master/templates/README.md
@@ -41,13 +41,16 @@ which keeps the fixed route name and dispatches exactly one child workflow:
The four indexes are the complete library-discovery source for
[`generate-pptx`](../workflows/generate-pptx.md) Step 3. The default page shows
-their registered entries alongside free design and any exact workspace roots
-supplied for the run; it never scans the four directories or fuzzy-matches a
-bare name. An exact root that matches a registered index entry may be displayed
-as `library`; an unregistered root remains `explicit`. After confirmation,
+free design, one registered single-select dropdown per kind, and one separate
+single-select dropdown for exact roots supplied for the run; it never scans the
+four directories or fuzzy-matches a bare name. An exact root that matches a
+registered index entry may be displayed in its kind dropdown as `library`; an
+unregistered root remains `explicit` in the specified-root dropdown. After
+confirmation,
[`apply-template-workspace`](../workflows/stages/apply-template-workspace.md)
validates, fuses, and installs every selected workspace into the current
-project before Stage 1 starts. Later roles read only that project-local copy.
+project before Stage 1 starts. Template-aware reading begins in Stage 2 from
+that project-local copy.
## Orthogonal contracts
diff --git a/skills/ppt-master/templates/brands/README.md b/skills/ppt-master/templates/brands/README.md
index 4be3c607..b2c08c4c 100644
--- a/skills/ppt-master/templates/brands/README.md
+++ b/skills/ppt-master/templates/brands/README.md
@@ -12,15 +12,16 @@ lives in the parent [`README.md`](../README.md).
Brand application follows the independent selection phase in
[`generate-pptx`](../../workflows/generate-pptx.md) Step 3. The default page
-lists registered brands only from `brands_index.json`, alongside exact
-workspace roots supplied for this run; it never scans this directory or
-fuzzy-matches a bare brand name. An exact supplied root that matches a
-registered root may be labelled `library`, while an unregistered root remains
-`explicit`. The conditional
+fills the Brand dropdown only from `brands_index.json`; unregistered exact roots
+appear only in the separate specified-root dropdown. It never scans this
+directory or fuzzy-matches a bare brand name. An exact supplied root matching a
+registered root may be labelled `library`; otherwise it remains `explicit`. The
+conditional
[`apply-template-workspace`](../../workflows/stages/apply-template-workspace.md)
stage owns path normalization, portable-root installation, multi-kind fusion,
-same-kind conflict resolution, and provenance before Stage 1. Later roles read
-only the installed project-local copy. This file owns only the Brand schema.
+same-kind conflict resolution, and provenance before Stage 1. Template-aware
+reading begins in Stage 2 from the installed project-local copy. This file owns
+only the Brand schema.
## Creating a new brand
diff --git a/skills/ppt-master/templates/decks/README.md b/skills/ppt-master/templates/decks/README.md
index 8ce25a4e..77d68542 100644
--- a/skills/ppt-master/templates/decks/README.md
+++ b/skills/ppt-master/templates/decks/README.md
@@ -33,14 +33,15 @@ Overview when application fit must be judged in detail.
Selection uses the independent phase in
[`generate-pptx`](../../workflows/generate-pptx.md) Step 3. The default page
-lists registered Decks only from `decks_index.json`, alongside exact workspace
-roots supplied for this run; it never scans this directory or fuzzy-matches a
-bare ID. An exact supplied root that matches a registered root may be labelled
-`library`, while an unregistered root remains `explicit`. Choosing and
+fills the Deck dropdown only from `decks_index.json`; unregistered exact roots
+appear only in the separate specified-root dropdown. It never scans this
+directory or fuzzy-matches a bare ID. An exact supplied root matching a
+registered root may be labelled `library`; otherwise it remains `explicit`. Choosing and
confirming an entry triggers the conditional
[`apply-template-workspace`](../../workflows/stages/apply-template-workspace.md)
stage, which owns path normalization, compatibility checks, installation, and
-fusion before Stage 1. Later roles read only the installed project-local copy.
+fusion before Stage 1. Template-aware reading begins in Stage 2 from the
+installed project-local copy.
This file owns the Deck schema and application-context boundary. Chat discovery
reads the same index and returns exact roots; a bare ID never resolves
implicitly.
diff --git a/skills/ppt-master/templates/layouts/README.md b/skills/ppt-master/templates/layouts/README.md
index b24742b2..65fd376a 100644
--- a/skills/ppt-master/templates/layouts/README.md
+++ b/skills/ppt-master/templates/layouts/README.md
@@ -48,14 +48,15 @@ kind of rule is never a mirror operation.
Selection uses the independent phase in
[`generate-pptx`](../../workflows/generate-pptx.md) Step 3. The default page
-lists registered Layouts only from `layouts_index.json`, alongside exact
-workspace roots supplied for this run; it never scans this directory or
-fuzzy-matches a bare ID. An exact supplied root that matches a registered root
-may be labelled `library`, while an unregistered root remains `explicit`.
+fills the Layout dropdown only from `layouts_index.json`; unregistered exact
+roots appear only in the separate specified-root dropdown. It never scans this
+directory or fuzzy-matches a bare ID. An exact supplied root matching a
+registered root may be labelled `library`; otherwise it remains `explicit`.
Choosing and confirming an entry triggers the conditional
[`apply-template-workspace`](../../workflows/stages/apply-template-workspace.md)
stage, which owns path normalization, compatibility checks, installation, and
-fusion before Stage 1. Later roles read only the installed project-local copy.
+fusion before Stage 1. Template-aware reading begins in Stage 2 from the
+installed project-local copy.
This file owns the Layout schema and its identity/application boundary. Chat
discovery reads the same index and returns exact roots; a bare ID never resolves
implicitly.
diff --git a/skills/ppt-master/templates/styles/README.md b/skills/ppt-master/templates/styles/README.md
index faf13901..833cd5de 100644
--- a/skills/ppt-master/templates/styles/README.md
+++ b/skills/ppt-master/templates/styles/README.md
@@ -19,14 +19,14 @@ These names are separate contracts. Style-only and Style + Brand naturally produ
Selection uses the independent phase in
[`generate-pptx`](../../workflows/generate-pptx.md) Step 3. The default page
-lists registered Styles only from `styles_index.json`, alongside exact
-workspace roots supplied for this run; it never scans this directory or
-fuzzy-matches a bare Style name. An exact supplied root that matches a
-registered root may be labelled `library`, while an unregistered root remains
-`explicit`. A consulting label or ordinary visual description remains a brief
-or catalog signal and does not activate this workspace. Confirmation runs the
-common installation/fusion stage before Stage 1; later roles read only the
-project-local copy.
+fills the Style dropdown only from `styles_index.json`; unregistered exact roots
+appear only in the separate specified-root dropdown. It never scans this
+directory or fuzzy-matches a bare Style name. An exact supplied root matching a
+registered root may be labelled `library`; otherwise it remains `explicit`. A
+consulting label or ordinary visual description remains a brief or catalog
+signal and does not activate this workspace. Confirmation runs the
+common installation/fusion stage before Stage 1; template-aware reading begins
+in Stage 2 from the project-local copy.
| Decision | Precedence |
|---|---|
diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.md
index ac529324..4942b8fa 100644
--- a/skills/ppt-master/workflows/generate-pptx.md
+++ b/skills/ppt-master/workflows/generate-pptx.md
@@ -147,14 +147,14 @@ Direct supported bitmap inputs follow both boundaries: the original is archived
🚧 **GATE**: Step 2 complete; the project workspace exists. Finish this phase before authoring or confirming Stage 1. Template selection is not part of the Stage-1 communication contract.
-**Default UI phase**: When the selected confirmation surface is the page, open its template-selection phase first. Offer free design plus registered Brand/Style/Layout/Deck workspaces from exactly these discovery sources:
+**Default UI phase**: When the selected confirmation surface is the page, open its template-selection phase first. Show one exclusive free-design choice, four single-select registered-workspace dropdowns (Brand / Style / Layout / Deck), and one single-select specified-root dropdown. Every dropdown has a `None` option. A non-empty dropdown exits free design; choosing free design clears all five dropdowns. Populate the registered dropdowns from exactly these discovery sources:
- `templates/brands/brands_index.json`
- `templates/styles/styles_index.json`
- `templates/layouts/layouts_index.json`
- `templates/decks/decks_index.json`
-Derive each library root as `templates/<kind_dir>/<id>/` from its index entry. Never scan kind directories, infer unregistered entries, or resolve a bare name, brand mention, or style phrase to a path. A path the user explicitly supplied remains an `explicit` selection unless its normalized root exactly equals an entry derived from the matching index, in which case the UI may present it as `library`. This source label records discovery provenance only; every selected root passes the same validation.
+Derive each library root as `templates/<kind_dir>/<id>/` from its index entry. Never scan kind directories, infer unregistered entries, or resolve a bare name, brand mention, or style phrase to a path. The registered dropdowns may be combined across kinds, with at most one choice from each. The specified dropdown offers the exact roots supplied for this run and allows at most one choice. The server parses that workspace's declared `kind`; the specified choice may therefore coexist with one registered choice of the same kind and enter the existing two-workspace conflict gate. A path the user explicitly supplied remains an `explicit` selection unless its normalized root exactly equals an entry derived from the matching index, in which case the UI may present it as `library`. This source label records discovery provenance only; it never changes segment ownership, fusion precedence, validation, or installation behavior.
**UI branch — executable sequence**: Resolve the confirmation surface under
[`confirm_ui.md`](../scripts/docs/confirm_ui.md) before the first command. For
@@ -173,15 +173,17 @@ python3 ${SKILL_DIR}/scripts/confirm_ui/server.py <project_path> --wait-only --w
After the wait, read `confirm_ui/template_selection.json` exactly once and
require `schema_version: 1`, `phase: "template"`, and `status: "confirmed"`.
-`mode: "free_design"` carries no selections; `mode: "templates"` carries one
-or more server-resolved exact roots with `source: "library"|"explicit"`. Keep
+`mode: "free_design"` carries no selections; `mode: "templates"` carries the
+server-resolved exact roots with `source: "library"|"explicit"` and declared
+`kind`. It contains at most one library selection per kind plus at most one
+explicit selection. Keep
the server live while applying selected workspaces and preparing Stage 1; the
same page polls for `recommendations.stage1.json`. On a non-zero wait, re-check
the receipt once, then follow `confirm_ui.md`'s chat fallback/switch contract.
⛔ **BLOCKING — template selection**: Wait for the user to confirm free design or the selected roots. Do not expose Stage 1 before this choice closes.
-**Selected workspace path**: For every non-free selection, load and run [`apply-template-workspace.md`](./stages/apply-template-workspace.md) against the exact roots in the confirmed receipt (or their chat-equivalent selection). It validates all roots, resolves fusion/collisions, and installs one project-local template state under `<project_path>/templates/` plus any real `<project_path>/images/` and `<project_path>/icons/` assets. Do not proceed until installation completes. Strategist and later roles read only this installed project-local state, never the library or external source root.
+**Selected workspace path**: For every non-free selection, load and run [`apply-template-workspace.md`](./stages/apply-template-workspace.md) against the exact roots in the confirmed receipt (or their chat-equivalent selection). It validates all roots, resolves template-to-template segment ownership/collisions, and installs one project-local template state under `<project_path>/templates/` plus any real `<project_path>/images/` and `<project_path>/icons/` assets. It does not judge current-project fit or derive any Stage-1 field. Do not proceed until installation completes. Template-aware Strategist work from Stage 2 onward and later roles read only this installed project-local state, never the library or external source root.
**UI handoff**: After free design closes, or after every selected workspace is
installed, bind that completed state to the current selection before authoring
@@ -209,6 +211,8 @@ write the handoff manually.
🚧 **GATE**: Step 3 selection is confirmed; free design is active, or the selected template state is validated and installed in the project. Stage 1 has not started before this point.
+**Hard rule — Stage 1 is template-independent**: Author every Stage-1 recommendation from the user's current request, source facts, conversation constraints, and project-initialization state only. Do not read or use the Step-3 selection, installed template spec/prototypes/assets, fused segment owners, or any template canvas when recommending or confirming Stage 1. The project initialization canvas remains the Stage-1 starting value unless the current user/source context changes it. Template inspection and current-project fit begin only after Stage 1 is confirmed, while authoring Stage 2.
+
First, read the role core, then only the modules triggered by the current plan:
```
Read references/strategist.md
@@ -216,10 +220,10 @@ Read references/strategist.md
| Deterministic trigger | Additional Strategist reference |
|---|---|
-| Step 3 installed a selected Brand/Style/Layout/Deck workspace into this project | `references/strategist-template.md` |
+| Stage 1 is confirmed and Step 3 installed a selected Brand/Style/Layout/Deck workspace into this project | `references/strategist-template.md` before Stage 2 |
| The core's proposed Stage 2 `image_usage` contains a source other than `none`, the user supplied an explicit non-`none` image constraint, or formula-worthy content activates formula planning | `references/strategist-image.md` + `references/image-layout-spec.md` + `references/image-layout-patterns.md` before authoring image renderings, production detail, formula resources, or §VIII |
-Core chooses Stage-2 sources. Load it before Stage 2 for non-`none`, or after confirmation if `none` changes; do not backfill candidates. Retain for confirmed non-`none` or formulas; otherwise write no image rows. Only an installed project-local template state loads the template module; a bare template/style name does not.
+Core chooses Stage-2 sources. Load it before Stage 2 for non-`none`, or after confirmation if `none` changes; do not backfill candidates. Retain for confirmed non-`none` or formulas; otherwise write no image rows. Only an installed project-local template state loads the template module, and only after Stage 1 is confirmed; a bare template/style name does not.
> ⚠️ **Mandatory artifact gates**: after final confirmation, author complete `design_spec.md` from `${SKILL_DIR}/templates/design_spec_reference.md`. After Gate 1 and any refinement approval, author `spec_lock.md` from `${SKILL_DIR}/templates/spec_lock_reference.md` plus approved Design Spec/context. Author each new artifact once without placeholders or `scaffold-*` (manual-only). Schema validity does not prove semantic fidelity.
@@ -272,7 +276,7 @@ chat fallback using the already printed URL, then:
python3 ${SKILL_DIR}/scripts/confirm_ui/server.py <project_path> --wait-only --wait-stage stage1
```
-2. Read Stage 1. Derive proposed image sources, load the triggered image-planning bundle above, and apply `strategist-template.md` when active. Create `confirm_ui/recommendations.stage2.json` without changing Stage 1, then wait:
+2. Read Stage 1. Only now inspect the installed template state and apply `strategist-template.md` when active. Derive proposed image sources, load the triggered image-planning bundle above, and create `confirm_ui/recommendations.stage2.json` without changing Stage 1, then wait:
```bash
python3 ${SKILL_DIR}/scripts/confirm_ui/server.py <project_path> --wait-only --wait-stage stage2
diff --git a/skills/ppt-master/workflows/stages/apply-template-workspace.md b/skills/ppt-master/workflows/stages/apply-template-workspace.md
index 2e50971d..900fb87c 100644
--- a/skills/ppt-master/workflows/stages/apply-template-workspace.md
+++ b/skills/ppt-master/workflows/stages/apply-template-workspace.md
@@ -4,7 +4,7 @@ description: Generate-PPTX Step-3 runbook for validating, installing, or fusing
# Apply Template Workspace Stage
-> Run only from [`generate-pptx.md`](../generate-pptx.md) Step 3 after the user confirms one or more library/explicit workspace roots, or after Create Template hands off its exact validated root in the current conversation. Never load this stage for confirmed free design, a bare template name, a style description, or a brand mention. This stage applies a completed selection; it does not move template choice into Stage 1 or Stage 2.
+> Run only from [`generate-pptx.md`](../generate-pptx.md) Step 3 after the user confirms the dropdown-composed library/explicit workspace roots, or after Create Template hands off its exact validated root in the current conversation. Never load this stage for confirmed free design, a bare template name, a style description, or a brand mention. This stage applies a completed selection; it does not move template choice into Stage 1 or Stage 2.
## 1. Gate and Normalize Inputs
@@ -32,6 +32,8 @@ valid without index membership; exact equality with a registered root may be
reported as `library`. The label changes discovery provenance only, never schema
validation, fusion precedence, or installation behavior.
+**Selection cardinality**: The default page permits one registered root per kind plus one explicit root. Kinds compose freely; an explicit root may pair with a same-kind library root under §5.2. Reject larger receipts server-side.
+
**Hard rule — raw source boundary**: A raw PPTX is not a Step 3 workspace. Raw PPTX plus new content uses [`template-fill-pptx`](../template-fill-pptx.md). When the user wants reusable SVG/template generation, run [`create-template`](../create-template.md) first and return with its validated workspace root. Never add Master/Layout/placeholder structure directly to an existing PPTX or SVG project.
**Compatibility gate**: Reject semantic-legacy or incomplete structured packages, including old baseline/distillation metadata, incomplete Master identity, or legacy direct atomic placeholders. Create a new current workspace through Create Template; use the original PPTX when native topology must be preserved. A legacy-flat Brand/Layout/Deck directory is readable only when it satisfies its current kind contract; Layout/Deck also require a current structured SVG contract. Style has no legacy-flat form and always requires `<root>/templates/design_spec.md`.
@@ -92,8 +94,9 @@ For a compatible legacy-flat package, route SVG/spec/non-bitmaps to project `tem
If the normalized source root equals the target project root, consume it in place and copy nothing. An in-place workspace cannot participate in multi-path fusion. Ignore source `exports/`; it contains review artifacts, not portable template inputs. Empty optional roots remain absent.
**Hard rule — project-local consumer boundary**: After installation/fusion,
-Strategist and every later role read only `<project_path>/templates/` and the
-project-local `images/` / `icons/` pools. The original library or external root
+template-aware Strategist work from Stage 2 onward and every later role read
+only `<project_path>/templates/` and the project-local `images/` / `icons/`
+pools. The original library or external root
is installation input, not a later prompt source. If source and target are the
same project root, that in-place root already satisfies this boundary.
@@ -102,24 +105,24 @@ Template SVGs are authoring prototypes, not export-time overlays. The generated
## 5. Fuse Multiple Workspace Paths
-Multi-path fusion supports different kinds, or at most two workspaces of the same kind. Resolve all segment and asset conflicts before writing any target file.
+Fuse different kinds or at most two same-kind roots. Resolve template segment/asset conflicts before writing. Never read, predict, or revise Stage 1 here.
### 5.1 Different Kinds
-Resolve four whole segments instead of enumerating every kind combination. This table selects the starting workspace owner; explicit current user instructions and the final Strategist confirmation remain authoritative over every result:
+Resolve four whole template segments. This table selects the installed starting owner; current user instructions and later confirmation still govern project use:
| Segment | Starting owner |
|---|---|
-| Identity | Brand, otherwise Deck, otherwise the current Stage-2 project decision. Style color/type/icon/image values are direction candidates, never identity truth. |
-| Structure | A compatible Layout, otherwise Deck, otherwise free design. Style owns no canvas, prototype, Master/Layout, slot, or page mapping. |
-| Application | The current Stage-1 communication contract, informed by Deck's descriptive recurring-application context when present. Style never supplies the current audience, outcome, page count, outline, or content. |
-| Direction / method | Style, otherwise the current Stage-2 project decision. Actual Deck prototypes and Signature facts may inform compatibility, but Deck does not own the Style-only method segment. |
+| Identity | Brand, otherwise Deck, otherwise unresolved until Stage 2. Style color/type/icon/image values are direction candidates, never identity truth. |
+| Structure | A compatible Layout, otherwise Deck, otherwise unresolved/free design until Stage 2. Style owns no canvas, prototype, Master/Layout, slot, or page mapping. |
+| Reusable application context | Deck only when present. Preserve it for the later Stage-2 comparison; it never becomes the current project's application contract. |
+| Direction / method | Style when present, otherwise unresolved until Stage 2. Actual Deck prototypes and Signature facts may inform compatibility, but Deck does not own the Style-only method segment. |
Replace each selected segment wholesale; do not mix its fields implicitly. Brand or Deck identity replaces any identity-adjacent defaults carried by Style. A Style direction may adapt to that resolved identity, but cannot relabel its candidates as official brand facts.
-Before Layout overrides Deck structure, verify that every required application/narrative/content role fits the Layout's page roles, slot types, and capacity. On mismatch, stop and surface exactly three remedies: retain Deck structure, select another Layout, or explicitly revise the application contract.
+Before Layout overrides Deck structure, compare Deck's reusable roles with Layout roles, slots, and capacity. On mismatch, offer exactly three remedies: retain Deck structure, select another Layout, or omit Deck. Do not invent the current project contract before Stage 1.
-Before Style overlays Deck-derived prototype/visual guidance, verify that its communication method can serve the Deck application and that its composition requirements fit the selected Layout/Deck structure. On mismatch, stop and surface the conflicting segment facts; require the user to omit the Style, choose a compatible Style/structure, or explicitly revise the application contract. Do not silently weaken Style, Deck, or Layout to make the paths appear compatible.
+Before Style overlays Deck guidance, verify that its method serves Deck's reusable context and fits the selected structure. On mismatch, require omitting Style or choosing a compatible Style/structure; never silently weaken a segment. Stage 2 separately checks the result against the confirmed project contract.
Field-level micro-adjustments such as a primary-color override are not Step 3 fusion. Carry them into the normal Strategist confirmation fields.
@@ -142,7 +145,7 @@ Write one final `<project>/templates/design_spec.md`. Immediately under its H1,
Single-path installs do not add provenance. Set fused frontmatter `kind` from the non-Style capability: `deck` when identity and structure are both present, `layout` for structure only, or `brand` for identity only. Use `kind: style` only for Style-only input. Adding Style to Brand, Layout, Deck, or Brand + Layout does not change that existing capability label; its Direction / method ownership stays explicit in the fused provenance and body. A project-local Brand + Layout fusion uses `kind: deck` for routing but is not automatically a reusable library Deck; its application remains current-project context.
-**Completion receipt**: Report `roots=<normalized roots>; sources=<library|explicit per root>; kinds=<kind per root>; segments=identity:<owner>,structure:<owner>,application:<owner>,direction:<owner>; install=<in-place|copied>; final_spec=<project_path>/templates/design_spec.md`.
+**Completion receipt**: Report `roots=<normalized roots>; sources=<library|explicit per root>; kinds=<kind per root>; segments=identity:<owner>,structure:<owner>,application_context:<owner>,direction:<owner>; install=<in-place|copied>; final_spec=<project_path>/templates/design_spec.md`.
## ✅ Template Workspace Applied