@allocator-one/rcl 4.5.4 → 4.5.5

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 (64) hide show
  1. package/README.md +3 -3
  2. package/dist/converge/attempt-budget.d.ts +14 -0
  3. package/dist/converge/attempt-budget.js +216 -1
  4. package/dist/converge/attempt-budget.js.map +1 -1
  5. package/dist/converge/launch-guard.js +23 -6
  6. package/dist/converge/launch-guard.js.map +1 -1
  7. package/dist/converge/launch-record.d.ts +36 -0
  8. package/dist/converge/launch-record.js +9 -3
  9. package/dist/converge/launch-record.js.map +1 -1
  10. package/dist/converge/legacy-launch-health.d.ts +36 -0
  11. package/dist/converge/native-lock.d.ts +3 -1
  12. package/dist/converge/native-lock.js +4 -4
  13. package/dist/converge/native-lock.js.map +1 -1
  14. package/dist/converge/ordinary-pending-export.d.ts +3 -0
  15. package/dist/converge/ordinary-pending-export.js +64 -17
  16. package/dist/converge/ordinary-pending-export.js.map +1 -1
  17. package/dist/converge/ordinary-pending-package.d.ts +11 -0
  18. package/dist/converge/ordinary-pending-package.js +18 -4
  19. package/dist/converge/ordinary-pending-package.js.map +1 -1
  20. package/dist/converge/pending-finalization-receipt.d.ts +4 -0
  21. package/dist/converge/pending-finalization-receipt.js +102 -0
  22. package/dist/converge/pending-finalization-receipt.js.map +1 -0
  23. package/dist/converge/pending-legacy-resume.d.ts +42 -3
  24. package/dist/converge/pending-legacy-resume.js +164 -32
  25. package/dist/converge/pending-legacy-resume.js.map +1 -1
  26. package/dist/converge/pending-recovery-source.d.ts +114 -0
  27. package/dist/converge/pending-recovery-source.js +36 -1
  28. package/dist/converge/pending-recovery-source.js.map +1 -1
  29. package/dist/converge/process-identity.d.ts +51 -0
  30. package/dist/converge/process-identity.js +190 -0
  31. package/dist/converge/process-identity.js.map +1 -0
  32. package/dist/converge/recovery-launch.js +39 -17
  33. package/dist/converge/recovery-launch.js.map +1 -1
  34. package/dist/converge/recovery-state.d.ts +55 -0
  35. package/dist/converge/recovery-state.js +306 -0
  36. package/dist/converge/recovery-state.js.map +1 -0
  37. package/dist/converge/run-state.d.ts +39 -1
  38. package/dist/converge/run-state.js +246 -18
  39. package/dist/converge/run-state.js.map +1 -1
  40. package/dist/converge/semantic-state.d.ts +55 -0
  41. package/dist/converge/semantic-state.js +666 -0
  42. package/dist/converge/semantic-state.js.map +1 -0
  43. package/dist/converge/stale-report.d.ts +36 -0
  44. package/dist/dispatch/async-lane.d.ts +12 -0
  45. package/dist/dispatch/async-lane.js +94 -0
  46. package/dist/dispatch/async-lane.js.map +1 -1
  47. package/dist/evidence/claim-recovery/validation/native-state.d.ts +22 -0
  48. package/dist/evidence/claim-recovery/validation/native-state.js +91 -9
  49. package/dist/evidence/claim-recovery/validation/native-state.js.map +1 -1
  50. package/dist/evidence/claim-recovery/validation/obligations.js +2 -1
  51. package/dist/evidence/claim-recovery/validation/obligations.js.map +1 -1
  52. package/dist/evidence/claim-recovery/validation/semantic-validation.d.ts +11 -0
  53. package/dist/evidence/claim-recovery/validation/semantic-validation.js +105 -28
  54. package/dist/evidence/claim-recovery/validation/semantic-validation.js.map +1 -1
  55. package/dist/evidence/claim-recovery/validation/types.d.ts +10 -0
  56. package/dist/evidence/original-run/lock-scope.d.ts +12 -6
  57. package/dist/evidence/original-run/lock-scope.js +12 -9
  58. package/dist/evidence/original-run/lock-scope.js.map +1 -1
  59. package/dist/index.js +31 -10
  60. package/dist/index.js.map +1 -1
  61. package/dist/telemetry/recovery/files.d.ts +4 -0
  62. package/dist/telemetry/recovery/files.js +15 -5
  63. package/dist/telemetry/recovery/files.js.map +1 -1
  64. package/package.json +1 -1
