entroly-wasm 0.19.12 → 1.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entroly-wasm",
3
- "version": "0.19.12",
3
+ "version": "1.0.3",
4
4
  "description": "Information-theoretic context optimization for AI coding agents. Zero-friction, pure WebAssembly - no Python dependency.",
5
5
  "main": "index.js",
6
6
  "types": "pkg/entroly_wasm.d.ts",
@@ -40,6 +40,36 @@ export class WasmEntrolyEngine {
40
40
  * Dependency graph stats.
41
41
  */
42
42
  dep_graph_stats(): any;
43
+ /**
44
+ * Verify and suppress hallucinations in LLM output.
45
+ *
46
+ * Modes:
47
+ * - "audit": no output change, certificates only (for dashboards)
48
+ * - "annotate": append warning footer listing unverified claims
49
+ * - "strict": supported→PASS, abstain→HEDGE [unverified], hallucinated→SUPPRESS
50
+ *
51
+ * Returns a JSON object with:
52
+ * - rewritten_output: the (possibly modified) response text
53
+ * - n_claims, n_supported, n_abstained, n_hallucinated
54
+ * - suppressed_count, warned_count, hallucination_rate
55
+ * - certificates: per-claim verification results
56
+ * - latency_ms
57
+ */
58
+ eicv_suppress(context: string, output: string, profile: string, mode: string): any;
59
+ /**
60
+ * Verify a single claim against evidence using the EICV pipeline.
61
+ *
62
+ * Returns a JSON object with:
63
+ * - phi: epistemic support density [0=hallucinated, 1=grounded]
64
+ * - hallucination_score: 1 - phi
65
+ * - decision: "supported" | "abstain" | "hallucinated"
66
+ * - layer_scores: per-layer breakdown (tg, nli, rnr, gamma, h_sem)
67
+ * - n_claim_atoms, n_ev_atoms, unsupported_fraction, contradiction_fraction
68
+ * - elapsed_ms
69
+ *
70
+ * Profiles: "rag" (default), "qa", "summarization", "dialogue", "fact_check"
71
+ */
72
+ eicv_verify(evidence: string, claim: string, profile: string): any;
43
73
  /**
44
74
  * Detect entropy anomalies.
45
75
  */
@@ -80,6 +80,65 @@ class WasmEntrolyEngine {
80
80
  const ret = wasm.wasmentrolyengine_dep_graph_stats(this.__wbg_ptr);
81
81
  return ret;
82
82
  }
83
+ /**
84
+ * Verify and suppress hallucinations in LLM output.
85
+ *
86
+ * Modes:
87
+ * - "audit": no output change, certificates only (for dashboards)
88
+ * - "annotate": append warning footer listing unverified claims
89
+ * - "strict": supported→PASS, abstain→HEDGE [unverified], hallucinated→SUPPRESS
90
+ *
91
+ * Returns a JSON object with:
92
+ * - rewritten_output: the (possibly modified) response text
93
+ * - n_claims, n_supported, n_abstained, n_hallucinated
94
+ * - suppressed_count, warned_count, hallucination_rate
95
+ * - certificates: per-claim verification results
96
+ * - latency_ms
97
+ * @param {string} context
98
+ * @param {string} output
99
+ * @param {string} profile
100
+ * @param {string} mode
101
+ * @returns {any}
102
+ */
103
+ eicv_suppress(context, output, profile, mode) {
104
+ const ptr0 = passStringToWasm0(context, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len0 = WASM_VECTOR_LEN;
106
+ const ptr1 = passStringToWasm0(output, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
107
+ const len1 = WASM_VECTOR_LEN;
108
+ const ptr2 = passStringToWasm0(profile, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
109
+ const len2 = WASM_VECTOR_LEN;
110
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
111
+ const len3 = WASM_VECTOR_LEN;
112
+ const ret = wasm.wasmentrolyengine_eicv_suppress(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
113
+ return ret;
114
+ }
115
+ /**
116
+ * Verify a single claim against evidence using the EICV pipeline.
117
+ *
118
+ * Returns a JSON object with:
119
+ * - phi: epistemic support density [0=hallucinated, 1=grounded]
120
+ * - hallucination_score: 1 - phi
121
+ * - decision: "supported" | "abstain" | "hallucinated"
122
+ * - layer_scores: per-layer breakdown (tg, nli, rnr, gamma, h_sem)
123
+ * - n_claim_atoms, n_ev_atoms, unsupported_fraction, contradiction_fraction
124
+ * - elapsed_ms
125
+ *
126
+ * Profiles: "rag" (default), "qa", "summarization", "dialogue", "fact_check"
127
+ * @param {string} evidence
128
+ * @param {string} claim
129
+ * @param {string} profile
130
+ * @returns {any}
131
+ */
132
+ eicv_verify(evidence, claim, profile) {
133
+ const ptr0 = passStringToWasm0(evidence, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ const ptr1 = passStringToWasm0(claim, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ const len1 = WASM_VECTOR_LEN;
137
+ const ptr2 = passStringToWasm0(profile, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ const len2 = WASM_VECTOR_LEN;
139
+ const ret = wasm.wasmentrolyengine_eicv_verify(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
140
+ return ret;
141
+ }
83
142
  /**
84
143
  * Detect entropy anomalies.
85
144
  * @returns {any}
Binary file