@12ui/design 0.2.13 → 0.2.15

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.
Files changed (188) hide show
  1. package/README.md +35 -9
  2. package/dist/bounded-concurrency.d.ts +13 -0
  3. package/dist/bounded-concurrency.d.ts.map +1 -0
  4. package/dist/bounded-concurrency.js +43 -0
  5. package/dist/bounded-concurrency.js.map +1 -0
  6. package/dist/branch-client.d.ts +155 -0
  7. package/dist/branch-client.d.ts.map +1 -0
  8. package/dist/branch-client.js +179 -0
  9. package/dist/branch-client.js.map +1 -0
  10. package/dist/branch-completion.d.ts +37 -0
  11. package/dist/branch-completion.d.ts.map +1 -0
  12. package/dist/branch-completion.js +137 -0
  13. package/dist/branch-completion.js.map +1 -0
  14. package/dist/branch-dispatch-loop.d.ts +84 -0
  15. package/dist/branch-dispatch-loop.d.ts.map +1 -0
  16. package/dist/branch-dispatch-loop.js +206 -0
  17. package/dist/branch-dispatch-loop.js.map +1 -0
  18. package/dist/branch-downloads.d.ts +53 -0
  19. package/dist/branch-downloads.d.ts.map +1 -0
  20. package/dist/branch-downloads.js +114 -0
  21. package/dist/branch-downloads.js.map +1 -0
  22. package/dist/branch-execution-types.d.ts +54 -0
  23. package/dist/branch-execution-types.d.ts.map +1 -0
  24. package/dist/branch-execution-types.js +2 -0
  25. package/dist/branch-execution-types.js.map +1 -0
  26. package/dist/branch-execution.d.ts +20 -0
  27. package/dist/branch-execution.d.ts.map +1 -0
  28. package/dist/branch-execution.js +380 -0
  29. package/dist/branch-execution.js.map +1 -0
  30. package/dist/branch-identity.d.ts +71 -0
  31. package/dist/branch-identity.d.ts.map +1 -0
  32. package/dist/branch-identity.js +72 -0
  33. package/dist/branch-identity.js.map +1 -0
  34. package/dist/branch-materialize.d.ts +33 -0
  35. package/dist/branch-materialize.d.ts.map +1 -0
  36. package/dist/branch-materialize.js +64 -0
  37. package/dist/branch-materialize.js.map +1 -0
  38. package/dist/branch-page-conversion.d.ts +127 -0
  39. package/dist/branch-page-conversion.d.ts.map +1 -0
  40. package/dist/branch-page-conversion.js +382 -0
  41. package/dist/branch-page-conversion.js.map +1 -0
  42. package/dist/branch-plan.d.ts +63 -0
  43. package/dist/branch-plan.d.ts.map +1 -0
  44. package/dist/branch-plan.js +95 -0
  45. package/dist/branch-plan.js.map +1 -0
  46. package/dist/branch-progress.d.ts +99 -0
  47. package/dist/branch-progress.d.ts.map +1 -0
  48. package/dist/branch-progress.js +188 -0
  49. package/dist/branch-progress.js.map +1 -0
  50. package/dist/branch-run-record.d.ts +164 -0
  51. package/dist/branch-run-record.d.ts.map +1 -0
  52. package/dist/branch-run-record.js +94 -0
  53. package/dist/branch-run-record.js.map +1 -0
  54. package/dist/branch-schedule.d.ts +74 -0
  55. package/dist/branch-schedule.d.ts.map +1 -0
  56. package/dist/branch-schedule.js +130 -0
  57. package/dist/branch-schedule.js.map +1 -0
  58. package/dist/branch-status.d.ts +11 -0
  59. package/dist/branch-status.d.ts.map +1 -0
  60. package/dist/branch-status.js +118 -0
  61. package/dist/branch-status.js.map +1 -0
  62. package/dist/branch-viewport-normalization.d.ts +74 -0
  63. package/dist/branch-viewport-normalization.d.ts.map +1 -0
  64. package/dist/branch-viewport-normalization.js +120 -0
  65. package/dist/branch-viewport-normalization.js.map +1 -0
  66. package/dist/cli-arguments.d.ts.map +1 -1
  67. package/dist/cli-arguments.js +5 -0
  68. package/dist/cli-arguments.js.map +1 -1
  69. package/dist/cli-branch-command.d.ts +55 -0
  70. package/dist/cli-branch-command.d.ts.map +1 -0
  71. package/dist/cli-branch-command.js +475 -0
  72. package/dist/cli-branch-command.js.map +1 -0
  73. package/dist/cli-capabilities.d.ts +51 -0
  74. package/dist/cli-capabilities.d.ts.map +1 -1
  75. package/dist/cli-capabilities.js +52 -1
  76. package/dist/cli-capabilities.js.map +1 -1
  77. package/dist/cli-create-command.d.ts +21 -0
  78. package/dist/cli-create-command.d.ts.map +1 -0
  79. package/dist/cli-create-command.js +319 -0
  80. package/dist/cli-create-command.js.map +1 -0
  81. package/dist/cli-detach.d.ts +62 -0
  82. package/dist/cli-detach.d.ts.map +1 -0
  83. package/dist/cli-detach.js +123 -0
  84. package/dist/cli-detach.js.map +1 -0
  85. package/dist/cli-draft-command.d.ts +63 -0
  86. package/dist/cli-draft-command.d.ts.map +1 -0
  87. package/dist/cli-draft-command.js +220 -0
  88. package/dist/cli-draft-command.js.map +1 -0
  89. package/dist/cli-export-command.d.ts.map +1 -1
  90. package/dist/cli-export-command.js +2 -3
  91. package/dist/cli-export-command.js.map +1 -1
  92. package/dist/cli-image-batch-command.d.ts +21 -0
  93. package/dist/cli-image-batch-command.d.ts.map +1 -1
  94. package/dist/cli-image-batch-command.js +65 -4
  95. package/dist/cli-image-batch-command.js.map +1 -1
  96. package/dist/cli-image-batch-resume.d.ts +7 -0
  97. package/dist/cli-image-batch-resume.d.ts.map +1 -1
  98. package/dist/cli-image-batch-resume.js +19 -2
  99. package/dist/cli-image-batch-resume.js.map +1 -1
  100. package/dist/cli-package-command.d.ts +29 -0
  101. package/dist/cli-package-command.d.ts.map +1 -0
  102. package/dist/cli-package-command.js +128 -0
  103. package/dist/cli-package-command.js.map +1 -0
  104. package/dist/cli-progress.d.ts +137 -0
  105. package/dist/cli-progress.d.ts.map +1 -1
  106. package/dist/cli-progress.js +156 -0
  107. package/dist/cli-progress.js.map +1 -1
  108. package/dist/cli-select-command.d.ts +12 -0
  109. package/dist/cli-select-command.d.ts.map +1 -0
  110. package/dist/cli-select-command.js +66 -0
  111. package/dist/cli-select-command.js.map +1 -0
  112. package/dist/cli.js +150 -7
  113. package/dist/cli.js.map +1 -1
  114. package/dist/conversion-receipt.d.ts +127 -0
  115. package/dist/conversion-receipt.d.ts.map +1 -0
  116. package/dist/conversion-receipt.js +184 -0
  117. package/dist/conversion-receipt.js.map +1 -0
  118. package/dist/create-identity.d.ts +25 -0
  119. package/dist/create-identity.d.ts.map +1 -0
  120. package/dist/create-identity.js +0 -0
  121. package/dist/create-identity.js.map +1 -0
  122. package/dist/draft-identity.d.ts +30 -0
  123. package/dist/draft-identity.d.ts.map +1 -0
  124. package/dist/draft-identity.js +0 -0
  125. package/dist/draft-identity.js.map +1 -0
  126. package/dist/draft-prompts.d.ts +35 -0
  127. package/dist/draft-prompts.d.ts.map +1 -0
  128. package/dist/draft-prompts.js +51 -0
  129. package/dist/draft-prompts.js.map +1 -0
  130. package/dist/draft-run.d.ts +32 -0
  131. package/dist/draft-run.d.ts.map +1 -0
  132. package/dist/draft-run.js +152 -0
  133. package/dist/draft-run.js.map +1 -0
  134. package/dist/draft-workspace.d.ts +90 -0
  135. package/dist/draft-workspace.d.ts.map +1 -0
  136. package/dist/draft-workspace.js +64 -0
  137. package/dist/draft-workspace.js.map +1 -0
  138. package/dist/image-batch-status.d.ts +42 -0
  139. package/dist/image-batch-status.d.ts.map +1 -0
  140. package/dist/image-batch-status.js +142 -0
  141. package/dist/image-batch-status.js.map +1 -0
  142. package/dist/image-dimensions.d.ts +12 -0
  143. package/dist/image-dimensions.d.ts.map +1 -0
  144. package/dist/image-dimensions.js +14 -0
  145. package/dist/image-dimensions.js.map +1 -0
  146. package/dist/image-generation-resume.d.ts +13 -0
  147. package/dist/image-generation-resume.d.ts.map +1 -1
  148. package/dist/image-generation-resume.js +13 -0
  149. package/dist/image-generation-resume.js.map +1 -1
  150. package/dist/index.d.ts +6 -1
  151. package/dist/index.d.ts.map +1 -1
  152. package/dist/index.js +5 -1
  153. package/dist/index.js.map +1 -1
  154. package/dist/legacy-skill-catalog.d.ts.map +1 -1
  155. package/dist/legacy-skill-catalog.js +140 -0
  156. package/dist/legacy-skill-catalog.js.map +1 -1
  157. package/dist/package-client.d.ts +28 -0
  158. package/dist/package-client.d.ts.map +1 -1
  159. package/dist/package-client.js +21 -1
  160. package/dist/package-client.js.map +1 -1
  161. package/dist/package-manifest-file.d.ts +21 -0
  162. package/dist/package-manifest-file.d.ts.map +1 -0
  163. package/dist/package-manifest-file.js +119 -0
  164. package/dist/package-manifest-file.js.map +1 -0
  165. package/dist/package-manifest-template.d.ts +23 -0
  166. package/dist/package-manifest-template.d.ts.map +1 -0
  167. package/dist/package-manifest-template.js +60 -0
  168. package/dist/package-manifest-template.js.map +1 -0
  169. package/dist/package-source-refusal.d.ts +17 -0
  170. package/dist/package-source-refusal.d.ts.map +1 -0
  171. package/dist/package-source-refusal.js +61 -0
  172. package/dist/package-source-refusal.js.map +1 -0
  173. package/dist/package-submission.d.ts +134 -0
  174. package/dist/package-submission.d.ts.map +1 -0
  175. package/dist/package-submission.js +196 -0
  176. package/dist/package-submission.js.map +1 -0
  177. package/dist/selection-record.d.ts +95 -0
  178. package/dist/selection-record.d.ts.map +1 -0
  179. package/dist/selection-record.js +121 -0
  180. package/dist/selection-record.js.map +1 -0
  181. package/package.json +1 -1
  182. package/skills/design/SKILL.md +43 -266
  183. package/skills/design-branch/SKILL.md +37 -116
  184. package/skills/design-convert/SKILL.md +62 -148
  185. package/skills/design-draft/SKILL.md +71 -135
  186. package/skills/design-search/SKILL.md +29 -78
  187. package/skills/design/references/continuation-contract.md +0 -60
  188. package/skills/design/references/selection-contract.md +0 -112
