ushman-ledger 1.2.2 → 1.3.1
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 +7 -5
- package/ARCHITECTURE.md +8 -2
- package/CHANGELOG.md +11 -0
- package/README.md +37 -5
- package/TROUBLESHOOTING.md +17 -3
- package/dist/blobs.d.ts.map +1 -1
- package/dist/blobs.js +1 -1
- package/dist/builders.d.ts +33 -0
- package/dist/builders.d.ts.map +1 -1
- package/dist/builders.js +10 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +153 -43
- package/dist/doctor.d.ts +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +45 -11
- package/dist/handle.d.ts.map +1 -1
- package/dist/handle.js +67 -30
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lab-min.d.ts +1 -1
- package/dist/lab-min.d.ts.map +1 -1
- package/dist/lab-min.js +2 -1
- package/dist/list.d.ts +32 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +1 -1
- package/dist/patch-resolver.d.ts.map +1 -1
- package/dist/patch-resolver.js +1 -1
- package/dist/process.d.ts +2 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +16 -0
- package/dist/read-index.d.ts +7 -7
- package/dist/read-index.d.ts.map +1 -1
- package/dist/read-index.js +13 -9
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +1 -2
- package/dist/recovery.d.ts +8 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +142 -30
- package/dist/render/retro.d.ts.map +1 -1
- package/dist/render/retro.js +4 -1
- package/dist/runtime-config.d.ts +2 -0
- package/dist/runtime-config.d.ts.map +1 -1
- package/dist/runtime-config.js +14 -0
- package/dist/schema/entry-core.d.ts +5 -2
- package/dist/schema/entry-core.d.ts.map +1 -1
- package/dist/schema/entry-core.js +3 -0
- package/dist/schema/entry-read.d.ts +57 -0
- package/dist/schema/entry-read.d.ts.map +1 -1
- package/dist/schema/entry-read.js +9 -1
- package/dist/schema/entry-write.d.ts +51 -0
- package/dist/schema/entry-write.d.ts.map +1 -1
- package/dist/schema/entry-write.js +9 -1
- package/dist/storage/filesystem.d.ts +14 -2
- package/dist/storage/filesystem.d.ts.map +1 -1
- package/dist/storage/filesystem.js +206 -39
- package/dist/storage/lock.d.ts.map +1 -1
- package/dist/storage/lock.js +38 -16
- package/package.json +2 -1
package/dist/handle.js
CHANGED
|
@@ -13,7 +13,7 @@ import { renderMigrationLogMarkdown } from "./render/migration-log.js";
|
|
|
13
13
|
import { renderRetroMarkdown } from "./render/retro.js";
|
|
14
14
|
import { renderTimelineHtml } from "./render/timeline-html.js";
|
|
15
15
|
import { renderWorkspaceNarrativeMarkdown } from "./render/workspace-narrative.js";
|
|
16
|
-
import { createAtomicTextFileWriter, resolveLedgerPaths, writeAtomicTextFile } from "./storage/filesystem.js";
|
|
16
|
+
import { createAtomicTextFileWriter, createExternalTempFileRegistrar, resolveLedgerPaths, writeAtomicTextFile, } from "./storage/filesystem.js";
|
|
17
17
|
const createEntryIteratorFactory = ({ filter, state, workspaceRoot, }) => {
|
|
18
18
|
return (entryOptions = {}) => iterateEntriesFromManifest(workspaceRoot, state.manifest, state.readIndex, {
|
|
19
19
|
kind: entryOptions.kind,
|
|
@@ -29,6 +29,22 @@ const collectRenderedText = async (emit) => {
|
|
|
29
29
|
});
|
|
30
30
|
return chunks.join('');
|
|
31
31
|
};
|
|
32
|
+
const attachCleanupCause = (error, cleanupError) => {
|
|
33
|
+
if (error instanceof Error) {
|
|
34
|
+
const errorWithCause = error;
|
|
35
|
+
if (errorWithCause.cause === undefined) {
|
|
36
|
+
Object.defineProperty(errorWithCause, 'cause', {
|
|
37
|
+
configurable: true,
|
|
38
|
+
enumerable: false,
|
|
39
|
+
value: cleanupError,
|
|
40
|
+
writable: true,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return error;
|
|
44
|
+
}
|
|
45
|
+
return new Error(String(error), { cause: cleanupError });
|
|
46
|
+
};
|
|
47
|
+
const getExternalTempRegistrar = (workspaceRoot, outPath) => outPath ? createExternalTempFileRegistrar(workspaceRoot) : undefined;
|
|
32
48
|
const emitRenderedTarget = async ({ createEntries, manifest, target, write, workspaceName, }) => {
|
|
33
49
|
switch (target) {
|
|
34
50
|
case 'dependency-graph':
|
|
@@ -82,6 +98,40 @@ const resolveRenderOutputPath = (workspaceRoot, target) => {
|
|
|
82
98
|
return null;
|
|
83
99
|
}
|
|
84
100
|
};
|
|
101
|
+
const runRenderToWriters = async ({ atomicWriter, createEntries, manifest, target, workspaceName, writer, }) => {
|
|
102
|
+
let hasWrittenContent = false;
|
|
103
|
+
let endsWithNewline = false;
|
|
104
|
+
try {
|
|
105
|
+
await emitRenderedTarget({
|
|
106
|
+
createEntries,
|
|
107
|
+
manifest,
|
|
108
|
+
target,
|
|
109
|
+
workspaceName,
|
|
110
|
+
write: async (chunk) => {
|
|
111
|
+
if (chunk.length > 0) {
|
|
112
|
+
hasWrittenContent = true;
|
|
113
|
+
endsWithNewline = chunk.endsWith('\n');
|
|
114
|
+
}
|
|
115
|
+
await writer?.(chunk);
|
|
116
|
+
await atomicWriter?.write(chunk);
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
if (!hasWrittenContent || !endsWithNewline) {
|
|
120
|
+
await writer?.('\n');
|
|
121
|
+
await atomicWriter?.write('\n');
|
|
122
|
+
}
|
|
123
|
+
await atomicWriter?.close();
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
try {
|
|
127
|
+
await atomicWriter?.abort();
|
|
128
|
+
}
|
|
129
|
+
catch (cleanupError) {
|
|
130
|
+
throw attachCleanupCause(error, cleanupError);
|
|
131
|
+
}
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
85
135
|
/** Open a workspace ledger handle after reconciling any pending crash-recovery state. */
|
|
86
136
|
export const openLedger = async (workspaceRoot) => {
|
|
87
137
|
await readLabManifestMin(workspaceRoot);
|
|
@@ -115,7 +165,9 @@ export const openLedger = async (workspaceRoot) => {
|
|
|
115
165
|
}));
|
|
116
166
|
const outputPath = options.out ?? resolveRenderOutputPath(workspaceRoot, options.to);
|
|
117
167
|
if (outputPath) {
|
|
118
|
-
await writeAtomicTextFile(outputPath, `${content}${content.endsWith('\n') ? '' : '\n'}
|
|
168
|
+
await writeAtomicTextFile(outputPath, `${content}${content.endsWith('\n') ? '' : '\n'}`, {
|
|
169
|
+
registerTempFile: getExternalTempRegistrar(workspaceRoot, options.out),
|
|
170
|
+
});
|
|
119
171
|
}
|
|
120
172
|
return content;
|
|
121
173
|
},
|
|
@@ -127,38 +179,23 @@ export const openLedger = async (workspaceRoot) => {
|
|
|
127
179
|
workspaceRoot,
|
|
128
180
|
});
|
|
129
181
|
const outputPath = options.out ?? resolveRenderOutputPath(workspaceRoot, options.to);
|
|
130
|
-
const atomicWriter = outputPath
|
|
182
|
+
const atomicWriter = outputPath
|
|
183
|
+
? await createAtomicTextFileWriter(outputPath, {
|
|
184
|
+
registerTempFile: getExternalTempRegistrar(workspaceRoot, options.out),
|
|
185
|
+
})
|
|
186
|
+
: null;
|
|
131
187
|
const writer = options.write;
|
|
132
|
-
let hasWrittenContent = false;
|
|
133
|
-
let endsWithNewline = false;
|
|
134
188
|
if (!atomicWriter && !writer) {
|
|
135
189
|
throw new Error(`Render target ${options.to} requires either a writer callback or an output path.`);
|
|
136
190
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
hasWrittenContent = true;
|
|
146
|
-
endsWithNewline = chunk.endsWith('\n');
|
|
147
|
-
}
|
|
148
|
-
await writer?.(chunk);
|
|
149
|
-
await atomicWriter?.write(chunk);
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
if (!hasWrittenContent || !endsWithNewline) {
|
|
153
|
-
await writer?.('\n');
|
|
154
|
-
await atomicWriter?.write('\n');
|
|
155
|
-
}
|
|
156
|
-
await atomicWriter?.close();
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
await atomicWriter?.abort();
|
|
160
|
-
throw error;
|
|
161
|
-
}
|
|
191
|
+
await runRenderToWriters({
|
|
192
|
+
atomicWriter,
|
|
193
|
+
createEntries,
|
|
194
|
+
manifest: state.manifest,
|
|
195
|
+
target: options.to,
|
|
196
|
+
workspaceName: path.basename(workspaceRoot),
|
|
197
|
+
writer,
|
|
198
|
+
});
|
|
162
199
|
},
|
|
163
200
|
show: async (entryId) => {
|
|
164
201
|
const { manifest } = await loadLedgerState(workspaceRoot);
|
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;;EAuBlC,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,UAAU,MAAM,EAAE,cAAc,kBAG7D,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,UAAU,MAAM,EAAE,kBAAiB,kBAcpE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,KAAK,EACxC,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC7C,QAAQ,MAAM,OAAO,CAAC,KAAK,CAAC,mBAuB/B,CAAC"}
|
package/dist/helpers.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { mkdir, mkdtemp, rm, stat, utimes, writeFile } from 'node:fs/promises';
|
|
2
2
|
import os from 'node:os';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
+
import { V4_SCHEMA_VERSION } from 'ushman-lab-types';
|
|
4
5
|
export const createWorkspaceFixture = async () => {
|
|
5
6
|
const workspaceRoot = await mkdtemp(path.join(os.tmpdir(), 'ushman-ledger-'));
|
|
6
7
|
await mkdir(path.join(workspaceRoot, '.lab'), { recursive: true });
|
|
7
8
|
await mkdir(path.join(workspaceRoot, 'src'), { recursive: true });
|
|
8
9
|
await writeFile(path.join(workspaceRoot, '.lab', 'lab.json'), `${JSON.stringify({
|
|
9
|
-
schemaVersion:
|
|
10
|
+
schemaVersion: V4_SCHEMA_VERSION,
|
|
10
11
|
workspaceId: '3d71d4fb-dca0-4d63-9ad6-69d59a2395f4',
|
|
11
12
|
}, null, 2)}\n`, 'utf8');
|
|
12
13
|
return {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { type BuildRecordInput, buildChangeLogRecord, buildCorrectionRecord, buildOperatorDecisionRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from './builders.ts';
|
|
1
|
+
export { type BuildRecordInput, buildChangeLogRecord, buildCorrectionRecord, buildOperatorDecisionRecord, buildStageWriteRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from './builders.ts';
|
|
2
2
|
export { runLedgerCli } from './cli.ts';
|
|
3
3
|
export { type CoverageReport, computeCoverage } from './coverage.ts';
|
|
4
4
|
export { DOCTOR_FINDING_CODES, type DoctorFinding, type DoctorFindingCode, type DoctorFindingMetadataValue, type DoctorReport, runLedgerDoctor, } from './doctor.ts';
|
|
5
5
|
export { type LedgerHandle, type LedgerRenderOptions, type LedgerRenderToOptions, openLedger, type RenderTarget, type RenderWriter, } from './handle.ts';
|
|
6
6
|
export type { LedgerFilter } from './list.ts';
|
|
7
|
-
export { type LedgerRuntimeConfig, getLedgerRuntimeConfig, validateLedgerRuntimeConfig } from './runtime-config.ts';
|
|
8
7
|
export { appendCleanupWaveNote, appendDecompositionWaveNote, appendNote, appendOpenIssueNote, appendSemanticCleanupSummaryNote, appendVerifiedFlowNote, type NoteBody, } from './note.ts';
|
|
9
8
|
export { deriveFilesChangedFromPatch } from './patch-resolver.ts';
|
|
10
|
-
export {
|
|
9
|
+
export { getLedgerRuntimeConfig, type LedgerRuntimeConfig, validateLedgerRuntimeConfig } from './runtime-config.ts';
|
|
10
|
+
export { type AgentPatchDiff, AgentPatchDiffSchema, AgentPatchEntrySchema, AgentPatchRecordSchema, type ChangeLogEntry, ChangeLogEntrySchema, type ChangeLogFileChange, ChangeLogFileChangeSchema, type ChangeLogParityStatus, ChangeLogParityStatusSchema, type ChangeLogRecord, ChangeLogRecordSchema, type ChangeLogSmokeResult, ChangeLogSmokeResultSchema, type ChangeLogSubkind, ChangeLogSubkindSchema, CorrectionEntrySchema, CorrectionRecordSchema, EmitterSchema, type LedgerEntry, LedgerEntrySchema, type LedgerKind, type LedgerLinks, LedgerLinksSchema, type LedgerPhase, LedgerPhaseSchema, type LedgerRecord, LedgerRecordSchema, type NoteEntry, NoteEntrySchema, type OperatorDecisionAction, OperatorDecisionActionSchema, OperatorDecisionEntrySchema, type OperatorDecisionPayload, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchEntrySchema, OperatorPatchRecordSchema, parseLedgerEntry, parseLedgerRecord, RuntimeEventEntrySchema, STAGE_WRITE_STAGES, type StageWriteStage, StageWriteEntrySchema, StageWriteRecordSchema, StripDecisionRevertedEntrySchema, type StripDecisionRevertedPayload, StripDecisionRevertedPayloadSchema, StripDecisionRevertedRecordSchema, ToolInvocationEntrySchema, ToolInvocationRecordSchema, ValidatorResultEntrySchema, ValidatorResultRecordSchema, } from './schema/entry.ts';
|
|
11
11
|
export { type NoteSubkind, NoteSubkindSchema } from './schema/note.ts';
|
|
12
12
|
export { resolveLedgerPaths } from './storage/filesystem.ts';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,gBAAgB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EACH,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,eAAe,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,YAAY,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,gBAAgB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,2BAA2B,EAC3B,qBAAqB,EACrB,gCAAgC,EAChC,0BAA0B,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EACH,oBAAoB,EACpB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EACjB,eAAe,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACH,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,UAAU,EACV,KAAK,YAAY,EACjB,KAAK,YAAY,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAA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AAiB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { buildChangeLogRecord, buildCorrectionRecord, buildOperatorDecisionRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from "./builders.js";
|
|
1
|
+
export { buildChangeLogRecord, buildCorrectionRecord, buildOperatorDecisionRecord, buildStageWriteRecord, buildStripDecisionRevertedRecord, buildValidatorResultRecord, } from "./builders.js";
|
|
2
2
|
export { runLedgerCli } from "./cli.js";
|
|
3
3
|
export { computeCoverage } from "./coverage.js";
|
|
4
4
|
export { DOCTOR_FINDING_CODES, runLedgerDoctor, } from "./doctor.js";
|
|
5
5
|
export { openLedger, } from "./handle.js";
|
|
6
|
-
export { getLedgerRuntimeConfig, validateLedgerRuntimeConfig } from "./runtime-config.js";
|
|
7
6
|
export { appendCleanupWaveNote, appendDecompositionWaveNote, appendNote, appendOpenIssueNote, appendSemanticCleanupSummaryNote, appendVerifiedFlowNote, } from "./note.js";
|
|
8
7
|
export { deriveFilesChangedFromPatch } from "./patch-resolver.js";
|
|
9
|
-
export {
|
|
8
|
+
export { getLedgerRuntimeConfig, validateLedgerRuntimeConfig } from "./runtime-config.js";
|
|
9
|
+
export { AgentPatchDiffSchema, AgentPatchEntrySchema, AgentPatchRecordSchema, ChangeLogEntrySchema, ChangeLogFileChangeSchema, ChangeLogParityStatusSchema, ChangeLogRecordSchema, ChangeLogSmokeResultSchema, ChangeLogSubkindSchema, CorrectionEntrySchema, CorrectionRecordSchema, EmitterSchema, LedgerEntrySchema, LedgerLinksSchema, LedgerPhaseSchema, LedgerRecordSchema, NoteEntrySchema, OperatorDecisionActionSchema, OperatorDecisionEntrySchema, OperatorDecisionPayloadSchema, OperatorDecisionRecordSchema, OperatorPatchEntrySchema, OperatorPatchRecordSchema, parseLedgerEntry, parseLedgerRecord, RuntimeEventEntrySchema, STAGE_WRITE_STAGES, StageWriteEntrySchema, StageWriteRecordSchema, StripDecisionRevertedEntrySchema, StripDecisionRevertedPayloadSchema, StripDecisionRevertedRecordSchema, ToolInvocationEntrySchema, ToolInvocationRecordSchema, ValidatorResultEntrySchema, ValidatorResultRecordSchema, } from "./schema/entry.js";
|
|
10
10
|
export { NoteSubkindSchema } from "./schema/note.js";
|
|
11
11
|
export { resolveLedgerPaths } from "./storage/filesystem.js";
|
package/dist/lab-min.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from 'valibot';
|
|
2
2
|
export declare const LabManifestMin: v.LooseObjectSchema<{
|
|
3
3
|
readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
4
|
-
readonly schemaVersion: v.LiteralSchema<"
|
|
4
|
+
readonly schemaVersion: v.LiteralSchema<"shibuk-lab/v4.0", undefined>;
|
|
5
5
|
readonly workspaceId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
|
|
6
6
|
}, undefined>;
|
|
7
7
|
export type LabManifestMin = v.InferOutput<typeof LabManifestMin>;
|
package/dist/lab-min.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lab-min.d.ts","sourceRoot":"","sources":["../src/lab-min.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lab-min.d.ts","sourceRoot":"","sources":["../src/lab-min.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,eAAO,MAAM,cAAc;;;;aAIzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,kBAAkB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,cAAc,CAWtF,CAAC"}
|
package/dist/lab-min.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { V4_SCHEMA_VERSION } from 'ushman-lab-types';
|
|
3
4
|
import * as v from 'valibot';
|
|
4
5
|
export const LabManifestMin = v.looseObject({
|
|
5
6
|
createdAt: v.optional(v.string()),
|
|
6
|
-
schemaVersion: v.literal(
|
|
7
|
+
schemaVersion: v.literal(V4_SCHEMA_VERSION),
|
|
7
8
|
workspaceId: v.pipe(v.string(), v.uuid()),
|
|
8
9
|
});
|
|
9
10
|
export const readLabManifestMin = async (workspaceRoot) => {
|
package/dist/list.d.ts
CHANGED
|
@@ -76,6 +76,38 @@ export declare const readManifestEntryBatch: ({ allowMissing, entryLocations, en
|
|
|
76
76
|
schemaVersion: "ushman-ledger-entry/v1";
|
|
77
77
|
summary: string;
|
|
78
78
|
ts: string;
|
|
79
|
+
} | {
|
|
80
|
+
filePath: string;
|
|
81
|
+
kind: "stage-write";
|
|
82
|
+
rationale: string;
|
|
83
|
+
stage: "intake" | "seed" | "vendor-extract" | "cleanup" | "candidate-promotion";
|
|
84
|
+
details?: {
|
|
85
|
+
[x: string]: unknown;
|
|
86
|
+
} | undefined;
|
|
87
|
+
emitter: {
|
|
88
|
+
tool: string;
|
|
89
|
+
user?: string | undefined;
|
|
90
|
+
version: string;
|
|
91
|
+
};
|
|
92
|
+
id: string;
|
|
93
|
+
links: {
|
|
94
|
+
affectedFiles?: string[] | undefined;
|
|
95
|
+
blobs?: string[] | undefined;
|
|
96
|
+
briefId?: string | undefined;
|
|
97
|
+
correctsLedgerId?: string | undefined;
|
|
98
|
+
gitRef?: string | undefined;
|
|
99
|
+
idempotencyKey?: string | undefined;
|
|
100
|
+
stripDecisionId?: string | undefined;
|
|
101
|
+
supersedesLedgerId?: string | undefined;
|
|
102
|
+
validatorVerdictId?: string | undefined;
|
|
103
|
+
} & {
|
|
104
|
+
[key: string]: unknown;
|
|
105
|
+
};
|
|
106
|
+
phase: "capture" | "intake" | "seed" | "vendor-extract" | "cleanup" | "parity" | "characterize" | "equiv" | "analyze" | "recover" | "ship" | "migration";
|
|
107
|
+
prevEntryId: string | null;
|
|
108
|
+
schemaVersion: "ushman-ledger-entry/v1";
|
|
109
|
+
summary: string;
|
|
110
|
+
ts: string;
|
|
79
111
|
} | {
|
|
80
112
|
agent: {
|
|
81
113
|
name: string;
|
package/dist/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAG7B,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,MAAM,YAAY,GAAG;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAgDF,eAAO,MAAM,wBAAwB,GACjC,UAAU,cAAc,EACxB,WAAW,eAAe,EAC1B,QAAQ,YAAY,EACpB,YAAW,KAAK,GAAG,MAAc,4BAgBpC,CAAC;AAiCF,eAAO,MAAM,sBAAsB,GAAU,wEAK1C;IACC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/list.ts"],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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAQI,CAAC;AAkDN,eAAO,MAAM,0BAA0B,GACnC,eAAe,MAAM,EACrB,UAAU,cAAc,EACxB,WAAW,eAAe,EAC1B,SAAQ,YAAiB,EACzB,YAAW,KAAK,GAAG,MAAc,KAClC,aAAa,CAAC,WAAW,CAkC3B,CAAC;AAEF,eAAO,MAAM,WAAW,GACpB,eAAe,MAAM,EACrB,SAAQ,YAAiB,KAC1B,aAAa,CAAC,WAAW,CAG3B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,eAAe,MAAM,EAAE,SAAQ,YAAiB,KAAG,OAAO,CAAC,WAAW,EAAE,CAM5G,CAAC"}
|
package/dist/list.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mapWithConcurrencyLimit } from "./async.js";
|
|
2
2
|
import { matchesReadIndexFilter, } from "./read-index.js";
|
|
3
|
-
import { getLedgerRuntimeConfig } from "./runtime-config.js";
|
|
4
3
|
import { loadLedgerState } from "./recovery.js";
|
|
4
|
+
import { getLedgerRuntimeConfig } from "./runtime-config.js";
|
|
5
5
|
import { parseLedgerEntry } from "./schema/entry.js";
|
|
6
6
|
import { readPhaseEntryText } from "./storage/filesystem.js";
|
|
7
7
|
const matchesFilter = (entry, filter) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch-resolver.d.ts","sourceRoot":"","sources":["../src/patch-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patch-resolver.d.ts","sourceRoot":"","sources":["../src/patch-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,YAAY,EAEpB,MAAM,mBAAmB,CAAC;AAK3B,KAAK,gBAAgB,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AACvE,KAAK,mBAAmB,GAAG,OAAO,CAAC,YAAY,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAAC;AAQ7E,KAAK,wBAAwB,GAAG,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACxF,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC/B,CAAC;AACF,KAAK,2BAA2B,GAAG,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IAC9F,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,GAAG,2BAA2B,CAAC;AAsTzF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,GAAI,WAAW,MAAM,KAAG,mBAAmB,EAuClF,CAAC;AAmBF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACtC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC"}
|
package/dist/patch-resolver.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile, stat } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import * as v from 'valibot';
|
|
4
|
-
import { assertPatchTextWithinLimit, readPatchTextFromFile, resolveBlobPath, storePatchBlob
|
|
4
|
+
import { assertPatchTextWithinLimit, readPatchTextFromFile, resolveBlobPath, storePatchBlob } from "./blobs.js";
|
|
5
5
|
import { WorkspaceRelativePathSchema, } from "./schema/entry.js";
|
|
6
6
|
import { forEachLine } from "./text-lines.js";
|
|
7
7
|
const readBlobText = async (workspaceRoot, blobSha256) => readFile(resolveBlobPath(workspaceRoot, blobSha256), 'utf8');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,YAczC,CAAC"}
|
package/dist/process.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const isProcessAlive = (pid) => {
|
|
2
|
+
try {
|
|
3
|
+
process.kill(pid, 0);
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
const code = error.code;
|
|
8
|
+
if (code === 'EPERM') {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (code === 'ESRCH') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
package/dist/read-index.d.ts
CHANGED
|
@@ -3,14 +3,14 @@ import { type LedgerEntry, type LedgerKind, type LedgerPhase } from './schema/en
|
|
|
3
3
|
import type { LedgerManifest } from './schema/manifest.ts';
|
|
4
4
|
declare const ReadIndexEntrySchema: v.ObjectSchema<{
|
|
5
5
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
6
|
-
readonly kind: v.PicklistSchema<readonly ["tool-invocation", "agent-patch", "operator-patch", "operator-decision", "validator-result", "runtime-event", "note", "correction", "strip-decision-reverted", "change-log"], undefined>;
|
|
6
|
+
readonly kind: v.PicklistSchema<readonly ["tool-invocation", "stage-write", "agent-patch", "operator-patch", "operator-decision", "validator-result", "runtime-event", "note", "correction", "strip-decision-reverted", "change-log"], undefined>;
|
|
7
7
|
readonly ts: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
8
8
|
}, undefined>;
|
|
9
9
|
declare const LedgerReadIndexSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
10
10
|
readonly coveredFiles: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
11
11
|
readonly entries: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
12
12
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
13
|
-
readonly kind: v.PicklistSchema<readonly ["tool-invocation", "agent-patch", "operator-patch", "operator-decision", "validator-result", "runtime-event", "note", "correction", "strip-decision-reverted", "change-log"], undefined>;
|
|
13
|
+
readonly kind: v.PicklistSchema<readonly ["tool-invocation", "stage-write", "agent-patch", "operator-patch", "operator-decision", "validator-result", "runtime-event", "note", "correction", "strip-decision-reverted", "change-log"], undefined>;
|
|
14
14
|
readonly ts: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
|
|
15
15
|
}, undefined>, undefined>, readonly []>;
|
|
16
16
|
readonly entryCount: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -21,7 +21,7 @@ declare const LedgerReadIndexSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
21
21
|
coveredFiles: string[];
|
|
22
22
|
entries: {
|
|
23
23
|
id: string;
|
|
24
|
-
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
24
|
+
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "stage-write" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
25
25
|
ts: string;
|
|
26
26
|
}[];
|
|
27
27
|
entryCount: number;
|
|
@@ -32,7 +32,7 @@ declare const LedgerReadIndexSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
32
32
|
coveredFiles: string[];
|
|
33
33
|
entries: {
|
|
34
34
|
id: string;
|
|
35
|
-
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
35
|
+
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "stage-write" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
36
36
|
ts: string;
|
|
37
37
|
}[];
|
|
38
38
|
entryCount: number;
|
|
@@ -50,7 +50,7 @@ export declare const buildReadIndexFromManifest: (workspaceRoot: string, manifes
|
|
|
50
50
|
coveredFiles: string[];
|
|
51
51
|
entries: {
|
|
52
52
|
id: string;
|
|
53
|
-
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
53
|
+
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "stage-write" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
54
54
|
ts: string;
|
|
55
55
|
}[];
|
|
56
56
|
entryCount: number;
|
|
@@ -65,7 +65,7 @@ export declare const ensureReadIndexUnderLock: (workspaceRoot: string, manifest:
|
|
|
65
65
|
coveredFiles: string[];
|
|
66
66
|
entries: {
|
|
67
67
|
id: string;
|
|
68
|
-
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
68
|
+
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "stage-write" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
69
69
|
ts: string;
|
|
70
70
|
}[];
|
|
71
71
|
entryCount: number;
|
|
@@ -81,7 +81,7 @@ export declare const appendEntryToReadIndex: ({ entry, readIndex, sequence, }: {
|
|
|
81
81
|
coveredFiles: string[];
|
|
82
82
|
entries: {
|
|
83
83
|
id: string;
|
|
84
|
-
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
84
|
+
kind: "operator-decision" | "validator-result" | "change-log" | "tool-invocation" | "stage-write" | "agent-patch" | "operator-patch" | "runtime-event" | "note" | "correction" | "strip-decision-reverted";
|
|
85
85
|
ts: string;
|
|
86
86
|
}[];
|
|
87
87
|
entryCount: number;
|
package/dist/read-index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-index.d.ts","sourceRoot":"","sources":["../src/read-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B,OAAO,EAAgB,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAoB,MAAM,mBAAmB,CAAC;AACxH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,QAAA,MAAM,oBAAoB;;;;aAIxB,CAAC;AAEH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAc1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE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C,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC7B;;;;;;;;;;;CASA,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,uCAIpC;IACC,QAAQ,CAAC,MAAM,EAAE;QACb,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;QAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;QAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;CAC3C,YAeA,CAAC"}
|
package/dist/read-index.js
CHANGED
|
@@ -32,6 +32,15 @@ const buildReadIndexEntry = (entry) => ({
|
|
|
32
32
|
kind: entry.kind,
|
|
33
33
|
ts: entry.ts,
|
|
34
34
|
});
|
|
35
|
+
const getCoverageFilesForEntry = (entry) => {
|
|
36
|
+
if (entry.kind === 'stage-write') {
|
|
37
|
+
return [...new Set([entry.filePath, ...(entry.links.affectedFiles ?? [])])];
|
|
38
|
+
}
|
|
39
|
+
if (entry.kind === 'agent-patch' || entry.kind === 'operator-patch') {
|
|
40
|
+
return entry.links.affectedFiles ?? [];
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
};
|
|
35
44
|
const sortBySequence = (left, right) => left[1].sequence - right[1].sequence;
|
|
36
45
|
const getManifestSequenceLocations = (manifest) => Object.entries(manifest.entryLocations).sort(sortBySequence);
|
|
37
46
|
const mergeSortedUniquePaths = (existingPaths, additionalPaths) => {
|
|
@@ -88,11 +97,8 @@ const readIndexedEntryBatch = async ({ entryReadConcurrency, entryLocations, wor
|
|
|
88
97
|
workspaceRoot,
|
|
89
98
|
}));
|
|
90
99
|
const collectCoveredFiles = (entry, coveredFiles) => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
for (const affectedFile of entry.links.affectedFiles ?? []) {
|
|
95
|
-
coveredFiles.add(affectedFile);
|
|
100
|
+
for (const coveredFile of getCoverageFilesForEntry(entry)) {
|
|
101
|
+
coveredFiles.add(coveredFile);
|
|
96
102
|
}
|
|
97
103
|
};
|
|
98
104
|
export const buildReadIndexFromManifest = async (workspaceRoot, manifest) => {
|
|
@@ -103,8 +109,8 @@ export const buildReadIndexFromManifest = async (workspaceRoot, manifest) => {
|
|
|
103
109
|
for (let index = 0; index < orderedEntryLocations.length; index += readIndexRebuildBatchSize) {
|
|
104
110
|
const batch = orderedEntryLocations.slice(index, index + readIndexRebuildBatchSize);
|
|
105
111
|
const resolvedEntries = await readIndexedEntryBatch({
|
|
106
|
-
entryReadConcurrency: readIndexRebuildConcurrency,
|
|
107
112
|
entryLocations: batch,
|
|
113
|
+
entryReadConcurrency: readIndexRebuildConcurrency,
|
|
108
114
|
workspaceRoot,
|
|
109
115
|
});
|
|
110
116
|
for (const entry of resolvedEntries) {
|
|
@@ -166,9 +172,7 @@ export const ensureReadIndexUnderLock = async (workspaceRoot, manifest) => {
|
|
|
166
172
|
};
|
|
167
173
|
export const appendEntryToReadIndex = ({ entry, readIndex, sequence, }) => {
|
|
168
174
|
const nextEntries = [...readIndex.entries, buildReadIndexEntry(entry)];
|
|
169
|
-
const nextCoveredFiles =
|
|
170
|
-
? mergeSortedUniquePaths(readIndex.coveredFiles, entry.links.affectedFiles ?? [])
|
|
171
|
-
: [...readIndex.coveredFiles];
|
|
175
|
+
const nextCoveredFiles = mergeSortedUniquePaths(readIndex.coveredFiles, getCoverageFilesForEntry(entry));
|
|
172
176
|
return buildReadIndex({
|
|
173
177
|
coveredFiles: nextCoveredFiles,
|
|
174
178
|
entries: nextEntries,
|
package/dist/record.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../src/record.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,KAAK,WAAW,EAMnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAU3D,KAAK,qBAAqB,GAAG;IACzB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpF,CAAC;AAOF,eAAO,MAAM,wBAAwB,GAAI,eAAe,MAAM,EAAE,OAAO,qBAAqB,GAAG,IAAI,SAOlG,CAAC;AA0EF,eAAO,MAAM,YAAY,GACrB,eAAe,MAAM,EACrB,OAAO,OAAO,KACf,OAAO,CAAC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAsF5C,CAAC;AAEF,eAAO,MAAM,aAAa,GACtB,eAAe,MAAM,EACrB,UAAU,cAAc,EACxB,SAAS,MAAM,KAChB,OAAO,CAAC,WAAW,CASrB,CAAC"}
|
package/dist/record.js
CHANGED
|
@@ -2,8 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import * as v from 'valibot';
|
|
4
4
|
import { sha256Hex, stableStringify } from "./json.js";
|
|
5
|
-
import { getNextManifestSequence } from "./manifest-update.js";
|
|
6
|
-
import { updateManifestForEntry } from "./manifest-update.js";
|
|
5
|
+
import { getNextManifestSequence, updateManifestForEntry } from "./manifest-update.js";
|
|
7
6
|
import { resolvePatchRecord } from "./patch-resolver.js";
|
|
8
7
|
import { appendEntryToReadIndex, saveReadIndex } from "./read-index.js";
|
|
9
8
|
import { reconcileLedgerStateUnderLock, removePendingCommit, writePendingCommit } from "./recovery.js";
|
package/dist/recovery.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { type LedgerReadIndex } from './read-index.ts';
|
|
2
2
|
import { type LedgerEntry } from './schema/entry.ts';
|
|
3
3
|
import type { LedgerManifest } from './schema/manifest.ts';
|
|
4
|
+
export type PendingCommitQuarantine = {
|
|
5
|
+
readonly commitPath: string;
|
|
6
|
+
readonly metadataPath: string | null;
|
|
7
|
+
readonly originalFileName: string;
|
|
8
|
+
readonly quarantinedAt: string | null;
|
|
9
|
+
readonly reason: string;
|
|
10
|
+
};
|
|
4
11
|
export type PreparedLedgerState = {
|
|
5
12
|
readonly manifest: LedgerManifest;
|
|
6
13
|
readonly readIndex: LedgerReadIndex;
|
|
@@ -12,6 +19,7 @@ export declare const writePendingCommit: ({ entry, logicalHash, manifest, worksp
|
|
|
12
19
|
readonly workspaceRoot: string;
|
|
13
20
|
}) => Promise<string>;
|
|
14
21
|
export declare const removePendingCommit: (filePath: string) => Promise<void>;
|
|
22
|
+
export declare const listPendingCommitQuarantines: (workspaceRoot: string) => Promise<PendingCommitQuarantine[]>;
|
|
15
23
|
export declare const reconcilePendingCommitsUnderLock: (workspaceRoot: string) => Promise<{
|
|
16
24
|
archives: {
|
|
17
25
|
createdAt: string;
|
package/dist/recovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../src/recovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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