@claude-flow/cli 3.56.10 → 3.57.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/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +2 -2
- package/README.md +12 -3
- package/catalog-manifest.json +2 -2
- package/dist/src/commands/daemon.js +8 -2
- package/dist/src/commands/doctor.js +95 -18
- package/dist/src/commands/policy.js +6 -1
- package/dist/src/index.js +5 -5
- package/dist/src/init/settings-generator.js +4 -58
- package/dist/src/mcp-tools/memory-tools.d.ts +1 -1
- package/dist/src/mcp-tools/memory-tools.js +30 -5
- package/dist/src/mcp-tools/metaharness-tools.js +1 -1
- package/dist/src/mcp-tools/neural-tools.js +20 -50
- package/dist/src/mcp-tools/policy-tools.js +5 -3
- package/dist/src/memory/intelligence.js +80 -33
- package/dist/src/memory/stats-file-lock.d.ts +7 -0
- package/dist/src/memory/stats-file-lock.js +53 -0
- package/dist/src/missions/schemas.d.ts +113 -113
- package/dist/src/mods/command-registry/schema.d.ts +193 -193
- package/dist/src/services/distill-oracle.d.ts +1 -1
- package/dist/src/services/distill-oracle.js +2 -2
- package/dist/src/services/policy-anchor-log.d.ts +13 -0
- package/dist/src/services/policy-anchor-log.js +242 -0
- package/dist/src/services/policy-archive-scan.d.ts +7 -0
- package/dist/src/services/policy-archive-scan.js +50 -0
- package/dist/src/services/policy-ledger-anchor.d.ts +14 -8
- package/dist/src/services/policy-ledger-anchor.js +356 -40
- package/dist/src/services/policy-ledger-audit.d.ts +22 -0
- package/dist/src/services/policy-ledger-audit.js +260 -0
- package/dist/src/services/policy-ledger-record.d.ts +3 -0
- package/dist/src/services/policy-ledger-record.js +22 -0
- package/dist/src/services/policy-runtime.d.ts +1 -0
- package/dist/src/services/policy-runtime.js +261 -40
- package/node_modules/@claude-flow/codex/dist/cli.js +0 -0
- package/node_modules/@claude-flow/plugin-agent-federation/dist/bin.js +0 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +6 -6
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts +17 -1
- package/node_modules/@claude-flow/security/dist/policy/engine.d.ts.map +1 -1
- package/node_modules/@claude-flow/security/dist/policy/engine.js +99 -24
- package/node_modules/@claude-flow/security/dist/policy/engine.js.map +1 -1
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts +14 -1
- package/node_modules/@claude-flow/security/dist/policy/types.d.ts.map +1 -1
- package/node_modules/@claude-flow/security/dist/policy/types.js +3 -1
- package/node_modules/@claude-flow/security/dist/policy/types.js.map +1 -1
- package/package.json +3 -3
- package/plugins/ruflo-console/dist/tui.mjs +153 -153
- package/plugins/ruflo-metaharness/hooks/screen.ts +7 -1
- package/plugins/ruflo-metaharness/scripts/_darwin.mjs +4 -4
- package/plugins/ruflo-metaharness/.claude-flow/daemon-state.json +0 -179
- package/plugins/ruflo-metaharness/.claude-flow/daemon.pid +0 -1
- package/plugins/ruflo-metaharness/.claude-flow/logs/daemon.log +0 -32
- package/plugins/ruflo-metaharness/.claude-flow/metrics/backup.json +0 -23
- package/plugins/ruflo-metaharness/.claude-flow/metrics/codebase-map.json +0 -11
- package/plugins/ruflo-metaharness/.claude-flow/metrics/consolidation.json +0 -16
- package/plugins/ruflo-metaharness/.claude-flow/metrics/harness-loop.json +0 -91
- package/plugins/ruflo-metaharness/.claude-flow/metrics/performance.json +0 -17
- package/plugins/ruflo-metaharness/.claude-flow/metrics/security-audit.json +0 -12
- package/plugins/ruflo-metaharness/.claude-flow/metrics/test-gaps.json +0 -8
- package/plugins/ruflo-metaharness/.claude-flow/neural/patterns.json +0 -2809
- package/plugins/ruflo-metaharness/.claude-flow/neural/stats.json +0 -6
- package/plugins/ruflo-metaharness/.claude-flow/policy/state.json +0 -11
- package/plugins/ruflo-metaharness/.swarm/agentdb-memory.db +0 -0
- package/plugins/ruflo-metaharness/.swarm/agentdb-memory.db-shm +0 -0
- package/plugins/ruflo-metaharness/.swarm/agentdb-memory.db-wal +0 -0
- package/plugins/ruflo-metaharness/.swarm/backups/memory-2026-10-14T16-09-38-164Z.db +0 -0
- package/plugins/ruflo-metaharness/.swarm/backups/store-agentdb-memory.db-2026-10-14T16-09-38-166Z.db +0 -0
- package/plugins/ruflo-metaharness/.swarm/ewc-fisher.json +0 -397
- package/plugins/ruflo-metaharness/.swarm/memory.db +0 -0
- package/plugins/ruflo-metaharness/.swarm/memory.db-shm +0 -0
- package/plugins/ruflo-metaharness/.swarm/memory.db-wal +0 -0
- package/plugins/ruflo-metaharness/agentdb.rvf +0 -0
- package/plugins/ruflo-metaharness/agentdb.rvf.lock +0 -0
- package/plugins/ruflo-metaharness/ruvector.db +0 -0
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import { type VerifyTaskKind } from '../ruvector/output-verifier.js';
|
|
38
38
|
import { FableHarness, type ReflectItem, type ReflectResult } from './fable-harness.js';
|
|
39
|
-
export declare const MH_DARWIN_PIN = "0.
|
|
39
|
+
export declare const MH_DARWIN_PIN = "0.12.0";
|
|
40
40
|
export type ResolvedProvenance = 'oracle:test-exec' | 'judge:fable' | 'proxy:structural';
|
|
41
41
|
/** SWE-bench-shaped / bench-suite-mapped test spec that Tier 1 can execute. */
|
|
42
42
|
export interface TestSpec {
|
|
@@ -43,9 +43,9 @@ import { FableHarness, } from './fable-harness.js';
|
|
|
43
43
|
// behavior mid-run (the #142 pin-drift failure mode). Pin it, and let
|
|
44
44
|
// scripts/check-metaharness-pins.mjs watch this constant for drift. Kept in
|
|
45
45
|
// lock-step with the optionalDependencies pin in package.json and the plugin
|
|
46
|
-
// darwin cache (versioned by the plugin's own `~0.
|
|
46
|
+
// darwin cache (versioned by the plugin's own `~0.12.0` pin in _darwin.mjs;
|
|
47
47
|
// both are checked by scripts/check-metaharness-pins.mjs — #3366).
|
|
48
|
-
export const MH_DARWIN_PIN = '0.
|
|
48
|
+
export const MH_DARWIN_PIN = '0.12.0';
|
|
49
49
|
// ── Public API ───────────────────────────────────────────────────────────
|
|
50
50
|
/**
|
|
51
51
|
* Label each trajectory with `resolved` + honest provenance, trying the tiers
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ATOMIC_JSON_WRITER: unique symbol;
|
|
2
|
+
export interface AtomicJsonSource {
|
|
3
|
+
[ATOMIC_JSON_WRITER](fd: number): void;
|
|
4
|
+
}
|
|
5
|
+
/** Supports property order/whitespace from ordinary JSON writers. Unknown
|
|
6
|
+
* root values remain bounded and syntax-checked; duplicate known keys fail. */
|
|
7
|
+
export declare function anchorEntries(file: string): Generator<unknown>;
|
|
8
|
+
/** Serialization callback runs inside the runtime's existing durable atomic
|
|
9
|
+
* writer. Failure removes the temporary file; no partial log is published. */
|
|
10
|
+
export declare function appendedAnchorLog(file: string | undefined, next: unknown, validate: (value: unknown, sequence: number, previous: string | null) => value is {
|
|
11
|
+
hash: string;
|
|
12
|
+
}): AtomicJsonSource;
|
|
13
|
+
//# sourceMappingURL=policy-anchor-log.d.ts.map
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/** Streaming reader/writer for the existing version-1 anchor JSON object.
|
|
2
|
+
* Every entry is still parsed and authenticated by the caller. This bounds
|
|
3
|
+
* memory without weakening historical validation or changing the log format.
|
|
4
|
+
*/
|
|
5
|
+
import { closeSync, constants, fstatSync, openSync, readSync, writeSync } from 'node:fs';
|
|
6
|
+
import { TextDecoder } from 'node:util';
|
|
7
|
+
export const ATOMIC_JSON_WRITER = Symbol('policy-atomic-json-writer');
|
|
8
|
+
const CHUNK_BYTES = 64 * 1024;
|
|
9
|
+
const VALUE_LIMIT = 16 * 1024 * 1024;
|
|
10
|
+
const STRING_STRUCTURE = /["\\]/g;
|
|
11
|
+
const VALUE_STRUCTURE = /["\\{}\[\]]/g;
|
|
12
|
+
class JsonReader {
|
|
13
|
+
fd;
|
|
14
|
+
buffer = Buffer.allocUnsafe(CHUNK_BYTES);
|
|
15
|
+
decoder = new TextDecoder('utf-8', { fatal: true });
|
|
16
|
+
text = '';
|
|
17
|
+
cursor = 0;
|
|
18
|
+
position = 0;
|
|
19
|
+
ended = false;
|
|
20
|
+
constructor(file) {
|
|
21
|
+
this.fd = openSync(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
22
|
+
try {
|
|
23
|
+
if (!fstatSync(this.fd).isFile())
|
|
24
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
closeSync(this.fd);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
close() { closeSync(this.fd); }
|
|
32
|
+
peek() {
|
|
33
|
+
while (this.cursor >= this.text.length && !this.ended) {
|
|
34
|
+
const count = readSync(this.fd, this.buffer, 0, this.buffer.length, this.position);
|
|
35
|
+
this.position += count;
|
|
36
|
+
this.text = this.decoder.decode(this.buffer.subarray(0, count), { stream: count !== 0 });
|
|
37
|
+
this.cursor = 0;
|
|
38
|
+
if (!count)
|
|
39
|
+
this.ended = true;
|
|
40
|
+
}
|
|
41
|
+
return this.text[this.cursor] ?? '';
|
|
42
|
+
}
|
|
43
|
+
next() { const character = this.peek(); if (character)
|
|
44
|
+
this.cursor++; return character; }
|
|
45
|
+
whitespace() { while (/[ \t\r\n]/.test(this.peek()) && this.peek())
|
|
46
|
+
this.next(); }
|
|
47
|
+
expect(character) { this.whitespace(); if (this.next() !== character)
|
|
48
|
+
throw new Error('policy-anchor-log-corrupt'); }
|
|
49
|
+
value() {
|
|
50
|
+
this.whitespace();
|
|
51
|
+
const first = this.peek();
|
|
52
|
+
if (!first)
|
|
53
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
54
|
+
const compound = first === '{' || first === '[';
|
|
55
|
+
const string = first === '"';
|
|
56
|
+
const parts = [];
|
|
57
|
+
let bytes = 0;
|
|
58
|
+
let depth = 0;
|
|
59
|
+
let quoted = false;
|
|
60
|
+
let escaped = false;
|
|
61
|
+
for (;;) {
|
|
62
|
+
if (!this.peek()) {
|
|
63
|
+
if (quoted || depth !== 0 || !parts.length)
|
|
64
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
const start = this.cursor;
|
|
68
|
+
let end = start;
|
|
69
|
+
let complete = false;
|
|
70
|
+
// Scan the available segment directly. Avoid per-character method,
|
|
71
|
+
// regular-expression and string-concatenation overhead on mature logs.
|
|
72
|
+
for (; end < this.text.length; end++) {
|
|
73
|
+
if (!escaped && (quoted || compound)) {
|
|
74
|
+
const markers = quoted ? STRING_STRUCTURE : VALUE_STRUCTURE;
|
|
75
|
+
markers.lastIndex = end;
|
|
76
|
+
const next = markers.exec(this.text);
|
|
77
|
+
if (!next) {
|
|
78
|
+
end = this.text.length;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
end = next.index;
|
|
82
|
+
}
|
|
83
|
+
const code = this.text.charCodeAt(end);
|
|
84
|
+
if (!quoted && depth === 0 && (parts.length > 0 || end > start) && !compound && !string
|
|
85
|
+
&& (code === 32 || code === 9 || code === 10 || code === 13 || code === 44 || code === 125 || code === 93)) {
|
|
86
|
+
complete = true;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
if (quoted) {
|
|
90
|
+
if (escaped)
|
|
91
|
+
escaped = false;
|
|
92
|
+
else if (code === 92)
|
|
93
|
+
escaped = true;
|
|
94
|
+
else if (code === 34) {
|
|
95
|
+
quoted = false;
|
|
96
|
+
if (string && depth === 0) {
|
|
97
|
+
end++;
|
|
98
|
+
complete = true;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else if (code === 34)
|
|
104
|
+
quoted = true;
|
|
105
|
+
else if (code === 123 || code === 91)
|
|
106
|
+
depth++;
|
|
107
|
+
else if (code === 125 || code === 93) {
|
|
108
|
+
depth--;
|
|
109
|
+
if (depth < 0)
|
|
110
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
111
|
+
if (compound && depth === 0) {
|
|
112
|
+
end++;
|
|
113
|
+
complete = true;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const segment = this.text.slice(start, end);
|
|
119
|
+
bytes += Buffer.byteLength(segment);
|
|
120
|
+
if (bytes > VALUE_LIMIT)
|
|
121
|
+
throw new Error('policy-anchor-log-record-too-large');
|
|
122
|
+
if (segment)
|
|
123
|
+
parts.push(segment);
|
|
124
|
+
this.cursor = end;
|
|
125
|
+
if (complete)
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
// JSON.parse validates the complete bounded token's grammar, including
|
|
129
|
+
// bracket kinds, escapes, control characters and scalar spellings.
|
|
130
|
+
return JSON.parse(parts.join(''));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Supports property order/whitespace from ordinary JSON writers. Unknown
|
|
134
|
+
* root values remain bounded and syntax-checked; duplicate known keys fail. */
|
|
135
|
+
export function* anchorEntries(file) {
|
|
136
|
+
const reader = new JsonReader(file);
|
|
137
|
+
let version;
|
|
138
|
+
let seenVersion = false;
|
|
139
|
+
let seenEntries = false;
|
|
140
|
+
try {
|
|
141
|
+
reader.expect('{');
|
|
142
|
+
reader.whitespace();
|
|
143
|
+
if (reader.peek() === '}')
|
|
144
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
145
|
+
for (;;) {
|
|
146
|
+
const key = reader.value();
|
|
147
|
+
if (typeof key !== 'string')
|
|
148
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
149
|
+
reader.expect(':');
|
|
150
|
+
if (key === 'entries') {
|
|
151
|
+
if (seenEntries)
|
|
152
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
153
|
+
seenEntries = true;
|
|
154
|
+
reader.expect('[');
|
|
155
|
+
reader.whitespace();
|
|
156
|
+
if (reader.peek() !== ']') {
|
|
157
|
+
for (;;) {
|
|
158
|
+
yield reader.value();
|
|
159
|
+
reader.whitespace();
|
|
160
|
+
if (reader.peek() === ']')
|
|
161
|
+
break;
|
|
162
|
+
reader.expect(',');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
reader.expect(']');
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const value = reader.value();
|
|
169
|
+
if (key === 'version') {
|
|
170
|
+
if (seenVersion)
|
|
171
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
172
|
+
seenVersion = true;
|
|
173
|
+
version = value;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
reader.whitespace();
|
|
177
|
+
if (reader.peek() === '}')
|
|
178
|
+
break;
|
|
179
|
+
reader.expect(',');
|
|
180
|
+
}
|
|
181
|
+
reader.expect('}');
|
|
182
|
+
reader.whitespace();
|
|
183
|
+
if (reader.peek() || !seenEntries || !seenVersion || version !== 1)
|
|
184
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
reader.close();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function writeText(fd, text) {
|
|
191
|
+
const bytes = Buffer.from(text);
|
|
192
|
+
let count = 0;
|
|
193
|
+
while (count < bytes.length) {
|
|
194
|
+
const next = writeSync(fd, bytes, count, bytes.length - count);
|
|
195
|
+
if (!next)
|
|
196
|
+
throw new Error('policy-anchor-log-short-write');
|
|
197
|
+
count += next;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/** Serialization callback runs inside the runtime's existing durable atomic
|
|
201
|
+
* writer. Failure removes the temporary file; no partial log is published. */
|
|
202
|
+
export function appendedAnchorLog(file, next, validate) {
|
|
203
|
+
return { [ATOMIC_JSON_WRITER](fd) {
|
|
204
|
+
let pending = '';
|
|
205
|
+
let pendingBytes = 0;
|
|
206
|
+
const flush = () => { if (pendingBytes)
|
|
207
|
+
writeText(fd, pending); pending = ''; pendingBytes = 0; };
|
|
208
|
+
const emit = (text) => {
|
|
209
|
+
const bytes = Buffer.byteLength(text);
|
|
210
|
+
if (pendingBytes + bytes > CHUNK_BYTES)
|
|
211
|
+
flush();
|
|
212
|
+
if (bytes >= CHUNK_BYTES)
|
|
213
|
+
writeText(fd, text);
|
|
214
|
+
else {
|
|
215
|
+
pending += text;
|
|
216
|
+
pendingBytes += bytes;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
emit('{"version":1,"entries":[\n');
|
|
220
|
+
let count = 0;
|
|
221
|
+
let previous = null;
|
|
222
|
+
if (file) {
|
|
223
|
+
for (const entry of anchorEntries(file)) {
|
|
224
|
+
if (!validate(entry, count, previous))
|
|
225
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
226
|
+
if (count)
|
|
227
|
+
emit(',\n');
|
|
228
|
+
emit(JSON.stringify(entry));
|
|
229
|
+
count++;
|
|
230
|
+
previous = entry.hash;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (!validate(next, count, previous))
|
|
234
|
+
throw new Error('policy-anchor-log-corrupt');
|
|
235
|
+
if (count)
|
|
236
|
+
emit(',\n');
|
|
237
|
+
emit(JSON.stringify(next));
|
|
238
|
+
emit('\n]}\n');
|
|
239
|
+
flush();
|
|
240
|
+
} };
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=policy-anchor-log.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Fixed-chunk reverse archive scan used by the synchronous anchor gate.
|
|
2
|
+
* Memory follows the largest single line, never the entire archive/window.
|
|
3
|
+
*/
|
|
4
|
+
import { readSync } from 'node:fs';
|
|
5
|
+
const CHUNK_BYTES = 64 * 1024;
|
|
6
|
+
export function* reverseArchiveRecords(fd, size, limit) {
|
|
7
|
+
let position = size;
|
|
8
|
+
let parts = [];
|
|
9
|
+
let partBytes = 0;
|
|
10
|
+
let terminated = false;
|
|
11
|
+
while (position > 0) {
|
|
12
|
+
const count = Math.min(CHUNK_BYTES, position);
|
|
13
|
+
position -= count;
|
|
14
|
+
const chunk = Buffer.allocUnsafe(count);
|
|
15
|
+
let read = 0;
|
|
16
|
+
while (read < count) {
|
|
17
|
+
const next = readSync(fd, chunk, read, count - read, position + read);
|
|
18
|
+
if (!next)
|
|
19
|
+
throw new Error('policy-ledger-archive-changed');
|
|
20
|
+
read += next;
|
|
21
|
+
}
|
|
22
|
+
let end = chunk.length;
|
|
23
|
+
for (;;) {
|
|
24
|
+
const newline = chunk.lastIndexOf(10, end - 1);
|
|
25
|
+
if (newline < 0)
|
|
26
|
+
break;
|
|
27
|
+
const piece = chunk.subarray(newline + 1, end);
|
|
28
|
+
if (piece.length + partBytes > limit)
|
|
29
|
+
throw new Error(`policy-ledger-archive-record-too-large:${limit}`);
|
|
30
|
+
const bytes = parts.length ? Buffer.concat([piece, ...parts], piece.length + partBytes) : Buffer.from(piece);
|
|
31
|
+
yield { bytes, offset: position + newline + 1, terminated };
|
|
32
|
+
terminated = true;
|
|
33
|
+
parts = [];
|
|
34
|
+
partBytes = 0;
|
|
35
|
+
end = newline;
|
|
36
|
+
if (end === 0)
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
if (end > 0) {
|
|
40
|
+
if (partBytes + end > limit)
|
|
41
|
+
throw new Error(`policy-ledger-archive-record-too-large:${limit}`);
|
|
42
|
+
const piece = Buffer.from(chunk.subarray(0, end));
|
|
43
|
+
parts.unshift(piece);
|
|
44
|
+
partBytes += piece.length;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (partBytes > 0)
|
|
48
|
+
yield { bytes: Buffer.concat(parts, partBytes), offset: 0, terminated };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=policy-archive-scan.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AtomicJsonSource } from './policy-anchor-log.js';
|
|
2
|
+
import { type PolicyState } from '@claude-flow/security/policy/index';
|
|
2
3
|
export type AnchorEvent = 'append' | 'migrated-from-state' | 'establish-anchor';
|
|
3
4
|
export interface AnchorEntry {
|
|
4
5
|
seq: number;
|
|
@@ -8,6 +9,15 @@ export interface AnchorEntry {
|
|
|
8
9
|
ts: number;
|
|
9
10
|
event: AnchorEvent;
|
|
10
11
|
by?: string;
|
|
12
|
+
/**
|
|
13
|
+
* How much of the archive this anchor claims (`state.retainedFrom` at
|
|
14
|
+
* anchor time) and the hash of its newest archived receipt (#3892 Blocker
|
|
15
|
+
* 1). Absent on anchors written before this field existed, or for a
|
|
16
|
+
* ledger that has never been pruned — both resolve to a vacuous pass so
|
|
17
|
+
* the unpruned baseline stays byte-for-byte identical (see `entryHash`).
|
|
18
|
+
*/
|
|
19
|
+
archivedThrough?: number;
|
|
20
|
+
archiveHeadHash?: string | null;
|
|
11
21
|
hash: string;
|
|
12
22
|
}
|
|
13
23
|
export type AnchorAssessment = {
|
|
@@ -21,6 +31,7 @@ export type AnchorAssessment = {
|
|
|
21
31
|
error: string;
|
|
22
32
|
};
|
|
23
33
|
export type AnchorWriter = (file: string, value: unknown) => Promise<void>;
|
|
34
|
+
export type StreamingAnchorWriter = (file: string, value: AtomicJsonSource) => Promise<void>;
|
|
24
35
|
export declare const anchorLogPath: (projectRoot: string) => string;
|
|
25
36
|
/**
|
|
26
37
|
* Directory holding per-project trust material (anchor mirror, HMAC key).
|
|
@@ -30,19 +41,14 @@ export declare const anchorLogPath: (projectRoot: string) => string;
|
|
|
30
41
|
* user who already has trust state under the legacy ~/.config keeps using it.
|
|
31
42
|
*/
|
|
32
43
|
export declare function policyTrustRoot(): string;
|
|
33
|
-
/**
|
|
34
|
-
* How the stored anchors relate to `state`; read-only. `rebuild` is the
|
|
35
|
-
* explicit-establish path: an unreadable log or mirror is treated as absent, but
|
|
36
|
-
* whatever readable anchor remains must still agree with the chain, so it can
|
|
37
|
-
* never bless a truncation the anchors still remember.
|
|
38
|
-
*/
|
|
44
|
+
/** Convert archive record-limit/UTF8 failures into structured gate failures. */
|
|
39
45
|
export declare function assessAnchors(projectRoot: string, state: PolicyState, rebuild?: boolean): AnchorAssessment;
|
|
40
46
|
/**
|
|
41
47
|
* Append an entry for the current state if the newest entry does not already
|
|
42
48
|
* describe it. Must run under the policy lock. Throws if the log is corrupt:
|
|
43
49
|
* only an explicit establish may replace a corrupt log.
|
|
44
50
|
*/
|
|
45
|
-
export declare function recordAnchor(projectRoot: string, state: PolicyState, write: AnchorWriter, event?: AnchorEvent, by?: string): Promise<void>;
|
|
51
|
+
export declare function recordAnchor(projectRoot: string, state: PolicyState, write: AnchorWriter, event?: AnchorEvent, by?: string, writeLog?: StreamingAnchorWriter, assessedTip?: AnchorEntry): Promise<void>;
|
|
46
52
|
export declare function anchorPosture(projectRoot: string): {
|
|
47
53
|
log: boolean;
|
|
48
54
|
mirror: boolean;
|