@@ -0,0 +1,306 @@
1
+ import { createHash, randomUUID } from 'node:crypto';
2
+ import { constants } from 'node:fs';
3
+ import { link, mkdir, open, realpath, rename, rm } from 'node:fs/promises';
4
+ import { dirname } from 'node:path';
5
+ import { isDeepStrictEqual } from 'node:util';
6
+ import { claimHistoryContent, sameClaimHistoryEvidence } from '../evidence/claim-recovery/carrier-inventory.js';
7
+ import { deriveCurrentClaimProjection } from '../evidence/claim-recovery/validation/current-projection.js';
8
+ import { nativeMaterial, operationOccurrences, packNativeMaterial } from '../evidence/claim-recovery/validation/native-material.js';
9
+ import { deriveNativeOccurrenceEvidence } from '../evidence/claim-recovery/validation/native-occurrences.js';
10
+ import { validateRetainedNativeEvidence, effectivePendingIdentities, recoveryAnchors, validateNativeRecoveryOperationInput, verifyNativeRecoveryLineage, MAX_NATIVE_RECOVERY_SNAPSHOT_BYTES } from '../evidence/claim-recovery/validation/native-state.js';
11
+ import { validateRecoveryMaterials } from '../evidence/claim-recovery/validation/materials.js';
12
+ import { decodeRecoveryOriginal } from '../evidence/claim-recovery/validation/recovery-json.js';
13
+ import { object } from '../evidence/claim-recovery/validation/primitives.js';
14
+ import { inspectRecoveryDirectory } from '../evidence/original-run/lock-path.js';
15
+ import { syncDirectory } from '../evidence/original-run/journal.js';
16
+ import { readStable } from '../telemetry/recovery/files.js';
17
+ import { assertRecoveryTargetOwnership, withOwnedNativeOperation } from './target-ownership.js';
18
+ import { convergeRunStatePath, loadConvergeRunStateEvidence } from './run-state.js';
19
+ const MAX_BYTES = 64 * 1024 * 1024;
20
+ export { MAX_NATIVE_RECOVERY_SNAPSHOT_BYTES };
21
+ const sha = (raw) => createHash('sha256').update(raw).digest('hex');
22
+ const requireSource = (valid) => {
23
+ if (!valid)
24
+ throw new Error('native_recovery_source_conflict');
25
+ };
26
+ function mergeMaterials(first, second) {
27
+ const rows = new Map();
28
+ for (const row of [...first, ...second]) {
29
+ const old = rows.get(row.sha256);
30
+ requireSource(!old || old.text === row.text);
31
+ rows.set(row.sha256, row);
32
+ }
33
+ return [...rows.values()];
34
+ }
35
+ /** Pure exact-byte preview. Effectful authority is checked by applyNativeRecovery. */
36
+ export function deriveNativeRecovery(input, projectionVersion = 2) {
37
+ try {
38
+ const source = verifyNativeRecoveryLineage(input.sourceJson, input.target, input.nativeSourceJsons).state;
39
+ validateNativeRecoveryOperationInput(input);
40
+ const priorOccurrences = source.recovery?.operations.flatMap(operation => {
41
+ const value = operationOccurrences(operation, input.recoveryMaterials ?? []);
42
+ return value ? [value] : [];
43
+ }) ?? [];
44
+ const occurrences = deriveNativeOccurrenceEvidence(input, {
45
+ target: input.target,
46
+ sourceJson: input.sourceJson,
47
+ nativeSourceJsons: input.nativeSourceJsons,
48
+ anchors: [...recoveryAnchors(source), ...input.anchors],
49
+ previous: priorOccurrences,
50
+ });
51
+ const currentProjection = input.currentHistory
52
+ ? deriveCurrentClaimProjection(source, [...recoveryAnchors(source), ...input.anchors], [...priorOccurrences, ...(occurrences ? [occurrences] : [])], input.currentHistory, input.nativeSourceJsons, input.sourceJson, projectionVersion)
53
+ : undefined;
54
+ requireSource(!currentProjection || input.externalMaterial);
55
+ const packed = input.externalMaterial && (occurrences || currentProjection)
56
+ ? packNativeMaterial({ ...(occurrences ? { occurrences } : {}), ...(currentProjection ? { currentProjection } : {}) })
57
+ : undefined;
58
+ const operation = {
59
+ operationId: input.operationId,
60
+ sourceVersion: source.version,
61
+ sourceSha256: sha(input.sourceJson),
62
+ anchors: structuredClone(input.anchors),
63
+ sourceReceipts: structuredClone(input.sourceReceipts),
64
+ ...(packed ? { material: packed.reference } : occurrences ? { occurrences } : {}),
65
+ };
66
+ const materials = packed
67
+ ? mergeMaterials(input.recoveryMaterials ?? [], packed.materials)
68
+ : structuredClone(input.recoveryMaterials ?? []);
69
+ const result = {
70
+ ...source,
71
+ version: 3,
72
+ sightings: source.sightings ?? [],
73
+ recovery: {
74
+ version: packed || source.recovery?.version === 2 ? 2 : 1,
75
+ operations: [...(source.recovery?.operations ?? []), operation],
76
+ },
77
+ };
78
+ const resultJson = `${JSON.stringify(result, null, 2)}\n`;
79
+ requireSource(Buffer.byteLength(resultJson) <= MAX_BYTES);
80
+ return {
81
+ ...structuredClone(input),
82
+ ...(packed ? { recoveryMaterials: materials } : {}),
83
+ sourceVersion: source.version,
84
+ sourceSha256: operation.sourceSha256,
85
+ resultJson,
86
+ resultSha256: sha(resultJson),
87
+ actionableIdentities: effectivePendingIdentities(result),
88
+ };
89
+ }
90
+ catch (error) {
91
+ if (error instanceof Error && error.message.startsWith('native_recovery_'))
92
+ throw error;
93
+ throw new Error('native_recovery_source_conflict', { cause: error });
94
+ }
95
+ }
96
+ export function nativeRecoveryPlanProjectionVersion(plan) {
97
+ if (!plan.currentHistory)
98
+ return 2;
99
+ requireSource(sha(plan.resultJson) === plan.resultSha256);
100
+ const result = decodeState(plan.resultJson, plan.target);
101
+ const operation = result.recovery?.operations.at(-1);
102
+ requireSource(operation?.operationId === plan.operationId && operation.sourceSha256 === plan.sourceSha256 && operation.material);
103
+ const projection = nativeMaterial(operation.material, plan.recoveryMaterials ?? []).currentProjection;
104
+ requireSource(projection && isDeepStrictEqual(projection.history, plan.currentHistory));
105
+ return projection.version;
106
+ }
107
+ function materialPath(commonDir, target, digest) {
108
+ requireSource(/^[a-f0-9]{64}$/.test(digest));
109
+ return `${convergeRunStatePath(commonDir, target)}.recovery-materials/${digest}`;
110
+ }
111
+ function snapshotPath(commonDir, target, digest) {
112
+ requireSource(/^[a-f0-9]{64}$/.test(digest));
113
+ return `${convergeRunStatePath(commonDir, target)}.recovery-sources/${digest}.json`;
114
+ }
115
+ function reportPath(commonDir, target, digest) {
116
+ requireSource(/^[a-f0-9]{64}$/.test(digest));
117
+ return `${convergeRunStatePath(commonDir, target)}.evidence/${digest}.json`;
118
+ }
119
+ function decodeState(raw, target) {
120
+ const decoded = decodeRecoveryOriginal(raw, { exactNumbers: true });
121
+ requireSource(decoded.transformations.length === 0 && object(decoded.value));
122
+ const state = decoded.value;
123
+ requireSource([1, 2, 3].includes(state.version) && state.target === target && Array.isArray(state.rounds) && object(state.findings));
124
+ return state;
125
+ }
126
+ export async function readNativeRecoveryMaterials(commonDir, state) {
127
+ const ids = [...new Set(state.recovery?.operations.flatMap(operation => operation.material?.sha256s ?? []) ?? [])];
128
+ requireSource(ids.length <= 20_000);
129
+ const rows = [];
130
+ let remaining = MAX_BYTES;
131
+ for (const id of ids) {
132
+ const raw = await readStable(materialPath(commonDir, state.target, id), remaining);
133
+ requireSource(raw.sha256 === id);
134
+ remaining -= raw.raw.length;
135
+ requireSource(remaining >= 0);
136
+ rows.push({ sha256: id, text: raw.text });
137
+ }
138
+ validateRecoveryMaterials(rows);
139
+ return rows;
140
+ }
141
+ /** Read only canonical exact predecessors, with one aggregate pre-read budget. */
142
+ export async function readNativeRecoverySourceJsons(commonDir, state) {
143
+ const snapshots = [];
144
+ const seen = new Set();
145
+ const maximum = (state.recovery?.operations.length ?? 0) + (state.migration ? 1 : 0);
146
+ let remaining = MAX_NATIVE_RECOVERY_SNAPSHOT_BYTES;
147
+ let current = state;
148
+ while (current.version === 3) {
149
+ requireSource(snapshots.length < maximum && current.recovery?.operations.length);
150
+ const operation = current.recovery.operations.at(-1);
151
+ requireSource(/^[a-f0-9]{64}$/.test(operation.sourceSha256) && !seen.has(operation.sourceSha256));
152
+ seen.add(operation.sourceSha256);
153
+ const source = await readStable(snapshotPath(commonDir, state.target, operation.sourceSha256), remaining);
154
+ remaining -= source.raw.length;
155
+ requireSource(remaining >= 0 && source.sha256 === operation.sourceSha256);
156
+ snapshots.push(source.text);
157
+ current = decodeState(source.text, state.target);
158
+ }
159
+ if (current.version === 2 && current.migration) {
160
+ requireSource(snapshots.length < maximum);
161
+ const migration = current.migration;
162
+ requireSource(await realpath(migration.snapshotPath) ===
163
+ await realpath(`${convergeRunStatePath(commonDir, state.target)}.v1-${migration.sourceSha256}.snapshot`));
164
+ const source = await readStable(migration.snapshotPath, remaining);
165
+ requireSource(source.sha256 === migration.sourceSha256 && !seen.has(source.sha256));
166
+ snapshots.push(source.text);
167
+ }
168
+ return snapshots;
169
+ }
170
+ /** Validate exact retained bytes and all physical recovery reads. */
171
+ export async function validateNativeRecoveryState(state, commonDir, raw) {
172
+ try {
173
+ requireSource(state.version === 3);
174
+ const sourceRaw = raw ?? Buffer.from(`${JSON.stringify(state, null, 2)}\n`);
175
+ requireSource(sourceRaw.equals(Buffer.from(sourceRaw.toString('utf8'))));
176
+ const sources = await readNativeRecoverySourceJsons(commonDir, state);
177
+ const admissionSourceJsons = [];
178
+ let admissionSourceBytes = MAX_BYTES;
179
+ for (const digest of [...new Set(state.rounds.flatMap(round => round.admission ? [round.admission.sourceStateSha256] : []))]) {
180
+ const source = await readStable(snapshotPath(commonDir, state.target, digest), admissionSourceBytes);
181
+ admissionSourceBytes -= source.raw.length;
182
+ requireSource(admissionSourceBytes >= 0 && source.sha256 === digest);
183
+ admissionSourceJsons.push(source.text);
184
+ }
185
+ const materials = await readNativeRecoveryMaterials(commonDir, state);
186
+ const reportDigests = [...new Set([
187
+ ...state.recovery.operations.flatMap(operation => operation.anchors.map(anchor => anchor.source.reportSha256)),
188
+ ...state.rounds.flatMap(round => round.reportBinding ? [round.reportBinding.reportSha256] : []),
189
+ ])];
190
+ let remaining = MAX_BYTES;
191
+ const reports = [];
192
+ for (const digest of reportDigests) {
193
+ const report = await readStable(reportPath(commonDir, state.target, digest), remaining);
194
+ remaining -= report.raw.length;
195
+ requireSource(remaining >= 0 && report.sha256 === digest);
196
+ reports.push(report.text);
197
+ }
198
+ validateRetainedNativeEvidence({
199
+ sourceJson: sourceRaw.toString('utf8'), target: state.target, reports,
200
+ nativeSourceJsons: sources, admissionSourceJsons, recoveryMaterials: materials,
201
+ });
202
+ }
203
+ catch (cause) {
204
+ throw new Error('native_recovery_state_invalid', { cause });
205
+ }
206
+ }
207
+ async function retainRaw(path, raw) {
208
+ const directory = dirname(path);
209
+ await mkdir(directory, { recursive: true, mode: 0o700 });
210
+ await inspectRecoveryDirectory(directory, true);
211
+ await syncDirectory(dirname(directory));
212
+ const temporary = `${path}.${randomUUID()}.retain-tmp`;
213
+ let handle;
214
+ let created = false;
215
+ try {
216
+ handle = await open(temporary, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | (constants.O_NOFOLLOW ?? 0), 0o600);
217
+ created = true;
218
+ await handle.writeFile(raw);
219
+ await handle.sync();
220
+ await handle.close();
221
+ handle = undefined;
222
+ try {
223
+ await link(temporary, path);
224
+ }
225
+ catch (error) {
226
+ if (error.code !== 'EEXIST' || (await readStable(path, MAX_BYTES)).text !== raw)
227
+ throw error;
228
+ const retained = await open(path, constants.O_RDWR | (constants.O_NOFOLLOW ?? 0));
229
+ try {
230
+ await retained.sync();
231
+ }
232
+ finally {
233
+ await retained.close();
234
+ }
235
+ }
236
+ await syncDirectory(directory);
237
+ }
238
+ finally {
239
+ try {
240
+ if (handle)
241
+ await handle.close();
242
+ }
243
+ finally {
244
+ if (created)
245
+ await rm(temporary, { force: true });
246
+ }
247
+ }
248
+ }
249
+ /** Retain the exact pre-admission native bytes authenticated by a round report. */
250
+ export async function retainNativeRecoverySource(commonDir, target, raw) {
251
+ const digest = sha(raw);
252
+ await retainRaw(snapshotPath(commonDir, target, digest), raw);
253
+ return digest;
254
+ }
255
+ /** Exact CAS under strict target ownership; an already-applied result is not rewritten. */
256
+ export function applyNativeRecovery(options) {
257
+ const plan = structuredClone(options.plan);
258
+ const commonInput = options.gitCommonDir;
259
+ return withOwnedNativeOperation(options.ownership, commonInput, plan.target, async (ownership) => {
260
+ await assertRecoveryTargetOwnership(ownership, commonInput, plan.target);
261
+ const commonDir = await realpath(commonInput);
262
+ if (plan.currentHistory) {
263
+ requireSource(options.history && sameClaimHistoryEvidence(claimHistoryContent(options.history), plan.currentHistory) &&
264
+ Date.parse(plan.currentHistory.readWindow.completedAt) <= Date.parse(claimHistoryContent(options.history).readWindow.completedAt));
265
+ }
266
+ validateRecoveryMaterials(plan.recoveryMaterials ?? []);
267
+ const expected = deriveNativeRecovery(plan, nativeRecoveryPlanProjectionVersion(plan));
268
+ requireSource(plan.sourceVersion === expected.sourceVersion && plan.sourceSha256 === expected.sourceSha256 &&
269
+ plan.resultJson === expected.resultJson && plan.resultSha256 === expected.resultSha256 &&
270
+ isDeepStrictEqual(plan.actionableIdentities, expected.actionableIdentities));
271
+ const { assertReviewCyclePair, assertNoPendingFreshReview } = await import('./fresh-review.js');
272
+ await assertNoPendingFreshReview(commonDir, plan.target);
273
+ await assertReviewCyclePair(commonDir, plan.target, decodeState(plan.resultJson, plan.target).cycle);
274
+ const path = convergeRunStatePath(commonDir, plan.target);
275
+ await inspectRecoveryDirectory(dirname(path), true);
276
+ const observed = await readStable(path, MAX_BYTES);
277
+ const snapshot = snapshotPath(commonDir, plan.target, plan.sourceSha256);
278
+ if (observed.sha256 === plan.resultSha256 && observed.text === plan.resultJson) {
279
+ await validateNativeRecoveryState(decodeState(observed.text, plan.target), commonDir, observed.raw);
280
+ await retainRaw(path, plan.resultJson);
281
+ return { status: 'already_applied', snapshotPath: snapshot, resultSha256: plan.resultSha256 };
282
+ }
283
+ requireSource(observed.sha256 === plan.sourceSha256 && observed.text === plan.sourceJson);
284
+ const native = await loadConvergeRunStateEvidence(commonDir, plan.target);
285
+ requireSource(native?.sha256 === observed.sha256);
286
+ await retainRaw(snapshot, plan.sourceJson);
287
+ for (const report of plan.reports)
288
+ await retainRaw(reportPath(commonDir, plan.target, sha(report)), report);
289
+ for (const row of plan.recoveryMaterials ?? [])
290
+ await retainRaw(materialPath(commonDir, plan.target, row.sha256), row.text);
291
+ await validateNativeRecoveryState(decodeState(plan.resultJson, plan.target), commonDir, Buffer.from(plan.resultJson));
292
+ const temporary = `${path}.${randomUUID()}.recovery-tmp`;
293
+ try {
294
+ await retainRaw(temporary, plan.resultJson);
295
+ requireSource((await readStable(path, MAX_BYTES)).sha256 === plan.sourceSha256);
296
+ await rename(temporary, path);
297
+ await syncDirectory(dirname(path));
298
+ }
299
+ finally {
300
+ await rm(temporary, { force: true });
301
+ }
302
+ return { status: 'applied', snapshotPath: snapshot, resultSha256: plan.resultSha256 };
303
+ });
304
+ }
305
+ export { effectivePendingIdentities, recoveryAnchors, verifyNativeRecoveryLineage };
306
+ //# sourceMappingURL=recovery-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recovery-state.js","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AE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC5C,aAAa,CAAC,CAAC,MAAM,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,YAAY,CAAC,CAAC;YAChF,MAAM,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC9B,MAAM,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACrC,CAAC;gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,SAAkB,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC;IACjG,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,2BAA2B,EAAE,CAAC"}
@@ -4,8 +4,13 @@ import { type NativeTargetOwnership } from './target-ownership.js';
4
4
  import { type RoundGapEntry } from './round-gap-schema.js';
