@parmanasystems/core 1.56.0 → 1.65.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 +366 -94
- package/dist/index.d.ts +3 -2
- package/dist/index.js +10620 -14
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,24 +1,87 @@
|
|
|
1
1
|
# @parmanasystems/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Deterministic governance SDK and evaluation foundation for the Parmana Systems ecosystem.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@parmanasystems/core)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
# Overview
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
`@parmanasystems/core` is the primary integration package for the Parmana deterministic governance ecosystem.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
It provides a unified governance SDK combining:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
- deterministic policy evaluation
|
|
16
|
+
- governed execution
|
|
17
|
+
- independent verification
|
|
18
|
+
- replay-safe execution infrastructure
|
|
19
|
+
- runtime provenance validation
|
|
20
|
+
- canonical governance utilities
|
|
21
|
+
|
|
22
|
+
For most applications, this is the recommended entry point into the Parmana ecosystem.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Mental Model
|
|
27
|
+
|
|
28
|
+
```txt id="o5f0r2"
|
|
29
|
+
Signals
|
|
30
|
+
↓
|
|
31
|
+
Deterministic Evaluation
|
|
32
|
+
↓
|
|
33
|
+
Governed Decision
|
|
34
|
+
↓
|
|
35
|
+
Governed Execution
|
|
36
|
+
↓
|
|
37
|
+
Execution Attestation
|
|
38
|
+
↓
|
|
39
|
+
Independent Verification
|
|
40
|
+
|
|
41
|
+
The core package unifies the full deterministic governance lifecycle.
|
|
42
|
+
|
|
43
|
+
What this package does
|
|
44
|
+
|
|
45
|
+
@parmanasystems/core combines:
|
|
46
|
+
|
|
47
|
+
Capability Description
|
|
48
|
+
deterministic evaluation governed decision evaluation
|
|
49
|
+
governed execution replay-safe enforcement
|
|
50
|
+
verification independent proof validation
|
|
51
|
+
governance utilities canonical governance infrastructure
|
|
52
|
+
runtime lineage provenance validation
|
|
53
|
+
replay protection deterministic execution safety
|
|
54
|
+
|
|
55
|
+
This package acts as the unified developer-facing governance SDK.
|
|
56
|
+
|
|
57
|
+
When to use this package
|
|
58
|
+
|
|
59
|
+
Use this package when:
|
|
18
60
|
|
|
19
|
-
|
|
61
|
+
integrating deterministic governance into applications
|
|
62
|
+
building governed AI systems
|
|
63
|
+
implementing governed execution workflows
|
|
64
|
+
deploying deterministic execution pipelines
|
|
65
|
+
verifying execution attestations
|
|
66
|
+
building replay-safe governance infrastructure
|
|
67
|
+
adopting Parmana without managing multiple packages individually
|
|
20
68
|
|
|
21
|
-
|
|
69
|
+
Do NOT use this package when:
|
|
70
|
+
|
|
71
|
+
requiring only low-level runtime primitives
|
|
72
|
+
implementing only cryptographic infrastructure
|
|
73
|
+
building custom governance internals
|
|
74
|
+
|
|
75
|
+
In those cases use lower-level packages directly:
|
|
76
|
+
|
|
77
|
+
Package Responsibility
|
|
78
|
+
@parmanasystems/execution governed execution runtime
|
|
79
|
+
@parmanasystems/verifier independent verification
|
|
80
|
+
@parmanasystems/governance governance lifecycle
|
|
81
|
+
@parmanasystems/crypto signing infrastructure
|
|
82
|
+
Installation
|
|
83
|
+
npm install @parmanasystems/core
|
|
84
|
+
Quick Start
|
|
22
85
|
import {
|
|
23
86
|
executeFromSignals,
|
|
24
87
|
verifyAttestation,
|
|
@@ -27,94 +90,268 @@ import {
|
|
|
27
90
|
getRuntimeManifest,
|
|
28
91
|
RedisReplayStore,
|
|
29
92
|
} from "@parmanasystems/core";
|
|
93
|
+
|
|
30
94
|
import { createClient } from "redis";
|
|
31
95
|
|
|
32
|
-
const redis
|
|
96
|
+
const redis =
|
|
97
|
+
createClient();
|
|
98
|
+
|
|
33
99
|
await redis.connect();
|
|
34
100
|
|
|
35
|
-
const signer
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
101
|
+
const signer =
|
|
102
|
+
new LocalSigner(
|
|
103
|
+
process.env.Parmana_PRIVATE_KEY!
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
const verifier =
|
|
107
|
+
new LocalVerifier(
|
|
108
|
+
process.env.Parmana_PUBLIC_KEY!
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const store =
|
|
112
|
+
new RedisReplayStore(
|
|
113
|
+
redis
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
const manifest =
|
|
117
|
+
getRuntimeManifest();
|
|
118
|
+
|
|
119
|
+
const result =
|
|
120
|
+
await executeFromSignals(
|
|
121
|
+
{
|
|
122
|
+
policyId:
|
|
123
|
+
"claims-approval",
|
|
124
|
+
|
|
125
|
+
policyVersion:
|
|
126
|
+
"v1",
|
|
127
|
+
|
|
128
|
+
signals: {
|
|
129
|
+
insurance_active: true,
|
|
130
|
+
risk_score: 42,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
signer,
|
|
56
134
|
verifier,
|
|
57
|
-
|
|
135
|
+
store
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
if (
|
|
139
|
+
result.status === "success"
|
|
140
|
+
&&
|
|
141
|
+
result.signature
|
|
142
|
+
) {
|
|
143
|
+
|
|
144
|
+
const verification =
|
|
145
|
+
verifyAttestation(
|
|
146
|
+
{
|
|
147
|
+
execution_id:
|
|
148
|
+
result.execution_id,
|
|
149
|
+
|
|
150
|
+
...result
|
|
151
|
+
},
|
|
152
|
+
verifier,
|
|
153
|
+
manifest
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
console.log(
|
|
157
|
+
verification.valid
|
|
58
158
|
);
|
|
59
|
-
console.log(verification.valid); // true
|
|
60
159
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
160
|
+
Core Concepts
|
|
161
|
+
Deterministic Evaluation
|
|
162
|
+
|
|
163
|
+
Governance evaluation is deterministic.
|
|
164
|
+
|
|
165
|
+
The runtime guarantees:
|
|
166
|
+
|
|
167
|
+
same signals + same policy → same governed outcome
|
|
168
|
+
|
|
169
|
+
Evaluation does not depend on:
|
|
170
|
+
|
|
171
|
+
randomness
|
|
172
|
+
mutable runtime state
|
|
173
|
+
probabilistic execution
|
|
174
|
+
timestamps
|
|
175
|
+
Signals vs Rules vs Execution
|
|
176
|
+
|
|
177
|
+
Parmana separates:
|
|
178
|
+
|
|
179
|
+
Component Responsibility
|
|
180
|
+
signals governed facts and inputs
|
|
181
|
+
rules deterministic governance logic
|
|
182
|
+
execution governed enforcement
|
|
183
|
+
|
|
184
|
+
This separation improves:
|
|
185
|
+
|
|
186
|
+
auditability
|
|
187
|
+
reproducibility
|
|
188
|
+
governance clarity
|
|
189
|
+
execution trust boundaries
|
|
190
|
+
signalsSchema
|
|
191
|
+
|
|
192
|
+
Policies define governed signal structure explicitly.
|
|
193
|
+
|
|
194
|
+
Example:
|
|
195
|
+
|
|
196
|
+
{
|
|
197
|
+
"signalsSchema": {
|
|
198
|
+
"risk_score": {
|
|
199
|
+
"type": "number"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
Signals are:
|
|
205
|
+
|
|
206
|
+
typed
|
|
207
|
+
deterministic
|
|
208
|
+
explicitly governed
|
|
209
|
+
schema-validated
|
|
210
|
+
Governed Decisions
|
|
211
|
+
|
|
212
|
+
The evaluator produces governed outcomes:
|
|
213
|
+
|
|
214
|
+
{
|
|
215
|
+
"action": "approve",
|
|
216
|
+
"requires_override": false
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
Possible outcomes include:
|
|
220
|
+
|
|
221
|
+
Outcome Meaning
|
|
222
|
+
approve execution allowed
|
|
223
|
+
reject execution denied
|
|
224
|
+
requires_override human escalation required
|
|
225
|
+
|
|
226
|
+
The evaluator determines governance outcomes.
|
|
227
|
+
|
|
228
|
+
Execution authority is enforced separately.
|
|
229
|
+
|
|
230
|
+
execution_id
|
|
231
|
+
|
|
232
|
+
Operational execution lineage identifier.
|
|
233
|
+
|
|
234
|
+
Used for:
|
|
235
|
+
|
|
236
|
+
audit tracking
|
|
237
|
+
governance event identity
|
|
238
|
+
operational lineage
|
|
239
|
+
execution_fingerprint
|
|
240
|
+
|
|
241
|
+
Deterministic replay identity.
|
|
242
|
+
|
|
243
|
+
Replay protection operates on execution fingerprints.
|
|
244
|
+
|
|
245
|
+
Identical governed inputs produce identical execution fingerprints.
|
|
246
|
+
|
|
247
|
+
signals_hash
|
|
248
|
+
|
|
249
|
+
Canonicalized governed input proof.
|
|
250
|
+
|
|
251
|
+
Used for:
|
|
252
|
+
|
|
253
|
+
deterministic reconstruction
|
|
254
|
+
execution verification
|
|
255
|
+
audit integrity
|
|
256
|
+
replay-safe governance
|
|
257
|
+
Example Policy
|
|
258
|
+
{
|
|
259
|
+
"policyId": "loan-approval",
|
|
260
|
+
|
|
261
|
+
"version": "v1",
|
|
262
|
+
|
|
263
|
+
"signalsSchema": {
|
|
264
|
+
|
|
265
|
+
"risk_score": {
|
|
266
|
+
"type": "number"
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
"rules": [
|
|
271
|
+
|
|
272
|
+
{
|
|
273
|
+
"id": "approve-low-risk",
|
|
274
|
+
|
|
275
|
+
"condition": {
|
|
276
|
+
"all": [
|
|
277
|
+
{
|
|
278
|
+
"signal": "risk_score",
|
|
279
|
+
"less_than": 0.25
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
"outcome": {
|
|
285
|
+
"action": "approve",
|
|
286
|
+
"requires_override": false
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
Governance Lifecycle
|
|
292
|
+
Signals
|
|
293
|
+
↓
|
|
294
|
+
Validation
|
|
295
|
+
↓
|
|
296
|
+
Deterministic Evaluation
|
|
297
|
+
↓
|
|
298
|
+
Governed Decision
|
|
299
|
+
↓
|
|
300
|
+
Execution Token
|
|
301
|
+
↓
|
|
302
|
+
Governed Execution
|
|
303
|
+
↓
|
|
304
|
+
Execution Attestation
|
|
305
|
+
↓
|
|
306
|
+
Independent Verification
|
|
307
|
+
Major Exports
|
|
308
|
+
Governance Lifecycle
|
|
309
|
+
|
|
310
|
+
From @parmanasystems/governance
|
|
311
|
+
|
|
312
|
+
Export Description
|
|
313
|
+
createPolicy scaffold governance policy
|
|
314
|
+
upgradePolicy create new immutable policy version
|
|
315
|
+
validatePolicy validate governance policy
|
|
316
|
+
generateBundle generate governance bundle
|
|
317
|
+
definePolicy define policy in memory
|
|
318
|
+
Deterministic Execution
|
|
319
|
+
|
|
320
|
+
From @parmanasystems/execution
|
|
321
|
+
|
|
322
|
+
Export Description
|
|
323
|
+
executeFromSignals full governed execution pipeline
|
|
324
|
+
executeDecision low-level execution pipeline
|
|
325
|
+
executeSimple simplified token execution
|
|
326
|
+
resolveOverride resolve override workflow
|
|
327
|
+
evaluatePolicy deterministic policy evaluation
|
|
328
|
+
issueToken issue execution token
|
|
329
|
+
getRuntimeManifest active runtime lineage
|
|
330
|
+
LocalSigner local Ed25519 signer
|
|
331
|
+
LocalVerifier local Ed25519 verifier
|
|
332
|
+
MemoryReplayStore in-memory replay protection
|
|
333
|
+
RedisReplayStore distributed replay protection
|
|
334
|
+
Independent Verification
|
|
335
|
+
|
|
336
|
+
From @parmanasystems/verifier
|
|
337
|
+
|
|
338
|
+
Export Description
|
|
339
|
+
verifyAttestation deterministic attestation verification
|
|
340
|
+
verifyBundle governance bundle verification
|
|
341
|
+
verifyRuntime runtime lineage verification
|
|
342
|
+
verifyRuntimeCompatibility runtime compatibility validation
|
|
343
|
+
verifyExecutionRequirements execution requirement validation
|
|
344
|
+
Canonical Utilities
|
|
345
|
+
|
|
346
|
+
From @parmanasystems/bundle
|
|
347
|
+
|
|
348
|
+
import {
|
|
349
|
+
canonicalize
|
|
350
|
+
} from "@parmanasystems/core";
|
|
351
|
+
|
|
352
|
+
Provides deterministic canonical serialization.
|
|
353
|
+
|
|
354
|
+
Types
|
|
118
355
|
import type {
|
|
119
356
|
ExecutionContext,
|
|
120
357
|
ExecutionAttestation,
|
|
@@ -128,8 +365,43 @@ import type {
|
|
|
128
365
|
AsyncReplayStore,
|
|
129
366
|
ViolationReport,
|
|
130
367
|
} from "@parmanasystems/core";
|
|
131
|
-
|
|
368
|
+
Recommended Architecture
|
|
369
|
+
Application
|
|
370
|
+
↓
|
|
371
|
+
@parmanasystems/core
|
|
372
|
+
↓
|
|
373
|
+
Deterministic Governance
|
|
374
|
+
↓
|
|
375
|
+
Execution Attestation
|
|
376
|
+
↓
|
|
377
|
+
Independent Verification
|
|
378
|
+
|
|
379
|
+
For most applications, @parmanasystems/core is the recommended integration surface.
|
|
380
|
+
|
|
381
|
+
Security Model
|
|
382
|
+
|
|
383
|
+
The core governance SDK enforces:
|
|
384
|
+
|
|
385
|
+
deterministic evaluation
|
|
386
|
+
fail-closed governance
|
|
387
|
+
replay-safe execution
|
|
388
|
+
immutable attestations
|
|
389
|
+
runtime provenance validation
|
|
390
|
+
independent verification
|
|
391
|
+
governed execution boundaries
|
|
392
|
+
canonical deterministic serialization
|
|
393
|
+
|
|
394
|
+
The system is designed so that:
|
|
132
395
|
|
|
133
|
-
|
|
396
|
+
AI may recommend actions.
|
|
397
|
+
Deterministic governance controls execution authority.
|
|
398
|
+
Relationship to Other Parmana Packages
|
|
399
|
+
Package Responsibility
|
|
400
|
+
@parmanasystems/core unified governance SDK
|
|
401
|
+
@parmanasystems/execution governed execution runtime
|
|
402
|
+
@parmanasystems/verifier independent verification
|
|
403
|
+
@parmanasystems/server deployable runtime
|
|
404
|
+
@parmanasystems/sdk-client HTTP integration
|
|
405
|
+
License
|
|
134
406
|
|
|
135
|
-
Apache-2.0
|
|
407
|
+
Apache-2.0
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
export { RuntimeRequirements, createPolicy, generateBundle, upgradePolicy, validatePolicy } from '@parmanasystems/governance';
|
|
2
2
|
export { signBundle } from '@parmanasystems/crypto';
|
|
3
|
-
export { ExecutionAttestation, ExecutionContext, ExecutionToken, INVARIANT_REGISTRY, InvariantBoundary, InvariantEntry, InvariantId, InvariantViolation, LocalSigner, LocalVerifier,
|
|
3
|
+
export { ExecutionAttestation, ExecutionContext, ExecutionToken, INVARIANT_REGISTRY, InvariantBoundary, InvariantEntry, InvariantId, InvariantViolation, LocalSigner, LocalVerifier, ReplayStore, RuntimeManifest, Signer, Verifier, ViolationReport, executeDecision, getRuntimeManifest, hashInput, issueToken, signRuntimeManifest, verifyExecutionToken, verifyRuntimeManifest, violate } from '@parmanasystems/execution';
|
|
4
|
+
export { MemoryReplayStore, RedisReplayStore, executeFromSignals } from '@parmanasystems/execution-runtime';
|
|
4
5
|
export { verifyAttestation, verifyBundle, verifyExecutionRequirements, verifyRuntime, verifyRuntimeCompatibility } from '@parmanasystems/verifier';
|
|
5
6
|
export { DecisionOutcome, DecisionResult } from '@parmanasystems/contracts';
|
|
6
7
|
import { AuditOverride } from '@parmanasystems/audit-db';
|
|
7
8
|
|
|
8
9
|
interface ApproveOverrideInput {
|
|
9
|
-
|
|
10
|
+
executionId: string;
|
|
10
11
|
approved_by: string;
|
|
11
12
|
approver_role: string;
|
|
12
13
|
reason: string;
|