pramana-protocol 1.2.0 → 1.3.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/dist/index.d.ts +124 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -35
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,35 +5,60 @@
|
|
|
5
5
|
* Author: Capt. Anil Kumar Sharma, PowerPbox IT Solutions Pvt Ltd
|
|
6
6
|
* License: Apache-2.0
|
|
7
7
|
*/
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* PRB Domain bits (bits 0-7 of the 32-bit Pramana Rule Bitmask)
|
|
10
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
11
|
+
*/
|
|
9
12
|
export declare const PRB_DOMAIN: {
|
|
10
13
|
readonly MARITIME: 1;
|
|
11
14
|
readonly LEGAL: 2;
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
15
|
+
readonly TRADE: 4;
|
|
16
|
+
readonly COMPLY: 8;
|
|
17
|
+
readonly FINANCE: 16;
|
|
18
|
+
readonly LOGISTICS: 32;
|
|
16
19
|
readonly ENERGY: 64;
|
|
17
|
-
readonly
|
|
20
|
+
readonly TECH: 128;
|
|
18
21
|
};
|
|
19
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* PRB Topic bits (bits 8-15) — domain-specific subject areas
|
|
24
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
25
|
+
*/
|
|
20
26
|
export declare const PRB_TOPIC: {
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
26
|
-
readonly
|
|
27
|
+
readonly BOOKING: 256;
|
|
28
|
+
readonly ARBITRATION: 512;
|
|
29
|
+
readonly FILING: 1024;
|
|
30
|
+
readonly COMPLIANCE: 2048;
|
|
31
|
+
readonly CHARTER: 4096;
|
|
32
|
+
readonly VOYAGE: 8192;
|
|
33
|
+
readonly CARGO: 16384;
|
|
34
|
+
readonly SANCTIONS: 32768;
|
|
27
35
|
};
|
|
28
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* PRB Tier bits (bits 16-23) — knowledge layer classification
|
|
38
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
39
|
+
*/
|
|
29
40
|
export declare const PRB_TIER: {
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
41
|
+
readonly SHASTRA: 65536;
|
|
42
|
+
readonly YUKTI: 131072;
|
|
43
|
+
readonly VIVEKA: 262144;
|
|
44
|
+
readonly STATUTE: 524288;
|
|
45
|
+
readonly INFERENCE: 1048576;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* PRB Confidence bits (bits 24-31)
|
|
49
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
50
|
+
*/
|
|
51
|
+
export declare const PRB_CONFIDENCE: {
|
|
52
|
+
readonly HIGH: 16777216;
|
|
53
|
+
readonly MEDIUM: 33554432;
|
|
54
|
+
readonly LOW: 67108864;
|
|
55
|
+
readonly INFERRED: 134217728;
|
|
56
|
+
readonly SLM_ONLY: 268435456;
|
|
33
57
|
};
|
|
34
58
|
export type PrbDomainKey = keyof typeof PRB_DOMAIN;
|
|
35
59
|
export type PrbTopicKey = keyof typeof PRB_TOPIC;
|
|
36
60
|
export type PrbTierKey = keyof typeof PRB_TIER;
|
|
61
|
+
export type PrbConfidenceKey = keyof typeof PRB_CONFIDENCE;
|
|
37
62
|
/** kitchen_mask — 8-bit bitmask encoding rule provenance and health */
|
|
38
63
|
export declare const KITCHEN: {
|
|
39
64
|
readonly AUTHORED: 1;
|
|
@@ -54,16 +79,17 @@ export declare const KITCHEN_DEFAULT: number;
|
|
|
54
79
|
*/
|
|
55
80
|
export declare function decodeKitchen(mask: number): KitchenKey[];
|
|
56
81
|
/**
|
|
57
|
-
* Decode a PRB integer into labelled domain, topic, and
|
|
82
|
+
* Decode a PRB integer into labelled domain, topic, tier, and confidence components.
|
|
58
83
|
*/
|
|
59
84
|
export declare function decodePrb(prb: number): {
|
|
60
85
|
domain: PrbDomainKey[];
|
|
61
86
|
topic: PrbTopicKey[];
|
|
62
87
|
tier: PrbTierKey[];
|
|
88
|
+
confidence: PrbConfidenceKey[];
|
|
63
89
|
};
|
|
64
90
|
/**
|
|
65
|
-
* Build
|
|
66
|
-
* Used by PRAMANA to derive
|
|
91
|
+
* Build tier mask from query slugs (maps natural language to PRB_TIER bits).
|
|
92
|
+
* Used by PRAMANA to derive intent from incoming query context.
|
|
67
93
|
*/
|
|
68
94
|
export declare function topicBitsFromSlugs(slugs: string[]): number;
|
|
69
95
|
export declare const PRAMANA_LEVEL: {
|
|
@@ -132,4 +158,82 @@ export interface AuthenticityMarker {
|
|
|
132
158
|
explanation?: string;
|
|
133
159
|
}
|
|
134
160
|
export declare function buildMarker(strandsAvailable: StrandType[], slmAvailable?: boolean, explanation?: string): AuthenticityMarker;
|
|
161
|
+
/**
|
|
162
|
+
* A single node returned by HBT traversal.
|
|
163
|
+
* Maps to GET /api/hbt/traverse response nodes.
|
|
164
|
+
*/
|
|
165
|
+
export interface TraversalNode {
|
|
166
|
+
id: string;
|
|
167
|
+
title: string;
|
|
168
|
+
domain: string;
|
|
169
|
+
prb: number;
|
|
170
|
+
kitchen_mask: number;
|
|
171
|
+
confidence: number;
|
|
172
|
+
status: string;
|
|
173
|
+
/** True if PHALA_DIRTY bit is set — PRAMANA level should be demoted by 1 */
|
|
174
|
+
phala_dirty: boolean;
|
|
175
|
+
/** True if PHALA_CLEAN bit is set — last 10 signals all success */
|
|
176
|
+
phala_clean: boolean;
|
|
177
|
+
/** Fraction of requested bits matched (0.0–1.0) */
|
|
178
|
+
match_score: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Full result from HBT traversal engine.
|
|
182
|
+
* Maps to POST /api/hbt/traverse response (GRANTHX port 4130).
|
|
183
|
+
*/
|
|
184
|
+
export interface TraversalResult {
|
|
185
|
+
nodes: TraversalNode[];
|
|
186
|
+
total_indexed: number;
|
|
187
|
+
domain_matched: number;
|
|
188
|
+
topic_matched: number;
|
|
189
|
+
returned: number;
|
|
190
|
+
elapsed_ms: number;
|
|
191
|
+
match_method: 'prb_full' | 'prb_domain_only' | 'none';
|
|
192
|
+
has_dirty_nodes: boolean;
|
|
193
|
+
intent?: {
|
|
194
|
+
domain_bit: number;
|
|
195
|
+
topic_mask: number;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Intent vector derived from natural language query + domain hint.
|
|
200
|
+
* Input to HBT traversal. Output of `encodeIntent()`.
|
|
201
|
+
*/
|
|
202
|
+
export interface IntentVector {
|
|
203
|
+
/** PRB domain bits (one or more PRB_DOMAIN bits ORed together) */
|
|
204
|
+
intentDomainBit: number;
|
|
205
|
+
/** PRB topic + tier bits (from PRB_TOPIC + PRB_TIER, may be 0 = any) */
|
|
206
|
+
intentTopicMask: number;
|
|
207
|
+
labels: {
|
|
208
|
+
domains: string[];
|
|
209
|
+
topics: string[];
|
|
210
|
+
};
|
|
211
|
+
/** True if query spans more than one domain */
|
|
212
|
+
multiDomain: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Domain branch entry from the HBT L1 domain index.
|
|
216
|
+
* Returned by GET /api/hbt/domain-branches.
|
|
217
|
+
*/
|
|
218
|
+
export interface DomainBranch {
|
|
219
|
+
domain_bit: number;
|
|
220
|
+
domain_name: string;
|
|
221
|
+
domain_hex: string;
|
|
222
|
+
service_count: number;
|
|
223
|
+
services: Array<{
|
|
224
|
+
id: string;
|
|
225
|
+
description?: string;
|
|
226
|
+
}>;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Full domain branch index (L1 of the HBT).
|
|
230
|
+
* Returned by GET /api/hbt/domain-branches.
|
|
231
|
+
*/
|
|
232
|
+
export interface DomainBranchIndex {
|
|
233
|
+
built_at: string;
|
|
234
|
+
universe_mask: number;
|
|
235
|
+
universe_hex: string;
|
|
236
|
+
total_services: number;
|
|
237
|
+
branches: DomainBranch[];
|
|
238
|
+
}
|
|
135
239
|
//# sourceMappingURL=index.d.ts.map
|
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
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;CASb,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;CASZ,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;CAMX,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;;CAMjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAO,MAAM,OAAO,UAAU,CAAC;AACvD,MAAM,MAAM,WAAW,GAAQ,MAAM,OAAO,SAAS,CAAC;AACtD,MAAM,MAAM,UAAU,GAAS,MAAM,OAAO,QAAQ,CAAC;AACrD,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,cAAc,CAAC;AAE3D,uEAAuE;AACvE,eAAO,MAAM,OAAO;;;;;;;;;CASV,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,OAAO,CAAC;AAE9C,oEAAoE;AACpE,eAAO,MAAM,eAAe,QAAkC,CAAC;AAE/D;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAIxD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG;IACtC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,KAA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AAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,UAAU,GAAG,iBAAiB,GAAG,MAAM,CAAC;IACtD,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,eAAe,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;IACF,+CAA+C;IAC/C,WAAW,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B"}
|
package/dist/index.js
CHANGED
|
@@ -7,38 +7,62 @@
|
|
|
7
7
|
* License: Apache-2.0
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
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_CONFIDENCE = exports.PRB_TIER = exports.PRB_TOPIC = exports.PRB_DOMAIN = void 0;
|
|
11
11
|
exports.decodeKitchen = decodeKitchen;
|
|
12
12
|
exports.decodePrb = decodePrb;
|
|
13
13
|
exports.topicBitsFromSlugs = topicBitsFromSlugs;
|
|
14
14
|
exports.getPramanaLevel = getPramanaLevel;
|
|
15
15
|
exports.buildMarker = buildMarker;
|
|
16
16
|
// ── HBT — Hierarchical Bitmask Trie (v1.2 — SHREEA Protocol Layer 3) ─────────
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* PRB Domain bits (bits 0-7 of the 32-bit Pramana Rule Bitmask)
|
|
19
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
20
|
+
*/
|
|
18
21
|
exports.PRB_DOMAIN = {
|
|
19
|
-
MARITIME:
|
|
20
|
-
LEGAL:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
ENERGY:
|
|
26
|
-
|
|
22
|
+
MARITIME: 0x00000001, // Bit 0
|
|
23
|
+
LEGAL: 0x00000002, // Bit 1
|
|
24
|
+
TRADE: 0x00000004, // Bit 2 — trade / customs / FTA
|
|
25
|
+
COMPLY: 0x00000008, // Bit 3 — compliance / regulatory
|
|
26
|
+
FINANCE: 0x00000010, // Bit 4
|
|
27
|
+
LOGISTICS: 0x00000020, // Bit 5
|
|
28
|
+
ENERGY: 0x00000040, // Bit 6
|
|
29
|
+
TECH: 0x00000080, // Bit 7 — ANKR platform / AI / software
|
|
27
30
|
};
|
|
28
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* PRB Topic bits (bits 8-15) — domain-specific subject areas
|
|
33
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
34
|
+
*/
|
|
29
35
|
exports.PRB_TOPIC = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
BOOKING: 0x00000100, // Bit 8
|
|
37
|
+
ARBITRATION: 0x00000200, // Bit 9
|
|
38
|
+
FILING: 0x00000400, // Bit 10
|
|
39
|
+
COMPLIANCE: 0x00000800, // Bit 11
|
|
40
|
+
CHARTER: 0x00001000, // Bit 12
|
|
41
|
+
VOYAGE: 0x00002000, // Bit 13
|
|
42
|
+
CARGO: 0x00004000, // Bit 14
|
|
43
|
+
SANCTIONS: 0x00008000, // Bit 15
|
|
36
44
|
};
|
|
37
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* PRB Tier bits (bits 16-23) — knowledge layer classification
|
|
47
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
48
|
+
*/
|
|
38
49
|
exports.PRB_TIER = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
SHASTRA: 0x00010000, // Bit 16 — domain statute / rule
|
|
51
|
+
YUKTI: 0x00020000, // Bit 17 — modus operandi / meta-reasoning
|
|
52
|
+
VIVEKA: 0x00040000, // Bit 18 — inference / pre-computed conclusion
|
|
53
|
+
STATUTE: 0x00080000, // Bit 19 — direct statutory reference
|
|
54
|
+
INFERENCE: 0x00100000, // Bit 20 — AI-inferred, not yet validated
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* PRB Confidence bits (bits 24-31)
|
|
58
|
+
* Canonical values — must match ankr-hbt-constants.ts
|
|
59
|
+
*/
|
|
60
|
+
exports.PRB_CONFIDENCE = {
|
|
61
|
+
HIGH: 0x01000000, // Bit 24 — confidence >= 0.90
|
|
62
|
+
MEDIUM: 0x02000000, // Bit 25 — confidence 0.70–0.89
|
|
63
|
+
LOW: 0x04000000, // Bit 26 — confidence < 0.70
|
|
64
|
+
INFERRED: 0x08000000, // Bit 27 — SLM-inferred, no human validation
|
|
65
|
+
SLM_ONLY: 0x10000000, // Bit 28 — no rule grounding at all
|
|
42
66
|
};
|
|
43
67
|
/** kitchen_mask — 8-bit bitmask encoding rule provenance and health */
|
|
44
68
|
exports.KITCHEN = {
|
|
@@ -63,7 +87,7 @@ function decodeKitchen(mask) {
|
|
|
63
87
|
.map(([key]) => key);
|
|
64
88
|
}
|
|
65
89
|
/**
|
|
66
|
-
* Decode a PRB integer into labelled domain, topic, and
|
|
90
|
+
* Decode a PRB integer into labelled domain, topic, tier, and confidence components.
|
|
67
91
|
*/
|
|
68
92
|
function decodePrb(prb) {
|
|
69
93
|
const domain = Object.entries(exports.PRB_DOMAIN)
|
|
@@ -72,25 +96,31 @@ function decodePrb(prb) {
|
|
|
72
96
|
.filter(([, bit]) => (prb & bit) !== 0).map(([k]) => k);
|
|
73
97
|
const tier = Object.entries(exports.PRB_TIER)
|
|
74
98
|
.filter(([, bit]) => (prb & bit) !== 0).map(([k]) => k);
|
|
75
|
-
|
|
99
|
+
const confidence = Object.entries(exports.PRB_CONFIDENCE)
|
|
100
|
+
.filter(([, bit]) => (prb & bit) !== 0).map(([k]) => k);
|
|
101
|
+
return { domain, topic, tier, confidence };
|
|
76
102
|
}
|
|
77
103
|
/**
|
|
78
|
-
* Build
|
|
79
|
-
* Used by PRAMANA to derive
|
|
104
|
+
* Build tier mask from query slugs (maps natural language to PRB_TIER bits).
|
|
105
|
+
* Used by PRAMANA to derive intent from incoming query context.
|
|
80
106
|
*/
|
|
81
107
|
function topicBitsFromSlugs(slugs) {
|
|
82
108
|
let mask = 0;
|
|
83
109
|
const joined = slugs.join(' ').toLowerCase();
|
|
84
|
-
if (/shastra|statute|rule|law|regulation/.test(joined))
|
|
85
|
-
mask |= exports.
|
|
86
|
-
if (/yukti|reasoning|pattern|modus|operandi/.test(joined))
|
|
87
|
-
mask |= exports.
|
|
88
|
-
if (/viveka|inference|conclusion|answer/.test(joined))
|
|
89
|
-
mask |= exports.
|
|
90
|
-
if (/
|
|
91
|
-
mask |= exports.PRB_TOPIC.
|
|
92
|
-
if (/
|
|
93
|
-
mask |= exports.PRB_TOPIC.
|
|
110
|
+
if (/shastra|statute|rule\b|law|regulation|act\b|convention/.test(joined))
|
|
111
|
+
mask |= exports.PRB_TIER.SHASTRA;
|
|
112
|
+
if (/yukti|reasoning|pattern|modus|operandi|how.to|calculate/.test(joined))
|
|
113
|
+
mask |= exports.PRB_TIER.YUKTI;
|
|
114
|
+
if (/viveka|inference|conclusion|answer|outcome|recommend/.test(joined))
|
|
115
|
+
mask |= exports.PRB_TIER.VIVEKA;
|
|
116
|
+
if (/booking|charter|voyage|cargo/.test(joined))
|
|
117
|
+
mask |= exports.PRB_TOPIC.CHARTER | exports.PRB_TOPIC.VOYAGE;
|
|
118
|
+
if (/arbitration|dispute/.test(joined))
|
|
119
|
+
mask |= exports.PRB_TOPIC.ARBITRATION;
|
|
120
|
+
if (/filing|return|form\b/.test(joined))
|
|
121
|
+
mask |= exports.PRB_TOPIC.FILING;
|
|
122
|
+
if (/sanction|ofac/.test(joined))
|
|
123
|
+
mask |= exports.PRB_TOPIC.SANCTIONS;
|
|
94
124
|
return mask;
|
|
95
125
|
}
|
|
96
126
|
// ── Authenticity Levels ────────────────────────────────────────────────────────
|
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;;;AAoFH,sCAIC;AAKD,8BAeC;AAMD,gDAWC;AAkGD,0CAUC;AAaD,kCAiBC;AArQD,gFAAgF;AAEh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C;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 — SHREEA Protocol
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "PRAMANA/1.0 — SHREEA Protocol Layers 3+4. Three strands. Four signals. Five levels. HBT PRB + kitchen_mask + TraversalResult + DomainBranchIndex types. Binary truth at every level.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|