5
5
  import { type HistoricalDeliveryReconciliationEntry } from './historical-delivery-reconciliation-schema.js';
6
6
  import type { ConsensusFinding } from '../consensus/types.js';
7
+ import type { ClaimDescriptor } from '../evidence/claim-recovery/validation/claims.js';
8
+ import type { NativeRecoveryMetadata, ReportBinding, RoundAdmissionSnapshot, SemanticSighting } from '../evidence/claim-recovery/validation/types.js';
9
+ import { type RecoveryProjectionFreshness } from '../evidence/claim-recovery/validation/current-projection.js';
7
10
  import type { GuardedLaunchState } from './launch-guard.js';
8
11
  import { type NativeReviewCycle } from './review-cycle.js';
12
+ import { verdictClearsPending } from '../evidence/claim-recovery/validation/obligations.js';
13
+ export { verdictClearsPending };
9
14
  /**
10
15
  * Per-converge-run state (RCL-24): the machine-enforced round cap and the
11
16
  * cross-round finding ledger (identity, verdicts, suppression). Lives next
@@ -55,6 +60,8 @@ export interface FindingEntry {
55
60
  * pre-2.1.1 states — the retained `severity` is frozen before new sightings.
56
61
  */
57
62
  verdictSeverity?: string;
63
+ claimDescriptor?: ClaimDescriptor;
64
+ pendingRound?: number;
58
65
  }
