prism-mcp-server 9.2.6 β 9.2.7
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 +37 -0
- package/dist/darkfactory/safetyController.js +6 -0
- package/dist/utils/crdtMerge.js +22 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -503,6 +503,43 @@ A gorgeous glassmorphism UI at `localhost:3000` that lets you see exactly what y
|
|
|
503
503
|
### 𧬠10à Memory Compression
|
|
504
504
|
Powered by a pure TypeScript port of Google's TurboQuant (inspired by Google's ICLR research), Prism compresses 768-dim embeddings from **3,072 bytes β ~400 bytes** β enabling decades of session history on a standard laptop. No native modules. No vector database required. To mitigate quantization degradation (where repeated compress/decompress cycles could smear subtle corrections after 10k+ memories), Prism leverages autonomous **ledger compaction** and **Deep Storage cleanup** to guarantee high-fidelity memory integrity over time.
|
|
505
505
|
|
|
506
|
+
<details>
|
|
507
|
+
<summary><strong>π 1M-Vector Benchmark (d=768, 4-bit)</strong></summary>
|
|
508
|
+
|
|
509
|
+
Validated on 1,000,000 synthetic unit vectors at production dimension (d=768), run on Apple M4 Max (36GB):
|
|
510
|
+
|
|
511
|
+
| Metric | Value |
|
|
512
|
+
|--------|-------|
|
|
513
|
+
| **Compression ratio** | 7.7Γ (3,072 β 400 bytes) |
|
|
514
|
+
| **Throughput** | 833 vectors/sec |
|
|
515
|
+
| **Peak heap** | 329 MB |
|
|
516
|
+
| **Total time** | 57.6 minutes |
|
|
517
|
+
|
|
518
|
+
**Residual norm distribution** β the quantization error after Householder rotation + Lloyd-Max scalar quantization:
|
|
519
|
+
|
|
520
|
+
| Statistic | Value |
|
|
521
|
+
|-----------|-------|
|
|
522
|
+
| Mean | 0.1855 |
|
|
523
|
+
| CV (coefficient of variation) | **0.038** |
|
|
524
|
+
| P99/P50 ratio | **1.11** |
|
|
525
|
+
| P99.9/P50 ratio | 1.16 |
|
|
526
|
+
| Max/Min ratio | 1.46 |
|
|
527
|
+
| IQR | 0.009 |
|
|
528
|
+
|
|
529
|
+
A CV of 0.038 means the residual norm barely varies across 1M vectors β **there is effectively no long tail**. The QJL correction term (which scales linearly with residualNorm) remains stable even for P99.9 outliers.
|
|
530
|
+
|
|
531
|
+
**R@k retrieval accuracy** (global corpus, 30 trials):
|
|
532
|
+
|
|
533
|
+
| Corpus Size | R@1 | R@5 |
|
|
534
|
+
|-------------|-----|-----|
|
|
535
|
+
| N=1,000 | 20.0% | 60.0% |
|
|
536
|
+
| N=10,000 | 36.7% | 76.7% |
|
|
537
|
+
| N=50,000 | 53.3% | **90.0%** |
|
|
538
|
+
|
|
539
|
+
> **Note:** R@k on random high-dimensional vectors is inherently harder than on real embeddings (all vectors are near-equidistant in d=768). Real-world retrieval with clustered embeddings produces higher accuracy. See [tests/residual-distribution.test.ts](tests/residual-distribution.test.ts) and [tests/benchmarks/residual-1m.ts](tests/benchmarks/residual-1m.ts) for full methodology.
|
|
540
|
+
|
|
541
|
+
</details>
|
|
542
|
+
|
|
506
543
|
### π Multi-Agent Hivemind & Enterprise Sync
|
|
507
544
|
While local SQLite is amazing for solo developers, enterprise teams cannot share a local SQLite file. Prism breaks the "local-only" ceiling via **Supabase Sync** and the **Multi-Agent Hivemind**βscaling effortlessly to teams of 50+ developers using agents. Multiple agents (dev, QA, PM) can work on the same project with **role-isolated memory**, discover each other automatically, and share context in real-time via Telepathy sync to a shared Postgres backend. β [Multi-agent setup example](examples/multi-agent-hivemind/)
|
|
508
545
|
|
|
@@ -84,6 +84,12 @@ export class SafetyController {
|
|
|
84
84
|
if (!action.targetPath || typeof action.targetPath !== 'string' || action.targetPath.trim() === '') {
|
|
85
85
|
return `Action[${i}]: targetPath is empty or missing`;
|
|
86
86
|
}
|
|
87
|
+
// Null-byte injection guard: C-string truncation attack vector.
|
|
88
|
+
// A path like "src/\0../../etc/passwd" would be truncated at the null byte
|
|
89
|
+
// by native fs syscalls, potentially resolving to an unintended location.
|
|
90
|
+
if (action.targetPath.includes('\0')) {
|
|
91
|
+
return `Action[${i}]: targetPath contains null byte (injection attempt)`;
|
|
92
|
+
}
|
|
87
93
|
// Resolve targetPath relative to workingDirectory for scope check
|
|
88
94
|
const resolvedTarget = spec.workingDirectory
|
|
89
95
|
? path.resolve(spec.workingDirectory, action.targetPath)
|
package/dist/utils/crdtMerge.js
CHANGED
|
@@ -40,13 +40,28 @@
|
|
|
40
40
|
//
|
|
41
41
|
// This is a zero-dependency, fast (~10ms for a typical handoff object)
|
|
42
42
|
// solution appropriate for Prism's small merge surfaces.
|
|
43
|
+
/**
|
|
44
|
+
* Typed error thrown when sanitizeForMerge() detects prototype pollution.
|
|
45
|
+
* Provides the offending key for forensic logging and distinct catch handling.
|
|
46
|
+
*/
|
|
47
|
+
export class PrototypePollutionError extends Error {
|
|
48
|
+
offendingKey;
|
|
49
|
+
constructor(key) {
|
|
50
|
+
super(`Security violation: prototype pollution attempt detected via key "${key}"`);
|
|
51
|
+
this.name = "PrototypePollutionError";
|
|
52
|
+
this.offendingKey = key;
|
|
53
|
+
if (Error.captureStackTrace) {
|
|
54
|
+
Error.captureStackTrace(this, PrototypePollutionError);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
43
58
|
const FORBIDDEN_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
44
59
|
function walkForForbiddenKeys(current) {
|
|
45
60
|
if (!current || typeof current !== "object")
|
|
46
61
|
return;
|
|
47
62
|
for (const key of Object.keys(current)) {
|
|
48
63
|
if (FORBIDDEN_KEYS.has(key)) {
|
|
49
|
-
throw new
|
|
64
|
+
throw new PrototypePollutionError(key);
|
|
50
65
|
}
|
|
51
66
|
walkForForbiddenKeys(current[key]);
|
|
52
67
|
}
|
|
@@ -63,18 +78,19 @@ export function sanitizeForMerge(obj) {
|
|
|
63
78
|
walkForForbiddenKeys(obj);
|
|
64
79
|
return JSON.parse(JSON.stringify(obj));
|
|
65
80
|
}
|
|
66
|
-
// βββ OR-Set Logic (
|
|
81
|
+
// βββ OR-Set Logic (Remove-Wins-from-Either) ββββββββββββββββββββ
|
|
67
82
|
//
|
|
68
83
|
// 3-way set merge:
|
|
69
84
|
// added_by_incoming = incoming - base
|
|
70
85
|
// removed_by_incoming = base - incoming
|
|
71
86
|
// added_by_current = current - base
|
|
72
87
|
// removed_by_current = base - current
|
|
73
|
-
// result = (base -
|
|
88
|
+
// result = (base - all_removals) βͺ all_adds
|
|
74
89
|
//
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
90
|
+
// SEMANTICS: Items removed by EITHER agent are dropped from the base.
|
|
91
|
+
// Fresh additions from either agent are always preserved (union).
|
|
92
|
+
// This means a removal by one agent wins over non-action by the other,
|
|
93
|
+
// but cannot override a fresh add. Safe for TODOs and keywords.
|
|
78
94
|
function mergeArray(b = [], i = [], c = []) {
|
|
79
95
|
const bSet = new Set(b);
|
|
80
96
|
const iSet = new Set(i);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prism-mcp-server",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.7",
|
|
4
4
|
"mcpName": "io.github.dcostenco/prism-mcp",
|
|
5
5
|
"description": "The Mind Palace for AI Agents β a true Cognitive Architecture with Hebbian learning (episodicβsemantic consolidation), ACT-R spreading activation (multi-hop causal reasoning), uncertainty-aware rejection gates (agents that know when they don't know), adversarial evaluation (anti-sycophancy), fail-closed Dark Factory pipelines, persistent memory (SQLite/Supabase), multi-agent Hivemind, time travel & visual dashboard. Zero-config local mode.",
|
|
6
6
|
"module": "index.ts",
|