mem-os-python 1.6.27__py3-none-any.whl
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.
- mem_os_python-1.6.27.dist-info/METADATA +1032 -0
- mem_os_python-1.6.27.dist-info/RECORD +253 -0
- mem_os_python-1.6.27.dist-info/WHEEL +4 -0
- mem_os_python-1.6.27.dist-info/entry_points.txt +2 -0
- mem_os_python-1.6.27.dist-info/licenses/LICENSE +21 -0
- memos/__init__.py +16 -0
- memos/_js/adapters/anthropic.d.ts +279 -0
- memos/_js/adapters/anthropic.d.ts.map +1 -0
- memos/_js/adapters/anthropic.js +348 -0
- memos/_js/adapters/anthropic.js.map +1 -0
- memos/_js/adapters/base.d.ts +10 -0
- memos/_js/adapters/base.d.ts.map +1 -0
- memos/_js/adapters/base.js +2 -0
- memos/_js/adapters/base.js.map +1 -0
- memos/_js/adapters/openai.d.ts +264 -0
- memos/_js/adapters/openai.d.ts.map +1 -0
- memos/_js/adapters/openai.js +342 -0
- memos/_js/adapters/openai.js.map +1 -0
- memos/_js/apps/explorer.d.ts +244 -0
- memos/_js/apps/explorer.d.ts.map +1 -0
- memos/_js/apps/explorer.js +738 -0
- memos/_js/apps/explorer.js.map +1 -0
- memos/_js/citations.d.ts +65 -0
- memos/_js/citations.d.ts.map +1 -0
- memos/_js/citations.js +143 -0
- memos/_js/citations.js.map +1 -0
- memos/_js/cli-browse.d.ts +3 -0
- memos/_js/cli-browse.d.ts.map +1 -0
- memos/_js/cli-browse.js +129 -0
- memos/_js/cli-browse.js.map +1 -0
- memos/_js/cli-completion.d.ts +31 -0
- memos/_js/cli-completion.d.ts.map +1 -0
- memos/_js/cli-completion.js +340 -0
- memos/_js/cli-completion.js.map +1 -0
- memos/_js/cli-help.d.ts +18 -0
- memos/_js/cli-help.d.ts.map +1 -0
- memos/_js/cli-help.js +357 -0
- memos/_js/cli-help.js.map +1 -0
- memos/_js/cli.d.ts +28 -0
- memos/_js/cli.d.ts.map +1 -0
- memos/_js/cli.js +2880 -0
- memos/_js/cli.js.map +1 -0
- memos/_js/compression.d.ts +25 -0
- memos/_js/compression.d.ts.map +1 -0
- memos/_js/compression.js +319 -0
- memos/_js/compression.js.map +1 -0
- memos/_js/confidence-machine.d.ts +99 -0
- memos/_js/confidence-machine.d.ts.map +1 -0
- memos/_js/confidence-machine.js +222 -0
- memos/_js/confidence-machine.js.map +1 -0
- memos/_js/context-pack.d.ts +506 -0
- memos/_js/context-pack.d.ts.map +1 -0
- memos/_js/context-pack.js +1435 -0
- memos/_js/context-pack.js.map +1 -0
- memos/_js/contradictions.d.ts +160 -0
- memos/_js/contradictions.d.ts.map +1 -0
- memos/_js/contradictions.js +255 -0
- memos/_js/contradictions.js.map +1 -0
- memos/_js/dashboard.d.ts +30 -0
- memos/_js/dashboard.d.ts.map +1 -0
- memos/_js/dashboard.js +302 -0
- memos/_js/dashboard.js.map +1 -0
- memos/_js/ebbinghaus.d.ts +29 -0
- memos/_js/ebbinghaus.d.ts.map +1 -0
- memos/_js/ebbinghaus.js +32 -0
- memos/_js/ebbinghaus.js.map +1 -0
- memos/_js/embedding-queue.d.ts +190 -0
- memos/_js/embedding-queue.d.ts.map +1 -0
- memos/_js/embedding-queue.js +316 -0
- memos/_js/embedding-queue.js.map +1 -0
- memos/_js/embeddings.d.ts +187 -0
- memos/_js/embeddings.d.ts.map +1 -0
- memos/_js/embeddings.js +633 -0
- memos/_js/embeddings.js.map +1 -0
- memos/_js/entity-extraction.d.ts +54 -0
- memos/_js/entity-extraction.d.ts.map +1 -0
- memos/_js/entity-extraction.js +325 -0
- memos/_js/entity-extraction.js.map +1 -0
- memos/_js/entity-index.d.ts +93 -0
- memos/_js/entity-index.d.ts.map +1 -0
- memos/_js/entity-index.js +165 -0
- memos/_js/entity-index.js.map +1 -0
- memos/_js/event-memory.d.ts +147 -0
- memos/_js/event-memory.d.ts.map +1 -0
- memos/_js/event-memory.js +290 -0
- memos/_js/event-memory.js.map +1 -0
- memos/_js/external-import.d.ts +98 -0
- memos/_js/external-import.d.ts.map +1 -0
- memos/_js/external-import.js +669 -0
- memos/_js/external-import.js.map +1 -0
- memos/_js/fidelity.d.ts +367 -0
- memos/_js/fidelity.d.ts.map +1 -0
- memos/_js/fidelity.js +911 -0
- memos/_js/fidelity.js.map +1 -0
- memos/_js/graph-expansion.d.ts +119 -0
- memos/_js/graph-expansion.d.ts.map +1 -0
- memos/_js/graph-expansion.js +213 -0
- memos/_js/graph-expansion.js.map +1 -0
- memos/_js/graph-mermaid.d.ts +13 -0
- memos/_js/graph-mermaid.d.ts.map +1 -0
- memos/_js/graph-mermaid.js +32 -0
- memos/_js/graph-mermaid.js.map +1 -0
- memos/_js/graph.d.ts +170 -0
- memos/_js/graph.d.ts.map +1 -0
- memos/_js/graph.js +482 -0
- memos/_js/graph.js.map +1 -0
- memos/_js/harness.d.ts +63 -0
- memos/_js/harness.d.ts.map +1 -0
- memos/_js/harness.js +93 -0
- memos/_js/harness.js.map +1 -0
- memos/_js/importance.d.ts +118 -0
- memos/_js/importance.d.ts.map +1 -0
- memos/_js/importance.js +144 -0
- memos/_js/importance.js.map +1 -0
- memos/_js/index.d.ts +51 -0
- memos/_js/index.d.ts.map +1 -0
- memos/_js/index.js +53 -0
- memos/_js/index.js.map +1 -0
- memos/_js/mcp.d.ts +58 -0
- memos/_js/mcp.d.ts.map +1 -0
- memos/_js/mcp.js +1853 -0
- memos/_js/mcp.js.map +1 -0
- memos/_js/memory.d.ts +1762 -0
- memos/_js/memory.d.ts.map +1 -0
- memos/_js/memory.js +6283 -0
- memos/_js/memory.js.map +1 -0
- memos/_js/procedural.d.ts +74 -0
- memos/_js/procedural.d.ts.map +1 -0
- memos/_js/procedural.js +125 -0
- memos/_js/procedural.js.map +1 -0
- memos/_js/project-config.d.ts +68 -0
- memos/_js/project-config.d.ts.map +1 -0
- memos/_js/project-config.js +59 -0
- memos/_js/project-config.js.map +1 -0
- memos/_js/proof-of-forgetting.d.ts +57 -0
- memos/_js/proof-of-forgetting.d.ts.map +1 -0
- memos/_js/proof-of-forgetting.js +80 -0
- memos/_js/proof-of-forgetting.js.map +1 -0
- memos/_js/provenance.d.ts +122 -0
- memos/_js/provenance.d.ts.map +1 -0
- memos/_js/provenance.js +182 -0
- memos/_js/provenance.js.map +1 -0
- memos/_js/quarantine-commands.d.ts +23 -0
- memos/_js/quarantine-commands.d.ts.map +1 -0
- memos/_js/quarantine-commands.js +42 -0
- memos/_js/quarantine-commands.js.map +1 -0
- memos/_js/quarantine.d.ts +120 -0
- memos/_js/quarantine.d.ts.map +1 -0
- memos/_js/quarantine.js +873 -0
- memos/_js/quarantine.js.map +1 -0
- memos/_js/redact.d.ts +12 -0
- memos/_js/redact.d.ts.map +1 -0
- memos/_js/redact.js +26 -0
- memos/_js/redact.js.map +1 -0
- memos/_js/repl.d.ts +57 -0
- memos/_js/repl.d.ts.map +1 -0
- memos/_js/repl.js +295 -0
- memos/_js/repl.js.map +1 -0
- memos/_js/rerank-local.d.ts +61 -0
- memos/_js/rerank-local.d.ts.map +1 -0
- memos/_js/rerank-local.js +210 -0
- memos/_js/rerank-local.js.map +1 -0
- memos/_js/retain-filter.d.ts +98 -0
- memos/_js/retain-filter.d.ts.map +1 -0
- memos/_js/retain-filter.js +232 -0
- memos/_js/retain-filter.js.map +1 -0
- memos/_js/retrieval.d.ts +265 -0
- memos/_js/retrieval.d.ts.map +1 -0
- memos/_js/retrieval.js +1018 -0
- memos/_js/retrieval.js.map +1 -0
- memos/_js/revert.d.ts +77 -0
- memos/_js/revert.d.ts.map +1 -0
- memos/_js/revert.js +252 -0
- memos/_js/revert.js.map +1 -0
- memos/_js/scope.d.ts +30 -0
- memos/_js/scope.d.ts.map +1 -0
- memos/_js/scope.js +71 -0
- memos/_js/scope.js.map +1 -0
- memos/_js/semantic-screen.d.ts +152 -0
- memos/_js/semantic-screen.d.ts.map +1 -0
- memos/_js/semantic-screen.js +290 -0
- memos/_js/semantic-screen.js.map +1 -0
- memos/_js/session-hooks.d.ts +127 -0
- memos/_js/session-hooks.d.ts.map +1 -0
- memos/_js/session-hooks.js +482 -0
- memos/_js/session-hooks.js.map +1 -0
- memos/_js/storage/sqlite.d.ts +427 -0
- memos/_js/storage/sqlite.d.ts.map +1 -0
- memos/_js/storage/sqlite.js +2428 -0
- memos/_js/storage/sqlite.js.map +1 -0
- memos/_js/sync.d.ts +213 -0
- memos/_js/sync.d.ts.map +1 -0
- memos/_js/sync.js +389 -0
- memos/_js/sync.js.map +1 -0
- memos/_js/tamper-log.d.ts +98 -0
- memos/_js/tamper-log.d.ts.map +1 -0
- memos/_js/tamper-log.js +327 -0
- memos/_js/tamper-log.js.map +1 -0
- memos/_js/temporal.d.ts +92 -0
- memos/_js/temporal.d.ts.map +1 -0
- memos/_js/temporal.js +536 -0
- memos/_js/temporal.js.map +1 -0
- memos/_js/time-travel.d.ts +38 -0
- memos/_js/time-travel.d.ts.map +1 -0
- memos/_js/time-travel.js +46 -0
- memos/_js/time-travel.js.map +1 -0
- memos/_js/timestamp-format.d.ts +18 -0
- memos/_js/timestamp-format.d.ts.map +1 -0
- memos/_js/timestamp-format.js +52 -0
- memos/_js/timestamp-format.js.map +1 -0
- memos/_js/triple-extraction.d.ts +31 -0
- memos/_js/triple-extraction.d.ts.map +1 -0
- memos/_js/triple-extraction.js +116 -0
- memos/_js/triple-extraction.js.map +1 -0
- memos/_js/types.d.ts +2474 -0
- memos/_js/types.d.ts.map +1 -0
- memos/_js/types.js +20 -0
- memos/_js/types.js.map +1 -0
- memos/_js/updater.d.ts +95 -0
- memos/_js/updater.d.ts.map +1 -0
- memos/_js/updater.js +268 -0
- memos/_js/updater.js.map +1 -0
- memos/_js/version.d.ts +17 -0
- memos/_js/version.d.ts.map +1 -0
- memos/_js/version.js +34 -0
- memos/_js/version.js.map +1 -0
- memos/_js/vision/clip-query-cache.d.ts +58 -0
- memos/_js/vision/clip-query-cache.d.ts.map +1 -0
- memos/_js/vision/clip-query-cache.js +79 -0
- memos/_js/vision/clip-query-cache.js.map +1 -0
- memos/_js/vision/clip.d.ts +113 -0
- memos/_js/vision/clip.d.ts.map +1 -0
- memos/_js/vision/clip.js +224 -0
- memos/_js/vision/clip.js.map +1 -0
- memos/_js/vision/fake-clip.d.ts +55 -0
- memos/_js/vision/fake-clip.d.ts.map +1 -0
- memos/_js/vision/fake-clip.js +122 -0
- memos/_js/vision/fake-clip.js.map +1 -0
- memos/_js/vision/index.d.ts +15 -0
- memos/_js/vision/index.d.ts.map +1 -0
- memos/_js/vision/index.js +13 -0
- memos/_js/vision/index.js.map +1 -0
- memos/_js/vision/store.d.ts +137 -0
- memos/_js/vision/store.d.ts.map +1 -0
- memos/_js/vision/store.js +383 -0
- memos/_js/vision/store.js.map +1 -0
- memos/adapters/__init__.py +0 -0
- memos/adapters/crewai.py +385 -0
- memos/adapters/langchain.py +301 -0
- memos/adapters/ollama.py +396 -0
- memos/server/__init__.py +0 -0
- memos/server/main.py +547 -0
- memos/server/routes.py +360 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"procedural.js","sourceRoot":"","sources":["../src/procedural.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACxC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,wEAAwE;AACxE,MAAM,CAAC,MAAM,2BAA2B,GAAG,EAAE,CAAC;AAC9C,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AACrC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAC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|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory-as-code: optional project-level configuration from a
|
|
3
|
+
* `.memos.json` file, resolved by walking up from the working directory
|
|
4
|
+
* (like AGENTS.md) so monorepo subdirectories inherit the root policy.
|
|
5
|
+
*
|
|
6
|
+
* The file commits memory POLICY to version control — scope defaults,
|
|
7
|
+
* consolidation knobs, embedding routing, the NAME of the env var that
|
|
8
|
+
* holds the encryption key (never the key itself):
|
|
9
|
+
*
|
|
10
|
+
* ```json
|
|
11
|
+
* {
|
|
12
|
+
* "scope": { "user": "alice", "agent": "coder" },
|
|
13
|
+
* "consolidation": { "minRetentionScore": 0.2, "decayHalfLifeDays": 60 },
|
|
14
|
+
* "embeddings": { "provider": "openai-compatible", "model": "LFM2.5-Embedding-350M-BF16", "baseUrl": "http://127.0.0.1:8080/v1" },
|
|
15
|
+
* "privacy": { "cipherKeyEnv": "MEMOS_KEY" }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module @mem-os/project-config
|
|
20
|
+
*/
|
|
21
|
+
export interface MemosProjectConfig {
|
|
22
|
+
scope?: {
|
|
23
|
+
user?: string;
|
|
24
|
+
agent?: string;
|
|
25
|
+
};
|
|
26
|
+
consolidation?: {
|
|
27
|
+
minRetentionScore?: number;
|
|
28
|
+
decayHalfLifeDays?: number;
|
|
29
|
+
olderThanDays?: number;
|
|
30
|
+
};
|
|
31
|
+
embeddings?: {
|
|
32
|
+
provider?: string;
|
|
33
|
+
model?: string;
|
|
34
|
+
baseUrl?: string;
|
|
35
|
+
dimensions?: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Image memory. `enabled` turns on the caption track (images are
|
|
39
|
+
* stored with a searchable caption); `clip.enabled` additionally
|
|
40
|
+
* turns on the CLIP pixel track. Overridable per-invocation with
|
|
41
|
+
* `--vision` / `--vision-clip` or MEMOS_VISION / MEMOS_VISION_CLIP.
|
|
42
|
+
*/
|
|
43
|
+
vision?: {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
clip?: {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
};
|
|
48
|
+
storeRoot?: string;
|
|
49
|
+
maxImageBytes?: number;
|
|
50
|
+
};
|
|
51
|
+
privacy?: {
|
|
52
|
+
/** Environment variable that holds the encryption key. */
|
|
53
|
+
cipherKeyEnv?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export declare const PROJECT_CONFIG_FILE = ".memos.json";
|
|
57
|
+
/**
|
|
58
|
+
* Find and parse the nearest `.memos.json`, walking up from `dir` to the
|
|
59
|
+
* filesystem root. Returns null when no file exists. Throws with the file
|
|
60
|
+
* path when the file exists but is malformed.
|
|
61
|
+
*/
|
|
62
|
+
export declare function loadProjectConfig(dir?: string): MemosProjectConfig | null;
|
|
63
|
+
/**
|
|
64
|
+
* The env var name that holds the encryption key, per project config.
|
|
65
|
+
* Default: MEMOS_KEY.
|
|
66
|
+
*/
|
|
67
|
+
export declare function cipherKeyEnvName(config: MemosProjectConfig | null): string;
|
|
68
|
+
//# sourceMappingURL=project-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../src/project-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,aAAa,CAAC,EAAE;QACd,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF;;;;;OAKG;IACH,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;QAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE;QACR,0DAA0D;QAC1D,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,MAAsB,GAC1B,kBAAkB,GAAG,IAAI,CAwB3B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAAG,MAAM,CAE1E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory-as-code: optional project-level configuration from a
|
|
3
|
+
* `.memos.json` file, resolved by walking up from the working directory
|
|
4
|
+
* (like AGENTS.md) so monorepo subdirectories inherit the root policy.
|
|
5
|
+
*
|
|
6
|
+
* The file commits memory POLICY to version control — scope defaults,
|
|
7
|
+
* consolidation knobs, embedding routing, the NAME of the env var that
|
|
8
|
+
* holds the encryption key (never the key itself):
|
|
9
|
+
*
|
|
10
|
+
* ```json
|
|
11
|
+
* {
|
|
12
|
+
* "scope": { "user": "alice", "agent": "coder" },
|
|
13
|
+
* "consolidation": { "minRetentionScore": 0.2, "decayHalfLifeDays": 60 },
|
|
14
|
+
* "embeddings": { "provider": "openai-compatible", "model": "LFM2.5-Embedding-350M-BF16", "baseUrl": "http://127.0.0.1:8080/v1" },
|
|
15
|
+
* "privacy": { "cipherKeyEnv": "MEMOS_KEY" }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @module @mem-os/project-config
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
22
|
+
import { dirname, resolve } from "node:path";
|
|
23
|
+
export const PROJECT_CONFIG_FILE = ".memos.json";
|
|
24
|
+
/**
|
|
25
|
+
* Find and parse the nearest `.memos.json`, walking up from `dir` to the
|
|
26
|
+
* filesystem root. Returns null when no file exists. Throws with the file
|
|
27
|
+
* path when the file exists but is malformed.
|
|
28
|
+
*/
|
|
29
|
+
export function loadProjectConfig(dir = process.cwd()) {
|
|
30
|
+
let current = resolve(dir);
|
|
31
|
+
for (;;) {
|
|
32
|
+
const candidate = resolve(current, PROJECT_CONFIG_FILE);
|
|
33
|
+
if (existsSync(candidate)) {
|
|
34
|
+
try {
|
|
35
|
+
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
36
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
37
|
+
throw new Error("config must be a JSON object");
|
|
38
|
+
}
|
|
39
|
+
return parsed;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
43
|
+
throw new Error(`Malformed ${PROJECT_CONFIG_FILE} at ${candidate}: ${message}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const parent = dirname(current);
|
|
47
|
+
if (parent === current)
|
|
48
|
+
return null;
|
|
49
|
+
current = parent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The env var name that holds the encryption key, per project config.
|
|
54
|
+
* Default: MEMOS_KEY.
|
|
55
|
+
*/
|
|
56
|
+
export function cipherKeyEnvName(config) {
|
|
57
|
+
return config?.privacy?.cipherKeyEnv || "MEMOS_KEY";
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=project-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-config.js","sourceR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,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAiC;IAChE,OAAO,MAAM,EAAE,OAAO,EAAE,YAAY,IAAI,WAAW,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographic proof of forgetting.
|
|
3
|
+
*
|
|
4
|
+
* When a memory is deleted via `forget()`, memos already writes a
|
|
5
|
+
* tombstone entry to the hash-chained tamper log. This module adds:
|
|
6
|
+
*
|
|
7
|
+
* - `proveForget()`: Export a signed deletion certificate containing
|
|
8
|
+
* the node ID, deletion timestamp, content hash, and tamper-log
|
|
9
|
+
* sequence number. The certificate proves *what* was deleted and *when*.
|
|
10
|
+
* - `verifyForget()`: Verify a certificate against the tamper log —
|
|
11
|
+
* checks the entry exists, the chain is intact, and the hashes match.
|
|
12
|
+
*
|
|
13
|
+
* This is the "prove it" for GDPR Article 17: not "trust us, it's deleted"
|
|
14
|
+
* but a cryptographically verifiable artifact. Zero competitors ship this.
|
|
15
|
+
*/
|
|
16
|
+
import type { TamperLogEntry } from "./types.js";
|
|
17
|
+
export interface DeletionCertificate {
|
|
18
|
+
/** The deleted node's ID. */
|
|
19
|
+
nodeId: string;
|
|
20
|
+
/** Unix ms when the deletion occurred. */
|
|
21
|
+
deletedAt: number;
|
|
22
|
+
/** SHA-256 hex of the deleted node's content. */
|
|
23
|
+
contentHash: string;
|
|
24
|
+
/** Tamper-log sequence number of the forget entry. */
|
|
25
|
+
tamperSeq: number;
|
|
26
|
+
/** Hash of the tamper-log entry (chain link). */
|
|
27
|
+
entryHash: string;
|
|
28
|
+
/** Previous entry hash (chain continuity). */
|
|
29
|
+
prevHash: string;
|
|
30
|
+
/** Certificate format version. */
|
|
31
|
+
version: 1;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a deletion certificate from a tamper-log forget entry.
|
|
35
|
+
*
|
|
36
|
+
* @param entry - The tamper-log entry with op="forget" for the deleted node.
|
|
37
|
+
* @returns A verifiable deletion certificate, or null if the entry is not a forget.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createDeletionCertificate(entry: TamperLogEntry): DeletionCertificate | null;
|
|
40
|
+
/**
|
|
41
|
+
* Verify a deletion certificate against tamper-log entries.
|
|
42
|
+
*
|
|
43
|
+
* Checks:
|
|
44
|
+
* 1. A forget entry exists at the certificate's sequence number.
|
|
45
|
+
* 2. The entry's hashes match the certificate.
|
|
46
|
+
* 3. The chain is intact (prevHash links correctly).
|
|
47
|
+
*
|
|
48
|
+
* @param cert - The certificate to verify.
|
|
49
|
+
* @param entries - Tamper-log entries (must include the forget entry and its predecessor).
|
|
50
|
+
* @returns True if the certificate is valid.
|
|
51
|
+
*/
|
|
52
|
+
export declare function verifyDeletionCertificate(cert: DeletionCertificate, entries: TamperLogEntry[]): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Hash content for the certificate (SHA-256 hex).
|
|
55
|
+
*/
|
|
56
|
+
export declare function hashContent(content: string): string;
|
|
57
|
+
//# sourceMappingURL=proof-of-forgetting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-of-forgetting.d.ts","sourceRoot":"","sources":["../src/proof-of-forgetting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,OAAO,EAAE,CAAC,CAAC;CACZ;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,cAAc,GACpB,mBAAmB,GAAG,IAAI,CAY5B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,cAAc,EAAE,GACxB,OAAO,CAsBT;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographic proof of forgetting.
|
|
3
|
+
*
|
|
4
|
+
* When a memory is deleted via `forget()`, memos already writes a
|
|
5
|
+
* tombstone entry to the hash-chained tamper log. This module adds:
|
|
6
|
+
*
|
|
7
|
+
* - `proveForget()`: Export a signed deletion certificate containing
|
|
8
|
+
* the node ID, deletion timestamp, content hash, and tamper-log
|
|
9
|
+
* sequence number. The certificate proves *what* was deleted and *when*.
|
|
10
|
+
* - `verifyForget()`: Verify a certificate against the tamper log —
|
|
11
|
+
* checks the entry exists, the chain is intact, and the hashes match.
|
|
12
|
+
*
|
|
13
|
+
* This is the "prove it" for GDPR Article 17: not "trust us, it's deleted"
|
|
14
|
+
* but a cryptographically verifiable artifact. Zero competitors ship this.
|
|
15
|
+
*/
|
|
16
|
+
import { createHash } from "node:crypto";
|
|
17
|
+
/**
|
|
18
|
+
* Create a deletion certificate from a tamper-log forget entry.
|
|
19
|
+
*
|
|
20
|
+
* @param entry - The tamper-log entry with op="forget" for the deleted node.
|
|
21
|
+
* @returns A verifiable deletion certificate, or null if the entry is not a forget.
|
|
22
|
+
*/
|
|
23
|
+
export function createDeletionCertificate(entry) {
|
|
24
|
+
if (entry.op !== "forget")
|
|
25
|
+
return null;
|
|
26
|
+
return {
|
|
27
|
+
nodeId: entry.nodeId,
|
|
28
|
+
deletedAt: entry.ts,
|
|
29
|
+
contentHash: entry.nodeHash,
|
|
30
|
+
tamperSeq: entry.seq,
|
|
31
|
+
entryHash: entry.entryHash,
|
|
32
|
+
prevHash: entry.prevHash,
|
|
33
|
+
version: 1,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Verify a deletion certificate against tamper-log entries.
|
|
38
|
+
*
|
|
39
|
+
* Checks:
|
|
40
|
+
* 1. A forget entry exists at the certificate's sequence number.
|
|
41
|
+
* 2. The entry's hashes match the certificate.
|
|
42
|
+
* 3. The chain is intact (prevHash links correctly).
|
|
43
|
+
*
|
|
44
|
+
* @param cert - The certificate to verify.
|
|
45
|
+
* @param entries - Tamper-log entries (must include the forget entry and its predecessor).
|
|
46
|
+
* @returns True if the certificate is valid.
|
|
47
|
+
*/
|
|
48
|
+
export function verifyDeletionCertificate(cert, entries) {
|
|
49
|
+
if (cert.version !== 1)
|
|
50
|
+
return false;
|
|
51
|
+
const entry = entries.find((e) => e.seq === cert.tamperSeq && e.op === "forget");
|
|
52
|
+
if (!entry)
|
|
53
|
+
return false;
|
|
54
|
+
// Hashes must match
|
|
55
|
+
if (entry.nodeId !== cert.nodeId)
|
|
56
|
+
return false;
|
|
57
|
+
if (entry.nodeHash !== cert.contentHash)
|
|
58
|
+
return false;
|
|
59
|
+
if (entry.entryHash !== cert.entryHash)
|
|
60
|
+
return false;
|
|
61
|
+
if (entry.prevHash !== cert.prevHash)
|
|
62
|
+
return false;
|
|
63
|
+
if (entry.ts !== cert.deletedAt)
|
|
64
|
+
return false;
|
|
65
|
+
// Chain continuity: prevHash must match the previous entry's hash
|
|
66
|
+
const prev = entries.find((e) => e.seq === cert.tamperSeq - 1);
|
|
67
|
+
if (prev && prev.entryHash !== cert.prevHash)
|
|
68
|
+
return false;
|
|
69
|
+
// If no predecessor (seq 0), prevHash should be the genesis marker
|
|
70
|
+
if (!prev && cert.tamperSeq !== 0)
|
|
71
|
+
return false;
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Hash content for the certificate (SHA-256 hex).
|
|
76
|
+
*/
|
|
77
|
+
export function hashContent(content) {
|
|
78
|
+
return createHash("sha256").update(content, "utf8").digest("hex");
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=proof-of-forgetting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-of-forgetting.js","sourceRoot":"","sources":["../src/proof-of-forgetting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoBzC;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAqB;IAErB,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAEvC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,SAAS,EAAE,KAAK,CAAC,EAAE;QACnB,WAAW,EAAE,KAAK,CAAC,QAAQ;QAC3B,SAAS,EAAE,KAAK,CAAC,GAAG;QACpB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,CAAC;KACX,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CACvC,IAAyB,EACzB,OAAyB;IAEzB,IAAI,IAAI,CAAC,OAAO,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAErC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CACxB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,EAAE,KAAK,QAAQ,CACrD,CAAC;IACF,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEzB,oBAAoB;IACpB,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,WAAW;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IACrD,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAE9C,kEAAkE;IAClE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC/D,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC3D,mEAAmE;IACnE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEhD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provenance-tiered trust for MemOS — the provenance-trust security layer.
|
|
3
|
+
*
|
|
4
|
+
* 2026 is the year memory became the attack surface (InjecMEM/COLM 2026:
|
|
5
|
+
* one ordinary interaction poisons memory with 35.6% end-to-end success;
|
|
6
|
+
* Trojan Hippo: dormant payloads persist through 100 benign sessions;
|
|
7
|
+
* AgentPoison >80% ASR at <0.1% poison rate; ClawHavoc poisoned AI skill
|
|
8
|
+
* packages). A local-first memory store should know *where* each memory
|
|
9
|
+
* came from and treat channels unequally — so every memory carries a
|
|
10
|
+
* provenance tier, assigned at write time and fused into recall scoring.
|
|
11
|
+
*
|
|
12
|
+
* Tier ordering (highest trust first):
|
|
13
|
+
*
|
|
14
|
+
* - `user-verified` — explicitly confirmed by the user (never assigned
|
|
15
|
+
* automatically — only via an explicit `provenance` opt or `verify()`).
|
|
16
|
+
* - `user` — ordinary user statements (the default for direct
|
|
17
|
+
* `store()` writes, which carry `source: "user_input"`).
|
|
18
|
+
* - `tool-output` — results returned by tools (`source: "tool_output"`).
|
|
19
|
+
* - `chat` — model-generated content (`source: "agent_inferred"`
|
|
20
|
+
* or `source: "system"`).
|
|
21
|
+
* - `imported` — bulk imports from ChatGPT/Claude/Slack exports
|
|
22
|
+
* (`source: "external_data"`).
|
|
23
|
+
*
|
|
24
|
+
* Default rule (documented here and in docs/provenance-trust.md): when
|
|
25
|
+
* `store()` is called without an explicit `provenance`, the tier is
|
|
26
|
+
* derived from `source` via {@link defaultProvenanceForSource}.
|
|
27
|
+
* `user-verified` is the only tier that can never be assigned by the
|
|
28
|
+
* default rule — it requires an explicit user confirmation step.
|
|
29
|
+
*
|
|
30
|
+
* Everything here is dependency-free and LLM-free: tier assignment and
|
|
31
|
+
* trust fusion are pure local computation, safe for the hot path.
|
|
32
|
+
*
|
|
33
|
+
* @module @mem-os/provenance
|
|
34
|
+
*/
|
|
35
|
+
import type { MemoryNode, MemorySource, ProvenanceTier, ScoredMemory } from "./types.js";
|
|
36
|
+
/**
|
|
37
|
+
* Canonical tier ordering, highest trust first. The index is the
|
|
38
|
+
* authority for "higher tier wins" comparisons.
|
|
39
|
+
*/
|
|
40
|
+
export declare const PROVENANCE_TIER_ORDER: readonly ProvenanceTier[];
|
|
41
|
+
/**
|
|
42
|
+
* Tiers whose content a host agent should confirm before acting on,
|
|
43
|
+
* rather than silently injecting as context. Quarantined-then-released
|
|
44
|
+
* memories are untrusted regardless of tier (see
|
|
45
|
+
* {@link isUntrustedForAgent}).
|
|
46
|
+
*/
|
|
47
|
+
export declare const LOW_TRUST_TIERS: ReadonlySet<ProvenanceTier>;
|
|
48
|
+
/**
|
|
49
|
+
* Per-tier trust multiplier fused into retrieval scoring (see
|
|
50
|
+
* `fuseResults` in src/retrieval.ts). Deliberately gentle: the top tier
|
|
51
|
+
* is untouched and the bottom tier keeps 72% of its relevance score, so
|
|
52
|
+
* provenance nudges ranking without overriding relevance.
|
|
53
|
+
*/
|
|
54
|
+
export declare const PROVENANCE_TRUST: Record<ProvenanceTier, number>;
|
|
55
|
+
/**
|
|
56
|
+
* Default strength of the provenance multiplier in score fusion
|
|
57
|
+
* (`score *= 1 - strength * (1 - tierTrust)`). 0.5 keeps the maximum
|
|
58
|
+
* penalty (imported tier) at ~14% — measurable but never dominant.
|
|
59
|
+
* Override per deployment via `config.fusion.provenanceWeightStrength`
|
|
60
|
+
* (0 disables it).
|
|
61
|
+
*/
|
|
62
|
+
export declare const DEFAULT_PROVENANCE_WEIGHT_STRENGTH = 0.5;
|
|
63
|
+
/** Metadata key stamped on a memory released from quarantine. */
|
|
64
|
+
export declare const QUARANTINE_RELEASED_METADATA_KEY = "releasedFromQuarantine";
|
|
65
|
+
/** Runtime guard for the tier union (storage rows may predate the column). */
|
|
66
|
+
export declare function isProvenanceTier(value: unknown): value is ProvenanceTier;
|
|
67
|
+
/**
|
|
68
|
+
* Default provenance tier for a write, derived from its `source`.
|
|
69
|
+
*
|
|
70
|
+
* - `user_input` → `user` (ordinary user statements)
|
|
71
|
+
* - `tool_output` → `tool-output`
|
|
72
|
+
* - `agent_inferred`→ `chat` (model-generated)
|
|
73
|
+
* - `system` → `chat` (machine-generated)
|
|
74
|
+
* - `external_data` → `imported` (bulk imports)
|
|
75
|
+
*
|
|
76
|
+
* `user-verified` is never returned here: explicit user confirmation is
|
|
77
|
+
* the only path to the top tier.
|
|
78
|
+
*/
|
|
79
|
+
export declare function defaultProvenanceForSource(source: MemorySource): ProvenanceTier;
|
|
80
|
+
/**
|
|
81
|
+
* Resolve the provenance tier for a write: an explicit, valid
|
|
82
|
+
* `provenance` option always wins; otherwise the source-derived
|
|
83
|
+
* default applies.
|
|
84
|
+
*/
|
|
85
|
+
export declare function resolveProvenance(opts: {
|
|
86
|
+
provenance?: ProvenanceTier;
|
|
87
|
+
source: MemorySource;
|
|
88
|
+
}): ProvenanceTier;
|
|
89
|
+
/** Compare two tiers: negative when `a` outranks `b`. */
|
|
90
|
+
export declare function compareProvenanceTier(a: ProvenanceTier, b: ProvenanceTier): number;
|
|
91
|
+
/**
|
|
92
|
+
* Whether a memory's provenance channel is low-trust for agent
|
|
93
|
+
* consumption: tier `imported` / `tool-output`, or a memory that was
|
|
94
|
+
* quarantined and later released (its tier alone no longer tells the
|
|
95
|
+
* story — the release marker does).
|
|
96
|
+
*/
|
|
97
|
+
export declare function isUntrustedForAgent(node: Pick<MemoryNode, "provenance" | "quarantined" | "metadata">): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Quarantine visibility for a recall filter. Storage excludes
|
|
100
|
+
* quarantined rows by default (`includeQuarantined` unset or false);
|
|
101
|
+
* `includeQuarantined: true` shows everything; `quarantinedOnly: true`
|
|
102
|
+
* shows only quarantined rows (the review queue).
|
|
103
|
+
*/
|
|
104
|
+
export declare function quarantineVisible(quarantined: boolean, filter: {
|
|
105
|
+
includeQuarantined?: boolean;
|
|
106
|
+
quarantinedOnly?: boolean;
|
|
107
|
+
}): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* The trust multiplier for one tier at a given fusion strength:
|
|
110
|
+
* `1 - strength * (1 - tierTrust)`. Uniform across a result set, so a
|
|
111
|
+
* same-tier corpus (e.g. the retrieval eval's all-`user` facts) keeps
|
|
112
|
+
* byte-identical ranking — the weight is provably neutral there.
|
|
113
|
+
*/
|
|
114
|
+
export declare function provenanceMultiplier(tier: ProvenanceTier, strength?: number): number;
|
|
115
|
+
/**
|
|
116
|
+
* Stamp trust flags onto search results headed for an agent: the
|
|
117
|
+
* provenance tier, a citable `[mem:hex]` token tracing the memory to
|
|
118
|
+
* its source episode, and `untrustedSource` for low-trust channels.
|
|
119
|
+
* Pure — returns new result objects, never mutates the input.
|
|
120
|
+
*/
|
|
121
|
+
export declare function decorateTrustFlags(results: ScoredMemory[]): ScoredMemory[];
|
|
122
|
+
//# sourceMappingURL=provenance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.d.ts","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,cAAc,EAMjD,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,cAAc,CAGtD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAM3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,iEAAiE;AACjE,eAAO,MAAM,gCAAgC,2BAA2B,CAAC;AAEzE,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAKxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,GACnB,cAAc,CAahB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,YAAY,CAAC;CACtB,GAAG,cAAc,CAKjB;AAED,yDAAyD;AACzD,wBAAgB,qBAAqB,CACnC,CAAC,EAAE,cAAc,EACjB,CAAC,EAAE,cAAc,GAChB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,GAAG,aAAa,GAAG,UAAU,CAAC,GAChE,OAAO,CAYT;AAMD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAClE,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,cAAc,EACpB,QAAQ,GAAE,MAA2C,GACpD,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAO1E"}
|
memos/_js/provenance.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provenance-tiered trust for MemOS — the provenance-trust security layer.
|
|
3
|
+
*
|
|
4
|
+
* 2026 is the year memory became the attack surface (InjecMEM/COLM 2026:
|
|
5
|
+
* one ordinary interaction poisons memory with 35.6% end-to-end success;
|
|
6
|
+
* Trojan Hippo: dormant payloads persist through 100 benign sessions;
|
|
7
|
+
* AgentPoison >80% ASR at <0.1% poison rate; ClawHavoc poisoned AI skill
|
|
8
|
+
* packages). A local-first memory store should know *where* each memory
|
|
9
|
+
* came from and treat channels unequally — so every memory carries a
|
|
10
|
+
* provenance tier, assigned at write time and fused into recall scoring.
|
|
11
|
+
*
|
|
12
|
+
* Tier ordering (highest trust first):
|
|
13
|
+
*
|
|
14
|
+
* - `user-verified` — explicitly confirmed by the user (never assigned
|
|
15
|
+
* automatically — only via an explicit `provenance` opt or `verify()`).
|
|
16
|
+
* - `user` — ordinary user statements (the default for direct
|
|
17
|
+
* `store()` writes, which carry `source: "user_input"`).
|
|
18
|
+
* - `tool-output` — results returned by tools (`source: "tool_output"`).
|
|
19
|
+
* - `chat` — model-generated content (`source: "agent_inferred"`
|
|
20
|
+
* or `source: "system"`).
|
|
21
|
+
* - `imported` — bulk imports from ChatGPT/Claude/Slack exports
|
|
22
|
+
* (`source: "external_data"`).
|
|
23
|
+
*
|
|
24
|
+
* Default rule (documented here and in docs/provenance-trust.md): when
|
|
25
|
+
* `store()` is called without an explicit `provenance`, the tier is
|
|
26
|
+
* derived from `source` via {@link defaultProvenanceForSource}.
|
|
27
|
+
* `user-verified` is the only tier that can never be assigned by the
|
|
28
|
+
* default rule — it requires an explicit user confirmation step.
|
|
29
|
+
*
|
|
30
|
+
* Everything here is dependency-free and LLM-free: tier assignment and
|
|
31
|
+
* trust fusion are pure local computation, safe for the hot path.
|
|
32
|
+
*
|
|
33
|
+
* @module @mem-os/provenance
|
|
34
|
+
*/
|
|
35
|
+
import { citationToken } from "./citations.js";
|
|
36
|
+
/**
|
|
37
|
+
* Canonical tier ordering, highest trust first. The index is the
|
|
38
|
+
* authority for "higher tier wins" comparisons.
|
|
39
|
+
*/
|
|
40
|
+
export const PROVENANCE_TIER_ORDER = [
|
|
41
|
+
"user-verified",
|
|
42
|
+
"user",
|
|
43
|
+
"tool-output",
|
|
44
|
+
"chat",
|
|
45
|
+
"imported",
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Tiers whose content a host agent should confirm before acting on,
|
|
49
|
+
* rather than silently injecting as context. Quarantined-then-released
|
|
50
|
+
* memories are untrusted regardless of tier (see
|
|
51
|
+
* {@link isUntrustedForAgent}).
|
|
52
|
+
*/
|
|
53
|
+
export const LOW_TRUST_TIERS = new Set([
|
|
54
|
+
"tool-output",
|
|
55
|
+
"imported",
|
|
56
|
+
]);
|
|
57
|
+
/**
|
|
58
|
+
* Per-tier trust multiplier fused into retrieval scoring (see
|
|
59
|
+
* `fuseResults` in src/retrieval.ts). Deliberately gentle: the top tier
|
|
60
|
+
* is untouched and the bottom tier keeps 72% of its relevance score, so
|
|
61
|
+
* provenance nudges ranking without overriding relevance.
|
|
62
|
+
*/
|
|
63
|
+
export const PROVENANCE_TRUST = {
|
|
64
|
+
"user-verified": 1.0,
|
|
65
|
+
user: 0.97,
|
|
66
|
+
"tool-output": 0.9,
|
|
67
|
+
chat: 0.82,
|
|
68
|
+
imported: 0.72,
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Default strength of the provenance multiplier in score fusion
|
|
72
|
+
* (`score *= 1 - strength * (1 - tierTrust)`). 0.5 keeps the maximum
|
|
73
|
+
* penalty (imported tier) at ~14% — measurable but never dominant.
|
|
74
|
+
* Override per deployment via `config.fusion.provenanceWeightStrength`
|
|
75
|
+
* (0 disables it).
|
|
76
|
+
*/
|
|
77
|
+
export const DEFAULT_PROVENANCE_WEIGHT_STRENGTH = 0.5;
|
|
78
|
+
/** Metadata key stamped on a memory released from quarantine. */
|
|
79
|
+
export const QUARANTINE_RELEASED_METADATA_KEY = "releasedFromQuarantine";
|
|
80
|
+
/** Runtime guard for the tier union (storage rows may predate the column). */
|
|
81
|
+
export function isProvenanceTier(value) {
|
|
82
|
+
return (typeof value === "string" &&
|
|
83
|
+
PROVENANCE_TIER_ORDER.includes(value));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Default provenance tier for a write, derived from its `source`.
|
|
87
|
+
*
|
|
88
|
+
* - `user_input` → `user` (ordinary user statements)
|
|
89
|
+
* - `tool_output` → `tool-output`
|
|
90
|
+
* - `agent_inferred`→ `chat` (model-generated)
|
|
91
|
+
* - `system` → `chat` (machine-generated)
|
|
92
|
+
* - `external_data` → `imported` (bulk imports)
|
|
93
|
+
*
|
|
94
|
+
* `user-verified` is never returned here: explicit user confirmation is
|
|
95
|
+
* the only path to the top tier.
|
|
96
|
+
*/
|
|
97
|
+
export function defaultProvenanceForSource(source) {
|
|
98
|
+
switch (source) {
|
|
99
|
+
case "tool_output":
|
|
100
|
+
return "tool-output";
|
|
101
|
+
case "agent_inferred":
|
|
102
|
+
case "system":
|
|
103
|
+
return "chat";
|
|
104
|
+
case "external_data":
|
|
105
|
+
return "imported";
|
|
106
|
+
case "user_input":
|
|
107
|
+
default:
|
|
108
|
+
return "user";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolve the provenance tier for a write: an explicit, valid
|
|
113
|
+
* `provenance` option always wins; otherwise the source-derived
|
|
114
|
+
* default applies.
|
|
115
|
+
*/
|
|
116
|
+
export function resolveProvenance(opts) {
|
|
117
|
+
if (opts.provenance && isProvenanceTier(opts.provenance)) {
|
|
118
|
+
return opts.provenance;
|
|
119
|
+
}
|
|
120
|
+
return defaultProvenanceForSource(opts.source);
|
|
121
|
+
}
|
|
122
|
+
/** Compare two tiers: negative when `a` outranks `b`. */
|
|
123
|
+
export function compareProvenanceTier(a, b) {
|
|
124
|
+
return PROVENANCE_TIER_ORDER.indexOf(a) - PROVENANCE_TIER_ORDER.indexOf(b);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Whether a memory's provenance channel is low-trust for agent
|
|
128
|
+
* consumption: tier `imported` / `tool-output`, or a memory that was
|
|
129
|
+
* quarantined and later released (its tier alone no longer tells the
|
|
130
|
+
* story — the release marker does).
|
|
131
|
+
*/
|
|
132
|
+
export function isUntrustedForAgent(node) {
|
|
133
|
+
if (node.quarantined)
|
|
134
|
+
return true;
|
|
135
|
+
if (isProvenanceTier(node.provenance) &&
|
|
136
|
+
LOW_TRUST_TIERS.has(node.provenance)) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return (isRecord(node.metadata) &&
|
|
140
|
+
node.metadata[QUARANTINE_RELEASED_METADATA_KEY] === true);
|
|
141
|
+
}
|
|
142
|
+
function isRecord(value) {
|
|
143
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Quarantine visibility for a recall filter. Storage excludes
|
|
147
|
+
* quarantined rows by default (`includeQuarantined` unset or false);
|
|
148
|
+
* `includeQuarantined: true` shows everything; `quarantinedOnly: true`
|
|
149
|
+
* shows only quarantined rows (the review queue).
|
|
150
|
+
*/
|
|
151
|
+
export function quarantineVisible(quarantined, filter) {
|
|
152
|
+
if (filter.quarantinedOnly === true)
|
|
153
|
+
return quarantined;
|
|
154
|
+
if (filter.includeQuarantined === true)
|
|
155
|
+
return true;
|
|
156
|
+
return !quarantined;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The trust multiplier for one tier at a given fusion strength:
|
|
160
|
+
* `1 - strength * (1 - tierTrust)`. Uniform across a result set, so a
|
|
161
|
+
* same-tier corpus (e.g. the retrieval eval's all-`user` facts) keeps
|
|
162
|
+
* byte-identical ranking — the weight is provably neutral there.
|
|
163
|
+
*/
|
|
164
|
+
export function provenanceMultiplier(tier, strength = DEFAULT_PROVENANCE_WEIGHT_STRENGTH) {
|
|
165
|
+
const trust = PROVENANCE_TRUST[tier] ?? 1.0;
|
|
166
|
+
return 1 - strength * (1 - trust);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Stamp trust flags onto search results headed for an agent: the
|
|
170
|
+
* provenance tier, a citable `[mem:hex]` token tracing the memory to
|
|
171
|
+
* its source episode, and `untrustedSource` for low-trust channels.
|
|
172
|
+
* Pure — returns new result objects, never mutates the input.
|
|
173
|
+
*/
|
|
174
|
+
export function decorateTrustFlags(results) {
|
|
175
|
+
return results.map((r) => ({
|
|
176
|
+
...r,
|
|
177
|
+
provenance: r.node.provenance,
|
|
178
|
+
citation: citationToken(r.node.id),
|
|
179
|
+
untrustedSource: isUntrustedForAgent(r.node),
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=provenance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provenance.js","sourceRoot":"","sources":["../src/provenance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAQ/C;;;GAGG;AACH,MAAM,CAAC,MAAM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CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAuB;IACxD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzB,GAAG,CAAC;QACJ,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU;QAC7B,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC;KAC7C,CAAC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Testable CLI command logic for the quarantine review queue.
|
|
3
|
+
*
|
|
4
|
+
* The CLI dispatches `memos quarantine list|release` through these
|
|
5
|
+
* helpers so the output format is asserted in unit tests rather than
|
|
6
|
+
* through awkward subprocess runs.
|
|
7
|
+
*/
|
|
8
|
+
import type { MemOS } from "./memory.js";
|
|
9
|
+
import type { MemoryNode } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Render the quarantine review queue. JSON mode emits the raw nodes;
|
|
12
|
+
* human mode prints one line per memory: `[mem:hex]`-style short id,
|
|
13
|
+
* quarantine reason, and the first ~120 chars of content.
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatQuarantineList(nodes: MemoryNode[], json: boolean): string;
|
|
16
|
+
/**
|
|
17
|
+
* Release a memory from quarantine and render the result. JSON mode
|
|
18
|
+
* emits the updated node; human mode confirms the release while
|
|
19
|
+
* reminding the operator that the memory keeps its low-trust marking
|
|
20
|
+
* for agent consumption.
|
|
21
|
+
*/
|
|
22
|
+
export declare function releaseQuarantined(memos: MemOS, id: string, json: boolean): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=quarantine-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarantine-commands.d.ts","sourceRoot":"","sources":["../src/quarantine-commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EAAE,EACnB,IAAI,EAAE,OAAO,GACZ,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,MAAM,CAAC,CASjB"}
|