@sentropic/h2a 0.1.0 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/abc.d.ts +199 -0
- package/dist/abc.d.ts.map +1 -0
- package/dist/abc.js +268 -0
- package/dist/abc.js.map +1 -0
- package/dist/artifacts.d.ts +10 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +147 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/authority.d.ts +21 -0
- package/dist/authority.d.ts.map +1 -0
- package/dist/authority.js +73 -0
- package/dist/authority.js.map +1 -0
- package/dist/canonical.d.ts +3 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +38 -0
- package/dist/canonical.js.map +1 -0
- package/dist/contractual.d.ts +52 -0
- package/dist/contractual.d.ts.map +1 -0
- package/dist/contractual.js +126 -0
- package/dist/contractual.js.map +1 -0
- package/dist/escalation.d.ts +40 -0
- package/dist/escalation.d.ts.map +1 -0
- package/dist/escalation.js +114 -0
- package/dist/escalation.js.map +1 -0
- package/dist/fixtures-index.d.ts +16 -0
- package/dist/fixtures-index.d.ts.map +1 -0
- package/dist/fixtures-index.js +11 -0
- package/dist/fixtures-index.js.map +1 -0
- package/dist/governance-boundary.d.ts +118 -0
- package/dist/governance-boundary.d.ts.map +1 -0
- package/dist/governance-boundary.js +143 -0
- package/dist/governance-boundary.js.map +1 -0
- package/dist/index.d.ts +23 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/journal.d.ts +37 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +73 -0
- package/dist/journal.js.map +1 -0
- package/dist/multi-human.d.ts +106 -0
- package/dist/multi-human.d.ts.map +1 -0
- package/dist/multi-human.js +116 -0
- package/dist/multi-human.js.map +1 -0
- package/dist/policy-precedence.d.ts +50 -0
- package/dist/policy-precedence.d.ts.map +1 -0
- package/dist/policy-precedence.js +98 -0
- package/dist/policy-precedence.js.map +1 -0
- package/dist/signature.d.ts +8 -0
- package/dist/signature.d.ts.map +1 -0
- package/dist/signature.js +39 -0
- package/dist/signature.js.map +1 -0
- package/dist/types.d.ts +105 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +12 -1
- package/dist/types.js.map +1 -1
- package/fixtures/authority.json +1 -0
- package/fixtures/contract.json +1 -0
- package/fixtures/enforcement-plan.json +1 -0
- package/fixtures/engagement.json +1 -0
- package/fixtures/mandate.json +1 -0
- package/fixtures/manifest.json +38 -0
- package/fixtures/policy.json +1 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -6,6 +6,17 @@ Current bootstrap surface:
|
|
|
6
6
|
|
|
7
7
|
- envelope creation and validation
|
|
8
8
|
- negotiation state guards
|
|
9
|
+
- artifact type guards for CONTRACT, POLICY, ENGAGEMENT, AMENDMENT, MANDATE, AUTHORITY, SIGNATURE, ENFORCEMENT_PLAN
|
|
10
|
+
- contractual artifact profiles + strict audit helpers for CONTRACT / POLICY / ENGAGEMENT
|
|
11
|
+
- escalation target resolution against ENFORCEMENT_PLAN routes
|
|
12
|
+
- ABC model compatibility profiles + audit helper for enterprise / ecosystem / government-citizen mappings
|
|
13
|
+
- policy precedence profiles for ABC contexts, with explicit escalation rather than a hidden V1 resolver
|
|
14
|
+
- multi-human mode taxonomy + selector for peer, delegated, shared-engagement, federated, consortium, and public-authority flows
|
|
15
|
+
- governance boundary classification for protocol / policy / implementation items
|
|
16
|
+
- canonical JSON + SHA-256 hashing
|
|
17
|
+
- ed25519 canonical signing and verification
|
|
18
|
+
- append-only journal entries and chain verification
|
|
19
|
+
- authority matrix for role/artifact signing rights
|
|
9
20
|
- canonical protocol constants
|
|
10
21
|
|
|
11
22
|
Repository: <https://github.com/rhanka/h2a>
|
package/dist/abc.d.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { type H2AArtifactKind, type H2APolicyAdoptionMode, type H2ARole } from "./types.js";
|
|
2
|
+
import { type H2AEscalationAuthorityKind } from "./escalation.js";
|
|
3
|
+
export declare const H2A_ABC_MODEL_IDS: readonly ["A_ENTERPRISE", "B_ECOSYSTEM", "C_GOVERNMENT_CITIZEN"];
|
|
4
|
+
export declare const H2A_ABC_MODEL_CAPABILITIES: readonly ["scope-first-class", "policy-first-class", "contract-engagement-separation", "mandated-signature", "deterministic-negotiation", "scope-authority-escalation", "external-authority", "controlled-disclosure", "policy-precedence", "recurring-obligations", "recourse", "jurisdiction"];
|
|
5
|
+
export type H2AAbcModelId = (typeof H2A_ABC_MODEL_IDS)[number];
|
|
6
|
+
export type H2AAbcTrack = "A" | "B" | "C";
|
|
7
|
+
export type H2AAbcTopology = "enterprise-hierarchy" | "peer-federation" | "public-authority";
|
|
8
|
+
export type H2AAbcModelCapability = (typeof H2A_ABC_MODEL_CAPABILITIES)[number];
|
|
9
|
+
export type H2AAbcModelCapabilityStatus = "shipped" | "partial" | "deferred";
|
|
10
|
+
export interface H2AAbcModelCapabilityDescriptor {
|
|
11
|
+
readonly capability: H2AAbcModelCapability;
|
|
12
|
+
readonly status: H2AAbcModelCapabilityStatus;
|
|
13
|
+
readonly evidence: string;
|
|
14
|
+
readonly gap?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface H2AAbcModelProfileDescriptor {
|
|
17
|
+
readonly id: H2AAbcModelId;
|
|
18
|
+
readonly track: H2AAbcTrack;
|
|
19
|
+
readonly label: string;
|
|
20
|
+
readonly topology: H2AAbcTopology;
|
|
21
|
+
readonly requiredRoles: readonly H2ARole[];
|
|
22
|
+
readonly requiredArtifactKinds: readonly H2AArtifactKind[];
|
|
23
|
+
readonly requiredPolicyAdoptionModes: readonly H2APolicyAdoptionMode[];
|
|
24
|
+
readonly escalationAuthorityKinds: readonly H2AEscalationAuthorityKind[];
|
|
25
|
+
readonly capabilities: readonly H2AAbcModelCapabilityDescriptor[];
|
|
26
|
+
}
|
|
27
|
+
export interface H2AAbcModelCompatibilityResult {
|
|
28
|
+
readonly ok: boolean;
|
|
29
|
+
readonly ready: boolean;
|
|
30
|
+
readonly modelId?: H2AAbcModelId;
|
|
31
|
+
readonly label?: string;
|
|
32
|
+
readonly issues: readonly string[];
|
|
33
|
+
readonly gaps: readonly string[];
|
|
34
|
+
readonly shipped: readonly H2AAbcModelCapability[];
|
|
35
|
+
readonly partial: readonly H2AAbcModelCapability[];
|
|
36
|
+
readonly deferred: readonly H2AAbcModelCapability[];
|
|
37
|
+
}
|
|
38
|
+
export declare const H2A_ABC_MODEL_PROFILES: Readonly<{
|
|
39
|
+
readonly A_ENTERPRISE: Readonly<{
|
|
40
|
+
id: "A_ENTERPRISE";
|
|
41
|
+
track: "A";
|
|
42
|
+
label: "A - traditional enterprise";
|
|
43
|
+
topology: "enterprise-hierarchy";
|
|
44
|
+
requiredRoles: readonly ["PRINCIPAL", "EXECUTIF", "CONDUCTOR", "AGENTS", "CONTROL", "MANDATAIRE"];
|
|
45
|
+
requiredArtifactKinds: readonly ["CONTRACT", "POLICY", "ENGAGEMENT", "MANDATE", "AUTHORITY", "SIGNATURE", "ENFORCEMENT_PLAN"];
|
|
46
|
+
requiredPolicyAdoptionModes: readonly ["ratified", "contractual", "imposed", "acknowledged"];
|
|
47
|
+
escalationAuthorityKinds: readonly ["PRINCIPAL", "EXECUTIF", "QUORUM", "CONTROL", "EXTERNAL_AUTHORITY", "RECOURSE"];
|
|
48
|
+
capabilities: readonly [{
|
|
49
|
+
readonly capability: "scope-first-class";
|
|
50
|
+
readonly status: "shipped";
|
|
51
|
+
readonly evidence: "roles, artifacts, negotiations, and escalations carry scope";
|
|
52
|
+
}, {
|
|
53
|
+
readonly capability: "policy-first-class";
|
|
54
|
+
readonly status: "shipped";
|
|
55
|
+
readonly evidence: "POLICY is a core artifact with adoption mode and source authority";
|
|
56
|
+
}, {
|
|
57
|
+
readonly capability: "contract-engagement-separation";
|
|
58
|
+
readonly status: "shipped";
|
|
59
|
+
readonly evidence: "DEC-039 contractual artifact profiles are executable";
|
|
60
|
+
}, {
|
|
61
|
+
readonly capability: "mandated-signature";
|
|
62
|
+
readonly status: "shipped";
|
|
63
|
+
readonly evidence: "MANDATE/AUTHORITY/SIGNATURE are core artifacts and signing matrix is enforced";
|
|
64
|
+
}, {
|
|
65
|
+
readonly capability: "deterministic-negotiation";
|
|
66
|
+
readonly status: "shipped";
|
|
67
|
+
readonly evidence: "NEGOTIATION ledger, canonical hashes, signatures, and stabilization are implemented";
|
|
68
|
+
}, {
|
|
69
|
+
readonly capability: "scope-authority-escalation";
|
|
70
|
+
readonly status: "shipped";
|
|
71
|
+
readonly evidence: "DEC-040 resolves escalation target by scope/channel/trigger/domain";
|
|
72
|
+
}, {
|
|
73
|
+
readonly capability: "external-authority";
|
|
74
|
+
readonly status: "shipped";
|
|
75
|
+
readonly evidence: "DEC-040 exposes EXTERNAL_AUTHORITY as an escalation authority kind";
|
|
76
|
+
}, {
|
|
77
|
+
readonly capability: "controlled-disclosure";
|
|
78
|
+
readonly status: "partial";
|
|
79
|
+
readonly evidence: "CONTROL roles and evidence hashes exist";
|
|
80
|
+
readonly gap: "controlled disclosure still lacks standard redaction/evidence-package limits";
|
|
81
|
+
}, {
|
|
82
|
+
readonly capability: "recurring-obligations";
|
|
83
|
+
readonly status: "partial";
|
|
84
|
+
readonly evidence: "CONTRACT can carry obligations and ENGAGEMENT can execute work";
|
|
85
|
+
readonly gap: "recurring obligations are identified but not yet a first-class schedule/schema";
|
|
86
|
+
}, {
|
|
87
|
+
readonly capability: "recourse";
|
|
88
|
+
readonly status: "partial";
|
|
89
|
+
readonly evidence: "RECOURSE is an escalation authority kind";
|
|
90
|
+
readonly gap: "recourse has routing vocabulary but no adjudication lifecycle";
|
|
91
|
+
}, H2AAbcModelCapabilityDescriptor];
|
|
92
|
+
}>;
|
|
93
|
+
readonly B_ECOSYSTEM: Readonly<{
|
|
94
|
+
id: "B_ECOSYSTEM";
|
|
95
|
+
track: "B";
|
|
96
|
+
label: "B - multi-organization ecosystem";
|
|
97
|
+
topology: "peer-federation";
|
|
98
|
+
requiredRoles: readonly ["PRINCIPAL", "EXECUTIF", "CONDUCTOR", "AGENTS", "CONTROL", "MANDATAIRE"];
|
|
99
|
+
requiredArtifactKinds: readonly ["CONTRACT", "POLICY", "ENGAGEMENT", "MANDATE", "AUTHORITY", "SIGNATURE", "ENFORCEMENT_PLAN"];
|
|
100
|
+
requiredPolicyAdoptionModes: readonly ["ratified", "contractual", "acknowledged"];
|
|
101
|
+
escalationAuthorityKinds: readonly ["PRINCIPAL", "EXECUTIF", "QUORUM", "CONTROL", "EXTERNAL_AUTHORITY", "RECOURSE"];
|
|
102
|
+
capabilities: readonly [{
|
|
103
|
+
readonly capability: "scope-first-class";
|
|
104
|
+
readonly status: "shipped";
|
|
105
|
+
readonly evidence: "roles, artifacts, negotiations, and escalations carry scope";
|
|
106
|
+
}, {
|
|
107
|
+
readonly capability: "policy-first-class";
|
|
108
|
+
readonly status: "shipped";
|
|
109
|
+
readonly evidence: "POLICY is a core artifact with adoption mode and source authority";
|
|
110
|
+
}, {
|
|
111
|
+
readonly capability: "contract-engagement-separation";
|
|
112
|
+
readonly status: "shipped";
|
|
113
|
+
readonly evidence: "DEC-039 contractual artifact profiles are executable";
|
|
114
|
+
}, {
|
|
115
|
+
readonly capability: "mandated-signature";
|
|
116
|
+
readonly status: "shipped";
|
|
117
|
+
readonly evidence: "MANDATE/AUTHORITY/SIGNATURE are core artifacts and signing matrix is enforced";
|
|
118
|
+
}, {
|
|
119
|
+
readonly capability: "deterministic-negotiation";
|
|
120
|
+
readonly status: "shipped";
|
|
121
|
+
readonly evidence: "NEGOTIATION ledger, canonical hashes, signatures, and stabilization are implemented";
|
|
122
|
+
}, {
|
|
123
|
+
readonly capability: "scope-authority-escalation";
|
|
124
|
+
readonly status: "shipped";
|
|
125
|
+
readonly evidence: "DEC-040 resolves escalation target by scope/channel/trigger/domain";
|
|
126
|
+
}, {
|
|
127
|
+
readonly capability: "external-authority";
|
|
128
|
+
readonly status: "shipped";
|
|
129
|
+
readonly evidence: "DEC-040 exposes EXTERNAL_AUTHORITY as an escalation authority kind";
|
|
130
|
+
}, {
|
|
131
|
+
readonly capability: "controlled-disclosure";
|
|
132
|
+
readonly status: "partial";
|
|
133
|
+
readonly evidence: "hashes and references can support evidence packages";
|
|
134
|
+
readonly gap: "controlled disclosure across partners lacks a standard evidence-package profile";
|
|
135
|
+
}, {
|
|
136
|
+
readonly capability: "recourse";
|
|
137
|
+
readonly status: "partial";
|
|
138
|
+
readonly evidence: "RECOURSE and QUORUM targets can be declared in ENFORCEMENT_PLAN";
|
|
139
|
+
readonly gap: "recourse/deadlock handling is routable but not procedurally specified";
|
|
140
|
+
}, H2AAbcModelCapabilityDescriptor];
|
|
141
|
+
}>;
|
|
142
|
+
readonly C_GOVERNMENT_CITIZEN: Readonly<{
|
|
143
|
+
id: "C_GOVERNMENT_CITIZEN";
|
|
144
|
+
track: "C";
|
|
145
|
+
label: "C - government and citizen ecosystem";
|
|
146
|
+
topology: "public-authority";
|
|
147
|
+
requiredRoles: readonly ["PRINCIPAL", "EXECUTIF", "CONDUCTOR", "AGENTS", "CONTROL", "MANDATAIRE"];
|
|
148
|
+
requiredArtifactKinds: readonly ["CONTRACT", "POLICY", "ENGAGEMENT", "MANDATE", "AUTHORITY", "SIGNATURE", "ENFORCEMENT_PLAN"];
|
|
149
|
+
requiredPolicyAdoptionModes: readonly ["imposed", "acknowledged", "ratified"];
|
|
150
|
+
escalationAuthorityKinds: readonly ["PRINCIPAL", "EXECUTIF", "QUORUM", "CONTROL", "EXTERNAL_AUTHORITY", "RECOURSE"];
|
|
151
|
+
capabilities: readonly [{
|
|
152
|
+
readonly capability: "scope-first-class";
|
|
153
|
+
readonly status: "shipped";
|
|
154
|
+
readonly evidence: "roles, artifacts, negotiations, and escalations carry scope";
|
|
155
|
+
}, {
|
|
156
|
+
readonly capability: "policy-first-class";
|
|
157
|
+
readonly status: "shipped";
|
|
158
|
+
readonly evidence: "POLICY is a core artifact with adoption mode and source authority";
|
|
159
|
+
}, {
|
|
160
|
+
readonly capability: "contract-engagement-separation";
|
|
161
|
+
readonly status: "shipped";
|
|
162
|
+
readonly evidence: "DEC-039 contractual artifact profiles are executable";
|
|
163
|
+
}, {
|
|
164
|
+
readonly capability: "mandated-signature";
|
|
165
|
+
readonly status: "shipped";
|
|
166
|
+
readonly evidence: "MANDATE/AUTHORITY/SIGNATURE are core artifacts and signing matrix is enforced";
|
|
167
|
+
}, {
|
|
168
|
+
readonly capability: "deterministic-negotiation";
|
|
169
|
+
readonly status: "shipped";
|
|
170
|
+
readonly evidence: "NEGOTIATION ledger, canonical hashes, signatures, and stabilization are implemented";
|
|
171
|
+
}, {
|
|
172
|
+
readonly capability: "scope-authority-escalation";
|
|
173
|
+
readonly status: "shipped";
|
|
174
|
+
readonly evidence: "DEC-040 resolves escalation target by scope/channel/trigger/domain";
|
|
175
|
+
}, {
|
|
176
|
+
readonly capability: "external-authority";
|
|
177
|
+
readonly status: "shipped";
|
|
178
|
+
readonly evidence: "DEC-040 exposes EXTERNAL_AUTHORITY as an escalation authority kind";
|
|
179
|
+
}, {
|
|
180
|
+
readonly capability: "recourse";
|
|
181
|
+
readonly status: "partial";
|
|
182
|
+
readonly evidence: "RECOURSE is a first-class escalation authority kind";
|
|
183
|
+
readonly gap: "recourse routing exists but appeal/adjudication lifecycle remains open";
|
|
184
|
+
}, {
|
|
185
|
+
readonly capability: "jurisdiction";
|
|
186
|
+
readonly status: "partial";
|
|
187
|
+
readonly evidence: "scope can encode territorial or sectoral boundaries";
|
|
188
|
+
readonly gap: "jurisdiction is represented by scope strings, not yet by a structured schema";
|
|
189
|
+
}, {
|
|
190
|
+
readonly capability: "controlled-disclosure";
|
|
191
|
+
readonly status: "partial";
|
|
192
|
+
readonly evidence: "hashes and references can support minimized proofs";
|
|
193
|
+
readonly gap: "controlled disclosure for public authority evidence is not yet standardized";
|
|
194
|
+
}, H2AAbcModelCapabilityDescriptor];
|
|
195
|
+
}>;
|
|
196
|
+
}>;
|
|
197
|
+
export declare function getAbcModelProfile(modelId: string): H2AAbcModelProfileDescriptor | undefined;
|
|
198
|
+
export declare function auditAbcModelCompatibility(modelId: string): H2AAbcModelCompatibilityResult;
|
|
199
|
+
//# sourceMappingURL=abc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abc.d.ts","sourceRoot":"","sources":["../src/abc.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,OAAO,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,iBAAiB,CAAC;AAGzB,eAAO,MAAM,iBAAiB,kEAIpB,CAAC;AAEX,eAAO,MAAM,0BAA0B,kSAa7B,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,MAAM,MAAM,WAAW,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAC1C,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,iBAAiB,GACjB,kBAAkB,CAAC;AACvB,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9C,MAAM,MAAM,2BAA2B,GACnC,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QA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E,MAAM,GACd,8BAA8B,CAmEhC"}
|
package/dist/abc.js
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { H2A_ARTIFACT_KINDS, H2A_POLICY_ADOPTION_MODES, H2A_ROLES } from "./types.js";
|
|
2
|
+
import { H2A_ESCALATION_AUTHORITY_KINDS } from "./escalation.js";
|
|
3
|
+
import { H2A_POLICY_PRECEDENCE_PROFILES } from "./policy-precedence.js";
|
|
4
|
+
export const H2A_ABC_MODEL_IDS = [
|
|
5
|
+
"A_ENTERPRISE",
|
|
6
|
+
"B_ECOSYSTEM",
|
|
7
|
+
"C_GOVERNMENT_CITIZEN"
|
|
8
|
+
];
|
|
9
|
+
export const H2A_ABC_MODEL_CAPABILITIES = [
|
|
10
|
+
"scope-first-class",
|
|
11
|
+
"policy-first-class",
|
|
12
|
+
"contract-engagement-separation",
|
|
13
|
+
"mandated-signature",
|
|
14
|
+
"deterministic-negotiation",
|
|
15
|
+
"scope-authority-escalation",
|
|
16
|
+
"external-authority",
|
|
17
|
+
"controlled-disclosure",
|
|
18
|
+
"policy-precedence",
|
|
19
|
+
"recurring-obligations",
|
|
20
|
+
"recourse",
|
|
21
|
+
"jurisdiction"
|
|
22
|
+
];
|
|
23
|
+
const ALL_ARTIFACTS = [
|
|
24
|
+
"CONTRACT",
|
|
25
|
+
"POLICY",
|
|
26
|
+
"ENGAGEMENT",
|
|
27
|
+
"MANDATE",
|
|
28
|
+
"AUTHORITY",
|
|
29
|
+
"SIGNATURE",
|
|
30
|
+
"ENFORCEMENT_PLAN"
|
|
31
|
+
];
|
|
32
|
+
const ALL_ROLES = [
|
|
33
|
+
"PRINCIPAL",
|
|
34
|
+
"EXECUTIF",
|
|
35
|
+
"CONDUCTOR",
|
|
36
|
+
"AGENTS",
|
|
37
|
+
"CONTROL",
|
|
38
|
+
"MANDATAIRE"
|
|
39
|
+
];
|
|
40
|
+
const ALL_SCOPE_AUTHORITIES = [
|
|
41
|
+
"PRINCIPAL",
|
|
42
|
+
"EXECUTIF",
|
|
43
|
+
"QUORUM",
|
|
44
|
+
"CONTROL",
|
|
45
|
+
"EXTERNAL_AUTHORITY",
|
|
46
|
+
"RECOURSE"
|
|
47
|
+
];
|
|
48
|
+
const ALL_POLICY_ADOPTION_MODES = [
|
|
49
|
+
"ratified",
|
|
50
|
+
"contractual",
|
|
51
|
+
"imposed",
|
|
52
|
+
"acknowledged"
|
|
53
|
+
];
|
|
54
|
+
const CONSENSUAL_POLICY_ADOPTION_MODES = [
|
|
55
|
+
"ratified",
|
|
56
|
+
"contractual",
|
|
57
|
+
"acknowledged"
|
|
58
|
+
];
|
|
59
|
+
const PUBLIC_POLICY_ADOPTION_MODES = [
|
|
60
|
+
"imposed",
|
|
61
|
+
"acknowledged",
|
|
62
|
+
"ratified"
|
|
63
|
+
];
|
|
64
|
+
const BASE_SHIPPED_CAPABILITIES = [
|
|
65
|
+
{
|
|
66
|
+
capability: "scope-first-class",
|
|
67
|
+
status: "shipped",
|
|
68
|
+
evidence: "roles, artifacts, negotiations, and escalations carry scope"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
capability: "policy-first-class",
|
|
72
|
+
status: "shipped",
|
|
73
|
+
evidence: "POLICY is a core artifact with adoption mode and source authority"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
capability: "contract-engagement-separation",
|
|
77
|
+
status: "shipped",
|
|
78
|
+
evidence: "DEC-039 contractual artifact profiles are executable"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
capability: "mandated-signature",
|
|
82
|
+
status: "shipped",
|
|
83
|
+
evidence: "MANDATE/AUTHORITY/SIGNATURE are core artifacts and signing matrix is enforced"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
capability: "deterministic-negotiation",
|
|
87
|
+
status: "shipped",
|
|
88
|
+
evidence: "NEGOTIATION ledger, canonical hashes, signatures, and stabilization are implemented"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
capability: "scope-authority-escalation",
|
|
92
|
+
status: "shipped",
|
|
93
|
+
evidence: "DEC-040 resolves escalation target by scope/channel/trigger/domain"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
capability: "external-authority",
|
|
97
|
+
status: "shipped",
|
|
98
|
+
evidence: "DEC-040 exposes EXTERNAL_AUTHORITY as an escalation authority kind"
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
function policyPrecedenceCapability(modelId) {
|
|
102
|
+
const profile = H2A_POLICY_PRECEDENCE_PROFILES[modelId];
|
|
103
|
+
return {
|
|
104
|
+
capability: "policy-precedence",
|
|
105
|
+
status: "partial",
|
|
106
|
+
evidence: `policy precedence profiles are declared (${profile.orderedTiers.join(" > ")})`,
|
|
107
|
+
gap: "policy precedence profiles are declared, but there is no V1 resolver; conflicts escalate instead of selecting a hidden winner"
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export const H2A_ABC_MODEL_PROFILES = Object.freeze({
|
|
111
|
+
A_ENTERPRISE: Object.freeze({
|
|
112
|
+
id: "A_ENTERPRISE",
|
|
113
|
+
track: "A",
|
|
114
|
+
label: "A - traditional enterprise",
|
|
115
|
+
topology: "enterprise-hierarchy",
|
|
116
|
+
requiredRoles: ALL_ROLES,
|
|
117
|
+
requiredArtifactKinds: ALL_ARTIFACTS,
|
|
118
|
+
requiredPolicyAdoptionModes: ALL_POLICY_ADOPTION_MODES,
|
|
119
|
+
escalationAuthorityKinds: ALL_SCOPE_AUTHORITIES,
|
|
120
|
+
capabilities: [
|
|
121
|
+
...BASE_SHIPPED_CAPABILITIES,
|
|
122
|
+
{
|
|
123
|
+
capability: "controlled-disclosure",
|
|
124
|
+
status: "partial",
|
|
125
|
+
evidence: "CONTROL roles and evidence hashes exist",
|
|
126
|
+
gap: "controlled disclosure still lacks standard redaction/evidence-package limits"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
capability: "recurring-obligations",
|
|
130
|
+
status: "partial",
|
|
131
|
+
evidence: "CONTRACT can carry obligations and ENGAGEMENT can execute work",
|
|
132
|
+
gap: "recurring obligations are identified but not yet a first-class schedule/schema"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
capability: "recourse",
|
|
136
|
+
status: "partial",
|
|
137
|
+
evidence: "RECOURSE is an escalation authority kind",
|
|
138
|
+
gap: "recourse has routing vocabulary but no adjudication lifecycle"
|
|
139
|
+
},
|
|
140
|
+
policyPrecedenceCapability("A_ENTERPRISE")
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
B_ECOSYSTEM: Object.freeze({
|
|
144
|
+
id: "B_ECOSYSTEM",
|
|
145
|
+
track: "B",
|
|
146
|
+
label: "B - multi-organization ecosystem",
|
|
147
|
+
topology: "peer-federation",
|
|
148
|
+
requiredRoles: ALL_ROLES,
|
|
149
|
+
requiredArtifactKinds: ALL_ARTIFACTS,
|
|
150
|
+
requiredPolicyAdoptionModes: CONSENSUAL_POLICY_ADOPTION_MODES,
|
|
151
|
+
escalationAuthorityKinds: ALL_SCOPE_AUTHORITIES,
|
|
152
|
+
capabilities: [
|
|
153
|
+
...BASE_SHIPPED_CAPABILITIES,
|
|
154
|
+
{
|
|
155
|
+
capability: "controlled-disclosure",
|
|
156
|
+
status: "partial",
|
|
157
|
+
evidence: "hashes and references can support evidence packages",
|
|
158
|
+
gap: "controlled disclosure across partners lacks a standard evidence-package profile"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
capability: "recourse",
|
|
162
|
+
status: "partial",
|
|
163
|
+
evidence: "RECOURSE and QUORUM targets can be declared in ENFORCEMENT_PLAN",
|
|
164
|
+
gap: "recourse/deadlock handling is routable but not procedurally specified"
|
|
165
|
+
},
|
|
166
|
+
policyPrecedenceCapability("B_ECOSYSTEM")
|
|
167
|
+
]
|
|
168
|
+
}),
|
|
169
|
+
C_GOVERNMENT_CITIZEN: Object.freeze({
|
|
170
|
+
id: "C_GOVERNMENT_CITIZEN",
|
|
171
|
+
track: "C",
|
|
172
|
+
label: "C - government and citizen ecosystem",
|
|
173
|
+
topology: "public-authority",
|
|
174
|
+
requiredRoles: ALL_ROLES,
|
|
175
|
+
requiredArtifactKinds: ALL_ARTIFACTS,
|
|
176
|
+
requiredPolicyAdoptionModes: PUBLIC_POLICY_ADOPTION_MODES,
|
|
177
|
+
escalationAuthorityKinds: ALL_SCOPE_AUTHORITIES,
|
|
178
|
+
capabilities: [
|
|
179
|
+
...BASE_SHIPPED_CAPABILITIES,
|
|
180
|
+
{
|
|
181
|
+
capability: "recourse",
|
|
182
|
+
status: "partial",
|
|
183
|
+
evidence: "RECOURSE is a first-class escalation authority kind",
|
|
184
|
+
gap: "recourse routing exists but appeal/adjudication lifecycle remains open"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
capability: "jurisdiction",
|
|
188
|
+
status: "partial",
|
|
189
|
+
evidence: "scope can encode territorial or sectoral boundaries",
|
|
190
|
+
gap: "jurisdiction is represented by scope strings, not yet by a structured schema"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
capability: "controlled-disclosure",
|
|
194
|
+
status: "partial",
|
|
195
|
+
evidence: "hashes and references can support minimized proofs",
|
|
196
|
+
gap: "controlled disclosure for public authority evidence is not yet standardized"
|
|
197
|
+
},
|
|
198
|
+
policyPrecedenceCapability("C_GOVERNMENT_CITIZEN")
|
|
199
|
+
]
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
function missingValues(values, allowed) {
|
|
203
|
+
return values.filter((value) => !allowed.includes(value));
|
|
204
|
+
}
|
|
205
|
+
function collectByStatus(capabilities, status) {
|
|
206
|
+
return capabilities
|
|
207
|
+
.filter((entry) => entry.status === status)
|
|
208
|
+
.map((entry) => entry.capability);
|
|
209
|
+
}
|
|
210
|
+
export function getAbcModelProfile(modelId) {
|
|
211
|
+
if (!H2A_ABC_MODEL_IDS.includes(modelId)) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
return H2A_ABC_MODEL_PROFILES[modelId];
|
|
215
|
+
}
|
|
216
|
+
export function auditAbcModelCompatibility(modelId) {
|
|
217
|
+
const profile = getAbcModelProfile(modelId);
|
|
218
|
+
if (!profile) {
|
|
219
|
+
return {
|
|
220
|
+
ok: false,
|
|
221
|
+
ready: false,
|
|
222
|
+
issues: [`unknown ABC model: ${modelId}`],
|
|
223
|
+
gaps: [],
|
|
224
|
+
shipped: [],
|
|
225
|
+
partial: [],
|
|
226
|
+
deferred: []
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
const issues = [];
|
|
230
|
+
const missingRoles = missingValues(profile.requiredRoles, H2A_ROLES);
|
|
231
|
+
const missingArtifacts = missingValues(profile.requiredArtifactKinds, H2A_ARTIFACT_KINDS);
|
|
232
|
+
const missingAdoptionModes = missingValues(profile.requiredPolicyAdoptionModes, H2A_POLICY_ADOPTION_MODES);
|
|
233
|
+
const missingAuthorityKinds = missingValues(profile.escalationAuthorityKinds, H2A_ESCALATION_AUTHORITY_KINDS);
|
|
234
|
+
const missingCapabilities = missingValues(profile.capabilities.map((entry) => entry.capability), H2A_ABC_MODEL_CAPABILITIES);
|
|
235
|
+
if (missingRoles.length > 0) {
|
|
236
|
+
issues.push(`unknown roles: ${missingRoles.join(", ")}`);
|
|
237
|
+
}
|
|
238
|
+
if (missingArtifacts.length > 0) {
|
|
239
|
+
issues.push(`unknown artifact kinds: ${missingArtifacts.join(", ")}`);
|
|
240
|
+
}
|
|
241
|
+
if (missingAdoptionModes.length > 0) {
|
|
242
|
+
issues.push(`unknown policy adoption modes: ${missingAdoptionModes.join(", ")}`);
|
|
243
|
+
}
|
|
244
|
+
if (missingAuthorityKinds.length > 0) {
|
|
245
|
+
issues.push(`unknown escalation authority kinds: ${missingAuthorityKinds.join(", ")}`);
|
|
246
|
+
}
|
|
247
|
+
if (missingCapabilities.length > 0) {
|
|
248
|
+
issues.push(`unknown ABC capabilities: ${missingCapabilities.join(", ")}`);
|
|
249
|
+
}
|
|
250
|
+
const shipped = collectByStatus(profile.capabilities, "shipped");
|
|
251
|
+
const partial = collectByStatus(profile.capabilities, "partial");
|
|
252
|
+
const deferred = collectByStatus(profile.capabilities, "deferred");
|
|
253
|
+
const gaps = profile.capabilities
|
|
254
|
+
.filter((entry) => entry.status !== "shipped")
|
|
255
|
+
.map((entry) => `${entry.capability}: ${entry.gap ?? entry.evidence}`);
|
|
256
|
+
return {
|
|
257
|
+
ok: issues.length === 0,
|
|
258
|
+
ready: issues.length === 0 && partial.length === 0 && deferred.length === 0,
|
|
259
|
+
modelId: profile.id,
|
|
260
|
+
label: profile.label,
|
|
261
|
+
issues,
|
|
262
|
+
gaps,
|
|
263
|
+
shipped,
|
|
264
|
+
partial,
|
|
265
|
+
deferred
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=abc.js.map
|
package/dist/abc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abc.js","sourceRoot":"","sources":["../src/abc.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,SAAS,EAIV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,8BAA8B,EAE/B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,cAAc;IACd,aAAa;IACb,sBAAsB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,mBAAmB;IACnB,oBAAoB;IACpB,gCAAgC;IAChC,oBAAoB;IACpB,2BAA2B;IAC3B,4BAA4B;IAC5B,oBAAoB;IACpB,uBAAuB;IACvB,mBAAmB;IACnB,uBAAuB;IACvB,UAAU;IACV,cAAc;CACN,CAAC;AA8CX,MAAM,aAAa,GAAG;IACpB,UAAU;IACV,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,WAAW;IACX,WAAW;IACX,kBAAkB;CAC2B,CAAC;AAEhD,MAAM,SAAS,G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EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,GAAG,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEzE,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC3E,OAAO,EAAE,OAAO,CAAC,EAAE;QACnB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM;QACN,IAAI;QACJ,OAAO;QACP,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type H2AAmendment, type H2AAuthority, type H2AContract, type H2AEnforcementPlan, type H2AEngagement, type H2AMandate, type H2APolicy, type H2ASignature } from "./types.js";
|
|
2
|
+
export declare function isSignature(value: unknown): value is H2ASignature;
|
|
3
|
+
export declare function isContract(value: unknown): value is H2AContract;
|
|
4
|
+
export declare function isPolicy(value: unknown): value is H2APolicy;
|
|
5
|
+
export declare function isEngagement(value: unknown): value is H2AEngagement;
|
|
6
|
+
export declare function isAmendment(value: unknown): value is H2AAmendment;
|
|
7
|
+
export declare function isMandate(value: unknown): value is H2AMandate;
|
|
8
|
+
export declare function isAuthority(value: unknown): value is H2AAuthority;
|
|
9
|
+
export declare function isEnforcementPlan(value: unknown): value is H2AEnforcementPlan;
|
|
10
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EAEd,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAsBpB,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAOjE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAY/D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAa3D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAiBnE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAcjE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAU7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAmBjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAS7E"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { H2A_ARTIFACT_KINDS, H2A_AUTHORITY_KINDS, H2A_POLICY_ADOPTION_MODES, H2A_ROLES } from "./types.js";
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null;
|
|
4
|
+
}
|
|
5
|
+
function isStringArray(value) {
|
|
6
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
7
|
+
}
|
|
8
|
+
function isArrayOf(value, check) {
|
|
9
|
+
return Array.isArray(value) && value.every((entry) => check(entry));
|
|
10
|
+
}
|
|
11
|
+
function isRole(value) {
|
|
12
|
+
return typeof value === "string" && H2A_ROLES.includes(value);
|
|
13
|
+
}
|
|
14
|
+
function isArtifactKind(value) {
|
|
15
|
+
return typeof value === "string" && H2A_ARTIFACT_KINDS.includes(value);
|
|
16
|
+
}
|
|
17
|
+
export function isSignature(value) {
|
|
18
|
+
return (isRecord(value) &&
|
|
19
|
+
typeof value.by === "string" &&
|
|
20
|
+
typeof value.alg === "string" &&
|
|
21
|
+
typeof value.value === "string");
|
|
22
|
+
}
|
|
23
|
+
export function isContract(value) {
|
|
24
|
+
if (!isRecord(value))
|
|
25
|
+
return false;
|
|
26
|
+
return (value.kind === "CONTRACT" &&
|
|
27
|
+
typeof value.id === "string" &&
|
|
28
|
+
isStringArray(value.parties) &&
|
|
29
|
+
typeof value.scope === "string" &&
|
|
30
|
+
Array.isArray(value.clauses) &&
|
|
31
|
+
isStringArray(value.policies) &&
|
|
32
|
+
isStringArray(value.engagements) &&
|
|
33
|
+
isArrayOf(value.signatures, isSignature));
|
|
34
|
+
}
|
|
35
|
+
export function isPolicy(value) {
|
|
36
|
+
if (!isRecord(value))
|
|
37
|
+
return false;
|
|
38
|
+
return (value.kind === "POLICY" &&
|
|
39
|
+
typeof value.id === "string" &&
|
|
40
|
+
typeof value.scope === "string" &&
|
|
41
|
+
typeof value.rule === "string" &&
|
|
42
|
+
typeof value.sourceAuthority === "string" &&
|
|
43
|
+
typeof value.adoptionMode === "string" &&
|
|
44
|
+
H2A_POLICY_ADOPTION_MODES.includes(value.adoptionMode));
|
|
45
|
+
}
|
|
46
|
+
export function isEngagement(value) {
|
|
47
|
+
if (!isRecord(value))
|
|
48
|
+
return false;
|
|
49
|
+
if (value.kind !== "ENGAGEMENT")
|
|
50
|
+
return false;
|
|
51
|
+
if (typeof value.id !== "string")
|
|
52
|
+
return false;
|
|
53
|
+
if (typeof value.scope !== "string")
|
|
54
|
+
return false;
|
|
55
|
+
if (!isRecord(value.charter))
|
|
56
|
+
return false;
|
|
57
|
+
if (!Array.isArray(value.roleBindings))
|
|
58
|
+
return false;
|
|
59
|
+
for (const binding of value.roleBindings) {
|
|
60
|
+
if (!isRecord(binding))
|
|
61
|
+
return false;
|
|
62
|
+
if (!isRole(binding.role))
|
|
63
|
+
return false;
|
|
64
|
+
if (typeof binding.instance !== "string")
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return (isStringArray(value.controls) &&
|
|
68
|
+
isStringArray(value.policies) &&
|
|
69
|
+
Array.isArray(value.successCriteria));
|
|
70
|
+
}
|
|
71
|
+
export function isAmendment(value) {
|
|
72
|
+
if (!isRecord(value))
|
|
73
|
+
return false;
|
|
74
|
+
if (value.kind !== "AMENDMENT")
|
|
75
|
+
return false;
|
|
76
|
+
if (typeof value.id !== "string")
|
|
77
|
+
return false;
|
|
78
|
+
if (!isArtifactKind(value.targetKind))
|
|
79
|
+
return false;
|
|
80
|
+
if (typeof value.targetId !== "string")
|
|
81
|
+
return false;
|
|
82
|
+
if (typeof value.baseArtifactHash !== "string")
|
|
83
|
+
return false;
|
|
84
|
+
if (!Array.isArray(value.changes))
|
|
85
|
+
return false;
|
|
86
|
+
for (const change of value.changes) {
|
|
87
|
+
if (!isRecord(change))
|
|
88
|
+
return false;
|
|
89
|
+
if (typeof change.op !== "string")
|
|
90
|
+
return false;
|
|
91
|
+
if (typeof change.path !== "string")
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
return isArrayOf(value.signatures, isSignature);
|
|
95
|
+
}
|
|
96
|
+
export function isMandate(value) {
|
|
97
|
+
if (!isRecord(value))
|
|
98
|
+
return false;
|
|
99
|
+
return (value.kind === "MANDATE" &&
|
|
100
|
+
typeof value.id === "string" &&
|
|
101
|
+
typeof value.instance === "string" &&
|
|
102
|
+
isRole(value.role) &&
|
|
103
|
+
typeof value.scope === "string" &&
|
|
104
|
+
isStringArray(value.rights));
|
|
105
|
+
}
|
|
106
|
+
export function isAuthority(value) {
|
|
107
|
+
if (!isRecord(value))
|
|
108
|
+
return false;
|
|
109
|
+
if (value.kind !== "AUTHORITY")
|
|
110
|
+
return false;
|
|
111
|
+
if (typeof value.id !== "string")
|
|
112
|
+
return false;
|
|
113
|
+
if (typeof value.authorityKind !== "string")
|
|
114
|
+
return false;
|
|
115
|
+
if (!H2A_AUTHORITY_KINDS.includes(value.authorityKind)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (!isStringArray(value.members))
|
|
119
|
+
return false;
|
|
120
|
+
if (value.authorityKind === "quorum") {
|
|
121
|
+
if (typeof value.threshold !== "number")
|
|
122
|
+
return false;
|
|
123
|
+
if (!Number.isInteger(value.threshold) || value.threshold < 1)
|
|
124
|
+
return false;
|
|
125
|
+
if (value.threshold > value.members.length)
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
export function isEnforcementPlan(value) {
|
|
131
|
+
if (!isRecord(value))
|
|
132
|
+
return false;
|
|
133
|
+
if (value.kind !== "ENFORCEMENT_PLAN")
|
|
134
|
+
return false;
|
|
135
|
+
if (typeof value.id !== "string")
|
|
136
|
+
return false;
|
|
137
|
+
if (typeof value.scope !== "string")
|
|
138
|
+
return false;
|
|
139
|
+
if (!Array.isArray(value.controls))
|
|
140
|
+
return false;
|
|
141
|
+
if (!Array.isArray(value.escalations))
|
|
142
|
+
return false;
|
|
143
|
+
if (!Array.isArray(value.triggers))
|
|
144
|
+
return false;
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=artifacts.js.map
|