@oh-my-pi/pi-mnemopi 18.2.10 → 18.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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @oh-my-pi/pi-mnemopi
|
|
2
2
|
|
|
3
|
-
Local SQLite memory engine for
|
|
3
|
+
Local SQLite memory engine for omp agents.
|
|
4
4
|
|
|
5
5
|
This package is the Bun/TypeScript port of the Mnemosyne memory engine. It provides:
|
|
6
6
|
|
|
@@ -72,7 +72,7 @@ const dynamicLlm = new Mnemopi({
|
|
|
72
72
|
|
|
73
73
|
`Mnemopi` itself exposes banks directly through constructor options such as `bank`; it does not hard-code coding-agent project scoping.
|
|
74
74
|
|
|
75
|
-
The
|
|
75
|
+
The omp coding-agent wrapper adds `mnemopi.scoping` on top of those constructor options:
|
|
76
76
|
|
|
77
77
|
- `global`: one shared bank
|
|
78
78
|
- `per-project`: isolated project memory
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -293,7 +293,7 @@ MIT License
|
|
|
293
293
|
Copyright (c) 2026 Sander Land
|
|
294
294
|
(measured tokenizer vocabulary data, reconstruction model, and reference
|
|
295
295
|
implementation: https://github.com/sanderland/ctok)
|
|
296
|
-
Copyright (c) 2026 Can Bölük and the
|
|
296
|
+
Copyright (c) 2026 Can Bölük and the omp contributors
|
|
297
297
|
Copyright (c) 2026 Stencil Labs, Inc.
|
|
298
298
|
(Rust implementation and the compact binary vocabulary encoding in
|
|
299
299
|
crates/pi-natives/src/utok/claude)
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-mnemopi",
|
|
4
|
-
"version": "18.
|
|
5
|
-
"description": "Local SQLite memory engine for
|
|
4
|
+
"version": "18.3.0",
|
|
5
|
+
"description": "Local SQLite memory engine for omp agents",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
|
-
"author":
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "Stencil Labs, Inc.",
|
|
9
|
+
"url": "https://stencil.so"
|
|
10
|
+
},
|
|
8
11
|
"contributors": [
|
|
9
12
|
"Abdias J"
|
|
10
13
|
],
|
|
@@ -39,10 +42,10 @@
|
|
|
39
42
|
"fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
|
|
40
43
|
},
|
|
41
44
|
"dependencies": {
|
|
42
|
-
"@oh-my-pi/pi-ai": "18.
|
|
43
|
-
"@oh-my-pi/pi-catalog": "18.
|
|
44
|
-
"@oh-my-pi/pi-natives": "18.
|
|
45
|
-
"@oh-my-pi/pi-utils": "18.
|
|
45
|
+
"@oh-my-pi/pi-ai": "18.3.0",
|
|
46
|
+
"@oh-my-pi/pi-catalog": "18.3.0",
|
|
47
|
+
"@oh-my-pi/pi-natives": "18.3.0",
|
|
48
|
+
"@oh-my-pi/pi-utils": "18.3.0"
|
|
46
49
|
},
|
|
47
50
|
"peerDependencies": {
|
|
48
51
|
"fastembed": "2.1.0",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
2
|
import { homedir } from "node:os";
|
|
4
3
|
import { join } from "node:path";
|
|
@@ -25,7 +24,7 @@ export function blobRoot(env: NodeJS.ProcessEnv = process.env): string {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
export function computeSha256(data: Uint8Array | string): string {
|
|
28
|
-
return
|
|
27
|
+
return Bun.SHA256.hash(data, "hex");
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
export function isDataUri(content: string): boolean {
|
package/src/core/shmr.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
2
|
import { cosineSimilarityPairs } from "@oh-my-pi/pi-natives";
|
|
4
3
|
import { logger } from "@oh-my-pi/pi-utils";
|
|
5
4
|
import * as embeddings from "./embeddings";
|
|
@@ -109,9 +108,10 @@ export function initSchema(db: Database): void {
|
|
|
109
108
|
function hashEmbedding(text: string): Vector {
|
|
110
109
|
const out = new Float32Array(EMBEDDING_DIM);
|
|
111
110
|
const words = text.toLowerCase().match(/[a-z0-9]+/g) ?? [];
|
|
111
|
+
const digest = new Uint8Array(20);
|
|
112
112
|
for (const word of words) {
|
|
113
|
-
|
|
114
|
-
const slot = digest
|
|
113
|
+
Bun.SHA1.hash(word, digest);
|
|
114
|
+
const slot = ((digest[0] << 8) | digest[1]) % EMBEDDING_DIM;
|
|
115
115
|
out[slot] = (out[slot] ?? 0) + 1;
|
|
116
116
|
}
|
|
117
117
|
return out;
|
|
@@ -335,10 +335,10 @@ export function applyBeliefs(
|
|
|
335
335
|
confidence,
|
|
336
336
|
belief.target_fact_id,
|
|
337
337
|
]);
|
|
338
|
-
const beliefId =
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
338
|
+
const beliefId = Bun.SHA256.hash(
|
|
339
|
+
`${clusterId}:${belief.subject}:${belief.predicate}:${belief.object.slice(0, 50)}`,
|
|
340
|
+
"hex",
|
|
341
|
+
).slice(0, 24);
|
|
342
342
|
const provenance = JSON.stringify(
|
|
343
343
|
cluster.map(item => item.fact_id).filter((id): id is string => typeof id === "string"),
|
|
344
344
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
2
|
import { type DatabasePath, openDatabase } from "../db";
|
|
4
3
|
|
|
5
4
|
export const VERACITY_WEIGHTS = Object.freeze({
|
|
@@ -123,12 +122,12 @@ export function computeFactId(subject: string, predicate: string, object: string
|
|
|
123
122
|
if (value === "") throw new RangeError(`compute_fact_id: ${name} must be non-empty`);
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
const
|
|
125
|
+
const hash = new Bun.SHA256();
|
|
127
126
|
for (const value of [subject, predicate, object]) {
|
|
128
127
|
const bytes = Buffer.from(value.normalize("NFC"), "utf8");
|
|
129
|
-
|
|
128
|
+
hash.update(`${bytes.length}:`).update(bytes);
|
|
130
129
|
}
|
|
131
|
-
return `cf_${
|
|
130
|
+
return `cf_${hash.digest("hex").slice(0, 24)}`;
|
|
132
131
|
}
|
|
133
132
|
export function clampVeracity(raw: unknown, context = "veracity"): Veracity {
|
|
134
133
|
if (raw === null || raw === undefined) return "unknown";
|
package/src/dr/recovery.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
2
|
import {
|
|
4
3
|
copyFileSync,
|
|
5
4
|
existsSync,
|
|
@@ -90,8 +89,8 @@ function timestampForBackup(now = new Date()): string {
|
|
|
90
89
|
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
function sha256Hex16(bytes:
|
|
94
|
-
return
|
|
92
|
+
function sha256Hex16(bytes: Uint8Array): string {
|
|
93
|
+
return Bun.SHA256.hash(bytes, "hex").slice(0, 16);
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
function nextUniqueToken(): string {
|