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.
- package/AGENTS.md +11 -7
- package/CHANGELOG.md +8 -12
- package/README.md +28 -57
- package/dist/archive-journal.d.ts +29 -18
- package/dist/archive-journal.d.ts.map +1 -1
- package/dist/archive-journal.js +17 -17
- package/dist/blobs.js +3 -3
- package/dist/builders.d.ts +79 -358
- package/dist/builders.d.ts.map +1 -1
- package/dist/builders.js +15 -60
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +227 -52
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +104 -4
- package/dist/handle.d.ts +4 -2
- package/dist/handle.d.ts.map +1 -1
- package/dist/handle.js +20 -15
- package/dist/helpers.d.ts +7 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +38 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/lab-min.d.ts +7 -7
- package/dist/lab-min.d.ts.map +1 -1
- package/dist/lab-min.js +7 -9
- package/dist/list.d.ts +104 -303
- package/dist/list.d.ts.map +1 -1
- package/dist/note.d.ts +20 -0
- package/dist/note.d.ts.map +1 -1
- package/dist/note.js +5 -0
- package/dist/patch-resolver.d.ts +27 -0
- package/dist/patch-resolver.d.ts.map +1 -0
- package/dist/patch-resolver.js +184 -0
- package/dist/read-index.d.ts +45 -57
- package/dist/read-index.d.ts.map +1 -1
- package/dist/read-index.js +16 -34
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +19 -130
- package/dist/recovery.d.ts +19 -8
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +13 -13
- package/dist/render/migration-log.d.ts +3 -0
- package/dist/render/migration-log.d.ts.map +1 -0
- package/dist/render/migration-log.js +72 -0
- package/dist/render/retro.d.ts.map +1 -1
- package/dist/render/retro.js +41 -25
- package/dist/render/workspace-narrative.d.ts +6 -0
- package/dist/render/workspace-narrative.d.ts.map +1 -0
- package/dist/render/workspace-narrative.js +69 -0
- package/dist/schema/entry-core.d.ts +110 -0
- package/dist/schema/entry-core.d.ts.map +1 -0
- package/dist/schema/entry-core.js +143 -0
- package/dist/schema/entry-migrations.d.ts +3 -0
- package/dist/schema/entry-migrations.d.ts.map +1 -0
- package/dist/schema/entry-migrations.js +48 -0
- package/dist/schema/entry-read.d.ts +694 -0
- package/dist/schema/entry-read.d.ts.map +1 -0
- package/dist/schema/entry-read.js +92 -0
- package/dist/schema/entry-write.d.ts +865 -0
- package/dist/schema/entry-write.d.ts.map +1 -0
- package/dist/schema/entry-write.js +105 -0
- package/dist/schema/entry.d.ts +6 -3295
- package/dist/schema/entry.d.ts.map +1 -1
- package/dist/schema/entry.js +10 -619
- package/dist/schema/manifest.d.ts +28 -41
- package/dist/schema/manifest.d.ts.map +1 -1
- package/dist/schema/manifest.js +20 -24
- package/dist/schema/note.d.ts +3 -9
- package/dist/schema/note.d.ts.map +1 -1
- package/dist/schema/note.js +13 -2
- package/dist/storage/filesystem.d.ts +2 -1
- package/dist/storage/filesystem.d.ts.map +1 -1
- package/dist/storage/filesystem.js +6 -4
- package/dist/storage/lock-reclaimer.d.ts +2 -0
- package/dist/storage/lock-reclaimer.d.ts.map +1 -0
- package/dist/storage/lock-reclaimer.js +45 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-write.d.ts","sourceRoot":"","sources":["../../src/schema/entry-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAoC7B,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;aAMrC,CAAC;AAUH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8HAUlC,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;;;;;;;;;;;;kEAW7B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { NoteSubkindSchema } from "./note.js";
|
|
3
|
+
import { AgentPatchDiffSchema, ChangeLogFileChangeSchema, ChangeLogParityStatusSchema, ChangeLogSmokeResultSchema, ChangeLogSubkindSchema, NonEmptyTrimmedStringSchema, OperatorDecisionPayloadSchema, recordEntryBaseEntries, StripDecisionRevertedPayloadSchema, } from "./entry-core.js";
|
|
4
|
+
const validatePatchRecord = (value) => {
|
|
5
|
+
const provided = [value.diff, value.diffPath, value.diffText].filter((entry) => Boolean(entry));
|
|
6
|
+
if (provided.length === 0) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (value.diffPath && value.diffText) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
return true;
|
|
13
|
+
};
|
|
14
|
+
const PATCH_RECORD_REFINEMENT_MESSAGE = 'patch records require at least one source (diff, diffPath, or diffText), and diffPath and diffText cannot be combined.';
|
|
15
|
+
export const ToolInvocationRecordSchema = v.object({
|
|
16
|
+
...recordEntryBaseEntries,
|
|
17
|
+
args: v.optional(v.array(v.string())),
|
|
18
|
+
cwd: v.optional(v.string()),
|
|
19
|
+
exitCode: v.optional(v.pipe(v.number(), v.integer())),
|
|
20
|
+
kind: v.literal('tool-invocation'),
|
|
21
|
+
});
|
|
22
|
+
const patchRecordEntries = {
|
|
23
|
+
...recordEntryBaseEntries,
|
|
24
|
+
diff: v.optional(AgentPatchDiffSchema),
|
|
25
|
+
diffPath: v.optional(NonEmptyTrimmedStringSchema),
|
|
26
|
+
diffText: v.optional(NonEmptyTrimmedStringSchema),
|
|
27
|
+
rationale: NonEmptyTrimmedStringSchema,
|
|
28
|
+
};
|
|
29
|
+
export const AgentPatchRecordSchema = v.pipe(v.object({
|
|
30
|
+
...patchRecordEntries,
|
|
31
|
+
agent: v.object({
|
|
32
|
+
name: NonEmptyTrimmedStringSchema,
|
|
33
|
+
sessionId: v.optional(NonEmptyTrimmedStringSchema),
|
|
34
|
+
}),
|
|
35
|
+
kind: v.literal('agent-patch'),
|
|
36
|
+
}), v.check(validatePatchRecord, PATCH_RECORD_REFINEMENT_MESSAGE));
|
|
37
|
+
export const OperatorPatchRecordSchema = v.pipe(v.object({
|
|
38
|
+
...patchRecordEntries,
|
|
39
|
+
kind: v.literal('operator-patch'),
|
|
40
|
+
operator: v.object({
|
|
41
|
+
name: NonEmptyTrimmedStringSchema,
|
|
42
|
+
}),
|
|
43
|
+
}), v.check(validatePatchRecord, PATCH_RECORD_REFINEMENT_MESSAGE));
|
|
44
|
+
export const OperatorDecisionRecordSchema = v.object({
|
|
45
|
+
...recordEntryBaseEntries,
|
|
46
|
+
kind: v.literal('operator-decision'),
|
|
47
|
+
payload: OperatorDecisionPayloadSchema,
|
|
48
|
+
});
|
|
49
|
+
export const ValidatorResultRecordSchema = v.object({
|
|
50
|
+
...recordEntryBaseEntries,
|
|
51
|
+
kind: v.literal('validator-result'),
|
|
52
|
+
metrics: v.optional(v.record(v.string(), v.unknown())),
|
|
53
|
+
resultPath: v.optional(v.string()),
|
|
54
|
+
validator: v.picklist(['parity', 'equiv', 'characterize', 'verify', 'doctor']),
|
|
55
|
+
verdict: v.picklist(['green', 'yellow', 'red']),
|
|
56
|
+
});
|
|
57
|
+
export const RuntimeEventRecordSchema = v.object({
|
|
58
|
+
...recordEntryBaseEntries,
|
|
59
|
+
kind: v.literal('runtime-event'),
|
|
60
|
+
level: v.picklist(['info', 'warn', 'error']),
|
|
61
|
+
message: NonEmptyTrimmedStringSchema,
|
|
62
|
+
source: NonEmptyTrimmedStringSchema,
|
|
63
|
+
stripDecisionId: v.optional(v.string()),
|
|
64
|
+
});
|
|
65
|
+
export const NoteRecordSchema = v.object({
|
|
66
|
+
...recordEntryBaseEntries,
|
|
67
|
+
body: v.string(),
|
|
68
|
+
kind: v.literal('note'),
|
|
69
|
+
subkind: NoteSubkindSchema,
|
|
70
|
+
});
|
|
71
|
+
export const CorrectionRecordSchema = v.pipe(v.object({
|
|
72
|
+
...recordEntryBaseEntries,
|
|
73
|
+
kind: v.literal('correction'),
|
|
74
|
+
rationale: NonEmptyTrimmedStringSchema,
|
|
75
|
+
}), v.check((value) => Boolean(value.links?.correctsLedgerId), 'correction records require links.correctsLedgerId'));
|
|
76
|
+
export const StripDecisionRevertedRecordSchema = v.object({
|
|
77
|
+
...recordEntryBaseEntries,
|
|
78
|
+
kind: v.literal('strip-decision-reverted'),
|
|
79
|
+
payload: StripDecisionRevertedPayloadSchema,
|
|
80
|
+
});
|
|
81
|
+
export const ChangeLogRecordSchema = v.pipe(v.object({
|
|
82
|
+
...recordEntryBaseEntries,
|
|
83
|
+
commandsRun: v.optional(v.array(NonEmptyTrimmedStringSchema)),
|
|
84
|
+
filesChanged: v.optional(v.array(ChangeLogFileChangeSchema), []),
|
|
85
|
+
hypothesis: v.optional(NonEmptyTrimmedStringSchema),
|
|
86
|
+
kind: v.literal('change-log'),
|
|
87
|
+
parityStatus: v.optional(ChangeLogParityStatusSchema),
|
|
88
|
+
rollbackPlan: v.optional(NonEmptyTrimmedStringSchema),
|
|
89
|
+
rollsBack: v.optional(NonEmptyTrimmedStringSchema),
|
|
90
|
+
smokeNotes: v.optional(NonEmptyTrimmedStringSchema),
|
|
91
|
+
smokeResult: v.optional(ChangeLogSmokeResultSchema),
|
|
92
|
+
subkind: ChangeLogSubkindSchema,
|
|
93
|
+
}), v.check((value) => value.subkind !== 'rollback' || Boolean(value.rollsBack), 'change-log rollback records require rollsBack'));
|
|
94
|
+
export const LedgerRecordSchema = v.variant('kind', [
|
|
95
|
+
ToolInvocationRecordSchema,
|
|
96
|
+
AgentPatchRecordSchema,
|
|
97
|
+
OperatorPatchRecordSchema,
|
|
98
|
+
OperatorDecisionRecordSchema,
|
|
99
|
+
ValidatorResultRecordSchema,
|
|
100
|
+
RuntimeEventRecordSchema,
|
|
101
|
+
NoteRecordSchema,
|
|
102
|
+
CorrectionRecordSchema,
|
|
103
|
+
StripDecisionRevertedRecordSchema,
|
|
104
|
+
ChangeLogRecordSchema,
|
|
105
|
+
]);
|