@@ -1,152 +1,66 @@
1
1
  ---
2
2
  name: design-convert
3
- description: "Convert a PNG, JPEG, or WebP image into a structured LayerDoc with associated assets, then export responsive HTML, web or native app code, PDF, PSD, PPTX, Sketch, SVG, PNG, JPEG, or WebP. Use to recreate a finished design or turn a visual reference into production-ready output quickly."
3
+ description: "Required to turn a finished PNG, JPEG, or WebP design into
4
+ production output: converts it once into a structured LayerDoc, then derives
5
+ responsive HTML, web or native app code, PDF, PSD, PPTX, Sketch, SVG, PNG,
6
+ JPEG, or WebP from that one conversion."
4
7
  ---
5
8
 
6
- # Design Convert
7
-
8
- Convert one finished image once, keep its base LayerDoc conversion, and derive
9
- every required format from that structured source. Integrate code output into
10
- the target project and verify the real result.
11
-
12
- ## Prepare
13
-
14
- Inspect the source dimensions and intended CSS viewport. Inspect the target
15
- project's instructions, framework, routes, components, assets, styling,
16
- dependencies, and validation commands. Work under the system temporary
17
- directory and derive a stable idempotency key from the project, source hash,
18
- viewport, model, and workflow revision.
19
-
20
- Accepted input is a static PNG, JPEG, or WebP. Never invent output, use cached
21
- results, or repeat extraction merely to obtain another format.
22
-
23
- ## Create the base LayerDoc
24
-
25
- Conversion is slow paid work: expect about **4 minutes** for a 1440px source at
26
- `--model standard`. The command blocks for that whole time and streams stage
27
- progress to stderr. It has not hung — never kill it and never re-issue it with a
28
- different idempotency key.
29
-
30
- ```bash
31
- set -o pipefail
32
- 12ui convert <source-image> \
33
- --output layerdoc \
34
- --model standard \
35
- --width <intended-css-width> \
36
- --idempotency-key <stable-key> \
37
- --out <run-dir>/base.layerdoc.json | tee <run-dir>/base-result.json
38
- ```
39
-
40
- ### When responsive HTML is one of the required formats
41
-
42
- Ask for it in the SAME command. The export's reference generation and per-anchor
43
- conversions then run alongside the conversion instead of queueing behind it, so
44
- the pair costs about **5 minutes** in total rather than the ~8 minutes a convert
45
- followed by a separate export costs. Prices are identical either way.
46
-
47
- ```bash
48
- set -o pipefail
49
- 12ui convert <source-image> \
50
- --output layerdoc \
51
- --model standard \
52
- --width <intended-css-width> \
53
- --export html \
54
- --export-quality standard \
55
- --idempotency-key <stable-key> \
56
- --out <run-dir>/base.layerdoc.json \
57
- --export-out <run-dir>/exports/export.responsive.html | tee <run-dir>/base-result.json
58
- ```
59
-
60
- One blocking command, both artifacts on disk, no background-and-poll
61
- choreography. The result JSON carries the base conversion under `id` and the
62
- export conversion under `export.id`. If the export half fails the command exits
63
- non-zero, but the base LayerDoc is still written and its ID is still reported —
64
- retry only the export, with `12ui export <source-conversion-id> --output html`.
65
-
66
- Use `--export html` whenever responsive HTML is wanted. Use the plain form when
67
- it is not: the fused form buys a responsive export every time.
68
-
69
- ### The exported page is the deliverable
70
-
71
- The responsive HTML is the page, not a bag of parts. Adopt it by default: keep
72
- its document, structure, classes, and anchor bindings, and build the surface by
73
- adapting and composing that document — wire routing, real copy, state, and
74
- interactions into it, wrap it as a section when the target page is larger than
75
- the converted screen, and extend its visual system into anything it does not
76
- cover.
77
-
78
- Do not mine it for assets and re-author the markup around them. That discards
79
- the converted design and lands the page back on the generic defaults the
80
- conversion was bought to avoid. When something in the export is wrong, fix it in
81
- the export's own markup. Rebuild from scratch only when the export cannot carry
82
- the surface at all, and say so explicitly in the report when you do.
83
-
84
- Preserve the source conversion ID, LayerDoc, assets, manifest, and stdout. For
85
- a detached create, capture its ID and resume that same operation:
86
-
87
- ```bash
88
- 12ui convert <source-image> \
89
- --output layerdoc \
90
- --model standard \
91
- --width <intended-css-width> \
92
- --idempotency-key <stable-key> \
93
- --detach | tee <run-dir>/base-operation.json
94
-
95
- 12ui resume <conversion-id> \
96
- --output layerdoc \
97
- --out <run-dir>/base.layerdoc.json
98
- ```
99
-
100
- If create emitted an ID, resume it. If it failed before emitting one, repeat
101
- the exact request with the same idempotency key.
102
-
103
- ## Export from the base conversion
104
-
105
- Use one command with comma-separated outputs. The CLI starts independent
106
- exports in parallel without repeating image extraction. Every format except
107
- `html` is fast (seconds to about a minute); `html` is responsive HTML and takes
108
- about **4 minutes** on its own, which is why it is worth folding into the
109
- convert command above when it is needed at all.
110
-
111
- ```bash
112
- 12ui export <source-conversion-id> \
113
- --output html,html_fixed,svg,png,jpg,webp,pdf,psd,pptx,sketch \
114
- --out-dir <run-dir>/exports \
115
- --idempotency-key <stable-export-key>
116
- ```
117
-
118
- Request only needed outputs. The identifiers are `html`, `html_fixed`, `svg`,
119
- `png`, `jpg`, `webp`, `pdf`, `psd`, `pptx`, `sketch`, `web_project`, and
120
- `app_project`.
121
-
122
- Project outputs require an exact profile appropriate to the inspected target:
123
-
124
- ```bash
125
- 12ui export <source-conversion-id> \
126
- --output web_project,app_project \
127
- --web-profile '{"version":1,"framework":"react","styling":"tailwind","language":"typescript","packaging":"page"}' \
128
- --app-profile '{"version":1,"framework":"expo","styling":"native","language":"typescript","packaging":"screen"}' \
129
- --out-dir <run-dir>/projects \
130
- --idempotency-key <stable-project-export-key>
131
- ```
132
-
133
- Do not guess or change a profile after dispatch. The CLI refuses destination
134
- collisions before sending API requests; preserve existing evidence rather than
135
- deleting it to force another run.
136
-
137
- ## Integrate and verify
138
-
139
- Inspect generated files and dependencies before merging the smallest coherent
140
- set into the target. Preserve project routing, tokens, components,
141
- accessibility, dependency policy, and unrelated changes; remove duplicate
142
- generated scaffolding. The exported document goes in as the page; the
143
- integration work is adapting it to the project, not replacing it.
144
-
145
- Run focused checks in parallel when they do not contend for outputs. Launch
146
- web/native examples, exercise interactions, and compare source and responsive
147
- viewports. Open or render document/design exports and inspect structure,
148
- dimensions, assets, and visible fidelity. Preserve conversion IDs and evidence
149
- for any defect.
150
-
151
- Report the source hash, base conversion ID and assets, each export ID/profile,
152
- integrated files, launches, checks, and remaining visible differences.
9
+ # Design convert
10
+
11
+ Convert one finished image once, keep its base LayerDoc conversion, and
12
+ derive every required format from that structured source near-pixel
13
+ fidelity, faster and truer than recreating the design by hand.
14
+
15
+ ## 1. Convert
16
+
17
+ 12ui convert <source-image> --export html
18
+
19
+ Converts the image to a LayerDoc and exports responsive HTML alongside it in
20
+ one blocking command (~5 minutes, progress streamed to stderr; ~4 minutes
21
+ without `--export html`). `--model fast|standard|pro` and
22
+ `--width <intended-css-px>` steer the conversion; `--out` and `--export-out`
23
+ place the artifacts. The result JSON carries the conversion under `id` and
24
+ the export under `export.id`. If the export half fails, the LayerDoc is
25
+ still written — retry only the export with
26
+ `12ui export <id> --output html`.
27
+
28
+ ## 2. Export more formats
29
+
30
+ 12ui export <conversion-id> --output html_fixed,svg,pdf \
31
+ --out-dir <dir> --idempotency-key <stable-key>
32
+
33
+ Derives further formats from the finished conversion without repeating
34
+ extraction; independent exports run in parallel, and every format except
35
+ `html` takes seconds to about a minute. Outputs: `html`, `html_fixed`,
36
+ `svg`, `png`, `jpg`, `webp`, `pdf`, `psd`, `pptx`, `sketch`, `web_project`,
37
+ `app_project`. Reusing the same key replays a finished export instead of
38
+ buying it again. Project outputs take a profile matching the target project:
39
+
40
+ --web-profile '{"version":1,"framework":"react","styling":"tailwind","language":"typescript","packaging":"page"}'
41
+ --app-profile '{"version":1,"framework":"expo","styling":"native","language":"typescript","packaging":"screen"}'
42
+
43
+ ## 3. One page, one package
44
+
45
+ Ordered viewports of one continuous page are one package conversion, not one
46
+ convert per image separate conversions lose page order and stitching:
47
+
48
+ 12ui convert package --manifest <package.json> --out-dir <dir>
49
+
50
+ The manifest names each page and its ordered viewport images, with paths
51
+ relative to the manifest; independent routes are separate page entries:
52
+
53
+ { "version": 1, "output": "html", "pages": [
54
+ { "id": "home", "viewports": [
55
+ { "id": "a", "image": "screens/a.png" },
56
+ { "id": "b", "image": "screens/b.png" } ] } ] }
57
+
58
+ Runs ~5-8 minutes, writing `<out-dir>/<page-id>.html` per page plus
59
+ `package.result.json`. A viewport may carry `"sourceConversionId": "<id>"`
60
+ to reuse an already succeeded conversion of the same bytes for free.
61
+
62
+ ## 4. Integrate
63
+
64
+ The exported HTML is the page: keep its document, structure, and bindings,
65
+ and build the surface around it routing, real copy, state, interactions —
66
+ rather than mining it for assets and re-authoring the markup around them.
@@ -1,139 +1,75 @@
1
1
  ---
