dsh-research-report 0.1.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/CHANGELOG.md +18 -0
- package/LICENSE +201 -0
- package/README.es.md +155 -0
- package/README.hi.md +155 -0
- package/README.md +155 -0
- package/README.pt.md +155 -0
- package/README.zh.md +155 -0
- package/THIRD_PARTY_NOTICES.md +21 -0
- package/cordis.patch.yml +24 -0
- package/lib/index.js +2143 -0
- package/lib/types/assemble.d.ts +123 -0
- package/lib/types/assemble.d.ts.map +1 -0
- package/lib/types/assemble.js +239 -0
- package/lib/types/assemble.js.map +1 -0
- package/lib/types/config.d.ts +48 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +60 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/gather.d.ts +119 -0
- package/lib/types/gather.d.ts.map +1 -0
- package/lib/types/gather.js +165 -0
- package/lib/types/gather.js.map +1 -0
- package/lib/types/index.d.ts +51 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +71 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/ledger.d.ts +159 -0
- package/lib/types/ledger.d.ts.map +1 -0
- package/lib/types/ledger.js +276 -0
- package/lib/types/ledger.js.map +1 -0
- package/lib/types/provider-local.d.ts +137 -0
- package/lib/types/provider-local.d.ts.map +1 -0
- package/lib/types/provider-local.js +418 -0
- package/lib/types/provider-local.js.map +1 -0
- package/lib/types/service.d.ts +302 -0
- package/lib/types/service.d.ts.map +1 -0
- package/lib/types/service.js +31 -0
- package/lib/types/service.js.map +1 -0
- package/lib/types/tools/evidence-add.d.ts +36 -0
- package/lib/types/tools/evidence-add.d.ts.map +1 -0
- package/lib/types/tools/evidence-add.js +107 -0
- package/lib/types/tools/evidence-add.js.map +1 -0
- package/lib/types/tools/ledger-query.d.ts +42 -0
- package/lib/types/tools/ledger-query.d.ts.map +1 -0
- package/lib/types/tools/ledger-query.js +154 -0
- package/lib/types/tools/ledger-query.js.map +1 -0
- package/lib/types/tools/research-report.d.ts +67 -0
- package/lib/types/tools/research-report.d.ts.map +1 -0
- package/lib/types/tools/research-report.js +345 -0
- package/lib/types/tools/research-report.js.map +1 -0
- package/lib/types/verify.d.ts +128 -0
- package/lib/types/verify.d.ts.map +1 -0
- package/lib/types/verify.js +208 -0
- package/lib/types/verify.js.map +1 -0
- package/lib/types/version.d.ts +7 -0
- package/lib/types/version.d.ts.map +1 -0
- package/lib/types/version.js +7 -0
- package/lib/types/version.js.map +1 -0
- package/package.json +147 -0
- package/src/assemble.ts +302 -0
- package/src/config.ts +97 -0
- package/src/gather.ts +239 -0
- package/src/index.ts +139 -0
- package/src/ledger.ts +344 -0
- package/src/provider-local.ts +489 -0
- package/src/service.ts +322 -0
- package/src/tools/evidence-add.ts +132 -0
- package/src/tools/ledger-query.ts +191 -0
- package/src/tools/research-report.ts +424 -0
- package/src/verify.ts +285 -0
- package/src/version.ts +7 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The local Provider of the research-report seam: assembles the filesystem
|
|
3
|
+
* evidence ledger, the byte-level verifier, the optional numeric bridge, and
|
|
4
|
+
* the sealing renderer into the `ctx.researchReport` service implementation.
|
|
5
|
+
* @module dsh-research-report/provider-local
|
|
6
|
+
*/
|
|
7
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { KNOWN_SESSION_EVENT_TYPES } from '@deepseek-ai/dsh-session';
|
|
10
|
+
import { buildManifest, configFingerprint, renderReportMarkdown, serializeManifest, slugify, validateAssembleRequest, versionIdOf, } from "./assemble.js";
|
|
11
|
+
import { captureSnapshot, gatherCandidates } from "./gather.js";
|
|
12
|
+
import { EvidenceLedger, LedgerError, sha256Of } from "./ledger.js";
|
|
13
|
+
import { ResearchReportService } from "./service.js";
|
|
14
|
+
import { combineOutcomes, mapBridgeResults, verifyClaimText } from "./verify.js";
|
|
15
|
+
import { VERSION } from "./version.js";
|
|
16
|
+
/** A loud provider failure with a machine-routable code. */
|
|
17
|
+
export class ResearchReportError extends Error {
|
|
18
|
+
/** The machine-routable failure code. */
|
|
19
|
+
code;
|
|
20
|
+
constructor(code, message) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'ResearchReportError';
|
|
23
|
+
this.code = code;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* rc.6's persistence layer refuses a session log carrying an event type it
|
|
28
|
+
* does not know, and rc.6 offers no plugin event-registration surface — so the
|
|
29
|
+
* research-report/* events are appended only when the host build already knows
|
|
30
|
+
* them. The ledger journals are always the durable source of truth; these
|
|
31
|
+
* events are the in-log audit mirror and activate automatically once the host
|
|
32
|
+
* learns the vocabulary.
|
|
33
|
+
* @param session - the owning session, when known.
|
|
34
|
+
* @param type - the event type.
|
|
35
|
+
* @param append - the typed append thunk.
|
|
36
|
+
*/
|
|
37
|
+
function appendAudit(session, type, append) {
|
|
38
|
+
if (session === undefined)
|
|
39
|
+
return;
|
|
40
|
+
if (!KNOWN_SESSION_EVENT_TYPES.has(type))
|
|
41
|
+
return;
|
|
42
|
+
append();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The local `ctx.researchReport` implementation. Everything durable lives in
|
|
46
|
+
* the filesystem ledger; the service adds policy (caps), verification, and
|
|
47
|
+
* sealing on top.
|
|
48
|
+
*/
|
|
49
|
+
export class LocalResearchReportService extends ResearchReportService {
|
|
50
|
+
/** The content-addressed ledger. */
|
|
51
|
+
ledger;
|
|
52
|
+
/** The resolved plugin config. */
|
|
53
|
+
config;
|
|
54
|
+
/** Absolute workspace root for local capture and path display. */
|
|
55
|
+
workspaceRoot;
|
|
56
|
+
/**
|
|
57
|
+
* @param ctx - the plugin context.
|
|
58
|
+
* @param config - the resolved plugin config.
|
|
59
|
+
* @param workspaceRoot - absolute workspace root (the harness cwd).
|
|
60
|
+
*/
|
|
61
|
+
constructor(ctx, config, workspaceRoot) {
|
|
62
|
+
super(ctx);
|
|
63
|
+
this.config = config;
|
|
64
|
+
this.workspaceRoot = workspaceRoot;
|
|
65
|
+
this.ledger = new EvidenceLedger(config.ledgerRoot);
|
|
66
|
+
}
|
|
67
|
+
/** The web seam, resolved at call time (HMR-safe; may be absent). */
|
|
68
|
+
get web() {
|
|
69
|
+
return this.ctx.get('web');
|
|
70
|
+
}
|
|
71
|
+
/** The optional numeric bridge, resolved at call time (never injected). */
|
|
72
|
+
get dataQuality() {
|
|
73
|
+
return this.ctx.get('dataQuality');
|
|
74
|
+
}
|
|
75
|
+
/** Capture dependencies for the gather/capture paths. */
|
|
76
|
+
get captureDeps() {
|
|
77
|
+
return { web: this.web, fetchTimeoutMs: this.config.fetchTimeoutMs, workspaceRoot: this.workspaceRoot };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Register one evidence snapshot. Over-size content is refused loudly;
|
|
81
|
+
* same-content registrations dedupe.
|
|
82
|
+
* @param input - the snapshot and its provenance.
|
|
83
|
+
* @param session - the owning session (audit event), when known.
|
|
84
|
+
* @returns the durable record and whether this call created it.
|
|
85
|
+
*/
|
|
86
|
+
async addEvidence(input, session) {
|
|
87
|
+
const bytes = Buffer.byteLength(input.content, 'utf8');
|
|
88
|
+
if (bytes > this.config.maxEvidenceBytes) {
|
|
89
|
+
throw new ResearchReportError('EVIDENCE_TOO_LARGE', `evidence content is ${bytes} bytes, above the configured maxEvidenceBytes ${this.config.maxEvidenceBytes}`);
|
|
90
|
+
}
|
|
91
|
+
const capturedAt = input.capturedAt ?? new Date().toISOString();
|
|
92
|
+
let outcome;
|
|
93
|
+
try {
|
|
94
|
+
outcome = await this.ledger.putEvidence({
|
|
95
|
+
...(input.id === undefined ? {} : { id: input.id }),
|
|
96
|
+
title: input.title,
|
|
97
|
+
origin: input.origin,
|
|
98
|
+
content: input.content,
|
|
99
|
+
capturedAt,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (error instanceof LedgerError)
|
|
104
|
+
throw new ResearchReportError('LEDGER', error.message);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
appendAudit(session, 'research-report/evidence', () => {
|
|
108
|
+
session?.append('research-report/evidence', {
|
|
109
|
+
id: outcome.record.id,
|
|
110
|
+
hash: outcome.record.hash,
|
|
111
|
+
origin: outcome.record.origin,
|
|
112
|
+
title: outcome.record.title,
|
|
113
|
+
capturedAt: outcome.record.capturedAt,
|
|
114
|
+
bytes: outcome.record.bytes,
|
|
115
|
+
deduplicated: !outcome.created,
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
return { record: outcome.record, deduplicated: !outcome.created };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Capture one origin (URL via ctx.web, workspace path via fs) and register
|
|
122
|
+
* it. Provider-internal helper for the tools layer.
|
|
123
|
+
* @param origin - URL or workspace path.
|
|
124
|
+
* @param title - display title (defaults to the origin).
|
|
125
|
+
* @param signal - caller cancellation.
|
|
126
|
+
* @param session - the owning session (audit event), when known.
|
|
127
|
+
* @returns the durable record and whether this call created it.
|
|
128
|
+
*/
|
|
129
|
+
async captureAndRegister(origin, title, signal, session) {
|
|
130
|
+
const snapshot = await captureSnapshot(this.captureDeps, origin, signal);
|
|
131
|
+
return this.addEvidence({ title: title ?? snapshot.origin, origin: snapshot.origin, content: snapshot.content }, session);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Run one topic gather: search + snapshot capture + registration. Never
|
|
135
|
+
* auto-assembles; uncaptured sources land in the gap list.
|
|
136
|
+
* @param topic - the research topic.
|
|
137
|
+
* @param depth - quick | standard | deep.
|
|
138
|
+
* @param signal - caller cancellation.
|
|
139
|
+
* @param session - the owning session (audit events), when known.
|
|
140
|
+
* @returns candidates plus gaps.
|
|
141
|
+
*/
|
|
142
|
+
async gather(topic, depth, signal, session) {
|
|
143
|
+
return gatherCandidates(this.captureDeps, topic, depth, signal, async (input) => {
|
|
144
|
+
const { record } = await this.addEvidence(input, session);
|
|
145
|
+
return record;
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Verify one registered claim against its bound snapshots: integrity first
|
|
150
|
+
* (tampered/missing ⇒ contradicted), then the byte-level check, then the
|
|
151
|
+
* optional numeric bridge. The verdict is written back to the ledger.
|
|
152
|
+
* @param claimId - the claim to verify.
|
|
153
|
+
* @param session - the owning session (audit event), when known.
|
|
154
|
+
* @returns the fresh verdict.
|
|
155
|
+
*/
|
|
156
|
+
async verifyClaim(claimId, session) {
|
|
157
|
+
const claim = await this.ledger.getClaim(claimId);
|
|
158
|
+
if (claim === undefined) {
|
|
159
|
+
throw new ResearchReportError('CLAIM_UNKNOWN', `unknown claim id "${claimId}"`);
|
|
160
|
+
}
|
|
161
|
+
const verdict = await this.verifyRegistration(claim);
|
|
162
|
+
await this.ledger.recordVerdict({
|
|
163
|
+
claimId,
|
|
164
|
+
status: verdict.status,
|
|
165
|
+
...(verdict.note === undefined ? {} : { note: verdict.note }),
|
|
166
|
+
}, new Date().toISOString());
|
|
167
|
+
appendAudit(session, 'research-report/verify', () => {
|
|
168
|
+
session?.append('research-report/verify', {
|
|
169
|
+
claimId,
|
|
170
|
+
status: verdict.status,
|
|
171
|
+
...(verdict.note === undefined ? {} : { note: verdict.note }),
|
|
172
|
+
evidenceIds: claim.evidenceIds,
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
return verdict;
|
|
176
|
+
}
|
|
177
|
+
/** Compute the verdict for one claim registration (no writeback). */
|
|
178
|
+
async verifyRegistration(claim) {
|
|
179
|
+
const contents = [];
|
|
180
|
+
const broken = [];
|
|
181
|
+
for (const evidenceId of claim.evidenceIds) {
|
|
182
|
+
const read = await this.ledger.readContent(evidenceId);
|
|
183
|
+
if (read === undefined) {
|
|
184
|
+
broken.push(`${evidenceId} (not in the ledger)`);
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (read.integrity !== 'ok') {
|
|
188
|
+
broken.push(`${evidenceId} (${read.integrity}: object bytes no longer match the indexed hash)`);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
contents.push(read.content);
|
|
192
|
+
}
|
|
193
|
+
let byte;
|
|
194
|
+
if (broken.length > 0) {
|
|
195
|
+
byte = {
|
|
196
|
+
status: 'contradicted',
|
|
197
|
+
note: `bound evidence failed the integrity check: ${broken.join('; ')}`,
|
|
198
|
+
missing: [],
|
|
199
|
+
contradictions: broken,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
byte = verifyClaimText(claim.text, contents);
|
|
204
|
+
}
|
|
205
|
+
let bridge;
|
|
206
|
+
if (claim.dataset !== undefined && claim.citations !== undefined && claim.citations.length > 0) {
|
|
207
|
+
const dataQuality = this.dataQuality;
|
|
208
|
+
if (dataQuality === undefined) {
|
|
209
|
+
bridge = {
|
|
210
|
+
status: 'unverified',
|
|
211
|
+
note: 'numeric dataset citations not cross-checked: ctx.dataQuality is not mounted (dsh-data-quality absent); byte-level check only',
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
try {
|
|
216
|
+
bridge = mapBridgeResults(await dataQuality.verifyCitations({ dataset: claim.dataset, citations: claim.citations }));
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
bridge = {
|
|
220
|
+
status: 'unverified',
|
|
221
|
+
note: `numeric dataset bridge failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const combined = combineOutcomes(byte, bridge);
|
|
227
|
+
return { claimId: claim.id, status: combined.status, note: combined.note };
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Assemble and seal one report: validate (loud), register evidence and
|
|
231
|
+
* claims (idempotent; conflicts throw), verify every claim, render
|
|
232
|
+
* `report.md` with visible markers for unverified/contradicted claims, write
|
|
233
|
+
* `manifest.json`, and seal the versioned directory with the manifest hash.
|
|
234
|
+
* @param request - the frozen assemble request.
|
|
235
|
+
* @param context - optional assemble context (owning session for events).
|
|
236
|
+
* @returns the sealed directory, the seal hash, and the per-claim verdicts.
|
|
237
|
+
*/
|
|
238
|
+
async assemble(request, context) {
|
|
239
|
+
validateAssembleRequest(request, this.config);
|
|
240
|
+
// Evidence: the ledger is authoritative and immutable. New ids register;
|
|
241
|
+
// an existing id whose incoming content still matches the index is a
|
|
242
|
+
// no-op; a mismatch against an INTACT object is a loud conflict, while a
|
|
243
|
+
// mismatch explained by tampering flows into verification (contradicted).
|
|
244
|
+
const records = [];
|
|
245
|
+
for (const item of request.evidence) {
|
|
246
|
+
const existing = await this.ledger.getEvidence(item.id);
|
|
247
|
+
if (existing === undefined) {
|
|
248
|
+
const added = await this.addEvidence({ id: item.id, title: item.title, origin: item.origin, content: item.content, capturedAt: item.capturedAt }, context?.session);
|
|
249
|
+
records.push(added.record);
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
const incomingHash = sha256Of(item.content);
|
|
253
|
+
if (incomingHash !== existing.hash) {
|
|
254
|
+
const stored = await this.ledger.readContent(item.id);
|
|
255
|
+
if (stored !== undefined && stored.integrity === 'ok') {
|
|
256
|
+
throw new ResearchReportError('LEDGER', `evidence id "${item.id}" is already registered with different content; snapshots are immutable — choose a new id`);
|
|
257
|
+
}
|
|
258
|
+
// Tampered/missing object: verification over the current bytes will
|
|
259
|
+
// produce the contradicted verdict; the index keeps the original hash.
|
|
260
|
+
}
|
|
261
|
+
records.push(existing);
|
|
262
|
+
}
|
|
263
|
+
await this.ledger.registerClaims(request.claims.map(claim => {
|
|
264
|
+
const registration = claim;
|
|
265
|
+
return {
|
|
266
|
+
id: registration.id,
|
|
267
|
+
text: registration.text,
|
|
268
|
+
evidenceIds: registration.evidenceIds,
|
|
269
|
+
...(registration.dataset === undefined ? {} : { dataset: registration.dataset }),
|
|
270
|
+
...(registration.citations === undefined ? {} : { citations: registration.citations }),
|
|
271
|
+
};
|
|
272
|
+
}), new Date().toISOString());
|
|
273
|
+
const verdicts = [];
|
|
274
|
+
for (const claim of request.claims) {
|
|
275
|
+
verdicts.push(await this.verifyClaim(claim.id, context?.session));
|
|
276
|
+
}
|
|
277
|
+
const generatedAt = new Date().toISOString();
|
|
278
|
+
const fingerprint = configFingerprint(this.config);
|
|
279
|
+
const plan = { request, verdicts, evidence: records, generatedAt, fingerprint, pluginVersion: VERSION };
|
|
280
|
+
const reportText = renderReportMarkdown(plan);
|
|
281
|
+
const manifestText = serializeManifest(buildManifest(plan, sha256Of(reportText)));
|
|
282
|
+
const sealHash = sha256Of(manifestText);
|
|
283
|
+
const reportDir = await this.freshReportDir(request.topic, new Date(generatedAt));
|
|
284
|
+
await writeFile(path.join(reportDir, 'report.md'), reportText, 'utf8');
|
|
285
|
+
await writeFile(path.join(reportDir, 'manifest.json'), manifestText, 'utf8');
|
|
286
|
+
appendAudit(context?.session, 'research-report/seal', () => {
|
|
287
|
+
context?.session?.append('research-report/seal', {
|
|
288
|
+
reportDir,
|
|
289
|
+
sealHash,
|
|
290
|
+
topic: request.topic,
|
|
291
|
+
title: request.title,
|
|
292
|
+
verdicts,
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
return { reportDir, sealHash, verdicts };
|
|
296
|
+
}
|
|
297
|
+
/** Allocate the next versioned report directory for one topic (UTC clock). */
|
|
298
|
+
async freshReportDir(topic, at) {
|
|
299
|
+
const base = path.join(this.config.reportRoot, slugify(topic));
|
|
300
|
+
await mkdir(base, { recursive: true });
|
|
301
|
+
const stamp = versionIdOf(at);
|
|
302
|
+
for (let suffix = 0;; suffix++) {
|
|
303
|
+
const candidate = path.join(base, suffix === 0 ? stamp : `${stamp}-${suffix + 1}`);
|
|
304
|
+
try {
|
|
305
|
+
await mkdir(candidate);
|
|
306
|
+
return candidate;
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
if (error.code !== 'EEXIST')
|
|
310
|
+
throw error;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Read one evidence item (re-hashed on read).
|
|
316
|
+
* @param evidenceId - the ledger id.
|
|
317
|
+
* @returns the view, or undefined when unknown.
|
|
318
|
+
*/
|
|
319
|
+
async getEvidence(evidenceId) {
|
|
320
|
+
const record = await this.ledger.getEvidence(evidenceId);
|
|
321
|
+
if (record === undefined)
|
|
322
|
+
return undefined;
|
|
323
|
+
const read = await this.ledger.readContent(evidenceId);
|
|
324
|
+
const integrity = read === undefined ? 'missing' : read.integrity;
|
|
325
|
+
return { ...record, integrity };
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Read one snapshot's bytes (re-hashed on read).
|
|
329
|
+
* @param evidenceId - the ledger id.
|
|
330
|
+
* @returns content plus integrity, or undefined when unknown.
|
|
331
|
+
*/
|
|
332
|
+
async readEvidenceContent(evidenceId) {
|
|
333
|
+
return this.ledger.readContent(evidenceId);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Read one claim with its latest verdict.
|
|
337
|
+
* @param claimId - the claim id.
|
|
338
|
+
* @returns the view, or undefined when unknown.
|
|
339
|
+
*/
|
|
340
|
+
async getClaim(claimId) {
|
|
341
|
+
const claim = await this.ledger.getClaim(claimId);
|
|
342
|
+
if (claim === undefined)
|
|
343
|
+
return undefined;
|
|
344
|
+
const verdict = (await this.ledger.latestVerdicts()).get(claimId);
|
|
345
|
+
return {
|
|
346
|
+
id: claim.id,
|
|
347
|
+
text: claim.text,
|
|
348
|
+
evidenceIds: claim.evidenceIds,
|
|
349
|
+
...(claim.dataset === undefined ? {} : { dataset: claim.dataset }),
|
|
350
|
+
...(verdict === undefined
|
|
351
|
+
? {}
|
|
352
|
+
: {
|
|
353
|
+
verdict: {
|
|
354
|
+
claimId: verdict.claimId,
|
|
355
|
+
status: verdict.status,
|
|
356
|
+
...(verdict.note === undefined ? {} : { note: verdict.note }),
|
|
357
|
+
at: verdict.at,
|
|
358
|
+
},
|
|
359
|
+
}),
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* List every registered evidence item (re-hashed on read).
|
|
364
|
+
* @returns all evidence views in registration order.
|
|
365
|
+
*/
|
|
366
|
+
async listEvidence() {
|
|
367
|
+
const records = await this.ledger.listEvidence();
|
|
368
|
+
const views = [];
|
|
369
|
+
for (const record of records) {
|
|
370
|
+
const read = await this.ledger.readContent(record.id);
|
|
371
|
+
views.push({ ...record, integrity: read === undefined ? 'missing' : read.integrity });
|
|
372
|
+
}
|
|
373
|
+
return views;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* List every registered claim with its latest verdict.
|
|
377
|
+
* @returns all claim views in registration order.
|
|
378
|
+
*/
|
|
379
|
+
async listClaims() {
|
|
380
|
+
const claims = await this.ledger.listClaims();
|
|
381
|
+
const verdicts = await this.ledger.latestVerdicts();
|
|
382
|
+
return claims.map(claim => {
|
|
383
|
+
const verdict = verdicts.get(claim.id);
|
|
384
|
+
return {
|
|
385
|
+
id: claim.id,
|
|
386
|
+
text: claim.text,
|
|
387
|
+
evidenceIds: claim.evidenceIds,
|
|
388
|
+
...(claim.dataset === undefined ? {} : { dataset: claim.dataset }),
|
|
389
|
+
...(verdict === undefined
|
|
390
|
+
? {}
|
|
391
|
+
: {
|
|
392
|
+
verdict: {
|
|
393
|
+
claimId: verdict.claimId,
|
|
394
|
+
status: verdict.status,
|
|
395
|
+
...(verdict.note === undefined ? {} : { note: verdict.note }),
|
|
396
|
+
at: verdict.at,
|
|
397
|
+
},
|
|
398
|
+
}),
|
|
399
|
+
};
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Aggregate ledger counts (evidence re-hashed for the tamper count).
|
|
404
|
+
* @returns the summary.
|
|
405
|
+
*/
|
|
406
|
+
async summarize() {
|
|
407
|
+
const evidence = await this.listEvidence();
|
|
408
|
+
const claims = await this.ledger.listClaims();
|
|
409
|
+
const verdicts = await this.ledger.latestVerdicts();
|
|
410
|
+
return {
|
|
411
|
+
evidenceCount: evidence.length,
|
|
412
|
+
claimCount: claims.length,
|
|
413
|
+
verdictCount: verdicts.size,
|
|
414
|
+
tamperedCount: evidence.filter(item => item.integrity !== 'ok').length,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
//# sourceMappingURL=provider-local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-local.js","sourceRoot":"","sources":["../../src/provider-local.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AAGpE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,OAAO,EACP,uBAAuB,EACvB,WAAW,GACZ,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE/D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAepD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAEhF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,4DAA4D;AAC5D,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,yCAAyC;IAChC,IAAI,CAAmD;IAChE,YAAY,IAAiC,EAAE,OAAe;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;A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