import type { Scope } from "./paths.js"; export type Origin = "user" | "self" | "external"; /** * Harness-owned note metadata. The eight required keys are always written; the four optional * sleep-shift keys survive this layer untouched when present. `[key: string]: unknown` carries * any frontmatter key this layer does not know, preserved verbatim across rewrites. */ export type NoteMeta = { scope: Scope; origin: Origin; /** Present only while the note is in the wastebasket; serialized as an ISO timestamp. */ crumpledAt?: string; createdAt: number; updatedAt: number; lastAccessed: number; accessCount: number; sourceWindow?: string; supersedes?: string; recurrenceCount?: number; recurrenceWindows?: string[]; /** Project ownership on newly-created session notes; legacy/invalid values are preserved as-is. */ project?: unknown; [key: string]: unknown; }; /** * Format epoch milliseconds as an ISO 8601 string in the host's local time zone with an * explicit numeric offset (e.g. 2026-09-15T17:31:45.392+08:00). A UTC host renders * "+00:00"; the "Z" designator is never used, and Date.parse round-trips the value. */ export declare function localIso(epochMs: number): string; export declare function isScope(value: unknown): value is Scope; export declare function isOrigin(value: unknown): value is Origin; /** * Parse a note file. Missing known keys take the defaults (accessCount 0, timestamps now); * crumpledAt stays absent until explicitly set, and unknown keys survive untouched. */ export declare function parseNote(raw: string, now?: number): { meta: NoteMeta; body: string; }; /** Serialize frontmatter + blank line + body. Known keys emit in Design order, extras after. */ export declare function serializeNote(meta: NoteMeta, body: string): string; /** Strip a leading frontmatter block from user content, so a note body is pure content. */ export declare function stripLeadingFrontmatter(content: string): string;