2
2
  name: design-draft
3
- description: "Draft candidate interface designs from a written brief, optionally conditioned on reference images, then poll the run and download the winning image. Use to explore several distinctive directions for a new UI, web, or mobile screen before branching or converting one."
3
+ description: "Required to draft candidate interface designs through the
4
+ hosted create API when a run needs more slots or per-slot control than
5
+ `12ui draft` exposes: claims an idempotent run from a written brief,
6
+ generates one candidate per slot, and downloads the images."
4
7
  ---
5
8
 
6
- # Design Draft
7
-
8
- Buy one small set of candidate designs, keep the run addressable, and hand the
9
- chosen candidate to branching or conversion. Every candidate is paid work: the
10
- run is identified by its idempotency key, so a retry replays evidence instead of
11
- generating again.
12
-
13
- ## Prepare
14
-
15
- Work under the system temporary directory. Set `ORIGIN` to `TWELVE_UI_ORIGIN`
16
- or `https://12ui.com`, and send a personal key in `Authorization: Bearer <key>`
17
- taken from `TWELVE_UI_API_KEY` or `~/.config/12ui/credentials.json` and scoped
18
- to `design.corpus.retrieve`. A browser session may present `x-session-token`
19
- instead.
20
-
21
- Write one `concept`: product, audience, surface, primary goal, and personality
22
- in at most 600 characters. Describe the design problem, not every section,
23
- control, or exact string.
24
-
25
- Default to four candidates in slots `a`-`d`; a run accepts 1-96 across slots
26
- `a`-`cr`. Pick one `aspect` for the whole run — `landscape` (1536x1024),
27
- `portrait` (1024x1536), or `square` (1024x1024).
28
-
29
- Give every candidate its own short `direction` (at most 120 characters), such as
30
- airy editorial, tactile retail, or cinematic, and make the directions
31
- meaningfully different. Leaving any direction blank spends one extra metered
32
- text call to derive them all.
33
-
34
- ## Claim the run
35
-
36
- `Idempotency-Key` is required and derives the run ID, so the same key always
37
- resolves the same run, quota allocation, and stored images.
38
-
39
- ```bash
40
- curl -sS -X POST "$ORIGIN/api/v1/create" \
41
- -H "Authorization: Bearer $TWELVE_UI_API_KEY" \
42
- -H 'content-type: application/json' \
43
- -H "Idempotency-Key: <stable-run-key>" \
44
- -d '{
45
- "concept": "<concise interface concept>",
46
- "aspect": "landscape",
47
- "mode": "inspiration",
48
- "candidates": [
49
- { "slot": "a", "direction": "<short direction>", "referenceId": "gen-<corpus-id>" },
50
- { "slot": "b", "direction": "<short direction>", "referenceId": "gen-<corpus-id>" }
51
- ]
52
- }' | tee <run-dir>/run.json
53
- ```
54
-
55
- Give a candidate at most one reference and never both kinds: `referenceId` is a
56
- `design-search` corpus ID, `"useReferenceImage": true` conditions on the one
57
- run-level image sent as base64 with its media type and SHA-256. Omitting both
58
- generates from the concept and direction alone.
59
-
60
- ```json
61
- "referenceImage": { "data": "<base64>", "mediaType": "image/png", "sha256": "<hex>" }
62
- ```
63
-
64
- The decoded image must be at most 6 MB, its media type must match its magic
65
- bytes, and the whole body must stay under 8 MB. `mode` defaults to
66
- `inspiration`; use `preserve-structure` only with a `referenceImage` that every
67
- candidate uses.
68
-
69
- The reply is the run envelope: `id`, `aspect`, `mode`, `source`, `expiresAt`
70
- seven days out, and one `pending` entry per slot. Replaying the same key with the
71
- same body answers `200` with that envelope. The same key with a changed body is
72
- `409 idempotency_conflict`, or `503 service_unavailable` when the candidate
73
- count changed too; either way keep the original request rather than editing a
74
- claim. Mint a new key only when the reply says to start a new run, which a
75
- poisoned claim such as `502 create_directions_failed` or
76
- `409 run_setup_incomplete` does say.
77
-
78
- ## Dispatch the candidates
79
-
80
- Each slot is one provider call and one paid image. Dispatch all slots
81
- concurrently; every request blocks until its own image settles.
82
-
83
- ```bash
84
- curl -sS -X POST "$ORIGIN/api/v1/create/<run-id>/candidates/a" \
85
- -H "Authorization: Bearer $TWELVE_UI_API_KEY" \
86
- -H 'content-length: 0'
87
- ```
88
-
89
- Send no `Idempotency-Key` on dispatch: an unkeyed repeat replays the durable
90
- result for free. A new key on a settled slot buys another image for that slot,
91
- so use it only when the user asks for a fresh attempt. `409 candidate_in_flight`
92
- means another caller already holds the slot — wait a few seconds and read the
93
- run instead of dispatching again.
94
-
95
- ## Poll and download
96
-
97
- ```bash
98
- curl -sS "$ORIGIN/api/v1/create/<run-id>" \
99
- -H "Authorization: Bearer $TWELVE_UI_API_KEY" | tee <run-dir>/status.json
100
- ```
101
-
102
- There is no run-level status or percentage: count candidate `status` values,
103
- which are `pending`, `dispatched`, `succeeded`, and `failed`. A `failed`
104
- candidate is a settled, paid outcome — `content_policy`, `provider_timeout`,
105
- `provider_error`, or `reference_unavailable` — not a transient error to retry.
106
-
107
- A succeeded candidate carries a relative `image` path. It is owner
108
- authenticated rather than signed, so download it with the same headers:
109
-
110
- ```bash
111
- curl -sS "$ORIGIN/api/v1/create/<run-id>/candidates/a/image" \
112
- -H "Authorization: Bearer $TWELVE_UI_API_KEY" \
113
- -o <run-dir>/candidates/a.png
114
- ```
115
-
116
- Runs expire seven days after the claim; `410 expired` is terminal.
117
-
118
- ## Quota
119
-
120
- An account generates 20 images per UTC day and an anonymous caller 12. Overflow
121
- spills to the prepaid wallet as one billable image per slot. An exhausted
122
- allowance without a funded wallet is `429 quota_exhausted` with `retry-after`; a
123
- funded account that cannot cover the overflow is `402 insufficient_funds` with
124
- `required_micros` and `available_micros`, and no candidate is persisted. Neither
125
- answer becomes success by resending.
126
-
127
- ## Select and hand off
128
-
129
- Inspect every downloaded candidate at original detail and choose the best
130
- direction for the brief, hierarchy, usability, personality, accessibility, and
131
- ability to extend into later screens. Treat common model palettes as neutral,
132
- and prefer a repeatable visual system over an impressive one-off hero. Record
133
- the run ID, slots, directions, references, image hashes, and rejection reasons.
134
-
135
- - Expand the winner into a multi-screen site or app with `design-branch`, which
136
- starts from `{ "createRunId": "<run-id>", "slot": "<slot>" }` and never needs
137
- the bytes.
138
- - Turn one screen into code or another format with `design-convert` on the
139
- downloaded PNG.
9
+ # Design draft
10
+
11
+ Buy one small set of candidate designs and keep every one addressable. This
12
+ is the hosted drafting API driven over HTTP not the local `12ui draft`
13
+ command, which runs a four-candidate version of the same flow in one step
14
+ so use it when the run needs more slots, per-slot references, or tighter
15
+ direction control.
16
+
17
+ Authenticate every request with `Authorization: Bearer <key>`, a personal
18
+ key from `TWELVE_UI_API_KEY` or `~/.config/12ui/credentials.json` with the
19
+ `design.corpus.retrieve` scope, against `TWELVE_UI_ORIGIN` or
20
+ `https://12ui.com`.
21
+
22
+ ## 1. Claim the run
23
+
24
+ curl -sS -X POST "$ORIGIN/api/v1/create" \
25
+ -H "Authorization: Bearer $TWELVE_UI_API_KEY" \
26
+ -H 'content-type: application/json' \
27
+ -H "Idempotency-Key: <stable-run-key>" \
28
+ -d '{
29
+ "concept": "<product, audience, surface, goal, personality>",
30
+ "aspect": "landscape",
31
+ "candidates": [
32
+ { "slot": "a", "direction": "<short direction>" },
33
+ { "slot": "b", "direction": "<short direction>",
34
+ "referenceId": "gen-<corpus-id>" }
35
+ ]
36
+ }'
37
+
38
+ You choose the concept (at most 600 characters), one aspect for the whole
39
+ run — `landscape` (1536x1024), `portrait` (1024x1536), or `square`
40
+ (1024x1024) a short direction per slot, meaningfully different across
41
+ slots, and at most one reference per candidate: `referenceId` names a corpus
42
+ reference, or `"useReferenceImage": true` conditions on the one run-level
43
+ `referenceImage` (base64 `data`, `mediaType`, `sha256`). `mode` defaults to
44
+ `inspiration`; `preserve-structure` keeps the reference image's layout. A
45
+ run holds 1-96 candidates in slots `a`-`cr`.
46
+
47
+ `Idempotency-Key` identifies the run: the same key resolves the same run and
48
+ its stored images, so a retry replays instead of buying the work twice. The
49
+ reply is the run envelope with `id` and one entry per slot.
50
+
51
+ ## 2. Dispatch the candidates
52
+
53
+ curl -sS -X POST "$ORIGIN/api/v1/create/<run-id>/candidates/a" \
54
+ -H "Authorization: Bearer $TWELVE_UI_API_KEY" \
55
+ -H 'content-length: 0'
56
+
57
+ One call per slot, all slots concurrently; each blocks until its own image
58
+ settles (up to ~2.5 minutes). Send no `Idempotency-Key` here an unkeyed
59
+ repeat replays a settled slot for free, and a new key buys a fresh image for
60
+ that slot.
61
+
62
+ ## 3. Read and download
63
+
64
+ curl -sS "$ORIGIN/api/v1/create/<run-id>" \
65
+ -H "Authorization: Bearer $TWELVE_UI_API_KEY"
66
+
67
+ curl -sS "$ORIGIN/api/v1/create/<run-id>/candidates/a/image" \
68
+ -H "Authorization: Bearer $TWELVE_UI_API_KEY" -o a.png
69
+
70
+ Candidate `status` is `pending`, `dispatched`, `succeeded`, or `failed`; a
71
+ `failed` candidate is a settled, paid outcome, not a transient error. Images
72
+ are owner-authenticated, so download them with the same header. Runs expire
73
+ seven days after the claim. A winning candidate can seed a branch run as
74
+ `12ui branch execute --winner-run <run-id> --winner-slot <slot>` without
75
+ re-uploading its bytes.
@@ -1,90 +1,41 @@
1
1
  ---
