@parmanasystems/governance 1.70.0 → 1.71.2
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 +67 -428
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,472 +1,111 @@
|
|
|
1
1
|
# @parmanasystems/governance
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Policy lifecycle management — create, upgrade, validate, and bundle governance policies.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@parmanasystems/governance)
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Overview
|
|
10
10
|
|
|
11
|
-
`@parmanasystems/governance`
|
|
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.
|
|
11
|
+
`@parmanasystems/governance` handles the full policy authoring lifecycle: scaffolding new policies, creating immutable version upgrades, validating policy schemas, and packaging policies into signed bundles for deployment.
|
|
24
12
|
|
|
25
13
|
---
|
|
26
14
|
|
|
27
|
-
|
|
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:
|
|
15
|
+
## Install
|
|
49
16
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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:
|
|
17
|
+
```bash
|
|
18
|
+
npm install @parmanasystems/governance
|
|
19
|
+
```
|
|
74
20
|
|
|
75
|
-
|
|
76
|
-
independently verifying attestations
|
|
77
|
-
deploying HTTP runtimes
|
|
78
|
-
integrating applications over HTTP
|
|
21
|
+
---
|
|
79
22
|
|
|
80
|
-
|
|
23
|
+
## Usage
|
|
81
24
|
|
|
82
|
-
|
|
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
|
|
25
|
+
```typescript
|
|
100
26
|
import {
|
|
101
27
|
createPolicy,
|
|
102
28
|
validatePolicy,
|
|
103
29
|
generateBundle,
|
|
30
|
+
definePolicy,
|
|
104
31
|
} from "@parmanasystems/governance";
|
|
105
32
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
await validatePolicy(
|
|
111
|
-
"./policies/claims-approval/v1/policy.json"
|
|
112
|
-
);
|
|
113
|
-
|
|
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
|
|
147
|
-
|
|
148
|
-
Policies define governed input structure explicitly.
|
|
149
|
-
|
|
150
|
-
Example:
|
|
151
|
-
|
|
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
|
-
|
|
231
|
-
"schemaVersion": "1.0.0",
|
|
232
|
-
|
|
233
|
-
"signalsSchema": {
|
|
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
|
-
}
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
"rules": [
|
|
33
|
+
// Scaffold a new policy at ./policies/loan-approval/v1/policy.json
|
|
34
|
+
const dir = createPolicy("loan-approval");
|
|
35
|
+
console.log(dir); // "./policies/loan-approval/v1"
|
|
252
36
|
|
|
37
|
+
// Define a policy in memory
|
|
38
|
+
const policy = definePolicy({
|
|
39
|
+
id: "loan-approval",
|
|
40
|
+
version: "v1",
|
|
41
|
+
rules: [
|
|
253
42
|
{
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
"
|
|
257
|
-
"all": [
|
|
258
|
-
|
|
259
|
-
{
|
|
260
|
-
"signal": "insurance_active",
|
|
261
|
-
"equals": true
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
{
|
|
265
|
-
"signal": "risk_score",
|
|
266
|
-
"less_than": 50
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
"outcome": {
|
|
272
|
-
"action": "approve",
|
|
273
|
-
"requires_override": false,
|
|
274
|
-
"reason": "Low risk profile"
|
|
275
|
-
}
|
|
43
|
+
id: "high-score",
|
|
44
|
+
condition: "credit_score >= 700 && requested_usd <= 100000",
|
|
45
|
+
action: "approve",
|
|
276
46
|
},
|
|
277
|
-
|
|
278
47
|
{
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
"
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
"outcome": {
|
|
287
|
-
"action": "reject",
|
|
288
|
-
"requires_override": false,
|
|
289
|
-
"reason": "Risk score too high"
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
]
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
Rules are evaluated deterministically in order.
|
|
296
|
-
|
|
297
|
-
The first matching rule determines the governed outcome.
|
|
298
|
-
|
|
299
|
-
If no rule matches, evaluation fails closed.
|
|
300
|
-
|
|
301
|
-
Governance Lifecycle APIs
|
|
302
|
-
createPolicy
|
|
303
|
-
|
|
304
|
-
Scaffolds a governance policy directory.
|
|
305
|
-
|
|
306
|
-
import {
|
|
307
|
-
createPolicy
|
|
308
|
-
} from "@parmanasystems/governance";
|
|
309
|
-
|
|
310
|
-
await createPolicy(
|
|
311
|
-
"fraud-detection"
|
|
312
|
-
);
|
|
313
|
-
definePolicy
|
|
314
|
-
|
|
315
|
-
Creates a policy definition in memory.
|
|
316
|
-
|
|
317
|
-
import {
|
|
318
|
-
definePolicy
|
|
319
|
-
} from "@parmanasystems/governance";
|
|
320
|
-
|
|
321
|
-
const policy =
|
|
322
|
-
definePolicy({
|
|
323
|
-
|
|
324
|
-
id:
|
|
325
|
-
"claims-approval",
|
|
326
|
-
|
|
327
|
-
version:
|
|
328
|
-
"v1",
|
|
329
|
-
|
|
330
|
-
rules: [],
|
|
331
|
-
});
|
|
332
|
-
validatePolicy
|
|
333
|
-
|
|
334
|
-
Validates governance structure.
|
|
335
|
-
|
|
336
|
-
Checks:
|
|
337
|
-
|
|
338
|
-
schemaVersion
|
|
339
|
-
signalsSchema
|
|
340
|
-
rules
|
|
341
|
-
outcomes
|
|
342
|
-
deterministic structure
|
|
343
|
-
import {
|
|
344
|
-
validatePolicy
|
|
345
|
-
} from "@parmanasystems/governance";
|
|
48
|
+
id: "default-reject",
|
|
49
|
+
condition: "true",
|
|
50
|
+
action: "reject",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
});
|
|
346
54
|
|
|
55
|
+
// Validate before bundling
|
|
347
56
|
validatePolicy(policy);
|
|
348
|
-
upgradePolicy
|
|
349
|
-
|
|
350
|
-
Creates immutable next-version governance lineage.
|
|
351
57
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
58
|
+
// Package into a signed bundle
|
|
59
|
+
const result = await generateBundle({
|
|
60
|
+
policyPath: "./policies/loan-approval/v1",
|
|
61
|
+
outputPath: "./dist/bundles/loan-approval",
|
|
62
|
+
});
|
|
355
63
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
"v2"
|
|
360
|
-
);
|
|
361
|
-
generateBundle
|
|
64
|
+
console.log(result.success); // true
|
|
65
|
+
console.log(result.bundle_hash); // SHA-256 commitment
|
|
66
|
+
```
|
|
362
67
|
|
|
363
|
-
|
|
68
|
+
### Upgrade an existing policy
|
|
364
69
|
|
|
365
|
-
|
|
70
|
+
```typescript
|
|
71
|
+
import { upgradePolicy } from "@parmanasystems/governance";
|
|
366
72
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
generateBundle
|
|
371
|
-
} from "@parmanasystems/governance";
|
|
73
|
+
// Creates ./policies/loan-approval/v2/ from ./policies/loan-approval/v1/
|
|
74
|
+
const newDir = upgradePolicy("loan-approval");
|
|
75
|
+
```
|
|
372
76
|
|
|
373
|
-
|
|
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:
|
|
77
|
+
---
|
|
411
78
|
|
|
412
|
-
|
|
79
|
+
## Exports
|
|
413
80
|
|
|
414
|
-
|
|
415
|
-
string[];
|
|
81
|
+
### Functions
|
|
416
82
|
|
|
417
|
-
|
|
418
|
-
|
|
83
|
+
| Export | Description |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `createPolicy` | Scaffold a new policy directory at `./policies/<id>/v1/` with a skeleton `policy.json` |
|
|
86
|
+
| `upgradePolicy` | Create the next version directory from the current latest version |
|
|
87
|
+
| `validatePolicy` | Validate a policy definition against the governance schema; throws on invalid input |
|
|
88
|
+
| `generateBundle` | Package a policy directory into a content-addressed, signed bundle |
|
|
89
|
+
| `definePolicy` | Construct a typed `PolicyDefinition` in memory |
|
|
419
90
|
|
|
420
|
-
|
|
421
|
-
string[];
|
|
422
|
-
}
|
|
91
|
+
### Types
|
|
423
92
|
|
|
424
|
-
|
|
93
|
+
| Export | Description |
|
|
94
|
+
|---|---|
|
|
95
|
+
| `PolicyDefinition` | In-memory policy with `id`, `version`, and ordered `rules` |
|
|
96
|
+
| `PolicyRule` | Single rule: `id`, `condition` expression, and `action` |
|
|
97
|
+
| `BundleGenerationResult` | Result of `generateBundle` — success flag, paths, and `bundle_hash` |
|
|
98
|
+
| `RuntimeRequirements` | Runtime capability and version constraints embedded in bundles |
|
|
425
99
|
|
|
426
|
-
|
|
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
|
|
100
|
+
---
|
|
452
101
|
|
|
453
|
-
|
|
102
|
+
## Documentation
|
|
454
103
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
fail-closed validation
|
|
458
|
-
signed governance artifacts
|
|
459
|
-
reproducible governance releases
|
|
460
|
-
canonical manifest integrity
|
|
461
|
-
runtime compatibility enforcement
|
|
104
|
+
Full docs: [parmanasystems.mintlify.app](https://parmanasystems.mintlify.app)
|
|
105
|
+
Package page: [parmanasystems.mintlify.app/packages/governance](https://parmanasystems.mintlify.app/packages/governance)
|
|
462
106
|
|
|
463
|
-
|
|
107
|
+
---
|
|
464
108
|
|
|
465
|
-
|
|
466
|
-
reproducible
|
|
467
|
-
independently verifiable
|
|
468
|
-
Most Important Principle
|
|
469
|
-
Governance policies are immutable, reproducible infrastructure artifacts with deterministic lineage.
|
|
470
|
-
License
|
|
109
|
+
## License
|
|
471
110
|
|
|
472
|
-
Apache-2.0
|
|
111
|
+
Apache-2.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parmanasystems/governance",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.71.2",
|
|
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.71.2",
|
|
22
|
+
"@parmanasystems/crypto": "^1.71.2",
|
|
23
|
+
"@parmanasystems/contracts": "^1.71.2"
|
|
24
24
|
},
|
|
25
25
|
"description": "Deterministic governance lifecycle and policy infrastructure for parmanasystems.",
|
|
26
26
|
"license": "Apache-2.0",
|