@12ui/design 0.2.16 → 0.2.18

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 (105) hide show
  1. package/README.md +22 -0
  2. package/dist/branch-client.d.ts +6 -1
  3. package/dist/branch-client.d.ts.map +1 -1
  4. package/dist/branch-client.js +6 -1
  5. package/dist/branch-client.js.map +1 -1
  6. package/dist/branch-status.d.ts.map +1 -1
  7. package/dist/branch-status.js +3 -2
  8. package/dist/branch-status.js.map +1 -1
  9. package/dist/branch-winner.d.ts +31 -0
  10. package/dist/branch-winner.d.ts.map +1 -0
  11. package/dist/branch-winner.js +121 -0
  12. package/dist/branch-winner.js.map +1 -0
  13. package/dist/cli-arguments.d.ts +1 -0
  14. package/dist/cli-arguments.d.ts.map +1 -1
  15. package/dist/cli-arguments.js +4 -3
  16. package/dist/cli-arguments.js.map +1 -1
  17. package/dist/cli-branch-command.d.ts +3 -0
  18. package/dist/cli-branch-command.d.ts.map +1 -1
  19. package/dist/cli-branch-command.js +66 -98
  20. package/dist/cli-branch-command.js.map +1 -1
  21. package/dist/cli-capabilities.d.ts +18 -0
  22. package/dist/cli-capabilities.d.ts.map +1 -1
  23. package/dist/cli-capabilities.js +23 -0
  24. package/dist/cli-capabilities.js.map +1 -1
  25. package/dist/cli-convert-command.d.ts +10 -0
  26. package/dist/cli-convert-command.d.ts.map +1 -0
  27. package/dist/cli-convert-command.js +307 -0
  28. package/dist/cli-convert-command.js.map +1 -0
  29. package/dist/cli-corpus-command.d.ts +6 -1
  30. package/dist/cli-corpus-command.d.ts.map +1 -1
  31. package/dist/cli-corpus-command.js +17 -21
  32. package/dist/cli-corpus-command.js.map +1 -1
  33. package/dist/cli-create-command.d.ts +5 -1
  34. package/dist/cli-create-command.d.ts.map +1 -1
  35. package/dist/cli-create-command.js +28 -12
  36. package/dist/cli-create-command.js.map +1 -1
  37. package/dist/cli-detach.d.ts.map +1 -1
  38. package/dist/cli-detach.js +10 -2
  39. package/dist/cli-detach.js.map +1 -1
  40. package/dist/cli-draft-command.d.ts +7 -0
  41. package/dist/cli-draft-command.d.ts.map +1 -1
  42. package/dist/cli-draft-command.js +6 -4
  43. package/dist/cli-draft-command.js.map +1 -1
  44. package/dist/cli-export-command.d.ts +24 -1
  45. package/dist/cli-export-command.d.ts.map +1 -1
  46. package/dist/cli-export-command.js +6 -3
  47. package/dist/cli-export-command.js.map +1 -1
  48. package/dist/cli-image-batch-command.d.ts +8 -2
  49. package/dist/cli-image-batch-command.d.ts.map +1 -1
  50. package/dist/cli-image-batch-command.js +15 -11
  51. package/dist/cli-image-batch-command.js.map +1 -1
  52. package/dist/cli-image-batch-resume.d.ts +3 -1
  53. package/dist/cli-image-batch-resume.d.ts.map +1 -1
  54. package/dist/cli-image-batch-resume.js +1 -0
  55. package/dist/cli-image-batch-resume.js.map +1 -1
  56. package/dist/cli-image-command.d.ts +3 -1
  57. package/dist/cli-image-command.d.ts.map +1 -1
  58. package/dist/cli-image-command.js +4 -2
  59. package/dist/cli-image-command.js.map +1 -1
  60. package/dist/cli-package-command.d.ts.map +1 -1
  61. package/dist/cli-package-command.js +4 -3
  62. package/dist/cli-package-command.js.map +1 -1
  63. package/dist/cli-refusal.d.ts +20 -0
  64. package/dist/cli-refusal.d.ts.map +1 -0
  65. package/dist/cli-refusal.js +29 -0
  66. package/dist/cli-refusal.js.map +1 -0
  67. package/dist/cli-run.d.ts +4 -0
  68. package/dist/cli-run.d.ts.map +1 -0
  69. package/dist/cli-run.js +215 -0
  70. package/dist/cli-run.js.map +1 -0
  71. package/dist/cli-select-command.d.ts +6 -1
  72. package/dist/cli-select-command.d.ts.map +1 -1
  73. package/dist/cli-select-command.js +9 -7
  74. package/dist/cli-select-command.js.map +1 -1
  75. package/dist/cli-usage.d.ts +17 -0
  76. package/dist/cli-usage.d.ts.map +1 -0
  77. package/dist/cli-usage.js +69 -0
  78. package/dist/cli-usage.js.map +1 -0
  79. package/dist/cli-version.d.ts +2 -0
  80. package/dist/cli-version.d.ts.map +1 -0
  81. package/dist/cli-version.js +8 -0
  82. package/dist/cli-version.js.map +1 -0
  83. package/dist/cli.js +9 -491
  84. package/dist/cli.js.map +1 -1
  85. package/dist/concept-input.d.ts +34 -0
  86. package/dist/concept-input.d.ts.map +1 -0
  87. package/dist/concept-input.js +41 -0
  88. package/dist/concept-input.js.map +1 -0
  89. package/dist/index.d.ts +7 -1
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +6 -0
  92. package/dist/index.js.map +1 -1
  93. package/dist/package-client.d.ts +36 -0
  94. package/dist/package-client.d.ts.map +1 -1
  95. package/dist/package-client.js +89 -1
  96. package/dist/package-client.js.map +1 -1
  97. package/dist/run-journal-commands.d.ts +54 -0
  98. package/dist/run-journal-commands.d.ts.map +1 -0
  99. package/dist/run-journal-commands.js +258 -0
  100. package/dist/run-journal-commands.js.map +1 -0
  101. package/dist/run-journal.d.ts +231 -0
  102. package/dist/run-journal.d.ts.map +1 -0
  103. package/dist/run-journal.js +453 -0
  104. package/dist/run-journal.js.map +1 -0
  105. package/package.json +1 -1
