@12ui/design 0.2.91 → 0.2.93

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 (230) hide show
  1. package/SKILL.md +1 -1
  2. package/codex-plugin/plugin.json +14 -14
  3. package/dist/branch-client.d.ts +16 -0
  4. package/dist/branch-client.d.ts.map +1 -1
  5. package/dist/branch-client.js +1 -0
  6. package/dist/branch-client.js.map +1 -1
  7. package/dist/branch-completion.d.ts +2 -0
  8. package/dist/branch-completion.d.ts.map +1 -1
  9. package/dist/branch-completion.js +1 -1
  10. package/dist/branch-completion.js.map +1 -1
  11. package/dist/branch-core/branch-canvas.d.ts +41 -0
  12. package/dist/branch-core/branch-canvas.d.ts.map +1 -0
  13. package/dist/branch-core/branch-canvas.js +87 -0
  14. package/dist/branch-core/branch-canvas.js.map +1 -0
  15. package/dist/branch-core/branch-gates.d.ts +62 -0
  16. package/dist/branch-core/branch-gates.d.ts.map +1 -0
  17. package/dist/branch-core/branch-gates.js +56 -0
  18. package/dist/branch-core/branch-gates.js.map +1 -0
  19. package/dist/branch-core/branch-plan-model.d.ts +115 -0
  20. package/dist/branch-core/branch-plan-model.d.ts.map +1 -0
  21. package/dist/branch-core/branch-plan-model.js +75 -0
  22. package/dist/branch-core/branch-plan-model.js.map +1 -0
  23. package/dist/branch-core/branch-planner.d.ts +92 -0
  24. package/dist/branch-core/branch-planner.d.ts.map +1 -0
  25. package/dist/branch-core/branch-planner.js +483 -0
  26. package/dist/branch-core/branch-planner.js.map +1 -0
  27. package/dist/branch-core/branch-prompt.d.ts +40 -0
  28. package/dist/branch-core/branch-prompt.d.ts.map +1 -0
  29. package/dist/branch-core/branch-prompt.js +180 -0
  30. package/dist/branch-core/branch-prompt.js.map +1 -0
  31. package/dist/branch-core/branch-scope.d.ts +73 -0
  32. package/dist/branch-core/branch-scope.d.ts.map +1 -0
  33. package/dist/branch-core/branch-scope.js +88 -0
  34. package/dist/branch-core/branch-scope.js.map +1 -0
  35. package/dist/branch-core/index.d.ts +18 -0
  36. package/dist/branch-core/index.d.ts.map +1 -0
  37. package/dist/branch-core/index.js +20 -0
  38. package/dist/branch-core/index.js.map +1 -0
  39. package/dist/branch-dispatch-loop.d.ts +2 -2
  40. package/dist/branch-dispatch-loop.d.ts.map +1 -1
  41. package/dist/branch-dispatch-loop.js +4 -0
  42. package/dist/branch-dispatch-loop.js.map +1 -1
  43. package/dist/branch-downloads.d.ts +2 -2
  44. package/dist/branch-downloads.d.ts.map +1 -1
  45. package/dist/branch-engine.d.ts +61 -0
  46. package/dist/branch-engine.d.ts.map +1 -0
  47. package/dist/branch-engine.js +94 -0
  48. package/dist/branch-engine.js.map +1 -0
  49. package/dist/branch-execution-types.d.ts +5 -0
  50. package/dist/branch-execution-types.d.ts.map +1 -1
  51. package/dist/branch-execution.d.ts +16 -3
  52. package/dist/branch-execution.d.ts.map +1 -1
  53. package/dist/branch-execution.js +83 -17
  54. package/dist/branch-execution.js.map +1 -1
  55. package/dist/branch-identity.d.ts +22 -1
  56. package/dist/branch-identity.d.ts.map +1 -1
  57. package/dist/branch-identity.js +23 -4
  58. package/dist/branch-identity.js.map +1 -1
  59. package/dist/branch-local-call-wait.d.ts +58 -0
  60. package/dist/branch-local-call-wait.d.ts.map +1 -0
  61. package/dist/branch-local-call-wait.js +122 -0
  62. package/dist/branch-local-call-wait.js.map +1 -0
  63. package/dist/branch-local-client.d.ts +108 -0
  64. package/dist/branch-local-client.d.ts.map +1 -0
  65. package/dist/branch-local-client.js +478 -0
  66. package/dist/branch-local-client.js.map +1 -0
  67. package/dist/branch-local-plan.d.ts +67 -0
  68. package/dist/branch-local-plan.d.ts.map +1 -0
  69. package/dist/branch-local-plan.js +282 -0
  70. package/dist/branch-local-plan.js.map +1 -0
  71. package/dist/branch-local-session-adoption.d.ts +35 -0
  72. package/dist/branch-local-session-adoption.d.ts.map +1 -0
  73. package/dist/branch-local-session-adoption.js +185 -0
  74. package/dist/branch-local-session-adoption.js.map +1 -0
  75. package/dist/branch-materialize.d.ts +2 -2
  76. package/dist/branch-materialize.d.ts.map +1 -1
  77. package/dist/branch-page-conversion.js +1 -1
  78. package/dist/branch-page-conversion.js.map +1 -1
  79. package/dist/branch-page-rollover.js +2 -2
  80. package/dist/branch-page-rollover.js.map +1 -1
  81. package/dist/branch-plan.d.ts +9 -0
  82. package/dist/branch-plan.d.ts.map +1 -1
  83. package/dist/branch-plan.js +3 -0
  84. package/dist/branch-plan.js.map +1 -1
  85. package/dist/branch-run-observation.d.ts +2 -2
  86. package/dist/branch-run-observation.d.ts.map +1 -1
  87. package/dist/branch-run-observation.js.map +1 -1
  88. package/dist/branch-run-outcome.d.ts +24 -0
  89. package/dist/branch-run-outcome.d.ts.map +1 -0
  90. package/dist/branch-run-outcome.js +31 -0
  91. package/dist/branch-run-outcome.js.map +1 -0
  92. package/dist/branch-run-record.d.ts +21 -0
  93. package/dist/branch-run-record.d.ts.map +1 -1
  94. package/dist/branch-run-record.js.map +1 -1
  95. package/dist/branch-run-supersede.d.ts +41 -0
  96. package/dist/branch-run-supersede.d.ts.map +1 -0
  97. package/dist/branch-run-supersede.js +64 -0
  98. package/dist/branch-run-supersede.js.map +1 -0
  99. package/dist/branch-schedule.d.ts +1 -1
  100. package/dist/branch-schedule.js +1 -1
  101. package/dist/cli-arguments.d.ts.map +1 -1
  102. package/dist/cli-arguments.js +1 -0
  103. package/dist/cli-arguments.js.map +1 -1
  104. package/dist/cli-branch-command.d.ts +9 -2
  105. package/dist/cli-branch-command.d.ts.map +1 -1
  106. package/dist/cli-branch-command.js +74 -17
  107. package/dist/cli-branch-command.js.map +1 -1
  108. package/dist/cli-help/design.d.ts +2 -2
  109. package/dist/cli-help/design.d.ts.map +1 -1
  110. package/dist/cli-help/design.js +3 -1
  111. package/dist/cli-help/design.js.map +1 -1
  112. package/dist/cli-help/index.d.ts +2 -2
  113. package/dist/cli-local-dispatch.d.ts.map +1 -1
  114. package/dist/cli-local-dispatch.js +6 -2
  115. package/dist/cli-local-dispatch.js.map +1 -1
  116. package/dist/cli-next-command.d.ts.map +1 -1
  117. package/dist/cli-next-command.js +3 -1
  118. package/dist/cli-next-command.js.map +1 -1
  119. package/dist/cli-usage.js +1 -1
  120. package/dist/legacy-skill-catalog.d.ts.map +1 -1
  121. package/dist/legacy-skill-catalog.js +10 -0
  122. package/dist/legacy-skill-catalog.js.map +1 -1
  123. package/dist/mcp-slate-ui-copy.d.ts +16 -6
  124. package/dist/mcp-slate-ui-copy.d.ts.map +1 -1
  125. package/dist/mcp-slate-ui-copy.js +11 -4
  126. package/dist/mcp-slate-ui-copy.js.map +1 -1
  127. package/dist/mcp-slate-ui-locales/de-DE.d.ts.map +1 -1
  128. package/dist/mcp-slate-ui-locales/de-DE.js +8 -3
  129. package/dist/mcp-slate-ui-locales/de-DE.js.map +1 -1
  130. package/dist/mcp-slate-ui-locales/es-419.d.ts.map +1 -1
  131. package/dist/mcp-slate-ui-locales/es-419.js +8 -3
  132. package/dist/mcp-slate-ui-locales/es-419.js.map +1 -1
  133. package/dist/mcp-slate-ui-locales/es-ES.d.ts.map +1 -1
  134. package/dist/mcp-slate-ui-locales/es-ES.js +8 -3
  135. package/dist/mcp-slate-ui-locales/es-ES.js.map +1 -1
  136. package/dist/mcp-slate-ui-locales/fr-FR.d.ts.map +1 -1
  137. package/dist/mcp-slate-ui-locales/fr-FR.js +8 -3
  138. package/dist/mcp-slate-ui-locales/fr-FR.js.map +1 -1
  139. package/dist/mcp-slate-ui-locales/hi-IN.d.ts.map +1 -1
  140. package/dist/mcp-slate-ui-locales/hi-IN.js +8 -3
  141. package/dist/mcp-slate-ui-locales/hi-IN.js.map +1 -1
  142. package/dist/mcp-slate-ui-locales/it-IT.d.ts.map +1 -1
  143. package/dist/mcp-slate-ui-locales/it-IT.js +7 -2
  144. package/dist/mcp-slate-ui-locales/it-IT.js.map +1 -1
  145. package/dist/mcp-slate-ui-locales/ja-JP.d.ts.map +1 -1
  146. package/dist/mcp-slate-ui-locales/ja-JP.js +7 -2
  147. package/dist/mcp-slate-ui-locales/ja-JP.js.map +1 -1
  148. package/dist/mcp-slate-ui-locales/ko-KR.d.ts.map +1 -1
  149. package/dist/mcp-slate-ui-locales/ko-KR.js +8 -3
  150. package/dist/mcp-slate-ui-locales/ko-KR.js.map +1 -1
  151. package/dist/mcp-slate-ui-locales/pt-BR.d.ts.map +1 -1
  152. package/dist/mcp-slate-ui-locales/pt-BR.js +8 -3
  153. package/dist/mcp-slate-ui-locales/pt-BR.js.map +1 -1
  154. package/dist/mcp-slate-ui-locales/zh-CN.d.ts.map +1 -1
  155. package/dist/mcp-slate-ui-locales/zh-CN.js +8 -3
  156. package/dist/mcp-slate-ui-locales/zh-CN.js.map +1 -1
  157. package/dist/mcp-slate-ui-locales/zh-TW.d.ts.map +1 -1
  158. package/dist/mcp-slate-ui-locales/zh-TW.js +8 -3
  159. package/dist/mcp-slate-ui-locales/zh-TW.js.map +1 -1
  160. package/dist/mcp-slate-ui-script-designs.d.ts.map +1 -1
  161. package/dist/mcp-slate-ui-script-designs.js +25 -4
  162. package/dist/mcp-slate-ui-script-designs.js.map +1 -1
  163. package/dist/mcp-slate-ui-script-remote.js +2 -2
  164. package/dist/mcp-slate-ui-script-viewer.d.ts +4 -3
  165. package/dist/mcp-slate-ui-script-viewer.d.ts.map +1 -1
  166. package/dist/mcp-slate-ui-script-viewer.js +13 -4
  167. package/dist/mcp-slate-ui-script-viewer.js.map +1 -1
  168. package/dist/mcp-slate-ui-styles-designs.d.ts.map +1 -1
  169. package/dist/mcp-slate-ui-styles-designs.js +7 -0
  170. package/dist/mcp-slate-ui-styles-designs.js.map +1 -1
  171. package/dist/slate-branch-runner.d.ts +9 -3
  172. package/dist/slate-branch-runner.d.ts.map +1 -1
  173. package/dist/slate-branch-runner.js +40 -7
  174. package/dist/slate-branch-runner.js.map +1 -1
  175. package/dist/slate-image-executor.d.ts +1 -0
  176. package/dist/slate-image-executor.d.ts.map +1 -1
  177. package/dist/slate-image-executor.js +1 -1
  178. package/dist/slate-image-executor.js.map +1 -1
  179. package/dist/slate-retry.d.ts +2 -1
  180. package/dist/slate-retry.d.ts.map +1 -1
  181. package/dist/slate-retry.js +32 -0
  182. package/dist/slate-retry.js.map +1 -1
  183. package/dist/slate-run-action.js +9 -4
  184. package/dist/slate-run-action.js.map +1 -1
  185. package/dist/slate-runner-context.d.ts +6 -0
  186. package/dist/slate-runner-context.d.ts.map +1 -1
  187. package/dist/slate-runner-context.js.map +1 -1
  188. package/dist/slate-runner-main.d.ts +3 -0
  189. package/dist/slate-runner-main.d.ts.map +1 -1
  190. package/dist/slate-runner-main.js +4 -0
  191. package/dist/slate-runner-main.js.map +1 -1
  192. package/dist/slate-view-contract.d.ts +9 -1
  193. package/dist/slate-view-contract.d.ts.map +1 -1
  194. package/dist/slate-view-contract.js +3 -1
  195. package/dist/slate-view-contract.js.map +1 -1
  196. package/dist/slate-view.d.ts.map +1 -1
  197. package/dist/slate-view.js +1 -0
  198. package/dist/slate-view.js.map +1 -1
  199. package/dist/slate-workspace-parse.d.ts.map +1 -1
  200. package/dist/slate-workspace-parse.js +4 -0
  201. package/dist/slate-workspace-parse.js.map +1 -1
  202. package/dist/slate-workspace-types.d.ts +8 -0
  203. package/dist/slate-workspace-types.d.ts.map +1 -1
  204. package/dist/workspace-draw-branch.d.ts +7 -3
  205. package/dist/workspace-draw-branch.d.ts.map +1 -1
  206. package/dist/workspace-draw-branch.js +42 -27
  207. package/dist/workspace-draw-branch.js.map +1 -1
  208. package/dist/workspace-draw-client.d.ts +1 -0
  209. package/dist/workspace-draw-client.d.ts.map +1 -1
  210. package/dist/workspace-draw-client.js +6 -3
  211. package/dist/workspace-draw-client.js.map +1 -1
  212. package/dist/workspace-draw-codex.d.ts +5 -1
  213. package/dist/workspace-draw-codex.d.ts.map +1 -1
  214. package/dist/workspace-draw-codex.js +1 -0
  215. package/dist/workspace-draw-codex.js.map +1 -1
  216. package/dist/workspace-draw-messages.d.ts +13 -0
  217. package/dist/workspace-draw-messages.d.ts.map +1 -1
  218. package/dist/workspace-draw-messages.js +17 -0
  219. package/dist/workspace-draw-messages.js.map +1 -1
  220. package/dist/workspace-draw-run.d.ts +2 -1
  221. package/dist/workspace-draw-run.d.ts.map +1 -1
  222. package/dist/workspace-draw-run.js +7 -2
  223. package/dist/workspace-draw-run.js.map +1 -1
  224. package/dist/workspace-draw-types.d.ts +1 -0
  225. package/dist/workspace-draw-types.d.ts.map +1 -1
  226. package/dist/workspace-draw-types.js +2 -0
  227. package/dist/workspace-draw-types.js.map +1 -1
  228. package/open-design.json +2 -2
  229. package/package.json +1 -1
  230. package/skills/12ui-design/outputs.md +1 -1
