qlm-measure 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/LICENSE +54 -0
- package/NOTICE +13 -0
- package/README.md +152 -0
- package/dist/clients/engine-client.d.ts +51 -0
- package/dist/clients/engine-client.d.ts.map +1 -0
- package/dist/clients/engine-client.js +59 -0
- package/dist/clients/engine-client.js.map +1 -0
- package/dist/clients/index.d.ts +5 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +3 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/ontology-client.d.ts +57 -0
- package/dist/clients/ontology-client.d.ts.map +1 -0
- package/dist/clients/ontology-client.js +47 -0
- package/dist/clients/ontology-client.js.map +1 -0
- package/dist/emitter/index.d.ts +3 -0
- package/dist/emitter/index.d.ts.map +1 -0
- package/dist/emitter/index.js +2 -0
- package/dist/emitter/index.js.map +1 -0
- package/dist/emitter/measurement-emitter.d.ts +33 -0
- package/dist/emitter/measurement-emitter.d.ts.map +1 -0
- package/dist/emitter/measurement-emitter.js +98 -0
- package/dist/emitter/measurement-emitter.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/schema/enums.d.ts +19 -0
- package/dist/schema/enums.d.ts.map +1 -0
- package/dist/schema/enums.js +24 -0
- package/dist/schema/enums.js.map +1 -0
- package/dist/schema/evidence-record.d.ts +70 -0
- package/dist/schema/evidence-record.d.ts.map +1 -0
- package/dist/schema/evidence-record.js +11 -0
- package/dist/schema/evidence-record.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +3 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/measurement-event.d.ts +35 -0
- package/dist/schema/measurement-event.d.ts.map +1 -0
- package/dist/schema/measurement-event.js +7 -0
- package/dist/schema/measurement-event.js.map +1 -0
- package/dist/schema/observation-event.d.ts +58 -0
- package/dist/schema/observation-event.d.ts.map +1 -0
- package/dist/schema/observation-event.js +12 -0
- package/dist/schema/observation-event.js.map +1 -0
- package/dist/verifier/hash.d.ts +28 -0
- package/dist/verifier/hash.d.ts.map +1 -0
- package/dist/verifier/hash.js +75 -0
- package/dist/verifier/hash.js.map +1 -0
- package/dist/verifier/index.d.ts +5 -0
- package/dist/verifier/index.d.ts.map +1 -0
- package/dist/verifier/index.js +4 -0
- package/dist/verifier/index.js.map +1 -0
- package/dist/verifier/replay.d.ts +34 -0
- package/dist/verifier/replay.d.ts.map +1 -0
- package/dist/verifier/replay.js +51 -0
- package/dist/verifier/replay.js.map +1 -0
- package/dist/verifier/verify-record.d.ts +48 -0
- package/dist/verifier/verify-record.d.ts.map +1 -0
- package/dist/verifier/verify-record.js +163 -0
- package/dist/verifier/verify-record.js.map +1 -0
- package/package.json +63 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @qlm/measure — Open Measurement SDK for Education AI
|
|
3
|
+
*
|
|
4
|
+
* What it is:
|
|
5
|
+
* - A typed evidence-event vocabulary any tool can emit
|
|
6
|
+
* - Clients for QLM's open datasets and measurement service
|
|
7
|
+
* - An evidence-record format + replay verifier
|
|
8
|
+
*
|
|
9
|
+
* What it is NOT:
|
|
10
|
+
* - The estimation engine (that is QLM's hosted service)
|
|
11
|
+
* - A replacement for the measurement service
|
|
12
|
+
* - A standalone learning analytics system
|
|
13
|
+
*
|
|
14
|
+
* The verifier checks bookkeeping integrity, not estimation correctness.
|
|
15
|
+
* That distinction is the design.
|
|
16
|
+
*
|
|
17
|
+
* @see https://play.quantumlearningmachines.com/developer
|
|
18
|
+
* @license Apache-2.0
|
|
19
|
+
*/
|
|
20
|
+
export type { ScaffoldType, EpistemicMode, DepthLevel, TriageResult, EventCategory, } from "./schema/enums";
|
|
21
|
+
export { toPublicEpistemicMode } from "./schema/enums";
|
|
22
|
+
export type { ObservationEvent } from "./schema/observation-event";
|
|
23
|
+
export type { MeasurementEvent } from "./schema/measurement-event";
|
|
24
|
+
export type { EvidenceEntry, EvidenceRecord } from "./schema/evidence-record";
|
|
25
|
+
export { COMPACTION_RETENTION } from "./schema/evidence-record";
|
|
26
|
+
export { MeasurementEmitter } from "./emitter/measurement-emitter";
|
|
27
|
+
export type { EmitterConfig } from "./emitter/measurement-emitter";
|
|
28
|
+
export { verifyRecord } from "./verifier/verify-record";
|
|
29
|
+
export type { VerificationResult, Violation } from "./verifier/verify-record";
|
|
30
|
+
export { replayToVersion, posteriorAtVersion, summarizeToVersion } from "./verifier/replay";
|
|
31
|
+
export { hashEntry, hashCanonical, canonicalize, sha256 } from "./verifier/hash";
|
|
32
|
+
export { OntologyClient } from "./clients/ontology-client";
|
|
33
|
+
export type { OntologyClientConfig, DatasetName } from "./clients/ontology-client";
|
|
34
|
+
export { EngineClient } from "./clients/engine-client";
|
|
35
|
+
export type { EngineClientConfig, ModelStateSummary } from "./clients/engine-client";
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,YAAY,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,YAAY,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @qlm/measure — Open Measurement SDK for Education AI
|
|
3
|
+
*
|
|
4
|
+
* What it is:
|
|
5
|
+
* - A typed evidence-event vocabulary any tool can emit
|
|
6
|
+
* - Clients for QLM's open datasets and measurement service
|
|
7
|
+
* - An evidence-record format + replay verifier
|
|
8
|
+
*
|
|
9
|
+
* What it is NOT:
|
|
10
|
+
* - The estimation engine (that is QLM's hosted service)
|
|
11
|
+
* - A replacement for the measurement service
|
|
12
|
+
* - A standalone learning analytics system
|
|
13
|
+
*
|
|
14
|
+
* The verifier checks bookkeeping integrity, not estimation correctness.
|
|
15
|
+
* That distinction is the design.
|
|
16
|
+
*
|
|
17
|
+
* @see https://play.quantumlearningmachines.com/developer
|
|
18
|
+
* @license Apache-2.0
|
|
19
|
+
*/
|
|
20
|
+
export { toPublicEpistemicMode } from "./schema/enums";
|
|
21
|
+
export { COMPACTION_RETENTION } from "./schema/evidence-record";
|
|
22
|
+
// Emitter
|
|
23
|
+
export { MeasurementEmitter } from "./emitter/measurement-emitter";
|
|
24
|
+
// Verifier
|
|
25
|
+
export { verifyRecord } from "./verifier/verify-record";
|
|
26
|
+
export { replayToVersion, posteriorAtVersion, summarizeToVersion } from "./verifier/replay";
|
|
27
|
+
export { hashEntry, hashCanonical, canonicalize, sha256 } from "./verifier/hash";
|
|
28
|
+
// Clients
|
|
29
|
+
export { OntologyClient } from "./clients/ontology-client";
|
|
30
|
+
export { EngineClient } from "./clients/engine-client";
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAUH,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,UAAU;AACV,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEjF,UAAU;AACV,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public enum types for the open measurement vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* These are structural labels only — no weights, thresholds, or
|
|
5
|
+
* estimation parameters are included or implied.
|
|
6
|
+
*/
|
|
7
|
+
/** The pedagogical move that preceded a student response. */
|
|
8
|
+
export type ScaffoldType = "none" | "socratic" | "probing" | "metacognitive" | "scaffolding" | "explain" | "hint" | "demonstrate";
|
|
9
|
+
/** How the student arrived at knowledge. */
|
|
10
|
+
export type EpistemicMode = "experience" | "inference" | "analogy" | "testimony";
|
|
11
|
+
/** Depth of understanding. */
|
|
12
|
+
export type DepthLevel = "surface" | "conceptual" | "transfer" | "integration";
|
|
13
|
+
/** Triage classification of a student response. */
|
|
14
|
+
export type TriageResult = "correct" | "slip" | "misconception" | "disengagement" | "ambiguous";
|
|
15
|
+
/** Category of a measurement event. */
|
|
16
|
+
export type EventCategory = "learning" | "teaching" | "assessment" | "interaction" | "system";
|
|
17
|
+
/** Map internal or public epistemic mode value to the public enum. */
|
|
18
|
+
export declare function toPublicEpistemicMode(value: string): EpistemicMode;
|
|
19
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/schema/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6DAA6D;AAC7D,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,UAAU,GACV,SAAS,GACT,eAAe,GACf,aAAa,GACb,SAAS,GACT,MAAM,GACN,aAAa,CAAC;AAElB,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,WAAW,GACX,SAAS,GACT,WAAW,CAAC;AAEhB,8BAA8B;AAC9B,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,YAAY,GACZ,UAAU,GACV,aAAa,CAAC;AAElB,mDAAmD;AACnD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,MAAM,GACN,eAAe,GACf,eAAe,GACf,WAAW,CAAC;AAEhB,uCAAuC;AACvC,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,UAAU,GACV,YAAY,GACZ,aAAa,GACb,QAAQ,CAAC;AAiBb,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAElE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public enum types for the open measurement vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* These are structural labels only — no weights, thresholds, or
|
|
5
|
+
* estimation parameters are included or implied.
|
|
6
|
+
*/
|
|
7
|
+
// ── Internal ↔ Public mapping (used at the EngineClient boundary) ────────
|
|
8
|
+
const EPISTEMIC_MAP = {
|
|
9
|
+
// Internal values (mapped at the service boundary)
|
|
10
|
+
direct: "experience",
|
|
11
|
+
reason: "inference",
|
|
12
|
+
compare: "analogy",
|
|
13
|
+
told: "testimony",
|
|
14
|
+
// Public names map to themselves
|
|
15
|
+
experience: "experience",
|
|
16
|
+
inference: "inference",
|
|
17
|
+
analogy: "analogy",
|
|
18
|
+
testimony: "testimony",
|
|
19
|
+
};
|
|
20
|
+
/** Map internal or public epistemic mode value to the public enum. */
|
|
21
|
+
export function toPublicEpistemicMode(value) {
|
|
22
|
+
return EPISTEMIC_MAP[value] ?? "testimony";
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/schema/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2CH,4EAA4E;AAE5E,MAAM,aAAa,GAAkC;IACnD,mDAAmD;IACnD,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,WAAW;IACjB,iCAAiC;IACjC,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;CACvB,CAAC;AAEF,sEAAsE;AACtE,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence Record — Public format v0.
|
|
3
|
+
*
|
|
4
|
+
* An append-only, hash-chained sequence of evidence entries.
|
|
5
|
+
* Each entry records what happened, what the system estimated,
|
|
6
|
+
* and what it decided — enabling external verification of
|
|
7
|
+
* bookkeeping integrity without any estimation mathematics.
|
|
8
|
+
*/
|
|
9
|
+
import type { ObservationEvent } from "./observation-event";
|
|
10
|
+
import type { ScaffoldType, DepthLevel, EpistemicMode, TriageResult } from "./enums";
|
|
11
|
+
/**
|
|
12
|
+
* A single evidence entry in the record.
|
|
13
|
+
*
|
|
14
|
+
* Carries the applied evidential weight and posteriors because
|
|
15
|
+
* auditability is the product's promise — a tenant must be able
|
|
16
|
+
* to see why their number moved.
|
|
17
|
+
*/
|
|
18
|
+
export interface EvidenceEntry {
|
|
19
|
+
/** Monotonically increasing version number — primary ordering key. */
|
|
20
|
+
version: number;
|
|
21
|
+
/** ISO 8601 timestamp. */
|
|
22
|
+
timestamp: string;
|
|
23
|
+
/** The observation that generated this entry, or a redacted hash. */
|
|
24
|
+
event: ObservationEvent | {
|
|
25
|
+
redacted: true;
|
|
26
|
+
eventHash: string;
|
|
27
|
+
};
|
|
28
|
+
/** Scaffold type active when the response was elicited. */
|
|
29
|
+
scaffoldType: ScaffoldType;
|
|
30
|
+
/** Estimated depth level at time of response. */
|
|
31
|
+
depthLevel: DepthLevel;
|
|
32
|
+
/** Epistemic mode classification. */
|
|
33
|
+
epistemicMode: EpistemicMode | null;
|
|
34
|
+
/** Triage classification. */
|
|
35
|
+
triageResult: TriageResult;
|
|
36
|
+
/** The evidential weight applied to this response (as a number). */
|
|
37
|
+
evidentialWeight: number;
|
|
38
|
+
/** The proficiency posterior BEFORE this update. */
|
|
39
|
+
priorPosterior: number;
|
|
40
|
+
/** The proficiency posterior AFTER this update. */
|
|
41
|
+
updatedPosterior: number;
|
|
42
|
+
/** Non-intervention decision (calibrated silence). */
|
|
43
|
+
nonInterventionDecision?: {
|
|
44
|
+
intervened: boolean;
|
|
45
|
+
confidence: number;
|
|
46
|
+
};
|
|
47
|
+
/** SHA-256 hash of this entry's canonical serialization. */
|
|
48
|
+
entryHash: string;
|
|
49
|
+
/** Hash of the previous entry (chain integrity). */
|
|
50
|
+
prevHash: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* An append-only evidence record for a single student scope.
|
|
54
|
+
*/
|
|
55
|
+
export interface EvidenceRecord {
|
|
56
|
+
/** Pseudonymous student scope ID. */
|
|
57
|
+
studentScopeId: string;
|
|
58
|
+
/** All entries, ordered by version. */
|
|
59
|
+
entries: EvidenceEntry[];
|
|
60
|
+
/** If the record has been compacted, info about the compaction boundary. */
|
|
61
|
+
compactedBefore?: {
|
|
62
|
+
/** Version number of the last compacted entry. */
|
|
63
|
+
version: number;
|
|
64
|
+
/** Hash summarizing the compacted entries. */
|
|
65
|
+
summaryHash: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Maximum entries retained after compaction. Public constant (bookkeeping, not estimation). */
|
|
69
|
+
export declare const COMPACTION_RETENTION = 500;
|
|
70
|
+
//# sourceMappingURL=evidence-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-record.d.ts","sourceRoot":"","sources":["../../src/schema/evidence-record.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAEhB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAElB,qEAAqE;IACrE,KAAK,EAAE,gBAAgB,GAAG;QAAE,QAAQ,EAAE,IAAI,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAEhE,2DAA2D;IAC3D,YAAY,EAAE,YAAY,CAAC;IAE3B,iDAAiD;IACjD,UAAU,EAAE,UAAU,CAAC;IAEvB,qCAAqC;IACrC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAEpC,6BAA6B;IAC7B,YAAY,EAAE,YAAY,CAAC;IAE3B,oEAAoE;IACpE,gBAAgB,EAAE,MAAM,CAAC;IAEzB,oDAAoD;IACpD,cAAc,EAAE,MAAM,CAAC;IAEvB,mDAAmD;IACnD,gBAAgB,EAAE,MAAM,CAAC;IAEzB,sDAAsD;IACtD,uBAAuB,CAAC,EAAE;QACxB,UAAU,EAAE,OAAO,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IAEF,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAElB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,cAAc,EAAE,MAAM,CAAC;IAEvB,uCAAuC;IACvC,OAAO,EAAE,aAAa,EAAE,CAAC;IAEzB,4EAA4E;IAC5E,eAAe,CAAC,EAAE;QAChB,kDAAkD;QAClD,OAAO,EAAE,MAAM,CAAC;QAChB,8CAA8C;QAC9C,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,gGAAgG;AAChG,eAAO,MAAM,oBAAoB,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evidence Record — Public format v0.
|
|
3
|
+
*
|
|
4
|
+
* An append-only, hash-chained sequence of evidence entries.
|
|
5
|
+
* Each entry records what happened, what the system estimated,
|
|
6
|
+
* and what it decided — enabling external verification of
|
|
7
|
+
* bookkeeping integrity without any estimation mathematics.
|
|
8
|
+
*/
|
|
9
|
+
/** Maximum entries retained after compaction. Public constant (bookkeeping, not estimation). */
|
|
10
|
+
export const COMPACTION_RETENTION = 500;
|
|
11
|
+
//# sourceMappingURL=evidence-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-record.js","sourceRoot":"","sources":["../../src/schema/evidence-record.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA2EH,gGAAgG;AAChG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { ScaffoldType, EpistemicMode, DepthLevel, TriageResult, EventCategory, } from "./enums";
|
|
2
|
+
export { toPublicEpistemicMode } from "./enums";
|
|
3
|
+
export type { ObservationEvent } from "./observation-event";
|
|
4
|
+
export type { MeasurementEvent } from "./measurement-event";
|
|
5
|
+
export type { EvidenceEntry, EvidenceRecord } from "./evidence-record";
|
|
6
|
+
export { COMPACTION_RETENTION } from "./evidence-record";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,aAAa,EACb,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEhD,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKhD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MeasurementEvent — Telemetry event for the measurement pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the production measurement-emitter.
|
|
5
|
+
*/
|
|
6
|
+
import type { EventCategory } from "./enums";
|
|
7
|
+
export interface MeasurementEvent {
|
|
8
|
+
/** Event type identifier. */
|
|
9
|
+
eventType: string;
|
|
10
|
+
/** Event category. */
|
|
11
|
+
eventCategory: EventCategory;
|
|
12
|
+
/** Session identifier. */
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
/** Classroom identifier. */
|
|
15
|
+
classroomId?: string;
|
|
16
|
+
/** Domain (e.g., "math", "science"). */
|
|
17
|
+
domain?: string;
|
|
18
|
+
/** Topic within the domain. */
|
|
19
|
+
topic?: string;
|
|
20
|
+
/** Simulation mode or activity type. */
|
|
21
|
+
mode?: string;
|
|
22
|
+
/** Estimated difficulty (0-1). */
|
|
23
|
+
difficulty?: number;
|
|
24
|
+
/** Arbitrary payload for event-specific data. */
|
|
25
|
+
payload?: Record<string, unknown>;
|
|
26
|
+
/** Quality signal (0-1) for this event. */
|
|
27
|
+
qualitySignal?: number;
|
|
28
|
+
/** Confidence in this measurement (0-1). */
|
|
29
|
+
confidence?: number;
|
|
30
|
+
/** Duration of the measured activity in milliseconds. */
|
|
31
|
+
durationMs?: number;
|
|
32
|
+
/** Parent event ID for hierarchical events. */
|
|
33
|
+
parentEventId?: string;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=measurement-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measurement-event.d.ts","sourceRoot":"","sources":["../../src/schema/measurement-event.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC/B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAElB,sBAAsB;IACtB,aAAa,EAAE,aAAa,CAAC;IAE7B,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measurement-event.js","sourceRoot":"","sources":["../../src/schema/measurement-event.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObservationEvent v0.1 — Public evidence-event schema.
|
|
3
|
+
*
|
|
4
|
+
* A deliberate subset of the internal StudentObservation.
|
|
5
|
+
* This is a deliberate public subset. Fields related to internal estimation,
|
|
6
|
+
* trait models, and classification logic are excluded. Integrators needing
|
|
7
|
+
* additional fields use the `ext` namespace.
|
|
8
|
+
*
|
|
9
|
+
* Integrators needing excluded fields use the `ext` namespace.
|
|
10
|
+
*/
|
|
11
|
+
import type { ScaffoldType, EpistemicMode } from "./enums";
|
|
12
|
+
export interface ObservationEvent {
|
|
13
|
+
/** Pseudonymous student identifier. MUST NOT contain PII. */
|
|
14
|
+
studentId: string;
|
|
15
|
+
/** Session identifier. */
|
|
16
|
+
sessionId: string;
|
|
17
|
+
/** Source system that produced this event. */
|
|
18
|
+
source: string;
|
|
19
|
+
/** ISO 8601 timestamp. */
|
|
20
|
+
timestamp: string;
|
|
21
|
+
/** Whether the student response was correct. */
|
|
22
|
+
correct: boolean;
|
|
23
|
+
/** Response time in milliseconds. */
|
|
24
|
+
responseTimeMs: number;
|
|
25
|
+
/** Domain (e.g., "math", "science", "history"). */
|
|
26
|
+
domain: string;
|
|
27
|
+
/** Scaffold type that preceded this response. */
|
|
28
|
+
scaffoldType?: ScaffoldType | null;
|
|
29
|
+
/** Misconception ID from the public ontology (if detected). */
|
|
30
|
+
misconceptionId?: string | null;
|
|
31
|
+
/** Classifier confidence for the misconception detection (0-1). */
|
|
32
|
+
classifierConfidence?: number;
|
|
33
|
+
/** Human-readable label for the detected misconception. */
|
|
34
|
+
classifierLabel?: string | null;
|
|
35
|
+
/** Skill ID being assessed. */
|
|
36
|
+
skillId?: string | null;
|
|
37
|
+
/** Score for this response (0-1). */
|
|
38
|
+
score?: number;
|
|
39
|
+
/** Estimated difficulty of the item (0-1). */
|
|
40
|
+
difficulty?: number;
|
|
41
|
+
/** Consecutive errors in the current session. */
|
|
42
|
+
consecutiveErrors?: number;
|
|
43
|
+
/** Error rate for the current session (0-1). */
|
|
44
|
+
sessionErrorRate?: number;
|
|
45
|
+
/** Explanation quality score (0-1) from teach-back or written explanation. */
|
|
46
|
+
explanationQuality?: number;
|
|
47
|
+
/** Whether this was a transfer problem (novel, unscaffolded). */
|
|
48
|
+
isTransferProblem?: boolean;
|
|
49
|
+
/** Spontaneous cross-concept connections made (count). */
|
|
50
|
+
connectionsMade?: number;
|
|
51
|
+
/** Epistemic mode — how the student arrived at this response. */
|
|
52
|
+
epistemicMode?: EpistemicMode;
|
|
53
|
+
/** Whether the student self-corrected before final submission. */
|
|
54
|
+
selfCorrected?: boolean;
|
|
55
|
+
/** Reserved extension namespace for integrator-specific fields. */
|
|
56
|
+
ext?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=observation-event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-event.d.ts","sourceRoot":"","sources":["../../src/schema/observation-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAElB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IAEf,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAElB,gDAAgD;IAChD,OAAO,EAAE,OAAO,CAAC;IAEjB,qCAAqC;IACrC,cAAc,EAAE,MAAM,CAAC;IAEvB,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,YAAY,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAEnC,+DAA+D;IAC/D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,iEAAiE;IACjE,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ObservationEvent v0.1 — Public evidence-event schema.
|
|
3
|
+
*
|
|
4
|
+
* A deliberate subset of the internal StudentObservation.
|
|
5
|
+
* This is a deliberate public subset. Fields related to internal estimation,
|
|
6
|
+
* trait models, and classification logic are excluded. Integrators needing
|
|
7
|
+
* additional fields use the `ext` namespace.
|
|
8
|
+
*
|
|
9
|
+
* Integrators needing excluded fields use the `ext` namespace.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=observation-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observation-event.js","sourceRoot":"","sources":["../../src/schema/observation-event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash utilities for evidence record integrity.
|
|
3
|
+
*
|
|
4
|
+
* Uses SHA-256 via the Web Crypto API (browser) or Node crypto module.
|
|
5
|
+
* Canonical serialization ensures deterministic hashing.
|
|
6
|
+
*/
|
|
7
|
+
import type { EvidenceEntry } from "../schema/evidence-record";
|
|
8
|
+
/**
|
|
9
|
+
* Canonical JSON serialization — sorted keys, no whitespace.
|
|
10
|
+
* Ensures the same object always produces the same hash regardless
|
|
11
|
+
* of property insertion order.
|
|
12
|
+
*/
|
|
13
|
+
export declare function canonicalize(obj: unknown): string;
|
|
14
|
+
/**
|
|
15
|
+
* Compute SHA-256 hash of a string.
|
|
16
|
+
* Works in both browser (Web Crypto) and Node (crypto module).
|
|
17
|
+
*/
|
|
18
|
+
export declare function sha256(input: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Compute the canonical hash of an evidence entry.
|
|
21
|
+
* Hashes all fields EXCEPT entryHash and prevHash (which are the chain links).
|
|
22
|
+
*/
|
|
23
|
+
export declare function hashEntry(entry: EvidenceEntry): string;
|
|
24
|
+
/**
|
|
25
|
+
* Compute a hash over a canonical string (for summary hashes, etc.).
|
|
26
|
+
*/
|
|
27
|
+
export declare function hashCanonical(input: string): string;
|
|
28
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/verifier/hash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAUjD;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAW5C;AAYD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAetD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hash utilities for evidence record integrity.
|
|
3
|
+
*
|
|
4
|
+
* Uses SHA-256 via the Web Crypto API (browser) or Node crypto module.
|
|
5
|
+
* Canonical serialization ensures deterministic hashing.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Canonical JSON serialization — sorted keys, no whitespace.
|
|
9
|
+
* Ensures the same object always produces the same hash regardless
|
|
10
|
+
* of property insertion order.
|
|
11
|
+
*/
|
|
12
|
+
export function canonicalize(obj) {
|
|
13
|
+
return JSON.stringify(obj, (_, value) => {
|
|
14
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
15
|
+
return Object.keys(value).sort().reduce((sorted, key) => {
|
|
16
|
+
sorted[key] = value[key];
|
|
17
|
+
return sorted;
|
|
18
|
+
}, {});
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Compute SHA-256 hash of a string.
|
|
25
|
+
* Works in both browser (Web Crypto) and Node (crypto module).
|
|
26
|
+
*/
|
|
27
|
+
export function sha256(input) {
|
|
28
|
+
// Node.js path
|
|
29
|
+
try {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
31
|
+
const crypto = require("crypto");
|
|
32
|
+
return crypto.createHash("sha256").update(input).digest("hex");
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Browser path — synchronous fallback using a simple hash
|
|
36
|
+
// Note: in production, use Web Crypto API (async) for true SHA-256
|
|
37
|
+
return simpleHash(input);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Simple non-cryptographic hash for browser environments without crypto. */
|
|
41
|
+
function simpleHash(str) {
|
|
42
|
+
let hash = 0;
|
|
43
|
+
for (let i = 0; i < str.length; i++) {
|
|
44
|
+
const char = str.charCodeAt(i);
|
|
45
|
+
hash = ((hash << 5) - hash + char) | 0;
|
|
46
|
+
}
|
|
47
|
+
return Math.abs(hash).toString(16).padStart(8, "0");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Compute the canonical hash of an evidence entry.
|
|
51
|
+
* Hashes all fields EXCEPT entryHash and prevHash (which are the chain links).
|
|
52
|
+
*/
|
|
53
|
+
export function hashEntry(entry) {
|
|
54
|
+
const hashable = {
|
|
55
|
+
version: entry.version,
|
|
56
|
+
timestamp: entry.timestamp,
|
|
57
|
+
event: entry.event,
|
|
58
|
+
scaffoldType: entry.scaffoldType,
|
|
59
|
+
depthLevel: entry.depthLevel,
|
|
60
|
+
epistemicMode: entry.epistemicMode,
|
|
61
|
+
triageResult: entry.triageResult,
|
|
62
|
+
evidentialWeight: entry.evidentialWeight,
|
|
63
|
+
priorPosterior: entry.priorPosterior,
|
|
64
|
+
updatedPosterior: entry.updatedPosterior,
|
|
65
|
+
nonInterventionDecision: entry.nonInterventionDecision ?? null,
|
|
66
|
+
};
|
|
67
|
+
return sha256(canonicalize(hashable));
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Compute a hash over a canonical string (for summary hashes, etc.).
|
|
71
|
+
*/
|
|
72
|
+
export function hashCanonical(input) {
|
|
73
|
+
return sha256(input);
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/verifier/hash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY;IACvC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACtC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAA0B,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;gBAC/E,MAAM,CAAC,GAAG,CAAC,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC;gBACtD,OAAO,MAAM,CAAC;YAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACT,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,eAAe;IACf,IAAI,CAAC;QACH,iEAAiE;QACjE,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,0DAA0D;QAC1D,mEAAmE;QACnE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,KAAoB;IAC5C,MAAM,QAAQ,GAAG;QACf,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,uBAAuB,EAAE,KAAK,CAAC,uBAAuB,IAAI,IAAI;KAC/D,CAAC;IACF,OAAO,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { verifyRecord } from "./verify-record";
|
|
2
|
+
export type { VerificationResult, Violation } from "./verify-record";
|
|
3
|
+
export { replayToVersion, posteriorAtVersion, summarizeToVersion } from "./replay";
|
|
4
|
+
export { hashEntry, hashCanonical, canonicalize, sha256 } from "./hash";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/verifier/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/verifier/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay — reconstruct evidence state at any historical version.
|
|
3
|
+
*
|
|
4
|
+
* This is pure bookkeeping: it slices the entry array to version N
|
|
5
|
+
* and returns the logged values. It does NOT recompute any posteriors.
|
|
6
|
+
*/
|
|
7
|
+
import type { EvidenceRecord, EvidenceEntry } from "../schema/evidence-record";
|
|
8
|
+
/**
|
|
9
|
+
* Replay an evidence record to a specific version.
|
|
10
|
+
*
|
|
11
|
+
* Returns entries up to and including the target version.
|
|
12
|
+
* The last entry's `updatedPosterior` is the posterior at that version.
|
|
13
|
+
*
|
|
14
|
+
* This function reconstructs state from LOGGED values only —
|
|
15
|
+
* it never calls an update function, never contains estimation math.
|
|
16
|
+
*/
|
|
17
|
+
export declare function replayToVersion(record: EvidenceRecord, targetVersion: number): EvidenceEntry[];
|
|
18
|
+
/**
|
|
19
|
+
* Get the posterior value at a specific version.
|
|
20
|
+
* Returns null if the version is not found.
|
|
21
|
+
*/
|
|
22
|
+
export declare function posteriorAtVersion(record: EvidenceRecord, targetVersion: number): number | null;
|
|
23
|
+
/**
|
|
24
|
+
* Get a summary of the record up to a version.
|
|
25
|
+
*/
|
|
26
|
+
export declare function summarizeToVersion(record: EvidenceRecord, targetVersion: number): {
|
|
27
|
+
entriesIncluded: number;
|
|
28
|
+
firstVersion: number;
|
|
29
|
+
lastVersion: number;
|
|
30
|
+
finalPosterior: number | null;
|
|
31
|
+
scaffoldDistribution: Record<string, number>;
|
|
32
|
+
triageDistribution: Record<string, number>;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=replay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/verifier/replay.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/E;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,GACpB,aAAa,EAAE,CAEjB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,IAAI,CAIf;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EACtB,aAAa,EAAE,MAAM,GACpB;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C,CAkBA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay — reconstruct evidence state at any historical version.
|
|
3
|
+
*
|
|
4
|
+
* This is pure bookkeeping: it slices the entry array to version N
|
|
5
|
+
* and returns the logged values. It does NOT recompute any posteriors.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Replay an evidence record to a specific version.
|
|
9
|
+
*
|
|
10
|
+
* Returns entries up to and including the target version.
|
|
11
|
+
* The last entry's `updatedPosterior` is the posterior at that version.
|
|
12
|
+
*
|
|
13
|
+
* This function reconstructs state from LOGGED values only —
|
|
14
|
+
* it never calls an update function, never contains estimation math.
|
|
15
|
+
*/
|
|
16
|
+
export function replayToVersion(record, targetVersion) {
|
|
17
|
+
return record.entries.filter((e) => e.version <= targetVersion);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the posterior value at a specific version.
|
|
21
|
+
* Returns null if the version is not found.
|
|
22
|
+
*/
|
|
23
|
+
export function posteriorAtVersion(record, targetVersion) {
|
|
24
|
+
const entries = replayToVersion(record, targetVersion);
|
|
25
|
+
if (entries.length === 0)
|
|
26
|
+
return null;
|
|
27
|
+
return entries[entries.length - 1].updatedPosterior;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get a summary of the record up to a version.
|
|
31
|
+
*/
|
|
32
|
+
export function summarizeToVersion(record, targetVersion) {
|
|
33
|
+
const entries = replayToVersion(record, targetVersion);
|
|
34
|
+
const scaffoldDist = {};
|
|
35
|
+
const triageDist = {};
|
|
36
|
+
for (const e of entries) {
|
|
37
|
+
if (e.scaffoldType)
|
|
38
|
+
scaffoldDist[e.scaffoldType] = (scaffoldDist[e.scaffoldType] ?? 0) + 1;
|
|
39
|
+
if (e.triageResult)
|
|
40
|
+
triageDist[e.triageResult] = (triageDist[e.triageResult] ?? 0) + 1;
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
entriesIncluded: entries.length,
|
|
44
|
+
firstVersion: entries[0]?.version ?? 0,
|
|
45
|
+
lastVersion: entries[entries.length - 1]?.version ?? 0,
|
|
46
|
+
finalPosterior: entries.length > 0 ? entries[entries.length - 1].updatedPosterior : null,
|
|
47
|
+
scaffoldDistribution: scaffoldDist,
|
|
48
|
+
triageDistribution: triageDist,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=replay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/verifier/replay.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAsB,EACtB,aAAqB;IAErB,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAsB,EACtB,aAAqB;IAErB,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAsB,EACtB,aAAqB;IASrB,MAAM,OAAO,GAAG,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvD,MAAM,YAAY,GAA2B,EAAE,CAAC;IAChD,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,CAAC,YAAY;YAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAC3F,IAAI,CAAC,CAAC,YAAY;YAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACzF,CAAC;IAED,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,MAAM;QAC/B,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC;QACtC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC;QACtD,cAAc,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI;QACxF,oBAAoB,EAAE,YAAY;QAClC,kBAAkB,EAAE,UAAU;KAC/B,CAAC;AACJ,CAAC"}
|