@12ui/design 0.2.73 → 0.2.75

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 (142) hide show
  1. package/SKILL.md +1 -1
  2. package/dist/cli-codex-readiness.d.ts +19 -6
  3. package/dist/cli-codex-readiness.d.ts.map +1 -1
  4. package/dist/cli-codex-readiness.js +36 -16
  5. package/dist/cli-codex-readiness.js.map +1 -1
  6. package/dist/cli-help/design.d.ts +9 -2
  7. package/dist/cli-help/design.d.ts.map +1 -1
  8. package/dist/cli-help/design.js +17 -2
  9. package/dist/cli-help/design.js.map +1 -1
  10. package/dist/cli-help/index.d.ts +9 -2
  11. package/dist/cli-help/index.d.ts.map +1 -1
  12. package/dist/cli-run.d.ts.map +1 -1
  13. package/dist/cli-run.js +6 -0
  14. package/dist/cli-run.js.map +1 -1
  15. package/dist/cli-usage.d.ts.map +1 -1
  16. package/dist/cli-usage.js +1 -0
  17. package/dist/cli-usage.js.map +1 -1
  18. package/dist/cli-workspace-command.js +1 -1
  19. package/dist/cli-workspace-command.js.map +1 -1
  20. package/dist/cli-workspace-draw.d.ts +23 -0
  21. package/dist/cli-workspace-draw.d.ts.map +1 -0
  22. package/dist/cli-workspace-draw.js +97 -0
  23. package/dist/cli-workspace-draw.js.map +1 -0
  24. package/dist/codex-binary.d.ts +20 -0
  25. package/dist/codex-binary.d.ts.map +1 -0
  26. package/dist/codex-binary.js +46 -0
  27. package/dist/codex-binary.js.map +1 -0
  28. package/dist/mcp-slate-command.d.ts.map +1 -1
  29. package/dist/mcp-slate-command.js +6 -1
  30. package/dist/mcp-slate-command.js.map +1 -1
  31. package/dist/mcp-slate-tool-defs.js +3 -3
  32. package/dist/mcp-slate-tool-defs.js.map +1 -1
  33. package/dist/mcp-slate-ui-copy.d.ts +30 -19
  34. package/dist/mcp-slate-ui-copy.d.ts.map +1 -1
  35. package/dist/mcp-slate-ui-copy.js +51 -23
  36. package/dist/mcp-slate-ui-copy.js.map +1 -1
  37. package/dist/mcp-slate-ui-script-dialog.d.ts +15 -14
  38. package/dist/mcp-slate-ui-script-dialog.d.ts.map +1 -1
  39. package/dist/mcp-slate-ui-script-dialog.js +61 -72
  40. package/dist/mcp-slate-ui-script-dialog.js.map +1 -1
  41. package/dist/mcp-slate-ui-script-inline.d.ts.map +1 -1
  42. package/dist/mcp-slate-ui-script-inline.js +9 -6
  43. package/dist/mcp-slate-ui-script-inline.js.map +1 -1
  44. package/dist/mcp-slate-ui-script-inspiration.d.ts +3 -2
  45. package/dist/mcp-slate-ui-script-inspiration.d.ts.map +1 -1
  46. package/dist/mcp-slate-ui-script-inspiration.js +29 -9
  47. package/dist/mcp-slate-ui-script-inspiration.js.map +1 -1
  48. package/dist/mcp-slate-ui-script-more.d.ts +16 -14
  49. package/dist/mcp-slate-ui-script-more.d.ts.map +1 -1
  50. package/dist/mcp-slate-ui-script-more.js +120 -56
  51. package/dist/mcp-slate-ui-script-more.js.map +1 -1
  52. package/dist/mcp-slate-ui-script-remote.d.ts +2 -2
  53. package/dist/mcp-slate-ui-script-remote.js +2 -2
  54. package/dist/mcp-slate-ui-script-scribble.js +1 -1
  55. package/dist/mcp-slate-ui-script-stage.d.ts +3 -2
  56. package/dist/mcp-slate-ui-script-stage.d.ts.map +1 -1
  57. package/dist/mcp-slate-ui-script-stage.js +7 -8
  58. package/dist/mcp-slate-ui-script-stage.js.map +1 -1
  59. package/dist/mcp-slate-ui-script-state.js +3 -3
  60. package/dist/mcp-slate-ui-script.d.ts +1 -2
  61. package/dist/mcp-slate-ui-script.d.ts.map +1 -1
  62. package/dist/mcp-slate-ui-script.js +6 -4
  63. package/dist/mcp-slate-ui-script.js.map +1 -1
  64. package/dist/mcp-slate-ui-styles-dialog.d.ts +12 -9
  65. package/dist/mcp-slate-ui-styles-dialog.d.ts.map +1 -1
  66. package/dist/mcp-slate-ui-styles-dialog.js +48 -26
  67. package/dist/mcp-slate-ui-styles-dialog.js.map +1 -1
  68. package/dist/mcp-slate-ui-styles-stage.d.ts +15 -8
  69. package/dist/mcp-slate-ui-styles-stage.d.ts.map +1 -1
  70. package/dist/mcp-slate-ui-styles-stage.js +32 -18
  71. package/dist/mcp-slate-ui-styles-stage.js.map +1 -1
  72. package/dist/mcp-slate-ui-styles.d.ts +5 -0
  73. package/dist/mcp-slate-ui-styles.d.ts.map +1 -1
  74. package/dist/mcp-slate-ui-styles.js +21 -6
  75. package/dist/mcp-slate-ui-styles.js.map +1 -1
  76. package/dist/mcp-slate-ui.d.ts.map +1 -1
  77. package/dist/mcp-slate-ui.js +4 -3
  78. package/dist/mcp-slate-ui.js.map +1 -1
  79. package/dist/slate-actions.d.ts +7 -2
  80. package/dist/slate-actions.d.ts.map +1 -1
  81. package/dist/slate-actions.js +14 -8
  82. package/dist/slate-actions.js.map +1 -1
  83. package/dist/slate-handoff-options.d.ts +1 -1
  84. package/dist/slate-handoff-options.d.ts.map +1 -1
  85. package/dist/slate-handoff-options.js +8 -18
  86. package/dist/slate-handoff-options.js.map +1 -1
  87. package/dist/slate-image-executor.js +1 -1
  88. package/dist/slate-image-executor.js.map +1 -1
  89. package/dist/slate-inspiration.d.ts +1 -1
  90. package/dist/slate-inspiration.js +1 -1
  91. package/dist/slate-local-image.d.ts +3 -6
  92. package/dist/slate-local-image.d.ts.map +1 -1
  93. package/dist/slate-local-image.js +2 -18
  94. package/dist/slate-local-image.js.map +1 -1
  95. package/dist/slate-view-contract.d.ts +2 -3
  96. package/dist/slate-view-contract.d.ts.map +1 -1
  97. package/dist/slate-workspace-parse.d.ts.map +1 -1
  98. package/dist/slate-workspace-parse.js +6 -1
  99. package/dist/slate-workspace-parse.js.map +1 -1
  100. package/dist/workspace-draw-client.d.ts +69 -0
  101. package/dist/workspace-draw-client.d.ts.map +1 -0
  102. package/dist/workspace-draw-client.js +193 -0
  103. package/dist/workspace-draw-client.js.map +1 -0
  104. package/dist/workspace-draw-codex.d.ts +49 -0
  105. package/dist/workspace-draw-codex.d.ts.map +1 -0
  106. package/dist/workspace-draw-codex.js +89 -0
  107. package/dist/workspace-draw-codex.js.map +1 -0
  108. package/dist/workspace-draw-engine.d.ts +39 -0
  109. package/dist/workspace-draw-engine.d.ts.map +1 -0
  110. package/dist/workspace-draw-engine.js +72 -0
  111. package/dist/workspace-draw-engine.js.map +1 -0
  112. package/dist/workspace-draw-messages.d.ts +45 -0
  113. package/dist/workspace-draw-messages.d.ts.map +1 -0
  114. package/dist/workspace-draw-messages.js +48 -0
  115. package/dist/workspace-draw-messages.js.map +1 -0
  116. package/dist/workspace-draw-run.d.ts +43 -0
  117. package/dist/workspace-draw-run.d.ts.map +1 -0
  118. package/dist/workspace-draw-run.js +328 -0
  119. package/dist/workspace-draw-run.js.map +1 -0
  120. package/dist/workspace-draw-store.d.ts +23 -0
  121. package/dist/workspace-draw-store.d.ts.map +1 -0
  122. package/dist/workspace-draw-store.js +65 -0
  123. package/dist/workspace-draw-store.js.map +1 -0
  124. package/dist/workspace-draw-types.d.ts +121 -0
  125. package/dist/workspace-draw-types.d.ts.map +1 -0
  126. package/dist/workspace-draw-types.js +21 -0
  127. package/dist/workspace-draw-types.js.map +1 -0
  128. package/open-design.json +2 -2
  129. package/package.json +1 -1
  130. package/runtime/codex-conversion/src/codex/home.mjs +43 -14
  131. package/runtime/codex-conversion/src/images/native-files.mjs +20 -0
  132. package/runtime/codex-conversion/src/images/native-invoke.mjs +5 -2
  133. package/runtime/codex-conversion/src/images/native-records.mjs +75 -3
  134. package/runtime/codex-conversion/src/images/native.mjs +7 -4
  135. package/dist/mcp-slate-ui-script-thumbtools.d.ts +0 -23
  136. package/dist/mcp-slate-ui-script-thumbtools.d.ts.map +0 -1
  137. package/dist/mcp-slate-ui-script-thumbtools.js +0 -103
  138. package/dist/mcp-slate-ui-script-thumbtools.js.map +0 -1
  139. package/dist/mcp-slate-ui-styles-thumbtools.d.ts +0 -10
  140. package/dist/mcp-slate-ui-styles-thumbtools.d.ts.map +0 -1
  141. package/dist/mcp-slate-ui-styles-thumbtools.js +0 -25
  142. package/dist/mcp-slate-ui-styles-thumbtools.js.map +0 -1