@@ -0,0 +1,180 @@
1
+ // GENERATED — do not edit. Copied verbatim from
2
+ // packages/layerdoc/src/branch-core by scripts/sync-improve-core.mjs.
3
+ const CONTENT_HEADING = 'This screen should contain:';
4
+ const READING_LAYOUT_HEADING = 'Reading layout:';
5
+ const CHROME_HEADING = 'Header and footer:';
6
+ const STRUCTURE_HEADING = 'Screen structure:';
7
+ const GENERATION_CONTRACT = 'Generate the complete new screen from scratch.';
8
+ const isWebPage = (input) => input.surfaceType === 'web_page';
9
+ const isFinalScreen = (input) => (input.pageEndsHere || input.viewportOrdinal === input.lastViewportOrdinal);
10
+ const footerImageNumber = (input) => (2 + Number(input.hasDependencyReference));
11
+ const referenceContract = (input) => {
12
+ const references = [
13
+ `Image 1 is the complete approved source design and defines the whole ${input.surfaceType === 'web_page' ? 'site' : 'product'}.`,
14
+ ];
15
+ if (input.hasDependencyReference) {
16
+ if (input.surfaceType === 'web_page') {
17
+ references.push('Image 2 is the complete preceding part of this page and is now entirely above the new screen.');
18
+ }
19
+ else if (input.surfaceType === 'mobile_app') {
20
+ references.push('Image 2 is the complete immediately preceding mobile application state.');
21
+ }
22
+ else if (input.surfaceType === 'immersive') {
23
+ references.push('Image 2 is the complete immediately preceding state of this immersive experience.');
24
+ }
25
+ else {
26
+ references.push('Image 2 is the complete immediately preceding application state.');
27
+ }
28
+ }
29
+ if (input.hasFooterReference) {
30
+ references.push(`Image ${footerImageNumber(input)} is a complete page ending from this site and shows how its footer belongs within a full page.`);
31
+ }
32
+ return references.join(' ');
33
+ };
34
+ const stateLocation = (input) => {
35
+ const stateKind = input.surfaceType === 'mobile_app'
36
+ ? 'mobile application state'
37
+ : input.surfaceType === 'immersive'
38
+ ? 'immersive experience state'
39
+ : 'application state';
40
+ const screenKind = input.surfaceType === 'mobile_app'
41
+ ? 'mobile application screen'
42
+ : input.surfaceType === 'immersive'
43
+ ? 'immersive experience screen'
44
+ : 'application screen';
45
+ if (input.hasDependencyReference) {
46
+ return `Create the next complete ${stateKind} for the “${input.pageTitle}” route. Preserve the named selection and entered context from Image 2, but show the new state instead of copying the preceding screen.`;
47
+ }
48
+ if (input.pageKind === 'source') {
49
+ return `Create the next complete ${stateKind} after the approved source for the “${input.pageTitle}” route. Preserve only context that is genuinely meant to continue; do not reproduce the approved screen.`;
50
+ }
51
+ return `Create one complete ${screenKind} for the “${input.pageTitle}” route. This is a new route in the same product, not content placed below Image 1.`;
52
+ };
53
+ const webpageLocation = (input) => {
54
+ const final = isFinalScreen(input);
55
+ if (!input.hasDependencyReference && input.pageKind === 'source') {
56
+ return `This screen continues the approved “${input.pageTitle}” page below the complete source in Image 1. Everything visible in Image 1 is entirely above this new screen. Begin with the next content in the page; do not repeat the previous section or show any overlap from above.`;
57
+ }
58
+ if (!input.hasDependencyReference && final) {
59
+ return `This is the complete short “${input.pageTitle}” page. It begins here and reaches its natural ending within this screen.`;
60
+ }
61
+ if (!input.hasDependencyReference) {
62
+ return `This is the top visible part of the new “${input.pageTitle}” page. Other parts of the page will continue below this screen.`;
63
+ }
64
+ if (final) {
65
+ return `This is the final visible part lower down the “${input.pageTitle}” page. The complete preceding part is entirely above this screen. Begin after that content without repeating its bottom edge or any section from above.`;
66
+ }
67
+ return `This is a later visible part lower down the “${input.pageTitle}” page. The complete preceding part is entirely above this screen, and more of the page will follow below. Begin after the prior content without repeating it.`;
68
+ };
69
+ const chromeContract = (input) => {
70
+ if (!isWebPage(input))
71
+ return null;
72
+ const firstNewPageScreen = input.pageKind === 'additional' && !input.hasDependencyReference;
73
+ const header = typeof input.header === 'boolean' ? input.header : firstNewPageScreen;
74
+ const footer = typeof input.footer === 'boolean' ? input.footer : isFinalScreen(input);
75
+ const headerText = header
76
+ ? 'Include the site header, interpreting it from the complete approved source in Image 1.'
77
+ : 'Do not include a header - this screen follows an earlier part of the page which already includes it.';
78
+ const footerText = footer
79
+ ? input.hasFooterReference
80
+ ? `Include a footer. Use the complete page in Image ${footerImageNumber(input)} as context for how the footer belongs to this site, then interpret it for the current page.`
81
+ : 'Include a footer that feels native to the same site, interpreting the complete approved source as a whole.'
82
+ : 'Do not include a footer - a later part of the page will include it.';
83
+ return `${headerText} ${footerText}`;
84
+ };
85
+ const stateShellContract = (input) => {
86
+ if (input.surfaceType === 'web_app') {
87
+ return 'Treat this as a complete desktop application state. Preserve recurring application navigation or shell elements established by the approved source where they belong; do not add a conventional webpage footer.';
88
+ }
89
+ if (input.surfaceType === 'mobile_app') {
90
+ return 'Treat this as a complete mobile application state. Preserve recurring mobile navigation established by the approved source where it belongs; do not add a conventional webpage header or footer.';
91
+ }
92
+ if (input.surfaceType === 'immersive') {
93
+ return 'Treat this as a complete immersive experience state. Do not assume conventional website or application chrome; include only controls that belong to the experience.';
94
+ }
95
+ return null;
96
+ };
97
+ const openingContract = (surface) => {
98
+ if (surface === 'web_page')
99
+ return 'You are creating another page for the same website shown in Image 1.';
100
+ if (surface === 'mobile_app')
101
+ return 'You are creating another mobile application screen or state for the same product shown in Image 1.';
102
+ if (surface === 'immersive')
103
+ return 'You are creating another screen or state for the same immersive product experience shown in Image 1.';
104
+ return 'You are creating another application screen or state for the same product shown in Image 1.';
105
+ };
106
+ const returnContract = (surface) => {
107
+ if (surface === 'mobile_app')
108
+ return 'Return one complete mobile application screen.';
109
+ if (surface === 'immersive')
110
+ return 'Return one complete immersive experience screen.';
111
+ if (surface === 'web_app')
112
+ return 'Return one complete desktop application screen.';
113
+ return 'Return one complete desktop webpage screen.';
114
+ };
115
+ const proseLines = (targetWords) => {
116
+ const words = Number.isSafeInteger(targetWords) && targetWords > 0
117
+ ? targetWords
118
+ : 400;
119
+ return Math.max(12, Math.min(60, Math.round(words / 10)));
120
+ };
121
+ const readingLayoutContract = (input) => {
122
+ if (!input.slotType || input.slotType === 'other')
123
+ return null;
124
+ const lines = proseLines(input.targetWords);
125
+ if (input.slotType === 'text-column') {
126
+ return `Use one wide reading column under a single section heading, with roughly ${lines} lines of body copy in the site's text style and generous margins. Keep it as one uninterrupted prose region with no cards, grid, callouts, or supporting graphic. The copy may be neutral placeholder prose, but do not print instructions, word counts, replacement labels, or empty frames.`;
127
+ }
128
+ if (input.slotType === 'text-with-graphic') {
129
+ return `Use roughly two-thirds of the screen for one continuous body-copy region of about ${lines} lines and one-third for a single clear diagram of the concrete subject described above. The diagram must depict those specific facts, not generic decoration. Do not turn the section into cards, a dashboard, a grid, or a collection of callouts. The copy may be neutral placeholder prose, but do not print instructions, word counts, replacement labels, or empty frames.`;
130
+ }
131
+ return `Use a closing paragraph of about ${lines} lines, then one restrained summary graphic of the concrete subject described above, then the site footer. Keep that order and do not split the conclusion into cards, a dashboard, a grid, or callouts. The copy may be neutral placeholder prose, but do not print instructions, word counts, replacement labels, or empty frames.`;
132
+ };
133
+ const naturalContent = (input) => {
134
+ const content = input.content.trim();
135
+ if (!input.slotType || input.slotType === 'other')
136
+ return content;
137
+ return content
138
+ .replace(/\b(?:slot|target)\s*:[^;.\n]*(?:[;.]|$)/giu, '')
139
+ .replace(/\s+/gu, ' ')
140
+ .trim();
141
+ };
142
+ export const buildBranchGenerationPrompt = (input) => {
143
+ const chrome = chromeContract(input);
144
+ const shell = stateShellContract(input);
145
+ const readingLayout = readingLayoutContract(input);
146
+ return [
147
+ `${openingContract(input.surfaceType)} Understand the complete approved source as a whole: what the product is doing, its atmosphere, visual language, hierarchy, typography, imagery, interaction language, and level of polish. Create a screen that unmistakably belongs to this same ${input.surfaceType === 'web_page' ? 'site' : 'product'} while interpreting the design for its own purpose. Do not turn it into a different brand or a generic template.`,
148
+ `Product purpose: ${input.productPurpose}\nCurrent page purpose: ${input.pagePurpose}`,
149
+ referenceContract(input),
150
+ isWebPage(input) ? webpageLocation(input) : stateLocation(input),
151
+ `${CONTENT_HEADING}\n${naturalContent(input)}`,
152
+ readingLayout ? `${READING_LAYOUT_HEADING}\n${readingLayout}` : null,
153
+ chrome ? `${CHROME_HEADING}\n${chrome}` : null,
154
+ shell ? `${STRUCTURE_HEADING}\n${shell}` : null,
155
+ `${GENERATION_CONTRACT} The complete reference images provide product and continuity context; do not paste, crop, extend, or composite them into the result. Do not reproduce the approved composition. Create new page-specific body imagery and examples. If a subject necessarily recurs, create a genuinely new depiction rather than copying reference pixels.`,
156
+ `Decide how this screen should look. ${returnContract(input.surfaceType)}`,
157
+ ].filter((section) => Boolean(section)).join('\n\n');
158
+ };
159
+ /**
160
+ * One branch screen's image prompt from the plan and its placement. The
161
+ * reference flags say which images actually arrive with the call, so the
162
+ * dispatcher rebuilds this from the references the gate released.
163
+ */
164
+ export const branchPromptFor = (plan, placement, references) => buildBranchGenerationPrompt({
165
+ content: placement.content,
166
+ ...(placement.slotType ? { slotType: placement.slotType } : {}),
167
+ ...(placement.targetWords !== undefined ? { targetWords: placement.targetWords } : {}),
168
+ productPurpose: plan.sitePurpose,
169
+ pagePurpose: placement.pagePurpose,
170
+ pageKind: placement.pageKind,
171
+ pageTitle: placement.pageTitle,
172
+ surfaceType: placement.surfaceType,
173
+ viewportOrdinal: placement.viewportOrdinal,
174
+ lastViewportOrdinal: placement.lastViewportOrdinal,
175
+ pageEndsHere: placement.pageEndsHere,
176
+ header: placement.header,
177
+ footer: placement.footer,
178
+ ...references,
179
+ });
180
+ //# sourceMappingURL=branch-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch-prompt.js","sourceRoot":"","sources":["../../src/branch-core/branch-prompt.ts"],"names":[],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EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACtF,cAAc,EAAE,IAAI,CAAC,WAAW;IAChC,WAAW,EAAE,SAAS,CAAC,WAAW;IAClC,QAAQ,EAAE,SAAS,CAAC,QAAQ;IAC5B,SAAS,EAAE,SAAS,CAAC,SAAS;IAC9B,WAAW,EAAE,SAAS,CAAC,WAAW;IAClC,eAAe,EAAE,SAAS,CAAC,eAAe;IAC1C,mBAAmB,EAAE,SAAS,CAAC,mBAAmB;IAClD,YAAY,EAAE,SAAS,CAAC,YAAY;IACpC,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,GAAG,UAAU;CACd,CAAC,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * THE scope policy of a branch: what the person chose to grow from the
3
+ * approved screen, said to the planner and applied to its answer. One module
4
+ * owns both halves so the words the planner reads and the rule its answer is
5
+ * held to can never drift apart (CLAUDE.md item 9).
6
+ *
7
+ * - `site` (the default, and every caller that predates scope): the web
8
+ * /branch plan — the source page continued where it needs it, plus the
9
+ * further pages or routes the planner chooses.
10
+ * - `page`: the person chose to continue this same page below the approved
11
+ * screen. The planner is told so, told to plan no other pages, and told that
12
+ * a visible footer is the only reason to plan no continuation. Its answer is
13
+ * then read as that choice: the source page's own continuations answer it,
14
+ * screens filed under additional pages continue the source page when it has
15
+ * none of its own (the provider schema stays permissive, CLAUDE.md item 2),
16
+ * and zero continuations is a valid plan only when the planner itself
17
+ * declared that the approved screen already ends.
18
+ *
19
+ * Also here, for both scopes: the brief the planner quotes was written for the
20
+ * approved screen (the first-screen round), so a first-viewport limit in it
21
+ * describes that screen and never limits the branch.
22
+ */
23
+ export declare const BRANCH_PLAN_SCOPES: readonly ["page", "site"];
24
+ export type BranchPlanScope = (typeof BRANCH_PLAN_SCOPES)[number];
25
+ export declare const isBranchPlanScope: (value: unknown) => value is BranchPlanScope;
26
+ /** Both scopes: the brief describes the approved screen, so its first-screen limits do not bound the branch. */
27
+ export declare const BRANCH_BRIEF_SCOPE_NOTE = "The original brief was written for the approved screen, the first screen of this design. Any limit it sets to the first viewport, one screen or a single view described that screen only and does not limit this branch.";
28
+ /** Page scope: the person's choice, said as the planner's task. */
29
+ export declare const PAGE_SCOPE_TASK = "The person chose to continue this same page below the approved screen. Plan its source continuations: the sections a visitor reaches next by scrolling down this page, each adding something the approved screen does not already say.";
30
+ export declare const PAGE_SCOPE_NO_OTHER_PAGES = "Keep additionalPages empty: this branch designs no other pages or routes.";
31
+ export declare const PAGE_SCOPE_FOOTER_RULE = "A visible footer is the only reason to return no continuations. Set sourceEndsHere to true and leave the source viewports empty only when the approved screen visibly closes with its webpage footer; otherwise set sourceEndsHere to false and plan at least one continuation below it.";
32
+ export declare const PAGE_SCOPE_STATUS_UPDATE = "Set statusUpdate to one or two concise first-person sentences explaining what you chose to add below the approved screen and how it completes this page. Speak directly to the user. Do not mention internal planning, models, generation mechanics, implementation details, or visual decisions.";
33
+ export declare const PAGE_SCOPE_ONE_SCREEN = "Exactly one generated screen can fit: plan one source continuation.";
34
+ export declare const PAGE_SCOPE_FOLLOW_BRIEF = "Follow the original brief for what this page still needs to say below the approved screen.";
35
+ export declare const pageScopeScreenBudget: (cap: number) => string;
36
+ type ScopedViewport = {
37
+ content: string;
38
+ slotType?: unknown;
39
+ targetWords?: unknown;
40
+ };
41
+ type ScopedPage<V extends ScopedViewport> = {
42
+ kind: 'source' | 'additional';
43
+ pageType: string;
44
+ sourceEndsHere?: boolean;
45
+ viewports: V[];
46
+ };
47
+ /**
48
+ * ARBITRATION (page scope): the planner's answer read as the person's choice.
49
+ * Fires only under page scope; site scope never reaches it.
50
+ *
51
+ * - The source page's own continuations are the answer to the page: any
52
+ * further pages the planner added anyway are dropped (the person chose this
53
+ * page, and the prompt asked for no others).
54
+ * - When the source page has none of its own but the planner filed screens
55
+ * under additional pages, those screens are the only plan it made of what
56
+ * comes next, so they continue the source page, in plan order, up to its
57
+ * continuation cap (a misfiled representation, CLAUDE.md item 2, resolved
58
+ * without another paid call). A source page that is not editorial cannot
59
+ * carry the editorial slot contract, so a borrowed screen sheds it.
60
+ * - A plan with continuations does not end here, whatever sourceEndsHere said:
61
+ * the person asked for the page to go on and the planner wrote how.
62
+ * - A plan with none is valid only when the planner declared the end
63
+ * (sourceEndsHere true: the approved screen visibly closes with its footer).
64
+ * Without that declaration it is a structural defect, so the bounded retry
65
+ * runs; "no continuations" is never taken to mean "already complete".
66
+ */
67
+ export declare const resolvePageScopePages: <V extends ScopedViewport, P extends ScopedPage<V>>(args: {
68
+ pages: P[];
69
+ sourceCap: (source: P) => number;
70
+ anomalies: string[];
71
+ }) => P[];
72
+ export {};
73
+ //# sourceMappingURL=branch-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch-scope.d.ts","sourceRoot":"","sources":["../../src/branch-core/branch-scope.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,eAAO,MAAM,kBAAkB,2BAA4B,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,eAE3D,CAAC;AAEF,gHAAgH;AAChH,eAAO,MAAM,uBAAuB,6NAA6N,CAAC;AAElQ,mEAAmE;AACnE,eAAO,MAAM,eAAe,2OAA2O,CAAC;AACxQ,eAAO,MAAM,yBAAyB,8EAA8E,CAAC;AACrH,eAAO,MAAM,sBAAsB,6RAA6R,CAAC;AACjU,eAAO,MAAM,wBAAwB,sSAAsS,CAAC;AAC5U,eAAO,MAAM,qBAAqB,wEAAwE,CAAC;AAC3G,eAAO,MAAM,uBAAuB,+FAA+F,CAAC;AAEpI,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,MAEnD,CAAC;AAEF,KAAK,cAAc,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AACrF,KAAK,UAAU,CAAC,CAAC,SAAS,cAAc,IAAI;IAC1C,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,CAAC,EAAE,CAAC;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM;IAC7F,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,SAAS,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,CAAC;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,KAAG,CAAC,EA2BJ,CAAC"}
@@ -0,0 +1,88 @@
1
+ // GENERATED — do not edit. Copied verbatim from
2
+ // packages/layerdoc/src/branch-core by scripts/sync-improve-core.mjs.
3
+ /**
4
+ * THE scope policy of a branch: what the person chose to grow from the
5
+ * approved screen, said to the planner and applied to its answer. One module
6
+ * owns both halves so the words the planner reads and the rule its answer is
7
+ * held to can never drift apart (CLAUDE.md item 9).
8
+ *
9
+ * - `site` (the default, and every caller that predates scope): the web
10
+ * /branch plan — the source page continued where it needs it, plus the
11
+ * further pages or routes the planner chooses.
12
+ * - `page`: the person chose to continue this same page below the approved
13
+ * screen. The planner is told so, told to plan no other pages, and told that
14
+ * a visible footer is the only reason to plan no continuation. Its answer is
15
+ * then read as that choice: the source page's own continuations answer it,
16
+ * screens filed under additional pages continue the source page when it has
17
+ * none of its own (the provider schema stays permissive, CLAUDE.md item 2),
18
+ * and zero continuations is a valid plan only when the planner itself
19
+ * declared that the approved screen already ends.
20
+ *
21
+ * Also here, for both scopes: the brief the planner quotes was written for the
22
+ * approved screen (the first-screen round), so a first-viewport limit in it
23
+ * describes that screen and never limits the branch.
24
+ */
25
+ export const BRANCH_PLAN_SCOPES = ['page', 'site'];
26
+ export const isBranchPlanScope = (value) => (typeof value === 'string' && BRANCH_PLAN_SCOPES.includes(value));
27
+ /** Both scopes: the brief describes the approved screen, so its first-screen limits do not bound the branch. */
28
+ export const BRANCH_BRIEF_SCOPE_NOTE = 'The original brief was written for the approved screen, the first screen of this design. Any limit it sets to the first viewport, one screen or a single view described that screen only and does not limit this branch.';
29
+ /** Page scope: the person's choice, said as the planner's task. */
30
+ export const PAGE_SCOPE_TASK = 'The person chose to continue this same page below the approved screen. Plan its source continuations: the sections a visitor reaches next by scrolling down this page, each adding something the approved screen does not already say.';
31
+ export const PAGE_SCOPE_NO_OTHER_PAGES = 'Keep additionalPages empty: this branch designs no other pages or routes.';
32
+ export const PAGE_SCOPE_FOOTER_RULE = 'A visible footer is the only reason to return no continuations. Set sourceEndsHere to true and leave the source viewports empty only when the approved screen visibly closes with its webpage footer; otherwise set sourceEndsHere to false and plan at least one continuation below it.';
33
+ export const PAGE_SCOPE_STATUS_UPDATE = 'Set statusUpdate to one or two concise first-person sentences explaining what you chose to add below the approved screen and how it completes this page. Speak directly to the user. Do not mention internal planning, models, generation mechanics, implementation details, or visual decisions.';
34
+ export const PAGE_SCOPE_ONE_SCREEN = 'Exactly one generated screen can fit: plan one source continuation.';
35
+ export const PAGE_SCOPE_FOLLOW_BRIEF = 'Follow the original brief for what this page still needs to say below the approved screen.';
36
+ export const pageScopeScreenBudget = (cap) => (`Plan at most ${cap} screens in total. Prefer fewer, stronger screens over filling the budget.`);
37
+ /**
38
+ * ARBITRATION (page scope): the planner's answer read as the person's choice.
39
+ * Fires only under page scope; site scope never reaches it.
40
+ *
41
+ * - The source page's own continuations are the answer to the page: any
42
+ * further pages the planner added anyway are dropped (the person chose this
43
+ * page, and the prompt asked for no others).
44
+ * - When the source page has none of its own but the planner filed screens
45
+ * under additional pages, those screens are the only plan it made of what
46
+ * comes next, so they continue the source page, in plan order, up to its
47
+ * continuation cap (a misfiled representation, CLAUDE.md item 2, resolved
48
+ * without another paid call). A source page that is not editorial cannot
49
+ * carry the editorial slot contract, so a borrowed screen sheds it.
50
+ * - A plan with continuations does not end here, whatever sourceEndsHere said:
51
+ * the person asked for the page to go on and the planner wrote how.
52
+ * - A plan with none is valid only when the planner declared the end
53
+ * (sourceEndsHere true: the approved screen visibly closes with its footer).
54
+ * Without that declaration it is a structural defect, so the bounded retry
55
+ * runs; "no continuations" is never taken to mean "already complete".
56
+ */
57
+ export const resolvePageScopePages = (args) => {
58
+ const source = args.pages.find((page) => page.kind === 'source');
59
+ if (!source)
60
+ throw new Error('sourcePage is missing.');
61
+ const others = args.pages.filter((page) => page.kind !== 'source' && page.viewports.length > 0);
62
+ let viewports = source.viewports;
63
+ if (others.length > 0 && viewports.length > 0) {
64
+ args.anomalies.push(`Page scope: dropped ${others.length} additional page(s); the source page's own continuations answer the page.`);
65
+ }
66
+ else if (others.length > 0) {
67
+ viewports = others.flatMap((page) => page.viewports.map((viewport) => {
68
+ if (source.pageType === 'editorial')
69
+ return viewport;
70
+ const { slotType: _slotType, targetWords: _targetWords, ...rest } = viewport;
71
+ return rest;
72
+ }));
73
+ args.anomalies.push(`Page scope: read ${viewports.length} screen(s) planned under additionalPages as continuations of the source page.`);
74
+ }
75
+ const cap = args.sourceCap(source);
76
+ if (viewports.length > cap) {
77
+ args.anomalies.push(`Page scope: kept the first ${cap} of ${viewports.length} continuations.`);
78
+ viewports = viewports.slice(0, cap);
79
+ }
80
+ if (viewports.length === 0 && source.sourceEndsHere !== true) {
81
+ throw new Error('sourcePage planned no continuation of this page and declared no footer ending.');
82
+ }
83
+ if (viewports.length > 0 && source.sourceEndsHere === true) {
84
+ args.anomalies.push('Page scope: sourcePage.sourceEndsHere was true with continuations planned; kept the continuations.');
85
+ }
86
+ return [{ ...source, viewports, sourceEndsHere: viewports.length === 0 }];
87
+ };
88
+ //#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G,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,gFAAgF,CAAC,CAAC;IACpG,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,cAAc,KAAK,IAAI,EAAE,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oGAAoG,CAAC,CAAC;IAC5H,CAAC;IACD,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,CAAC;AAC5E,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The branch build process as one source: the planner's system text, prompt,
3
+ * schema and deterministic parse; the plan model and its slot cells; the canvas
4
+ * mapping; the dispatch gates; and the per-screen image prompt.
5
+ *
6
+ * Pure and Worker-safe (no node imports; `tsconfig.branch-core.json` proves it).
7
+ * The hosted create route imports it through `@just-every/layerdoc/core`; the
8
+ * CLI, which runs the same process on a person's own Codex, carries a generated,
9
+ * git-ignored copy (`scripts/sync-improve-core.mjs` vendors it beside
10
+ * improve-core). Prompt text lives here and nowhere else.
11
+ */
12
+ export { BRANCH_PAGE_TYPES, BRANCH_PLAN_SCHEMA_VERSION, BRANCH_SURFACE_TYPES, BRANCH_VIEWPORT_SLOT_TYPES, BUILD_SLOTS, branchContentSlotId, branchPlanCells, type BranchCell, type BranchCellPlacement, type BranchPageType, type BranchPlan, type BranchPlanPage, type BranchPlanViewport, type BranchSurfaceType, type BranchViewportSlotType, type BuildSlot, } from './branch-plan-model.js';
13
+ export { CREATE_ASPECT_SIZES, branchAspectForCanvas, branchCanvasDecision, branchProviderCanvas, parseBranchCanvasDecision, resolveBranchPlanCanvases, type BranchAspect, type BranchCanvas, type BranchCanvasDecision, } from './branch-canvas.js';
14
+ export { BRANCH_PLANNER_SYSTEM_PROMPT, BUILD_PLAN_MODEL, MAX_BRANCH_ADDITIONAL_PAGES, MAX_BRANCH_CELLS, MAX_BRANCH_SOURCE_CONTINUATIONS, MAX_BRANCH_VIEWPORTS, MAX_EDITORIAL_BRANCH_SOURCE_CONTINUATIONS, MIN_BRANCH_ADDITIONAL_PAGES, MIN_BRANCH_VIEWPORTS, branchBriefRequestsLongFormSamePage, branchConceptText, branchPlanParseOptions, branchPlanResponseSchema, branchScreenCap, buildBranchPlannerPrompt, parseBranchPlan, type BranchPlanParseOptions, } from './branch-planner.js';
15
+ export { BRANCH_PLAN_SCOPES, isBranchPlanScope, type BranchPlanScope, } from './branch-scope.js';
16
+ export { branchPromptFor, buildBranchGenerationPrompt, type BranchGenerationPromptInput, } from './branch-prompt.js';
17
+ export { branchFooterSeedSlot, branchGenerationSourceKeys, evaluateBranchDispatchGate, type BranchCandidateState, type BranchDispatchGate, type BranchReferenceRole, type BranchReferenceSlotInputs, } from './branch-gates.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/branch-core/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,+BAA+B,EAC/B,oBAAoB,EACpB,yCAAyC,EACzC,2BAA2B,EAC3B,oBAAoB,EACpB,mCAAmC,EACnC,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,KAAK,2BAA2B,GACjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,20 @@
1
+ // GENERATED — do not edit. Copied verbatim from
2
+ // packages/layerdoc/src/branch-core by scripts/sync-improve-core.mjs.
3
+ /**
4
+ * The branch build process as one source: the planner's system text, prompt,
5
+ * schema and deterministic parse; the plan model and its slot cells; the canvas
6
+ * mapping; the dispatch gates; and the per-screen image prompt.
7
+ *
8
+ * Pure and Worker-safe (no node imports; `tsconfig.branch-core.json` proves it).
9
+ * The hosted create route imports it through `@just-every/layerdoc/core`; the
10
+ * CLI, which runs the same process on a person's own Codex, carries a generated,
11
+ * git-ignored copy (`scripts/sync-improve-core.mjs` vendors it beside
12
+ * improve-core). Prompt text lives here and nowhere else.
13
+ */
14
+ export { BRANCH_PAGE_TYPES, BRANCH_PLAN_SCHEMA_VERSION, BRANCH_SURFACE_TYPES, BRANCH_VIEWPORT_SLOT_TYPES, BUILD_SLOTS, branchContentSlotId, branchPlanCells, } from './branch-plan-model.js';
15
+ export { CREATE_ASPECT_SIZES, branchAspectForCanvas, branchCanvasDecision, branchProviderCanvas, parseBranchCanvasDecision, resolveBranchPlanCanvases, } from './branch-canvas.js';
16
+ export { BRANCH_PLANNER_SYSTEM_PROMPT, BUILD_PLAN_MODEL, MAX_BRANCH_ADDITIONAL_PAGES, MAX_BRANCH_CELLS, MAX_BRANCH_SOURCE_CONTINUATIONS, MAX_BRANCH_VIEWPORTS, MAX_EDITORIAL_BRANCH_SOURCE_CONTINUATIONS, MIN_BRANCH_ADDITIONAL_PAGES, MIN_BRANCH_VIEWPORTS, branchBriefRequestsLongFormSamePage, branchConceptText, branchPlanParseOptions, branchPlanResponseSchema, branchScreenCap, buildBranchPlannerPrompt, parseBranchPlan, } from './branch-planner.js';
17
+ export { BRANCH_PLAN_SCOPES, isBranchPlanScope, } from './branch-scope.js';
18
+ export { branchPromptFor, buildBranchGenerationPrompt, } from './branch-prompt.js';
19
+ export { branchFooterSeedSlot, branchGenerationSourceKeys, evaluateBranchDispatchGate, } from './branch-gates.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/branch-core/index.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,sEAAsE;AAEtE;;;;;;;;;;GAUG;AACH,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,WAAW,EACX,mBAAmB,EACnB,eAAe,GAUhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,yBAAyB,GAI1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,4BAA4B,EAC5B,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,+BAA+B,EAC/B,oBAAoB,EACpB,yCAAyC,EACzC,2BAA2B,EAC3B,oBAAoB,EACpB,mCAAmC,EACnC,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EACxB,eAAe,GAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,GAElB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,2BAA2B,GAE5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,GAK3B,MAAM,mBAAmB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type TwelveUiBranchClient } from './branch-client.js';
1
+ import { type BranchRunClient } from './branch-client.js';
2
2
  import { type BranchNormalizedPlan } from './branch-plan.js';
