@actuarial-ts/compliance 0.6.1 → 0.7.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/README.md +44 -3
- package/dist/diagnosticArtifactStream.d.ts +30 -0
- package/dist/diagnosticArtifactStream.d.ts.map +1 -0
- package/dist/diagnosticArtifactStream.js +128 -0
- package/dist/diagnosticArtifactStream.js.map +1 -0
- package/dist/diagnosticByteSource.d.ts +10 -0
- package/dist/diagnosticByteSource.d.ts.map +1 -0
- package/dist/diagnosticByteSource.js +70 -0
- package/dist/diagnosticByteSource.js.map +1 -0
- package/dist/diagnosticByteView.d.ts +3 -0
- package/dist/diagnosticByteView.d.ts.map +1 -0
- package/dist/diagnosticByteView.js +27 -0
- package/dist/diagnosticByteView.js.map +1 -0
- package/dist/diagnosticCompactRun.d.ts +43 -0
- package/dist/diagnosticCompactRun.d.ts.map +1 -0
- package/dist/diagnosticCompactRun.js +253 -0
- package/dist/diagnosticCompactRun.js.map +1 -0
- package/dist/diagnosticReplayFrames.d.ts +10 -0
- package/dist/diagnosticReplayFrames.d.ts.map +1 -0
- package/dist/diagnosticReplayFrames.js +99 -0
- package/dist/diagnosticReplayFrames.js.map +1 -0
- package/dist/diagnosticReplayProtocol.d.ts +17 -0
- package/dist/diagnosticReplayProtocol.d.ts.map +1 -0
- package/dist/diagnosticReplayProtocol.js +98 -0
- package/dist/diagnosticReplayProtocol.js.map +1 -0
- package/dist/diagnosticReplayReader.d.ts +41 -0
- package/dist/diagnosticReplayReader.d.ts.map +1 -0
- package/dist/diagnosticReplayReader.js +346 -0
- package/dist/diagnosticReplayReader.js.map +1 -0
- package/dist/diagnosticReplayValue.d.ts +34 -0
- package/dist/diagnosticReplayValue.d.ts.map +1 -0
- package/dist/diagnosticReplayValue.js +269 -0
- package/dist/diagnosticReplayValue.js.map +1 -0
- package/dist/diagnosticReplayWriter.d.ts +25 -0
- package/dist/diagnosticReplayWriter.d.ts.map +1 -0
- package/dist/diagnosticReplayWriter.js +148 -0
- package/dist/diagnosticReplayWriter.js.map +1 -0
- package/dist/diagnosticRun.d.ts.map +1 -1
- package/dist/diagnosticRun.js +1 -193
- package/dist/diagnosticRun.js.map +1 -1
- package/dist/diagnosticRunEvidence.d.ts +18 -0
- package/dist/diagnosticRunEvidence.d.ts.map +1 -0
- package/dist/diagnosticRunEvidence.js +195 -0
- package/dist/diagnosticRunEvidence.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/sha256Stream.d.ts +6 -0
- package/dist/sha256Stream.d.ts.map +1 -0
- package/dist/sha256Stream.js +103 -0
- package/dist/sha256Stream.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/src/diagnosticArtifactStream.ts +148 -0
- package/src/diagnosticByteSource.ts +82 -0
- package/src/diagnosticByteView.ts +27 -0
- package/src/diagnosticCompactRun.ts +462 -0
- package/src/diagnosticReplayFrames.ts +99 -0
- package/src/diagnosticReplayProtocol.ts +99 -0
- package/src/diagnosticReplayReader.ts +428 -0
- package/src/diagnosticReplayValue.ts +269 -0
- package/src/diagnosticReplayWriter.ts +190 -0
- package/src/diagnosticRun.ts +7 -373
- package/src/diagnosticRunEvidence.ts +391 -0
- package/src/index.ts +10 -0
- package/src/sha256Stream.ts +108 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
Documentation, judgment, provenance, and reproducibility primitives for actuarial-ts. The package is designed to support compliance work under applicable ASOPs; it neither determines compliance nor replaces the actuary’s review.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @actuarial-ts/compliance@0.
|
|
6
|
+
npm install @actuarial-ts/compliance@0.7.1 @actuarial-ts/core@0.7.1 @actuarial-ts/data@0.7.1 @actuarial-ts/interchange@0.7.1
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Node 20+, ESM.
|
|
10
10
|
|
|
11
11
|
## Diagnostic provenance
|
|
12
12
|
|
|
13
|
-
`createDiagnosticRunIdentity` accepts only an owner-authenticated, completed data-package run. It does not accept caller-restated formulas, filters, review status, or result identities.
|
|
13
|
+
The example below uses eager provenance. `createDiagnosticRunIdentity` accepts only an owner-authenticated, completed eager data-package run. It does not accept caller-restated formulas, filters, review status, or result identities. Compact runs use the separate workflow below.
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
16
|
import { createBundle, createDiagnosticRunIdentity } from "@actuarial-ts/compliance";
|
|
@@ -59,7 +59,48 @@ Material host judgments worth recording in the assumption ledger include amount
|
|
|
59
59
|
|
|
60
60
|
The package also provides estimate metadata, assumption ledgers, ASOP No. 41 draft disclosure generation, ASOP No. 56 model cards, actual-versus-expected roll-forward, and canonical reproducibility bundles.
|
|
61
61
|
|
|
62
|
-
See the [formula catalog](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
62
|
+
See the [formula catalog](https://github.com/yerromnitsuj/actng/blob/v0.7.1/docs/reference/diagnostic-formulas.md) and [migration guide](https://github.com/yerromnitsuj/actng/blob/v0.7.1/docs/migrations/0.6-generalized-diagnostics.md).
|
|
63
|
+
|
|
64
|
+
## Compact provenance and replay streams
|
|
65
|
+
|
|
66
|
+
Introduced in 0.7.0, this separate path retains complete audit evidence without
|
|
67
|
+
requiring expanded manifest/result objects or one archive-sized identity string.
|
|
68
|
+
It does not certify dataset capacity or total application memory use. Existing
|
|
69
|
+
eager provenance and interchange `BundleDoc` APIs remain available.
|
|
70
|
+
|
|
71
|
+
| Step | Public API and host responsibility |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Produce a genuine completed run | Use the compact validated gateway in `@actuarial-ts/data`; handle both review and metric blocks. |
|
|
74
|
+
| Hash actual artifact bytes | `digestDiagnosticArtifactChunks` returns an authenticated computed digest. Keep a repeatable byte source; hashes without retained original bytes must remain caller-declared. |
|
|
75
|
+
| Bind run and artifact evidence | `createCompactDiagnosticRunIdentity` accepts the completed compact run, genuine computed receipts or explicitly declared evidence, and complete preparation lineage. |
|
|
76
|
+
| Write complete replay evidence | Consume `writeDiagnosticReplayStream` into a temporary host destination and publish it only after successful completion. `openArtifact` must reopen the bytes matching each computed digest. |
|
|
77
|
+
| Independently verify | `verifyDiagnosticReplayStream` requires explicit host resource limits, reruns the recorded input, and compares complete canonical evidence before issuing a receipt. Success requires the trailer and EOF. |
|
|
78
|
+
|
|
79
|
+
The host owns file/network I/O, pending-I/O cancellation, retention, and access
|
|
80
|
+
control. Supply the same abort signal to host I/O and the SDK. Cancellation is
|
|
81
|
+
cooperative between chunks/phases, not interruption of synchronous calculation.
|
|
82
|
+
Use summaries/pages for routine views; materializing all findings or identity
|
|
83
|
+
documents afterward can erase the representation's memory benefit.
|
|
84
|
+
|
|
85
|
+
`VerifiedCompactDiagnosticRunProvenance` is a distinct owner-authenticated
|
|
86
|
+
object, not an eager `VerifiedDiagnosticRunProvenance` or a serializable
|
|
87
|
+
authorization token. It cannot be cast into `createBundle`, the eager verifier,
|
|
88
|
+
or the current diagnostic agent executor. The stream format is
|
|
89
|
+
`diagnostic-replay/1`, separate from interchange wire `1.1.0`; it is not a
|
|
90
|
+
single JSON document or a `BundleDoc`.
|
|
91
|
+
|
|
92
|
+
Replay identities include the producing SDK's engine versions. Preserve those
|
|
93
|
+
exact package versions with stored evidence and use a matching runtime for
|
|
94
|
+
verification. Stream version 1 does not guarantee cross-SDK-version replay;
|
|
95
|
+
in particular, a patch upgrade must not be assumed to verify an older stream.
|
|
96
|
+
Successful replay establishes internal reproducibility, not source authenticity,
|
|
97
|
+
a digital signature, correct claim-level capping, or actuarial correctness.
|
|
98
|
+
|
|
99
|
+
The runnable [compact adoption guide](https://github.com/yerromnitsuj/actng/blob/v0.7.1/docs/migrations/0.7-compact-diagnostics.md)
|
|
100
|
+
and complete [replay reference](https://github.com/yerromnitsuj/actng/blob/v0.7.1/docs/reference/diagnostic-replay-stream.md)
|
|
101
|
+
document ownership, artifact bytes, paging, framing, resource limits, and
|
|
102
|
+
assurance boundaries. These repository guides are linked here for npm users;
|
|
103
|
+
the guide files themselves are not shipped inside the package.
|
|
63
104
|
|
|
64
105
|
## License
|
|
65
106
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DiagnosticArtifactDigest } from "./diagnosticRun.js";
|
|
2
|
+
export interface DiagnosticArtifactStreamMetadata {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly scope: "input" | "preparation";
|
|
5
|
+
/** Optional completeness check; no digest handle is issued on truncation. */
|
|
6
|
+
readonly expectedByteLength?: number;
|
|
7
|
+
/** Caller-selected resource ceiling, at most Number.MAX_SAFE_INTEGER. */
|
|
8
|
+
readonly maximumByteLength?: number;
|
|
9
|
+
}
|
|
10
|
+
declare const computedArtifactDigestBrand: unique symbol;
|
|
11
|
+
export type ComputedDiagnosticArtifactDigest = Extract<DiagnosticArtifactDigest, {
|
|
12
|
+
assurance: "sdk-computed";
|
|
13
|
+
}> & {
|
|
14
|
+
readonly [computedArtifactDigestBrand]: true;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Hash the bytes actually received, retaining only a bounded chunk copy.
|
|
18
|
+
* The producer owns I/O. A completed handle means SDK-computed content digest,
|
|
19
|
+
* not source authenticity, a signature, or validation of an actuarial run.
|
|
20
|
+
* Shared buffers are refused; bytes are consumed before requesting the next
|
|
21
|
+
* chunk. A changing producer must be checked again against this digest on replay.
|
|
22
|
+
* Cancellation is cooperative between received chunks; the producer should use
|
|
23
|
+
* the same signal to cancel pending I/O. One synchronous chunk is not interrupted.
|
|
24
|
+
*/
|
|
25
|
+
export declare function digestDiagnosticArtifactChunks(metadata: DiagnosticArtifactStreamMetadata, chunks: AsyncIterable<Uint8Array> | Iterable<Uint8Array>, options?: {
|
|
26
|
+
readonly signal?: AbortSignal;
|
|
27
|
+
}): Promise<ComputedDiagnosticArtifactDigest>;
|
|
28
|
+
export declare function assertComputedDiagnosticArtifactDigest(value: unknown): asserts value is ComputedDiagnosticArtifactDigest;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=diagnosticArtifactStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticArtifactStream.d.ts","sourceRoot":"","sources":["../src/diagnosticArtifactStream.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAKnE,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAAC;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AACD,OAAO,CAAC,MAAM,2BAA2B,EAAE,OAAO,MAAM,CAAC;AACzD,MAAM,MAAM,gCAAgC,GAAG,OAAO,CACpD,wBAAwB,EACxB;IAAE,SAAS,EAAE,cAAc,CAAA;CAAE,CAC9B,GAAG;IAAE,QAAQ,CAAC,CAAC,2BAA2B,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAiErD;;;;;;;;GAQG;AACH,wBAAsB,8BAA8B,CAClD,QAAQ,EAAE,gCAAgC,EAC1C,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,EACxD,OAAO,GAAE;IAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC9C,OAAO,CAAC,gCAAgC,CAAC,CAuC3C;AAED,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,KAAK,IAAI,gCAAgC,CAGnD"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { diagnosticJsonPreflight, isDiagnosticPlainRecord, isDiagnosticToken, } from "@actuarial-ts/core";
|
|
2
|
+
import { ComplianceError } from "./errors.js";
|
|
3
|
+
import { createSha256 } from "./sha256Stream.js";
|
|
4
|
+
import { diagnosticByteView } from "./diagnosticByteView.js";
|
|
5
|
+
import { consumeDiagnosticByteSource } from "./diagnosticByteSource.js";
|
|
6
|
+
const computed = new WeakSet();
|
|
7
|
+
const signalAborted = Object.getOwnPropertyDescriptor(AbortSignal.prototype, "aborted").get;
|
|
8
|
+
const throwIfAborted = AbortSignal.prototype.throwIfAborted;
|
|
9
|
+
const COPY_SIZE = 65_536;
|
|
10
|
+
function invalid(message, path = "$") {
|
|
11
|
+
throw new ComplianceError("BAD_DIAGNOSTIC_RUN", message, path);
|
|
12
|
+
}
|
|
13
|
+
function ownedMetadata(value) {
|
|
14
|
+
// Read descriptors once. A Proxy must not pass validation with one property
|
|
15
|
+
// value and supply a different value when the final digest is assembled.
|
|
16
|
+
if (!isDiagnosticPlainRecord(value))
|
|
17
|
+
invalid("Artifact metadata must be a plain object");
|
|
18
|
+
const snapshot = Object.create(null);
|
|
19
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
20
|
+
if (typeof key !== "string")
|
|
21
|
+
invalid("Artifact metadata cannot have symbol keys");
|
|
22
|
+
const field = Object.getOwnPropertyDescriptor(value, key);
|
|
23
|
+
if (!field || !("value" in field) || !field.enumerable)
|
|
24
|
+
invalid("Artifact metadata must contain enumerable data properties", `$.${key}`);
|
|
25
|
+
snapshot[key] = field.value;
|
|
26
|
+
}
|
|
27
|
+
value = snapshot;
|
|
28
|
+
const issues = diagnosticJsonPreflight(value, "input");
|
|
29
|
+
if (issues.length)
|
|
30
|
+
invalid(issues[0].message, issues[0].path);
|
|
31
|
+
if (!isDiagnosticPlainRecord(value))
|
|
32
|
+
invalid("Artifact metadata must be a plain object");
|
|
33
|
+
for (const key of Object.keys(value))
|
|
34
|
+
if (!["id", "scope", "expectedByteLength", "maximumByteLength"].includes(key))
|
|
35
|
+
invalid("Unknown artifact metadata key", `$.${key}`);
|
|
36
|
+
if (!isDiagnosticToken(value.id))
|
|
37
|
+
invalid("Artifact ID must be a valid token", "$.id");
|
|
38
|
+
if (value.scope !== "input" && value.scope !== "preparation")
|
|
39
|
+
invalid("Artifact scope must be input or preparation", "$.scope");
|
|
40
|
+
for (const key of ["expectedByteLength", "maximumByteLength"])
|
|
41
|
+
if (value[key] !== undefined && (!Number.isSafeInteger(value[key]) || value[key] < 0))
|
|
42
|
+
invalid("Byte length must be a nonnegative safe integer", `$.${key}`);
|
|
43
|
+
const maximumByteLength = value.maximumByteLength ?? Number.MAX_SAFE_INTEGER;
|
|
44
|
+
if (value.expectedByteLength !== undefined && value.expectedByteLength > maximumByteLength)
|
|
45
|
+
invalid("Expected byte length exceeds the resource ceiling", "$.expectedByteLength");
|
|
46
|
+
return {
|
|
47
|
+
id: value.id,
|
|
48
|
+
scope: value.scope,
|
|
49
|
+
expectedByteLength: value.expectedByteLength,
|
|
50
|
+
maximumByteLength,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function cancellation(options) {
|
|
54
|
+
if (!isDiagnosticPlainRecord(options))
|
|
55
|
+
invalid("Artifact stream options must be a plain object");
|
|
56
|
+
for (const key of Reflect.ownKeys(options))
|
|
57
|
+
if (key !== "signal")
|
|
58
|
+
invalid("Unknown artifact stream option");
|
|
59
|
+
const field = Object.getOwnPropertyDescriptor(options, "signal");
|
|
60
|
+
if (field && (!("value" in field) || !field.enumerable))
|
|
61
|
+
invalid("Artifact signal must be supplied as a data property");
|
|
62
|
+
const signal = field?.value;
|
|
63
|
+
if (signal === undefined)
|
|
64
|
+
return () => { };
|
|
65
|
+
try {
|
|
66
|
+
signalAborted.call(signal);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
invalid("Artifact signal must be an AbortSignal");
|
|
70
|
+
}
|
|
71
|
+
// Capture the genuine signal and intrinsic method before any producer await.
|
|
72
|
+
return () => throwIfAborted.call(signal);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Hash the bytes actually received, retaining only a bounded chunk copy.
|
|
76
|
+
* The producer owns I/O. A completed handle means SDK-computed content digest,
|
|
77
|
+
* not source authenticity, a signature, or validation of an actuarial run.
|
|
78
|
+
* Shared buffers are refused; bytes are consumed before requesting the next
|
|
79
|
+
* chunk. A changing producer must be checked again against this digest on replay.
|
|
80
|
+
* Cancellation is cooperative between received chunks; the producer should use
|
|
81
|
+
* the same signal to cancel pending I/O. One synchronous chunk is not interrupted.
|
|
82
|
+
*/
|
|
83
|
+
export async function digestDiagnosticArtifactChunks(metadata, chunks, options = {}) {
|
|
84
|
+
const owned = ownedMetadata(metadata);
|
|
85
|
+
const checkCancellation = cancellation(options);
|
|
86
|
+
checkCancellation();
|
|
87
|
+
const hash = createSha256();
|
|
88
|
+
const copy = new Uint8Array(COPY_SIZE);
|
|
89
|
+
let byteLength = 0;
|
|
90
|
+
try {
|
|
91
|
+
for await (const chunk of consumeDiagnosticByteSource(chunks, checkCancellation)) {
|
|
92
|
+
checkCancellation();
|
|
93
|
+
const view = diagnosticByteView(chunk);
|
|
94
|
+
const size = view.byteLength;
|
|
95
|
+
if (!Number.isSafeInteger(byteLength + size) || byteLength + size > owned.maximumByteLength)
|
|
96
|
+
invalid("Artifact byte length exceeds the resource ceiling", "$.chunks");
|
|
97
|
+
if (owned.expectedByteLength !== undefined && byteLength + size > owned.expectedByteLength)
|
|
98
|
+
invalid("Artifact has more bytes than declared", "$.chunks");
|
|
99
|
+
for (let start = 0; start < size; start += COPY_SIZE) {
|
|
100
|
+
const length = Math.min(COPY_SIZE, size - start);
|
|
101
|
+
copy.set(new Uint8Array(view.buffer, view.byteOffset + start, length));
|
|
102
|
+
hash.update(copy.subarray(0, length));
|
|
103
|
+
}
|
|
104
|
+
byteLength += size;
|
|
105
|
+
}
|
|
106
|
+
checkCancellation();
|
|
107
|
+
if (owned.expectedByteLength !== undefined && byteLength !== owned.expectedByteLength)
|
|
108
|
+
invalid("Artifact ended before its declared byte length", "$.chunks");
|
|
109
|
+
const digest = Object.freeze({
|
|
110
|
+
id: owned.id,
|
|
111
|
+
scope: owned.scope,
|
|
112
|
+
assurance: "sdk-computed",
|
|
113
|
+
algorithm: "sha256",
|
|
114
|
+
value: hash.digest(),
|
|
115
|
+
byteLength,
|
|
116
|
+
});
|
|
117
|
+
computed.add(digest);
|
|
118
|
+
return digest;
|
|
119
|
+
}
|
|
120
|
+
finally {
|
|
121
|
+
copy.fill(0);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export function assertComputedDiagnosticArtifactDigest(value) {
|
|
125
|
+
if (value === null || typeof value !== "object" || !computed.has(value))
|
|
126
|
+
invalid("Value is not an authentic SDK-computed streamed artifact digest");
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=diagnosticArtifactStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticArtifactStream.js","sourceRoot":"","sources":["../src/diagnosticArtifactStream.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAgBxE,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAU,CAAC;AACvC,MAAM,aAAa,GAAG,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAE,CAAC,GAAI,CAAC;AAC9F,MAAM,cAAc,GAAG,WAAW,CAAC,SAAS,CAAC,cAAc,CAAC;AAC5D,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB,SAAS,OAAO,CAAC,OAAe,EAAE,IAAI,GAAG,GAAG;IAC1C,MAAM,IAAI,eAAe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ACrB,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sCAAsC,CACpD,KAAc;IAEd,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC;QACrE,OAAO,CAAC,iEAAiE,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type DiagnosticByteSource = Iterable<Uint8Array> | AsyncIterable<Uint8Array>;
|
|
2
|
+
/**
|
|
3
|
+
* Own one producer iterator through completion, cancellation or read failure.
|
|
4
|
+
* Unlike a bare for-await loop, a rejected next() also closes the producer.
|
|
5
|
+
* A cleanup failure never replaces the error that caused cleanup. Hosts should
|
|
6
|
+
* pass the same cancellation signal to pending I/O; checks cannot interrupt it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function consumeDiagnosticByteSource(source: DiagnosticByteSource, checkCancellation?: () => void): AsyncGenerator<Uint8Array>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=diagnosticByteSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticByteSource.d.ts","sourceRoot":"","sources":["../src/diagnosticByteSource.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;AAQ7E;;;;;GAKG;AACH,wBAAuB,2BAA2B,CAChD,MAAM,EAAE,oBAAoB,EAC5B,iBAAiB,GAAE,MAAM,IAAe,GACvC,cAAc,CAAC,UAAU,CAAC,CAgE5B"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
function isObject(value) {
|
|
2
|
+
return (value !== null && (typeof value === "object" || typeof value === "function"));
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Own one producer iterator through completion, cancellation or read failure.
|
|
6
|
+
* Unlike a bare for-await loop, a rejected next() also closes the producer.
|
|
7
|
+
* A cleanup failure never replaces the error that caused cleanup. Hosts should
|
|
8
|
+
* pass the same cancellation signal to pending I/O; checks cannot interrupt it.
|
|
9
|
+
*/
|
|
10
|
+
export async function* consumeDiagnosticByteSource(source, checkCancellation = () => { }) {
|
|
11
|
+
if (!isObject(source))
|
|
12
|
+
throw new TypeError("Diagnostic byte source must be iterable");
|
|
13
|
+
const iterable = source;
|
|
14
|
+
const asynchronous = iterable[Symbol.asyncIterator];
|
|
15
|
+
const method = asynchronous ?? iterable[Symbol.iterator];
|
|
16
|
+
if (typeof method !== "function")
|
|
17
|
+
throw new TypeError("Diagnostic byte source must provide an iterator method");
|
|
18
|
+
const iterator = Reflect.apply(method, source, []);
|
|
19
|
+
if (!isObject(iterator))
|
|
20
|
+
throw new TypeError("Diagnostic byte iterator must be an object");
|
|
21
|
+
const protocol = iterator;
|
|
22
|
+
let completed = false;
|
|
23
|
+
let failed = false;
|
|
24
|
+
try {
|
|
25
|
+
// Capture next once, as the iterator protocol does; never use a producer's
|
|
26
|
+
// potentially overwritten Function.call property.
|
|
27
|
+
const next = protocol.next;
|
|
28
|
+
if (typeof next !== "function")
|
|
29
|
+
throw new TypeError("Diagnostic byte iterator must provide next()");
|
|
30
|
+
for (;;) {
|
|
31
|
+
checkCancellation();
|
|
32
|
+
const result = await Reflect.apply(next, iterator, []);
|
|
33
|
+
if (!isObject(result))
|
|
34
|
+
throw new TypeError("Diagnostic byte read must return an iterator result");
|
|
35
|
+
const item = result;
|
|
36
|
+
completed = Boolean(item.done);
|
|
37
|
+
checkCancellation();
|
|
38
|
+
if (completed)
|
|
39
|
+
return;
|
|
40
|
+
// An async generator also observes a rejected value from a synchronous
|
|
41
|
+
// iterator here, so that failure follows the same cleanup path.
|
|
42
|
+
yield item.value;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
failed = true;
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
if (!completed) {
|
|
51
|
+
try {
|
|
52
|
+
// Read return only when closing, once, following normal iterator
|
|
53
|
+
// semantics. The generator's finally executes at most once.
|
|
54
|
+
const close = protocol.return;
|
|
55
|
+
if (close !== undefined && close !== null) {
|
|
56
|
+
if (typeof close !== "function")
|
|
57
|
+
throw new TypeError("Diagnostic byte iterator return must be a function");
|
|
58
|
+
const result = await Reflect.apply(close, iterator, []);
|
|
59
|
+
if (!isObject(result))
|
|
60
|
+
throw new TypeError("Diagnostic byte iterator return must return an iterator result");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (cleanupError) {
|
|
64
|
+
if (!failed)
|
|
65
|
+
throw cleanupError;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=diagnosticByteSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticByteSource.js","sourceRoot":"","sources":["../src/diagnosticByteSource.ts"],"names":[],"mappings":"AAEA,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,CACL,KAAK,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC,CAC7E,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,2BAA2B,CAChD,MAA4B,EAC5B,oBAAgC,GAAG,EAAE,GAAE,CAAC;IAExC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;QACnB,MAAM,IAAI,SAAS,CAAC,yCAAyC,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,MAEhB,CAAC;IACF,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,YAAY,I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E,CAAC;YACf,IAAI,CAAC;gBACH,iEAAiE;gBACjE,4DAA4D;gBAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC;gBAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBAC1C,IAAI,OAAO,KAAK,KAAK,UAAU;wBAC7B,MAAM,IAAI,SAAS,CACjB,oDAAoD,CACrD,CAAC;oBACJ,MAAM,MAAM,GAAY,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;oBACjE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;wBACnB,MAAM,IAAI,SAAS,CACjB,gEAAgE,CACjE,CAAC;gBACN,CAAC;YACH,CAAC;YAAC,OAAO,YAAY,EAAE,CAAC;gBACtB,IAAI,CAAC,MAAM;oBAAE,MAAM,YAAY,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticByteView.d.ts","sourceRoot":"","sources":["../src/diagnosticByteView.ts"],"names":[],"mappings":"AAUA,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAe1E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ComplianceError } from "./errors.js";
|
|
2
|
+
const typedArrayPrototype = Object.getPrototypeOf(Uint8Array.prototype);
|
|
3
|
+
const byteLength = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteLength").get;
|
|
4
|
+
const byteOffset = Object.getOwnPropertyDescriptor(typedArrayPrototype, "byteOffset").get;
|
|
5
|
+
const bufferOf = Object.getOwnPropertyDescriptor(typedArrayPrototype, "buffer").get;
|
|
6
|
+
const arrayBufferLength = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "byteLength")
|
|
7
|
+
.get;
|
|
8
|
+
const resizable = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, "resizable")?.get;
|
|
9
|
+
/** Borrow a synchronous intrinsic-only view; callers copy before yielding. */
|
|
10
|
+
export function diagnosticByteView(chunk) {
|
|
11
|
+
const fail = (message) => {
|
|
12
|
+
throw new ComplianceError("BAD_DIAGNOSTIC_RUN", message, "$.chunks");
|
|
13
|
+
};
|
|
14
|
+
if (!(chunk instanceof Uint8Array) || !ArrayBuffer.isView(chunk))
|
|
15
|
+
fail("Artifact chunks must be Uint8Array values");
|
|
16
|
+
const buffer = bufferOf.call(chunk);
|
|
17
|
+
try {
|
|
18
|
+
arrayBufferLength.call(buffer);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
fail("Shared artifact buffers cannot provide a stable byte snapshot");
|
|
22
|
+
}
|
|
23
|
+
if (resizable?.call(buffer))
|
|
24
|
+
fail("Resizable artifact buffers cannot provide a stable byte snapshot");
|
|
25
|
+
return new Uint8Array(buffer, byteOffset.call(chunk), byteLength.call(chunk));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=diagnosticByteView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticByteView.js","sourceRoot":"","sources":["../src/diagnosticByteView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,mBAAmB,GAAG,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AACxE,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,mBAAmB,EAAE,YAAY,CAAE,CAAC,GAAI,CAAC;AAC5F,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAAC,mBAAmB,EAAE,YAAY,CAAE,CAAC,GAAI,CAAC;AAC5F,MAAM,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC,mBAAmB,EAAE,QAAQ,CAAE,CAAC,GAAI,CAAC;AACtF,MAAM,iBAAiB,GAAG,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,YAAY,CAAE;KAC5F,GAAI,CAAC;AACR,MAAM,SAAS,GAAG,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,GAAG,CAAC;AAE3F,8EAA8E;AAC9E,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,MAAM,IAAI,GAAG,CAAC,OAAe,EAAS,EAAE;QACtC,MAAM,IAAI,eAAe,CAAC,oBAAoB,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC,CAAC;IACF,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC;QAC9D,IAAI,CAAC,2CAA2C,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAgB,CAAC;IACnD,IAAI,CAAC;QACH,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC,+DAA+D,CAAC,CAAC;IACxE,CAAC;IACD,IAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,kEAAkE,CAAC,CAAC;IAC3E,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type DiagnosticIdentityDocument } from "@actuarial-ts/core";
|
|
2
|
+
import { type CompletedCompactMetricDiagnosticsRun } from "@actuarial-ts/data";
|
|
3
|
+
import { type ComputedDiagnosticArtifactDigest } from "./diagnosticArtifactStream.js";
|
|
4
|
+
import type { DiagnosticArtifactDigest, DiagnosticPreparationLineage, DiagnosticRunIdentity, DiagnosticRunProvenance } from "./diagnosticRun.js";
|
|
5
|
+
/** Computed digests must be authentic completed byte-stream receipts, not JSON copies. */
|
|
6
|
+
export type CompactDiagnosticArtifactEvidence = ComputedDiagnosticArtifactDigest | Extract<DiagnosticArtifactDigest, {
|
|
7
|
+
assurance: "caller-declared";
|
|
8
|
+
}>;
|
|
9
|
+
export interface CreateCompactDiagnosticRunIdentityInput {
|
|
10
|
+
readonly completedRun: CompletedCompactMetricDiagnosticsRun;
|
|
11
|
+
readonly inputArtifacts: readonly CompactDiagnosticArtifactEvidence[];
|
|
12
|
+
readonly preparationArtifacts: readonly CompactDiagnosticArtifactEvidence[];
|
|
13
|
+
readonly preparationLineage: readonly DiagnosticPreparationLineage[];
|
|
14
|
+
}
|
|
15
|
+
declare const verifiedCompactDiagnosticRunProvenanceBrand: unique symbol;
|
|
16
|
+
/**
|
|
17
|
+
* Verified compact evidence, not a legacy provenance DTO or BundleDoc.
|
|
18
|
+
* Documents emit the complete legacy normalized manifest/result identity bytes.
|
|
19
|
+
* They retain immutable owners, not expanded identity arrays or source bytes.
|
|
20
|
+
* The provenance brand, not a structural document, establishes verification.
|
|
21
|
+
*/
|
|
22
|
+
export interface VerifiedCompactDiagnosticRunProvenance extends DiagnosticRunIdentity {
|
|
23
|
+
readonly [verifiedCompactDiagnosticRunProvenanceBrand]: true;
|
|
24
|
+
readonly definition: DiagnosticRunProvenance["definition"];
|
|
25
|
+
readonly inputArtifacts: readonly DiagnosticArtifactDigest[];
|
|
26
|
+
readonly preparationArtifacts: readonly DiagnosticArtifactDigest[];
|
|
27
|
+
readonly preparationLineage: readonly DiagnosticPreparationLineage[];
|
|
28
|
+
readonly preparationFingerprint: string;
|
|
29
|
+
readonly reviewFingerprint: string;
|
|
30
|
+
readonly manifestIdentityDocument: DiagnosticIdentityDocument;
|
|
31
|
+
readonly resultIdentityDocument: DiagnosticIdentityDocument;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Verify an authentic compact completed run and bind completed artifact digests.
|
|
35
|
+
* Synchronous: source bytes were consumed by digestDiagnosticArtifactChunks already.
|
|
36
|
+
* This deliberately replays review/math and compares every identity code unit.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createCompactDiagnosticRunIdentity(input: CreateCompactDiagnosticRunIdentityInput): VerifiedCompactDiagnosticRunProvenance;
|
|
39
|
+
export declare function assertVerifiedCompactDiagnosticRunProvenance(value: unknown): asserts value is VerifiedCompactDiagnosticRunProvenance;
|
|
40
|
+
/** Internal transport plumbing; deliberately not exported from the package index. */
|
|
41
|
+
export declare function getCompactDiagnosticRunOwner(provenance: VerifiedCompactDiagnosticRunProvenance): CompletedCompactMetricDiagnosticsRun;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=diagnosticCompactRun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnosticCompactRun.d.ts","sourceRoot":"","sources":["../src/diagnosticCompactRun.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAML,KAAK,oCAAoC,EAC1C,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,gCAAgC,EACtC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAU5B,0FAA0F;AAC1F,MAAM,MAAM,iCAAiC,GACzC,gCAAgC,GAChC,OAAO,CAAC,wBAAwB,EAAE;IAAE,SAAS,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAAC;AAExE,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,YAAY,EAAE,oCAAoC,CAAC;IAC5D,QAAQ,CAAC,cAAc,EAAE,SAAS,iCAAiC,EAAE,CAAC;IACtE,QAAQ,CAAC,oBAAoB,EAAE,SAAS,iCAAiC,EAAE,CAAC;IAC5E,QA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