pramana-protocol 1.0.0 → 1.2.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/PROTOCOL.md +95 -1
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -1
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/PROTOCOL.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
```
|
|
6
6
|
Document: PRAMANA/1.0
|
|
7
7
|
Status: OPEN DRAFT — Reference Implementation by ANKR
|
|
8
|
-
Version: 1.
|
|
8
|
+
Version: 1.1.0
|
|
9
9
|
Date: 2026-03-28
|
|
10
10
|
Author: Capt. Anil Kumar Sharma
|
|
11
11
|
PowerPbox IT Solutions Pvt Ltd
|
|
@@ -914,6 +914,100 @@ Priority date: 2026-03-28
|
|
|
914
914
|
|
|
915
915
|
---
|
|
916
916
|
|
|
917
|
+
## 18. Version 1.1 — Amendments from Reference Implementation POC (2026-03-28)
|
|
918
|
+
|
|
919
|
+
Three underspecifications in v1.0 were identified by running the POC against 514 real AnkrCodex
|
|
920
|
+
nodes, 176 CCA audits, and 243 Knowledge Codex nodes. All three are non-breaking — they narrow
|
|
921
|
+
what counts as a strand confirmation. They cannot produce a lower level than v1.0 would have
|
|
922
|
+
given; they can only prevent false promotions.
|
|
923
|
+
|
|
924
|
+
---
|
|
925
|
+
|
|
926
|
+
### PRM-AMEND-001 — Knowledge Strand Requires Domain Match (AND, not OR)
|
|
927
|
+
|
|
928
|
+
**Problem discovered:** A query for "quantum hull coating compliance" against the maritime domain
|
|
929
|
+
matched three "routing protocol" research documents (which contained the word "routing") and was
|
|
930
|
+
falsely promoted to PRAMANA-1. The Knowledge Codex contains 243 nodes across many domains.
|
|
931
|
+
Keyword-only matching without domain confirmation is insufficient.
|
|
932
|
+
|
|
933
|
+
**v1.0 rule (wrong):** Knowledge strand confirmed if: `keywords_match OR domain_match`
|
|
934
|
+
|
|
935
|
+
**v1.1 rule:** Knowledge strand confirmed if: `domain_match AND keywords_match`
|
|
936
|
+
|
|
937
|
+
- `domain_match`: the node's declared `domain` field must include the query domain string
|
|
938
|
+
(or the query domain must include the node's primary domain segment)
|
|
939
|
+
- `keywords_match`: at least one meaningful query keyword (length > 3) must appear in the
|
|
940
|
+
node's title, content, or tags
|
|
941
|
+
- Both conditions are required. A node from a different domain that happens to contain
|
|
942
|
+
a query keyword does NOT satisfy the Knowledge strand.
|
|
943
|
+
|
|
944
|
+
**PHALA consequence:** The authenticity level is never promoted by cross-domain keyword noise.
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
### PRM-AMEND-002 — PHALA.rule_id Must Be the Applied Rule, Not the Search Result
|
|
949
|
+
|
|
950
|
+
**Problem discovered:** The v1.0 POC set `PHALA.rule_id = knowledge_registry.research[0].id`
|
|
951
|
+
— the first node in the registry array, not the matched node. This meant PHALA was returning
|
|
952
|
+
outcomes to a rule that had nothing to do with the query. The RCA loop was being poisoned.
|
|
953
|
+
|
|
954
|
+
**v1.1 rule:** `PHALA.rule_id` must be set from the `rule_id` or `id` field of the
|
|
955
|
+
knowledge node that was actually matched and applied. If no knowledge strand is available,
|
|
956
|
+
`PHALA.rule_id` must be `"{DOMAIN}-UNKNOWN"` — explicitly signalling that no rule was applied.
|
|
957
|
+
|
|
958
|
+
**Implementation note:** The knowledge strand check function must return the `applied_rule_id`
|
|
959
|
+
as part of its result. The PHALA construction reads from that result, not from the registry index.
|
|
960
|
+
|
|
961
|
+
**Why this matters:** The entire value of PHALA is that outcomes return to the source RULE.
|
|
962
|
+
If `rule_id` points at the wrong rule, the RCA loop runs in the wrong place. The two-wrongs
|
|
963
|
+
detection (Section 11) also depends on correct rule attribution.
|
|
964
|
+
|
|
965
|
+
---
|
|
966
|
+
|
|
967
|
+
### PRM-AMEND-003 — Proof Strand: Dormant Services Are Attestable
|
|
968
|
+
|
|
969
|
+
**Problem identified in design:** The v1.0 spec implied that a service must be currently
|
|
970
|
+
online for the Proof strand to be satisfied. This over-restricts the protocol.
|
|
971
|
+
|
|
972
|
+
**The dabbawalla principle:** A dabbawalla who is resting is not a broken dabbawalla.
|
|
973
|
+
He can be called back. A service that has been CCA-audited and is registered in the system's
|
|
974
|
+
service registry is attestable — it can be woken on demand.
|
|
975
|
+
|
|
976
|
+
**v1.1 attestation modes** (three tiers, not binary):
|
|
977
|
+
|
|
978
|
+
| Mode | Meaning | Proof strand |
|
|
979
|
+
|---|---|---|
|
|
980
|
+
| `ONLINE` | Service is live and responding | Strongest — full attestation |
|
|
981
|
+
| `DORMANT` | Audited, offline, registered — awakeable via service manager | Valid — CCA record is the proof |
|
|
982
|
+
| `UNREGISTERED` | No CCA audit record exists | Proof strand unavailable |
|
|
983
|
+
|
|
984
|
+
**Rule:** A service in DORMANT mode satisfies the Proof strand. Its CCA audit record is the
|
|
985
|
+
proof document. The system should display the attestation mode to the user so they can choose
|
|
986
|
+
to wake the service if they require live verification.
|
|
987
|
+
|
|
988
|
+
**PHALA addition:** The `attestation_mode` field is added to PhalaPayload (v1.1). This allows
|
|
989
|
+
the receiving rule to distinguish between a DORMANT-proof result and an ONLINE-proof result
|
|
990
|
+
in RCA analysis.
|
|
991
|
+
|
|
992
|
+
**Implementation note:** The proof strand check function must return the best attestation mode
|
|
993
|
+
across all matched services: ONLINE if any matched service is live, DORMANT if all are offline
|
|
994
|
+
but audited, UNREGISTERED if none have audit records.
|
|
995
|
+
|
|
996
|
+
---
|
|
997
|
+
|
|
998
|
+
### PhalaPayload v1.1 Additions
|
|
999
|
+
|
|
1000
|
+
```typescript
|
|
1001
|
+
interface PhalaPayload {
|
|
1002
|
+
// ... v1.0 fields ...
|
|
1003
|
+
domain: string; // PRM-AMEND-001: explicit domain tag
|
|
1004
|
+
attestation_mode?: AttestationMode; // PRM-AMEND-003: online | dormant | unregistered
|
|
1005
|
+
// rule_id is now guaranteed to be the applied rule — PRM-AMEND-002
|
|
1006
|
+
}
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
917
1011
|
*PRAMANA/1.0 — Open Protocol Specification*
|
|
918
1012
|
*© 2026 PowerPbox IT Solutions Pvt Ltd. Open protocol. Reference implementation Apache 2.0.*
|
|
919
1013
|
*capt.anil.sharma@powerpbox.org | +91-7506926394*
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,67 @@
|
|
|
5
5
|
* Author: Capt. Anil Kumar Sharma, PowerPbox IT Solutions Pvt Ltd
|
|
6
6
|
* License: Apache-2.0
|
|
7
7
|
*/
|
|
8
|
+
/** PRB Domain bits (bits 0-7 of the 32-bit Pramana Rule Bitmask) */
|
|
9
|
+
export declare const PRB_DOMAIN: {
|
|
10
|
+
readonly MARITIME: 1;
|
|
11
|
+
readonly LEGAL: 2;
|
|
12
|
+
readonly COMPLIANCE: 4;
|
|
13
|
+
readonly FINANCE: 8;
|
|
14
|
+
readonly LOGISTICS: 16;
|
|
15
|
+
readonly TECH: 32;
|
|
16
|
+
readonly ENERGY: 64;
|
|
17
|
+
readonly HEALTH: 128;
|
|
18
|
+
};
|
|
19
|
+
/** PRB Topic bits (bits 8-15 of the 32-bit Pramana Rule Bitmask) */
|
|
20
|
+
export declare const PRB_TOPIC: {
|
|
21
|
+
readonly SHASTRA: 256;
|
|
22
|
+
readonly YUKTI: 512;
|
|
23
|
+
readonly VIVEKA: 1024;
|
|
24
|
+
readonly RESEARCH: 2048;
|
|
25
|
+
readonly CHAIN: 4096;
|
|
26
|
+
readonly RULE_NODE: 8192;
|
|
27
|
+
};
|
|
28
|
+
/** PRB Confidence tier bits (bits 24-31 of the 32-bit Pramana Rule Bitmask) */
|
|
29
|
+
export declare const PRB_TIER: {
|
|
30
|
+
readonly HIGH: 2147483648;
|
|
31
|
+
readonly MEDIUM: 1073741824;
|
|
32
|
+
readonly LOW: 536870912;
|
|
33
|
+
};
|
|
34
|
+
export type PrbDomainKey = keyof typeof PRB_DOMAIN;
|
|
35
|
+
export type PrbTopicKey = keyof typeof PRB_TOPIC;
|
|
36
|
+
export type PrbTierKey = keyof typeof PRB_TIER;
|
|
37
|
+
/** kitchen_mask — 8-bit bitmask encoding rule provenance and health */
|
|
38
|
+
export declare const KITCHEN: {
|
|
39
|
+
readonly AUTHORED: 1;
|
|
40
|
+
readonly CITED: 2;
|
|
41
|
+
readonly VALIDATED: 4;
|
|
42
|
+
readonly LIVE: 8;
|
|
43
|
+
readonly CONTESTED: 16;
|
|
44
|
+
readonly SLM_TRAINED: 32;
|
|
45
|
+
readonly PHALA_CLEAN: 64;
|
|
46
|
+
readonly PHALA_DIRTY: 128;
|
|
47
|
+
};
|
|
48
|
+
export type KitchenKey = keyof typeof KITCHEN;
|
|
49
|
+
/** Default kitchen_mask for any new rule: AUTHORED | LIVE = 0x09 */
|
|
50
|
+
export declare const KITCHEN_DEFAULT: number;
|
|
51
|
+
/**
|
|
52
|
+
* Decode a kitchen_mask integer into a human-readable array of bit names.
|
|
53
|
+
* e.g. decodeKitchen(0x0b) → ['AUTHORED', 'CITED', 'LIVE']
|
|
54
|
+
*/
|
|
55
|
+
export declare function decodeKitchen(mask: number): KitchenKey[];
|
|
56
|
+
/**
|
|
57
|
+
* Decode a PRB integer into labelled domain, topic, and tier components.
|
|
58
|
+
*/
|
|
59
|
+
export declare function decodePrb(prb: number): {
|
|
60
|
+
domain: PrbDomainKey[];
|
|
61
|
+
topic: PrbTopicKey[];
|
|
62
|
+
tier: PrbTierKey[];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Build topic mask from an array of query slugs / domain strings.
|
|
66
|
+
* Used by PRAMANA to derive intentTopicMask from incoming query context.
|
|
67
|
+
*/
|
|
68
|
+
export declare function topicBitsFromSlugs(slugs: string[]): number;
|
|
8
69
|
export declare const PRAMANA_LEVEL: {
|
|
9
70
|
/** No strand available. Mandatory human check. Never act on this output. */
|
|
10
71
|
readonly UNVERIFIED: 0;
|
|
@@ -33,16 +94,24 @@ export declare const SIGNAL: {
|
|
|
33
94
|
readonly PHALA: "phala";
|
|
34
95
|
};
|
|
35
96
|
export type SignalType = typeof SIGNAL[keyof typeof SIGNAL];
|
|
97
|
+
export declare const ATTESTATION_MODE: {
|
|
98
|
+
readonly ONLINE: "online";
|
|
99
|
+
readonly DORMANT: "dormant";
|
|
100
|
+
readonly UNREGISTERED: "unregistered";
|
|
101
|
+
};
|
|
102
|
+
export type AttestationMode = typeof ATTESTATION_MODE[keyof typeof ATTESTATION_MODE];
|
|
36
103
|
export interface PhalaPayload {
|
|
37
104
|
signal_type: 'phala';
|
|
38
105
|
rule_id: string;
|
|
39
106
|
applied_by: string;
|
|
107
|
+
domain: string;
|
|
40
108
|
query_context: string;
|
|
41
109
|
outcome: 'success' | 'failure' | 'partial';
|
|
42
110
|
strands_available: StrandType[];
|
|
43
111
|
strand_missing: StrandType[];
|
|
44
112
|
authenticity_level: PramanaLevel;
|
|
45
113
|
rca_triggered: boolean;
|
|
114
|
+
attestation_mode?: AttestationMode;
|
|
46
115
|
slm_available?: boolean;
|
|
47
116
|
timestamp: string;
|
|
48
117
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,eAAO,MAAM,aAAa;IACxB,4EAA4E;;IAE5E,6EAA6E;;IAE7E,sEAAsE;;IAEtE,6CAA6C;;IAE7C,iEAAiE;;CAEzD,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE5E,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAMtD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAMvD,CAAC;AAIF,eAAO,MAAM,MAAM;;;;CAIT,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO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AAU,EAAE,EAC9B,YAAY,UAAQ,GACnB,YAAY,CAOd;AAID,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CACzB,gBAAgB,EAAE,UAAU,EAAE,EAC9B,YAAY,UAAQ,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,kBAAkB,CAapB"}
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,92 @@
|
|
|
7
7
|
* License: Apache-2.0
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.RCA_FAILURE = exports.SIGNAL = exports.STRAND = exports.PRAMANA_ACTION = exports.PRAMANA_LABEL = exports.PRAMANA_LEVEL = void 0;
|
|
10
|
+
exports.RCA_FAILURE = exports.ATTESTATION_MODE = exports.SIGNAL = exports.STRAND = exports.PRAMANA_ACTION = exports.PRAMANA_LABEL = exports.PRAMANA_LEVEL = exports.KITCHEN_DEFAULT = exports.KITCHEN = exports.PRB_TIER = exports.PRB_TOPIC = exports.PRB_DOMAIN = void 0;
|
|
11
|
+
exports.decodeKitchen = decodeKitchen;
|
|
12
|
+
exports.decodePrb = decodePrb;
|
|
13
|
+
exports.topicBitsFromSlugs = topicBitsFromSlugs;
|
|
11
14
|
exports.getPramanaLevel = getPramanaLevel;
|
|
12
15
|
exports.buildMarker = buildMarker;
|
|
16
|
+
// ── HBT — Hierarchical Bitmask Trie (v1.2 — SHREEA Protocol Layer 3) ─────────
|
|
17
|
+
/** PRB Domain bits (bits 0-7 of the 32-bit Pramana Rule Bitmask) */
|
|
18
|
+
exports.PRB_DOMAIN = {
|
|
19
|
+
MARITIME: 0x01,
|
|
20
|
+
LEGAL: 0x02,
|
|
21
|
+
COMPLIANCE: 0x04,
|
|
22
|
+
FINANCE: 0x08,
|
|
23
|
+
LOGISTICS: 0x10,
|
|
24
|
+
TECH: 0x20,
|
|
25
|
+
ENERGY: 0x40,
|
|
26
|
+
HEALTH: 0x80,
|
|
27
|
+
};
|
|
28
|
+
/** PRB Topic bits (bits 8-15 of the 32-bit Pramana Rule Bitmask) */
|
|
29
|
+
exports.PRB_TOPIC = {
|
|
30
|
+
SHASTRA: 0x0100, // Domain statutes / rules
|
|
31
|
+
YUKTI: 0x0200, // Reasoning patterns / modus operandi
|
|
32
|
+
VIVEKA: 0x0400, // Inference library / pre-computed conclusions
|
|
33
|
+
RESEARCH: 0x0800, // Research codex / paper nodes
|
|
34
|
+
CHAIN: 0x1000, // Orchestration chains
|
|
35
|
+
RULE_NODE: 0x2000, // Individual rule entries
|
|
36
|
+
};
|
|
37
|
+
/** PRB Confidence tier bits (bits 24-31 of the 32-bit Pramana Rule Bitmask) */
|
|
38
|
+
exports.PRB_TIER = {
|
|
39
|
+
HIGH: 0x80000000,
|
|
40
|
+
MEDIUM: 0x40000000,
|
|
41
|
+
LOW: 0x20000000,
|
|
42
|
+
};
|
|
43
|
+
/** kitchen_mask — 8-bit bitmask encoding rule provenance and health */
|
|
44
|
+
exports.KITCHEN = {
|
|
45
|
+
AUTHORED: 0x01, // Named author recorded (always set on creation)
|
|
46
|
+
CITED: 0x02, // Cites a statute, convention, or published case
|
|
47
|
+
VALIDATED: 0x04, // Domain has CCA proof_coverage >= 70%, or rule is published/certified
|
|
48
|
+
LIVE: 0x08, // Active rule (cleared only on deprecated/superseded)
|
|
49
|
+
CONTESTED: 0x10, // Open dispute or conflicting rule exists
|
|
50
|
+
SLM_TRAINED: 0x20, // Rule included in an SLM fine-tune cycle
|
|
51
|
+
PHALA_CLEAN: 0x40, // Last 10 PHALA signals all success (runtime-managed only)
|
|
52
|
+
PHALA_DIRTY: 0x80, // One or more PHALA failures — RCA pending (runtime-managed only)
|
|
53
|
+
};
|
|
54
|
+
/** Default kitchen_mask for any new rule: AUTHORED | LIVE = 0x09 */
|
|
55
|
+
exports.KITCHEN_DEFAULT = exports.KITCHEN.AUTHORED | exports.KITCHEN.LIVE;
|
|
56
|
+
/**
|
|
57
|
+
* Decode a kitchen_mask integer into a human-readable array of bit names.
|
|
58
|
+
* e.g. decodeKitchen(0x0b) → ['AUTHORED', 'CITED', 'LIVE']
|
|
59
|
+
*/
|
|
60
|
+
function decodeKitchen(mask) {
|
|
61
|
+
return Object.entries(exports.KITCHEN)
|
|
62
|
+
.filter(([, bit]) => (mask & bit) !== 0)
|
|
63
|
+
.map(([key]) => key);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Decode a PRB integer into labelled domain, topic, and tier components.
|
|
67
|
+
*/
|
|
68
|
+
function decodePrb(prb) {
|
|
69
|
+
const domain = Object.entries(exports.PRB_DOMAIN)
|
|
70
|
+
.filter(([, bit]) => (prb & bit) !== 0).map(([k]) => k);
|
|
71
|
+
const topic = Object.entries(exports.PRB_TOPIC)
|
|
72
|
+
.filter(([, bit]) => (prb & bit) !== 0).map(([k]) => k);
|
|
73
|
+
const tier = Object.entries(exports.PRB_TIER)
|
|
74
|
+
.filter(([, bit]) => (prb & bit) !== 0).map(([k]) => k);
|
|
75
|
+
return { domain, topic, tier };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build topic mask from an array of query slugs / domain strings.
|
|
79
|
+
* Used by PRAMANA to derive intentTopicMask from incoming query context.
|
|
80
|
+
*/
|
|
81
|
+
function topicBitsFromSlugs(slugs) {
|
|
82
|
+
let mask = 0;
|
|
83
|
+
const joined = slugs.join(' ').toLowerCase();
|
|
84
|
+
if (/shastra|statute|rule|law|regulation/.test(joined))
|
|
85
|
+
mask |= exports.PRB_TOPIC.SHASTRA;
|
|
86
|
+
if (/yukti|reasoning|pattern|modus|operandi/.test(joined))
|
|
87
|
+
mask |= exports.PRB_TOPIC.YUKTI;
|
|
88
|
+
if (/viveka|inference|conclusion|answer/.test(joined))
|
|
89
|
+
mask |= exports.PRB_TOPIC.VIVEKA;
|
|
90
|
+
if (/research|paper|study|codex/.test(joined))
|
|
91
|
+
mask |= exports.PRB_TOPIC.RESEARCH;
|
|
92
|
+
if (/chain|orchestrat|workflow/.test(joined))
|
|
93
|
+
mask |= exports.PRB_TOPIC.CHAIN;
|
|
94
|
+
return mask;
|
|
95
|
+
}
|
|
13
96
|
// ── Authenticity Levels ────────────────────────────────────────────────────────
|
|
14
97
|
exports.PRAMANA_LEVEL = {
|
|
15
98
|
/** No strand available. Mandatory human check. Never act on this output. */
|
|
@@ -50,6 +133,13 @@ exports.SIGNAL = {
|
|
|
50
133
|
SENSE: 'sense', // What is happening now
|
|
51
134
|
PHALA: 'phala', // Delivery outcome — returned to source RULE (the novel signal)
|
|
52
135
|
};
|
|
136
|
+
// ── Attestation Mode (v1.1 — PRM-AMEND-003) ───────────────────────────────────
|
|
137
|
+
// A service can be offline but still attestable — it was audited and can be woken.
|
|
138
|
+
exports.ATTESTATION_MODE = {
|
|
139
|
+
ONLINE: 'online', // Service was online at proof time — strongest
|
|
140
|
+
DORMANT: 'dormant', // Service was audited but currently offline — awakeable via ankr-ctl
|
|
141
|
+
UNREGISTERED: 'unregistered', // No audit record — proof strand cannot attest
|
|
142
|
+
};
|
|
53
143
|
// ── RCA Failure Types ──────────────────────────────────────────────────────────
|
|
54
144
|
exports.RCA_FAILURE = {
|
|
55
145
|
ROUTING: 'routing', // Wrong service received the query
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AA0DH,sCAIC;AAKD,8BAQC;AAMD,gDASC;AAkGD,0CAUC;AAaD,kCAiBC;AAlOD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AAE,YAAY,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,cAAM,CAAiB,CAAC;IACzD,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtE,OAAO;QACL,KAAK;QACL,KAAK,EAAE,qBAAa,CAAC,KAAK,CAAC;QAC3B,MAAM,EAAE,sBAAc,CAAC,KAAK,CAAC;QAC7B,eAAe,EAAE,gBAAgB;QACjC,eAAe,EAAE,OAAO;QACxB,GAAG,CAAC,KAAK,GAAG,qBAAa,CAAC,SAAS,IAAI,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pramana-protocol",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "PRAMANA/1.0 —
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "PRAMANA/1.0 — SHREEA Protocol Layer 3+4. Three strands. Four signals. Five authenticity levels. HBT kitchen_mask + PRB (Pramana Rule Bitmask) for binary truth at rule level.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -24,7 +24,12 @@
|
|
|
24
24
|
"rca-loop",
|
|
25
25
|
"forja",
|
|
26
26
|
"ankr",
|
|
27
|
-
"dharmakirti"
|
|
27
|
+
"dharmakirti",
|
|
28
|
+
"hbt",
|
|
29
|
+
"kitchen-mask",
|
|
30
|
+
"prb",
|
|
31
|
+
"shreea-protocol",
|
|
32
|
+
"hierarchical-bitmask-trie"
|
|
28
33
|
],
|
|
29
34
|
"author": "Capt. Anil Kumar Sharma <capt.anil.sharma@powerpbox.org> (PowerPbox IT Solutions Pvt Ltd)",
|
|
30
35
|
"license": "Apache-2.0",
|