59
66
  export interface RoundCounts {
60
67
  new: number;
@@ -63,8 +70,15 @@ export interface RoundCounts {
63
70
  regating: number;
64
71
  }
65
72
  export interface ConvergeRunState {
66
- version: 1 | 2;
73
+ version: 1 | 2 | 3;
67
74
  cycle?: NativeReviewCycle;
75
+ recovery?: NativeRecoveryMetadata;
76
+ sightings?: SemanticSighting[];
77
+ migration?: {
78
+ sourceSha256: string;
79
+ snapshotPath: string;
80
+ migratedAt: string;
81
+ };
68
82
  target: string;
69
83
  roundCap: number;
70
84
  /** `runId` is the report's `run.id` (rcl ≥ 3.0), which converge-verdict sends with every verdict. */
@@ -72,6 +86,9 @@ export interface ConvergeRunState {
72
86
  round: number;
73
87
  counts: RoundCounts;
74
88
  runId?: string;
89
+ reportBinding?: ReportBinding;
90
+ /** Immutable obligations at semantic admission, before verdict or later recovery mutation. */
91
+ admission?: RoundAdmissionSnapshot;
75
92
  /** Strongest sighting per identity in this round, including for delayed verdicts. Absent in legacy state. */
76
93
  severities?: Record<string, ConsensusFinding['severity']>;
77
94
  }>;
@@ -104,6 +121,8 @@ export interface ConvergeRunState {
104
121
  status: FindingStatus;
105
122
  gating: string;
106
123
  }>;
124
+ /** Pending obligations as admitted, before verdicts can clear them. */
125
+ actionableBeforeTriage?: string[];
107
126
  };
108
127
  }
