@colophon-claims/verify 0.0.0 → 0.2.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/README.md +39 -0
- package/dist/admission/application.d.ts +18 -0
- package/dist/admission/application.js +53 -0
- package/dist/admission/contracts.d.ts +506 -0
- package/dist/admission/contracts.js +459 -0
- package/dist/admission/index.d.ts +5 -0
- package/dist/admission/index.js +5 -0
- package/dist/admission/intake.d.ts +75 -0
- package/dist/admission/intake.js +70 -0
- package/dist/admission/result-evaluation.d.ts +18 -0
- package/dist/admission/result-evaluation.js +71 -0
- package/dist/admission/screening-sample.d.ts +56 -0
- package/dist/admission/screening-sample.js +126 -0
- package/dist/admission/verification.d.ts +102 -0
- package/dist/admission/verification.js +844 -0
- package/dist/anchor/check.d.ts +95 -0
- package/dist/anchor/check.js +146 -0
- package/dist/anchor/ports.d.ts +6 -0
- package/dist/anchor/ports.js +354 -0
- package/dist/assets.d.ts +33 -0
- package/dist/assets.js +885 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +20 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +205 -0
- package/dist/comparison.d.ts +64 -0
- package/dist/comparison.js +235 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/manifest.d.ts +54 -0
- package/dist/manifest.js +240 -0
- package/dist/materialize.d.ts +4 -0
- package/dist/materialize.js +13 -0
- package/dist/profile/admission-receipts.d.ts +11 -0
- package/dist/profile/admission-receipts.js +24 -0
- package/dist/profile/anchor-claims.d.ts +157 -0
- package/dist/profile/anchor-claims.js +330 -0
- package/dist/profile/artifacts.d.ts +261 -0
- package/dist/profile/artifacts.js +139 -0
- package/dist/profile/assembly-ports.d.ts +19 -0
- package/dist/profile/assembly-ports.js +42 -0
- package/dist/profile/binary-judge-manifest.d.ts +121 -0
- package/dist/profile/binary-judge-manifest.js +106 -0
- package/dist/profile/binary-qualification.d.ts +9 -0
- package/dist/profile/binary-qualification.js +58 -0
- package/dist/profile/branding-assets.d.ts +5 -0
- package/dist/profile/branding-assets.js +5 -0
- package/dist/profile/branding.d.ts +24 -0
- package/dist/profile/branding.js +14 -0
- package/dist/profile/claim-consistency.d.ts +26 -0
- package/dist/profile/claim-consistency.js +91 -0
- package/dist/profile/claim.d.ts +327 -0
- package/dist/profile/claim.js +742 -0
- package/dist/profile/errors.d.ts +49 -0
- package/dist/profile/errors.js +78 -0
- package/dist/profile/inspect-assurance.d.ts +16 -0
- package/dist/profile/inspect-assurance.js +30 -0
- package/dist/profile/inspect-disclosure.d.ts +28 -0
- package/dist/profile/inspect-disclosure.js +54 -0
- package/dist/profile/inspect-manifest.d.ts +706 -0
- package/dist/profile/inspect-manifest.js +397 -0
- package/dist/profile/isolation.d.ts +21 -0
- package/dist/profile/isolation.js +31 -0
- package/dist/profile/pinning-evidence.d.ts +41 -0
- package/dist/profile/pinning-evidence.js +43 -0
- package/dist/profile/ports.d.ts +3 -0
- package/dist/profile/ports.js +11 -0
- package/dist/profile/preview-log.d.ts +4 -0
- package/dist/profile/preview-log.js +3 -0
- package/dist/profile/run-results.d.ts +17 -0
- package/dist/profile/run-results.js +23 -0
- package/dist/profile/signing.d.ts +10 -0
- package/dist/profile/signing.js +46 -0
- package/dist/profile/trust.d.ts +13 -0
- package/dist/profile/trust.js +35 -0
- package/dist/profile/venue.d.ts +2 -0
- package/dist/profile/venue.js +2 -0
- package/dist/profile/verdict.d.ts +28 -0
- package/dist/profile/verdict.js +51 -0
- package/dist/reader-instructions.d.ts +41 -0
- package/dist/reader-instructions.js +52 -0
- package/dist/schema.d.ts +380 -0
- package/dist/schema.js +498 -0
- package/dist/verify.d.ts +72 -0
- package/dist/verify.js +1573 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +63 -3
- package/schemas/assembly-row.schema.json +194 -0
- package/schemas/bundle-manifest.schema.json +23 -0
- package/schemas/claim-package.schema.json +279 -0
- package/schemas/dsse-envelope.schema.json +25 -0
- package/schemas/evidence-catalog.schema.json +43 -0
- package/schemas/public-trust.schema.json +44 -0
- package/schemas/verdict-catalog.schema.json +27 -0
- package/scripts/external-verify.py +238 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product's typed error posture (spec §4.3, assumption A8).
|
|
3
|
+
*
|
|
4
|
+
* Every operation returns either a typed result or a typed error — never a silent
|
|
5
|
+
* fallback, never free-text-only failure. Callers branch on `code` (and, where they
|
|
6
|
+
* care, on `issues[].path`), never on `message`: messages are prose and free to
|
|
7
|
+
* change; codes and paths are the contract.
|
|
8
|
+
*
|
|
9
|
+
* The v1 code set refines the spec §4.3 categories per A8 ("refined per operation
|
|
10
|
+
* in BP-10"):
|
|
11
|
+
*
|
|
12
|
+
* - `authority` is realized as `authority-denied` (the operations-boundary refusal).
|
|
13
|
+
* - `journal-integrity`, `not-found`, `conflict`, and `invalid-invocation` are BP-10
|
|
14
|
+
* refinements: a malformed audit journal, a missing subject, a workspace/draft
|
|
15
|
+
* collision, and a CLI-level invocation error are four different situations a
|
|
16
|
+
* machine caller must distinguish.
|
|
17
|
+
* - `venue-unavailable`, `venue-unverifiable`, and `execution` are reserved here so
|
|
18
|
+
* later packets (venue selection, launch) extend the taxonomy without a breaking
|
|
19
|
+
* change; BP-10 raises `execution` only as the carrier for untyped throws.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PRODUCT_ERROR_CODES: readonly ["validation", "illegal-transition", "authority-denied", "record-integrity", "journal-integrity", "not-found", "conflict", "invalid-invocation", "venue-unavailable", "venue-unverifiable", "execution"];
|
|
22
|
+
export type ProductErrorCode = (typeof PRODUCT_ERROR_CODES)[number];
|
|
23
|
+
export interface ProductIssue {
|
|
24
|
+
readonly path: string;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The machine-readable error envelope (spec §4.3): the same shape on the library
|
|
29
|
+
* surface and inside the CLI's `--json` output.
|
|
30
|
+
*/
|
|
31
|
+
export interface ProductErrorEnvelope {
|
|
32
|
+
readonly code: ProductErrorCode;
|
|
33
|
+
readonly detail: string;
|
|
34
|
+
readonly issues?: readonly ProductIssue[];
|
|
35
|
+
}
|
|
36
|
+
export declare class BenchmarkProductError extends Error {
|
|
37
|
+
readonly code: ProductErrorCode;
|
|
38
|
+
readonly issues: readonly ProductIssue[];
|
|
39
|
+
constructor(code: ProductErrorCode, message: string, issues?: readonly ProductIssue[]);
|
|
40
|
+
}
|
|
41
|
+
/** Throws a typed error carrying a single issue. */
|
|
42
|
+
export declare function refuse(code: ProductErrorCode, path: string, message: string): never;
|
|
43
|
+
/** Throws a typed error carrying every issue; the first issue's message leads. */
|
|
44
|
+
export declare function refuseWithIssues(code: ProductErrorCode, issues: readonly ProductIssue[]): never;
|
|
45
|
+
/**
|
|
46
|
+
* Adapts any thrown value to the machine-readable envelope. A typed error keeps its
|
|
47
|
+
* code and issues; anything else is carried as `execution` — visible, never swallowed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function toErrorEnvelope(cause: unknown): ProductErrorEnvelope;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product's typed error posture (spec §4.3, assumption A8).
|
|
3
|
+
*
|
|
4
|
+
* Every operation returns either a typed result or a typed error — never a silent
|
|
5
|
+
* fallback, never free-text-only failure. Callers branch on `code` (and, where they
|
|
6
|
+
* care, on `issues[].path`), never on `message`: messages are prose and free to
|
|
7
|
+
* change; codes and paths are the contract.
|
|
8
|
+
*
|
|
9
|
+
* The v1 code set refines the spec §4.3 categories per A8 ("refined per operation
|
|
10
|
+
* in BP-10"):
|
|
11
|
+
*
|
|
12
|
+
* - `authority` is realized as `authority-denied` (the operations-boundary refusal).
|
|
13
|
+
* - `journal-integrity`, `not-found`, `conflict`, and `invalid-invocation` are BP-10
|
|
14
|
+
* refinements: a malformed audit journal, a missing subject, a workspace/draft
|
|
15
|
+
* collision, and a CLI-level invocation error are four different situations a
|
|
16
|
+
* machine caller must distinguish.
|
|
17
|
+
* - `venue-unavailable`, `venue-unverifiable`, and `execution` are reserved here so
|
|
18
|
+
* later packets (venue selection, launch) extend the taxonomy without a breaking
|
|
19
|
+
* change; BP-10 raises `execution` only as the carrier for untyped throws.
|
|
20
|
+
*/
|
|
21
|
+
export const PRODUCT_ERROR_CODES = [
|
|
22
|
+
/** Draft or document content invalid (schema issues carried in `issues`). */
|
|
23
|
+
"validation",
|
|
24
|
+
/** The operation is not valid in the subject's current lifecycle state. */
|
|
25
|
+
"illegal-transition",
|
|
26
|
+
/** The acting principal is not a workspace member or lacks the required grant. */
|
|
27
|
+
"authority-denied",
|
|
28
|
+
/** Stored sealed bytes fail their digest check on read. */
|
|
29
|
+
"record-integrity",
|
|
30
|
+
/** The audit journal on disk is not well-formed, ordered JSONL. */
|
|
31
|
+
"journal-integrity",
|
|
32
|
+
/** The named workspace, draft, or record does not exist. */
|
|
33
|
+
"not-found",
|
|
34
|
+
/** The write collides with existing state (workspace already initialized, draft id taken). */
|
|
35
|
+
"conflict",
|
|
36
|
+
/** CLI-level: unknown verb, unknown flag, or missing required flag. */
|
|
37
|
+
"invalid-invocation",
|
|
38
|
+
/** Reserved for later packets (spec §7.3): the selected venue is not available. */
|
|
39
|
+
"venue-unavailable",
|
|
40
|
+
/** Reserved for later packets (spec §7.3): a venue guarantee cannot be verified. */
|
|
41
|
+
"venue-unverifiable",
|
|
42
|
+
/** Backend-reported or untyped failure, carried through rather than swallowed. */
|
|
43
|
+
"execution",
|
|
44
|
+
];
|
|
45
|
+
export class BenchmarkProductError extends Error {
|
|
46
|
+
code;
|
|
47
|
+
issues;
|
|
48
|
+
constructor(code, message, issues = []) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.name = "BenchmarkProductError";
|
|
51
|
+
this.code = code;
|
|
52
|
+
this.issues = issues;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Throws a typed error carrying a single issue. */
|
|
56
|
+
export function refuse(code, path, message) {
|
|
57
|
+
throw new BenchmarkProductError(code, message, [{ path, message }]);
|
|
58
|
+
}
|
|
59
|
+
/** Throws a typed error carrying every issue; the first issue's message leads. */
|
|
60
|
+
export function refuseWithIssues(code, issues) {
|
|
61
|
+
const [first] = issues;
|
|
62
|
+
throw new BenchmarkProductError(code, first === undefined ? code : first.message, issues);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Adapts any thrown value to the machine-readable envelope. A typed error keeps its
|
|
66
|
+
* code and issues; anything else is carried as `execution` — visible, never swallowed.
|
|
67
|
+
*/
|
|
68
|
+
export function toErrorEnvelope(cause) {
|
|
69
|
+
if (cause instanceof BenchmarkProductError) {
|
|
70
|
+
return cause.issues.length > 0
|
|
71
|
+
? { code: cause.code, detail: cause.message, issues: cause.issues }
|
|
72
|
+
: { code: cause.code, detail: cause.message };
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
code: "execution",
|
|
76
|
+
detail: cause instanceof Error ? cause.message : String(cause),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InspectSelectionManifest } from "./inspect-manifest.js";
|
|
2
|
+
export interface InspectAssurance {
|
|
3
|
+
readonly independence?: string;
|
|
4
|
+
readonly minVerdicts?: number;
|
|
5
|
+
readonly distinctEvaluator?: boolean;
|
|
6
|
+
readonly verdictRule?: string;
|
|
7
|
+
}
|
|
8
|
+
export type InspectEvaluationStrategy = "embedded" | "separate-log-verification";
|
|
9
|
+
export declare const INSPECT_SEPARATE_ASSURANCE_LIMITATIONS: readonly ["Inspect scores came from scorers in the same task execution; official verdicts separately verified the sealed projection from the native log.", "Separate verifier processes and evaluator keys on this self-run venue do not establish a separate real-world party.", "Log verification is not independent rescoring and does not establish method diversity."];
|
|
10
|
+
export declare function deriveInspectEvaluationStrategy(assurance: Readonly<InspectAssurance> | undefined): InspectEvaluationStrategy;
|
|
11
|
+
export declare function inspectLogVerifierMethod(manifest: InspectSelectionManifest, selectionManifestSha256: string): {
|
|
12
|
+
readonly name: "benchmark-product-inspect-log-verifier";
|
|
13
|
+
readonly digest: {
|
|
14
|
+
readonly sha256: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { canonicalJsonBytes } from "@jinn-network/trust-core";
|
|
3
|
+
export const INSPECT_SEPARATE_ASSURANCE_LIMITATIONS = [
|
|
4
|
+
"Inspect scores came from scorers in the same task execution; official verdicts separately verified the sealed projection from the native log.",
|
|
5
|
+
"Separate verifier processes and evaluator keys on this self-run venue do not establish a separate real-world party.",
|
|
6
|
+
"Log verification is not independent rescoring and does not establish method diversity.",
|
|
7
|
+
];
|
|
8
|
+
export function deriveInspectEvaluationStrategy(assurance) {
|
|
9
|
+
return (assurance?.independence ?? "disclosed") === "disclosed"
|
|
10
|
+
&& (assurance?.minVerdicts ?? 1) === 1
|
|
11
|
+
&& (assurance?.distinctEvaluator ?? false) === false
|
|
12
|
+
&& (assurance?.verdictRule ?? "sole") === "sole"
|
|
13
|
+
? "embedded"
|
|
14
|
+
: "separate-log-verification";
|
|
15
|
+
}
|
|
16
|
+
export function inspectLogVerifierMethod(manifest, selectionManifestSha256) {
|
|
17
|
+
const method = {
|
|
18
|
+
schema: "jinn.network/benchmark-product/inspect-log-verifier-method/1",
|
|
19
|
+
selectionManifestSha256,
|
|
20
|
+
adapterVersion: manifest.runtime.adapterVersion,
|
|
21
|
+
workerSha256: manifest.runtime.workerSha256,
|
|
22
|
+
inspectVersion: manifest.runtime.inspectVersion,
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
name: "benchmark-product-inspect-log-verifier",
|
|
26
|
+
digest: {
|
|
27
|
+
sha256: createHash("sha256").update(canonicalJsonBytes(method)).digest("hex"),
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { VerdictRule } from "@jinn-network/task-execution-profiles";
|
|
2
|
+
import { INSPECT_ADAPTER_ID, type InspectSelectionManifest } from "./inspect-manifest.js";
|
|
3
|
+
import { type InspectAssurance } from "./inspect-assurance.js";
|
|
4
|
+
export interface InspectScoringProjectionDisclosure {
|
|
5
|
+
readonly measurementName: string;
|
|
6
|
+
readonly scorerName: string;
|
|
7
|
+
readonly subScoreKey?: string;
|
|
8
|
+
readonly passValue: string | number | boolean | null;
|
|
9
|
+
}
|
|
10
|
+
export interface InspectRuntimeMethodDisclosure {
|
|
11
|
+
readonly adapterId: typeof INSPECT_ADAPTER_ID;
|
|
12
|
+
readonly selectionManifestSha256: string;
|
|
13
|
+
readonly scorerNames: readonly string[];
|
|
14
|
+
readonly projections: readonly InspectScoringProjectionDisclosure[];
|
|
15
|
+
readonly verdictRule: VerdictRule;
|
|
16
|
+
readonly verdictRuleText: string;
|
|
17
|
+
readonly nativeAnalysis: {
|
|
18
|
+
readonly metrics: unknown;
|
|
19
|
+
readonly epochReducers: readonly string[] | null;
|
|
20
|
+
};
|
|
21
|
+
readonly evaluatorRelationship: "same-execution-scorer";
|
|
22
|
+
readonly scoreSourceRelationship: "same-execution-scorer";
|
|
23
|
+
readonly officialEvaluationRelationship: "same-execution-scorer" | "separate-log-verifier";
|
|
24
|
+
readonly officialEvaluatorCount: number;
|
|
25
|
+
readonly partyIndependence: "not-established";
|
|
26
|
+
}
|
|
27
|
+
/** Public method disclosure derived only from the authenticated Inspect selection. */
|
|
28
|
+
export declare function describeInspectRuntimeMethod(manifest: InspectSelectionManifest, selectionManifestSha256: string, assurance?: Readonly<InspectAssurance>): InspectRuntimeMethodDisclosure;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { INSPECT_ADAPTER_ID, isInspectMultiScorerSelection, } from "./inspect-manifest.js";
|
|
2
|
+
import { deriveInspectEvaluationStrategy } from "./inspect-assurance.js";
|
|
3
|
+
function ruleText(rule) {
|
|
4
|
+
if ("threshold" in rule) {
|
|
5
|
+
return `${rule.threshold.measurement} ${rule.threshold.op} ${JSON.stringify(rule.threshold.value)}`;
|
|
6
|
+
}
|
|
7
|
+
if ("all" in rule)
|
|
8
|
+
return `all(${rule.all.map(ruleText).join(", ")})`;
|
|
9
|
+
if ("any" in rule)
|
|
10
|
+
return `any(${rule.any.map(ruleText).join(", ")})`;
|
|
11
|
+
if ("not" in rule)
|
|
12
|
+
return `not(${ruleText(rule.not)})`;
|
|
13
|
+
if ("inconclusiveWhen" in rule) {
|
|
14
|
+
return `inconclusive[${rule.class}] when ${ruleText(rule.inconclusiveWhen)}`;
|
|
15
|
+
}
|
|
16
|
+
return "pass" in rule ? "pass" : "fail";
|
|
17
|
+
}
|
|
18
|
+
/** Public method disclosure derived only from the authenticated Inspect selection. */
|
|
19
|
+
export function describeInspectRuntimeMethod(manifest, selectionManifestSha256, assurance) {
|
|
20
|
+
const strategy = deriveInspectEvaluationStrategy(assurance);
|
|
21
|
+
const projections = isInspectMultiScorerSelection(manifest)
|
|
22
|
+
? manifest.scoring.projections
|
|
23
|
+
: [{
|
|
24
|
+
measurementName: "inspect-score-pass",
|
|
25
|
+
scorerName: manifest.scorer.name,
|
|
26
|
+
passValue: manifest.scorer.passValue,
|
|
27
|
+
}];
|
|
28
|
+
const verdictRule = isInspectMultiScorerSelection(manifest)
|
|
29
|
+
? manifest.scoring.verdictRule
|
|
30
|
+
: { threshold: { measurement: "inspect-score-pass", op: "eq", value: true } };
|
|
31
|
+
return {
|
|
32
|
+
adapterId: INSPECT_ADAPTER_ID,
|
|
33
|
+
selectionManifestSha256,
|
|
34
|
+
scorerNames: isInspectMultiScorerSelection(manifest)
|
|
35
|
+
? manifest.scorers.map((scorer) => scorer.name)
|
|
36
|
+
: [manifest.scorer.name],
|
|
37
|
+
projections,
|
|
38
|
+
verdictRule,
|
|
39
|
+
verdictRuleText: ruleText(verdictRule),
|
|
40
|
+
nativeAnalysis: isInspectMultiScorerSelection(manifest)
|
|
41
|
+
? {
|
|
42
|
+
metrics: manifest.scoring.inspectMetrics,
|
|
43
|
+
epochReducers: manifest.scoring.inspectEpochReducers,
|
|
44
|
+
}
|
|
45
|
+
: { metrics: null, epochReducers: null },
|
|
46
|
+
evaluatorRelationship: "same-execution-scorer",
|
|
47
|
+
scoreSourceRelationship: "same-execution-scorer",
|
|
48
|
+
officialEvaluationRelationship: strategy === "embedded"
|
|
49
|
+
? "same-execution-scorer"
|
|
50
|
+
: "separate-log-verifier",
|
|
51
|
+
officialEvaluatorCount: assurance?.minVerdicts ?? 1,
|
|
52
|
+
partyIndependence: "not-established",
|
|
53
|
+
};
|
|
54
|
+
}
|