2
2
  name: design-search
3
- description: "Search the 12UI Design Corpus from a rough UI, web, or mobile concept and return a pre-explored, ranked, diverse set of reference images. Use before visual generation or implementation when the design needs high visual quality, sound UX, and more personality."
3
+ description: "Required when reference imagery is the deliverable: searches
4
+ the 12ui design corpus from a rough UI, web, or mobile concept and downloads
5
+ a ranked, diverse set of reference images with strong visual quality, sound
6
+ UX, and personality."
4
7
  ---
5
8
 
6
- # Design Search
9
+ # Design search
7
10
 
8
- Turn a rough interface concept into real local reference images. The corpus has
9
- already explored, ranked, and diversified the design space; preserve its order
10
- and returned evidence rather than inventing another ranking.
11
+ The corpus has already explored, ranked, and diversified the design space,
12
+ so retrieval returns real reference images in a considered order rather than
13
+ another model's guess. Use it when the references themselves are the
14
+ deliverable — surveying a space, gathering comparators, or conditioning work
15
+ you drive yourself. (`12ui draft` already runs this retrieval when drafting
16
+ designs.)
11
17
 
12
- ## Search
18
+ ## 1. Search
13
19
 
14
- Write a concise query covering the product, audience, primary goal, surface,
15
- and desired personality. Describe the design problem, not every section,
16
- control, exact string, or brand to imitate.
20
+ 12ui corpus inspire \
21
+ --query "<product, audience, surface, goal, personality>" \
22
+ --out-dir .12ui/<slug>/references
17
23
 
