/** * The vault activity log (`llm-curated/log.md`) as entries. * * One place that knows the entry format `WikiIngestService` appends: * * ## [] | * * ref: * * * * Used by search (one document per recent entry), rotation (carry forward * the recent non-noise entries), the digest compiler and the startup * briefing. Also decides what counts as a content-free entry (#1345): a * templated state transition carries nothing a reader could use. * * @module services/wiki/wiki-log-entries */ /** One parsed `log.md` entry. */ export interface WikiLogEntryRecord { /** ISO timestamp from the header. */ timestamp: string; /** Epoch ms of `timestamp`, or NaN when it does not parse. */ timestampMs: number; /** Source type from the header (`record_learning`, `user_chat`, ...). */ sourceType: string; /** Caller session (or source ref) from the header. */ caller: string; /** `ref:` line value, '' when absent. */ ref: string; /** Entry body after the `ref:` line, trimmed. */ body: string; /** The entry's raw text, header included, as it stands in the file. */ raw: string; } /** Header a fresh `log.md` starts with. */ export declare const WIKI_LOG_HEADER = "# Activity log\n\nAppend-only log of ingested sources. Each entry: `## [] | `.\n"; /** * Whether one line is an entry header (`## [] | `). * * @param line - One line without its newline * @returns True for a header line */ export declare function isLogEntryHeaderLine(line: string): boolean; /** * Whether a learning / log body is a content-free templated record. * * @param body - Entry body or learning text * @returns True when the text matches a known templated shape or is blank * * @example * ```typescript * isNoiseLogBody('(learning) [pattern] [[WorkItem-1]] task:done running→done. timestamp=2026-10-17T00:00:00Z. Source: x.'); // true * isNoiseLogBody('(gotcha) complete-task rejects queued→done; accept-task first.'); // false * ``` */ export declare function isNoiseLogBody(body: string | undefined | null): boolean; /** * Conversation handover snapshots (`**Conversation handover — — task ** (fact) …`) * that the fresh-conversation path mirrors into the vault. They are state, * not knowledge: a thousand of them a week on one machine. They stay in the * log (the agent is pointed at them) but are not knowledge for search, the * digest, memory or the briefing. * * @param body - Entry body * @returns True for a handover snapshot */ export declare function isHandoverLogBody(body: string | undefined | null): boolean; /** * Normalised form of a body used for duplicate detection: whitespace * collapsed, case folded, trailing punctuation dropped. * * @param body - Entry body * @returns Normalised text */ export declare function normalizeLogBody(body: string): string; /** * Stable key of an entry's content (sha1 of the normalised body). Two * entries with the same body share a key whatever their timestamps. * * @param body - Entry body * @returns 40-char hex digest */ export declare function logBodyKey(body: string): string; /** * Parse a whole `log.md` into entries, in file order. Text before the * first entry header (the preamble, a migrated learnings import) is not an * entry and is dropped. * * @param raw - File content * @returns Entries in file order */ export declare function parseLogEntries(raw: string): WikiLogEntryRecord[]; /** * Serialise an entry back into the append format (leading blank line, * header, ref line, body, trailing blank line). * * @param entry - Entry to serialise * @returns Markdown block */ export declare function serializeLogEntry(entry: Pick): string; /** * The entries from the last `days` days that carry content, newest first, * with duplicate bodies collapsed (the newest copy wins). Handover * snapshots are left out unless `includeHandovers` is set (rotation keeps * them; search, digest, memory and briefing do not). * * @param entries - Parsed entries (any order) * @param days - Window length * @param now - Current epoch ms * @param limit - Cap on returned entries * @param options - `includeHandovers` keeps handover snapshots * @returns Recent, non-noise, deduped entries, newest first */ export declare function recentContentEntries(entries: readonly WikiLogEntryRecord[], days: number, now?: number, limit?: number, options?: { includeHandovers?: boolean; }): WikiLogEntryRecord[]; /** * Vault-relative "path" of a log entry as surfaced by search: * `llm-curated/log.md#`. * * @param entry - Entry * @returns Pseudo path */ export declare function logEntryPath(entry: Pick): string; /** * Whether a vault-relative path points at a log entry (as opposed to a page). * * @param relativePath - Path from a search hit * @returns True for `llm-curated/log.md#…` */ export declare function isLogEntryPath(relativePath: string): boolean; /** * The `(category)` prefix `MemoryService` puts on a mirrored memory * (`(gotcha) …`, `(decision) …`) or the `[tag]` an auto-recorder uses. * * @param body - Entry body * @returns Lower-case category, or 'learning' when none is present */ export declare function logEntryCategory(body: string): string; /** * Topic of an entry for grouping in a digest: the first `[[Entity]]` link, * else a bold `**Title**` lead, else the category. * * @param body - Entry body * @returns Short topic label */ export declare function logEntryTopic(body: string): string; //# sourceMappingURL=wiki-log-entries.d.ts.map