@sema-agent/core
Version:
Stateless, task-oriented AI agent core
35 lines (34 loc) • 2.06 kB
TypeScript
/** Files/dirs the entry scan never treats as entries: the derived index, dotfiles (`.hydrate`,
* transaction staging files), and anything not `.md`. */
export declare const MEMORY_INDEX_FILENAME = "MEMORY.md";
/** Default nesting depth cap under a scope dir (CC memory is flat; a small allowance for topic dirs). */
export declare const DEFAULT_MAX_ENTRY_DEPTH = 3;
/**
* What an entry file's bytes must carry to be an entry file at all: anything but whitespace. A blank
* file holds no entry, so every reader of the plane reads it exactly as it reads an absent file — the
* harvest does not admit a blank new file as an entry, a blank file where a committed entry was
* materialized is that entry's removal (the same as the file being gone), and the backend's read
* serves nothing from it.
*/
export declare function carriesEntry(text: string): boolean;
/** Whether a link stands at `path` itself (the final component, never followed). A path that cannot be examined is not one: the
* reading the caller already had — an unreadable path — stands. */
export declare function standsAsLink(path: string): boolean;
/** One on-disk entry file the scan found. */
export interface ScannedEntryFile {
/** Absolute path. */
path: string;
/** Slug = path relative to the scope dir, without `.md` (may contain `/` for nested topics). */
slug: string;
}
/**
* Enumerate a scope dir's entry files (depth-capped, symlinks skipped, dotfiles/index/non-`.md`
* ignored). Shared by the backend and the engine's harvest scan so the two can never disagree on
* what counts as an entry file. A scope dir is that scope's home and nothing else — no other
* scope's directory can lie under it, so there is nothing to exclude.
*/
export declare function scanEntryFiles(dir: string, opts?: {
maxDepth?: number;
/** Harvest gate hook: called for every path the scan SKIPS, with why (backend scans ignore it). */
onSkip?: (path: string, kind: "symlink" | "depth" | "nonmd" | "dotfile" | "unreadable") => void;
}): ScannedEntryFile[];