agent-passport-system 4.0.0 → 4.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/dist/src/core/canonical-jcs.d.ts +11 -0
- package/dist/src/core/canonical-jcs.d.ts.map +1 -1
- package/dist/src/core/canonical-jcs.js +39 -0
- package/dist/src/core/canonical-jcs.js.map +1 -1
- package/dist/src/core/reversibility-fold.d.ts +425 -0
- package/dist/src/core/reversibility-fold.d.ts.map +1 -0
- package/dist/src/core/reversibility-fold.js +513 -0
- package/dist/src/core/reversibility-fold.js.map +1 -0
- package/dist/src/types/execution-envelope.d.ts +7 -0
- package/dist/src/types/execution-envelope.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/** Raised when a value cannot be canonicalized under RFC 8785. Subclasses the
|
|
2
|
+
* built-in Error that canonicalizeJCS already throws, so any existing handler
|
|
3
|
+
* that catches Error (or `catch (e)`) still catches it and fails closed. */
|
|
4
|
+
export declare class JcsCanonicalizationError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
/** Stable machine-readable category, shared across the APS SDKs. */
|
|
7
|
+
readonly category = "invalid_unicode";
|
|
8
|
+
/** Specific failure within the category, e.g. 'lone_surrogate'. */
|
|
9
|
+
readonly reason: string;
|
|
10
|
+
constructor(code: string, message: string, reason?: string);
|
|
11
|
+
}
|
|
1
12
|
/** RFC 8785 JSON Canonicalization Scheme.
|
|
2
13
|
* Differences from legacy canonicalize():
|
|
3
14
|
* - null values ARE preserved (not filtered)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-jcs.d.ts","sourceRoot":"","sources":["../../../src/core/canonical-jcs.ts"],"names":[],"mappings":"AAgBA;;;;;qEAKqE;AACrE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"canonical-jcs.d.ts","sourceRoot":"","sources":["../../../src/core/canonical-jcs.ts"],"names":[],"mappings":"AAgBA;;6EAE6E;AAC7E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,qBAAoB;IACrC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAmB,EAKnE;CACF;AAqBD;;;;;qEAKqE;AACrE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAmCtD;AAED;kFACkF;AAClF,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,eAAe,EAAE,MAAM,GACtB,KAAK,GAAG,QAAQ,GAAG,WAAW,CAMhC;AAYD,mEAAmE;AACnE,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB;AAOD;;;yDAGyD;AACzD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAErE;AAED,4DAA4D;AAC5D,wBAAgB,cAAc,IAAI,0BAA0B,EAAE,CAoF7D"}
|
|
@@ -13,6 +13,43 @@
|
|
|
13
13
|
// Migration: new signatures should use JCS. Old signatures keep
|
|
14
14
|
// working with the legacy function. Verification tries both.
|
|
15
15
|
// ══════════════════════════════════════════════════════════════════
|
|
16
|
+
/** Raised when a value cannot be canonicalized under RFC 8785. Subclasses the
|
|
17
|
+
* built-in Error that canonicalizeJCS already throws, so any existing handler
|
|
18
|
+
* that catches Error (or `catch (e)`) still catches it and fails closed. */
|
|
19
|
+
export class JcsCanonicalizationError extends Error {
|
|
20
|
+
code;
|
|
21
|
+
/** Stable machine-readable category, shared across the APS SDKs. */
|
|
22
|
+
category = 'invalid_unicode';
|
|
23
|
+
/** Specific failure within the category, e.g. 'lone_surrogate'. */
|
|
24
|
+
reason;
|
|
25
|
+
constructor(code, message, reason = 'lone_surrogate') {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = 'JcsCanonicalizationError';
|
|
28
|
+
this.code = code;
|
|
29
|
+
this.reason = reason;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Reject a string containing an unpaired UTF-16 surrogate: a high surrogate
|
|
33
|
+
* (U+D800..U+DBFF) not immediately followed by a low surrogate (U+DC00..U+DFFF),
|
|
34
|
+
* or a low surrogate not immediately preceded by a high one. A lone surrogate is
|
|
35
|
+
* not a valid Unicode scalar and has no UTF-8 encoding, so RFC 8785 requires
|
|
36
|
+
* rejecting the input rather than escaping it. A valid surrogate PAIR passes. */
|
|
37
|
+
function assertNoLoneSurrogate(s) {
|
|
38
|
+
for (let i = 0; i < s.length; i++) {
|
|
39
|
+
const c = s.charCodeAt(i);
|
|
40
|
+
if (c >= 0xd800 && c <= 0xdbff) {
|
|
41
|
+
const next = i + 1 < s.length ? s.charCodeAt(i + 1) : 0;
|
|
42
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
43
|
+
i++;
|
|
44
|
+
continue;
|
|
45
|
+
} // valid pair
|
|
46
|
+
throw new JcsCanonicalizationError('ERR_JCS_LONE_SURROGATE', 'canonicalizeJCS: string contains an unpaired UTF-16 high surrogate; a lone surrogate has no valid UTF-8 encoding and RFC 8785 requires rejection');
|
|
47
|
+
}
|
|
48
|
+
if (c >= 0xdc00 && c <= 0xdfff) {
|
|
49
|
+
throw new JcsCanonicalizationError('ERR_JCS_LONE_SURROGATE', 'canonicalizeJCS: string contains an unpaired UTF-16 low surrogate; a lone surrogate has no valid UTF-8 encoding and RFC 8785 requires rejection');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
16
53
|
/** RFC 8785 JSON Canonicalization Scheme.
|
|
17
54
|
* Differences from legacy canonicalize():
|
|
18
55
|
* - null values ARE preserved (not filtered)
|
|
@@ -32,6 +69,7 @@ export function canonicalizeJCS(value) {
|
|
|
32
69
|
return JSON.stringify(value);
|
|
33
70
|
}
|
|
34
71
|
case 'string':
|
|
72
|
+
assertNoLoneSurrogate(value);
|
|
35
73
|
return JSON.stringify(value);
|
|
36
74
|
case 'object': {
|
|
37
75
|
if (value instanceof Date)
|
|
@@ -44,6 +82,7 @@ export function canonicalizeJCS(value) {
|
|
|
44
82
|
const keys = Object.keys(obj).sort();
|
|
45
83
|
const pairs = [];
|
|
46
84
|
for (const key of keys) {
|
|
85
|
+
assertNoLoneSurrogate(key);
|
|
47
86
|
const v = obj[key];
|
|
48
87
|
// RFC 8785: undefined becomes null, null is preserved
|
|
49
88
|
// Only skip if the key was never set (shouldn't happen with Object.keys)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-jcs.js","sourceRoot":"","sources":["../../../src/core/canonical-jcs.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,sCAAsC;AACtC,qEAAqE;AACrE,kEAAkE;AAClE,qEAAqE;AACrE,qEAAqE;AACrE,wEAAwE;AACxE,EAAE;AACF,wBAAwB;AACxB,mDAAmD;AACnD,uDAAuD;AACvD,EAAE;AACF,gEAAgE;AAChE,6DAA6D;AAC7D,qEAAqE;AAErE;;;;;qEAKqE;AACrE,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IAExD,QAAQ,OAAO,KAAK,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACjC,KAAK,QAAQ,EAAE,CAAC;YACd,IA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S,EAAE,sBAAsB;KAClC,EACD,iTAAiT,EACjT,oQAAoQ,CAAC,CAAA;IAEvQ,sBAAsB;IACtB,SAAS,CAAC,QAAQ,EAAE,gBAAgB,EAClC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAChC,iCAAiC,EACjC,iCAAiC,CAAC,CAAA;IAEpC,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/** What evidence actually establishes about an effect's reversibility.
|
|
2
|
+
* `unresolved` is an honest "not known yet", never silently upgraded. */
|
|
3
|
+
export type RealizedClass = 'tentative' | 'compensable' | 'irreversible' | 'unresolved';
|
|
4
|
+
/** The conservative class admission and the gateway act on. There is no
|
|
5
|
+
* `unresolved` here: the projection below folds it to `irreversible`. */
|
|
6
|
+
export type EnforcementClass = 'tentative' | 'compensable' | 'irreversible';
|
|
7
|
+
/** Pure projection realized -> enforcement (spec section 0).
|
|
8
|
+
* `unresolved` becomes `irreversible` (conservative, fail-closed). Every
|
|
9
|
+
* other value is the identity. This is the ONLY place `unresolved` is
|
|
10
|
+
* mapped to `irreversible`; realized truth is never rewritten. */
|
|
11
|
+
export declare function enforcementFrom(realized: RealizedClass): EnforcementClass;
|
|
12
|
+
/** The externality bucket an effect falls in. These values mirror the RAPV0
|
|
13
|
+
* TaskClassification.externality vocabulary (src/types/reputation-authority.ts)
|
|
14
|
+
* minus 'none'; a caller may pass RAPV0 values, and 'none' or an absent value
|
|
15
|
+
* is treated as unbound (see EffectFacts.externality). This is pattern reuse,
|
|
16
|
+
* not a shared type: reversibility is not a scalar of the effect location. */
|
|
17
|
+
export type EffectExternality = 'internal' | 'external-reversible' | 'external-irreversible';
|
|
18
|
+
/** Finality of an external effect. Used to decide whether an irreversible
|
|
19
|
+
* verdict is definitive or only an upper bound (spec section 4). */
|
|
20
|
+
export type FinalityState = 'settled' | 'pending' | 'expired' | 'contradicted';
|
|
21
|
+
/** A reversal-right attestation fact. To count, the signer MUST be a domain
|
|
22
|
+
* other than the acting principal (spec section 4). This step models the
|
|
23
|
+
* fact; it verifies no signature. A signer equal to the acting principal is
|
|
24
|
+
* self-attestation and does not establish the right. */
|
|
25
|
+
export interface ReversalRightFact {
|
|
26
|
+
/** Identity/domain that attested the reversal right. */
|
|
27
|
+
signer: string;
|
|
28
|
+
}
|
|
29
|
+
/** The raw facts a classifier consumes for one effect. Every field is
|
|
30
|
+
* optional: absence is meaningful and generally fails toward unresolved or,
|
|
31
|
+
* once the externality bucket is known, toward irreversible (fail-closed).
|
|
32
|
+
* This is the classifier input, not a receipt wire shape. */
|
|
33
|
+
export interface EffectFacts {
|
|
34
|
+
/** The externality bucket. Absent (undefined) means unbound / missing and
|
|
35
|
+
* classifies as unresolved. A caller mapping RAPV0 'none' should pass it
|
|
36
|
+
* as undefined here. */
|
|
37
|
+
externality?: EffectExternality;
|
|
38
|
+
/** RESERVED for the deferred v4 section 10 four-object subsystem. Not consumed
|
|
39
|
+
* by the v0 classifier: v0 has no external-compensable path, so the acting
|
|
40
|
+
* principal plays no part in v0 classification. */
|
|
41
|
+
actingPrincipal?: string;
|
|
42
|
+
/** Who can invoke reversal (recovery_controller), a carried raw fact. Not
|
|
43
|
+
* consumed by the v0 classifier (v0 external is irreversible-only). */
|
|
44
|
+
recoveryController?: string | null;
|
|
45
|
+
/** RESERVED for the deferred v4 section 10 four-object subsystem. Not consumed
|
|
46
|
+
* by the v0 classifier. In v0 no reversal-right can ground compensability;
|
|
47
|
+
* external compensability is a future profile, not a v0 branch. */
|
|
48
|
+
reversalRight?: ReversalRightFact | null;
|
|
49
|
+
/** Finality of an external-irreversible effect. Only 'settled' contributes
|
|
50
|
+
* to a definitive (non-upper-bound) irreversible verdict. */
|
|
51
|
+
finalityState?: FinalityState;
|
|
52
|
+
/** Whether the target/counterparty binding is verified, for external-
|
|
53
|
+
* irreversible effects. Both finality and this must hold to drop the
|
|
54
|
+
* upper_bound label. */
|
|
55
|
+
targetBindingVerified?: boolean;
|
|
56
|
+
/** A producer-declared recovery mechanism reference. Carried as raw data only:
|
|
57
|
+
* in v0 it derives NOTHING about the class (v4 s4 / s4.1). A self-declared ref
|
|
58
|
+
* is self-attestation, so it cannot mint compensability; internal-compensable
|
|
59
|
+
* requires a verifier-checked recovery result that v0 defers. */
|
|
60
|
+
recoveryMechanismRef?: string | null;
|
|
61
|
+
}
|
|
62
|
+
/** Deterministic reason codes for the v0 profile. One per mapping rule, so a
|
|
63
|
+
* verifier and an auditor read the same explanation for the same facts. Part of
|
|
64
|
+
* the profile's authoritative content (its reason-code set). */
|
|
65
|
+
export type ReasonCode = 'RM_V0_UNBOUND' | 'RM_V0_INTERNAL_DEFINITIVE' | 'RM_V0_INTERNAL_UPPER_BOUND' | 'RM_V0_EXTERNAL_DEFINITIVE' | 'RM_V0_EXTERNAL_UPPER_BOUND';
|
|
66
|
+
/** The result of a classification. The RealizedClass is the mapping output;
|
|
67
|
+
* `label` carries the section-4 upper_bound annotation, present only when an
|
|
68
|
+
* external verdict is not backed by verified finality and target binding; and
|
|
69
|
+
* `reason` is the deterministic reason code for the rule that fired. */
|
|
70
|
+
export interface ClassificationResult {
|
|
71
|
+
realized: RealizedClass;
|
|
72
|
+
label?: 'upper_bound';
|
|
73
|
+
reason: ReasonCode;
|
|
74
|
+
}
|
|
75
|
+
/** A versioned mapping profile: a pure function from raw effect facts to a
|
|
76
|
+
* RealizedClass, addressed by a stable id. */
|
|
77
|
+
export interface ClassificationProfile {
|
|
78
|
+
id: string;
|
|
79
|
+
classify: (facts: EffectFacts) => ClassificationResult;
|
|
80
|
+
}
|
|
81
|
+
/** Stable id of the v0 mapping profile. Chosen value; the spec fixes no
|
|
82
|
+
* literal, only that classification_profile_id must be bound. */
|
|
83
|
+
export declare const REVERSIBILITY_MAPPING_V0_ID = "reversibility-mapping-v0";
|
|
84
|
+
/** The v0 mapping rules (v4 sections 4, 4.1, 10), as a pure function.
|
|
85
|
+
*
|
|
86
|
+
* v0 has NO external-compensable path. External compensability is a FUTURE
|
|
87
|
+
* profile (reversibility-mapping-v1) built on the deferred four-object subsystem
|
|
88
|
+
* of v4 section 10, never a branch inside the v0 profile. v4 section 10 rejects
|
|
89
|
+
* the domain-separation-without-authority model (a non-empty reversal-right
|
|
90
|
+
* signer different from the principal): a registration outside operator control
|
|
91
|
+
* shows only separation, not authority-over-a-mechanism, so it cannot ground
|
|
92
|
+
* compensability. This profile must not behave differently by entry point.
|
|
93
|
+
*
|
|
94
|
+
* - external-irreversible AND external-reversible -> irreversible. Upper bound
|
|
95
|
+
* (label upper_bound) unless finality is settled AND the target binding is
|
|
96
|
+
* verified. The two external buckets are treated identically in v0.
|
|
97
|
+
* - internal -> irreversible, treated exactly like an external-irreversible
|
|
98
|
+
* effect (upper_bound unless finality settled AND target binding verified). A
|
|
99
|
+
* self-declared recovery_mechanism_ref derives nothing (v4 s4 / s4.1), so v0
|
|
100
|
+
* has no internal-compensable path.
|
|
101
|
+
* - unbound / missing externality -> unresolved.
|
|
102
|
+
* v0 therefore emits no compensable outcome at all. */
|
|
103
|
+
export declare function classifyV0(facts: EffectFacts): ClassificationResult;
|
|
104
|
+
/** The v0 profile function object. */
|
|
105
|
+
export declare const reversibilityMappingV0: ClassificationProfile;
|
|
106
|
+
/** The AUTHORITATIVE, canonical content of the v0 profile (v4 section 4): its
|
|
107
|
+
* input schema, mapping rules, reason-code set, and time semantics, and nothing
|
|
108
|
+
* else. No runtime, diagnostic, or human-facing metadata (display name,
|
|
109
|
+
* comments, timestamps) is included, so those can change without changing the
|
|
110
|
+
* content digest. This object is what the digest commits to. */
|
|
111
|
+
export declare const REVERSIBILITY_PROFILE_V0_CONTENT: {
|
|
112
|
+
profile_id: string;
|
|
113
|
+
input_fields: string[];
|
|
114
|
+
externality_values: string[];
|
|
115
|
+
finality_values: string[];
|
|
116
|
+
external_compensable: boolean;
|
|
117
|
+
internal_compensable: boolean;
|
|
118
|
+
rules: ({
|
|
119
|
+
id: string;
|
|
120
|
+
when: string;
|
|
121
|
+
realized: string;
|
|
122
|
+
reason: string;
|
|
123
|
+
label?: undefined;
|
|
124
|
+
} | {
|
|
125
|
+
id: string;
|
|
126
|
+
when: string;
|
|
127
|
+
realized: string;
|
|
128
|
+
label: string;
|
|
129
|
+
reason: string;
|
|
130
|
+
})[];
|
|
131
|
+
reason_codes: string[];
|
|
132
|
+
time_semantics: {
|
|
133
|
+
clock_skew_ms: number;
|
|
134
|
+
finality_source: string;
|
|
135
|
+
target_binding_source: string;
|
|
136
|
+
};
|
|
137
|
+
schema_version: string;
|
|
138
|
+
};
|
|
139
|
+
/** Domain-separated content digest of a profile (v4 section 4):
|
|
140
|
+
* SHA-256( UTF8("APS-REVERSIBILITY-PROFILE-V0") || 0x00 || UTF8(JCS(content)) ).
|
|
141
|
+
* Any language that JCS-canonicalizes the same content reproduces this byte-for-
|
|
142
|
+
* byte. */
|
|
143
|
+
export declare function profileContentDigest(content: unknown): string;
|
|
144
|
+
/** The v0 profile's content digest. */
|
|
145
|
+
export declare const REVERSIBILITY_MAPPING_V0_DIGEST: string;
|
|
146
|
+
/** A registered profile: its function object, its authoritative content, its
|
|
147
|
+
* content digest, and non-authoritative diagnostic metadata that is NOT part of
|
|
148
|
+
* the digest. */
|
|
149
|
+
export interface RegisteredProfile {
|
|
150
|
+
profile: ClassificationProfile;
|
|
151
|
+
content: unknown;
|
|
152
|
+
digest: string;
|
|
153
|
+
/** Diagnostic/human-facing only. Excluded from the digest; may change freely. */
|
|
154
|
+
metadata: {
|
|
155
|
+
display_name: string;
|
|
156
|
+
description: string;
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/** Resolve a mapping profile function by its classification_profile_id. Returns
|
|
160
|
+
* undefined for an unknown id (a distinct event from unbound facts). */
|
|
161
|
+
export declare function getClassificationProfile(id: string): ClassificationProfile | undefined;
|
|
162
|
+
/** Resolve the full registered profile (function, content, digest, metadata). */
|
|
163
|
+
export declare function getRegisteredProfile(id: string): RegisteredProfile | undefined;
|
|
164
|
+
/** The registry's content digest for a profile id, or undefined if unknown. */
|
|
165
|
+
export declare function getProfileDigest(id: string): string | undefined;
|
|
166
|
+
/** The set of registered profile ids. */
|
|
167
|
+
export declare function registeredProfileIds(): string[];
|
|
168
|
+
/** The outcome of checking a declared (id, digest) against the registry. Unknown
|
|
169
|
+
* id and digest mismatch are DISTINCT failures, never conflated. */
|
|
170
|
+
export type ProfileBindingCheck = {
|
|
171
|
+
ok: true;
|
|
172
|
+
digest: string;
|
|
173
|
+
} | {
|
|
174
|
+
ok: false;
|
|
175
|
+
reason: 'unknown_profile';
|
|
176
|
+
classificationProfileId: string;
|
|
177
|
+
} | {
|
|
178
|
+
ok: false;
|
|
179
|
+
reason: 'digest_mismatch';
|
|
180
|
+
classificationProfileId: string;
|
|
181
|
+
declaredDigest: string;
|
|
182
|
+
expectedDigest: string;
|
|
183
|
+
};
|
|
184
|
+
/** Check a declared profile id + content digest against the immutable registry.
|
|
185
|
+
* An id not in the registry fails unknown_profile; a known id whose declared
|
|
186
|
+
* digest does not equal the registry digest fails digest_mismatch. */
|
|
187
|
+
export declare function verifyProfileBinding(id: string, declaredDigest: string): ProfileBindingCheck;
|
|
188
|
+
/** Where an effect lands. Coarser than the classifier's externality bucket:
|
|
189
|
+
* the reversible-vs-irreversible distinction for an external effect is not a
|
|
190
|
+
* field an author sets, it is recomputed from the recovery facts (spec Q4:
|
|
191
|
+
* reversibility is not a scalar of the effect location). */
|
|
192
|
+
export type EffectScope = 'internal' | 'external';
|
|
193
|
+
/** Whether the effect's facts are established yet. Carried per section 3 and
|
|
194
|
+
* consumed by the two-stage lifecycle (a later step), not by this recompute. */
|
|
195
|
+
export type EvidenceStatus = 'resolved' | 'pending' | 'unavailable' | 'conflicted';
|
|
196
|
+
/** One instantiated effect. Raw facts only. */
|
|
197
|
+
export interface EffectInstantiationElement {
|
|
198
|
+
effect_scope: EffectScope;
|
|
199
|
+
effect_target_ref: string;
|
|
200
|
+
finality_state: FinalityState;
|
|
201
|
+
recovery_mechanism_ref: string | null;
|
|
202
|
+
recovery_controller: string | null;
|
|
203
|
+
recovery_deadline: string | null;
|
|
204
|
+
evidence_status: EvidenceStatus;
|
|
205
|
+
classification_profile_id: string;
|
|
206
|
+
/** The content digest of the profile named by classification_profile_id (v4
|
|
207
|
+
* section 4). A recompute checks it against the immutable registry: a
|
|
208
|
+
* mismatch fails distinctly from an unknown profile. Binding the id to the
|
|
209
|
+
* digest proves which profile CONTENT governed the classification. */
|
|
210
|
+
classification_profile_digest: string;
|
|
211
|
+
/** Content-addressed request/action identity of the execution instance this
|
|
212
|
+
* effect belongs to (v4 section 2). Sourced from the carrying receipt's
|
|
213
|
+
* action_ref (ExecutionEnvelope.action_ref, the APS correlation key). A
|
|
214
|
+
* stable, signed binding so an effect state cannot be transplanted between
|
|
215
|
+
* receipts. */
|
|
216
|
+
action_ref: string;
|
|
217
|
+
/** Stable unique id of the specific execution instance (v4 section 2). Sourced
|
|
218
|
+
* from the carrying receipt's per-instance id (ExecutionEnvelope.action_id or
|
|
219
|
+
* RAPV0.receipt_id). Distinguishes two instances that share a content-
|
|
220
|
+
* addressed action_ref. */
|
|
221
|
+
action_instance_id: string;
|
|
222
|
+
/** Stable id for this effect across its lifecycle stages (v4 section 2).
|
|
223
|
+
* Precedence is defined by lineage under this id, never by array position. */
|
|
224
|
+
effect_id: string;
|
|
225
|
+
/** Hash of the prior signed state of THIS effect, or null on the first state.
|
|
226
|
+
* Chains an effect's lineage so a later state references its predecessor. */
|
|
227
|
+
predecessor_effect_state_hash: string | null;
|
|
228
|
+
/** Monotonic position within THIS effect's own lineage (not the array). */
|
|
229
|
+
sequence: number;
|
|
230
|
+
/** Optional cache ONLY. Never trusted. A verifier recomputes the realized
|
|
231
|
+
* class and any mismatch fails verification (verifyAssertedClass). */
|
|
232
|
+
asserted_realized_class?: RealizedClass;
|
|
233
|
+
}
|
|
234
|
+
/** The effect-instantiation block: the effect vector (v0). */
|
|
235
|
+
export interface EffectInstantiationBlock {
|
|
236
|
+
instantiated_effects: EffectInstantiationElement[];
|
|
237
|
+
}
|
|
238
|
+
/** RAPV0 TaskClassification.externality value space. Declared here to avoid
|
|
239
|
+
* coupling this primitive to the reputation type; the values mirror
|
|
240
|
+
* src/types/reputation-authority.ts TaskClassification.externality. */
|
|
241
|
+
export type RapvExternality = 'none' | 'internal' | 'external-reversible' | 'external-irreversible';
|
|
242
|
+
/** Map an RAPV0 externality onto the value used for EffectFacts.externality.
|
|
243
|
+
* 'none' or absent -> undefined (unbound), which classifies unresolved.
|
|
244
|
+
* internal -> internal. Both external buckets -> external-irreversible: the
|
|
245
|
+
* legacy 'external-reversible' taxonomy carried a stronger meaning than v0
|
|
246
|
+
* grants, so it is NOT passed through as-is; mapping it to external-irreversible
|
|
247
|
+
* keeps it from being a backdoor into compensability (v4 s4/s10). This is a pure
|
|
248
|
+
* adapter, not an import-and-couple. */
|
|
249
|
+
export declare function rapvExternalityToEffectFacts(externality: RapvExternality | null | undefined): EffectExternality | undefined;
|
|
250
|
+
/** Verifier-supplied context for a recompute. Facts a verifier establishes
|
|
251
|
+
* out of band. Everything defaults to the fail-closed value when absent. */
|
|
252
|
+
export interface RecomputeOptions {
|
|
253
|
+
/** HARD RULE: an author NEVER sets this from the block. Only a verifier that
|
|
254
|
+
* checked the resource_confirmation_ref cryptographic commitment (a later
|
|
255
|
+
* step) may pass true. Absent or false keeps an external-irreversible effect
|
|
256
|
+
* at irreversible + upper_bound. */
|
|
257
|
+
targetBindingVerified?: boolean;
|
|
258
|
+
}
|
|
259
|
+
/** The outcome of a recompute. An unknown classification_profile_id is a
|
|
260
|
+
* DISTINCT failure from unbound facts: it is surfaced, never silently
|
|
261
|
+
* classified as unresolved. */
|
|
262
|
+
export type RecomputeOutcome = {
|
|
263
|
+
status: 'recomputed';
|
|
264
|
+
classificationProfileId: string;
|
|
265
|
+
result: ClassificationResult;
|
|
266
|
+
} | {
|
|
267
|
+
status: 'unknown_profile';
|
|
268
|
+
classificationProfileId: string;
|
|
269
|
+
} | {
|
|
270
|
+
status: 'profile_digest_mismatch';
|
|
271
|
+
classificationProfileId: string;
|
|
272
|
+
declaredDigest: string;
|
|
273
|
+
expectedDigest: string;
|
|
274
|
+
};
|
|
275
|
+
/** Recompute the realized class for one effect element. Resolves the mapping
|
|
276
|
+
* profile by classification_profile_id; an unknown id is surfaced as its own
|
|
277
|
+
* failure and is NOT classified. Otherwise runs the profile over the element's
|
|
278
|
+
* facts and returns the ClassificationResult. */
|
|
279
|
+
export declare function recomputeEffect(element: EffectInstantiationElement, options?: RecomputeOptions): RecomputeOutcome;
|
|
280
|
+
/** Recompute every effect in a block, per element. No folding or collapsing to
|
|
281
|
+
* a maximum here (that is the fold, a later step). */
|
|
282
|
+
export declare function recomputeBlock(block: EffectInstantiationBlock, options?: RecomputeOptions): RecomputeOutcome[];
|
|
283
|
+
/** The result of checking an element's asserted cache class against the
|
|
284
|
+
* recompute. Absent cache passes. A present cache that differs from the
|
|
285
|
+
* recomputed realized class fails. An unknown profile cannot be verified. */
|
|
286
|
+
export type AssertedClassCheck = {
|
|
287
|
+
ok: true;
|
|
288
|
+
recomputed: ClassificationResult;
|
|
289
|
+
} | {
|
|
290
|
+
ok: false;
|
|
291
|
+
reason: 'mismatch';
|
|
292
|
+
asserted: RealizedClass;
|
|
293
|
+
recomputed: RealizedClass;
|
|
294
|
+
} | {
|
|
295
|
+
ok: false;
|
|
296
|
+
reason: 'unknown_profile';
|
|
297
|
+
classificationProfileId: string;
|
|
298
|
+
} | {
|
|
299
|
+
ok: false;
|
|
300
|
+
reason: 'profile_digest_mismatch';
|
|
301
|
+
classificationProfileId: string;
|
|
302
|
+
declaredDigest: string;
|
|
303
|
+
expectedDigest: string;
|
|
304
|
+
};
|
|
305
|
+
/** Verify an element's asserted cache class (if any) against the recompute.
|
|
306
|
+
* A cache is a convenience only and is never trusted: a mismatch fails. An
|
|
307
|
+
* unknown profile or a profile-digest mismatch cannot be verified and surfaces
|
|
308
|
+
* distinctly. */
|
|
309
|
+
export declare function verifyAssertedClass(element: EffectInstantiationElement, options?: RecomputeOptions): AssertedClassCheck;
|
|
310
|
+
/** Provisional stage. Append-only. */
|
|
311
|
+
export interface ExecutionStageReceipt {
|
|
312
|
+
stage: 'execution';
|
|
313
|
+
action_ref: string;
|
|
314
|
+
run_id: string;
|
|
315
|
+
/** The provisional class facts. */
|
|
316
|
+
effect_instantiation: EffectInstantiationBlock;
|
|
317
|
+
/** Stage-level evidence status. Provisional receipts are always pending. */
|
|
318
|
+
evidence_status: 'pending';
|
|
319
|
+
/** The enforcement class that GOVERNED admission, recorded by the gateway that
|
|
320
|
+
* admitted the action. Never rewritten by any later stage. */
|
|
321
|
+
admitted_enforcement_class: EnforcementClass;
|
|
322
|
+
created_at: string;
|
|
323
|
+
}
|
|
324
|
+
export interface ReconciliationSignature {
|
|
325
|
+
algorithm: 'Ed25519';
|
|
326
|
+
public_key: string;
|
|
327
|
+
value: string;
|
|
328
|
+
}
|
|
329
|
+
/** Audit stage. Hash-linked to an execution receipt and signed. Carries the
|
|
330
|
+
* refined realized class, which has NO enforcement power. */
|
|
331
|
+
export interface ReconciliationStageReceipt {
|
|
332
|
+
stage: 'reconciliation';
|
|
333
|
+
/** SHA-256 hash-link to the execution receipt this refines. */
|
|
334
|
+
execution_receipt_hash: string;
|
|
335
|
+
action_ref: string;
|
|
336
|
+
/** Audit-time realized class. Never gates admission. */
|
|
337
|
+
realized_class: RealizedClass;
|
|
338
|
+
/** Refined evidence status after reconciliation. */
|
|
339
|
+
evidence_status: 'resolved' | 'unavailable' | 'conflicted';
|
|
340
|
+
reconciled_at: string;
|
|
341
|
+
signature: ReconciliationSignature;
|
|
342
|
+
}
|
|
343
|
+
/** SHA-256 (over strict JCS bytes) of an execution receipt. Any change to the
|
|
344
|
+
* execution receipt changes this hash, so a hash-link detects a rewrite. */
|
|
345
|
+
export declare function hashExecutionReceipt(receipt: ExecutionStageReceipt): string;
|
|
346
|
+
export interface CreateReconciliationInput {
|
|
347
|
+
realized_class: RealizedClass;
|
|
348
|
+
evidence_status: 'resolved' | 'unavailable' | 'conflicted';
|
|
349
|
+
reconciled_at: string;
|
|
350
|
+
signerPrivateKey: string;
|
|
351
|
+
signerPublicKey: string;
|
|
352
|
+
}
|
|
353
|
+
/** Create a reconciliation receipt hash-linked to an execution receipt and
|
|
354
|
+
* signed over its canonical body. Does not touch the execution receipt. */
|
|
355
|
+
export declare function createReconciliationReceipt(execution: ExecutionStageReceipt, input: CreateReconciliationInput): ReconciliationStageReceipt;
|
|
356
|
+
export interface TransitionCheck {
|
|
357
|
+
ok: boolean;
|
|
358
|
+
errors: string[];
|
|
359
|
+
}
|
|
360
|
+
/** Validate a reconciliation against its execution receipt. Rejects a broken
|
|
361
|
+
* hash-link (a rewritten execution receipt), an invalid signature, a stage
|
|
362
|
+
* that is not pending, and any non-monotonic realized class. */
|
|
363
|
+
export declare function validateTransition(execution: ExecutionStageReceipt, reconciliation: ReconciliationStageReceipt): TransitionCheck;
|
|
364
|
+
/** The enforcement class that GOVERNED admission. This reads ONLY the execution
|
|
365
|
+
* receipt: the reconciliation's realized class is audit-time truth and carries
|
|
366
|
+
* no enforcement power, so a consumer cannot read the final class as the one
|
|
367
|
+
* that gated the action. */
|
|
368
|
+
export declare function admittedEnforcementClass(execution: ExecutionStageReceipt): EnforcementClass;
|
|
369
|
+
/** The signed authoritative fields of one effect state as a null-free object
|
|
370
|
+
* (v4 section 2). It commits to every signed field: effect_id, sequence,
|
|
371
|
+
* predecessor_effect_state_hash, the raw effect facts, classification_profile_id,
|
|
372
|
+
* classification_profile_digest, the evidence status, and the receipt/action
|
|
373
|
+
* binding (action_ref, action_instance_id). The asserted class is signed content
|
|
374
|
+
* and part of the state identity, so it is included when present, but it is
|
|
375
|
+
* non-authoritative for classification (a verifier recomputes). Computed
|
|
376
|
+
* verification outputs, the state hash itself, and out-of-object signatures are
|
|
377
|
+
* excluded: the builder reads only the known signed fields, so an extra property
|
|
378
|
+
* on the element object cannot enter the preimage. Only non-null fields are
|
|
379
|
+
* included, the same parity-safe rule the profile content follows, because the
|
|
380
|
+
* SDK JCS implementations diverge on null-valued keys. */
|
|
381
|
+
export declare function effectStatePreimage(el: EffectInstantiationElement): Record<string, unknown>;
|
|
382
|
+
/** Domain-separated hash of one effect state (v4 section 2):
|
|
383
|
+
* SHA-256( UTF8("APS-REVERSIBILITY-EFFECT-STATE-V0") || 0x00 || UTF8(JCS(preimage)) )
|
|
384
|
+
* over the null-free preimage of every signed authoritative field. Chains a
|
|
385
|
+
* lineage: a later state's predecessor_effect_state_hash references this. Any
|
|
386
|
+
* language that JCS-canonicalizes the same preimage reproduces it byte-for-byte. */
|
|
387
|
+
export declare function hashEffectState(element: EffectInstantiationElement): string;
|
|
388
|
+
/** Deterministic derivation of an effect_id (v4 section 2):
|
|
389
|
+
* base64url( SHA-256( UTF8("APS-REVERSIBILITY-EFFECT-ID-V0") || 0x00 ||
|
|
390
|
+
* UTF8(JCS({action_ref, action_instance_id, local_effect_id})) ) ), where
|
|
391
|
+
* local_effect_id is unique within the receipt and STABLE across retries (an
|
|
392
|
+
* id, not a nonce). The id is a function of stable inputs, so a retry produces
|
|
393
|
+
* the same effect_id and the same lineage identity. */
|
|
394
|
+
export declare function deriveEffectId(action_ref: string, action_instance_id: string, local_effect_id: string): string;
|
|
395
|
+
/** The typed outcome of lineage validation (v4 section 2, corrected).
|
|
396
|
+
* - ok: a single rooted, gap-free, correctly chained lineage per effect_id.
|
|
397
|
+
* - lineage_incomplete: a gap in sequences, a non-zero origin, or no root
|
|
398
|
+
* (missing states).
|
|
399
|
+
* - lineage_conflicted: a fork, where one predecessor state has two distinct
|
|
400
|
+
* successors.
|
|
401
|
+
* - equivocation: two distinct roots share an effect_id (multiple-roots), or two
|
|
402
|
+
* states occupy the same (effect_id, sequence) with different hashes without a
|
|
403
|
+
* shared predecessor. Named as the provable condition; it is NOT a claim about
|
|
404
|
+
* a semantic collision between unrelated effects.
|
|
405
|
+
* - invalid_state: a state at sequence n>0 whose predecessor_effect_state_hash
|
|
406
|
+
* does not equal the hash of the state at n-1 (a broken chain link). */
|
|
407
|
+
export type LineageStatus = 'ok' | 'lineage_incomplete' | 'lineage_conflicted' | 'equivocation' | 'invalid_state';
|
|
408
|
+
export interface LineageResult {
|
|
409
|
+
status: LineageStatus;
|
|
410
|
+
/** Exact-duplicate states (identical full effect-state hash) removed before
|
|
411
|
+
* the graph checks, aggregated across all effect_ids in the block. */
|
|
412
|
+
duplicate_count: number;
|
|
413
|
+
}
|
|
414
|
+
/** Validate the identity and lineage structure of a block, independent of array
|
|
415
|
+
* order (v4 section 2, corrected). Returns a TYPED status plus a duplicate_count.
|
|
416
|
+
* The block is ok only when every effect_id's lineage is ok; otherwise the
|
|
417
|
+
* status is that of the lexicographically first non-ok effect_id (deterministic).
|
|
418
|
+
* This validates identity only; the lineage-based fold reading (classify from
|
|
419
|
+
* the latest lineage state per effect_id) is the fold, not built here. */
|
|
420
|
+
export declare function validateEffectLineage(block: EffectInstantiationBlock): LineageResult;
|
|
421
|
+
/** The latest valid state per effect_id, but ONLY for an ok lineage. Returns
|
|
422
|
+
* undefined for any non-ok block, so a caller cannot pull a latest state from an
|
|
423
|
+
* incomplete, conflicted, equivocating, or invalid lineage. Order-invariant. */
|
|
424
|
+
export declare function latestValidEffectStates(block: EffectInstantiationBlock): Map<string, EffectInstantiationElement> | undefined;
|
|
425
|
+
//# sourceMappingURL=reversibility-fold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reversibility-fold.d.ts","sourceRoot":"","sources":["../../../src/core/reversibility-fold.ts"],"names":[],"mappings":"AAmCA;0EAC0E;AAC1E,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,GAAG,YAAY,CAAA;AAEvF;0EAC0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAA;AAE3E;;;mEAGmE;AACnE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,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wB,GAAG,aAAa,CAepF;AAED;;iFAEiF;AACjF,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,wBAAwB,GAC9B,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,GAAG,SAAS,CAarD"}
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
// Copyright (c) 2026 Tymofii Pidlisnyi
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Reversibility fold - foundation (spec v2, reversibility-fold-design-v2.md)
|
|
4
|
+
//
|
|
5
|
+
// A new primitive that reuses the trust-domain-counting and provisional/final
|
|
6
|
+
// lifecycle patterns already established in APS, applied to reversibility.
|
|
7
|
+
//
|
|
8
|
+
// This module is the FOUNDATION only: the two-axis output types and their
|
|
9
|
+
// projection (step 1), and the versioned mapping-profile registry (step 2).
|
|
10
|
+
// It touches no receipt envelope, no gateway, and no existing wire shape.
|
|
11
|
+
// The effect-instantiation block, lifecycle records, fold, divergence, and
|
|
12
|
+
// admission checkpoint are later steps and are not implemented here.
|
|
13
|
+
import { createHash } from 'node:crypto';
|
|
14
|
+
import { sign, verify } from '../crypto/keys.js';
|
|
15
|
+
import { canonicalizeJCS } from './canonical-jcs.js';
|
|
16
|
+
/** Pure projection realized -> enforcement (spec section 0).
|
|
17
|
+
* `unresolved` becomes `irreversible` (conservative, fail-closed). Every
|
|
18
|
+
* other value is the identity. This is the ONLY place `unresolved` is
|
|
19
|
+
* mapped to `irreversible`; realized truth is never rewritten. */
|
|
20
|
+
export function enforcementFrom(realized) {
|
|
21
|
+
return realized === 'unresolved' ? 'irreversible' : realized;
|
|
22
|
+
}
|
|
23
|
+
/** Stable id of the v0 mapping profile. Chosen value; the spec fixes no
|
|
24
|
+
* literal, only that classification_profile_id must be bound. */
|
|
25
|
+
export const REVERSIBILITY_MAPPING_V0_ID = 'reversibility-mapping-v0';
|
|
26
|
+
/** The v0 mapping rules (v4 sections 4, 4.1, 10), as a pure function.
|
|
27
|
+
*
|
|
28
|
+
* v0 has NO external-compensable path. External compensability is a FUTURE
|
|
29
|
+
* profile (reversibility-mapping-v1) built on the deferred four-object subsystem
|
|
30
|
+
* of v4 section 10, never a branch inside the v0 profile. v4 section 10 rejects
|
|
31
|
+
* the domain-separation-without-authority model (a non-empty reversal-right
|
|
32
|
+
* signer different from the principal): a registration outside operator control
|
|
33
|
+
* shows only separation, not authority-over-a-mechanism, so it cannot ground
|
|
34
|
+
* compensability. This profile must not behave differently by entry point.
|
|
35
|
+
*
|
|
36
|
+
* - external-irreversible AND external-reversible -> irreversible. Upper bound
|
|
37
|
+
* (label upper_bound) unless finality is settled AND the target binding is
|
|
38
|
+
* verified. The two external buckets are treated identically in v0.
|
|
39
|
+
* - internal -> irreversible, treated exactly like an external-irreversible
|
|
40
|
+
* effect (upper_bound unless finality settled AND target binding verified). A
|
|
41
|
+
* self-declared recovery_mechanism_ref derives nothing (v4 s4 / s4.1), so v0
|
|
42
|
+
* has no internal-compensable path.
|
|
43
|
+
* - unbound / missing externality -> unresolved.
|
|
44
|
+
* v0 therefore emits no compensable outcome at all. */
|
|
45
|
+
export function classifyV0(facts) {
|
|
46
|
+
const ext = facts.externality;
|
|
47
|
+
// Unbound / missing externality: we cannot even name the bucket. Honest
|
|
48
|
+
// unresolved; enforcementFrom() lifts this to irreversible for admission.
|
|
49
|
+
if (ext === undefined || ext === null) {
|
|
50
|
+
return { realized: 'unresolved', reason: 'RM_V0_UNBOUND' };
|
|
51
|
+
}
|
|
52
|
+
// Any external effect -> irreversible; upper bound unless finality is settled
|
|
53
|
+
// AND target binding verified. v0 has no external-compensable path, so the
|
|
54
|
+
// legacy 'external-reversible' taxonomy value is treated exactly as
|
|
55
|
+
// 'external-irreversible' here (no compensable branch, no reversal-right read).
|
|
56
|
+
if (ext === 'external-irreversible' || ext === 'external-reversible') {
|
|
57
|
+
const finalityVerified = facts.finalityState === 'settled';
|
|
58
|
+
const definitive = finalityVerified && facts.targetBindingVerified === true;
|
|
59
|
+
return definitive
|
|
60
|
+
? { realized: 'irreversible', reason: 'RM_V0_EXTERNAL_DEFINITIVE' }
|
|
61
|
+
: { realized: 'irreversible', label: 'upper_bound', reason: 'RM_V0_EXTERNAL_UPPER_BOUND' };
|
|
62
|
+
}
|
|
63
|
+
// internal -> irreversible in v0. A self-declared recovery_mechanism_ref is
|
|
64
|
+
// self-attestation and derives NOTHING about the class (v4 s4 / s4.1), the same
|
|
65
|
+
// conflation removed for the external path: a producer cannot mint
|
|
66
|
+
// compensability by naming a rollback path. v0 has no verifier-checked recovery
|
|
67
|
+
// evidence (recoveryMechanismRef, recoveryController, recovery_deadline, and
|
|
68
|
+
// evidence_status are all producer-declared, and the only verifier-supplied
|
|
69
|
+
// signal, targetBindingVerified, is the external resource-confirmation check).
|
|
70
|
+
// internal-compensable requires a verified recovery result that v0 defers, so
|
|
71
|
+
// internal is treated exactly as an external-irreversible effect: irreversible
|
|
72
|
+
// plus upper_bound, unless finality is settled AND the binding is verified. v0
|
|
73
|
+
// therefore has no compensable outcome at all, the sound and consistent
|
|
74
|
+
// position across both externality axes.
|
|
75
|
+
if (ext === 'internal') {
|
|
76
|
+
const finalityVerified = facts.finalityState === 'settled';
|
|
77
|
+
const definitive = finalityVerified && facts.targetBindingVerified === true;
|
|
78
|
+
return definitive
|
|
79
|
+
? { realized: 'irreversible', reason: 'RM_V0_INTERNAL_DEFINITIVE' }
|
|
80
|
+
: { realized: 'irreversible', label: 'upper_bound', reason: 'RM_V0_INTERNAL_UPPER_BOUND' };
|
|
81
|
+
}
|
|
82
|
+
// Unreachable for typed inputs. Any unrecognized externality bucket is
|
|
83
|
+
// treated as unbound and fails to unresolved (never a compensable fall-open).
|
|
84
|
+
return { realized: 'unresolved', reason: 'RM_V0_UNBOUND' };
|
|
85
|
+
}
|
|
86
|
+
/** The v0 profile function object. */
|
|
87
|
+
export const reversibilityMappingV0 = {
|
|
88
|
+
id: REVERSIBILITY_MAPPING_V0_ID,
|
|
89
|
+
classify: classifyV0,
|
|
90
|
+
};
|
|
91
|
+
/** The AUTHORITATIVE, canonical content of the v0 profile (v4 section 4): its
|
|
92
|
+
* input schema, mapping rules, reason-code set, and time semantics, and nothing
|
|
93
|
+
* else. No runtime, diagnostic, or human-facing metadata (display name,
|
|
94
|
+
* comments, timestamps) is included, so those can change without changing the
|
|
95
|
+
* content digest. This object is what the digest commits to. */
|
|
96
|
+
export const REVERSIBILITY_PROFILE_V0_CONTENT = {
|
|
97
|
+
profile_id: REVERSIBILITY_MAPPING_V0_ID,
|
|
98
|
+
input_fields: ['externality', 'finality_state', 'target_binding_verified'],
|
|
99
|
+
externality_values: ['internal', 'external-reversible', 'external-irreversible'],
|
|
100
|
+
finality_values: ['settled', 'pending', 'expired', 'contradicted'],
|
|
101
|
+
external_compensable: false,
|
|
102
|
+
internal_compensable: false,
|
|
103
|
+
// label is present only when the rule emits one (upper_bound). No null values
|
|
104
|
+
// anywhere in the content: the three SDK JCS implementations disagree on
|
|
105
|
+
// null-valued keys (TS and Python drop them, Go keeps them), so a null-free
|
|
106
|
+
// content is the parity-safe form that canonicalizes byte-identically.
|
|
107
|
+
// v0 has no compensable outcome: both compensable strengths require verified
|
|
108
|
+
// recovery evidence that v0 defers, and a self-declared recovery_mechanism_ref
|
|
109
|
+
// derives nothing, so it is not a classification input.
|
|
110
|
+
rules: [
|
|
111
|
+
{ id: 'unbound', when: 'externality_absent', realized: 'unresolved', reason: 'RM_V0_UNBOUND' },
|
|
112
|
+
{ id: 'external_definitive', when: 'externality_external AND finality_settled AND target_binding_verified', realized: 'irreversible', reason: 'RM_V0_EXTERNAL_DEFINITIVE' },
|
|
113
|
+
{ id: 'external_upper_bound', when: 'externality_external AND NOT(finality_settled AND target_binding_verified)', realized: 'irreversible', label: 'upper_bound', reason: 'RM_V0_EXTERNAL_UPPER_BOUND' },
|
|
114
|
+
{ id: 'internal_definitive', when: 'externality_internal AND finality_settled AND target_binding_verified', realized: 'irreversible', reason: 'RM_V0_INTERNAL_DEFINITIVE' },
|
|
115
|
+
{ id: 'internal_upper_bound', when: 'externality_internal AND NOT(finality_settled AND target_binding_verified)', realized: 'irreversible', label: 'upper_bound', reason: 'RM_V0_INTERNAL_UPPER_BOUND' },
|
|
116
|
+
],
|
|
117
|
+
reason_codes: ['RM_V0_UNBOUND', 'RM_V0_EXTERNAL_DEFINITIVE', 'RM_V0_EXTERNAL_UPPER_BOUND', 'RM_V0_INTERNAL_DEFINITIVE', 'RM_V0_INTERNAL_UPPER_BOUND'],
|
|
118
|
+
time_semantics: { clock_skew_ms: 0, finality_source: 'bound_input', target_binding_source: 'verifier_supplied' },
|
|
119
|
+
schema_version: 'v0',
|
|
120
|
+
};
|
|
121
|
+
/** Domain-separated content digest of a profile (v4 section 4):
|
|
122
|
+
* SHA-256( UTF8("APS-REVERSIBILITY-PROFILE-V0") || 0x00 || UTF8(JCS(content)) ).
|
|
123
|
+
* Any language that JCS-canonicalizes the same content reproduces this byte-for-
|
|
124
|
+
* byte. */
|
|
125
|
+
export function profileContentDigest(content) {
|
|
126
|
+
const preimage = Buffer.concat([
|
|
127
|
+
Buffer.from('APS-REVERSIBILITY-PROFILE-V0', 'utf8'),
|
|
128
|
+
Buffer.from([0x00]),
|
|
129
|
+
Buffer.from(canonicalizeJCS(content), 'utf8'),
|
|
130
|
+
]);
|
|
131
|
+
return 'sha256:' + createHash('sha256').update(preimage).digest('hex');
|
|
132
|
+
}
|
|
133
|
+
/** The v0 profile's content digest. */
|
|
134
|
+
export const REVERSIBILITY_MAPPING_V0_DIGEST = profileContentDigest(REVERSIBILITY_PROFILE_V0_CONTENT);
|
|
135
|
+
/** The immutable content-addressed registry (v4 section 4). It never mutates an
|
|
136
|
+
* existing (id, digest) pair; a change to a profile's content yields a new
|
|
137
|
+
* digest and is a NEW profile with a new id. Resolving an unknown id, or an
|
|
138
|
+
* (id, digest) mismatch, is a DISTINCT failure, never a silent fallback. */
|
|
139
|
+
const PROFILE_REGISTRY = new Map([
|
|
140
|
+
[REVERSIBILITY_MAPPING_V0_ID, {
|
|
141
|
+
profile: reversibilityMappingV0,
|
|
142
|
+
content: REVERSIBILITY_PROFILE_V0_CONTENT,
|
|
143
|
+
digest: REVERSIBILITY_MAPPING_V0_DIGEST,
|
|
144
|
+
metadata: {
|
|
145
|
+
display_name: 'Reversibility mapping v0',
|
|
146
|
+
description: 'Fail-closed v0 classifier: internal and external both resolve to irreversible; no compensable outcome, since verified recovery evidence is deferred.',
|
|
147
|
+
},
|
|
148
|
+
}],
|
|
149
|
+
]);
|
|
150
|
+
/** Resolve a mapping profile function by its classification_profile_id. Returns
|
|
151
|
+
* undefined for an unknown id (a distinct event from unbound facts). */
|
|
152
|
+
export function getClassificationProfile(id) {
|
|
153
|
+
return PROFILE_REGISTRY.get(id)?.profile;
|
|
154
|
+
}
|
|
155
|
+
/** Resolve the full registered profile (function, content, digest, metadata). */
|
|
156
|
+
export function getRegisteredProfile(id) {
|
|
157
|
+
return PROFILE_REGISTRY.get(id);
|
|
158
|
+
}
|
|
159
|
+
/** The registry's content digest for a profile id, or undefined if unknown. */
|
|
160
|
+
export function getProfileDigest(id) {
|
|
161
|
+
return PROFILE_REGISTRY.get(id)?.digest;
|
|
162
|
+
}
|
|
163
|
+
/** The set of registered profile ids. */
|
|
164
|
+
export function registeredProfileIds() {
|
|
165
|
+
return [...PROFILE_REGISTRY.keys()];
|
|
166
|
+
}
|
|
167
|
+
/** Check a declared profile id + content digest against the immutable registry.
|
|
168
|
+
* An id not in the registry fails unknown_profile; a known id whose declared
|
|
169
|
+
* digest does not equal the registry digest fails digest_mismatch. */
|
|
170
|
+
export function verifyProfileBinding(id, declaredDigest) {
|
|
171
|
+
const registered = PROFILE_REGISTRY.get(id);
|
|
172
|
+
if (registered === undefined) {
|
|
173
|
+
return { ok: false, reason: 'unknown_profile', classificationProfileId: id };
|
|
174
|
+
}
|
|
175
|
+
if (declaredDigest !== registered.digest) {
|
|
176
|
+
return { ok: false, reason: 'digest_mismatch', classificationProfileId: id, declaredDigest, expectedDigest: registered.digest };
|
|
177
|
+
}
|
|
178
|
+
return { ok: true, digest: registered.digest };
|
|
179
|
+
}
|
|
180
|
+
/** Map an RAPV0 externality onto the value used for EffectFacts.externality.
|
|
181
|
+
* 'none' or absent -> undefined (unbound), which classifies unresolved.
|
|
182
|
+
* internal -> internal. Both external buckets -> external-irreversible: the
|
|
183
|
+
* legacy 'external-reversible' taxonomy carried a stronger meaning than v0
|
|
184
|
+
* grants, so it is NOT passed through as-is; mapping it to external-irreversible
|
|
185
|
+
* keeps it from being a backdoor into compensability (v4 s4/s10). This is a pure
|
|
186
|
+
* adapter, not an import-and-couple. */
|
|
187
|
+
export function rapvExternalityToEffectFacts(externality) {
|
|
188
|
+
if (externality == null || externality === 'none')
|
|
189
|
+
return undefined;
|
|
190
|
+
if (externality === 'internal')
|
|
191
|
+
return 'internal';
|
|
192
|
+
return 'external-irreversible';
|
|
193
|
+
}
|
|
194
|
+
/** Derive the classifier externality bucket from an element's raw facts (v4
|
|
195
|
+
* section 4.1). internal -> internal. external -> external-irreversible,
|
|
196
|
+
* ALWAYS, in v0: there is no verified reversal right in v0, so no external
|
|
197
|
+
* effect reaches external-reversible, and a self-declared recovery_mechanism_ref
|
|
198
|
+
* derives NOTHING about the class. recovery_mechanism_ref remains a carried raw
|
|
199
|
+
* fact and still informs the INTERNAL branch's observable-recovery test; it is
|
|
200
|
+
* simply not evidence of reversibility for an external effect. Downstream, an
|
|
201
|
+
* external effect classifies to irreversible + upper_bound (target binding is
|
|
202
|
+
* not verified in v0), never bare irreversible and never compensable. */
|
|
203
|
+
function deriveExternality(element) {
|
|
204
|
+
if (element.effect_scope === 'internal')
|
|
205
|
+
return 'internal';
|
|
206
|
+
return 'external-irreversible';
|
|
207
|
+
}
|
|
208
|
+
/** Build classifier facts from an element plus verifier context. Note what is
|
|
209
|
+
* deliberately NOT supplied here: actingPrincipal and the external reversal-
|
|
210
|
+
* right attestation are the actor axis (a later step), so an external-
|
|
211
|
+
* reversible effect fails closed to irreversible under this recompute until
|
|
212
|
+
* that step supplies verified actor-axis facts. targetBindingVerified comes
|
|
213
|
+
* only from the verifier context, never from the element (hard rule). */
|
|
214
|
+
function effectFactsFromElement(element, options) {
|
|
215
|
+
return {
|
|
216
|
+
externality: deriveExternality(element),
|
|
217
|
+
recoveryController: element.recovery_controller,
|
|
218
|
+
recoveryMechanismRef: element.recovery_mechanism_ref,
|
|
219
|
+
finalityState: element.finality_state,
|
|
220
|
+
targetBindingVerified: options?.targetBindingVerified === true,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/** Recompute the realized class for one effect element. Resolves the mapping
|
|
224
|
+
* profile by classification_profile_id; an unknown id is surfaced as its own
|
|
225
|
+
* failure and is NOT classified. Otherwise runs the profile over the element's
|
|
226
|
+
* facts and returns the ClassificationResult. */
|
|
227
|
+
export function recomputeEffect(element, options) {
|
|
228
|
+
const registered = getRegisteredProfile(element.classification_profile_id);
|
|
229
|
+
if (registered === undefined) {
|
|
230
|
+
return { status: 'unknown_profile', classificationProfileId: element.classification_profile_id };
|
|
231
|
+
}
|
|
232
|
+
// Bind id to content: a declared digest that does not match the registry is a
|
|
233
|
+
// DISTINCT failure from an unknown profile, and is not classified.
|
|
234
|
+
if (element.classification_profile_digest !== registered.digest) {
|
|
235
|
+
return {
|
|
236
|
+
status: 'profile_digest_mismatch',
|
|
237
|
+
classificationProfileId: element.classification_profile_id,
|
|
238
|
+
declaredDigest: element.classification_profile_digest,
|
|
239
|
+
expectedDigest: registered.digest,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const facts = effectFactsFromElement(element, options);
|
|
243
|
+
return {
|
|
244
|
+
status: 'recomputed',
|
|
245
|
+
classificationProfileId: element.classification_profile_id,
|
|
246
|
+
result: registered.profile.classify(facts),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/** Recompute every effect in a block, per element. No folding or collapsing to
|
|
250
|
+
* a maximum here (that is the fold, a later step). */
|
|
251
|
+
export function recomputeBlock(block, options) {
|
|
252
|
+
return block.instantiated_effects.map((e) => recomputeEffect(e, options));
|
|
253
|
+
}
|
|
254
|
+
/** Verify an element's asserted cache class (if any) against the recompute.
|
|
255
|
+
* A cache is a convenience only and is never trusted: a mismatch fails. An
|
|
256
|
+
* unknown profile or a profile-digest mismatch cannot be verified and surfaces
|
|
257
|
+
* distinctly. */
|
|
258
|
+
export function verifyAssertedClass(element, options) {
|
|
259
|
+
const outcome = recomputeEffect(element, options);
|
|
260
|
+
if (outcome.status === 'unknown_profile') {
|
|
261
|
+
return { ok: false, reason: 'unknown_profile', classificationProfileId: outcome.classificationProfileId };
|
|
262
|
+
}
|
|
263
|
+
if (outcome.status === 'profile_digest_mismatch') {
|
|
264
|
+
return {
|
|
265
|
+
ok: false,
|
|
266
|
+
reason: 'profile_digest_mismatch',
|
|
267
|
+
classificationProfileId: outcome.classificationProfileId,
|
|
268
|
+
declaredDigest: outcome.declaredDigest,
|
|
269
|
+
expectedDigest: outcome.expectedDigest,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
const recomputed = outcome.result;
|
|
273
|
+
if (element.asserted_realized_class === undefined) {
|
|
274
|
+
return { ok: true, recomputed };
|
|
275
|
+
}
|
|
276
|
+
if (element.asserted_realized_class !== recomputed.realized) {
|
|
277
|
+
return { ok: false, reason: 'mismatch', asserted: element.asserted_realized_class, recomputed: recomputed.realized };
|
|
278
|
+
}
|
|
279
|
+
return { ok: true, recomputed };
|
|
280
|
+
}
|
|
281
|
+
/** SHA-256 (over strict JCS bytes) of an execution receipt. Any change to the
|
|
282
|
+
* execution receipt changes this hash, so a hash-link detects a rewrite. */
|
|
283
|
+
export function hashExecutionReceipt(receipt) {
|
|
284
|
+
return 'sha256:' + createHash('sha256').update(canonicalizeJCS(receipt)).digest('hex');
|
|
285
|
+
}
|
|
286
|
+
/** Create a reconciliation receipt hash-linked to an execution receipt and
|
|
287
|
+
* signed over its canonical body. Does not touch the execution receipt. */
|
|
288
|
+
export function createReconciliationReceipt(execution, input) {
|
|
289
|
+
const body = {
|
|
290
|
+
stage: 'reconciliation',
|
|
291
|
+
execution_receipt_hash: hashExecutionReceipt(execution),
|
|
292
|
+
action_ref: execution.action_ref,
|
|
293
|
+
realized_class: input.realized_class,
|
|
294
|
+
evidence_status: input.evidence_status,
|
|
295
|
+
reconciled_at: input.reconciled_at,
|
|
296
|
+
};
|
|
297
|
+
const value = sign(canonicalizeJCS(body), input.signerPrivateKey);
|
|
298
|
+
return { ...body, signature: { algorithm: 'Ed25519', public_key: input.signerPublicKey, value } };
|
|
299
|
+
}
|
|
300
|
+
/** The realized classes a reconciliation may refine a pending stage into.
|
|
301
|
+
* pending -> compensable and pending -> irreversible only. */
|
|
302
|
+
const MONOTONIC_RECONCILED_CLASSES = new Set([
|
|
303
|
+
'compensable',
|
|
304
|
+
'irreversible',
|
|
305
|
+
]);
|
|
306
|
+
/** Validate a reconciliation against its execution receipt. Rejects a broken
|
|
307
|
+
* hash-link (a rewritten execution receipt), an invalid signature, a stage
|
|
308
|
+
* that is not pending, and any non-monotonic realized class. */
|
|
309
|
+
export function validateTransition(execution, reconciliation) {
|
|
310
|
+
const errors = [];
|
|
311
|
+
// Hash-link integrity: the reconciliation must reference THIS execution
|
|
312
|
+
// receipt. A post-hoc rewrite of the execution receipt breaks the link.
|
|
313
|
+
if (reconciliation.execution_receipt_hash !== hashExecutionReceipt(execution)) {
|
|
314
|
+
errors.push('hash-link mismatch: reconciliation does not reference this execution receipt');
|
|
315
|
+
}
|
|
316
|
+
if (reconciliation.action_ref !== execution.action_ref) {
|
|
317
|
+
errors.push('action_ref mismatch between stages');
|
|
318
|
+
}
|
|
319
|
+
// Signature over the reconciliation body (excluding the signature block).
|
|
320
|
+
const { signature, ...body } = reconciliation;
|
|
321
|
+
if (!verify(canonicalizeJCS(body), signature.value, signature.public_key)) {
|
|
322
|
+
errors.push('reconciliation signature invalid');
|
|
323
|
+
}
|
|
324
|
+
// Monotonic transition: the execution stage is provisional (pending); the
|
|
325
|
+
// reconciliation may only refine to compensable or irreversible. Anything
|
|
326
|
+
// else is an arbitrary replacement and is rejected.
|
|
327
|
+
if (execution.evidence_status !== 'pending') {
|
|
328
|
+
errors.push('execution receipt is not in the pending stage');
|
|
329
|
+
}
|
|
330
|
+
if (!MONOTONIC_RECONCILED_CLASSES.has(reconciliation.realized_class)) {
|
|
331
|
+
errors.push(`non-monotonic realized_class '${reconciliation.realized_class}' (only compensable or irreversible refine a pending stage)`);
|
|
332
|
+
}
|
|
333
|
+
return { ok: errors.length === 0, errors };
|
|
334
|
+
}
|
|
335
|
+
/** The enforcement class that GOVERNED admission. This reads ONLY the execution
|
|
336
|
+
* receipt: the reconciliation's realized class is audit-time truth and carries
|
|
337
|
+
* no enforcement power, so a consumer cannot read the final class as the one
|
|
338
|
+
* that gated the action. */
|
|
339
|
+
export function admittedEnforcementClass(execution) {
|
|
340
|
+
return execution.admitted_enforcement_class;
|
|
341
|
+
}
|
|
342
|
+
// ══════════════════════════════════════
|
|
343
|
+
// STEP v0-2 - Effect identity and lineage (v4 section 2)
|
|
344
|
+
// ══════════════════════════════════════
|
|
345
|
+
//
|
|
346
|
+
// Every effect element carries a stable identity so precedence is defined
|
|
347
|
+
// without array position. The fold (a later step) classifies from the LATEST
|
|
348
|
+
// valid lineage state per effect_id, never from position in instantiated_effects
|
|
349
|
+
// and never from the existence of a right. This step adds and validates the
|
|
350
|
+
// identity fields only; it does not build the fold.
|
|
351
|
+
/** The signed authoritative fields of one effect state as a null-free object
|
|
352
|
+
* (v4 section 2). It commits to every signed field: effect_id, sequence,
|
|
353
|
+
* predecessor_effect_state_hash, the raw effect facts, classification_profile_id,
|
|
354
|
+
* classification_profile_digest, the evidence status, and the receipt/action
|
|
355
|
+
* binding (action_ref, action_instance_id). The asserted class is signed content
|
|
356
|
+
* and part of the state identity, so it is included when present, but it is
|
|
357
|
+
* non-authoritative for classification (a verifier recomputes). Computed
|
|
358
|
+
* verification outputs, the state hash itself, and out-of-object signatures are
|
|
359
|
+
* excluded: the builder reads only the known signed fields, so an extra property
|
|
360
|
+
* on the element object cannot enter the preimage. Only non-null fields are
|
|
361
|
+
* included, the same parity-safe rule the profile content follows, because the
|
|
362
|
+
* SDK JCS implementations diverge on null-valued keys. */
|
|
363
|
+
export function effectStatePreimage(el) {
|
|
364
|
+
const p = {
|
|
365
|
+
effect_scope: el.effect_scope,
|
|
366
|
+
effect_target_ref: el.effect_target_ref,
|
|
367
|
+
finality_state: el.finality_state,
|
|
368
|
+
evidence_status: el.evidence_status,
|
|
369
|
+
classification_profile_id: el.classification_profile_id,
|
|
370
|
+
classification_profile_digest: el.classification_profile_digest,
|
|
371
|
+
action_ref: el.action_ref,
|
|
372
|
+
action_instance_id: el.action_instance_id,
|
|
373
|
+
effect_id: el.effect_id,
|
|
374
|
+
sequence: el.sequence,
|
|
375
|
+
};
|
|
376
|
+
if (el.recovery_mechanism_ref != null)
|
|
377
|
+
p.recovery_mechanism_ref = el.recovery_mechanism_ref;
|
|
378
|
+
if (el.recovery_controller != null)
|
|
379
|
+
p.recovery_controller = el.recovery_controller;
|
|
380
|
+
if (el.recovery_deadline != null)
|
|
381
|
+
p.recovery_deadline = el.recovery_deadline;
|
|
382
|
+
if (el.predecessor_effect_state_hash != null)
|
|
383
|
+
p.predecessor_effect_state_hash = el.predecessor_effect_state_hash;
|
|
384
|
+
if (el.asserted_realized_class !== undefined)
|
|
385
|
+
p.asserted_realized_class = el.asserted_realized_class;
|
|
386
|
+
return p;
|
|
387
|
+
}
|
|
388
|
+
/** Domain-separated hash of one effect state (v4 section 2):
|
|
389
|
+
* SHA-256( UTF8("APS-REVERSIBILITY-EFFECT-STATE-V0") || 0x00 || UTF8(JCS(preimage)) )
|
|
390
|
+
* over the null-free preimage of every signed authoritative field. Chains a
|
|
391
|
+
* lineage: a later state's predecessor_effect_state_hash references this. Any
|
|
392
|
+
* language that JCS-canonicalizes the same preimage reproduces it byte-for-byte. */
|
|
393
|
+
export function hashEffectState(element) {
|
|
394
|
+
const preimage = Buffer.concat([
|
|
395
|
+
Buffer.from('APS-REVERSIBILITY-EFFECT-STATE-V0', 'utf8'),
|
|
396
|
+
Buffer.from([0x00]),
|
|
397
|
+
Buffer.from(canonicalizeJCS(effectStatePreimage(element)), 'utf8'),
|
|
398
|
+
]);
|
|
399
|
+
return 'sha256:' + createHash('sha256').update(preimage).digest('hex');
|
|
400
|
+
}
|
|
401
|
+
/** Deterministic derivation of an effect_id (v4 section 2):
|
|
402
|
+
* base64url( SHA-256( UTF8("APS-REVERSIBILITY-EFFECT-ID-V0") || 0x00 ||
|
|
403
|
+
* UTF8(JCS({action_ref, action_instance_id, local_effect_id})) ) ), where
|
|
404
|
+
* local_effect_id is unique within the receipt and STABLE across retries (an
|
|
405
|
+
* id, not a nonce). The id is a function of stable inputs, so a retry produces
|
|
406
|
+
* the same effect_id and the same lineage identity. */
|
|
407
|
+
export function deriveEffectId(action_ref, action_instance_id, local_effect_id) {
|
|
408
|
+
const preimage = Buffer.concat([
|
|
409
|
+
Buffer.from('APS-REVERSIBILITY-EFFECT-ID-V0', 'utf8'),
|
|
410
|
+
Buffer.from([0x00]),
|
|
411
|
+
Buffer.from(canonicalizeJCS({ action_ref, action_instance_id, local_effect_id }), 'utf8'),
|
|
412
|
+
]);
|
|
413
|
+
return createHash('sha256').update(preimage).digest('base64url');
|
|
414
|
+
}
|
|
415
|
+
/** Validate one effect_id's lineage, order-invariant. First removes exact
|
|
416
|
+
* duplicates (same full hash), then enforces the graph invariant. */
|
|
417
|
+
function validateOneLineage(states) {
|
|
418
|
+
// Deduplicate exact-duplicate states by full effect-state hash.
|
|
419
|
+
const byHash = new Map();
|
|
420
|
+
let duplicate_count = 0;
|
|
421
|
+
for (const s of states) {
|
|
422
|
+
const h = hashEffectState(s);
|
|
423
|
+
if (byHash.has(h))
|
|
424
|
+
duplicate_count++;
|
|
425
|
+
else
|
|
426
|
+
byHash.set(h, s);
|
|
427
|
+
}
|
|
428
|
+
const unique = [...byHash.values()];
|
|
429
|
+
// Exactly one root at sequence 0 with a null predecessor.
|
|
430
|
+
const roots = unique.filter((s) => s.predecessor_effect_state_hash === null);
|
|
431
|
+
if (roots.length > 1)
|
|
432
|
+
return { status: 'equivocation', duplicate_count };
|
|
433
|
+
if (roots.length === 0)
|
|
434
|
+
return { status: 'lineage_incomplete', duplicate_count };
|
|
435
|
+
if (roots[0].sequence !== 0)
|
|
436
|
+
return { status: 'lineage_incomplete', duplicate_count };
|
|
437
|
+
// Fork: no predecessor hash may have more than one distinct successor. This
|
|
438
|
+
// holds regardless of the successors' sequences, so a fork whose branches sit
|
|
439
|
+
// at different sequences is still a fork, not a broken link.
|
|
440
|
+
const succOfPred = new Map();
|
|
441
|
+
for (const s of unique) {
|
|
442
|
+
if (s.predecessor_effect_state_hash !== null) {
|
|
443
|
+
succOfPred.set(s.predecessor_effect_state_hash, (succOfPred.get(s.predecessor_effect_state_hash) ?? 0) + 1);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if ([...succOfPred.values()].some((c) => c > 1)) {
|
|
447
|
+
return { status: 'lineage_conflicted', duplicate_count };
|
|
448
|
+
}
|
|
449
|
+
// At most one state per sequence. A remaining collision (not from a shared
|
|
450
|
+
// predecessor, since forks were already caught) is an equivocation about the
|
|
451
|
+
// position: two states claim the same sequence with different hashes.
|
|
452
|
+
const bySeq = new Map();
|
|
453
|
+
for (const s of unique)
|
|
454
|
+
bySeq.set(s.sequence, (bySeq.get(s.sequence) ?? 0) + 1);
|
|
455
|
+
if ([...bySeq.values()].some((c) => c > 1)) {
|
|
456
|
+
return { status: 'equivocation', duplicate_count };
|
|
457
|
+
}
|
|
458
|
+
// Consecutive sequences 0..n-1 (a gap is incomplete), and each state at n>0
|
|
459
|
+
// references the hash of the state at n-1 (else the chain link is invalid).
|
|
460
|
+
const ordered = [...unique].sort((a, b) => a.sequence - b.sequence);
|
|
461
|
+
for (let i = 0; i < ordered.length; i++) {
|
|
462
|
+
if (ordered[i].sequence !== i)
|
|
463
|
+
return { status: 'lineage_incomplete', duplicate_count };
|
|
464
|
+
}
|
|
465
|
+
for (let i = 1; i < ordered.length; i++) {
|
|
466
|
+
if (ordered[i].predecessor_effect_state_hash !== hashEffectState(ordered[i - 1])) {
|
|
467
|
+
return { status: 'invalid_state', duplicate_count };
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return { status: 'ok', duplicate_count };
|
|
471
|
+
}
|
|
472
|
+
/** Validate the identity and lineage structure of a block, independent of array
|
|
473
|
+
* order (v4 section 2, corrected). Returns a TYPED status plus a duplicate_count.
|
|
474
|
+
* The block is ok only when every effect_id's lineage is ok; otherwise the
|
|
475
|
+
* status is that of the lexicographically first non-ok effect_id (deterministic).
|
|
476
|
+
* This validates identity only; the lineage-based fold reading (classify from
|
|
477
|
+
* the latest lineage state per effect_id) is the fold, not built here. */
|
|
478
|
+
export function validateEffectLineage(block) {
|
|
479
|
+
const byEffect = new Map();
|
|
480
|
+
for (const el of block.instantiated_effects) {
|
|
481
|
+
const states = byEffect.get(el.effect_id) ?? [];
|
|
482
|
+
states.push(el);
|
|
483
|
+
byEffect.set(el.effect_id, states);
|
|
484
|
+
}
|
|
485
|
+
let duplicate_count = 0;
|
|
486
|
+
let firstNonOk;
|
|
487
|
+
for (const effectId of [...byEffect.keys()].sort()) {
|
|
488
|
+
const r = validateOneLineage(byEffect.get(effectId));
|
|
489
|
+
duplicate_count += r.duplicate_count;
|
|
490
|
+
if (r.status !== 'ok' && firstNonOk === undefined)
|
|
491
|
+
firstNonOk = r.status;
|
|
492
|
+
}
|
|
493
|
+
return { status: firstNonOk ?? 'ok', duplicate_count };
|
|
494
|
+
}
|
|
495
|
+
/** The latest valid state per effect_id, but ONLY for an ok lineage. Returns
|
|
496
|
+
* undefined for any non-ok block, so a caller cannot pull a latest state from an
|
|
497
|
+
* incomplete, conflicted, equivocating, or invalid lineage. Order-invariant. */
|
|
498
|
+
export function latestValidEffectStates(block) {
|
|
499
|
+
if (validateEffectLineage(block).status !== 'ok')
|
|
500
|
+
return undefined;
|
|
501
|
+
const byEffect = new Map();
|
|
502
|
+
for (const el of block.instantiated_effects) {
|
|
503
|
+
const states = byEffect.get(el.effect_id) ?? [];
|
|
504
|
+
states.push(el);
|
|
505
|
+
byEffect.set(el.effect_id, states);
|
|
506
|
+
}
|
|
507
|
+
const latest = new Map();
|
|
508
|
+
for (const [id, states] of byEffect) {
|
|
509
|
+
latest.set(id, [...states].sort((a, b) => b.sequence - a.sequence)[0]);
|
|
510
|
+
}
|
|
511
|
+
return latest;
|
|
512
|
+
}
|
|
513
|
+
//# sourceMappingURL=reversibility-fold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reversibility-fold.js","sourceRoot":"","sources":["../../../src/core/reversibility-fold.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,sCAAsC;AACtC,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;AAC3E,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AA4BpD;;;mEAGmE;AACnE,MAAM,UAAU,eAAe,CAAC,QAAuB;IACrD,OAAO,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC9D,CAAC;AAuGD;kEACkE;AAClE,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAA;AAErE;;;;;;;;;;;;;;;;;;wDAkBwD;AACxD,MAAM,UAAU,UAAU,CAAC,KAAkB;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,CAAA;IAE7B,wEAAwE;IACxE,0EAA0E;IAC1E,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;Q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,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACxE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EffectInstantiationBlock } from '../core/reversibility-fold.js';
|
|
1
2
|
export type EvaluationMethod = 'deterministic' | 'probabilistic' | 'model_dependent' | 'hybrid';
|
|
2
3
|
export type EnvelopeVerdict = 'permit' | 'deny' | 'narrow' | 'audit';
|
|
3
4
|
export type RevocationStatus = 'active' | 'revoked';
|
|
@@ -53,6 +54,12 @@ export interface ExecutionEnvelope {
|
|
|
53
54
|
};
|
|
54
55
|
/** When the envelope was created */
|
|
55
56
|
timestamp: string;
|
|
57
|
+
/** OPTIONAL effect-instantiation block (reversibility fold, spec v2 section 3).
|
|
58
|
+
* Absent on existing receipts, which stay valid unchanged. A fold over a
|
|
59
|
+
* receipt lacking it is incomplete, never irreversible. When present the
|
|
60
|
+
* block is part of the signed body; its presence does not change any
|
|
61
|
+
* existing validation path. */
|
|
62
|
+
effect_instantiation?: EffectInstantiationBlock;
|
|
56
63
|
signature: {
|
|
57
64
|
algorithm: 'Ed25519';
|
|
58
65
|
/** Public key of the signer */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-envelope.d.ts","sourceRoot":"","sources":["../../../src/types/execution-envelope.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,eAAe,GAAG,iBAAiB,GAAG,QAAQ,CAAA;AAC/F,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AACpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEnD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,yBAAyB,CAAA;IA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E,KAAK,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,gDAAgD;AAChD,MAAM,WAAW,oBAAoB;IACnC,uBAAuB;IACvB,KAAK,EAAE,OAAO,CAAA;IACd,kCAAkC;IAClC,cAAc,EAAE,OAAO,CAAA;IACvB,mCAAmC;IACnC,uBAAuB,EAAE,OAAO,CAAA;IAChC,6BAA6B;IAC7B,gBAAgB,EAAE,OAAO,CAAA;IACzB,uDAAuD;IACvD,aAAa,EAAE,OAAO,CAAA;IACtB,yBAAyB;IACzB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB"}
|
|
1
|
+
{"version":3,"file":"execution-envelope.d.ts","sourceRoot":"","sources":["../../../src/types/execution-envelope.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAE7E,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,eAAe,GAAG,iBAAiB,GAAG,QAAQ,CAAA;AAC/F,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AACpE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEnD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,yBAAyB,CAAA;IAEjC,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAA;IACjB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB,cAAc,EAAE;QACd,4EAA4E;QAC5E,aAAa,EAAE,MAAM,CAAA;QACrB,oDAAoD;QACpD,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,oCAAoC;QACpC,sBAAsB,EAAE,MAAM,CAAA;QAC9B,0CAA0C;QAC1C,iBAAiB,EAAE,gBAAgB,CAAA;KACpC,CAAA;IAED,QAAQ,EAAE;QACR,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|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-passport-system",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Enforcement and accountability layer for AI agents. Bring your own identity (did:key, did:web, SPIFFE, OAuth, did:aps). Verifier hot path p50 = 420ns bare-metal Linux EPYC 7313P (§13.1 canonical environment per spec), 347ns AWS c7i.2xlarge, 292ns Mac M3. Gateway enforcement, monotonic narrowing, cascade revocation, Bayesian reputation, wallet binding, unified four-axis attribution primitive, per-period attribution settlement, data lifecycle, mutual authentication, Wave 1 accountability primitives (action, authority-boundary, custody, contestability, bundle), evidentiary type safety (claim/evidence registry, claim verifier with forbidden-substitution detection, contestation cascade). 4,098 tests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc && chmod +x dist/src/cli/index.js",
|
|
23
|
-
"test": "npx tsx --test tests/passport.test.ts tests/adversarial.ts tests/v2.0-integration.ts tests/contract.test.ts tests/agora.test.ts tests/values.test.ts tests/delegation.test.ts tests/attribution.test.ts tests/policy.test.ts tests/canonical.test.ts tests/coordination.test.ts tests/commerce.test.ts tests/enforcement.test.ts tests/routing.test.ts tests/did-vc.test.ts tests/a2a.test.ts tests/principal.test.ts tests/adversarial-paper.test.ts tests/property-delegation.test.ts tests/property-canonical.test.ts tests/intent.test.ts tests/reputation-authority.test.ts tests/cross-chain.test.ts tests/encrypted-messaging.test.ts tests/obligations.test.ts tests/execution-envelope.test.ts tests/adversarial-causal-chain.test.ts tests/governance.test.ts tests/feasibility.test.ts tests/identity.test.ts tests/precedent.test.ts tests/reanchor.test.ts tests/escalation.test.ts tests/oracle-witness.test.ts tests/messaging-audit.test.ts tests/policy-conflict.test.ts tests/data-source.test.ts tests/decision-semantics.test.ts tests/interop-vectors.test.ts tests/v2-bridge.test.ts tests/v2-full.test.ts tests/key-storage.test.ts tests/qntm-bridge.test.ts tests/agent-json-bridge.test.ts tests/did-resolution-conformance.test.ts tests/decision-equivalence.test.ts tests/data-lifecycle.test.ts tests/campaign7-composition.test.ts tests/entity-verification.test.ts tests/conformance.test.ts tests/governance-block.test.ts tests/aps-txt.test.ts tests/governance-360.test.ts tests/storage-backend.test.ts tests/receipt-bundle.test.ts tests/reputation-confidence.test.ts tests/governance-consumer.test.ts tests/charter.test.ts tests/institutional-governance-phase2.test.ts tests/data-source-attribution.test.ts tests/canonical-jcs.test.ts tests/temporal-spread.test.ts tests/fidelity-pressure.test.ts tests/denial-domains.test.ts tests/data-narrowing.test.ts tests/governance-posture.test.ts tests/anchor-state.test.ts tests/issuer-signature.test.ts tests/openshell-adapter.test.ts tests/attestation.test.ts tests/execution-attestation.test.ts tests/bilateral-receipt.test.ts tests/proof-namespace.test.ts tests/ecosystem-features.test.ts tests/persistent-passport.test.ts tests/security-av.test.ts tests/audit-fixes.test.ts tests/did-interop.test.ts tests/identity-bridge.test.ts tests/vc-wrapper.test.ts tests/identity-pipeline.test.ts tests/cross-protocol/sint-crossverify.test.ts tests/action-ref.test.ts tests/external-action-ref.test.ts tests/freshness.test.ts tests/evidence-grade.test.ts tests/key-rotation.test.ts tests/governance-regression.test.ts tests/posture-overlay.test.ts tests/feasibility-gateway.test.ts tests/trust-adapters.test.ts tests/evaluation-context.test.ts tests/health.test.ts tests/composio-adapter.test.ts tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts tests/ibac-adapter.test.ts tests/langchain-adapter.test.ts tests/crewai-adapter.test.ts tests/mcp-adapter.test.ts tests/a2a-adapter.test.ts tests/gonka-adapter.test.ts tests/cross-algo-mismatch.test.ts tests/credential-lifecycle.test.ts tests/behavioral-memory.test.ts tests/telemetry-scope.test.ts tests/idempotency.test.ts tests/v2/wallet-binding.test.ts tests/v2/wallet-binding-fixture.test.ts tests/v2/credential-check-policy.test.ts tests/v2/delegation-escalation.test.ts tests/v2/attribution-consent.test.ts tests/v2/attribution-integration.test.ts tests/v2/attribution-primitive.test.ts tests/v2/attribution-primitive-integration.test.ts tests/v2/build-b-fractional-weights.test.ts tests/v2/build-b-cross-language.test.ts tests/v2/build-c-settlement.test.ts tests/v2/build-c-cross-language.test.ts tests/v2/build-c-end-to-end.test.ts tests/v2/provisional-statement.test.ts tests/temporal-decay.test.ts tests/confidence-breakdown.test.ts tests/behavioral-fingerprint.test.ts tests/session-boundary.test.ts tests/probe-identity.test.ts tests/v2/cognitive-attestation/envelope.test.ts tests/v2/cognitive-attestation/verify.test.ts tests/v2/cognitive-attestation/adversarial.test.ts tests/v2/mutual-auth/handshake.test.ts tests/v2/mutual-auth/adversarial.test.ts tests/v2/mutual-auth/conformance.test.ts tests/property-bilateral-receipt.test.ts tests/v2/instruction-provenance/conformance.test.ts tests/v2/instruction-provenance/adversarial.test.ts tests/v2/identity-composition-error.test.ts tests/v2/claim-evidence-types.test.ts tests/v2/claim-verifier.test.ts tests/v2/downstream-taint.test.ts tests/v2/payment-rails/nano.test.ts tests/v2/payment-rails/governance.test.ts tests/v2/payment-rails/ap2.test.ts tests/v2/payment-rails/x402.test.ts tests/v2/payment-rails/conformance/harness.test.ts tests/v2/payment-rails/binding-harness.test.ts tests/v2/payment-rails/stripe-issuing-primitives.test.ts tests/v2/payment-rails/acp.test.ts tests/v2/payment-rails/cycles.test.ts tests/v2/payment-rails/mpp.test.ts tests/v2/payment-rails/scope-resolution.test.ts tests/v2/payment-rails/accountability-bundle.test.ts tests/v2/payment-rails/did-uri-signing.test.ts tests/v2/payment-rails/cross-receipt-chain.test.ts src/v2/accountability/__tests__/action.test.ts src/v2/accountability/__tests__/authority-boundary.test.ts src/v2/accountability/__tests__/bundle.test.ts src/v2/accountability/__tests__/contestability.test.ts src/v2/accountability/__tests__/custody.test.ts src/v2/accountability/__tests__/fixtures.test.ts src/v2/cognitive_attestation/__tests__/cognitive_attestation.test.ts src/v2/delegation/__tests__/responsibility_anchor.test.ts src/v2/memory_provenance/__tests__/memory_provenance.test.ts src/v2/cross_issuer_attestation/__tests__/cross_issuer_attestation.test.ts src/v2/behavioral_drift_window/__tests__/behavioral_drift_window.test.ts tests/tool-registry-integrity.test.ts tests/v2/transport/rfc9421/request-binding.test.ts tests/v2/verifier-hardening.test.ts tests/v2/key-resolution/resolver.test.ts src/v2/feasibility/__tests__/feasibility.test.ts tests/oauth-rfc8693-bridge.test.ts tests/conformance/conformance-negatives.test.ts tests/v2/policy-bundle/policy-bundle.test.ts src/v2/scope-registry/__tests__/scope-registry.test.ts tests/check-many-parity.test.ts tests/cross-impl/jcs-equivalence.test.ts tests/remote-signer.test.ts tests/v2/assurance/descriptor.test.ts tests/v2/audience-binding/audience-binding.test.ts tests/v2/hash-pointer/bbs-composition.test.ts tests/v2/hash-pointer/profile.test.ts tests/v2/human-oversight/human-oversight.test.ts tests/v2/offline-verifier/conformance-runner.test.ts tests/v2/offline-verifier/middleware.test.ts tests/v2/offline-verifier/verify.test.ts tests/v2/payment-rails/cycles-evidence-resolution.test.ts tests/v2/payment-rails/cycles-evidence-authority.test.ts tests/v2/revocation-enforcement.test.ts tests/v2/trust-policy/trust-policy.test.ts src/v2/context-provenance/__tests__/roundtrip.test.ts src/v2/context-provenance/__tests__/disclosure.test.ts src/v2/context-provenance/__tests__/known-answer.test.ts src/v2/context-provenance/__tests__/conformance.test.ts src/v2/context-provenance/__tests__/adversarial.test.ts src/v2/context-provenance/__tests__/parity.test.ts src/v2/context-provenance/__tests__/cross-lang-parity.test.ts tests/v2/verification-source.test.ts tests/v2/producer-attestation.test.ts tests/delegation-currency-narrowing.test.ts tests/delegation-temporal-narrowing.test.ts tests/oauth-id-jag-bridge.test.ts tests/v2/regulated-action/conformance.test.ts tests/commerce-spend-accumulation.test.ts tests/delegation-spend-unit-narrowing.test.ts tests/delegation-parent-verify.test.ts tests/commerce-currency-gate.test.ts tests/v2/composition-check/conformance.test.ts src/v2/word_handles/__tests__/word_handles.test.ts src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.ts tests/jurisdiction-selection.test.ts tests/v2/bilateral-pair/bilateral-pair.test.ts tests/evidence-bundle.test.ts tests/v2/verifier-null-guards.test.ts tests/merkle-domain-separation.test.ts tests/threshold-verify-before-count.test.ts",
|
|
23
|
+
"test": "npx tsx --test tests/passport.test.ts tests/adversarial.ts tests/v2.0-integration.ts tests/contract.test.ts tests/agora.test.ts tests/values.test.ts tests/delegation.test.ts tests/attribution.test.ts tests/policy.test.ts tests/canonical.test.ts tests/coordination.test.ts tests/commerce.test.ts tests/enforcement.test.ts tests/routing.test.ts tests/did-vc.test.ts tests/a2a.test.ts tests/principal.test.ts tests/adversarial-paper.test.ts tests/property-delegation.test.ts tests/property-canonical.test.ts tests/intent.test.ts tests/reputation-authority.test.ts tests/cross-chain.test.ts tests/encrypted-messaging.test.ts tests/obligations.test.ts tests/execution-envelope.test.ts tests/adversarial-causal-chain.test.ts tests/governance.test.ts tests/feasibility.test.ts tests/identity.test.ts tests/precedent.test.ts tests/reanchor.test.ts tests/escalation.test.ts tests/oracle-witness.test.ts tests/messaging-audit.test.ts tests/policy-conflict.test.ts tests/data-source.test.ts tests/decision-semantics.test.ts tests/interop-vectors.test.ts tests/v2-bridge.test.ts tests/v2-full.test.ts tests/key-storage.test.ts tests/qntm-bridge.test.ts tests/agent-json-bridge.test.ts tests/did-resolution-conformance.test.ts tests/decision-equivalence.test.ts tests/data-lifecycle.test.ts tests/campaign7-composition.test.ts tests/entity-verification.test.ts tests/conformance.test.ts tests/governance-block.test.ts tests/aps-txt.test.ts tests/governance-360.test.ts tests/storage-backend.test.ts tests/receipt-bundle.test.ts tests/reputation-confidence.test.ts tests/governance-consumer.test.ts tests/charter.test.ts tests/institutional-governance-phase2.test.ts tests/data-source-attribution.test.ts tests/canonical-jcs.test.ts tests/canonical-jcs-lone-surrogate.test.ts tests/temporal-spread.test.ts tests/fidelity-pressure.test.ts tests/denial-domains.test.ts tests/data-narrowing.test.ts tests/governance-posture.test.ts tests/anchor-state.test.ts tests/issuer-signature.test.ts tests/openshell-adapter.test.ts tests/attestation.test.ts tests/execution-attestation.test.ts tests/bilateral-receipt.test.ts tests/proof-namespace.test.ts tests/ecosystem-features.test.ts tests/persistent-passport.test.ts tests/security-av.test.ts tests/audit-fixes.test.ts tests/did-interop.test.ts tests/identity-bridge.test.ts tests/vc-wrapper.test.ts tests/identity-pipeline.test.ts tests/cross-protocol/sint-crossverify.test.ts tests/action-ref.test.ts tests/external-action-ref.test.ts tests/freshness.test.ts tests/evidence-grade.test.ts tests/key-rotation.test.ts tests/governance-regression.test.ts tests/posture-overlay.test.ts tests/feasibility-gateway.test.ts tests/trust-adapters.test.ts tests/evaluation-context.test.ts tests/health.test.ts tests/composio-adapter.test.ts tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts tests/ibac-adapter.test.ts tests/langchain-adapter.test.ts tests/crewai-adapter.test.ts tests/mcp-adapter.test.ts tests/a2a-adapter.test.ts tests/gonka-adapter.test.ts tests/cross-algo-mismatch.test.ts tests/credential-lifecycle.test.ts tests/behavioral-memory.test.ts tests/telemetry-scope.test.ts tests/idempotency.test.ts tests/v2/wallet-binding.test.ts tests/v2/wallet-binding-fixture.test.ts tests/v2/credential-check-policy.test.ts tests/v2/delegation-escalation.test.ts tests/v2/attribution-consent.test.ts tests/v2/attribution-integration.test.ts tests/v2/attribution-primitive.test.ts tests/v2/attribution-primitive-integration.test.ts tests/v2/build-b-fractional-weights.test.ts tests/v2/build-b-cross-language.test.ts tests/v2/build-c-settlement.test.ts tests/v2/build-c-cross-language.test.ts tests/v2/build-c-end-to-end.test.ts tests/v2/provisional-statement.test.ts tests/temporal-decay.test.ts tests/confidence-breakdown.test.ts tests/behavioral-fingerprint.test.ts tests/session-boundary.test.ts tests/probe-identity.test.ts tests/v2/cognitive-attestation/envelope.test.ts tests/v2/cognitive-attestation/verify.test.ts tests/v2/cognitive-attestation/adversarial.test.ts tests/v2/mutual-auth/handshake.test.ts tests/v2/mutual-auth/adversarial.test.ts tests/v2/mutual-auth/conformance.test.ts tests/property-bilateral-receipt.test.ts tests/v2/instruction-provenance/conformance.test.ts tests/v2/instruction-provenance/adversarial.test.ts tests/v2/identity-composition-error.test.ts tests/v2/claim-evidence-types.test.ts tests/v2/claim-verifier.test.ts tests/v2/downstream-taint.test.ts tests/v2/payment-rails/nano.test.ts tests/v2/payment-rails/governance.test.ts tests/v2/payment-rails/ap2.test.ts tests/v2/payment-rails/x402.test.ts tests/v2/payment-rails/conformance/harness.test.ts tests/v2/payment-rails/binding-harness.test.ts tests/v2/payment-rails/stripe-issuing-primitives.test.ts tests/v2/payment-rails/acp.test.ts tests/v2/payment-rails/cycles.test.ts tests/v2/payment-rails/mpp.test.ts tests/v2/payment-rails/scope-resolution.test.ts tests/v2/payment-rails/accountability-bundle.test.ts tests/v2/payment-rails/did-uri-signing.test.ts tests/v2/payment-rails/cross-receipt-chain.test.ts src/v2/accountability/__tests__/action.test.ts src/v2/accountability/__tests__/authority-boundary.test.ts src/v2/accountability/__tests__/bundle.test.ts src/v2/accountability/__tests__/contestability.test.ts src/v2/accountability/__tests__/custody.test.ts src/v2/accountability/__tests__/fixtures.test.ts src/v2/cognitive_attestation/__tests__/cognitive_attestation.test.ts src/v2/delegation/__tests__/responsibility_anchor.test.ts src/v2/memory_provenance/__tests__/memory_provenance.test.ts src/v2/cross_issuer_attestation/__tests__/cross_issuer_attestation.test.ts src/v2/behavioral_drift_window/__tests__/behavioral_drift_window.test.ts tests/tool-registry-integrity.test.ts tests/v2/transport/rfc9421/request-binding.test.ts tests/v2/verifier-hardening.test.ts tests/v2/key-resolution/resolver.test.ts src/v2/feasibility/__tests__/feasibility.test.ts tests/oauth-rfc8693-bridge.test.ts tests/conformance/conformance-negatives.test.ts tests/v2/policy-bundle/policy-bundle.test.ts src/v2/scope-registry/__tests__/scope-registry.test.ts tests/check-many-parity.test.ts tests/cross-impl/jcs-equivalence.test.ts tests/remote-signer.test.ts tests/v2/assurance/descriptor.test.ts tests/v2/audience-binding/audience-binding.test.ts tests/v2/hash-pointer/bbs-composition.test.ts tests/v2/hash-pointer/profile.test.ts tests/v2/human-oversight/human-oversight.test.ts tests/v2/offline-verifier/conformance-runner.test.ts tests/v2/offline-verifier/middleware.test.ts tests/v2/offline-verifier/verify.test.ts tests/v2/payment-rails/cycles-evidence-resolution.test.ts tests/v2/payment-rails/cycles-evidence-authority.test.ts tests/v2/revocation-enforcement.test.ts tests/v2/trust-policy/trust-policy.test.ts src/v2/context-provenance/__tests__/roundtrip.test.ts src/v2/context-provenance/__tests__/disclosure.test.ts src/v2/context-provenance/__tests__/known-answer.test.ts src/v2/context-provenance/__tests__/conformance.test.ts src/v2/context-provenance/__tests__/adversarial.test.ts src/v2/context-provenance/__tests__/parity.test.ts src/v2/context-provenance/__tests__/cross-lang-parity.test.ts tests/v2/verification-source.test.ts tests/v2/producer-attestation.test.ts tests/delegation-currency-narrowing.test.ts tests/delegation-temporal-narrowing.test.ts tests/oauth-id-jag-bridge.test.ts tests/v2/regulated-action/conformance.test.ts tests/commerce-spend-accumulation.test.ts tests/delegation-spend-unit-narrowing.test.ts tests/delegation-parent-verify.test.ts tests/commerce-currency-gate.test.ts tests/v2/composition-check/conformance.test.ts src/v2/word_handles/__tests__/word_handles.test.ts src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.ts tests/jurisdiction-selection.test.ts tests/v2/bilateral-pair/bilateral-pair.test.ts tests/evidence-bundle.test.ts tests/v2/verifier-null-guards.test.ts tests/merkle-domain-separation.test.ts tests/threshold-verify-before-count.test.ts tests/reversibility-fold.test.ts tests/reversibility-profile-parity.test.ts tests/reversibility-v0-vectors.test.ts",
|
|
24
24
|
"test:interop": "npx tsx --test tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts",
|
|
25
25
|
"test:quick": "tsx --test tests/passport.test.ts",
|
|
26
26
|
"test:fixtures": "tsx fixtures/bilateral-delegation/test-canonicalize.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"prepublishOnly": "npm run build && npm test",
|
|
31
31
|
"postversion": "if [ -f ~/aps-web/scripts/sync-project-state.mjs ]; then node ~/aps-web/scripts/sync-project-state.mjs sdk $npm_package_version; else echo 'postversion: ~/aps-web/scripts/sync-project-state.mjs not found, skipping project-state sync'; fi",
|
|
32
32
|
"postpublish": "if [ -d ~/aps-web ]; then cd ~/aps-web && node scripts/propagate.mjs --apply --skip-roadmap-build; else echo 'postpublish: ~/aps-web not found, skipping propagation'; fi",
|
|
33
|
-
"test:coverage": "npx tsx --test --experimental-test-coverage tests/passport.test.ts tests/adversarial.ts tests/v2.0-integration.ts tests/contract.test.ts tests/agora.test.ts tests/values.test.ts tests/delegation.test.ts tests/attribution.test.ts tests/policy.test.ts tests/canonical.test.ts tests/coordination.test.ts tests/commerce.test.ts tests/enforcement.test.ts tests/routing.test.ts tests/did-vc.test.ts tests/a2a.test.ts tests/principal.test.ts tests/adversarial-paper.test.ts tests/property-delegation.test.ts tests/property-canonical.test.ts tests/intent.test.ts tests/reputation-authority.test.ts tests/cross-chain.test.ts tests/encrypted-messaging.test.ts tests/obligations.test.ts tests/execution-envelope.test.ts tests/adversarial-causal-chain.test.ts tests/governance.test.ts tests/feasibility.test.ts tests/identity.test.ts tests/precedent.test.ts tests/reanchor.test.ts tests/escalation.test.ts tests/oracle-witness.test.ts tests/messaging-audit.test.ts tests/policy-conflict.test.ts tests/data-source.test.ts tests/decision-semantics.test.ts tests/interop-vectors.test.ts tests/v2-bridge.test.ts tests/v2-full.test.ts tests/key-storage.test.ts tests/qntm-bridge.test.ts tests/agent-json-bridge.test.ts tests/did-resolution-conformance.test.ts tests/decision-equivalence.test.ts tests/data-lifecycle.test.ts tests/campaign7-composition.test.ts tests/entity-verification.test.ts tests/conformance.test.ts tests/governance-block.test.ts tests/aps-txt.test.ts tests/governance-360.test.ts tests/storage-backend.test.ts tests/receipt-bundle.test.ts tests/reputation-confidence.test.ts tests/governance-consumer.test.ts tests/charter.test.ts tests/institutional-governance-phase2.test.ts tests/data-source-attribution.test.ts tests/canonical-jcs.test.ts tests/temporal-spread.test.ts tests/fidelity-pressure.test.ts tests/denial-domains.test.ts tests/data-narrowing.test.ts tests/governance-posture.test.ts tests/anchor-state.test.ts tests/issuer-signature.test.ts tests/openshell-adapter.test.ts tests/attestation.test.ts tests/execution-attestation.test.ts tests/bilateral-receipt.test.ts tests/proof-namespace.test.ts tests/ecosystem-features.test.ts tests/persistent-passport.test.ts tests/security-av.test.ts tests/audit-fixes.test.ts tests/did-interop.test.ts tests/identity-bridge.test.ts tests/vc-wrapper.test.ts tests/identity-pipeline.test.ts tests/cross-protocol/sint-crossverify.test.ts tests/action-ref.test.ts tests/external-action-ref.test.ts tests/freshness.test.ts tests/evidence-grade.test.ts tests/key-rotation.test.ts tests/governance-regression.test.ts tests/posture-overlay.test.ts tests/feasibility-gateway.test.ts tests/trust-adapters.test.ts tests/evaluation-context.test.ts tests/health.test.ts tests/composio-adapter.test.ts tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts tests/ibac-adapter.test.ts tests/langchain-adapter.test.ts tests/crewai-adapter.test.ts tests/mcp-adapter.test.ts tests/a2a-adapter.test.ts tests/gonka-adapter.test.ts tests/cross-algo-mismatch.test.ts tests/credential-lifecycle.test.ts tests/behavioral-memory.test.ts tests/telemetry-scope.test.ts tests/idempotency.test.ts tests/v2/wallet-binding.test.ts tests/v2/wallet-binding-fixture.test.ts tests/v2/credential-check-policy.test.ts tests/v2/delegation-escalation.test.ts tests/v2/attribution-consent.test.ts tests/v2/attribution-integration.test.ts tests/v2/attribution-primitive.test.ts tests/v2/attribution-primitive-integration.test.ts tests/v2/build-b-fractional-weights.test.ts tests/v2/build-b-cross-language.test.ts tests/v2/build-c-settlement.test.ts tests/v2/build-c-cross-language.test.ts tests/v2/build-c-end-to-end.test.ts tests/v2/provisional-statement.test.ts tests/temporal-decay.test.ts tests/confidence-breakdown.test.ts tests/behavioral-fingerprint.test.ts tests/session-boundary.test.ts tests/probe-identity.test.ts tests/v2/cognitive-attestation/envelope.test.ts tests/v2/cognitive-attestation/verify.test.ts tests/v2/cognitive-attestation/adversarial.test.ts tests/v2/mutual-auth/handshake.test.ts tests/v2/mutual-auth/adversarial.test.ts tests/v2/mutual-auth/conformance.test.ts tests/property-bilateral-receipt.test.ts tests/v2/instruction-provenance/conformance.test.ts tests/v2/instruction-provenance/adversarial.test.ts tests/v2/identity-composition-error.test.ts tests/v2/claim-evidence-types.test.ts tests/v2/claim-verifier.test.ts tests/v2/downstream-taint.test.ts tests/v2/payment-rails/nano.test.ts tests/v2/payment-rails/governance.test.ts tests/v2/payment-rails/ap2.test.ts tests/v2/payment-rails/x402.test.ts tests/v2/payment-rails/conformance/harness.test.ts tests/v2/payment-rails/binding-harness.test.ts tests/v2/payment-rails/stripe-issuing-primitives.test.ts tests/v2/payment-rails/acp.test.ts tests/v2/payment-rails/cycles.test.ts tests/v2/payment-rails/mpp.test.ts tests/v2/payment-rails/scope-resolution.test.ts tests/v2/payment-rails/accountability-bundle.test.ts tests/v2/payment-rails/did-uri-signing.test.ts tests/v2/payment-rails/cross-receipt-chain.test.ts src/v2/accountability/__tests__/action.test.ts src/v2/accountability/__tests__/authority-boundary.test.ts src/v2/accountability/__tests__/bundle.test.ts src/v2/accountability/__tests__/contestability.test.ts src/v2/accountability/__tests__/custody.test.ts src/v2/accountability/__tests__/fixtures.test.ts src/v2/cognitive_attestation/__tests__/cognitive_attestation.test.ts src/v2/delegation/__tests__/responsibility_anchor.test.ts src/v2/memory_provenance/__tests__/memory_provenance.test.ts src/v2/cross_issuer_attestation/__tests__/cross_issuer_attestation.test.ts src/v2/behavioral_drift_window/__tests__/behavioral_drift_window.test.ts tests/tool-registry-integrity.test.ts tests/v2/transport/rfc9421/request-binding.test.ts tests/v2/verifier-hardening.test.ts tests/v2/key-resolution/resolver.test.ts src/v2/feasibility/__tests__/feasibility.test.ts tests/oauth-rfc8693-bridge.test.ts tests/conformance/conformance-negatives.test.ts tests/v2/policy-bundle/policy-bundle.test.ts src/v2/scope-registry/__tests__/scope-registry.test.ts tests/check-many-parity.test.ts tests/cross-impl/jcs-equivalence.test.ts tests/remote-signer.test.ts tests/v2/assurance/descriptor.test.ts tests/v2/audience-binding/audience-binding.test.ts tests/v2/hash-pointer/bbs-composition.test.ts tests/v2/hash-pointer/profile.test.ts tests/v2/human-oversight/human-oversight.test.ts tests/v2/offline-verifier/conformance-runner.test.ts tests/v2/offline-verifier/middleware.test.ts tests/v2/offline-verifier/verify.test.ts tests/v2/payment-rails/cycles-evidence-resolution.test.ts tests/v2/payment-rails/cycles-evidence-authority.test.ts tests/v2/revocation-enforcement.test.ts tests/v2/trust-policy/trust-policy.test.ts src/v2/context-provenance/__tests__/roundtrip.test.ts src/v2/context-provenance/__tests__/disclosure.test.ts src/v2/context-provenance/__tests__/known-answer.test.ts src/v2/context-provenance/__tests__/conformance.test.ts src/v2/context-provenance/__tests__/adversarial.test.ts src/v2/context-provenance/__tests__/parity.test.ts src/v2/context-provenance/__tests__/cross-lang-parity.test.ts tests/v2/verification-source.test.ts tests/v2/producer-attestation.test.ts tests/delegation-currency-narrowing.test.ts tests/delegation-temporal-narrowing.test.ts tests/oauth-id-jag-bridge.test.ts tests/v2/regulated-action/conformance.test.ts tests/commerce-spend-accumulation.test.ts tests/delegation-spend-unit-narrowing.test.ts tests/delegation-parent-verify.test.ts tests/commerce-currency-gate.test.ts tests/v2/composition-check/conformance.test.ts src/v2/word_handles/__tests__/word_handles.test.ts src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.ts tests/jurisdiction-selection.test.ts tests/v2/bilateral-pair/bilateral-pair.test.ts tests/evidence-bundle.test.ts"
|
|
33
|
+
"test:coverage": "npx tsx --test --experimental-test-coverage tests/passport.test.ts tests/adversarial.ts tests/v2.0-integration.ts tests/contract.test.ts tests/agora.test.ts tests/values.test.ts tests/delegation.test.ts tests/attribution.test.ts tests/policy.test.ts tests/canonical.test.ts tests/coordination.test.ts tests/commerce.test.ts tests/enforcement.test.ts tests/routing.test.ts tests/did-vc.test.ts tests/a2a.test.ts tests/principal.test.ts tests/adversarial-paper.test.ts tests/property-delegation.test.ts tests/property-canonical.test.ts tests/intent.test.ts tests/reputation-authority.test.ts tests/cross-chain.test.ts tests/encrypted-messaging.test.ts tests/obligations.test.ts tests/execution-envelope.test.ts tests/adversarial-causal-chain.test.ts tests/governance.test.ts tests/feasibility.test.ts tests/identity.test.ts tests/precedent.test.ts tests/reanchor.test.ts tests/escalation.test.ts tests/oracle-witness.test.ts tests/messaging-audit.test.ts tests/policy-conflict.test.ts tests/data-source.test.ts tests/decision-semantics.test.ts tests/interop-vectors.test.ts tests/v2-bridge.test.ts tests/v2-full.test.ts tests/key-storage.test.ts tests/qntm-bridge.test.ts tests/agent-json-bridge.test.ts tests/did-resolution-conformance.test.ts tests/decision-equivalence.test.ts tests/data-lifecycle.test.ts tests/campaign7-composition.test.ts tests/entity-verification.test.ts tests/conformance.test.ts tests/governance-block.test.ts tests/aps-txt.test.ts tests/governance-360.test.ts tests/storage-backend.test.ts tests/receipt-bundle.test.ts tests/reputation-confidence.test.ts tests/governance-consumer.test.ts tests/charter.test.ts tests/institutional-governance-phase2.test.ts tests/data-source-attribution.test.ts tests/canonical-jcs.test.ts tests/canonical-jcs-lone-surrogate.test.ts tests/temporal-spread.test.ts tests/fidelity-pressure.test.ts tests/denial-domains.test.ts tests/data-narrowing.test.ts tests/governance-posture.test.ts tests/anchor-state.test.ts tests/issuer-signature.test.ts tests/openshell-adapter.test.ts tests/attestation.test.ts tests/execution-attestation.test.ts tests/bilateral-receipt.test.ts tests/proof-namespace.test.ts tests/ecosystem-features.test.ts tests/persistent-passport.test.ts tests/security-av.test.ts tests/audit-fixes.test.ts tests/did-interop.test.ts tests/identity-bridge.test.ts tests/vc-wrapper.test.ts tests/identity-pipeline.test.ts tests/cross-protocol/sint-crossverify.test.ts tests/action-ref.test.ts tests/external-action-ref.test.ts tests/freshness.test.ts tests/evidence-grade.test.ts tests/key-rotation.test.ts tests/governance-regression.test.ts tests/posture-overlay.test.ts tests/feasibility-gateway.test.ts tests/trust-adapters.test.ts tests/evaluation-context.test.ts tests/health.test.ts tests/composio-adapter.test.ts tests/interop/ietf-envelope.test.ts tests/interop/signet-combined.test.ts tests/interop/moltrust-attestation.test.ts tests/interop/cross-protocol-vectors.test.ts tests/interop/receipt-chaining.test.ts tests/ibac-adapter.test.ts tests/langchain-adapter.test.ts tests/crewai-adapter.test.ts tests/mcp-adapter.test.ts tests/a2a-adapter.test.ts tests/gonka-adapter.test.ts tests/cross-algo-mismatch.test.ts tests/credential-lifecycle.test.ts tests/behavioral-memory.test.ts tests/telemetry-scope.test.ts tests/idempotency.test.ts tests/v2/wallet-binding.test.ts tests/v2/wallet-binding-fixture.test.ts tests/v2/credential-check-policy.test.ts tests/v2/delegation-escalation.test.ts tests/v2/attribution-consent.test.ts tests/v2/attribution-integration.test.ts tests/v2/attribution-primitive.test.ts tests/v2/attribution-primitive-integration.test.ts tests/v2/build-b-fractional-weights.test.ts tests/v2/build-b-cross-language.test.ts tests/v2/build-c-settlement.test.ts tests/v2/build-c-cross-language.test.ts tests/v2/build-c-end-to-end.test.ts tests/v2/provisional-statement.test.ts tests/temporal-decay.test.ts tests/confidence-breakdown.test.ts tests/behavioral-fingerprint.test.ts tests/session-boundary.test.ts tests/probe-identity.test.ts tests/v2/cognitive-attestation/envelope.test.ts tests/v2/cognitive-attestation/verify.test.ts tests/v2/cognitive-attestation/adversarial.test.ts tests/v2/mutual-auth/handshake.test.ts tests/v2/mutual-auth/adversarial.test.ts tests/v2/mutual-auth/conformance.test.ts tests/property-bilateral-receipt.test.ts tests/v2/instruction-provenance/conformance.test.ts tests/v2/instruction-provenance/adversarial.test.ts tests/v2/identity-composition-error.test.ts tests/v2/claim-evidence-types.test.ts tests/v2/claim-verifier.test.ts tests/v2/downstream-taint.test.ts tests/v2/payment-rails/nano.test.ts tests/v2/payment-rails/governance.test.ts tests/v2/payment-rails/ap2.test.ts tests/v2/payment-rails/x402.test.ts tests/v2/payment-rails/conformance/harness.test.ts tests/v2/payment-rails/binding-harness.test.ts tests/v2/payment-rails/stripe-issuing-primitives.test.ts tests/v2/payment-rails/acp.test.ts tests/v2/payment-rails/cycles.test.ts tests/v2/payment-rails/mpp.test.ts tests/v2/payment-rails/scope-resolution.test.ts tests/v2/payment-rails/accountability-bundle.test.ts tests/v2/payment-rails/did-uri-signing.test.ts tests/v2/payment-rails/cross-receipt-chain.test.ts src/v2/accountability/__tests__/action.test.ts src/v2/accountability/__tests__/authority-boundary.test.ts src/v2/accountability/__tests__/bundle.test.ts src/v2/accountability/__tests__/contestability.test.ts src/v2/accountability/__tests__/custody.test.ts src/v2/accountability/__tests__/fixtures.test.ts src/v2/cognitive_attestation/__tests__/cognitive_attestation.test.ts src/v2/delegation/__tests__/responsibility_anchor.test.ts src/v2/memory_provenance/__tests__/memory_provenance.test.ts src/v2/cross_issuer_attestation/__tests__/cross_issuer_attestation.test.ts src/v2/behavioral_drift_window/__tests__/behavioral_drift_window.test.ts tests/tool-registry-integrity.test.ts tests/v2/transport/rfc9421/request-binding.test.ts tests/v2/verifier-hardening.test.ts tests/v2/key-resolution/resolver.test.ts src/v2/feasibility/__tests__/feasibility.test.ts tests/oauth-rfc8693-bridge.test.ts tests/conformance/conformance-negatives.test.ts tests/v2/policy-bundle/policy-bundle.test.ts src/v2/scope-registry/__tests__/scope-registry.test.ts tests/check-many-parity.test.ts tests/cross-impl/jcs-equivalence.test.ts tests/remote-signer.test.ts tests/v2/assurance/descriptor.test.ts tests/v2/audience-binding/audience-binding.test.ts tests/v2/hash-pointer/bbs-composition.test.ts tests/v2/hash-pointer/profile.test.ts tests/v2/human-oversight/human-oversight.test.ts tests/v2/offline-verifier/conformance-runner.test.ts tests/v2/offline-verifier/middleware.test.ts tests/v2/offline-verifier/verify.test.ts tests/v2/payment-rails/cycles-evidence-resolution.test.ts tests/v2/payment-rails/cycles-evidence-authority.test.ts tests/v2/revocation-enforcement.test.ts tests/v2/trust-policy/trust-policy.test.ts src/v2/context-provenance/__tests__/roundtrip.test.ts src/v2/context-provenance/__tests__/disclosure.test.ts src/v2/context-provenance/__tests__/known-answer.test.ts src/v2/context-provenance/__tests__/conformance.test.ts src/v2/context-provenance/__tests__/adversarial.test.ts src/v2/context-provenance/__tests__/parity.test.ts src/v2/context-provenance/__tests__/cross-lang-parity.test.ts tests/v2/verification-source.test.ts tests/v2/producer-attestation.test.ts tests/delegation-currency-narrowing.test.ts tests/delegation-temporal-narrowing.test.ts tests/oauth-id-jag-bridge.test.ts tests/v2/regulated-action/conformance.test.ts tests/commerce-spend-accumulation.test.ts tests/delegation-spend-unit-narrowing.test.ts tests/delegation-parent-verify.test.ts tests/commerce-currency-gate.test.ts tests/v2/composition-check/conformance.test.ts src/v2/word_handles/__tests__/word_handles.test.ts src/v2/read_fidelity_receipt/__tests__/read_fidelity_receipt.test.ts tests/jurisdiction-selection.test.ts tests/v2/bilateral-pair/bilateral-pair.test.ts tests/evidence-bundle.test.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"libsodium-wrappers": "^0.8.4",
|