ushman-ledger 0.3.0 → 1.2.0

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 (80) hide show
  1. package/AGENTS.md +11 -7
  2. package/CHANGELOG.md +8 -12
  3. package/README.md +28 -57
  4. package/dist/archive-journal.d.ts +29 -18
  5. package/dist/archive-journal.d.ts.map +1 -1
  6. package/dist/archive-journal.js +17 -17
  7. package/dist/blobs.js +3 -3
  8. package/dist/builders.d.ts +79 -358
  9. package/dist/builders.d.ts.map +1 -1
  10. package/dist/builders.js +15 -60
  11. package/dist/cli.d.ts.map +1 -1
  12. package/dist/cli.js +227 -52
  13. package/dist/doctor.d.ts.map +1 -1
  14. package/dist/doctor.js +104 -4
  15. package/dist/handle.d.ts +4 -2
  16. package/dist/handle.d.ts.map +1 -1
  17. package/dist/handle.js +20 -15
  18. package/dist/helpers.d.ts +7 -0
  19. package/dist/helpers.d.ts.map +1 -0
  20. package/dist/helpers.js +38 -0
  21. package/dist/index.d.ts +4 -5
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +3 -4
  24. package/dist/lab-min.d.ts +7 -7
  25. package/dist/lab-min.d.ts.map +1 -1
  26. package/dist/lab-min.js +7 -9
  27. package/dist/list.d.ts +104 -303
  28. package/dist/list.d.ts.map +1 -1
  29. package/dist/note.d.ts +20 -0
  30. package/dist/note.d.ts.map +1 -1
  31. package/dist/note.js +5 -0
  32. package/dist/patch-resolver.d.ts +27 -0
  33. package/dist/patch-resolver.d.ts.map +1 -0
  34. package/dist/patch-resolver.js +184 -0
  35. package/dist/read-index.d.ts +45 -57
  36. package/dist/read-index.d.ts.map +1 -1
  37. package/dist/read-index.js +16 -34
  38. package/dist/record.d.ts.map +1 -1
  39. package/dist/record.js +19 -130
  40. package/dist/recovery.d.ts +19 -8
  41. package/dist/recovery.d.ts.map +1 -1
  42. package/dist/recovery.js +13 -13
  43. package/dist/render/migration-log.d.ts +3 -0
  44. package/dist/render/migration-log.d.ts.map +1 -0
  45. package/dist/render/migration-log.js +72 -0
  46. package/dist/render/retro.d.ts.map +1 -1
  47. package/dist/render/retro.js +41 -25
  48. package/dist/render/workspace-narrative.d.ts +6 -0
  49. package/dist/render/workspace-narrative.d.ts.map +1 -0
  50. package/dist/render/workspace-narrative.js +69 -0
  51. package/dist/schema/entry-core.d.ts +110 -0
  52. package/dist/schema/entry-core.d.ts.map +1 -0
  53. package/dist/schema/entry-core.js +143 -0
  54. package/dist/schema/entry-migrations.d.ts +3 -0
  55. package/dist/schema/entry-migrations.d.ts.map +1 -0
  56. package/dist/schema/entry-migrations.js +48 -0
  57. package/dist/schema/entry-read.d.ts +694 -0
  58. package/dist/schema/entry-read.d.ts.map +1 -0
  59. package/dist/schema/entry-read.js +92 -0
  60. package/dist/schema/entry-write.d.ts +865 -0
  61. package/dist/schema/entry-write.d.ts.map +1 -0
  62. package/dist/schema/entry-write.js +105 -0
  63. package/dist/schema/entry.d.ts +6 -3295
  64. package/dist/schema/entry.d.ts.map +1 -1
  65. package/dist/schema/entry.js +10 -619
  66. package/dist/schema/manifest.d.ts +28 -41
  67. package/dist/schema/manifest.d.ts.map +1 -1
  68. package/dist/schema/manifest.js +20 -24
  69. package/dist/schema/note.d.ts +3 -9
  70. package/dist/schema/note.d.ts.map +1 -1
  71. package/dist/schema/note.js +13 -2
  72. package/dist/storage/filesystem.d.ts +2 -1
  73. package/dist/storage/filesystem.d.ts.map +1 -1
  74. package/dist/storage/filesystem.js +6 -4
  75. package/dist/storage/lock-reclaimer.d.ts +2 -0
  76. package/dist/storage/lock-reclaimer.d.ts.map +1 -0
  77. package/dist/storage/lock-reclaimer.js +45 -0
  78. package/dist/version.d.ts +1 -1
  79. package/dist/version.js +1 -1
  80. package/package.json +3 -4
