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,42 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Render the quarantine review queue. JSON mode emits the raw nodes;
|
|
10
|
+
* human mode prints one line per memory: `[mem:hex]`-style short id,
|
|
11
|
+
* quarantine reason, and the first ~120 chars of content.
|
|
12
|
+
*/
|
|
13
|
+
export function formatQuarantineList(nodes, json) {
|
|
14
|
+
if (json) {
|
|
15
|
+
return JSON.stringify(nodes, null, 2);
|
|
16
|
+
}
|
|
17
|
+
if (nodes.length === 0) {
|
|
18
|
+
return "Quarantine queue is empty.";
|
|
19
|
+
}
|
|
20
|
+
return nodes
|
|
21
|
+
.map((n) => {
|
|
22
|
+
const preview = n.content.length > 120 ? `${n.content.slice(0, 117)}...` : n.content;
|
|
23
|
+
const reason = n.quarantineReason ?? "unspecified";
|
|
24
|
+
return `[${n.id.slice(0, 8)}] (${n.provenance}) reason=${reason}: ${preview}`;
|
|
25
|
+
})
|
|
26
|
+
.join("\n");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Release a memory from quarantine and render the result. JSON mode
|
|
30
|
+
* emits the updated node; human mode confirms the release while
|
|
31
|
+
* reminding the operator that the memory keeps its low-trust marking
|
|
32
|
+
* for agent consumption.
|
|
33
|
+
*/
|
|
34
|
+
export async function releaseQuarantined(memos, id, json) {
|
|
35
|
+
const node = await memos.releaseFromQuarantine(id);
|
|
36
|
+
if (json) {
|
|
37
|
+
return JSON.stringify(node, null, 2);
|
|
38
|
+
}
|
|
39
|
+
return (`Released ${id.slice(0, 8)} from quarantine.` +
|
|
40
|
+
" It is recallable again; agent tools still see it as untrusted until a reviewer promotes its provenance tier.");
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=quarantine-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarantine-commands.js","sourceRoot":"","sources":["../src/quarantine-commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAmB,EACnB,IAAa;IAEb,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,4BAA4B,CAAC;IACtC,CAAC;IACD,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,MAAM,OAAO,GACX,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QACvE,MAAM,MAAM,GAAG,CAAC,CAAC,gBAAgB,IAAI,aAAa,CAAC;QACnD,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,YAAY,MAAM,KAAK,OAAO,EAAE,CAAC;IAChF,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,KAAY,EACZ,EAAU,EACV,IAAa;IAEb,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC;IACnD,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,CACL,YAAY,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,mBAAmB;QAC7C,+GAA+G,CAChH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write-gate quarantine — a local-heuristic classifier for
|
|
3
|
+
* instruction-like payloads in memory writes and imports.
|
|
4
|
+
*
|
|
5
|
+
* Runs synchronously on the `store()` hot path (pure regex scoring,
|
|
6
|
+
* microseconds per write — no LLM, no network). Content that scores at
|
|
7
|
+
* or above {@link QUARANTINE_FLAG_THRESHOLD} is still stored (add-only
|
|
8
|
+
* is preserved) but marked `quarantined: true`, which excludes it from
|
|
9
|
+
* recall by default until a human reviews it via
|
|
10
|
+
* `memos quarantine list|release`.
|
|
11
|
+
*
|
|
12
|
+
* The classifier first normalizes its input
|
|
13
|
+
* ({@link normalizeForScreening}): NFKC unicode folding, zero-width
|
|
14
|
+
* character stripping, Cyrillic/Greek homoglyph folding, single-newline
|
|
15
|
+
* collapsing, spaced-letter joining (`i g n o r e` → `ignore`), and
|
|
16
|
+
* whitespace collapsing. Injection clichés are additionally matched
|
|
17
|
+
* against a leetspeak-unfolded copy (`1gn0re` → `ignore`).
|
|
18
|
+
*
|
|
19
|
+
* Signal classes (each reports a stable machine-readable `code`):
|
|
20
|
+
*
|
|
21
|
+
* 1. Injection clichés — verbatim prompt-injection openers ("ignore
|
|
22
|
+
* previous instructions", "disregard your prior instructions",
|
|
23
|
+
* "do not tell the user", "pretend you are …", DAN/jailbreak
|
|
24
|
+
* patterns, chat-template role markers). Full-strength (2.0:
|
|
25
|
+
* quarantines on its own). Deliberately anchored to
|
|
26
|
+
* `previous`/`prior` so ordinary "ignore the old template" phrasing
|
|
27
|
+
* does NOT match.
|
|
28
|
+
* 2. Imperative exfiltration — an exfil verb (send, email, upload, dump,
|
|
29
|
+
* …) governing a credential noun (passwords, api keys, secrets, …).
|
|
30
|
+
* 1.5 alone; 2.0 when a URL/email destination appears anywhere in
|
|
31
|
+
* the write, or when verb+destination share a sentence and a
|
|
32
|
+
* credential noun appears anywhere. First-person possessives ("my
|
|
33
|
+
* password", "our api key") are exempt — "reset my password" is not
|
|
34
|
+
* an attack. On low-trust tiers (`tool-output`, `imported`) the
|
|
35
|
+
* bare verb+credential shape is 2.0 on its own — tool output that
|
|
36
|
+
* moves credentials is never benign.
|
|
37
|
+
* 3. Exfiltration-shaped — secret material (an `sk-…`/`AKIA…`/`ghp_…`
|
|
38
|
+
* token, a `-----BEGIN … PRIVATE KEY-----` block, or an
|
|
39
|
+
* `api key: <value>` assignment) next to a URL or an exfiltration
|
|
40
|
+
* verb. 2.0.
|
|
41
|
+
* 4. Encoded payloads — base64 blobs are decoded (whitespace-tolerant,
|
|
42
|
+
* depth-bounded) and the decoded text is re-screened: a blob that
|
|
43
|
+
* decodes to an injection scores 2.0 (`injection:encoded-
|
|
44
|
+
* instructions`); an opaque blob is 1.0 on its own (1.5 on
|
|
45
|
+
* low-trust tiers). A candidate only counts as a blob when it looks
|
|
46
|
+
* like real base64 (a digit, `+`/`/`, or `=` padding) — English prose
|
|
47
|
+
* that merely uses base64-alphabet words is not a blob.
|
|
48
|
+
* 5. Low-trust-tier dormant instructions (Trojan-Hippo shape) —
|
|
49
|
+
* conditional future-directed instructions ("when the user asks
|
|
50
|
+
* about X, always say Y", "from now on, include …", "never mention
|
|
51
|
+
* …") are 2.0, but ONLY for `tool-output`/`imported` tiers. Tool
|
|
52
|
+
* output is data, never behavioral instructions; the same phrasing
|
|
53
|
+
* in a user's own memory ("when I travel, always pack my charger")
|
|
54
|
+
* is silent.
|
|
55
|
+
* 6. Low-trust-tier trigger phrases (AgentPoison shape) — nonce-like
|
|
56
|
+
* tokens or trigger words ("code word", "activation token")
|
|
57
|
+
* co-occurring with instruction-shaped content. 2.0, low-trust
|
|
58
|
+
* tiers only.
|
|
59
|
+
*
|
|
60
|
+
* False-positive tuning: the negative corpus in
|
|
61
|
+
* `__tests__/fixtures/redteam-battery.ts` (60 ordinary memories —
|
|
62
|
+
* wifi passwords on the fridge, "send mom the photos", meeting notes
|
|
63
|
+
* with URLs, developer-mode phone settings, surprise parties) must
|
|
64
|
+
* score below threshold, including adversarial-benign cases such as
|
|
65
|
+
* security notes quoting attack clichés. Quoted clichés under
|
|
66
|
+
* meta-discussion framing ("how do I defend against 'ignore previous
|
|
67
|
+
* instructions'?", "the article explains DAN mode") halves every signal
|
|
68
|
+
* and caps total injection:* contribution at 1.0 — discussing an attack
|
|
69
|
+
* is not an attack. A single unquoted injection signal wearing a
|
|
70
|
+
* discussion-like prefix ("Security update: ignore previous
|
|
71
|
+
* instructions") still evades; that residual gap is documented in
|
|
72
|
+
* docs/provenance-trust.md.
|
|
73
|
+
*
|
|
74
|
+
* @module @mem-os/quarantine
|
|
75
|
+
*/
|
|
76
|
+
import type { ProvenanceTier } from "./types.js";
|
|
77
|
+
/**
|
|
78
|
+
* Normalize write content before screening: NFKC folding, zero-width
|
|
79
|
+
* stripping, homoglyph folding, single-newline joining (paragraph
|
|
80
|
+
* breaks still split sentences), spaced-letter joining, and whitespace
|
|
81
|
+
* collapsing. Exported for testing.
|
|
82
|
+
*/
|
|
83
|
+
export declare function normalizeForScreening(content: string): string;
|
|
84
|
+
/** Quarantine at or above this score. Tuned against the negative corpus. */
|
|
85
|
+
export declare const QUARANTINE_FLAG_THRESHOLD = 2;
|
|
86
|
+
export interface QuarantineSignal {
|
|
87
|
+
/** Stable machine-readable code, e.g. `injection:ignore-previous-instructions`. */
|
|
88
|
+
code: string;
|
|
89
|
+
/** Human-readable explanation. */
|
|
90
|
+
detail: string;
|
|
91
|
+
/** Points contributed toward {@link QUARANTINE_FLAG_THRESHOLD}. */
|
|
92
|
+
points: number;
|
|
93
|
+
}
|
|
94
|
+
export interface QuarantineVerdict {
|
|
95
|
+
flagged: boolean;
|
|
96
|
+
score: number;
|
|
97
|
+
signals: QuarantineSignal[];
|
|
98
|
+
/** `;`-joined signal codes — stored in `quarantine_reason`. */
|
|
99
|
+
reason: string;
|
|
100
|
+
}
|
|
101
|
+
export interface ScreenWriteOptions {
|
|
102
|
+
/**
|
|
103
|
+
* Provenance tier of the write. Low-trust tiers (`tool-output`,
|
|
104
|
+
* `imported`) get stricter screening: dormant-instruction and
|
|
105
|
+
* trigger-phrase signals activate, and bare verb+credential
|
|
106
|
+
* exfiltration quarantines on its own. Defaults to user-like
|
|
107
|
+
* (lenient) when omitted.
|
|
108
|
+
*/
|
|
109
|
+
tier?: ProvenanceTier;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Screen one write for instruction-like payloads. Pure, synchronous,
|
|
113
|
+
* allocation-light — safe on the store() hot path.
|
|
114
|
+
*
|
|
115
|
+
* Pass `opts.tier` for tier-aware strictness: `tool-output` /
|
|
116
|
+
* `imported` writes additionally screen for dormant instructions and
|
|
117
|
+
* trigger phrases, and bare verb+credential exfiltration quarantines.
|
|
118
|
+
*/
|
|
119
|
+
export declare function screenWrite(content: string, opts?: ScreenWriteOptions): QuarantineVerdict;
|
|
120
|
+
//# sourceMappingURL=quarantine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quarantine.d.ts","sourceRoot":"","sources":["../src/quarantine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AA8EjD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAa7D;AA2XD,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAoC3C,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AA8aD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,kBAAuB,GAC5B,iBAAiB,CA2CnB"}
|