@parmanasystems/governance 1.56.0 → 1.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +411 -114
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,49 +1,288 @@
|
|
|
1
1
|
# @parmanasystems/governance
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Governance lifecycle infrastructure for deterministic policy versioning, validation, bundling, and release management.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@parmanasystems/governance)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Overview
|
|
10
|
+
|
|
11
|
+
`@parmanasystems/governance` provides the governance lifecycle layer for Parmana Systems.
|
|
12
|
+
|
|
13
|
+
It manages:
|
|
14
|
+
|
|
15
|
+
- policy creation
|
|
16
|
+
- policy validation
|
|
17
|
+
- immutable policy lineage
|
|
18
|
+
- governance versioning
|
|
19
|
+
- deterministic governance bundles
|
|
20
|
+
- signed governance artifacts
|
|
21
|
+
- reproducible governance releases
|
|
22
|
+
|
|
23
|
+
Governance policies are treated as immutable, reproducible infrastructure artifacts.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Mental Model
|
|
28
|
+
|
|
29
|
+
```txt id="9b6j2m"
|
|
30
|
+
Author Policy
|
|
31
|
+
↓
|
|
32
|
+
Validate Policy
|
|
33
|
+
↓
|
|
34
|
+
Generate Bundle
|
|
35
|
+
↓
|
|
36
|
+
Sign Bundle
|
|
37
|
+
↓
|
|
38
|
+
Release Governance Artifact
|
|
39
|
+
↓
|
|
40
|
+
Execute Governed Decisions
|
|
41
|
+
↓
|
|
42
|
+
Independent Verification
|
|
43
|
+
|
|
44
|
+
The governance layer defines how policies become reproducible, portable, and verifiable governance infrastructure.
|
|
45
|
+
|
|
46
|
+
What this package does
|
|
47
|
+
|
|
48
|
+
The governance package handles:
|
|
49
|
+
|
|
50
|
+
policy scaffolding
|
|
51
|
+
policy validation
|
|
52
|
+
policy version upgrades
|
|
53
|
+
governance bundle generation
|
|
54
|
+
deterministic manifest generation
|
|
55
|
+
governance artifact signing
|
|
56
|
+
immutable policy lineage management
|
|
57
|
+
governance release reproducibility
|
|
58
|
+
|
|
59
|
+
Policies are versioned governance artifacts with deterministic provenance.
|
|
60
|
+
|
|
61
|
+
When to use this package
|
|
62
|
+
|
|
63
|
+
Use this package when:
|
|
64
|
+
|
|
65
|
+
creating governance policies
|
|
66
|
+
versioning deterministic governance logic
|
|
67
|
+
validating governance structure
|
|
68
|
+
generating signed governance bundles
|
|
69
|
+
implementing governed release workflows
|
|
70
|
+
managing immutable governance lineage
|
|
71
|
+
building governance authoring pipelines
|
|
72
|
+
|
|
73
|
+
Do NOT use this package when:
|
|
74
|
+
|
|
75
|
+
executing governed decisions
|
|
76
|
+
independently verifying attestations
|
|
77
|
+
deploying HTTP runtimes
|
|
78
|
+
integrating applications over HTTP
|
|
79
|
+
|
|
80
|
+
In those cases use:
|
|
81
|
+
|
|
82
|
+
Package Responsibility
|
|
83
|
+
@parmanasystems/execution governed execution
|
|
84
|
+
@parmanasystems/verifier independent verification
|
|
85
|
+
@parmanasystems/server deployable runtime
|
|
86
|
+
@parmanasystems/sdk-client HTTP integration
|
|
87
|
+
Features
|
|
88
|
+
Immutable governance versioning
|
|
89
|
+
Deterministic policy validation
|
|
90
|
+
Signed governance bundles
|
|
91
|
+
Canonical manifest generation
|
|
92
|
+
Runtime compatibility requirements
|
|
93
|
+
Portable governance artifacts
|
|
94
|
+
Governance provenance lineage
|
|
95
|
+
Deterministic governance releases
|
|
96
|
+
Fail-closed governance validation
|
|
97
|
+
Installation
|
|
98
|
+
npm install @parmanasystems/governance
|
|
99
|
+
Quick Start
|
|
100
|
+
import {
|
|
101
|
+
createPolicy,
|
|
102
|
+
validatePolicy,
|
|
103
|
+
generateBundle,
|
|
104
|
+
} from "@parmanasystems/governance";
|
|
8
105
|
|
|
9
|
-
|
|
106
|
+
await createPolicy(
|
|
107
|
+
"claims-approval"
|
|
108
|
+
);
|
|
10
109
|
|
|
11
|
-
|
|
110
|
+
await validatePolicy(
|
|
111
|
+
"./policies/claims-approval/v1/policy.json"
|
|
112
|
+
);
|
|
12
113
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
114
|
+
const bundle =
|
|
115
|
+
await generateBundle(
|
|
116
|
+
"claims-approval",
|
|
117
|
+
"v1",
|
|
118
|
+
"./policies/claims-approval/v1"
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
console.log(
|
|
122
|
+
bundle.bundle_hash
|
|
123
|
+
);
|
|
124
|
+
Core Concepts
|
|
125
|
+
Immutable Policy Lineage
|
|
126
|
+
|
|
127
|
+
Policies are immutable governance artifacts.
|
|
128
|
+
|
|
129
|
+
Example lineage:
|
|
130
|
+
|
|
131
|
+
claims-approval/
|
|
132
|
+
v1/
|
|
133
|
+
v2/
|
|
134
|
+
v3/
|
|
135
|
+
|
|
136
|
+
Older policy versions remain immutable after release.
|
|
137
|
+
|
|
138
|
+
New governance behavior requires new versions.
|
|
139
|
+
|
|
140
|
+
This ensures:
|
|
141
|
+
|
|
142
|
+
reproducibility
|
|
143
|
+
auditability
|
|
144
|
+
deterministic governance lineage
|
|
145
|
+
historical governance integrity
|
|
146
|
+
signalsSchema
|
|
16
147
|
|
|
17
|
-
|
|
148
|
+
Policies define governed input structure explicitly.
|
|
18
149
|
|
|
19
|
-
|
|
150
|
+
Example:
|
|
20
151
|
|
|
21
|
-
```json
|
|
22
152
|
{
|
|
153
|
+
"signalsSchema": {
|
|
154
|
+
"risk_score": {
|
|
155
|
+
"type": "integer",
|
|
156
|
+
"required": true
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
Signals are:
|
|
162
|
+
|
|
163
|
+
typed
|
|
164
|
+
deterministic
|
|
165
|
+
explicitly governed
|
|
166
|
+
schema validated
|
|
167
|
+
Governance Bundles
|
|
168
|
+
|
|
169
|
+
Governance bundles package deterministic governance artifacts.
|
|
170
|
+
|
|
171
|
+
Bundles include:
|
|
172
|
+
|
|
173
|
+
policy definition
|
|
174
|
+
canonical manifest
|
|
175
|
+
governance hashes
|
|
176
|
+
signatures
|
|
177
|
+
provenance metadata
|
|
178
|
+
|
|
179
|
+
Bundles are:
|
|
180
|
+
|
|
181
|
+
deterministic
|
|
182
|
+
portable
|
|
183
|
+
reproducible
|
|
184
|
+
independently verifiable
|
|
185
|
+
Bundle Provenance
|
|
186
|
+
|
|
187
|
+
Governance provenance includes:
|
|
188
|
+
|
|
189
|
+
deterministic hashes
|
|
190
|
+
canonical manifests
|
|
191
|
+
cryptographic signatures
|
|
192
|
+
runtime compatibility lineage
|
|
193
|
+
|
|
194
|
+
This enables:
|
|
195
|
+
|
|
196
|
+
reproducible releases
|
|
197
|
+
independent verification
|
|
198
|
+
governance auditability
|
|
199
|
+
portable governance validation
|
|
200
|
+
Fail-Closed Governance
|
|
201
|
+
|
|
202
|
+
Governance validation is fail-closed.
|
|
203
|
+
|
|
204
|
+
Invalid governance artifacts reject execution.
|
|
205
|
+
|
|
206
|
+
Validation failures include:
|
|
207
|
+
|
|
208
|
+
malformed policies
|
|
209
|
+
invalid schemas
|
|
210
|
+
invalid rule structure
|
|
211
|
+
compatibility violations
|
|
212
|
+
signature failures
|
|
213
|
+
Policy Structure
|
|
214
|
+
|
|
215
|
+
Policies live at:
|
|
216
|
+
|
|
217
|
+
policies/{policyId}/{version}/policy.json
|
|
218
|
+
|
|
219
|
+
Example:
|
|
220
|
+
|
|
221
|
+
policies/
|
|
222
|
+
claims-approval/
|
|
223
|
+
v1/
|
|
224
|
+
policy.json
|
|
225
|
+
Example Policy
|
|
226
|
+
{
|
|
227
|
+
"policyId": "claims-approval",
|
|
228
|
+
|
|
229
|
+
"version": "v1",
|
|
230
|
+
|
|
23
231
|
"schemaVersion": "1.0.0",
|
|
232
|
+
|
|
24
233
|
"signalsSchema": {
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
234
|
+
|
|
235
|
+
"insurance_active": {
|
|
236
|
+
"type": "boolean",
|
|
237
|
+
"required": true
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
"risk_score": {
|
|
241
|
+
"type": "integer",
|
|
242
|
+
"required": true
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
"claim_amount": {
|
|
246
|
+
"type": "integer",
|
|
247
|
+
"required": false
|
|
248
|
+
}
|
|
28
249
|
},
|
|
250
|
+
|
|
29
251
|
"rules": [
|
|
252
|
+
|
|
30
253
|
{
|
|
31
254
|
"id": "rule_low_risk",
|
|
255
|
+
|
|
32
256
|
"condition": {
|
|
33
257
|
"all": [
|
|
34
|
-
|
|
35
|
-
{
|
|
258
|
+
|
|
259
|
+
{
|
|
260
|
+
"signal": "insurance_active",
|
|
261
|
+
"equals": true
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
{
|
|
265
|
+
"signal": "risk_score",
|
|
266
|
+
"less_than": 50
|
|
267
|
+
}
|
|
36
268
|
]
|
|
37
269
|
},
|
|
270
|
+
|
|
38
271
|
"outcome": {
|
|
39
272
|
"action": "approve",
|
|
40
273
|
"requires_override": false,
|
|
41
274
|
"reason": "Low risk profile"
|
|
42
275
|
}
|
|
43
276
|
},
|
|
277
|
+
|
|
44
278
|
{
|
|
45
279
|
"id": "rule_high_risk",
|
|
46
|
-
|
|
280
|
+
|
|
281
|
+
"condition": {
|
|
282
|
+
"signal": "risk_score",
|
|
283
|
+
"greater_than": 80
|
|
284
|
+
},
|
|
285
|
+
|
|
47
286
|
"outcome": {
|
|
48
287
|
"action": "reject",
|
|
49
288
|
"requires_override": false,
|
|
@@ -52,124 +291,182 @@ Policies live at `policies/{policyId}/{version}/policy.json`:
|
|
|
52
291
|
}
|
|
53
292
|
]
|
|
54
293
|
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Rules are evaluated in order. The first matching rule determines the outcome. If no rule matches, execution fails closed.
|
|
58
|
-
|
|
59
|
-
## API
|
|
60
294
|
|
|
61
|
-
|
|
295
|
+
Rules are evaluated deterministically in order.
|
|
62
296
|
|
|
63
|
-
|
|
297
|
+
The first matching rule determines the governed outcome.
|
|
64
298
|
|
|
65
|
-
|
|
66
|
-
import { createPolicy } from "@parmanasystems/governance";
|
|
67
|
-
await createPolicy("fraud-detection");
|
|
68
|
-
```
|
|
299
|
+
If no rule matches, evaluation fails closed.
|
|
69
300
|
|
|
70
|
-
|
|
301
|
+
Governance Lifecycle APIs
|
|
302
|
+
createPolicy
|
|
71
303
|
|
|
72
|
-
|
|
304
|
+
Scaffolds a governance policy directory.
|
|
73
305
|
|
|
74
|
-
|
|
75
|
-
|
|
306
|
+
import {
|
|
307
|
+
createPolicy
|
|
308
|
+
} from "@parmanasystems/governance";
|
|
76
309
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
```
|
|
310
|
+
await createPolicy(
|
|
311
|
+
"fraud-detection"
|
|
312
|
+
);
|
|
313
|
+
definePolicy
|
|
83
314
|
|
|
84
|
-
|
|
315
|
+
Creates a policy definition in memory.
|
|
85
316
|
|
|
86
|
-
|
|
317
|
+
import {
|
|
318
|
+
definePolicy
|
|
319
|
+
} from "@parmanasystems/governance";
|
|
87
320
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
validatePolicy(policy);
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### `upgradePolicy(policy, nextVersion): PolicyDefinition`
|
|
94
|
-
|
|
95
|
-
Creates a new version of an existing policy.
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
import { upgradePolicy } from "@parmanasystems/governance";
|
|
99
|
-
const v2 = upgradePolicy(policyV1, "v2");
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### `generateBundle(policyId, version, directory): Promise<BundleGenerationResult>`
|
|
103
|
-
|
|
104
|
-
Generates `bundle.manifest.json` and signs it as `bundle.sig`.
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
import { generateBundle } from "@parmanasystems/governance";
|
|
108
|
-
|
|
109
|
-
const result = await generateBundle("claims-approval", "v1", "./policies/claims-approval/v1");
|
|
110
|
-
console.log(result.bundle_hash); // SHA-256 of manifest
|
|
111
|
-
console.log(result.signature_path); // path to bundle.sig
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### `verifyBundle(directory): Promise<boolean>`
|
|
321
|
+
const policy =
|
|
322
|
+
definePolicy({
|
|
115
323
|
|
|
116
|
-
|
|
324
|
+
id:
|
|
325
|
+
"claims-approval",
|
|
117
326
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const ok = await verifyBundle("./policies/claims-approval/v1");
|
|
121
|
-
```
|
|
327
|
+
version:
|
|
328
|
+
"v1",
|
|
122
329
|
|
|
123
|
-
|
|
330
|
+
rules: [],
|
|
331
|
+
});
|
|
332
|
+
validatePolicy
|
|
124
333
|
|
|
125
|
-
|
|
334
|
+
Validates governance structure.
|
|
126
335
|
|
|
127
|
-
|
|
128
|
-
interface PolicyDefinition {
|
|
129
|
-
id: string;
|
|
130
|
-
version: string;
|
|
131
|
-
rules: PolicyRule[];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
interface PolicyRule {
|
|
135
|
-
id: string;
|
|
136
|
-
condition: string;
|
|
137
|
-
action: string;
|
|
138
|
-
}
|
|
139
|
-
```
|
|
336
|
+
Checks:
|
|
140
337
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
```
|
|
338
|
+
schemaVersion
|
|
339
|
+
signalsSchema
|
|
340
|
+
rules
|
|
341
|
+
outcomes
|
|
342
|
+
deterministic structure
|
|
343
|
+
import {
|
|
344
|
+
validatePolicy
|
|
345
|
+
} from "@parmanasystems/governance";
|
|
151
346
|
|
|
152
|
-
|
|
347
|
+
validatePolicy(policy);
|
|
348
|
+
upgradePolicy
|
|
349
|
+
|
|
350
|
+
Creates immutable next-version governance lineage.
|
|
351
|
+
|
|
352
|
+
import {
|
|
353
|
+
upgradePolicy
|
|
354
|
+
} from "@parmanasystems/governance";
|
|
355
|
+
|
|
356
|
+
const v2 =
|
|
357
|
+
upgradePolicy(
|
|
358
|
+
policyV1,
|
|
359
|
+
"v2"
|
|
360
|
+
);
|
|
361
|
+
generateBundle
|
|
362
|
+
|
|
363
|
+
Generates deterministic governance bundles.
|
|
364
|
+
|
|
365
|
+
Produces:
|
|
366
|
+
|
|
367
|
+
bundle.manifest.json
|
|
368
|
+
bundle.sig
|
|
369
|
+
import {
|
|
370
|
+
generateBundle
|
|
371
|
+
} from "@parmanasystems/governance";
|
|
372
|
+
|
|
373
|
+
const result =
|
|
374
|
+
await generateBundle(
|
|
375
|
+
"claims-approval",
|
|
376
|
+
"v1",
|
|
377
|
+
"./policies/claims-approval/v1"
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
console.log(
|
|
381
|
+
result.bundle_hash
|
|
382
|
+
);
|
|
383
|
+
verifyBundle
|
|
384
|
+
|
|
385
|
+
Verifies governance bundle integrity.
|
|
386
|
+
|
|
387
|
+
Checks:
|
|
388
|
+
|
|
389
|
+
signatures
|
|
390
|
+
hashes
|
|
391
|
+
manifest integrity
|
|
392
|
+
import {
|
|
393
|
+
verifyBundle
|
|
394
|
+
} from "@parmanasystems/governance";
|
|
395
|
+
|
|
396
|
+
const valid =
|
|
397
|
+
await verifyBundle(
|
|
398
|
+
"./policies/claims-approval/v1"
|
|
399
|
+
);
|
|
400
|
+
Governance Bundle Structure
|
|
401
|
+
claims-approval/
|
|
402
|
+
v1/
|
|
403
|
+
policy.json
|
|
404
|
+
bundle.manifest.json
|
|
405
|
+
bundle.sig
|
|
406
|
+
Runtime Requirements
|
|
407
|
+
|
|
408
|
+
Governance bundles may specify runtime compatibility requirements.
|
|
409
|
+
|
|
410
|
+
Example:
|
|
153
411
|
|
|
154
|
-
```typescript
|
|
155
412
|
interface RuntimeRequirements {
|
|
156
|
-
required_capabilities: string[];
|
|
157
|
-
supported_runtime_versions: string[];
|
|
158
|
-
supported_schema_versions: string[];
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
413
|
|
|
162
|
-
|
|
414
|
+
required_capabilities:
|
|
415
|
+
string[];
|
|
163
416
|
|
|
164
|
-
|
|
417
|
+
supported_runtime_versions:
|
|
418
|
+
string[];
|
|
165
419
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
| `patient-triage` | v1 | Patient triage routing by severity |
|
|
170
|
-
| `fraud-detection` | v1 | Transaction fraud detection |
|
|
171
|
-
| `claims-advanced` | v1 | Advanced claims with multi-condition rules |
|
|
172
|
-
|
|
173
|
-
## License
|
|
420
|
+
supported_schema_versions:
|
|
421
|
+
string[];
|
|
422
|
+
}
|
|
174
423
|
|
|
175
|
-
|
|
424
|
+
This enables deterministic compatibility enforcement.
|
|
425
|
+
|
|
426
|
+
Included Example Policies
|
|
427
|
+
Policy Versions Description
|
|
428
|
+
claims-approval v1, v2 insurance claims governance
|
|
429
|
+
patient-triage v1 healthcare triage routing
|
|
430
|
+
fraud-detection v1 transaction fraud governance
|
|
431
|
+
claims-advanced v1 advanced multi-condition evaluation
|
|
432
|
+
Recommended Architecture
|
|
433
|
+
Governance Authoring
|
|
434
|
+
↓
|
|
435
|
+
Policy Validation
|
|
436
|
+
↓
|
|
437
|
+
Governance Bundle
|
|
438
|
+
↓
|
|
439
|
+
Signed Governance Artifact
|
|
440
|
+
↓
|
|
441
|
+
Governed Runtime Execution
|
|
442
|
+
↓
|
|
443
|
+
Independent Verification
|
|
444
|
+
Relationship to Other Parmana Packages
|
|
445
|
+
Package Responsibility
|
|
446
|
+
@parmanasystems/governance governance lifecycle
|
|
447
|
+
@parmanasystems/execution governed execution
|
|
448
|
+
@parmanasystems/verifier independent verification
|
|
449
|
+
@parmanasystems/bundle canonical governance artifacts
|
|
450
|
+
@parmanasystems/server deployable runtime
|
|
451
|
+
Security Model
|
|
452
|
+
|
|
453
|
+
The governance layer enforces:
|
|
454
|
+
|
|
455
|
+
immutable policy lineage
|
|
456
|
+
deterministic governance structure
|
|
457
|
+
fail-closed validation
|
|
458
|
+
signed governance artifacts
|
|
459
|
+
reproducible governance releases
|
|
460
|
+
canonical manifest integrity
|
|
461
|
+
runtime compatibility enforcement
|
|
462
|
+
|
|
463
|
+
Governance artifacts are designed to be:
|
|
464
|
+
|
|
465
|
+
portable
|
|
466
|
+
reproducible
|
|
467
|
+
independently verifiable
|
|
468
|
+
Most Important Principle
|
|
469
|
+
Governance policies are immutable, reproducible infrastructure artifacts with deterministic lineage.
|
|
470
|
+
License
|
|
471
|
+
|
|
472
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parmanasystems/governance",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
],
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@parmanasystems/bundle": "^1.
|
|
22
|
-
"@parmanasystems/crypto": "^1.
|
|
23
|
-
"@parmanasystems/contracts": "^1.
|
|
21
|
+
"@parmanasystems/bundle": "^1.59.0",
|
|
22
|
+
"@parmanasystems/crypto": "^1.59.0",
|
|
23
|
+
"@parmanasystems/contracts": "^1.59.0"
|
|
24
24
|
},
|
|
25
25
|
"description": "Deterministic governance lifecycle and policy infrastructure for parmanasystems.",
|
|
26
26
|
"license": "Apache-2.0",
|