@@ -0,0 +1,453 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { closeSync, existsSync, openSync, writeSync } from 'node:fs';
3
+ import { readFile } from 'node:fs/promises';
4
+ import path from 'node:path';
5
+ import { CLI_BOOLEAN_FLAGS } from './cli-arguments.js';
6
+ import { isCliRefusal } from './cli-refusal.js';
7
+ /**
8
+ * The CLI run journal — the durable record of what the CLI actually did.
9
+ *
10
+ * WHY THIS EXISTS. The product left the shell: `12ui draft` collapsed three
11
+ * commands into one, `branch execute` detaches into its own process group, and
12
+ * a fused convert exports alongside itself. Every measurement pass since has
13
+ * made the same mistake in a new costume — the absence of a command in a shell
14
+ * transcript was read as the absence of work. It is not: the work moved into
15
+ * the CLI, and the shell stopped being able to see it. So the CLI writes down
16
+ * what it did, in the workspace the work belongs to, and that record — not a
17
+ * transcript, not narration — is what a reader scores.
18
+ *
19
+ * WHERE. `<workspace>/journal.jsonl`, one JSON object per line, where the
20
+ * workspace is the durable directory the command operates on: a draft run
21
+ * directory, a branch out-dir, a convert or export output directory. Commands
22
+ * with no workspace (`auth status`, `capabilities`, `create claim`, `mcp`) do
23
+ * not journal — see `run-journal-commands.ts`, which enumerates the whole
24
+ * surface and states a reason for every command that skips.
25
+ *
26
+ * ORDER AND DURABILITY.
27
+ * - Append-only. A line, once written, is never rewritten or removed.
28
+ * - Every append is ONE `write(2)` of a complete line under
29
+ * {@link RUN_JOURNAL_MAX_LINE_BYTES} to a descriptor opened `O_APPEND`, so
30
+ * concurrent appenders — the detached `branch execute` worker and the parent
31
+ * that spawned it share one file — never interleave mid-line.
32
+ * - Appends are synchronous so a line survives `process.exit` and so an exit
33
+ * backstop can close an unfinished command's record.
34
+ * - A reader must tolerate a torn final line: a writer can be interrupted
35
+ * between the append and the newline. {@link readRunJournal} reports it
36
+ * rather than throwing.
37
+ * - The journal never creates a directory. A workspace that never came into
38
+ * existence has no journal, which is the truthful record — nothing durable
39
+ * happened. Lines written before the workspace exists are held and flushed
40
+ * the moment it does.
41
+ *
42
+ * LINE SCHEMA v1. Field order below is the serialized order; readers must not
43
+ * depend on it.
44
+ *
45
+ * v always 1. A reader that does not know a version SKIPS the
46
+ * line and counts it, rather than guessing.
47
+ * ts ISO-8601 UTC, taken when the EVENT happened, which may be
48
+ * earlier than the append if the workspace appeared late.
49
+ * Wall clocks across processes are not ordered; file order
50
+ * is. Read order from the file, never from `ts`.
51
+ * cmd canonical command name: `branch execute`, `convert`,
52
+ * `convert package`, `draft status`. Never raw argv.
53
+ * args_digest sha256 of the normalized argv (positional order kept,
54
+ * flags sorted, values of sensitive flags replaced before
55
+ * hashing so the digest is stable across key rotation).
56
+ * Argv itself is never written down.
57
+ * run_id the service-side identity this command operates on, when
58
+ * it has one: a branch/create run id, a conversion id.
59
+ * idempotency_key the key that makes the paid call replayable.
60
+ * paid whether this command CAN spend money. A property of the
61
+ * command, not of the outcome.
62
+ * event "start" at command begin, "end" at exit.
63
+ * outcome end lines only: "ok" | "refused" | "error". A refusal is
64
+ * the CLI declining with nothing started (see
65
+ * `cli-refusal.ts`); an error is a failure.
66
+ * error_class end lines only, and only when not "ok". A closed
67
+ * vocabulary slug — never message text, never a path or an
68
+ * id. See {@link classifyRunJournalError}.
69
+ * artifacts paths this command produced. The AUTHORITATIVE records
70
+ * (a completion sentinel, a manifest, the written output),
71
+ * not every file: the records name the rest, and the line
72
+ * has a byte budget.
73
+ * purchased ids of anything bought — conversion ids, run ids, package
74
+ * ids.
75
+ * terminal whether the RUN this workspace holds is in a terminal
76
+ * state after this event, as best this command knows. A
77
+ * start line is never terminal. A dispatcher that detached
78
+ * is never terminal — its worker owns the answer.
79
+ * detached whether this process handed the run to a background
80
+ * worker and returned before the work finished. The worker
81
+ * appends its own start/end pair to the same file with
82
+ * `detached: false` and its own `pid`; the two are told
83
+ * apart by `pid` and by the worker's argv digest, which
84
+ * covers the `--wait` the dispatcher appended.
85
+ * pid the appending process.
86
+ *
87
+ * FORWARD COMPATIBILITY. Fields are added, never repurposed or removed, and a
88
+ * new field is always optional. Readers ignore fields they do not know, skip
89
+ * lines whose `v` they do not know, and tolerate a torn final line. Anything
90
+ * that changes the meaning of an existing field takes `v: 2`, and this header
91
+ * is where that is written down.
92
+ */
93
+ export const RUN_JOURNAL_VERSION = 1;
94
+ export const RUN_JOURNAL_FILENAME = 'journal.jsonl';
95
+ /**
96
+ * A single small append cannot be split by the kernel, which is what keeps
97
+ * concurrent appenders from interleaving. 4 KiB is the conventional page-sized
98
+ * budget and is far more than a line of identities needs.
99
+ */
100
+ export const RUN_JOURNAL_MAX_LINE_BYTES = 4096;
101
+ /** How many entries `artifacts` and `purchased` carry before they are trimmed. */
102
+ export const RUN_JOURNAL_MAX_LIST_ENTRIES = 16;
103
+ /**
104
+ * The last element of a list that did not fit. Trimming is visible rather than
105
+ * silent: a journal that names fewer paths is recoverable, a journal that
106
+ * failed to append is not.
107
+ */
108
+ export const RUN_JOURNAL_TRUNCATION_MARKER = '<truncated>';
109
+ /** Written in place of a sensitive flag's value before the digest is taken. */
110
+ export const RUN_JOURNAL_REDACTED = '<redacted>';
111
+ /**
112
+ * Credentials are redacted before the digest is taken so two runs of the same
113
+ * command share a digest across a key rotation, and so no secret is ever inside
114
+ * a hash the journal publishes. Identities that are not secrets —
115
+ * `--idempotency-key` above all — are deliberately NOT redacted: they are what
116
+ * ties a line to a paid call.
117
+ */
118
+ export const isSensitiveFlagName = (name) => (name === 'api-key' || /(?:^|-)(?:secret|token|password|credentials?)$/u.test(name));
119
+ /**
120
+ * Tolerant on purpose. The digest is taken before anything is validated, so an
121
+ * argv the real parser would reject still produces a stable digest instead of
122
+ * throwing inside the instrument.
123
+ */
124
+ export const normalizeArgv = (argv) => {
125
+ const command = [];
126
+ const flags = [];
127
+ for (let index = 0; index < argv.length; index += 1) {
128
+ const token = argv[index];
129
+ if (token === undefined)
130
+ continue;
131
+ if (!token.startsWith('--') || token === '--') {
132
+ command.push(token);
133
+ continue;
134
+ }
135
+ const body = token.slice(2);
136
+ const equals = body.indexOf('=');
137
+ if (equals > 0) {
138
+ const name = body.slice(0, equals);
139
+ flags.push([name, isSensitiveFlagName(name) ? RUN_JOURNAL_REDACTED : body.slice(equals + 1)]);
140
+ continue;
141
+ }
142
+ if (!body)
143
+ continue;
144
+ if (CLI_BOOLEAN_FLAGS.has(body)) {
145
+ flags.push([body, true]);
146
+ continue;
147
+ }
148
+ const next = argv[index + 1];
149
+ if (next === undefined || next.startsWith('--')) {
150
+ flags.push([body, true]);
151
+ continue;
152
+ }
153
+ flags.push([body, isSensitiveFlagName(body) ? RUN_JOURNAL_REDACTED : next]);
154
+ index += 1;
155
+ }
156
+ flags.sort((left, right) => (left[0] === right[0]
157
+ ? String(left[1]).localeCompare(String(right[1]))
158
+ : left[0].localeCompare(right[0])));
159
+ return { command, flags };
160
+ };
161
+ export const argsDigest = (argv) => (createHash('sha256').update(JSON.stringify(normalizeArgv(argv))).digest('hex'));
162
+ const trimList = (values) => (values.length > RUN_JOURNAL_MAX_LIST_ENTRIES
163
+ ? [...values.slice(0, RUN_JOURNAL_MAX_LIST_ENTRIES - 1), RUN_JOURNAL_TRUNCATION_MARKER]
164
+ : [...values]);
165
+ const serialize = (entry) => `${JSON.stringify({
166
+ v: entry.v,
167
+ ts: entry.ts,
168
+ cmd: entry.cmd,
169
+ args_digest: entry.args_digest,
170
+ ...(entry.run_id === undefined ? {} : { run_id: entry.run_id }),
171
+ ...(entry.idempotency_key === undefined ? {} : { idempotency_key: entry.idempotency_key }),
172
+ paid: entry.paid,
173
+ event: entry.event,
174
+ ...(entry.outcome === undefined ? {} : { outcome: entry.outcome }),
175
+ ...(entry.error_class === undefined ? {} : { error_class: entry.error_class }),
176
+ ...(entry.artifacts === undefined ? {} : { artifacts: entry.artifacts }),
177
+ ...(entry.purchased === undefined ? {} : { purchased: entry.purchased }),
178
+ terminal: entry.terminal,
179
+ detached: entry.detached,
180
+ pid: entry.pid,
181
+ })}\n`;
182
+ /**
183
+ * The line as it goes to disk: lists trimmed to the entry cap, then trimmed
184
+ * again — visibly — until the whole line fits the single-write budget.
185
+ */
186
+ export const buildRunJournalLine = (entry) => {
187
+ let artifacts = entry.artifacts ? trimList(entry.artifacts) : undefined;
188
+ let purchased = entry.purchased ? trimList(entry.purchased) : undefined;
189
+ for (;;) {
190
+ const line = serialize({
191
+ ...entry,
192
+ ...(artifacts ? { artifacts } : {}),
193
+ ...(purchased ? { purchased } : {}),
194
+ });
195
+ if (Buffer.byteLength(line, 'utf8') <= RUN_JOURNAL_MAX_LINE_BYTES)
196
+ return line;
197
+ const longest = (artifacts?.length ?? 0) >= (purchased?.length ?? 0) ? 'artifacts' : 'purchased';
198
+ const list = longest === 'artifacts' ? artifacts : purchased;
199
+ if (!list || list.length === 0) {
200
+ // Nothing left to give back: drop both lists rather than lose the line.
201
+ if (artifacts === undefined && purchased === undefined) {
202
+ throw new Error('Run journal entry exceeds the single-write budget with no list to trim');
203
+ }
204
+ artifacts = undefined;
205
+ purchased = undefined;
206
+ continue;
207
+ }
208
+ const trimmed = [...list.slice(0, Math.max(0, list.length - 2)), RUN_JOURNAL_TRUNCATION_MARKER];
209
+ if (longest === 'artifacts')
210
+ artifacts = trimmed;
211
+ else
212
+ purchased = trimmed;
213
+ }
214
+ };
215
+ /**
216
+ * ONE `write(2)` of the whole line to an `O_APPEND` descriptor. Everything
217
+ * about concurrent appenders rests on this staying a single write: a loop that
218
+ * retried a short write would be exactly the tear this prevents.
219
+ */
220
+ export const appendRunJournalLine = (file, line) => {
221
+ const bytes = Buffer.from(line, 'utf8');
222
+ const descriptor = openSync(file, 'a');
223
+ try {
224
+ writeSync(descriptor, bytes, 0, bytes.byteLength);
225
+ }
226
+ finally {
227
+ closeSync(descriptor);
228
+ }
229
+ };
230
+ export const runJournalPath = (workspace) => (path.join(path.resolve(workspace), RUN_JOURNAL_FILENAME));
231
+ const isEntry = (value) => {
232
+ if (!value || typeof value !== 'object' || Array.isArray(value))
233
+ return false;
234
+ const record = value;
235
+ return typeof record.ts === 'string'
236
+ && typeof record.cmd === 'string'
237
+ && typeof record.args_digest === 'string'
238
+ && typeof record.paid === 'boolean'
239
+ && (record.event === 'start' || record.event === 'end')
240
+ && typeof record.terminal === 'boolean'
241
+ && typeof record.detached === 'boolean'
242
+ && typeof record.pid === 'number';
243
+ };
244
+ export const parseRunJournalLine = (line) => {
245
+ let parsed;
246
+ try {
247
+ parsed = JSON.parse(line);
248
+ }
249
+ catch {
250
+ return { ok: false, reason: 'malformed' };
251
+ }
252
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
253
+ return { ok: false, reason: 'malformed' };
254
+ }
255
+ if (parsed.v !== RUN_JOURNAL_VERSION) {
256
+ return { ok: false, reason: 'unsupported-version' };
257
+ }
258
+ if (!isEntry(parsed))
259
+ return { ok: false, reason: 'malformed' };
260
+ return { ok: true, entry: parsed };
261
+ };
262
+ export const parseRunJournal = (contents) => {
263
+ const entries = [];
264
+ const skipped = [];
265
+ const torn = contents.length > 0 && !contents.endsWith('\n');
266
+ const lines = contents.split('\n');
267
+ // A trailing newline leaves an empty final element; a torn write leaves the
268
+ // fragment. Either way the last element is handled with the rest, and a
269
+ // fragment that does not parse is reported as torn rather than malformed.
270
+ lines.forEach((line, index) => {
271
+ if (!line)
272
+ return;
273
+ const isFragment = torn && index === lines.length - 1;
274
+ const result = parseRunJournalLine(line);
275
+ if (result.ok) {
276
+ entries.push(result.entry);
277
+ return;
278
+ }
279
+ if (isFragment)
280
+ return;
281
+ skipped.push({ line: index + 1, reason: result.reason });
282
+ });
283
+ return { entries, torn, skipped };
284
+ };
285
+ export const readRunJournal = async (target) => {
286
+ const file = 'file' in target ? target.file : runJournalPath(target.workspace);
287
+ try {
288
+ return parseRunJournal(await readFile(file, 'utf8'));
289
+ }
290
+ catch (error) {
291
+ if (error.code === 'ENOENT') {
292
+ return { entries: [], torn: false, skipped: [] };
293
+ }
294
+ throw error;
295
+ }
296
+ };
297
+ /**
298
+ * A closed vocabulary, so a reader can bucket without reading prose and so no
299
+ * path, id, or user text ever reaches the journal through an error message.
300
+ * Refusals carry their own declared code; everything else lands on a shape.
301
+ */
302
+ export const classifyRunJournalError = (error) => {
303
+ if (isCliRefusal(error))
304
+ return { outcome: 'refused', errorClass: error.code };
305
+ if (error instanceof AggregateError)
306
+ return { outcome: 'error', errorClass: 'aggregate' };
307
+ const record = error;
308
+ const status = typeof record?.status === 'number' ? record.status : undefined;
309
+ if (status !== undefined)
310
+ return { outcome: 'error', errorClass: `http_${status}` };
311
+ const code = typeof record?.code === 'string' ? record.code : undefined;
312
+ if (code && /^[A-Z][A-Z0-9_]*$/u.test(code)) {
313
+ return { outcome: 'error', errorClass: `fs_${code.toLowerCase()}` };
314
+ }
315
+ const name = typeof record?.name === 'string' ? record.name : undefined;
316
+ if (name === 'TypeError')
317
+ return { outcome: 'error', errorClass: 'type_error' };
318
+ if (name === 'AbortError')
319
+ return { outcome: 'error', errorClass: 'aborted' };
320
+ return { outcome: 'error', errorClass: 'unclassified' };
321
+ };
322
+ const NO_OP_SESSION = {
323
+ note: () => undefined,
324
+ end: () => undefined,
325
+ };
326
+ /**
327
+ * Opens the record for one command: writes (or holds) the start line now and
328
+ * owns the end line, including the backstop for a command that leaves through
329
+ * `process.exit` instead of returning.
330
+ */
331
+ export const openRunJournal = (plan) => {
332
+ const digest = argsDigest(plan.argv);
333
+ const state = {
334
+ workspace: plan.workspace ? path.resolve(plan.workspace) : undefined,
335
+ runId: plan.runId,
336
+ idempotencyKey: plan.idempotencyKey,
337
+ artifacts: [],
338
+ purchased: [],
339
+ terminal: undefined,
340
+ };
341
+ let pending = [];
342
+ let ended = false;
343
+ let unwritable = false;
344
+ /**
345
+ * The instrument never becomes the failure. A journal that cannot be written
346
+ * costs a reader its record; a journal that threw would cost the caller the
347
+ * paid work the command was in the middle of. It says so once, on stderr,
348
+ * and the command carries on.
349
+ */
350
+ const flush = () => {
351
+ if (pending.length === 0 || !state.workspace || !existsSync(state.workspace))
352
+ return;
353
+ const file = runJournalPath(state.workspace);
354
+ const draining = pending;
355
+ pending = [];
356
+ for (const entry of draining) {
357
+ try {
358
+ appendRunJournalLine(file, buildRunJournalLine(entry));
359
+ }
360
+ catch (error) {
361
+ if (unwritable)
362
+ continue;
363
+ unwritable = true;
364
+ process.stderr.write(`The run journal at ${file} could not be written`
365
+ + ` (${error instanceof Error ? error.message : String(error)}).`
366
+ + ' This command continues; its record does not.\n');
367
+ }
368
+ }
369
+ };
370
+ const record = (entry) => {
371
+ pending.push(entry);
372
+ flush();
373
+ };
374
+ const entryFor = (event, outcome, errorClass) => ({
375
+ v: RUN_JOURNAL_VERSION,
376
+ ts: new Date().toISOString(),
377
+ cmd: plan.cmd,
378
+ args_digest: digest,
379
+ ...(state.runId === undefined ? {} : { run_id: state.runId }),
380
+ ...(state.idempotencyKey === undefined ? {} : { idempotency_key: state.idempotencyKey }),
381
+ paid: plan.paid,
382
+ event,
383
+ ...(outcome === undefined ? {} : { outcome }),
384
+ ...(errorClass === undefined ? {} : { error_class: errorClass }),
385
+ ...(event === 'end' && state.artifacts.length > 0 ? { artifacts: state.artifacts } : {}),
386
+ ...(event === 'end' && state.purchased.length > 0 ? { purchased: state.purchased } : {}),
387
+ terminal: event === 'end'
388
+ && (state.terminal ?? (outcome === 'ok' && !plan.detached && plan.terminalOnSuccess)),
389
+ detached: plan.detached,
390
+ pid: process.pid,
391
+ });
392
+ const finish = (outcome, errorClass) => {
393
+ if (ended)
394
+ return;
395
+ ended = true;
396
+ process.off('exit', onExit);
397
+ record(entryFor('end', outcome, errorClass));
398
+ };
399
+ /**
400
+ * A command that leaves through `process.exit`, or a process that ends
401
+ * without unwinding, still owes its record. Synchronous appends are what make
402
+ * this possible at all.
403
+ */
404
+ function onExit() {
405
+ finish(process.exitCode ? 'error' : 'ok', process.exitCode ? 'process_exit' : undefined);
406
+ }
407
+ process.once('exit', onExit);
408
+ record(entryFor('start'));
409
+ return {
410
+ note: (facts) => {
411
+ if (facts.workspace !== undefined)
412
+ state.workspace = path.resolve(facts.workspace);
413
+ if (facts.runId !== undefined)
414
+ state.runId = facts.runId;
415
+ if (facts.idempotencyKey !== undefined)
416
+ state.idempotencyKey = facts.idempotencyKey;
417
+ if (facts.artifacts)
418
+ state.artifacts.push(...facts.artifacts);
419
+ if (facts.purchased)
420
+ state.purchased.push(...facts.purchased);
421
+ if (facts.terminal !== undefined)
422
+ state.terminal = facts.terminal;
423
+ flush();
424
+ },
425
+ end: ({ outcome, error }) => {
426
+ if (outcome === 'ok') {
427
+ finish('ok');
428
+ return;
429
+ }
430
+ const classified = classifyRunJournalError(error);
431
+ finish(classified.outcome, classified.errorClass);
432
+ },
433
+ };
434
+ };
435
+ /**
436
+ * Run one command inside its journal. A command with no workspace runs against
437
+ * a no-op session, so the caller never branches on whether it journals.
438
+ */
439
+ export const withRunJournal = async (plan, run) => {
440
+ if (!plan)
441
+ return run(NO_OP_SESSION);
442
+ const session = openRunJournal(plan);
443
+ try {
444
+ const result = await run(session);
445
+ session.end({ outcome: 'ok' });
446
+ return result;
447
+ }
448
+ catch (error) {
449
+ session.end({ outcome: 'error', error });
450
+ throw error;
451
+ }
452
+ };
453
+ //# sourceMappingURL=run-journal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-journal.js","sourceRoot":"","sources":["../src/run-journal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqFG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,kFAAkF;AAClF,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAE/C;;;;GAIG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,aAAa,CAAC;AAE3D,+EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAuBjD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,CAC5D,IAAI,KAAK,SAAS,IAAI,iDAAiD,CAAC,IAAI,CAAC,IAAI,CAAC,CACnF,CAAC;AAOF;;;;GAIG;AACH,MAAM,CA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UAAU,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;YAClD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,IAA2B,EAC3B,GAA6C,EACjC,EAAE;IACd,IAAI,CAAC,IAAI;QAAE,OAAO,GAAG,CAAC,aAAa,CAAC,CAAC;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACzC,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12ui/design",
3
- "version": "0.2.16",
3
+ "version": "0.2.18",
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",