109
128
  export type FindingStatus = 'new' | 'repeat' | 'suppressed' | 'regating';
@@ -112,10 +131,15 @@ export interface AnnotatedRoundFinding {
112
131
  status: FindingStatus;
113
132
  suppressReason?: string;
114
133
  finding: ConsensusFinding;
134
+ sighting?: SemanticSighting;
115
135
  }
116
136
  export interface RoundReport {
117
137
  roundCap: number;
118
138
  counts: RoundCounts;
139
+ actionableIdentities?: string[];
140
+ reportBinding?: ReportBinding;
141
+ classificationVersion?: 1;
142
+ legacyPendingIdentities?: string[];
119
143
  findings: AnnotatedRoundFinding[];
120
144
  }
121
145
  export declare function convergeRunStatePath(gitCommonDir: string, target: string): string;
@@ -127,6 +151,8 @@ export declare function loadConvergeRunStateEvidence(gitCommonDir: string, targe
127
151
  } | undefined>;
128
152
  /** Persist only under live explicit target authority; started writes drain before release. */
129
153
  export declare function writeState(gitCommonDir: string, state: ConvergeRunState, ownership: NativeTargetOwnership): Promise<void>;
154
+ /** Exact ordinary CAS for retained transitions under the same target lease. */
155
+ export declare function writeStateIfUnchanged(gitCommonDir: string, sourceSha256: string, next: ConvergeRunState, ownership: NativeTargetOwnership): Promise<'written' | 'already-written'>;
130
156
  /** Read-only qualification for an update to an existing native state file. */