3
3
  /**
4
4
  * The dispatch driver: the scheduler decides WHICH screens may run, this decides
@@ -68,7 +68,7 @@ export type BranchDispatchTuning = {
68
68
  timeoutMs?: number;
69
69
  };
70
70
  export declare const runBranchDispatch: (args: {
71
- client: TwelveUiBranchClient;
71
+ client: BranchRunClient;
72
72
  plan: BranchNormalizedPlan;
73
73
  onEvent?: (event: BranchDispatchEvent) => void;
74
74
  /** Called on every loop turn, changed or not, so a poller always sees motion. */
@@ -1 +1 @@
1
- {"version":3,"file":"branch-dispatch-loop.d.ts","sourceRoot":"","sources":["../src/branch-dispatch-loop.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAO/E,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAElF;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,uBAAuB,OAAQ,CAAC;AAC7C,eAAO,MAAM,sBAAsB,OAAQ,CAAC;AAC5C,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,QAAc,CAAC;AAmBjD,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,MAAM,CAA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CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAeF,eAAO,MAAM,iBAAiB,GAAU,MAAM;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC/C,iFAAiF;IACjF,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACxD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC,oBAAoB,CA+O/B,CAAC"}
@@ -33,6 +33,10 @@ const TERMINAL_CODES = new Set([
33
33
  // identically forever, so holding the slot would spin. Stop the run.
34
34
  'idempotency_key_required',
35
35
  'run_state_invalid',
36
+ // The local engine only (branch-local-client.ts): the person's Codex stopped
37
+ // being able to draw (signed out, binary gone, stopped by a signal). Every
38
+ // other screen would fail the same way, so the run stops; it stays resumable.
39
+ 'codex_unavailable',
36
40
  ]);
37
41
  const scheduleView = (plan) => (plan.screens.map((screen) => ({
38
42
  slot: screen.slot,
@@ -1 +1 @@
1
- {"version":3,"file":"branch-dispatch-loop.js","sourceRoot":"","sources":["../src/branch-dispatch-loop.ts"],"names":[],"mappings":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AAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { TwelveUiBranchClient } from './branch-client.js';
1
+ import type { BranchRunClient } from './branch-client.js';
2
2
  /**
3
3
  * Screens are written into a hidden staging directory and moved into
4
4
  * `screens/` in one pass once the run is terminal, exactly as
@@ -38,7 +38,7 @@ export declare const stageBranchScreenBytes: (args: {
38
38
  */
39
39
  export declare const readBranchScreenBytes: (screen: BranchDownloadedScreen) => Promise<Uint8Array>;
40
40
  export declare const stageBranchScreen: (args: {
41
- client: TwelveUiBranchClient;
41
+ client: BranchRunClient;
42
42
  runId: string;
43
43
  slot: string;
44
44
  screensDirectory: string;
@@ -1 +1 @@
1
- {"version":3,"file":"branch-downloads.d.ts","sourceRoot":"","sources":["../src/branch-downloads.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,6BAA6B,yBAAyB,CAAC;AAEpE,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,MAAM,EAAE,MAAM,MAAM,KAAG,MAEzE,CAAC;AAgBF,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,GACjC,kBAAkB,MAAM,EACxB,MAAM,MAAM,KACX,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAiBvC,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,MAAM;IACjD,gBAAgB,EAAE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KACX,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAiBvC,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,MAAM;IACjD,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,OAAO,CAAC,sBAAsB,CAcjC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,sBAAsB,KAC7B,OAAO,CAAC,UAAU,CASpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAU,MAAM;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,KAAG,OAAO,CAAC,sBAAsB,CAOjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,kBAAkB,MAAM,EACxB,OAAO,SAAS,MAAM,EAAE,KACvB,OAAO,CAAC,IAAI,CAgBd,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { OPTION_FAILURES } from './workspace-draw-messages.js';
2
+ import type { ReadinessProbe } from './workspace-draw-engine.js';
3
+ /**
4
+ * THE engine policy for Branch, one module for the CLI and both workspaces
5
+ * (owner decision, 2026-10-03): a branch runs on the person's own Codex
6
+ * whenever Codex can run it — signed in to 12ui or not — and on the hosted
7
+ * branch service only when Codex cannot and a 12ui sign-in exists. With
8
+ * neither, a workspace request fails with `draw_branch_signin` and starts
9
+ * nothing.
10
+ *
11
+ * Codex can run a branch when the draw readiness probe passes (binary, ChatGPT
12
+ * sign-in, flags, image generation) AND the home's model cache lists the
13
+ * planner's model (gpt-6.1-sol) at low effort. A saved run keeps the engine it
14
+ * started on; `--engine codex|api` forces a side.
15
+ */
16
+ export type BranchEngine = 'codex' | 'api';
17
+ export type BranchEngineRequest = 'auto' | BranchEngine;
18
+ export type BranchEngineChoice = {
19
+ engine: BranchEngine;
20
+ reason: string;
21
+ };
22
+ export type BranchCodexReadiness = {
23
+ ready: boolean;
24
+ reason: string;
25
+ };
26
+ /** `--engine` is strict; `TWELVE_UI_ENGINE` counts when it names auto, codex or api. */
27
+ export declare const parseBranchEngineRequest: (flag: string | undefined, env: NodeJS.ProcessEnv) => BranchEngineRequest;
28
+ /** Whether a Codex home's model cache lists `model` at `effort`. */
29
+ export declare const codexHomeListsModel: (home: string, model: string, effort: string) => Promise<boolean>;
30
+ export declare const branchCodexReadiness: (args: {
31
+ env: NodeJS.ProcessEnv;
32
+ probe?: ReadinessProbe;
33
+ }) => Promise<BranchCodexReadiness>;
34
+ /** `12ui branch execute` / `resume`: which side draws this run. Refusals name the way in and buy nothing. */
35
+ export declare const chooseBranchEngine: (args: {
36
+ requested: BranchEngineRequest;
37
+ /** The engine a saved attempt started on (attempts recorded before engines existed are hosted). */
38
+ saved?: BranchEngine;
39
+ winner: "image" | "run";
40
+ env: NodeJS.ProcessEnv;
41
+ probe?: ReadinessProbe;
42
+ }) => Promise<BranchEngineChoice>;
43
+ export type WorkspaceBranchDecision = {
44
+ ok: true;
45
+ engine: BranchEngine;
46
+ reason: string;
47
+ } | {
48
+ ok: false;
49
+ failure: typeof OPTION_FAILURES.branchSignin;
50
+ reason: string;
51
+ };
52
+ /** A workspace's Branch request (hosted Design workspace or the local plugin's runner). */
53
+ export declare const workspaceBranchEngine: (args: {
54
+ codex: () => Promise<BranchCodexReadiness>;
55
+ signedIn: () => boolean;
56
+ }) => Promise<WorkspaceBranchDecision>;
57
+ /** A credential file this CLI cannot read is no sign-in either: `12ui auth login` writes a fresh one. */
58
+ export declare const hasTwelveUiSignIn: () => boolean;
59
+ /** The real decision for a workspace on this computer: its Codex, else its 12ui sign-in. */
60
+ export declare const defaultWorkspaceBranchEngine: (env: NodeJS.ProcessEnv, probe?: ReadinessProbe) => () => Promise<WorkspaceBranchDecision>;
61
+ //# sourceMappingUR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