@@ -2,130 +2,26 @@ import { type LedgerRecord } from './schema/entry.ts';
2
2
  type BuildRecordInput<TRecord extends LedgerRecord> = Omit<TRecord, 'kind'> & {
3
3
  readonly kind?: TRecord['kind'];
4
4
  };
5
- /** Build an `agent-patch` record, deriving structured payload fields later if only `diffPath` is supplied. */
6
- export declare const buildAgentPatchRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
7
- kind: "agent-patch";
5
+ /** Build an `operator-decision` record with a validated structured payload. */
6
+ export declare const buildOperatorDecisionRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
7
+ kind: "operator-decision";
8
8
  }>>) => {
9
- emitter: {
10
- tool: string;
11
- version: string;
12
- user?: string | undefined;
13
- };
14
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
15
- summary: string;
16
- rationale: string;
17
- agent: {
18
- name: string;
19
- sessionId?: string | undefined;
9
+ kind: "operator-decision";
10
+ payload: {
11
+ action: "bypass-doctor" | "skip-check" | "override-strip-decision" | "override-ship-state" | "manual-parity-assertion" | "ledger-hand-edit" | "escalation";
12
+ checkId?: string | undefined;
13
+ rationale: string;
20
14
  };
21
- kind: "agent-patch";
22
- details?: Record<string, unknown> | undefined;
23
- idempotencyKey?: string | undefined;
24
- links?: {
15
+ details?: {
25
16
  [x: string]: unknown;
26
- affectedFiles?: string[] | undefined;
27
- blobs?: string[] | undefined;
28
- briefId?: string | undefined;
29
- correctsLedgerId?: string | undefined;
30
- gitRef?: string | undefined;
31
- idempotencyKey?: string | undefined;
32
- stripDecisionId?: string | undefined;
33
- supersedesLedgerId?: string | undefined;
34
- validatorVerdictId?: string | undefined;
35
- } | undefined;
36
- diff?: {
37
- addedLines: number;
38
- blobSha256: string;
39
- bytes: number;
40
- removedLines: number;
41
17
  } | undefined;
42
- diffPath?: string | undefined;
43
- payload?: {
44
- diff?: string | undefined;
45
- diffSha256?: string | undefined;
46
- fileSha256After?: Record<string, string> | undefined;
47
- fileSha256Before?: Record<string, string> | undefined;
48
- hunks?: {
49
- endLine: number;
50
- path: string;
51
- startLine: number;
52
- }[] | undefined;
53
- touchedPaths?: string[] | undefined;
54
- } | undefined;
55
- };
56
- /** Build an `operator-patch` record, deriving structured payload fields later if only `diffPath` is supplied. */
57
- export declare const buildOperatorPatchRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
58
- kind: "operator-patch";
59
- }>>) => {
60
18
  emitter: {
61
19
  tool: string;
62
- version: string;
63
20
  user?: string | undefined;
64
- };
65
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
66
- summary: string;
67
- rationale: string;
68
- kind: "operator-patch";
69
- operator: {
70
- name: string;
71
- };
72
- details?: Record<string, unknown> | undefined;
73
- idempotencyKey?: string | undefined;
74
- links?: {
75
- [x: string]: unknown;
76
- affectedFiles?: string[] | undefined;
77
- blobs?: string[] | undefined;
78
- briefId?: string | undefined;
79
- correctsLedgerId?: string | undefined;
80
- gitRef?: string | undefined;
81
- idempotencyKey?: string | undefined;
82
- stripDecisionId?: string | undefined;
83
- supersedesLedgerId?: string | undefined;
84
- validatorVerdictId?: string | undefined;
85
- } | undefined;
86
- diff?: {
87
- addedLines: number;
88
- blobSha256: string;
89
- bytes: number;
90
- removedLines: number;
91
- } | undefined;
92
- diffPath?: string | undefined;
93
- payload?: {
94
- diff?: string | undefined;
95
- diffSha256?: string | undefined;
96
- fileSha256After?: Record<string, string> | undefined;
97
- fileSha256Before?: Record<string, string> | undefined;
98
- hunks?: {
99
- endLine: number;
100
- path: string;
101
- startLine: number;
102
- }[] | undefined;
103
- touchedPaths?: string[] | undefined;
104
- } | undefined;
105
- };
106
- /** Build a `stage-transition` record with a validated structured payload. */
107
- export declare const buildStageTransitionRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
108
- kind: "stage-transition";
109
- }>>) => {
110
- emitter: {
111
- tool: string;
112
21
  version: string;
113
- user?: string | undefined;
114
22
  };
115
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
116
- summary: string;
117
- kind: "stage-transition";
118
- payload: {
119
- endedAt: string;
120
- exitCode: number;
121
- stage: "seed" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize";
122
- startedAt: string;
123
- doctorBaselineId?: string | undefined;
124
- };
125
- details?: Record<string, unknown> | undefined;
126
23
  idempotencyKey?: string | undefined;
127
- links?: {
128
- [x: string]: unknown;
24
+ links?: ({
129
25
  affectedFiles?: string[] | undefined;
130
26
  blobs?: string[] | undefined;
131
27
  briefId?: string | undefined;
@@ -135,126 +31,33 @@ export declare const buildStageTransitionRecord: (input: BuildRecordInput<Extrac
135
31
  stripDecisionId?: string | undefined;
136
32
  supersedesLedgerId?: string | undefined;
137
33
  validatorVerdictId?: string | undefined;
138
- } | undefined;
139
- };
140
- /** Build an `operator-decision` record using the required structured payload shape. */
141
- export declare const buildOperatorDecisionRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
142
- kind: "operator-decision";
143
- }>>) => {
144
- emitter: {
145
- tool: string;
146
- version: string;
147
- user?: string | undefined;
148
- };
149
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
34
+ } & {
35
+ [key: string]: unknown;
36
+ }) | undefined;
37
+ phase: "capture" | "intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
150
38
  summary: string;
