@gate-forge/core 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 +202 -0
- package/dist/baselines/adoption.d.ts +76 -0
- package/dist/baselines/adoption.d.ts.map +1 -0
- package/dist/baselines/adoption.js +163 -0
- package/dist/baselines/adoption.js.map +1 -0
- package/dist/baselines/index.d.ts +102 -0
- package/dist/baselines/index.d.ts.map +1 -0
- package/dist/baselines/index.js +186 -0
- package/dist/baselines/index.js.map +1 -0
- package/dist/canonical-json.d.ts +51 -0
- package/dist/canonical-json.d.ts.map +1 -0
- package/dist/canonical-json.js +112 -0
- package/dist/canonical-json.js.map +1 -0
- package/dist/classifier/bind.d.ts +64 -0
- package/dist/classifier/bind.d.ts.map +1 -0
- package/dist/classifier/bind.js +188 -0
- package/dist/classifier/bind.js.map +1 -0
- package/dist/classifier/classify.d.ts +154 -0
- package/dist/classifier/classify.d.ts.map +1 -0
- package/dist/classifier/classify.js +1207 -0
- package/dist/classifier/classify.js.map +1 -0
- package/dist/classifier/glob.d.ts +48 -0
- package/dist/classifier/glob.d.ts.map +1 -0
- package/dist/classifier/glob.js +104 -0
- package/dist/classifier/glob.js.map +1 -0
- package/dist/classifier/index.d.ts +10 -0
- package/dist/classifier/index.d.ts.map +1 -0
- package/dist/classifier/index.js +21 -0
- package/dist/classifier/index.js.map +1 -0
- package/dist/classifier/schema.d.ts +150 -0
- package/dist/classifier/schema.d.ts.map +1 -0
- package/dist/classifier/schema.js +139 -0
- package/dist/classifier/schema.js.map +1 -0
- package/dist/config/index.d.ts +259 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +523 -0
- package/dist/config/index.js.map +1 -0
- package/dist/fingerprints.d.ts +56 -0
- package/dist/fingerprints.d.ts.map +1 -0
- package/dist/fingerprints.js +59 -0
- package/dist/fingerprints.js.map +1 -0
- package/dist/graph/build.d.ts +16 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +423 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/index.d.ts +12 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +10 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/schema.d.ts +448 -0
- package/dist/graph/schema.d.ts.map +1 -0
- package/dist/graph/schema.js +237 -0
- package/dist/graph/schema.js.map +1 -0
- package/dist/graph/symbols.d.ts +129 -0
- package/dist/graph/symbols.d.ts.map +1 -0
- package/dist/graph/symbols.js +177 -0
- package/dist/graph/symbols.js.map +1 -0
- package/dist/graph/util.d.ts +40 -0
- package/dist/graph/util.d.ts.map +1 -0
- package/dist/graph/util.js +41 -0
- package/dist/graph/util.js.map +1 -0
- package/dist/index.d.ts +683 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +563 -0
- package/dist/index.js.map +1 -0
- package/dist/mapping/resolve.d.ts +177 -0
- package/dist/mapping/resolve.d.ts.map +1 -0
- package/dist/mapping/resolve.js +523 -0
- package/dist/mapping/resolve.js.map +1 -0
- package/dist/policy/coverage.d.ts +79 -0
- package/dist/policy/coverage.d.ts.map +1 -0
- package/dist/policy/coverage.js +119 -0
- package/dist/policy/coverage.js.map +1 -0
- package/dist/policy/evaluate.d.ts +275 -0
- package/dist/policy/evaluate.d.ts.map +1 -0
- package/dist/policy/evaluate.js +382 -0
- package/dist/policy/evaluate.js.map +1 -0
- package/dist/policy/index.d.ts +15 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +14 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/trusted.d.ts +59 -0
- package/dist/policy/trusted.d.ts.map +1 -0
- package/dist/policy/trusted.js +96 -0
- package/dist/policy/trusted.js.map +1 -0
- package/dist/provenance.d.ts +170 -0
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +306 -0
- package/dist/provenance.js.map +1 -0
- package/dist/receipt/index.d.ts +74 -0
- package/dist/receipt/index.d.ts.map +1 -0
- package/dist/receipt/index.js +154 -0
- package/dist/receipt/index.js.map +1 -0
- package/dist/report/index.d.ts +100 -0
- package/dist/report/index.d.ts.map +1 -0
- package/dist/report/index.js +355 -0
- package/dist/report/index.js.map +1 -0
- package/dist/schemas/adoption.d.ts +40 -0
- package/dist/schemas/adoption.d.ts.map +1 -0
- package/dist/schemas/adoption.js +87 -0
- package/dist/schemas/adoption.js.map +1 -0
- package/dist/schemas/baseline.d.ts +19 -0
- package/dist/schemas/baseline.d.ts.map +1 -0
- package/dist/schemas/baseline.js +45 -0
- package/dist/schemas/baseline.js.map +1 -0
- package/dist/schemas/claim.d.ts +32 -0
- package/dist/schemas/claim.d.ts.map +1 -0
- package/dist/schemas/claim.js +34 -0
- package/dist/schemas/claim.js.map +1 -0
- package/dist/schemas/classification-policy.d.ts +84 -0
- package/dist/schemas/classification-policy.d.ts.map +1 -0
- package/dist/schemas/classification-policy.js +130 -0
- package/dist/schemas/classification-policy.js.map +1 -0
- package/dist/schemas/classification-signal.d.ts +125 -0
- package/dist/schemas/classification-signal.d.ts.map +1 -0
- package/dist/schemas/classification-signal.js +126 -0
- package/dist/schemas/classification-signal.js.map +1 -0
- package/dist/schemas/classification.d.ts +120 -0
- package/dist/schemas/classification.d.ts.map +1 -0
- package/dist/schemas/classification.js +154 -0
- package/dist/schemas/classification.js.map +1 -0
- package/dist/schemas/common.d.ts +73 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +60 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/coverage-policy.d.ts +89 -0
- package/dist/schemas/coverage-policy.d.ts.map +1 -0
- package/dist/schemas/coverage-policy.js +81 -0
- package/dist/schemas/coverage-policy.js.map +1 -0
- package/dist/schemas/evidence.d.ts +65 -0
- package/dist/schemas/evidence.d.ts.map +1 -0
- package/dist/schemas/evidence.js +64 -0
- package/dist/schemas/evidence.js.map +1 -0
- package/dist/schemas/execution-result.d.ts +214 -0
- package/dist/schemas/execution-result.d.ts.map +1 -0
- package/dist/schemas/execution-result.js +240 -0
- package/dist/schemas/execution-result.js.map +1 -0
- package/dist/schemas/gate-receipt.d.ts +86 -0
- package/dist/schemas/gate-receipt.d.ts.map +1 -0
- package/dist/schemas/gate-receipt.js +193 -0
- package/dist/schemas/gate-receipt.js.map +1 -0
- package/dist/schemas/index.d.ts +22 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +22 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/obligation.d.ts +37 -0
- package/dist/schemas/obligation.d.ts.map +1 -0
- package/dist/schemas/obligation.js +46 -0
- package/dist/schemas/obligation.js.map +1 -0
- package/dist/schemas/plugin.d.ts +19 -0
- package/dist/schemas/plugin.d.ts.map +1 -0
- package/dist/schemas/plugin.js +20 -0
- package/dist/schemas/plugin.js.map +1 -0
- package/dist/schemas/policy.d.ts +73 -0
- package/dist/schemas/policy.d.ts.map +1 -0
- package/dist/schemas/policy.js +46 -0
- package/dist/schemas/policy.js.map +1 -0
- package/dist/schemas/resource.d.ts +26 -0
- package/dist/schemas/resource.d.ts.map +1 -0
- package/dist/schemas/resource.js +29 -0
- package/dist/schemas/resource.js.map +1 -0
- package/dist/schemas/run-manifest.d.ts +72 -0
- package/dist/schemas/run-manifest.d.ts.map +1 -0
- package/dist/schemas/run-manifest.js +125 -0
- package/dist/schemas/run-manifest.js.map +1 -0
- package/dist/schemas/runner-adapter.d.ts +169 -0
- package/dist/schemas/runner-adapter.d.ts.map +1 -0
- package/dist/schemas/runner-adapter.js +2 -0
- package/dist/schemas/runner-adapter.js.map +1 -0
- package/dist/schemas/test-catalog.d.ts +472 -0
- package/dist/schemas/test-catalog.d.ts.map +1 -0
- package/dist/schemas/test-catalog.js +311 -0
- package/dist/schemas/test-catalog.js.map +1 -0
- package/dist/schemas/test-map.d.ts +99 -0
- package/dist/schemas/test-map.d.ts.map +1 -0
- package/dist/schemas/test-map.js +103 -0
- package/dist/schemas/test-map.js.map +1 -0
- package/dist/schemas/verdict.d.ts +73 -0
- package/dist/schemas/verdict.d.ts.map +1 -0
- package/dist/schemas/verdict.js +92 -0
- package/dist/schemas/verdict.js.map +1 -0
- package/dist/schemas/waiver.d.ts +36 -0
- package/dist/schemas/waiver.d.ts.map +1 -0
- package/dist/schemas/waiver.js +42 -0
- package/dist/schemas/waiver.js.map +1 -0
- package/dist/supervision/index.d.ts +170 -0
- package/dist/supervision/index.d.ts.map +1 -0
- package/dist/supervision/index.js +354 -0
- package/dist/supervision/index.js.map +1 -0
- package/dist/testing/clock.d.ts +50 -0
- package/dist/testing/clock.d.ts.map +1 -0
- package/dist/testing/clock.js +75 -0
- package/dist/testing/clock.js.map +1 -0
- package/dist/testing/env.d.ts +66 -0
- package/dist/testing/env.d.ts.map +1 -0
- package/dist/testing/env.js +106 -0
- package/dist/testing/env.js.map +1 -0
- package/dist/testing/gate-runner.d.ts +141 -0
- package/dist/testing/gate-runner.d.ts.map +1 -0
- package/dist/testing/gate-runner.js +173 -0
- package/dist/testing/gate-runner.js.map +1 -0
- package/dist/testing/gf19.d.ts +106 -0
- package/dist/testing/gf19.d.ts.map +1 -0
- package/dist/testing/gf19.js +282 -0
- package/dist/testing/gf19.js.map +1 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/red-probe.d.ts +138 -0
- package/dist/testing/red-probe.d.ts.map +1 -0
- package/dist/testing/red-probe.js +251 -0
- package/dist/testing/red-probe.js.map +1 -0
- package/dist/testing/temp-repo.d.ts +126 -0
- package/dist/testing/temp-repo.d.ts.map +1 -0
- package/dist/testing/temp-repo.js +214 -0
- package/dist/testing/temp-repo.js.map +1 -0
- package/dist/verdict/cause.d.ts +99 -0
- package/dist/verdict/cause.d.ts.map +1 -0
- package/dist/verdict/cause.js +206 -0
- package/dist/verdict/cause.js.map +1 -0
- package/dist/verdict/evaluate.d.ts +135 -0
- package/dist/verdict/evaluate.d.ts.map +1 -0
- package/dist/verdict/evaluate.js +1513 -0
- package/dist/verdict/evaluate.js.map +1 -0
- package/dist/verdict/index.d.ts +21 -0
- package/dist/verdict/index.d.ts.map +1 -0
- package/dist/verdict/index.js +20 -0
- package/dist/verdict/index.js.map +1 -0
- package/dist/verdict/pack-verifiers.d.ts +97 -0
- package/dist/verdict/pack-verifiers.d.ts.map +1 -0
- package/dist/verdict/pack-verifiers.js +763 -0
- package/dist/verdict/pack-verifiers.js.map +1 -0
- package/dist/verdict/registry.d.ts +180 -0
- package/dist/verdict/registry.d.ts.map +1 -0
- package/dist/verdict/registry.js +67 -0
- package/dist/verdict/registry.js.map +1 -0
- package/dist/waivers/index.d.ts +103 -0
- package/dist/waivers/index.d.ts.map +1 -0
- package/dist/waivers/index.js +192 -0
- package/dist/waivers/index.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type CauseCode } from '../schemas/verdict.js';
|
|
2
|
+
/** Cause plus its plan §5.4 next action, attached to a report entry. */
|
|
3
|
+
export interface VerdictCause {
|
|
4
|
+
/** Stable cause code, or null when Phase 0 has no honest mapping. */
|
|
5
|
+
cause: CauseCode | null;
|
|
6
|
+
/** Human next action for the cause, or null when unmapped. */
|
|
7
|
+
nextAction: string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps one blocking verdict to its cause and next action (plan §5.4).
|
|
11
|
+
* Deterministic and pure: identical inputs produce identical output.
|
|
12
|
+
*
|
|
13
|
+
* Mapping (Phase 0, extended in Phase 1):
|
|
14
|
+
* - clean verdicts (`satisfied`, `waived`) → null cause;
|
|
15
|
+
* - no capability record for the contract's namespace →
|
|
16
|
+
* VERIFIER_UNSUPPORTED (nothing is registered to prove it with);
|
|
17
|
+
* - a registered namespace that does not implement the contract (e.g.
|
|
18
|
+
* `http:frontend-request-observed`, unknown `crud:*`/`http:*` names)
|
|
19
|
+
* or an unavailable namespace (the five domain namespaces) →
|
|
20
|
+
* VERIFIER_UNSUPPORTED;
|
|
21
|
+
* - a supported contract whose reason reports the §3.6 exact-value echo
|
|
22
|
+
* violation → EVIDENCE_VALUE_MISMATCH;
|
|
23
|
+
* - a crud claim whose session exchange cannot be attributed because the
|
|
24
|
+
* host supplied no route inventory → VERIFIER_UNSUPPORTED (the setup
|
|
25
|
+
* lacks the derived inventory the proof channel needs);
|
|
26
|
+
* - a supported contract whose reason reports absent required
|
|
27
|
+
* observations (including the crud session-channel rules: direct
|
|
28
|
+
* mutation outside the session channel, no visible result, no
|
|
29
|
+
* session-bound anchor) → EVIDENCE_NOT_COLLECTED;
|
|
30
|
+
* - `no claim declares '<id>'` → TEST_MAPPING_MISSING (no existing test
|
|
31
|
+
* is connected to the obligation; the Phase 2-3 mapping subsystem
|
|
32
|
+
* refines this into catalog-backed causes);
|
|
33
|
+
* - anything else → null (precise single-cause reason; no guessed code).
|
|
34
|
+
*
|
|
35
|
+
* Args:
|
|
36
|
+
* params: obligationId, contract, verdict value, and engine reason of
|
|
37
|
+
* the report entry being rendered.
|
|
38
|
+
*
|
|
39
|
+
* Returns:
|
|
40
|
+
* VerdictCause: `{cause, nextAction}` — cause/nextAction are null when
|
|
41
|
+
* the verdict is clean or no honest mapping exists yet.
|
|
42
|
+
*/
|
|
43
|
+
export declare function causeForVerdict(params: {
|
|
44
|
+
obligationId: string;
|
|
45
|
+
contract: string;
|
|
46
|
+
verdict: string;
|
|
47
|
+
reason: string | null;
|
|
48
|
+
}): VerdictCause;
|
|
49
|
+
/**
|
|
50
|
+
* One precise capability gap (plan Phase 0 item 4, ADR 0005 D1/D5): a
|
|
51
|
+
* required contract whose proof channel is unavailable. `detail` names
|
|
52
|
+
* the contract, the missing observer, and the fail-closed consequence;
|
|
53
|
+
* `nextAction` is always the plan §5.4 `VERIFIER_UNSUPPORTED` action.
|
|
54
|
+
*/
|
|
55
|
+
export interface CapabilityGap {
|
|
56
|
+
/** The unsupported contract name. */
|
|
57
|
+
contract: string;
|
|
58
|
+
/** The independent observer channel whose absence blocks this contract. */
|
|
59
|
+
observer: string;
|
|
60
|
+
/** Single-cause precise explanation (fail-closed wording). */
|
|
61
|
+
detail: string;
|
|
62
|
+
/** Always `VERIFIER_UNSUPPORTED` (plan §5.4). */
|
|
63
|
+
cause: Extract<CauseCode, 'VERIFIER_UNSUPPORTED'>;
|
|
64
|
+
/** Plan §5.4 next action for an unsupported proof channel. */
|
|
65
|
+
nextAction: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Computes the capability gap for one contract, or null when the
|
|
69
|
+
* contract's namespace is registered, available, and implements the
|
|
70
|
+
* contract. Pure; reads only the capability registry (single source of
|
|
71
|
+
* truth — no duplicated contract lists at call sites).
|
|
72
|
+
*
|
|
73
|
+
* Args:
|
|
74
|
+
* contract: the required contract name, e.g. `http:request-observed`.
|
|
75
|
+
*
|
|
76
|
+
* Returns:
|
|
77
|
+
* CapabilityGap | null: the gap, or null when the contract is provable.
|
|
78
|
+
*/
|
|
79
|
+
export declare function capabilityGap(contract: string): CapabilityGap | null;
|
|
80
|
+
/**
|
|
81
|
+
* Preflight for strict setups (plan Phase 0 item 4): returns one gap per
|
|
82
|
+
* obligation whose contract cannot be proven. A strict setup demanding an
|
|
83
|
+
* unavailable contract must fail closed with these precise errors — it
|
|
84
|
+
* cannot advertise an operational blocking E2E gate.
|
|
85
|
+
*
|
|
86
|
+
* Args:
|
|
87
|
+
* obligations: the obligations to preflight (`id` + `contract`).
|
|
88
|
+
*
|
|
89
|
+
* Returns:
|
|
90
|
+
* Array<CapabilityGap & {obligationId: string}>: one entry per
|
|
91
|
+
* unsupported obligation, sorted by obligation id (deterministic).
|
|
92
|
+
*/
|
|
93
|
+
export declare function strictCapabilityGaps(obligations: readonly {
|
|
94
|
+
id: string;
|
|
95
|
+
contract: string;
|
|
96
|
+
}[]): Array<CapabilityGap & {
|
|
97
|
+
obligationId: string;
|
|
98
|
+
}>;
|
|
99
|
+
//# sourceMappingURL=cause.d.ts.map
|
|
@@ -0,0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**
|
|
2
|
+
* Cause mapping for the shared report model (plan 2026-09-13 §5.4, ADR
|
|
3
|
+
* 0005): derives a stable cause code plus its next action from a
|
|
4
|
+
* blocking verdict's contract and reason. Mapped today: unsupported
|
|
5
|
+
* proof channels (VERIFIER_UNSUPPORTED — including a crud claim whose
|
|
6
|
+
* session exchange cannot be attributed for lack of a route inventory),
|
|
7
|
+
* a connected test whose required observations are absent
|
|
8
|
+
* (EVIDENCE_NOT_COLLECTED — including the crud session-channel rules:
|
|
9
|
+
* direct mutation outside the supervised channel, no visible result, no
|
|
10
|
+
* session-bound anchor), an obligation no test is connected to
|
|
11
|
+
* (TEST_MAPPING_MISSING), and the §3.6 exact-value echo violation
|
|
12
|
+
* (EVIDENCE_VALUE_MISMATCH). Remaining causes are populated by the
|
|
13
|
+
* phases that build their subsystems (catalog/mapping: Phase 2-3;
|
|
14
|
+
* execution results: Phase 4); an unmapped blocking verdict carries a
|
|
15
|
+
* null cause rather than a guess.
|
|
16
|
+
*
|
|
17
|
+
* The mapping matches the verifier reasons verbatim — those strings are
|
|
18
|
+
* engine-owned (single grading sites, kept in lockstep by tests), never
|
|
19
|
+
* adversary-controlled input.
|
|
20
|
+
*/
|
|
21
|
+
import { capabilityFor } from './registry.js';
|
|
22
|
+
import { CAUSE_NEXT_ACTIONS } from '../schemas/verdict.js';
|
|
23
|
+
/** Verdicts that never carry a cause: clean runs have nothing to explain. */
|
|
24
|
+
const CLEAN_VERDICTS = new Set(['satisfied', 'waived']);
|
|
25
|
+
/**
|
|
26
|
+
* Evidence-absence reasons produced by the built-in verifiers for a
|
|
27
|
+
* CONNECTED test (a claim exists) whose required observations are
|
|
28
|
+
* missing — the plan §5.4 `EVIDENCE_NOT_COLLECTED` shape ("a mapped test
|
|
29
|
+
* lacks required observations"). Matched verbatim; each is emitted from
|
|
30
|
+
* exactly one grading site. The last two are the crud session-channel
|
|
31
|
+
* rules (plan Phase 1 item 8): a mutation performed outside the
|
|
32
|
+
* supervised session channel (direct API/Node-side) and a journey that
|
|
33
|
+
* never read the rendered result back.
|
|
34
|
+
*/
|
|
35
|
+
const EVIDENCE_NOT_COLLECTED_PATTERNS = [
|
|
36
|
+
'produced no evidence records',
|
|
37
|
+
"no 'ui.action' anchor from the declaring test",
|
|
38
|
+
'the witness observed no matching HTTP exchange',
|
|
39
|
+
"no witnessed session-bound 'http.request' exchange",
|
|
40
|
+
'no witnessed visible-result record',
|
|
41
|
+
"no session-bound 'ui.action' anchor from the declaring test",
|
|
42
|
+
"carries no witness session binding",
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* The plan §5.4 exact-value echo violation (plan §3.6, implemented in
|
|
46
|
+
* Phase 1): the persisted state does not echo the journey's entered
|
|
47
|
+
* input on the same entity. Matched verbatim from the single grading
|
|
48
|
+
* site in the persistence verifier (reused verbatim by the crud
|
|
49
|
+
* session-channel verifier).
|
|
50
|
+
*/
|
|
51
|
+
const EVIDENCE_VALUE_MISMATCH_PATTERN = 'exact-value echo violation (EVIDENCE_VALUE_MISMATCH)';
|
|
52
|
+
/**
|
|
53
|
+
* A crud session exchange that cannot be attributed because the host
|
|
54
|
+
* supplied no route inventory (plan §9, D2): the proof channel the
|
|
55
|
+
* contract needs is not wired into this setup. Scoped to the crud
|
|
56
|
+
* namespace's wording so the http transport grader's own inventory
|
|
57
|
+
* reason keeps its existing (unmapped) cause.
|
|
58
|
+
*/
|
|
59
|
+
const CRUD_INVENTORY_UNSUPPORTED_PATTERN = "no route inventory context for 'crud:";
|
|
60
|
+
/**
|
|
61
|
+
* Maps one blocking verdict to its cause and next action (plan §5.4).
|
|
62
|
+
* Deterministic and pure: identical inputs produce identical output.
|
|
63
|
+
*
|
|
64
|
+
* Mapping (Phase 0, extended in Phase 1):
|
|
65
|
+
* - clean verdicts (`satisfied`, `waived`) → null cause;
|
|
66
|
+
* - no capability record for the contract's namespace →
|
|
67
|
+
* VERIFIER_UNSUPPORTED (nothing is registered to prove it with);
|
|
68
|
+
* - a registered namespace that does not implement the contract (e.g.
|
|
69
|
+
* `http:frontend-request-observed`, unknown `crud:*`/`http:*` names)
|
|
70
|
+
* or an unavailable namespace (the five domain namespaces) →
|
|
71
|
+
* VERIFIER_UNSUPPORTED;
|
|
72
|
+
* - a supported contract whose reason reports the §3.6 exact-value echo
|
|
73
|
+
* violation → EVIDENCE_VALUE_MISMATCH;
|
|
74
|
+
* - a crud claim whose session exchange cannot be attributed because the
|
|
75
|
+
* host supplied no route inventory → VERIFIER_UNSUPPORTED (the setup
|
|
76
|
+
* lacks the derived inventory the proof channel needs);
|
|
77
|
+
* - a supported contract whose reason reports absent required
|
|
78
|
+
* observations (including the crud session-channel rules: direct
|
|
79
|
+
* mutation outside the session channel, no visible result, no
|
|
80
|
+
* session-bound anchor) → EVIDENCE_NOT_COLLECTED;
|
|
81
|
+
* - `no claim declares '<id>'` → TEST_MAPPING_MISSING (no existing test
|
|
82
|
+
* is connected to the obligation; the Phase 2-3 mapping subsystem
|
|
83
|
+
* refines this into catalog-backed causes);
|
|
84
|
+
* - anything else → null (precise single-cause reason; no guessed code).
|
|
85
|
+
*
|
|
86
|
+
* Args:
|
|
87
|
+
* params: obligationId, contract, verdict value, and engine reason of
|
|
88
|
+
* the report entry being rendered.
|
|
89
|
+
*
|
|
90
|
+
* Returns:
|
|
91
|
+
* VerdictCause: `{cause, nextAction}` — cause/nextAction are null when
|
|
92
|
+
* the verdict is clean or no honest mapping exists yet.
|
|
93
|
+
*/
|
|
94
|
+
export function causeForVerdict(params) {
|
|
95
|
+
if (CLEAN_VERDICTS.has(params.verdict))
|
|
96
|
+
return { cause: null, nextAction: null };
|
|
97
|
+
const capability = capabilityFor(params.contract);
|
|
98
|
+
const implemented = capability?.contracts.includes(params.contract) ?? false;
|
|
99
|
+
if (capability === null || capability.availability.status === 'unavailable' || !implemented) {
|
|
100
|
+
return nextActionFor('VERIFIER_UNSUPPORTED');
|
|
101
|
+
}
|
|
102
|
+
const reason = params.reason ?? '';
|
|
103
|
+
if (reason.includes(EVIDENCE_VALUE_MISMATCH_PATTERN)) {
|
|
104
|
+
return nextActionFor('EVIDENCE_VALUE_MISMATCH');
|
|
105
|
+
}
|
|
106
|
+
if (reason.includes(CRUD_INVENTORY_UNSUPPORTED_PATTERN)) {
|
|
107
|
+
return nextActionFor('VERIFIER_UNSUPPORTED');
|
|
108
|
+
}
|
|
109
|
+
if (EVIDENCE_NOT_COLLECTED_PATTERNS.some((pattern) => reason.includes(pattern))) {
|
|
110
|
+
return nextActionFor('EVIDENCE_NOT_COLLECTED');
|
|
111
|
+
}
|
|
112
|
+
if (reason === `no claim declares '${params.obligationId}'`) {
|
|
113
|
+
return nextActionFor('TEST_MAPPING_MISSING');
|
|
114
|
+
}
|
|
115
|
+
return { cause: null, nextAction: null };
|
|
116
|
+
}
|
|
117
|
+
/** Pairs a cause with its frozen plan §5.4 next action. */
|
|
118
|
+
function nextActionFor(cause) {
|
|
119
|
+
return { cause, nextAction: CAUSE_NEXT_ACTIONS[cause] };
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Computes the capability gap for one contract, or null when the
|
|
123
|
+
* contract's namespace is registered, available, and implements the
|
|
124
|
+
* contract. Pure; reads only the capability registry (single source of
|
|
125
|
+
* truth — no duplicated contract lists at call sites).
|
|
126
|
+
*
|
|
127
|
+
* Args:
|
|
128
|
+
* contract: the required contract name, e.g. `http:request-observed`.
|
|
129
|
+
*
|
|
130
|
+
* Returns:
|
|
131
|
+
* CapabilityGap | null: the gap, or null when the contract is provable.
|
|
132
|
+
*/
|
|
133
|
+
export function capabilityGap(contract) {
|
|
134
|
+
const capability = capabilityFor(contract);
|
|
135
|
+
if (capability === null) {
|
|
136
|
+
return {
|
|
137
|
+
contract,
|
|
138
|
+
observer: 'a registered semantic verifier and its independent observation channel',
|
|
139
|
+
detail: `contract '${contract}' has no registered verifier or capability record: no honest ` +
|
|
140
|
+
'proof channel exists, so obligations requiring it can never be satisfied',
|
|
141
|
+
cause: 'VERIFIER_UNSUPPORTED',
|
|
142
|
+
nextAction: CAUSE_NEXT_ACTIONS['VERIFIER_UNSUPPORTED'],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (capability.availability.status === 'unavailable') {
|
|
146
|
+
return {
|
|
147
|
+
contract,
|
|
148
|
+
observer: capability.observer,
|
|
149
|
+
detail: `contract '${contract}' is unprovable: its namespace '${capability.namespace}' is ` +
|
|
150
|
+
`fail-closed (${capability.availability.reason}). Required observer: ${capability.observer}.`,
|
|
151
|
+
cause: 'VERIFIER_UNSUPPORTED',
|
|
152
|
+
nextAction: CAUSE_NEXT_ACTIONS['VERIFIER_UNSUPPORTED'],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const unavailable = capability.unavailableContracts.find((entry) => entry.contract === contract);
|
|
156
|
+
if (unavailable !== undefined) {
|
|
157
|
+
return {
|
|
158
|
+
contract,
|
|
159
|
+
observer: capability.observer,
|
|
160
|
+
detail: `contract '${contract}' is registered but unavailable: ${unavailable.reason}. ` +
|
|
161
|
+
`Required observer: ${capability.observer}.`,
|
|
162
|
+
cause: 'VERIFIER_UNSUPPORTED',
|
|
163
|
+
nextAction: CAUSE_NEXT_ACTIONS['VERIFIER_UNSUPPORTED'],
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
if (!capability.contracts.includes(contract)) {
|
|
167
|
+
return {
|
|
168
|
+
contract,
|
|
169
|
+
observer: capability.observer,
|
|
170
|
+
detail: `contract '${contract}' is not implemented by its namespace '${capability.namespace}': ` +
|
|
171
|
+
`the namespace implements [${capability.contracts.join(', ')}]. No honest proof ` +
|
|
172
|
+
'channel exists for this name',
|
|
173
|
+
cause: 'VERIFIER_UNSUPPORTED',
|
|
174
|
+
nextAction: CAUSE_NEXT_ACTIONS['VERIFIER_UNSUPPORTED'],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Preflight for strict setups (plan Phase 0 item 4): returns one gap per
|
|
181
|
+
* obligation whose contract cannot be proven. A strict setup demanding an
|
|
182
|
+
* unavailable contract must fail closed with these precise errors — it
|
|
183
|
+
* cannot advertise an operational blocking E2E gate.
|
|
184
|
+
*
|
|
185
|
+
* Args:
|
|
186
|
+
* obligations: the obligations to preflight (`id` + `contract`).
|
|
187
|
+
*
|
|
188
|
+
* Returns:
|
|
189
|
+
* Array<CapabilityGap & {obligationId: string}>: one entry per
|
|
190
|
+
* unsupported obligation, sorted by obligation id (deterministic).
|
|
191
|
+
*/
|
|
192
|
+
export function strictCapabilityGaps(obligations) {
|
|
193
|
+
const gaps = [];
|
|
194
|
+
for (const obligation of obligations) {
|
|
195
|
+
const gap = capabilityGap(obligation.contract);
|
|
196
|
+
if (gap === null)
|
|
197
|
+
continue;
|
|
198
|
+
gaps.push({
|
|
199
|
+
...gap,
|
|
200
|
+
detail: `obligation '${obligation.id}': ${gap.detail}`,
|
|
201
|
+
obligationId: obligation.id,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return gaps.sort((a, b) => a.obligationId < b.obligationId ? -1 : a.obligationId > b.obligationId ? 1 : 0);
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=cause.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cause.js","sourceRoot":"","sources":["../../src/verdict/cause.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAkB,MAAM,uBAAuB,CAAC;AAU3E,6EAA6E;AAC7E,MAAM,cAAc,GAAwB,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7E;;;;;;;;;GASG;AACH,MAAM,+BAA+B,GAAsB;IACzD,8BAA8B;IAC9B,+CAA+C;IAC/C,gDAAgD;IAChD,oDAAoD;IACpD,oCAAoC;IACpC,6DAA6D;IAC7D,oCAAoC;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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { type HttpRouteCandidate } from './registry.js';
|
|
2
|
+
import { type Obligation } from '../schemas/obligation.js';
|
|
3
|
+
import type { TrustTier } from '../schemas/common.js';
|
|
4
|
+
import type { CauseCode, Verdict } from '../schemas/verdict.js';
|
|
5
|
+
import { type Waiver } from '../schemas/waiver.js';
|
|
6
|
+
/** Verdicts that block a run (exit code 1). Clean: satisfied, waived. */
|
|
7
|
+
export declare const BLOCKING_VERDICTS: readonly Verdict[];
|
|
8
|
+
/**
|
|
9
|
+
* Fail-closed verdict-engine error: raised only for engine-internal
|
|
10
|
+
* contract violations (malformed obligation, invalid `now`) — never for
|
|
11
|
+
* adversary-controlled evidence, which must degrade to a verdict.
|
|
12
|
+
*/
|
|
13
|
+
export declare class GateforgeVerdictError extends Error {
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
/** A waiver plus the engine-only stale-owner flag (GF-17). */
|
|
17
|
+
export type WaiverRef = Waiver & {
|
|
18
|
+
readonly ownerStale?: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** The pinned pin-#9 result shape for one obligation. */
|
|
21
|
+
export interface VerdictOutcome {
|
|
22
|
+
/** One of the seven verdicts (ADR 0001 D1). */
|
|
23
|
+
verdict: Verdict;
|
|
24
|
+
/**
|
|
25
|
+
* Single-cause human explanation. `null` only for `satisfied`;
|
|
26
|
+
* every other verdict explains itself (invariant 8).
|
|
27
|
+
*/
|
|
28
|
+
reason: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Record ids that drove the verdict — the satisfying witnessed set for
|
|
31
|
+
* `satisfied`; all considered records for `missing`/`invalid`; empty for
|
|
32
|
+
* verdicts decided before evidence is consulted. Sorted, deduplicated.
|
|
33
|
+
*/
|
|
34
|
+
recordIds: string[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A per-obligation verdict enriched for reporting: the batch wrapper adds
|
|
38
|
+
* the obligation identity, the highest trust tier among considered
|
|
39
|
+
* records, optional detector provenance (invariant 8 trace), and the
|
|
40
|
+
* stable cause code + next action for the shared report model (plan
|
|
41
|
+
* §5.4). Cause/nextAction are null when the verdict is clean or no
|
|
42
|
+
* honest mapping exists yet (later phases populate).
|
|
43
|
+
*/
|
|
44
|
+
export interface ObligationVerdict extends VerdictOutcome {
|
|
45
|
+
/** The obligation this verdict is about. */
|
|
46
|
+
obligation: Obligation;
|
|
47
|
+
/** Highest trust tier among the obligation's records; null when none. */
|
|
48
|
+
trustTier: TrustTier | null;
|
|
49
|
+
/** Detector provenance for the trace; attached by the caller when known. */
|
|
50
|
+
detector?: {
|
|
51
|
+
id: string;
|
|
52
|
+
version: string;
|
|
53
|
+
} | null;
|
|
54
|
+
/** Stable plan §5.4 cause code; null when unmapped or clean. */
|
|
55
|
+
readonly cause?: CauseCode | null;
|
|
56
|
+
/** Human next action for the cause; null when unmapped or clean. */
|
|
57
|
+
readonly nextAction?: string | null;
|
|
58
|
+
}
|
|
59
|
+
/** Pin-#9 evaluation context. Malformed entries degrade, never crash. */
|
|
60
|
+
export interface VerdictContext {
|
|
61
|
+
/** Reporter claims (Claim-shaped); entries failing the schema are ignored. */
|
|
62
|
+
claims: readonly unknown[];
|
|
63
|
+
/**
|
|
64
|
+
* Witness records — deliberately lenient input: records that fail the
|
|
65
|
+
* EvidenceRecord shape or lack service-issued provenance are treated as
|
|
66
|
+
* claimed-tier (GF-23), never rejected.
|
|
67
|
+
*/
|
|
68
|
+
records: readonly unknown[];
|
|
69
|
+
/** Loaded waivers; `ownerStale: true` entries yield `stale` (GF-17). */
|
|
70
|
+
waivers: readonly WaiverRef[];
|
|
71
|
+
/** Classification of `obligation.resourceId`; null ⇒ `unclassified`. */
|
|
72
|
+
classification: unknown;
|
|
73
|
+
/** The obligation's graph resource (kind + attributes), when the host can supply it. Verifiers use it to bind evidence to identity. */
|
|
74
|
+
resource?: {
|
|
75
|
+
kind: string;
|
|
76
|
+
attributes: Record<string, unknown>;
|
|
77
|
+
} | null;
|
|
78
|
+
/**
|
|
79
|
+
* The COMPLETE runtime route inventory for HTTP attribution (plan
|
|
80
|
+
* §9, D2). Host-derived from the graph; absent blocks HTTP
|
|
81
|
+
* satisfaction (no any-endpoint fallback).
|
|
82
|
+
*/
|
|
83
|
+
httpRoutes?: readonly HttpRouteCandidate[] | null;
|
|
84
|
+
/** Injected clock instant (invariant 7) — the only time source. */
|
|
85
|
+
now: Date | string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Normalizes the injected clock to a Date. Accepts Date or ISO-8601
|
|
89
|
+
* string; anything else is an engine-internal contract violation.
|
|
90
|
+
*
|
|
91
|
+
* Args:
|
|
92
|
+
* now: the injected clock instant.
|
|
93
|
+
*
|
|
94
|
+
* Returns:
|
|
95
|
+
* Date: the parsed instant.
|
|
96
|
+
*
|
|
97
|
+
* Throws:
|
|
98
|
+
* GateforgeVerdictError: when `now` is not a valid ISO-8601 instant.
|
|
99
|
+
*/
|
|
100
|
+
export declare function parseInstant(now: Date | string): Date;
|
|
101
|
+
/**
|
|
102
|
+
* Evaluates ONE obligation against the run's claims, records, waivers,
|
|
103
|
+
* classification, and injected clock (pin #9). Pure and deterministic:
|
|
104
|
+
* identical inputs produce identical outcomes.
|
|
105
|
+
*
|
|
106
|
+
* Args:
|
|
107
|
+
* obligation: the obligation under evaluation (validated schema shape).
|
|
108
|
+
* context: claims, records, waivers, classification, and `now`.
|
|
109
|
+
*
|
|
110
|
+
* Returns:
|
|
111
|
+
* VerdictOutcome: {verdict, reason, recordIds} — reason is null only
|
|
112
|
+
* for `satisfied`; recordIds is always a sorted array.
|
|
113
|
+
*
|
|
114
|
+
* Throws:
|
|
115
|
+
* GateforgeVerdictError: when the obligation or `now` violates the
|
|
116
|
+
* engine-internal contract (evidence problems NEVER throw — they
|
|
117
|
+
* produce `invalid`/`missing` verdicts).
|
|
118
|
+
*/
|
|
119
|
+
export declare function evaluateObligation(obligation: Obligation, context: VerdictContext): VerdictOutcome;
|
|
120
|
+
/**
|
|
121
|
+
* Evaluates a batch of obligations against one context and returns
|
|
122
|
+
* report-ready entries sorted by obligation id, each enriched with the
|
|
123
|
+
* highest trust tier among its records (SARIF properties), optional
|
|
124
|
+
* detector provenance passthrough, and the plan §5.4 cause code +
|
|
125
|
+
* next action for the shared report model.
|
|
126
|
+
*
|
|
127
|
+
* Args:
|
|
128
|
+
* obligations: obligations to evaluate.
|
|
129
|
+
* context: the shared pin-#9 evaluation context.
|
|
130
|
+
*
|
|
131
|
+
* Returns:
|
|
132
|
+
* ObligationVerdict[]: sorted by obligation id; deterministic.
|
|
133
|
+
*/
|
|
134
|
+
export declare function evaluateObligations(obligations: readonly Obligation[], context: VerdictContext): ObligationVerdict[];
|
|
135
|
+
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/verdict/evaluate.ts"],"names":[],"mappings":"AAuDA,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AASvB,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,sBAAsB,CAAC;AA+BjE,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,EAAE,SAAS,OAAO,EAM/C,CAAC;AAEF;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,8DAA8D;AAC9D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