131
157
  export declare function preflightConvergeRunStateWrite(gitCommonDir: string, state: ConvergeRunState, ownership: NativeTargetOwnership): Promise<void>;
132
158
  export declare function loadConvergeRunState(gitCommonDir: string, target: string): Promise<ConvergeRunState | undefined>;
@@ -176,6 +202,9 @@ export interface ProcessRoundOptions {
176
202
  lineWindow?: number;
177
203
  /** The report's own run id, kept so verdicts can be bound to the round's run. */
178
204
  runId?: string;
205
+ evidence?: {
206
+ reportJson: string;
207
+ };
179
208
  reportSha256?: string;
180
209
  cycleId?: string;
181
210
  ownership?: NativeTargetOwnership;
@@ -196,6 +225,7 @@ export interface RoundResolution {
196
225
  /** Identities recorded fixed this round (any status — every fix changes the patch). */
197
226
  fixedThisRound: number;
198
227
  status: 'converged-dismissal-only' | 'fixes-pending-fresh-round' | 'unresolved';
228
+ recoveryProjection?: RecoveryProjectionFreshness;
199
229
  }
200
230
  export interface RecordVerdictsResult {
201
231
  runId?: string;
@@ -222,7 +252,15 @@ export interface RecordVerdictsOptions {
222
252
  verdict: FindingVerdict;
223
253
  reason?: string;
224
254
  }>;
255
+ requireVerifiedBinding?: boolean;
225
256
  ownership?: NativeTargetOwnership;
226
257
  }
227
258
  export declare function recordVerdicts(options: RecordVerdictsOptions): Promise<RecordVerdictsResult>;
228
259
  export declare function resolveRoundResolution(state: ConvergeRunState, round: number): RoundResolution | undefined;
260
+ /** Pure ordinary verdict projection for retained persistence before any write. */
261
+ export declare function prepareVerdicts(source: ConvergeRunState, options: Omit<RecordVerdictsOptions, 'gitCommonDir' | 'ownership' | 'requireVerifiedBinding'> & {
262
+ recordedAt: string;
263
+ }): {
264
+ state: ConvergeRunState;
265
+ result: RecordVerdictsResult;
266
+ };