@@ -0,0 +1,328 @@
1
+ import { packageIdentity } from './client-version.js';
2
+ import { createDrawClient, DrawHttpError, DrawTransportError } from './workspace-draw-client.js';
3
+ import { drawOptionWithCodex } from './workspace-draw-codex.js';
4
+ import { chooseEngine } from './workspace-draw-engine.js';
5
+ import { DRAW_MESSAGES, OPTION_FAILURES } from './workspace-draw-messages.js';
6
+ import { defaultDataRoot, opRootOf, readPreviousRecord, takeOpLock, writeRecord } from './workspace-draw-store.js';
7
+ import { DRAW_EXIT_CODES, RECORD_SCHEMA, } from './workspace-draw-types.js';
8
+ class DrawAbort extends Error {
9
+ abort;
10
+ constructor(abort) {
11
+ super(abort.message);
12
+ this.abort = abort;
13
+ }
14
+ }
15
+ /** Server and transport failures, as the command's refusal codes. Anything else is a fault and is thrown. */
16
+ export const abortOf = (error) => {
17
+ if (error instanceof DrawAbort)
18
+ return error.abort;
19
+ if (error instanceof DrawTransportError) {
20
+ if (error.kind === 'unreachable')
21
+ return { code: 'needs_escalation', message: DRAW_MESSAGES.unreachable() };
22
+ if (error.kind === 'corrupt')
23
+ return { code: 'needs_escalation', message: DRAW_MESSAGES.serverFault() };
24
+ return { code: 'cli_outdated', message: DRAW_MESSAGES.cliOutdated() };
25
+ }
26
+ if (error instanceof DrawHttpError) {
27
+ if (error.status === 426 || error.code === 'cli_outdated')
28
+ return { code: 'cli_outdated', message: DRAW_MESSAGES.cliOutdated() };
29
+ if (error.code === 'token_invalid')
30
+ return { code: 'token_invalid', message: DRAW_MESSAGES.tokenInvalid() };
31
+ if (error.code === 'unknown_op')
32
+ return { code: 'unknown_op', message: DRAW_MESSAGES.unknownOp() };
33
+ if (error.code === 'not_a_drawing_request')
34
+ return { code: 'unknown_op', message: DRAW_MESSAGES.notDrawing() };
35
+ return { code: 'needs_escalation', message: DRAW_MESSAGES.serverFault() };
36
+ }
37
+ return null;
38
+ };
39
+ const refusal = (opId, abort) => ({
40
+ exitCode: DRAW_EXIT_CODES[abort.code],
41
+ output: { ok: false, code: abort.code, op: opId, message: abort.message, record: null },
42
+ });
43
+ /** The precedence of run-level outcomes when several options fail differently: the one a rerun most needs first. */
44
+ const ABORT_PRECEDENCE = ['cli_outdated', 'token_invalid', 'unknown_op', 'needs_escalation'];
45
+ const imageNames = (plan) => [...new Set(plan.options.flatMap((option) => option.images.map((image) => image.name)))];
46
+ const imageRecords = (option, fetched) => option.images.map((image) => {
47
+ const bytes = fetched.get(image.name);
48
+ return { name: image.name, referenceId: image.referenceId ?? bytes.referenceId, versionId: image.versionId, sha256: bytes.sha256, mimeType: bytes.mimeType };
49
+ });
50
+ export const runWorkspaceDraw = async (args, deps = {}) => {
51
+ const env = deps.env ?? process.env;
52
+ // 1. Sandbox gate: before any network call, file write or dispatch.
53
+ if ((env.CODEX_SANDBOX ?? '') !== '')
54
+ return refusal(args.opId, { code: 'needs_escalation', message: DRAW_MESSAGES.needsEscalation() });
55
+ const clock = deps.now ?? (() => new Date());
56
+ const progress = deps.progress ?? (() => undefined);
57
+ const cliVersion = deps.cliVersion ?? packageIdentity().version;
58
+ const client = createDrawClient({
59
+ origin: args.origin,
60
+ token: args.token,
61
+ opId: args.opId,
62
+ cliVersion,
63
+ ...(deps.fetch ? { fetch: deps.fetch } : {}),
64
+ ...(deps.sleep ? { sleep: deps.sleep } : {}),
65
+ });
66
+ const opRoot = opRootOf(deps.dataRoot ?? defaultDataRoot(env), args.opId);
67
+ // 2. Op lock (a dry run draws nothing and writes nothing, so it takes none).
68
+ const lock = args.dryRun ? null : await takeOpLock(opRoot);
69
+ if (!args.dryRun && !lock)
70
+ return refusal(args.opId, { code: 'op_in_progress', message: DRAW_MESSAGES.opInProgress() });
71
+ try {
72
+ const startedAt = clock();
73
+ // 3. The plan and every image it names, each checked against its sha256.
74
+ let plan;
75
+ const fetched = new Map();
76
+ try {
77
+ plan = await client.plan();
78
+ const names = imageNames(plan);
79
+ const images = await Promise.all(names.map((name) => client.image(name)));
80
+ names.forEach((name, index) => fetched.set(name, images[index]));
81
+ }
82
+ catch (error) {
83
+ const abort = abortOf(error);
84
+ if (!abort)
85
+ throw error;
86
+ return refusal(args.opId, abort);
87
+ }
88
+ // 4. Codex readiness, once for the whole op.
89
+ const choice = await chooseEngine({ env, ...(deps.probe ? { probe: deps.probe } : {}) });
90
+ if (!choice.ok) {
91
+ const refused = { ok: false, code: 'no_engine', op: args.opId, engine: null, engineReason: choice.reason, message: DRAW_MESSAGES.noEngine(choice.check) };
92
+ // A dry run, or `--engine codex`, asked only whether Codex can draw: nothing is pushed.
93
+ if (args.dryRun || args.engine === 'codex') {
94
+ return { exitCode: DRAW_EXIT_CODES.no_engine, output: { ...refused, ...(args.dryRun ? { dryRun: true } : {}), record: null } };
95
+ }
96
+ const unavailable = await recordCodexUnavailable({ args, plan, fetched, client, opRoot, clock, startedAt, cliVersion, reason: choice.reason, progress });
97
+ // A refused push (a stale token, say) is what a rerun needs first; with nothing waiting to be drawn, the
98
+ // request is reported as it stands, whatever Codex can do now.
99
+ const outcome = outcomeOf(plan, unavailable.runs);
100
+ const pending = plan.options.some((option) => option.state === 'pending');
101
+ if (ABORT_PRECEDENCE.includes(outcome.code) || !pending) {
102
+ const code = outcome.code;
103
+ return { exitCode: DRAW_EXIT_CODES[code], output: { ...refused, ok: DRAW_EXIT_CODES[code] === 0, code, message: outcome.message, record: unavailable.recordPath } };
104
+ }
105
+ return { exitCode: DRAW_EXIT_CODES.no_engine, output: { ...refused, record: unavailable.recordPath } };
106
+ }
107
+ if (args.dryRun)
108
+ return dryRun(plan, fetched, choice, args.opId);
109
+ // 5-7. Every pending option at once; each settles on its own.
110
+ const previous = await readPreviousRecord(opRoot);
111
+ const runs = await Promise.all(plan.options.map((option) => drawOption({
112
+ option, fetched, engine: choice.engine, client, env, opRoot, clock, previous, deps,
113
+ }).then((run) => {
114
+ progress(progressLine(run, choice.engine));
115
+ return run;
116
+ })));
117
+ // 8. The record, then the outcome.
118
+ const finishedAt = clock();
119
+ const record = {
120
+ schema: RECORD_SCHEMA,
121
+ opId: args.opId,
122
+ origin: args.origin,
123
+ cliVersion,
124
+ engine: choice.engine,
125
+ engineReason: choice.reason,
126
+ codex: choice.codex,
127
+ plan: { planDigest: plan.planDigest, promptRevision: plan.promptRevision, kind: plan.kind, mode: plan.mode },
128
+ startedAt: startedAt.toISOString(),
129
+ finishedAt: finishedAt.toISOString(),
130
+ wallMs: finishedAt.getTime() - startedAt.getTime(),
131
+ options: runs.map((run) => run.record),
132
+ };
133
+ const recordPath = await writeRecord(opRoot, record);
134
+ const { code, message } = outcomeOf(plan, runs);
135
+ return {
136
+ exitCode: DRAW_EXIT_CODES[code],
137
+ output: {
138
+ ok: DRAW_EXIT_CODES[code] === 0,
139
+ code,
140
+ op: args.opId,
141
+ engine: choice.engine,
142
+ engineReason: choice.reason,
143
+ options: runs.map((run) => ({
144
+ key: run.record.key,
145
+ state: run.record.state,
146
+ label: run.record.label,
147
+ versionId: run.record.versionId,
148
+ ms: run.ms,
149
+ ...(run.record.failure ? { failure: run.record.failure } : {}),
150
+ })),
151
+ noReference: plan.options.filter((option) => option.noReferenceReason !== null).map((option) => option.key),
152
+ message,
153
+ record: recordPath,
154
+ },
155
+ };
156
+ }
157
+ finally {
158
+ await lock?.release();
159
+ }
160
+ };
161
+ /** Each option's exact Codex request (the plan's prompt, the fetched bytes in order, the frame); draws nothing. */
162
+ const dryRun = (plan, fetched, choice, opId) => ({
163
+ exitCode: 0,
164
+ output: {
165
+ ok: true,
166
+ dryRun: true,
167
+ op: opId,
168
+ engine: choice.engine,
169
+ engineReason: choice.reason,
170
+ codex: { binary: choice.codex.binary, version: choice.codex.version, home: choice.codex.home },
171
+ planDigest: plan.planDigest,
172
+ promptRevision: plan.promptRevision,
173
+ options: plan.options.map((option) => ({
174
+ key: option.key,
175
+ callId: option.callId,
176
+ prompt: option.prompt,
177
+ promptSha256: option.promptSha256,
178
+ images: imageRecords(option, fetched).map(({ mimeType: _mimeType, ...image }) => image),
179
+ frame: option.frame,
180
+ })),
181
+ },
182
+ });
183
+ /**
184
+ * Codex cannot draw here and there is no other engine (decision D2-B): push each pending option's fixed failure so
185
+ * the screen stops waiting, spend nothing, and keep a run record of it. Returns the record's path.
186
+ */
187
+ const recordCodexUnavailable = async (context) => {
188
+ const { plan, client, clock } = context;
189
+ const runs = await Promise.all(plan.options.map(async (option) => {
190
+ const started = clock().toISOString();
191
+ const base = {
192
+ key: option.key, callId: option.callId, engine: null, prompt: option.prompt, promptSha256: option.promptSha256,
193
+ images: imageRecords(option, context.fetched), frame: option.frame, startedAt: started, finishedAt: started,
194
+ state: 'failed', failure: option.failure, versionId: option.versionId, label: option.label,
195
+ };
196
+ if (option.state === 'filled')
197
+ return { record: { ...base, state: 'replayed' }, ms: 0, drawnThisRun: false };
198
+ if (option.state === 'failed')
199
+ return { record: base, ms: 0, drawnThisRun: false };
200
+ let failure = OPTION_FAILURES.codexUnavailable;
201
+ let abort;
202
+ try {
203
+ await client.push(option.key, { reason: OPTION_FAILURES.codexUnavailable });
204
+ }
205
+ catch (error) {
206
+ abort = abortOf(error) ?? undefined;
207
+ if (!abort)
208
+ throw error;
209
+ failure = abort.message;
210
+ }
211
+ context.progress(`12ui workspace draw: ${option.key} not drawn: ${failure}`);
212
+ return { record: { ...base, failure, finishedAt: clock().toISOString() }, ms: 0, drawnThisRun: true, ...(abort ? { abort } : {}) };
213
+ }));
214
+ const finishedAt = clock();
215
+ const recordPath = await writeRecord(context.opRoot, {
216
+ schema: RECORD_SCHEMA,
217
+ opId: context.args.opId,
218
+ origin: context.args.origin,
219
+ cliVersion: context.cliVersion,
220
+ engine: null,
221
+ engineReason: context.reason,
222
+ codex: null,
223
+ plan: { planDigest: plan.planDigest, promptRevision: plan.promptRevision, kind: plan.kind, mode: plan.mode },
224
+ startedAt: context.startedAt.toISOString(),
225
+ finishedAt: finishedAt.toISOString(),
226
+ wallMs: finishedAt.getTime() - context.startedAt.getTime(),
227
+ options: runs.map((run) => run.record),
228
+ });
229
+ return { recordPath, runs };
230
+ };
231
+ const drawOption = async (context) => {
232
+ const { option, engine, client, clock } = context;
233
+ const started = clock();
234
+ const base = {
235
+ key: option.key,
236
+ callId: option.callId,
237
+ engine,
238
+ prompt: option.prompt,
239
+ promptSha256: option.promptSha256,
240
+ images: imageRecords(option, context.fetched),
241
+ frame: option.frame,
242
+ startedAt: started.toISOString(),
243
+ finishedAt: started.toISOString(),
244
+ state: 'failed',
245
+ failure: null,
246
+ versionId: null,
247
+ label: null,
248
+ };
249
+ const finish = (record, extra = {}) => {
250
+ const finished = clock();
251
+ return {
252
+ record: { ...base, ...record, finishedAt: finished.toISOString() },
253
+ ms: finished.getTime() - started.getTime(),
254
+ drawnThisRun: true,
255
+ ...extra,
256
+ };
257
+ };
258
+ if (option.state !== 'pending') {
259
+ // Already resolved on the server: a replay. An earlier run's entry keeps its call directory and timings.
260
+ const earlier = context.previous?.options.find((entry) => entry.key === option.key && entry.callId === option.callId);
261
+ const resolved = option.state === 'filled'
262
+ ? { state: 'replayed', versionId: option.versionId, label: option.label, failure: null }
263
+ : { state: 'failed', versionId: null, label: null, failure: option.failure };
264
+ return { record: { ...(earlier ?? base), ...resolved }, ms: 0, drawnThisRun: false };
265
+ }
266
+ try {
267
+ const result = await drawOptionWithCodex({
268
+ root: context.opRoot,
269
+ env: context.env,
270
+ option,
271
+ images: option.images.map((image) => context.fetched.get(image.name).bytes),
272
+ ...(context.deps.executorFactory ? { executorFactory: context.deps.executorFactory } : {}),
273
+ });
274
+ if (result.kind === 'environment') {
275
+ return finish({ codex: result.details, failure: result.error }, { codexEnvironment: result.error });
276
+ }
277
+ // 6. Push this option as soon as it lands.
278
+ const pushed = await client.push(option.key, result.kind === 'drawn' ? { png: result.png } : { reason: result.failure });
279
+ return finish({
280
+ codex: result.details,
281
+ state: pushed.state,
282
+ label: pushed.label,
283
+ versionId: pushed.versionId,
284
+ failure: result.kind === 'failed' ? result.failure : null,
285
+ });
286
+ }
287
+ catch (error) {
288
+ if (error instanceof DrawHttpError && error.code === 'option_already_resolved') {
289
+ return finish({ failure: 'This option was already resolved with a different result.' });
290
+ }
291
+ const abort = abortOf(error);
292
+ if (!abort)
293
+ throw error;
294
+ return finish({ failure: abort.message }, { abort });
295
+ }
296
+ };
297
+ const progressLine = (run, engine) => {
298
+ const { record } = run;
299
+ const seconds = `${(run.ms / 1000).toFixed(1)} s`;
300
+ if (record.state === 'replayed')
301
+ return `12ui workspace draw: ${record.key} was already added as ${record.label ?? record.versionId}`;
302
+ if (record.state === 'filled')
303
+ return `12ui workspace draw: ${record.key} added as ${record.label ?? record.versionId} (${engine}, ${seconds})`;
304
+ return `12ui workspace draw: ${record.key} failed (${engine}, ${seconds}): ${record.failure ?? 'no image'}`;
305
+ };
306
+ const outcomeOf = (plan, runs) => {
307
+ for (const code of ABORT_PRECEDENCE) {
308
+ const hit = runs.find((run) => run.abort?.code === code);
309
+ if (hit?.abort)
310
+ return hit.abort;
311
+ }
312
+ if (runs.some((run) => run.codexEnvironment))
313
+ return { code: 'no_engine', message: DRAW_MESSAGES.codexStopped() };
314
+ const total = runs.length;
315
+ const failed = runs.filter((run) => run.record.state === 'failed').length;
316
+ const drawn = runs.filter((run) => run.drawnThisRun);
317
+ if (failed === 0) {
318
+ if (drawn.length === 0)
319
+ return { code: 'replayed', message: DRAW_MESSAGES.replayed({ count: total }) };
320
+ const edit = plan.kind === 'edit';
321
+ return { code: 'done', message: DRAW_MESSAGES.added({ count: drawn.length, edit, label: drawn[0]?.record.label ?? null }) };
322
+ }
323
+ const added = total - failed;
324
+ return added > 0
325
+ ? { code: 'partial', message: DRAW_MESSAGES.partial({ added, total }) }
326
+ : { code: 'failed', message: DRAW_MESSAGES.failed({ total }) };
327
+ };
328
+ //# sourceMappingURL=workspace-draw-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-draw-run.js","sourceRoot":"","sources":["../src/workspace-draw-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,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, holding the op lock, the
4
+ * codex call store (`calls/`) and the run record (`run.json`). Nothing here is created before the sandbox gate has
5
+ * passed and the command is about to draw.
6
+ */
7
+ export declare const opRootOf: (dataRoot: string, opId: string) => string;
8
+ export declare const defaultDataRoot: (env: NodeJS.ProcessEnv) => string;
9
+ export type OpLock = {
10
+ release: () => Promise<void>;
11
+ };
12
+ /**
13
+ * The op lock: one live run per op on this machine. A holder is alive while its process is and its heartbeat (the
14
+ * lock file's mtime, touched every few seconds) is fresh; a dead or silent holder's lock is taken over. Null when a
15
+ * live run holds it.
16
+ */
17
+ export declare const takeOpLock: (opRoot: string) => Promise<OpLock | null>;
18
+ export declare const recordPathOf: (opRoot: string) => string;
19
+ /** The record an earlier run left, if it is one this command wrote. */
20
+ export declare const readPreviousRecord: (opRoot: string) => Promise<DrawRecord | null>;
21
+ /** Replace the record atomically: a reader never sees half a file. */
22
+ export declare const writeRecord: (opRoot: string, record: DrawRecord) => Promise<string>;
23
+ //# sourceMappingURL=workspace-draw-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-draw-store.d.ts","sourceRoot":"","sources":["../src/workspace-draw-store.ts"],"names":[],"mappings":"AAMA,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE3E;;;;GAIG;AAEH,eAAO,MAAM,QAAQ,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,KAAG,MAAqD,CAAC;AAEhH,eAAO,MAAM,eAAe,GAAI,KAAK,MAAM,CAAC,UAAU,KAAG,MAA+C,CAAC;AAEzG,MAAM,MAAM,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAiBtE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAAuC,CAAC;AAEtF,uEAAuE;AACvE,eAAO,MAAM,kBAAkB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAQlF,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,WAAW,GAAU,QAAQ,MAAM,EAAE,QAAQ,UAAU,KAAG,OAAO,CAAC,MAAM,CAUpF,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { resolveCliInstallLayout } from './cli-persistence.js';
5
+ import { acquireLock, RUNNER_HEARTBEAT_INTERVAL_MS, staleWhenHeartbeatLapsed } from './slate-lock.js';
6
+ import { RECORD_SCHEMA } from './workspace-draw-types.js';
7
+ /**
8
+ * Where one request's draws live on this machine: `<data root>/workspace-draw/<opId>/`, holding the op lock, the
9
+ * codex call store (`calls/`) and the run record (`run.json`). Nothing here is created before the sandbox gate has
10
+ * passed and the command is about to draw.
11
+ */
12
+ export const opRootOf = (dataRoot, opId) => path.join(dataRoot, 'workspace-draw', opId);
13
+ export const defaultDataRoot = (env) => resolveCliInstallLayout(env).dataRoot;
14
+ /**
15
+ * The op lock: one live run per op on this machine. A holder is alive while its process is and its heartbeat (the
16
+ * lock file's mtime, touched every few seconds) is fresh; a dead or silent holder's lock is taken over. Null when a
17
+ * live run holds it.
18
+ */
19
+ export const takeOpLock = async (opRoot) => {
20
+ await mkdir(opRoot, { recursive: true });
21
+ let lock;
22
+ try {
23
+ lock = await acquireLock({ file: path.join(opRoot, 'lock'), policy: staleWhenHeartbeatLapsed, waitMs: 0 });
24
+ }
25
+ catch (error) {
26
+ if (error.code === 'workspace_busy')
27
+ return null;
28
+ throw error;
29
+ }
30
+ const heartbeat = setInterval(() => { void lock.touch().catch(() => undefined); }, RUNNER_HEARTBEAT_INTERVAL_MS);
31
+ heartbeat.unref();
32
+ return {
33
+ release: async () => {
34
+ clearInterval(heartbeat);
35
+ await lock.release();
36
+ },
37
+ };
38
+ };
39
+ export const recordPathOf = (opRoot) => path.join(opRoot, 'run.json');
40
+ /** The record an earlier run left, if it is one this command wrote. */
41
+ export const readPreviousRecord = async (opRoot) => {
42
+ try {
43
+ const parsed = JSON.parse(await readFile(recordPathOf(opRoot), 'utf8'));
44
+ return parsed?.schema === RECORD_SCHEMA ? parsed : null;
45
+ }
46
+ catch (error) {
47
+ if (error.code === 'ENOENT' || error instanceof SyntaxError)
48
+ return null;
49
+ throw error;
50
+ }
51
+ };
52
+ /** Replace the record atomically: a reader never sees half a file. */
53
+ export const writeRecord = async (opRoot, record) => {
54
+ const file = recordPathOf(opRoot);
55
+ const temporary = `${file}.${randomUUID()}.tmp`;
56
+ try {
57
+ await writeFile(temporary, `${JSON.stringify(record, null, 2)}\n`, { flag: 'wx' });
58
+ await rename(temporary, file);
59
+ }
60
+ finally {
61
+ await rm(temporary, { force: true });
62
+ }
63
+ return file;
64
+ };
65
+ //# sourceMappingURL=workspace-draw-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-draw-store.js","sourceRoot":"","sources":["../src/workspace-draw-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACtG,OAAO,EAAE,aAAa,EAAmB,MAAM,2BAA2B,CAAC;AAE3E;;;;GAIG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,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B,EAAE;IACrF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAe,CAAC;QACtF,OAAO,MAAM,EAAE,MAAM,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,YAAY,WAAW;YAAE,OAAO,IAAI,CAAC;QACpG,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,MAAc,EAAE,MAAkB,EAAmB,EAAE;IACvF,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,UAAU,EAAE,MAAM,CAAC;IAChD,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnF,MAAM,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * The shapes `12ui workspace draw` reads and writes: the frozen draw plan design.12ui.com serves (interface I1,
3
+ * `GET /api/v1/slate/ops/{opId}/plan`), and the command's own outcome codes and run record (interface I2).
4
+ */
5
+ export type PlanImageName = 'parent' | 'annotated' | `ref-${number}`;
6
+ export type SlatePlanImage = {
7
+ name: PlanImageName;
8
+ role: 'parent' | 'annotated' | 'reference';
9
+ referenceId: string | null;
10
+ versionId: string | null;
11
+ };
12
+ export type SlatePlanOption = {
13
+ key: string;
14
+ callId: string;
15
+ prompt: string;
16
+ promptSha256: string;
17
+ images: SlatePlanImage[];
18
+ frame: {
19
+ width: number;
20
+ height: number;
21
+ };
22
+ noReferenceReason: 'search_rate_limited' | 'search_unavailable' | 'too_few_fresh' | 'no_query' | null;
23
+ state: 'pending' | 'filled' | 'failed';
24
+ versionId: string | null;
25
+ label: string | null;
26
+ failure: string | null;
27
+ };
28
+ export type SlateDrawPlan = {
29
+ schema: '12ui.slate.plan/1';
30
+ workspace: string;
31
+ opId: string;
32
+ kind: 'round' | 'edit';
33
+ mode: 'root' | 'new' | 'like' | 'edit';
34
+ promptRevision: string;
35
+ planDigest: string;
36
+ state: 'running' | 'succeeded' | 'failed' | 'interrupted';
37
+ options: SlatePlanOption[];
38
+ };
39
+ export declare const PLAN_SCHEMA = "12ui.slate.plan/1";
40
+ /** The `code` field of the command's JSON line, and the exit code each one carries (I2). */
41
+ export declare const DRAW_EXIT_CODES: {
42
+ readonly done: 0;
43
+ readonly replayed: 0;
44
+ readonly partial: 1;
45
+ readonly failed: 1;
46
+ readonly token_invalid: 2;
47
+ readonly unknown_op: 2;
48
+ readonly op_in_progress: 2;
49
+ readonly usage: 2;
50
+ readonly needs_escalation: 3;
51
+ readonly no_engine: 4;
52
+ readonly cli_outdated: 5;
53
+ };
54
+ export type DrawCode = keyof typeof DRAW_EXIT_CODES;
55
+ /** The one engine of this release (decision D2-B): drawing on 12ui needs a 12ui sign-in and is not part of the command. */
56
+ export type DrawEngine = 'codex';
57
+ export type DrawImageRecord = {
58
+ name: string;
59
+ referenceId: string | null;
60
+ versionId: string | null;
61
+ sha256: string;
62
+ mimeType: string;
63
+ };
64
+ export type DrawOptionCodex = {
65
+ callDir: string;
66
+ tempHome: string;
67
+ tempHomeRemoved: boolean;
68
+ rollouts: string[];
69
+ imageGenCalls: number;
70
+ promptVerbatim: boolean | null;
71
+ revisedPrompt: string | null;
72
+ };
73
+ export type DrawOptionRecord = {
74
+ key: string;
75
+ callId: string;
76
+ /** Null when Codex could not draw and nothing was drawn (the option's failure was pushed). */
77
+ engine: DrawEngine | null;
78
+ prompt: string;
79
+ promptSha256: string;
80
+ images: DrawImageRecord[];
81
+ frame: {
82
+ width: number;
83
+ height: number;
84
+ };
85
+ startedAt: string;
86
+ finishedAt: string;
87
+ state: 'filled' | 'failed' | 'replayed';
88
+ failure: string | null;
89
+ versionId: string | null;
90
+ label: string | null;
91
+ codex?: DrawOptionCodex;
92
+ };
93
+ export type DrawRecordCodex = {
94
+ binary: string;
95
+ version: string;
96
+ home: string;
97
+ threadId: string | null;
98
+ sameHomeRollout: string | null;
99
+ };
100
+ export type DrawRecord = {
101
+ schema: '12ui.workspace.draw-record/1';
102
+ opId: string;
103
+ origin: string;
104
+ cliVersion: string;
105
+ /** Null when Codex could not draw here: the run spent nothing and pushed each pending option's failure. */
106
+ engine: DrawEngine | null;
107
+ engineReason: string;
108
+ codex: DrawRecordCodex | null;
109
+ plan: {
110
+ planDigest: string;
111
+ promptRevision: string;
112
+ kind: string;
113
+ mode: string;
114
+ };
115
+ startedAt: string;
116
+ finishedAt: string;
117
+ wallMs: number;
118
+ options: DrawOptionRecord[];
119
+ };
120
+ export declare const RECORD_SCHEMA = "12ui.workspace.draw-record/1";
121
+ //# sourceMappingURL=workspace-draw-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-draw-types.d.ts","sourceRoot":"","sources":["../src/workspace-draw-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,MAAM,EAAE,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CA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AAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEzI,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,8BAA8B,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,2GAA2G;IAC3G,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAC9B,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjF,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,aAAa,iCAAiC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The shapes `12ui workspace draw` reads and writes: the frozen draw plan design.12ui.com serves (interface I1,
3
+ * `GET /api/v1/slate/ops/{opId}/plan`), and the command's own outcome codes and run record (interface I2).
4
+ */
5
+ export const PLAN_SCHEMA = '12ui.slate.plan/1';
6
+ /** The `code` field of the command's JSON line, and the exit code each one carries (I2). */
7
+ export const DRAW_EXIT_CODES = {
8
+ done: 0,
9
+ replayed: 0,
10
+ partial: 1,
11
+ failed: 1,
12
+ token_invalid: 2,
13
+ unknown_op: 2,
14
+ op_in_progress: 2,
15
+ usage: 2,
16
+ needs_escalation: 3,
17
+ no_engine: 4,
18
+ cli_outdated: 5,
19
+ };
20
+ export const RECORD_SCHEMA = '12ui.workspace.draw-record/1';
21
+ //# sourceMappingURL=workspace-draw-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-draw-types.js","sourceRoot":"","sources":["../src/workspace-draw-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqCH,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAE/C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,CAAC;IACjB,KAAK,EAAE,CAAC;IACR,gBAAgB,EAAE,CAAC;IACnB,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;CACP,CAAC;AAsDX,MAAM,CAAC,MAAM,aAAa,GAAG,8BAA8B,CAAC"}
package/open-design.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "specVersion": "1.0.0",
4
4
  "name": "12ui-design",
5
5
  "title": "12UI Design",
6
- "version": "0.2.73",
6
+ "version": "0.2.75",
7
7
  "description": "Explore corpus-grounded interface directions, choose one, and convert it into production-ready responsive or native artifacts with 12UI.",
8
8
  "author": {
9
9
  "name": "Just Every",
@@ -49,7 +49,7 @@
49
49
  "command": "npx",
50
50
  "args": [
51
51
  "-y",
52
- "@12ui/design@0.2.73",
52
+ "@12ui/design@0.2.75",
53
53
  "mcp"
54
54
  ]
55
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12ui/design",
3
- "version": "0.2.73",
3
+ "version": "0.2.75",
4
4
  "type": "module",
5
5
  "description": "The canonical 12ui CLI, SDK, MCP server, and visual interface design skills",
6
6
  "main": "dist/index.js",