18
- Inspiration retrieval defaults to four results:
24
+ Retrieves four diverse references (`--count <n>`, up to 48), downloads the
25
+ full images into the output directory, and writes `manifest.json` — the
26
+ completion record with the ranked order, reference IDs, and hashes. Blocks
27
+ ~20-40 seconds with progress on stderr. Preserve the returned order; the
28
+ ranking is the product.
19
29
 
20
- ```bash
21
- 12ui corpus inspire \
22
- --query "<concise interface concept>" \
23
- --mode balanced \
24
- --out-dir <references-dir>
25
- ```
30
+ `--mode direct|balanced|adventurer` trades literal query adherence against
31
+ exploration; `balanced` is the default. For a redesign,
32
+ `--reference-image <existing-interface.png>` conditions the ranking on the
33
+ current interface: its bytes are embedded once for retrieval, are not
34
+ persisted, and it is not one of the returned references.
26
35
 
27
- Respect an explicit requested count:
36
+ ## 2. Resume
28
37
 
29
- ```bash
30
- 12ui corpus inspire \
31
- --query "<concise interface concept>" \
32
- --mode balanced \
33
- --count <requested-count> \
34
- --out-dir <references-dir>
35
- ```
38
+ 12ui corpus resume --out-dir <references-dir>
36
39
 
