@dickpy/dsh-oil-slide 0.0.0-stage → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +89 -2
- package/bundled-assets/brand/empty-deck-cobalt.webp +0 -0
- package/bundled-assets/brand/oil-slide-mark-512.png +0 -0
- package/bundled-assets/skill/LICENSE +21 -0
- package/bundled-assets/skill/README.md +61 -0
- package/bundled-assets/skill/SKILL.md +185 -0
- package/bundled-assets/skill/references/art-directions.md +99 -0
- package/bundled-assets/skill/references/brand-and-canvas.md +72 -0
- package/bundled-assets/skill/references/design-baseline.txt +1 -0
- package/bundled-assets/skill/references/prompt-compiler.md +99 -0
- package/bundled-assets/skill/references/restore-and-pptx.md +178 -0
- package/bundled-assets/skill/references/staged-pptx.md +71 -0
- package/bundled-assets/skill/scripts/_runtime_utils.py +351 -0
- package/bundled-assets/skill/scripts/asset_sheet.py +528 -0
- package/bundled-assets/skill/scripts/brand_ref.py +776 -0
- package/bundled-assets/skill/scripts/crop_asset.py +1709 -0
- package/bundled-assets/skill/scripts/deck_shell.py +2322 -0
- package/bundled-assets/skill/scripts/export_images.py +280 -0
- package/bundled-assets/skill/scripts/extract_pptx.py +360 -0
- package/bundled-assets/skill/scripts/extract_slide_dom.js +1640 -0
- package/bundled-assets/skill/scripts/html_to_pptx.py +4042 -0
- package/bundled-assets/skill/scripts/measure_slide_layout.py +952 -0
- package/bundled-assets/skill/scripts/oiloil-connect.mjs +1493 -0
- package/bundled-assets/skill/scripts/oiloil-image.mjs +492 -0
- package/bundled-assets/skill/scripts/prepare_plate.py +412 -0
- package/bundled-assets/skill/scripts/render_gradient.py +258 -0
- package/bundled-assets/skill/scripts/slide_brand.py +111 -0
- package/bundled-assets/skill/scripts/slide_incremental.py +122 -0
- package/bundled-assets/skill/scripts/slide_workflow.py +711 -0
- package/bundled-assets/skill/scripts/verify_deck.py +3483 -0
- package/bundled-assets/skill/vendor/README.md +4 -0
- package/bundled-assets/skill/vendor/codex-ppt/LICENSE +21 -0
- package/bundled-assets/skill/vendor/codex-ppt/assemble_ppt.py +435 -0
- package/bundled-assets/skill/vendor/codex-ppt/codex_ppt_runtime.py +284 -0
- package/bundled-assets/skill/vendor/codex-ppt/image_gen.py +972 -0
- package/bundled-assets/skill/vendor/codex-ppt/image_providers/__init__.py +6 -0
- package/bundled-assets/skill/vendor/codex-ppt/image_providers/atlascloud.py +222 -0
- package/bundled-assets/skill/vendor/codex-ppt/image_providers/base.py +32 -0
- package/bundled-assets/skill/vendor/codex-ppt/image_providers/factory.py +21 -0
- package/bundled-assets/skill/vendor/codex-ppt/image_providers/openai_compatible.py +238 -0
- package/bundled-assets/skill/vendor/codex-ppt/requirements.txt +5 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//345/205/232/346/224/277/347/272/242/351/243/216/346/240/274.md +98 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//345/210/233/346/204/217/346/235/202/345/277/227/351/243/216.md +72 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//345/244/215/345/217/244/346/211/201/345/271/263/346/217/222/347/224/273/351/243/216.md +72 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//346/211/213/347/273/230/346/212/200/346/234/257/350/247/243/351/207/212/351/243/216.md +86 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//346/211/213/347/273/230/347/231/275/346/235/277/351/243/216.md +72 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//346/225/231/345/255/246/350/257/276/344/273/266/351/243/216.md +107 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//346/225/260/346/215/256/344/273/252/350/241/250/347/233/230/351/243/216.md +73 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//346/270/205/347/210/275/344/270/223/344/270/232/351/243/216.md +87 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//346/270/251/346/232/226/346/211/213/345/267/245/351/243/216.md +72 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//347/224/265/345/255/220/345/242/250/346/260/264/346/235/202/345/277/227/351/243/216.md +86 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//347/247/221/347/240/224/347/255/224/350/276/251/351/243/216.md +138 -0
- package/bundled-assets/skill/vendor/codex-ppt/styles//351/272/246/350/202/257/351/224/241/351/243/216/346/240/274.md +119 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/LICENSE +21 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/SKILL.md +171 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/agents/openai.yaml +4 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/__init__.py +1 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/cli.py +25 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/__init__.py +1 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/_input_normalization.py +355 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/_page_artifacts.py +132 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/build_pptx_from_manifest.py +1029 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/configure_image_backend.py +52 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/deck_run_state.py +214 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/deck_text_hints.py +179 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/finalize_deck_run.py +96 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/formula_renderer.py +254 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/image_gen.py +206 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/main.py +795 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/make_page_contact_sheet.py +28 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/native_tables.py +140 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/paddle_text_hints.py +212 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/page_job_status.py +54 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/page_text_metrics.py +334 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/path_geometry.py +174 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/prepare_deck_run.py +209 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/process_asset_sheet.py +104 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/record_imagegen_result.py +118 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/record_page_dispatch.py +83 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/record_page_result.py +130 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/remove_chroma_key.py +441 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/reset_page_job.py +74 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/runtime_env.py +283 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/split_alpha_components.py +323 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/text_hints.py +309 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/editppt/runtime/validate_pptx.py +873 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/cli/pyproject.toml +29 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/prompts/page-worker.md +47 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/references/cli-helper.md +282 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/references/manifest-schema.md +423 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/references/page-decision-tree.md +301 -0
- package/bundled-assets/skill/vendor/image-to-editable-ppt/scripts/build-page-worker-prompt.py +134 -0
- package/cordis.patch.yml +3 -0
- package/lib/client.js +11282 -0
- package/lib/index.js +2638 -0
- package/package.json +140 -4
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# Page Decision Tree
|
|
2
|
+
|
|
3
|
+
This file is the single source of truth for page object decisions. Field contracts live in `manifest-schema.md`; command syntax lives in `cli-helper.md`.
|
|
4
|
+
|
|
5
|
+
Every `source.png` is judged in three steps, in this order:
|
|
6
|
+
|
|
7
|
+
1. Background recognition and repair.
|
|
8
|
+
2. Foreground asset separation.
|
|
9
|
+
3. PPT native element reconstruction.
|
|
10
|
+
|
|
11
|
+
The order exists because steps 1-2 decide object sources and step 3 consumes those decisions. Nativizing text and layout first locks in wrong choices: text that belongs to a logo, a UI screenshot, or a to-be-separated asset must not become a native text box, and which text needs clean-base removal depends on the background decision. Define the boundaries between background, foreground, and native structure first; then write the manifest. Submit image jobs serially through `page_request.json.image_backend`; its field contract lives in `manifest-schema.md`, and fallback CLI syntax lives in `cli-helper.md`. Do not parallelize page-local image jobs through a batch interface because concurrent asset-sheet calls make rate limits, retries, and reconciliation failures harder to diagnose.
|
|
12
|
+
|
|
13
|
+
Contents:
|
|
14
|
+
|
|
15
|
+
- Common failure mode: false progress
|
|
16
|
+
- Pre-decision: page inventory
|
|
17
|
+
- 1. Background recognition and repair
|
|
18
|
+
- 2. Foreground asset separation
|
|
19
|
+
- 3. PPT native element reconstruction
|
|
20
|
+
- Final self-check
|
|
21
|
+
- Fix versus warning
|
|
22
|
+
|
|
23
|
+
## Common Failure Mode: False Progress
|
|
24
|
+
|
|
25
|
+
First establish that the foreground workflow in section 2.1 is feasible; if it is blocked, report that failure before building a replacement page. Passing structural validation never waives the object-source rules.
|
|
26
|
+
|
|
27
|
+
## Pre-Decision: Page Inventory
|
|
28
|
+
|
|
29
|
+
Build a complete inventory before deciding anything, so that no object's source is chosen ad hoc later:
|
|
30
|
+
|
|
31
|
+
- Page size and page type.
|
|
32
|
+
- All readable text, with source glyph height, container height, line spacing, and density for each text level.
|
|
33
|
+
- Background type — solid color, gradient, regular texture, photo, illustration, dashboard, spatial/product image, complex graphic background — and whether it is occluded by text, icons, labels, stickers, hand-drawn marks, or other foreground objects that will be rebuilt later.
|
|
34
|
+
- Foreground visual objects: icons, pictograms, logo-like marks, foreground photos, screenshots, image blocks, textures, illustrations, people, plants, devices, hand-drawn marks, stickers, decorative lines, badges.
|
|
35
|
+
- PPT native element candidates: text, text boxes, cards, panels, tables, axes, lines, flow boxes, dividers, simple arrows.
|
|
36
|
+
- Formula candidates: objective functions, constraints, matrices, fractions, roots, cases, multiline equation groups, ordinary math expressions. List formulas separately; never group them with ordinary text.
|
|
37
|
+
- Corner geometry for every rectangle/card/table outline: straight, slight radius, obvious radius, pill.
|
|
38
|
+
|
|
39
|
+
Record visual objects in `visual_inventory`, readable text in `text_inventory`, and decisions in `background_strategy`; record completed checks in `quality_checks`. Field contracts live in `manifest-schema.md`.
|
|
40
|
+
|
|
41
|
+
## 1. Background Recognition and Repair
|
|
42
|
+
|
|
43
|
+
Step 1 decides only the background; do not process foreground assets or text yet. Record the outcome in `background_strategy` (field contract in `manifest-schema.md`), including a `comparison_note` written after comparing the result against the source.
|
|
44
|
+
|
|
45
|
+
### 1.1 Backgrounds That Do Not Need Image Tools
|
|
46
|
+
|
|
47
|
+
Rebuild these directly with PPT structural objects or the deterministic runtime — calling the image backend for them wastes a generation and risks drift:
|
|
48
|
+
|
|
49
|
+
- Solid-color backgrounds.
|
|
50
|
+
- Simple gradients.
|
|
51
|
+
- Ordinary cards, panels, and container fills.
|
|
52
|
+
- Table lines, axes, gridlines, chart frames.
|
|
53
|
+
- Regular repeated textures, regular divider bands, simple shadows.
|
|
54
|
+
- Blank background regions not occluded by foreground.
|
|
55
|
+
|
|
56
|
+
Record this kind of background as `background_strategy.mode: native-or-script` or an equivalent mode.
|
|
57
|
+
|
|
58
|
+
### 1.2 Reusable Background Regions
|
|
59
|
+
|
|
60
|
+
An existing background region may be reused as-is only when all of these hold:
|
|
61
|
+
|
|
62
|
+
- It contains no text, labels, icons, stickers, hand-drawn marks, or other foreground objects that need removal.
|
|
63
|
+
- Reusing it will not create a duplicate "one copy in the background, another copy as editable objects" problem.
|
|
64
|
+
- It is not a full-page `source.png` with native text overlaid.
|
|
65
|
+
- It is a background/illustration area within the page — not a whole card, whole table, or whole chart screenshot used to bypass editability.
|
|
66
|
+
|
|
67
|
+
### 1.3 Backgrounds That Need Image Tool Repair
|
|
68
|
+
|
|
69
|
+
Use the image-edit path selected by `page_request.json.image_backend` for background repair or clean bases when:
|
|
70
|
+
|
|
71
|
+
- Complex photos, spaces, real product images, complex dashboards, or complex illustrated backgrounds are occluded by foreground text or icons.
|
|
72
|
+
- Occluded areas need completion after removing text, labels, icons, stickers, or hand-drawn marks.
|
|
73
|
+
- Background and foreground are stuck together and native shapes cannot preserve source identity.
|
|
74
|
+
|
|
75
|
+
The clean base target is the same background with the to-be-rebuilt foreground removed — not a new image with a similar theme. The edit prompt must treat the source as both the edit target and strict visual reference, and must state:
|
|
76
|
+
|
|
77
|
+
- Preserve: original aspect ratio, composition, perspective, object positions, colors, lighting, materials, textures, depth of field, and background identity.
|
|
78
|
+
- Remove: readable text, labels, numbers, icons, stickers, badges, hand-drawn marks, and decorative objects that will be rebuilt later.
|
|
79
|
+
- Forbid: new rooms, new dashboards, new products, new camera angles, new object positions, different lighting, pseudo-text, watermarks, blurry patches, or smear artifacts.
|
|
80
|
+
|
|
81
|
+
If the occlusion is small, prefer local completion or a small patch rather than letting the image backend reimagine the whole background.
|
|
82
|
+
|
|
83
|
+
### 1.4 Dashboard Is Not Background by Default
|
|
84
|
+
|
|
85
|
+
A dashboard is not background, and it is not a single image block to screenshot wholesale. Dashboard titles, numbers, tables, axes, legends, ordinary chart elements, metric cards, filters, and labels are decomposed in step 3 into native text and structural objects.
|
|
86
|
+
|
|
87
|
+
Only these areas may be handled as background or image regions:
|
|
88
|
+
|
|
89
|
+
- Maps and heatmaps.
|
|
90
|
+
- Complex screenshot base images.
|
|
91
|
+
- Complex chart image regions whose data cannot be reliably restored.
|
|
92
|
+
- Complex textures or base imagery that function as visual background and will not be duplicated by later native objects.
|
|
93
|
+
|
|
94
|
+
Never screenshot a whole dashboard, whole table, whole card, or whole chart to skip editable structure.
|
|
95
|
+
|
|
96
|
+
## 2. Foreground Asset Separation
|
|
97
|
+
|
|
98
|
+
Step 2 decides only the source of non-text foreground visual objects. Every foreground object enters `visual_inventory` before its source is chosen.
|
|
99
|
+
|
|
100
|
+
### 2.1 Foreground Assets Must Use Image Edit Separation
|
|
101
|
+
|
|
102
|
+
Every non-text foreground visual object must be separated through the image-edit asset-sheet workflow selected by `page_request.json.image_backend`, including:
|
|
103
|
+
|
|
104
|
+
- Foreground photos, foreground screenshots, video covers, foreground image blocks, map fragments, chart-image fragments, and rectangular illustrations.
|
|
105
|
+
- Icons, pictograms, symbols, logo-like marks.
|
|
106
|
+
- Badges, stickers, tapes, stamps, corner tags.
|
|
107
|
+
- Hand-drawn marks, hand-drawn arrows, decorative underlines, circles, checkmarks, crosses.
|
|
108
|
+
- Complex arrows, icon-like nodes, objects with texture or shadow.
|
|
109
|
+
- Semantic small icons, trend icons, warning symbols, and status symbols in dashboards or charts.
|
|
110
|
+
- Leaves, plants, people, animals, computers, phones, devices, scene illustrations, and any other non-text object that carries page style.
|
|
111
|
+
|
|
112
|
+
Do not approximate these with native primitives, even when one appears to be made of circles, lines, rectangles, or ellipses — the criterion is not "can it be drawn" but whether it is a foreground visual asset rather than a layout primitive. Do not substitute direct source-image snippets for source-faithful separation. Do not hand-draw or assemble foreground visual objects with local Python/Pillow/SVG/HTML/CSS code; deterministic tools are only for normalization, recording, background removal, splitting, formula rendering, building, validation, and QA.
|
|
113
|
+
|
|
114
|
+
There is no fallback path. If asset-sheet separation cannot produce a compliant asset, the page is blocked until the asset workflow is fixed or the user explicitly changes the requirements for that exact object. Do not downgrade the missing separation to a warning; do not record, finalize, or deliver the fallback.
|
|
115
|
+
|
|
116
|
+
### 2.2 Asset Sheet Prompt Principles
|
|
117
|
+
|
|
118
|
+
An asset sheet is source-faithful separation, not redraw. The generation prompt must require:
|
|
119
|
+
|
|
120
|
+
- Separate existing objects from the source.
|
|
121
|
+
- Preserve original shapes, strokes, colors, proportions, internal spacing, texture, and visual identity.
|
|
122
|
+
- Use a flat chroma-key background; choose the key color based on the subject colors in `visual_inventory`. This keeps generation compatible with image backends that do not support transparent output; do not require transparent generation first. Keep extraction prompts source-faithful and do not add shadows or effects.
|
|
123
|
+
- Put as many icons and foreground visual objects as practical onto one sparse asset sheet. Create multiple asset sheets only when a single sheet cannot fit all required objects with clear separation.
|
|
124
|
+
- Every object complete, not touching or overlapping other objects, with generous empty space between neighboring objects and sufficient outer padding so `process-sheet` can split each icon/object cleanly.
|
|
125
|
+
- Object count and order match `visual_inventory`.
|
|
126
|
+
- Remove ordinary editable text and labels; preserve identity text classified under section 3.1 (such as logo wordmarks). Do not add pseudo-text or watermarks.
|
|
127
|
+
- No whole cards, whole panels, whole charts, or full-page fragments.
|
|
128
|
+
- No redrawing, beautifying, simplifying, synonym-symbol replacement, or "cleaner" substitute icons.
|
|
129
|
+
|
|
130
|
+
Key color: any high-saturation pure color (cyan, green, magenta, red, orange, ...) that does not appear in the assets and is far from all subject, stroke, shadow, and highlight colors — green subjects must not use `#00ff00`, blue/purple subjects must not use cyan/blue families, purple/magenta subjects must not use `#ff00ff`, white subjects must not use white or light gray. Apply "Fix versus Warning" before making another attempt. Accept harmless small fringes or residue; for actual defects, inspect whether splitting boundaries or removal parameters caused them and repair that local stage first. Regenerate with a different key color only when subject/background colors collide or the generated sheet itself lacks usable source detail.
|
|
131
|
+
|
|
132
|
+
For sparse sheets, assign one complete object to each region after inspecting the actual generated sheet. Keep disconnected dots, strokes, and soft edges inside the same region; do not infer object identity from connected components. Use the region contract in `manifest-schema.md`, "Asset sheet regions and split reports". Regions must preserve complete objects with transparent margins; inspect boundaries rather than blindly dividing the requested grid. The split-report contract defines the narrow exception for faint isolated residue; review its warnings during reconciliation. When processing an already-transparent supplied sheet, preserve its Alpha without re-keying; this is input compatibility, not a transparent-generation step. Legacy connected-component splitting remains available when regions are not supplied, but its output still requires the reconciliation below.
|
|
133
|
+
|
|
134
|
+
### 2.3 Asset Sheet Reconciliation
|
|
135
|
+
|
|
136
|
+
After a sheet is generated and split, reconcile it against `visual_inventory`:
|
|
137
|
+
|
|
138
|
+
- Split asset count covers all required objects, and every asset name corresponds to the inventory.
|
|
139
|
+
- Missing objects, wrong symbols, missing strokes, severe deformation, background attachment, text contamination, or synonymous substitution must be regenerated or fixed before use.
|
|
140
|
+
|
|
141
|
+
What may ship as a recorded warning after compliant separation is defined in "Fix versus Warning" at the end of this file.
|
|
142
|
+
|
|
143
|
+
## 3. PPT Native Element Reconstruction
|
|
144
|
+
|
|
145
|
+
Step 3 rebuilds everything carried by native PowerPoint structure, plus formula assets. Enter it only after the step-1/2 decisions are recorded.
|
|
146
|
+
|
|
147
|
+
### 3.1 Text and Text Boxes
|
|
148
|
+
|
|
149
|
+
All readable text defaults to native PPT text boxes or native table cells (see 3.3). Never use generated images to carry editable text, and never use hidden text, transparent text, 1 pt text, or off-canvas text to satisfy the text inventory. (Formulas are not ordinary text — see 3.2.)
|
|
150
|
+
|
|
151
|
+
Exceptions — text that is part of brand or background identity rather than editable content:
|
|
152
|
+
|
|
153
|
+
- Logo wordmarks, brand symbols, and trademark text.
|
|
154
|
+
- Brand text on product packaging.
|
|
155
|
+
- Place names on map base imagery.
|
|
156
|
+
- Small text inside UI screenshots that is not required to be editable.
|
|
157
|
+
- Signage in photo backgrounds.
|
|
158
|
+
- Textures such as newspapers, book pages, or code.
|
|
159
|
+
- Tiny text with very low OCR confidence that does not affect main meaning.
|
|
160
|
+
|
|
161
|
+
Explain each exception in `visual_inventory` or `asset_provenance`. Never disguise main titles, subtitles, body text, table text, legends, axis labels, numbers, tags, or button text as exceptions.
|
|
162
|
+
|
|
163
|
+
Use reliable measured font sizes and positions first; inspect the source to correct missing or implausible measurements rather than treating detection as ground truth. Every page dir contains `text_hints.json` (each detected line's source-pixel `box_px`, glyph height, and derived font sizes; the `backend` field records which detector produced them) and `text_hints.png`, the source image with every detected line framed and labeled. If missing, regenerate with `editppt page hints <page_dir>`. Use the hints like this:
|
|
164
|
+
|
|
165
|
+
- Match each detected line in the overlay image to the text you read in the source.
|
|
166
|
+
- Copy the measured `box_px` and the matching font size column (`font_pt_if_cjk` for CJK text, `font_pt_if_latin` for Latin) into the corresponding `text_boxes` item.
|
|
167
|
+
- Add `"font_size_source": "measured"` to every box sized this way — the deterministic builder then trusts the measured size instead of applying its conservative shrink, which otherwise makes text systematically smaller than the source.
|
|
168
|
+
- Hints are advisory and incomplete by design. Fill lines the detector missed and correct lines it merged with a graphic or labeled implausibly (a box sitting on an icon or photo) from your own reading of the source — a missed hint never means the text can be dropped.
|
|
169
|
+
- Same-level text uses exactly one font size: lines sharing a `size_group` get the same size, hand-added text joins the size group of its level, and the final page keeps same-level text identical even where individual measurements disagree slightly.
|
|
170
|
+
- Keep deterministic runtime fitting (`fit_text`) enabled as the overflow guard; tuning fields and when to disable it are in `manifest-schema.md`.
|
|
171
|
+
- After building a preview, compare text by level against the source; do not enlarge titles, body text, or labels by default. If any level looks larger, heavier, more crowded, or wraps more than the source, fix the font size or box before continuing.
|
|
172
|
+
|
|
173
|
+
Record completed calibration with `quality_checks.font_size_calibrated=true`.
|
|
174
|
+
|
|
175
|
+
### 3.2 Formula Handling
|
|
176
|
+
|
|
177
|
+
Transcribe each formula from the source into LaTeX, then render it with `editppt formula render-latex` into an image asset written inside the page directory (prefer SVG; use PNG when SVG preview/PowerPoint compatibility is unstable):
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
editppt formula render-latex <page_dir> \
|
|
181
|
+
--tex "\\sum_{i \\in N} p_{ij} x_{ij} \\ge a_j u_j" \
|
|
182
|
+
--out assets/formula_c2_1.svg \
|
|
183
|
+
--box 105,392,390,90 \
|
|
184
|
+
--id formula_c2_1 \
|
|
185
|
+
--fragment assets/formula_c2_1.fragment.json
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Merge the fragment's `images`, `asset_provenance`, and `formula_inventory` into `manifest.json`; the required provenance fields are in `manifest-schema.md`. Never assemble formulas from Unicode subscripts/superscripts or many hand-written text boxes, and never use source-image formula snippets.
|
|
189
|
+
|
|
190
|
+
If the machine lacks a TeX engine or converter, or compilation fails: still deliver the current openable PPT with `validation.json` keeping top-level `passed: true` and the failure recorded as a warning — formula id, LaTeX source, CLI error, and required tool/package repair. Do not replace the formula with a full-page screenshot.
|
|
191
|
+
|
|
192
|
+
### 3.3 Structural Primitives and Layout Objects
|
|
193
|
+
|
|
194
|
+
These may use native PPT shapes or structural objects:
|
|
195
|
+
|
|
196
|
+
- Straight lines, dashed lines, polylines, and structural curves.
|
|
197
|
+
- Rectangles, rounded rectangles, circles, ellipses.
|
|
198
|
+
- Ordinary arrows and connectors.
|
|
199
|
+
- Solid-color cards, panels, dividers, borders.
|
|
200
|
+
- Table lines, axes, gridlines; native tables follow the rule below.
|
|
201
|
+
- Simple bar charts, progress bars, status color blocks.
|
|
202
|
+
- Simple callouts.
|
|
203
|
+
- Basic flow boxes and containers without style-specific details.
|
|
204
|
+
|
|
205
|
+
Regular row-and-column tables with readable content and clear cell boundaries must use one native PowerPoint table per logical table, not a collection of text boxes and rectangle/line fragments. This preserves cell editing and row/column operations. Record source-supported row/column proportions, rectangular merges, text, fills, borders, and alignment; the field contract lives in `manifest-schema.md`, "Native tables." Table cell text remains in `text_inventory` and must not also be emitted as overlaid text boxes.
|
|
206
|
+
|
|
207
|
+
Diagonal headers and images embedded inside cells are not supported by the table builder. If cell text, row/column structure, or merge boundaries are unclear, inspect the source at higher resolution and available hints first. If essential evidence is still missing, record the specific source limitation as a page failure; do not invent values or merge relationships. Do not silently replace the table with a screenshot to bypass native editability.
|
|
208
|
+
|
|
209
|
+
Native shapes carry only layout structure, never semantic icons or visual identity: a DNA mark, lock, network node, target, magnifier, or checkmark inside a circular icon is not a structural primitive — separate it in step 2.
|
|
210
|
+
|
|
211
|
+
A continuous structural line or curve must be one native line or path object, so it can be selected, restyled, and reshaped as a whole. Use native dash styling for dotted/dashed strokes and endpoint properties for arrowheads; do not build individual dashes, sampled short-line objects, or separate arrowhead triangles. A genuine polyline may have straight segments within one path; a smooth curve uses Bézier segments with only the control points needed to preserve its shape. Dense sampling merely moves the editing burden into hundreds of nodes. Grouping fragments does not repair their object granularity. Path and stroke field contracts are in `manifest-schema.md`, "Native paths and stroke styles."
|
|
212
|
+
|
|
213
|
+
A native curve provides shape editing, not a data-linked chart. If changing underlying values must update the plot, that requires a native chart with its data; do not claim that a path provides this capability or invent precise values from an ambiguous image.
|
|
214
|
+
|
|
215
|
+
### 3.4 Corner Geometry
|
|
216
|
+
|
|
217
|
+
Corner decisions are conservative because over-rounding is a common, visible failure:
|
|
218
|
+
|
|
219
|
+
- Classify the source corner first: `straight`, `small-radius`, `large-radius`, or `pill`.
|
|
220
|
+
- Use `rect` for `straight`; use `roundRect` for the rest and estimate `source_corner_radius_px`.
|
|
221
|
+
- Corner radius is an object-level property, not a boolean: an 8-12 px slight radius on a large panel must not become a 70 px pill.
|
|
222
|
+
- If uncertain, zoom into the source corner; if still uncertain, record the basis and prefer the smaller radius.
|
|
223
|
+
- Every `roundRect` records `source_corner_radius_px`; `corner_reason` is supplemental and never replaces the radius.
|
|
224
|
+
- Never round ordinary rectangles out of design preference.
|
|
225
|
+
|
|
226
|
+
### 3.5 Text Strokes and Decoration Splitting
|
|
227
|
+
|
|
228
|
+
A readable character stroke belongs only to its native text box or table cell — never draw the same stroke again as a shape. Independent decorative lines, dividers, and button underlines may be shapes, but only after confirming they are not part of text. If the preview shows an extra dash, dot, or repeated symbol, inspect the source to decide whether it is a text stroke or an independent decoration, then remove the duplicate.
|
|
229
|
+
|
|
230
|
+
### 3.6 Grouping and Layering
|
|
231
|
+
|
|
232
|
+
Preserve grouping relationships (icon + circular base, badge + number, speech bubble + text, hand-drawn arrow + annotation, card background + title + chart + labels).
|
|
233
|
+
|
|
234
|
+
For native text centered inside a badge or circular base, reuse the base shape's exact `box_px` for the text box and use the centered horizontal and vertical alignment defined in `manifest-schema.md` under "Text alignment." A separate tight ink box drifts as font metrics change and is not a stable grouping relationship.
|
|
235
|
+
|
|
236
|
+
Recommended z-index:
|
|
237
|
+
|
|
238
|
+
- clean background/base: 0
|
|
239
|
+
- native structural shapes: 10-20
|
|
240
|
+
- separated foreground assets: 30
|
|
241
|
+
- native editable text: 40+
|
|
242
|
+
- circles, stickers, or hand-drawn marks that must sit above text: 50+
|
|
243
|
+
|
|
244
|
+
The background must not cover text, foreground assets must sit on the right layer, and the same text, icon, or decoration must never appear both in an image layer and as a native object.
|
|
245
|
+
|
|
246
|
+
## Final Self-Check
|
|
247
|
+
|
|
248
|
+
Whoever rebuilds the page checks it once against this list; after a repair, recheck the affected objects and their layout dependencies. Do not rerun unchanged visual checks. Deterministic validation is necessary but not sufficient, and the parent agent does not repeat this check. Record the evidence in structured manifest fields and `validation.json`. (Deck-level structural QA at finalize time is in `SKILL.md` Phase 4.)
|
|
249
|
+
|
|
250
|
+
Structure and artifacts:
|
|
251
|
+
|
|
252
|
+
- `page.pptx` builds from `manifest.json` and opens; `preview.png` exists; `split_assets_contact.png` exists and shows an origin-versus-preview comparison.
|
|
253
|
+
- Every final raster asset has provenance.
|
|
254
|
+
|
|
255
|
+
Background:
|
|
256
|
+
|
|
257
|
+
- The clean base contains none of the text or foreground objects designated for rebuilding in sections 1 and 3.1.
|
|
258
|
+
- Repaired regions show no ghosts, blur blocks, smear patches, or pseudo-text.
|
|
259
|
+
- A complex-background clean base is the same background as the source — composition, perspective, object positions, colors, lighting, and key details have not drifted. A related-theme lookalike is a current-page fix even if deterministic validation passes.
|
|
260
|
+
- No image-backend call was wasted on solid or regular backgrounds.
|
|
261
|
+
|
|
262
|
+
Assets:
|
|
263
|
+
|
|
264
|
+
- `visual_inventory` covers all non-text visual objects; each has an independent representation unless explicitly recorded as background; no required object is missing or stood in by a low-quality placeholder.
|
|
265
|
+
- Object sources satisfy sections 1-3; compare separated assets with their source identities.
|
|
266
|
+
- Split assets have no fused objects, missing edges, wrong names, fragments, or cross-object shadows; check alpha edges for chroma-key remnants and apply the minor-defect tolerance in "Fix versus Warning".
|
|
267
|
+
|
|
268
|
+
Text:
|
|
269
|
+
|
|
270
|
+
- `text_inventory` covers all readable text; every editable item is a real, visible native text box or table cell (no hidden, transparent, 1 pt, or off-canvas text).
|
|
271
|
+
- Font sizes and positions are calibrated per 3.1: no clipping, wrong wrapping, or container overflow, and no level visibly larger, heavier, or more crowded than the source.
|
|
272
|
+
- CJK previews show no boxes or mojibake; use a stable CJK font when needed.
|
|
273
|
+
- No text, icon, or decoration appears both in an image layer and as a native object.
|
|
274
|
+
|
|
275
|
+
Shapes and layers:
|
|
276
|
+
|
|
277
|
+
- Structural line/curve granularity and stroke styles follow 3.3; verify the PPT object structure as well as the rendered appearance.
|
|
278
|
+
|
|
279
|
+
- Corners follow 3.4; large container corners, table borders, and card borders align with the source. Corner misclassification is a current-page fix, not a low-risk warning.
|
|
280
|
+
- No text stroke is redrawn as a decorative shape (3.5).
|
|
281
|
+
- Dashboards, tables, cards, and charts are decomposed per 1.4, never screenshotted wholesale. Check native tables against section 3.3, including cell text and merge boundaries.
|
|
282
|
+
- Badge and circular-number groups follow the shared-box centering rule in 3.6.
|
|
283
|
+
- z-index follows 3.6; no text or key object is covered.
|
|
284
|
+
|
|
285
|
+
## Fix versus Warning
|
|
286
|
+
|
|
287
|
+
Classify defects using the warning allowances below before deciding to repair. Any remaining failed self-check is a current-page fix owned by the page author. Once required outputs pass and only allowed warnings remain, return the page without further polishing. These structural conditions are also hard failures, never warnings:
|
|
288
|
+
|
|
289
|
+
- Line/curve object-granularity or stroke-style violations of 3.3, even when the rendered curve looks correct.
|
|
290
|
+
- The input cannot be normalized.
|
|
291
|
+
- The page lacks a buildable `manifest.json`/`page.pptx`, or the PPTX cannot be opened.
|
|
292
|
+
- Text font size or position visibly deviates from the source and causes crowding, overflow, or occlusion.
|
|
293
|
+
|
|
294
|
+
May ship as recorded warnings with the current PPT — but only after the required object-source workflow has succeeded:
|
|
295
|
+
|
|
296
|
+
- Minor line-width, antialiasing, proportion, shadow, or detail differences in separated assets, including small edge fringes or isolated remnants that do not affect object completeness or use.
|
|
297
|
+
- Minor visual drift in non-critical decorations.
|
|
298
|
+
- Recorded low-risk font differences.
|
|
299
|
+
- A formula whose LaTeX rendering is blocked by missing local TeX tooling, with the LaTeX source, error, and required repair recorded per 3.2.
|
|
300
|
+
|
|
301
|
+
Warnings never hide a failure to follow the three-step decision process: an object-source violation is always a current-page fix.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Build a page-worker prompt from skill-local prompt templates."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import json
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
SCRIPT_DIR = Path(__file__).resolve().parent
|
|
12
|
+
SKILL_ROOT = SCRIPT_DIR.parent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def read_json(path: Path) -> dict:
|
|
16
|
+
if not path.exists():
|
|
17
|
+
raise SystemExit(f"Missing JSON file: {path}")
|
|
18
|
+
return json.loads(path.read_text(encoding="utf-8"))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def run_dir_from_target(target: str) -> Path:
|
|
22
|
+
path = Path(target).expanduser().resolve()
|
|
23
|
+
if path.is_dir():
|
|
24
|
+
return path
|
|
25
|
+
if path.name == "deck_manifest.json":
|
|
26
|
+
return path.parent
|
|
27
|
+
raise SystemExit(f"Expected run directory or deck_manifest.json: {target}")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def load_jobs(run_dir: Path) -> dict:
|
|
31
|
+
return read_json(run_dir / "page_jobs.json")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def find_page(jobs: dict, page_ref: str) -> dict:
|
|
35
|
+
ref = str(page_ref).strip()
|
|
36
|
+
candidates = [ref]
|
|
37
|
+
if ref.isdigit():
|
|
38
|
+
candidates.append(f"page_{int(ref):03d}")
|
|
39
|
+
for page in jobs.get("pages", []):
|
|
40
|
+
if page.get("page_id") in candidates:
|
|
41
|
+
return page
|
|
42
|
+
raise SystemExit(f"Page not found in page_jobs.json: {page_ref}")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def page_dir_for(run_dir: Path, page: dict) -> Path:
|
|
46
|
+
page_dir = Path(str(page.get("page_dir") or ""))
|
|
47
|
+
return page_dir if page_dir.is_absolute() else (run_dir / page_dir).resolve()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def resolve_prompt_out(run_dir: Path, page_dir: Path, value: str) -> Path:
|
|
51
|
+
path = Path(value).expanduser()
|
|
52
|
+
if path.is_absolute():
|
|
53
|
+
out = path.resolve()
|
|
54
|
+
elif path.parts[:1] == ("pages",):
|
|
55
|
+
out = (run_dir / path).resolve()
|
|
56
|
+
else:
|
|
57
|
+
out = (page_dir / path).resolve()
|
|
58
|
+
try:
|
|
59
|
+
out.relative_to(page_dir)
|
|
60
|
+
except ValueError as exc:
|
|
61
|
+
raise SystemExit(f"Prompt file must live inside page dir: {out}") from exc
|
|
62
|
+
return out
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def page_worker_template() -> str:
|
|
66
|
+
text = (SKILL_ROOT / "prompts" / "page-worker.md").read_text(encoding="utf-8")
|
|
67
|
+
marker = "```text"
|
|
68
|
+
start = text.find(marker)
|
|
69
|
+
if start == -1:
|
|
70
|
+
return text.strip()
|
|
71
|
+
start += len(marker)
|
|
72
|
+
# Use rfind so nested code fences inside the template cannot truncate it.
|
|
73
|
+
end = text.rfind("```")
|
|
74
|
+
if end <= start:
|
|
75
|
+
return text[start:].strip()
|
|
76
|
+
return text[start:end].strip()
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def build_prompt(run_dir: Path, page: dict, page_dir: Path) -> str:
|
|
80
|
+
request = read_json(page_dir / "page_request.json")
|
|
81
|
+
page_id = page.get("page_id")
|
|
82
|
+
source_image = request.get("source_image") or str(page_dir / "source.png")
|
|
83
|
+
replacements = {
|
|
84
|
+
"{{RUN_DIR}}": str(run_dir),
|
|
85
|
+
"{{PAGE_ID}}": str(page_id),
|
|
86
|
+
"{{PAGE_DIR}}": str(page_dir),
|
|
87
|
+
"{{SOURCE_IMAGE}}": str(source_image),
|
|
88
|
+
"{{SKILL_ROOT}}": str(SKILL_ROOT),
|
|
89
|
+
}
|
|
90
|
+
prompt = page_worker_template()
|
|
91
|
+
for placeholder, value in replacements.items():
|
|
92
|
+
prompt = prompt.replace(placeholder, value)
|
|
93
|
+
missing = [p for p in replacements if p in prompt]
|
|
94
|
+
if missing:
|
|
95
|
+
raise SystemExit(f"Unfilled placeholders in worker prompt: {missing}")
|
|
96
|
+
return prompt
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def main() -> int:
|
|
100
|
+
parser = argparse.ArgumentParser(
|
|
101
|
+
description="Build a page-worker prompt from the skill-local page-worker template.",
|
|
102
|
+
)
|
|
103
|
+
parser.add_argument("run", help="Run directory or deck_manifest.json path.")
|
|
104
|
+
parser.add_argument("--page", required=True, help="Page id such as page_001, or page number such as 1.")
|
|
105
|
+
parser.add_argument(
|
|
106
|
+
"--out",
|
|
107
|
+
required=True,
|
|
108
|
+
help="Prompt file to write inside the page directory. Relative names are resolved under the page dir; pages/page_NNN/... is resolved under the run dir.",
|
|
109
|
+
)
|
|
110
|
+
parser.add_argument("--cli", default="editppt", help="CLI command name used in the returned dispatch command template.")
|
|
111
|
+
args = parser.parse_args()
|
|
112
|
+
|
|
113
|
+
run_dir = run_dir_from_target(args.run)
|
|
114
|
+
jobs = load_jobs(run_dir)
|
|
115
|
+
page = find_page(jobs, args.page)
|
|
116
|
+
page_id = page.get("page_id")
|
|
117
|
+
page_dir = page_dir_for(run_dir, page)
|
|
118
|
+
out = resolve_prompt_out(run_dir, page_dir, args.out)
|
|
119
|
+
out.parent.mkdir(parents=True, exist_ok=True)
|
|
120
|
+
out.write_text(build_prompt(run_dir, page, page_dir).strip() + "\n", encoding="utf-8")
|
|
121
|
+
|
|
122
|
+
payload = {
|
|
123
|
+
"prompt_file": str(out),
|
|
124
|
+
"page_id": page_id,
|
|
125
|
+
"page_dir": str(page_dir),
|
|
126
|
+
"run_dir": str(run_dir),
|
|
127
|
+
"dispatch_command_template": f"{args.cli} run dispatch {run_dir} --page {page_id} --agent-id <worker-id> --prompt-file {out}",
|
|
128
|
+
}
|
|
129
|
+
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
|
130
|
+
return 0
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if __name__ == "__main__":
|
|
134
|
+
raise SystemExit(main())
|
package/cordis.patch.yml
ADDED