@sema-agent/core
Version:
Stateless, task-oriented AI agent core
20 lines (19 loc) • 1.17 kB
TypeScript
import type { ScanFinding } from "./types.js";
/** S2-B 判决四 — the per-path-segment whitelist for memory-domain file names. */
export declare const MEMORY_FILENAME_SEGMENT_RE: RegExp;
/**
* Scan a memory-domain file NAME (a path relative to the writable root, `/`-separated). Returns the
* finding or undefined (clean). Rejected names quarantine at harvest and hard-reject at write time —
* a name like `foo</system-reminder>bar.md` is an injection payload wherever the path is echoed.
*/
export declare function scanMemoryFileName(relPath: string): ScanFinding | undefined;
/**
* Scan memory-domain file CONTENT. Returns every finding (empty = clean). `maxBytes` (when given)
* adds the per-file cap rung — harvest passes it via its own pre-check today, the write-time hook
* passes the engine's `perFileBytes` so the model gets the feedback BEFORE the bytes ever land.
*/
export declare function scanMemoryWrite(text: string, opts?: {
maxBytes?: number;
}): ScanFinding[];
/** Model-facing remediation line per scan code (S2-C: 拒写+结构化错误含整改指引). */
export declare function scanRemediation(code: ScanFinding["code"]): string;