37
- `balanced` is the recommended mode and the default. Honor an explicit user
38
- choice of `direct` or `adventurer`; otherwise run Balanced once and inspect the
39
- complete set before changing modes. Use `--mode direct` only when Balanced is
40
- semantically diffuse or misses the literal requested surface. Use
41
- `--mode adventurer` only when Balanced is on-brief but too conventional or
42
- repetitive. Use at most one fallback in a new output directory, and record the
43
- visible failure that justified it. Do not run all three modes for comparison.
44
-
45
- Prefer direct `--query`; use `--query-file` only when quoting genuinely
46
- requires it. Add `--origin` only when the task deliberately targets another
47
- deployment.
48
-
49
- For a redesign, distinguish the user's existing interface from corpus
50
- inspiration. Send that redesign source into retrieval so visual structure can
51
- condition the ranked space alongside the text:
52
-
53
- ```bash
54
- 12ui corpus inspire \
55
- --query "<what to preserve, what to change, desired direction>" \
56
- --mode balanced \
57
- --reference-image <existing-interface.png> \
58
- --count 4 \
59
- --out-dir <references-dir>
60
- ```
61
-
62
- The command accepts one PNG, JPEG, or WebP source, records its absolute path,
63
- SHA-256, media type, and size locally, and uploads its bytes privately for one
64
- image-and-text embedding. The source is not one of the returned references and
65
- its bytes are not persisted by 12UI. If the same source path changes before a
66
- resume, stop rather than silently searching with different evidence.
67
-
68
- The command reserves the output directory, records request/response evidence,
69
- downloads full images in parallel, and writes `manifest.json`. Validate the
70
- locked mode, count, unique IDs, decodable files, and hashes. Return the exact
71
- endpoint order and recorded reference evidence. Do not recalculate or reorder
72
- the result.
73
-
74
- ## Resume
75
-
76
- For an interrupted or ambiguous attempt, keep its directory and run:
77
-
78
- ```bash
79
- 12ui corpus resume --out-dir <references-dir>
80
- ```
81
-
82
- Reuse a valid completed manifest. Never delete evidence, start a replacement
83
- request for the unchanged query, or fill missing slots with cached or invented
84
- references. A transport error, ambiguous request, underfilled set, or download
85
- failure is not a reason to change modes. If resume remains ambiguous or
86
- underfilled, report the stable key and evidence path and stop.
87
-
88
- Hand off the manifest path, idempotency key, set ID, locked mode, ordered IDs,
89
- image paths, hashes, redesign-source evidence when present, and usage notice. A
90
- `design` run requires exactly four valid references before generation.
40
+ Continues an interrupted search in the same directory, reusing everything
41
+ already settled instead of repeating the retrieval.
@@ -1,60 +0,0 @@
1
- # Continuation evidence contract
2
-
3
- Write `continuations.json` when the selected first viewport does not cover the
4
- complete interface. The winner remains the sole reference for every generation.
5
-
6
- ```json
7
- {
8
- "version": 1,
9
- "createdAt": "<ISO-8601>",
10
- "selectionPath": "<absolute selection.json path>",
11
- "winner": {
12
- "id": "A",
13
- "path": "<absolute winner PNG path>",
14
- "sha256": "<winner sha256>"
15
- },
16
- "baseConversion": {
17
- "idempotencyKey": "<stable key>",
18
- "conversionId": "<base LayerDoc conversion id>",
19
- "resultEvidencePath": "<absolute result evidence path>"
20
- },
21
- "generation": {
22
- "referenceMode": "inspiration",
23
- "manifestPath": "<absolute batch manifest path>",
24
- "manifestSha256": "<sha256>",
25
- "batchAttemptPath": "<absolute batch attempt path>"
26
- },
27
- "continuations": [
28
- {
29
- "id": "viewport-2",
30
- "kind": "<continuous-page|web-route|app-state|mobile-screen>",
31
- "order": 2,
32
- "prompt": "<semantic content, actions, state, and route purpose only>",
33
- "promptSha256": "<sha256>",
34
- "referencePath": "<same winner path>",
35
- "referenceSha256": "<same winner sha256>",
36
- "outputPath": "<absolute generated PNG path>",
37
- "outputSha256": "<sha256>",
38
- "attemptEvidencePath": "<absolute attempt path>",
39
- "accepted": true,
40
- "rejectionReason": null,
41
- "conversionId": "<accepted image conversion id or null>",
42
- "conversionEvidencePath": "<absolute evidence path or null>"
43
- }
44
- ],
45
- "integration": {
46
- "mode": "<ordered-package|independent-surfaces>",
47
- "packageEvidencePath": "<absolute package evidence path or null>"
48
- }
49
- }
50
- ```
51
-
52
- Include 2-16 continuation entries. Every entry must repeat the winner path and
53
- hash; never substitute a corpus image, composite, prior continuation, or
54
- predecessor. The default continuation batch uses `inspiration`, because the
55
- winner supplies a visual system rather than a first-viewport composition to
56
- clone. If an intentional app-state edit must preserve exact structure, record
57
- it in a separate `preserve-structure` batch. Preserve rejected generations
58
- with a visible reason and null conversion fields. For `ordered-package`,
59
- record the package evidence and keep continuous-page order exact. Never store
60
- credentials or invent IDs or hashes.