151
- kind: "operator-decision";
152
- payload: {
153
- action: "bypass-doctor" | "skip-check" | "override-strip-decision" | "override-ship-state" | "manual-parity-assertion" | "ledger-hand-edit" | "escalation";
154
- rationale: string;
155
- checkId?: string | undefined;
156
- };
157
- details?: Record<string, unknown> | undefined;
158
- idempotencyKey?: string | undefined;
159
- links?: {
160
- [x: string]: unknown;
161
- affectedFiles?: string[] | undefined;
162
- blobs?: string[] | undefined;
163
- briefId?: string | undefined;
164
- correctsLedgerId?: string | undefined;
165
- gitRef?: string | undefined;
166
- idempotencyKey?: string | undefined;
167
- stripDecisionId?: string | undefined;
168
- supersedesLedgerId?: string | undefined;
169
- validatorVerdictId?: string | undefined;
170
- } | undefined;
171
39
  };
172
- /** Build a `validator-result` record and synthesize `payload.id` only when the caller omits it. */
40
+ /** Build a `validator-result` record. */
173
41
  export declare const buildValidatorResultRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
174
42
  kind: "validator-result";
175
43
  }>>) => {
176
- emitter: {
177
- tool: string;
178
- version: string;
179
- user?: string | undefined;
180
- };
181
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
182
- summary: string;
183
44
  kind: "validator-result";
184
- validator: "parity" | "characterize" | "equiv" | "verify" | "doctor";
185
- verdict: "green" | "yellow" | "red";
186
- details?: Record<string, unknown> | undefined;
187
- idempotencyKey?: string | undefined;
188
- links?: {
45
+ metrics?: {
189
46
  [x: string]: unknown;
190
- affectedFiles?: string[] | undefined;
191
- blobs?: string[] | undefined;
192
- briefId?: string | undefined;
193
- correctsLedgerId?: string | undefined;
194
- gitRef?: string | undefined;
195
- idempotencyKey?: string | undefined;
196
- stripDecisionId?: string | undefined;
197
- supersedesLedgerId?: string | undefined;
198
- validatorVerdictId?: string | undefined;
199
- } | undefined;
200
- metrics?: Record<string, unknown> | undefined;
201
- payload?: {
202
- id?: string | undefined;
203
47
  } | undefined;
204
48
  resultPath?: string | undefined;
205
- };
206
- /** Build a `correction` record with validated linkage fields. */
207
- export declare const buildCorrectionRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
208
- kind: "correction";
209
- }>>) => {
210
- emitter: {
211
- tool: string;
212
- version: string;
213
- user?: string | undefined;
214
- };
215
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
216
- summary: string;
217
- kind: "correction";
218
- rationale: string;
219
- details?: Record<string, unknown> | undefined;
220
- idempotencyKey?: string | undefined;
221
- links?: {
49
+ validator: "parity" | "characterize" | "equiv" | "verify" | "doctor";
50
+ verdict: "green" | "yellow" | "red";
51
+ details?: {
222
52
  [x: string]: unknown;
223
- affectedFiles?: string[] | undefined;
224
- blobs?: string[] | undefined;
225
- briefId?: string | undefined;
226
- correctsLedgerId?: string | undefined;
227
- gitRef?: string | undefined;
228
- idempotencyKey?: string | undefined;
229
- stripDecisionId?: string | undefined;
230
- supersedesLedgerId?: string | undefined;
231
- validatorVerdictId?: string | undefined;
232
- } | undefined;
233
- payload?: {
234
- correctsValidatorResultId?: string | undefined;
235
53
  } | undefined;
236
- };
237
- /** Build a `strip-decision-reverted` record. */
238
- export declare const buildStripDecisionRevertedRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
239
- kind: "strip-decision-reverted";
240
- }>>) => {
241
54
  emitter: {
242
55
  tool: string;
243
- version: string;
244
56
  user?: string | undefined;
57
+ version: string;
245
58
  };
246
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
247
- summary: string;
248
- kind: "strip-decision-reverted";
249
- payload: {
250
- rationale: string;
251
- stripDecisionId: string;
252
- invalidatedStages?: ("seed" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize")[] | undefined;
253
- };
254
- details?: Record<string, unknown> | undefined;
255
59
  idempotencyKey?: string | undefined;
256
- links?: {
257
- [x: string]: unknown;
60
+ links?: ({
258
61
  affectedFiles?: string[] | undefined;
259
62
  blobs?: string[] | undefined;
260
63
  briefId?: string | undefined;
@@ -264,62 +67,28 @@ export declare const buildStripDecisionRevertedRecord: (input: BuildRecordInput<
264
67
  stripDecisionId?: string | undefined;
265
68
  supersedesLedgerId?: string | undefined;
266
69
  validatorVerdictId?: string | undefined;
267
- } | undefined;
70
+ } & {
71
+ [key: string]: unknown;
72
+ }) | undefined;
73
+ phase: "capture" | "intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
74
+ summary: string;
268
75
  };
269
- /** Build a `descope-brief` record. */
270
- export declare const buildDescopeBriefRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
271
- kind: "descope-brief";
76
+ /** Build a `correction` record. Requires `links.correctsLedgerId`. */
77
+ export declare const buildCorrectionRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
78
+ kind: "correction";
272
79
  }>>) => {
273
- emitter: {
274
- tool: string;
275
- version: string;
276
- user?: string | undefined;
277
- };
278
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
279
- summary: string;
280
- kind: "descope-brief";
281
- payload: {
282
- briefId: string;
283
- reason?: string | undefined;
284
- round?: number | undefined;
285
- stripDecisionIds?: string[] | undefined;
286
- };
287
- details?: Record<string, unknown> | undefined;
288
- idempotencyKey?: string | undefined;
289
- links?: {
80
+ kind: "correction";
81
+ rationale: string;
82
+ details?: {
290
83
  [x: string]: unknown;
291
- affectedFiles?: string[] | undefined;
292
- blobs?: string[] | undefined;
293
- briefId?: string | undefined;
294
- correctsLedgerId?: string | undefined;
295
- gitRef?: string | undefined;
296
- idempotencyKey?: string | undefined;
297
- stripDecisionId?: string | undefined;
298
- supersedesLedgerId?: string | undefined;
299
- validatorVerdictId?: string | undefined;
300
84
  } | undefined;
301
- };
302
- /** Build a `merge-return` record. */
303
- export declare const buildMergeReturnRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
304
- kind: "merge-return";
305
- }>>) => {
306
85
  emitter: {
307
86
  tool: string;
308
- version: string;
309
87
  user?: string | undefined;
88
+ version: string;
310
89
  };
311
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
312
- summary: string;
313
- kind: "merge-return";
314
- payload: {
315
- returnId: string;
316
- briefId?: string | undefined;
317
- source?: string | undefined;
318
- };
319
- details?: Record<string, unknown> | undefined;
320
90
  idempotencyKey?: string | undefined;
321
- links?: {
322
- [x: string]: unknown;
91
+ links?: ({
323
92
  affectedFiles?: string[] | undefined;
324
93
  blobs?: string[] | undefined;
325
94
  briefId?: string | undefined;
@@ -329,61 +98,40 @@ export declare const buildMergeReturnRecord: (input: BuildRecordInput<Extract<Le
329
98
  stripDecisionId?: string | undefined;
330
99
  supersedesLedgerId?: string | undefined;
331
100
  validatorVerdictId?: string | undefined;
332
- } | undefined;
101
+ } & {
102
+ [key: string]: unknown;
103
+ }) | undefined;
104
+ phase: "capture" | "intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
105
+ summary: string;
333
106
  };
334
- /** Build a `merge-return-rejected` record. */
335
- export declare const buildMergeReturnRejectedRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
336
- kind: "merge-return-rejected";
107
+ /** Build a `change-log` record. */
108
+ export declare const buildChangeLogRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
109
+ kind: "change-log";
337
110
  }>>) => {
338
- emitter: {
339
- tool: string;
340
- version: string;
341
- user?: string | undefined;
342
- };
343
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
344
- summary: string;
345
- kind: "merge-return-rejected";
346
- payload: {
347
- returnId: string;
348
- reason: string;
349
- briefId?: string | undefined;
350
- source?: string | undefined;
351
- };
352
- details?: Record<string, unknown> | undefined;
353
- idempotencyKey?: string | undefined;
354
- links?: {
111
+ commandsRun?: string[] | undefined;
112
+ filesChanged: {
113
+ added?: number | undefined;
114
+ path: string;
115
+ removed?: number | undefined;
116
+ }[];
117
+ hypothesis?: string | undefined;
118
+ kind: "change-log";
119
+ parityStatus?: "not-run" | "green" | "yellow" | "red" | undefined;
120
+ rollbackPlan?: string | undefined;
121
+ rollsBack?: string | undefined;
122
+ smokeNotes?: string | undefined;
123
+ smokeResult?: "pass" | "fail" | "partial" | "not-run" | undefined;
124
+ subkind: "vendor-extract" | "pre-change-checkpoint" | "semantic-cleanup" | "decomposition" | "rollback" | "hotfix" | "smoke";
125
+ details?: {
355
126
  [x: string]: unknown;
356
- affectedFiles?: string[] | undefined;
357
- blobs?: string[] | undefined;
358
- briefId?: string | undefined;
359
- correctsLedgerId?: string | undefined;
360
- gitRef?: string | undefined;
361
- idempotencyKey?: string | undefined;
362
- stripDecisionId?: string | undefined;
363
- supersedesLedgerId?: string | undefined;
364
- validatorVerdictId?: string | undefined;
365
127
  } | undefined;
366
- };
367
- /** Build a `revert` record. */
368
- export declare const buildRevertRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
369
- kind: "revert";
370
- }>>) => {
371
128
  emitter: {
372
129
  tool: string;
373
- version: string;
374
130
  user?: string | undefined;
131
+ version: string;
375
132
  };
376
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
377
- summary: string;
378
- kind: "revert";
379
- payload: {
380
- reason: string;
381
- targetEntryId?: string | undefined;
382
- };
383
- details?: Record<string, unknown> | undefined;
384
133
  idempotencyKey?: string | undefined;
385
- links?: {
386
- [x: string]: unknown;
134
+ links?: ({
387
135
  affectedFiles?: string[] | undefined;
388
136
  blobs?: string[] | undefined;
389
137
  briefId?: string | undefined;
@@ -393,63 +141,32 @@ export declare const buildRevertRecord: (input: BuildRecordInput<Extract<LedgerR
393
141
  stripDecisionId?: string | undefined;
394
142
  supersedesLedgerId?: string | undefined;
395
143
  validatorVerdictId?: string | undefined;
396
- } | undefined;
144
+ } & {
145
+ [key: string]: unknown;
146
+ }) | undefined;
147
+ phase: "capture" | "intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
148
+ summary: string;
397
149
  };
398
- /** Build a `rollback` record. */
399
- export declare const buildRollbackRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
400
- kind: "rollback";
150
+ /** Build a `strip-decision-reverted` record. */
151
+ export declare const buildStripDecisionRevertedRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
152
+ kind: "strip-decision-reverted";
401
153
  }>>) => {
402
- emitter: {
403
- tool: string;
404
- version: string;
405
- user?: string | undefined;
406
- };
407
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
408
- summary: string;
409
- kind: "rollback";
154
+ kind: "strip-decision-reverted";
410
155
  payload: {
411
- reason: string;
412
- targetEntryId?: string | undefined;
413
- targetStage?: "seed" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | undefined;
156
+ invalidatedStages?: ("intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize")[] | undefined;
157
+ rationale: string;
158
+ stripDecisionId: string;
414
159
  };
415
- details?: Record<string, unknown> | undefined;
416
- idempotencyKey?: string | undefined;
417
- links?: {
160
+ details?: {
418
161
  [x: string]: unknown;
419
- affectedFiles?: string[] | undefined;
420
- blobs?: string[] | undefined;
421
- briefId?: string | undefined;
422
- correctsLedgerId?: string | undefined;
423
- gitRef?: string | undefined;
424
- idempotencyKey?: string | undefined;
425
- stripDecisionId?: string | undefined;
426
- supersedesLedgerId?: string | undefined;
427
- validatorVerdictId?: string | undefined;
428
162
  } | undefined;
429
- };
430
- /** Build a `rework.test_retired` record. */
431
- export declare const buildReworkTestRetiredRecord: (input: BuildRecordInput<Extract<LedgerRecord, {
432
- kind: "rework.test_retired";
433
- }>>) => {
434
163
  emitter: {
435
164
  tool: string;
436
- version: string;
437
165
  user?: string | undefined;
166
+ version: string;
438
167
  };
439
- phase: "seed" | "capture" | "intake" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
440
- summary: string;
441
- kind: "rework.test_retired";
442
- payload: {
443
- removedBy: "operator" | "descope" | "decompose";
444
- removedTestPath: string;
445
- removedTestSymbols: string[];
446
- sourceSymbolDeletedFrom: string;
447
- briefId?: string | undefined;
448
- };
449
- details?: Record<string, unknown> | undefined;
450
168
  idempotencyKey?: string | undefined;
451
- links?: {
452
- [x: string]: unknown;
169
+ links?: ({
453
170
  affectedFiles?: string[] | undefined;
454
171
  blobs?: string[] | undefined;
455
172
  briefId?: string | undefined;
@@ -459,7 +176,11 @@ export declare const buildReworkTestRetiredRecord: (input: BuildRecordInput<Extr
459
176
  stripDecisionId?: string | undefined;
460
177
  supersedesLedgerId?: string | undefined;
461
178
  validatorVerdictId?: string | undefined;
462
- } | undefined;
179
+ } & {
180
+ [key: string]: unknown;
181
+ }) | undefined;
182
+ phase: "capture" | "intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
183
+ summary: string;
463
184
  };
464
185
  export {};
465
186
  //# sourceMappingURL=builders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,YAAY,EAapB,MAAM,mBAAmB,CAAC;AAG3B,KAAK,gBAAgB,CAAC,OAAO,SAAS,YAAY,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AAEF,8GAA8G;AAC9G,eAAO,MAAM,qBAAqB,GAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKvG,CAAC;AAEP,iHAAiH;AACjH,eAAO,MAAM,wBAAwB,GAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK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AAE;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAM3E,CAAC;AAEP,yCAAyC;AACzC,eAAO,MAAM,0BAA0B,GACnC,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK1E,CAAC;AAEP,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,GAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CAItG,CAAC;AAEP,mCAAmC;AACnC,eAAO,MAAM,oBAAoB,GAAI,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIrG,CAAC;AAEP,gDAAgD;AAChD,eAAO,MAAM,gCAAgC,GACzC,OAAO,gBAAgB,CAAC,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,yBAAyB,CAAA;CAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKjF,CAAC"}
package/dist/builders.js CHANGED
@@ -1,73 +1,28 @@
1
- import { AgentPatchRecordSchema, CorrectionRecordSchema, DescopeBriefRecordSchema, MergeReturnRecordSchema, MergeReturnRejectedRecordSchema, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchRecordSchema, PatchPayloadWriteSchema, RevertRecordSchema, ReworkTestRetiredRecordSchema, RollbackRecordSchema, StageTransitionRecordSchema, StripDecisionRevertedRecordSchema, ValidatorResultRecordSchema, } from "./schema/entry.js";
2
- import { generateUuidV7 } from "./uuid.js";
3
- /** Build an `agent-patch` record, deriving structured payload fields later if only `diffPath` is supplied. */
4
- export const buildAgentPatchRecord = (input) => AgentPatchRecordSchema.parse({
5
- ...input,
6
- kind: 'agent-patch',
7
- payload: input.payload ? PatchPayloadWriteSchema.parse(input.payload) : undefined,
8
- });
9
- /** Build an `operator-patch` record, deriving structured payload fields later if only `diffPath` is supplied. */
10
- export const buildOperatorPatchRecord = (input) => OperatorPatchRecordSchema.parse({
11
- ...input,
12
- kind: 'operator-patch',
13
- payload: input.payload ? PatchPayloadWriteSchema.parse(input.payload) : undefined,
14
- });
15
- /** Build a `stage-transition` record with a validated structured payload. */
16
- export const buildStageTransitionRecord = (input) => StageTransitionRecordSchema.parse({
17
- ...input,
18
- kind: 'stage-transition',
19
- });
20
- /** Build an `operator-decision` record using the required structured payload shape. */
21
- export const buildOperatorDecisionRecord = (input) => OperatorDecisionRecordSchema.parse({
1
+ import * as v from 'valibot';
2
+ import { ChangeLogRecordSchema, CorrectionRecordSchema, OperatorDecisionRecordSchema, StripDecisionRevertedRecordSchema, ValidatorResultRecordSchema, } from "./schema/entry.js";
3
+ /** Build an `operator-decision` record with a validated structured payload. */
4
+ export const buildOperatorDecisionRecord = (input) => v.parse(OperatorDecisionRecordSchema, {
22
5
  ...input,
23
6
  kind: 'operator-decision',
24
- payload: OperatorDecisionPayloadSchema.parse(input.payload),
7
+ payload: input.payload,
25
8
  });
26
- /** Build a `validator-result` record and synthesize `payload.id` only when the caller omits it. */
27
- export const buildValidatorResultRecord = (input) => ValidatorResultRecordSchema.parse({
9
+ /** Build a `validator-result` record. */
10
+ export const buildValidatorResultRecord = (input) => v.parse(ValidatorResultRecordSchema, {
28
11
  ...input,
29
12
  kind: 'validator-result',
30
- payload: {
31
- id: input.payload?.id ?? generateUuidV7(),
32
- },
33
13
  });
34
- /** Build a `correction` record with validated linkage fields. */
35
- export const buildCorrectionRecord = (input) => CorrectionRecordSchema.parse({
14
+ /** Build a `correction` record. Requires `links.correctsLedgerId`. */
15
+ export const buildCorrectionRecord = (input) => v.parse(CorrectionRecordSchema, {
36
16
  ...input,
37
17
  kind: 'correction',
38
18
  });
39
- /** Build a `strip-decision-reverted` record. */
40
- export const buildStripDecisionRevertedRecord = (input) => StripDecisionRevertedRecordSchema.parse({
41
- ...input,
42
- kind: 'strip-decision-reverted',
43
- });
44
- /** Build a `descope-brief` record. */
45
- export const buildDescopeBriefRecord = (input) => DescopeBriefRecordSchema.parse({
19
+ /** Build a `change-log` record. */
20
+ export const buildChangeLogRecord = (input) => v.parse(ChangeLogRecordSchema, {
46
21
  ...input,
47
- kind: 'descope-brief',
22
+ kind: 'change-log',
48
23
  });
49
- /** Build a `merge-return` record. */
50
- export const buildMergeReturnRecord = (input) => MergeReturnRecordSchema.parse({
51
- ...input,
52
- kind: 'merge-return',
53
- });
54
- /** Build a `merge-return-rejected` record. */
55
- export const buildMergeReturnRejectedRecord = (input) => MergeReturnRejectedRecordSchema.parse({
56
- ...input,
57
- kind: 'merge-return-rejected',
58
- });
59
- /** Build a `revert` record. */
60
- export const buildRevertRecord = (input) => RevertRecordSchema.parse({
61
- ...input,
62
- kind: 'revert',
63
- });
64
- /** Build a `rollback` record. */
65
- export const buildRollbackRecord = (input) => RollbackRecordSchema.parse({
66
- ...input,
67
- kind: 'rollback',
68
- });
69
- /** Build a `rework.test_retired` record. */
70
- export const buildReworkTestRetiredRecord = (input) => ReworkTestRetiredRecordSchema.parse({
24
+ /** Build a `strip-decision-reverted` record. */
25
+ export const buildStripDecisionRevertedRecord = (input) => v.parse(StripDecisionRevertedRecordSchema, {
71
26
  ...input,
72
- kind: 'rework.test_retired',
27
+ kind: 'strip-decision-reverted',
73
28
  });
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAoBA,KAAK,UAAU,GAAG;IACd,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,EAAE;QACrB,QAAQ,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