@bonginkan/maria
Version:
MARIA OS v5.9.5 – Self-Evolving Organizational Intelligence OS | Speed Improvement Phase 3: LLM Optimization + Command Refactoring | Performance Measurement + Run Evidence System | Zero ESLint/TypeScript Errors | 人とAIが役割を持ち、学び、進化し続けるための仕事のOS | GraphRAG ×
32 lines (31 loc) • 1.15 kB
TypeScript
/**
* Helper to resolve a per-project session root
*
* Priority:
* 1. Explicit MARIA_WORKSPACE_ROOT environment variable
* 2. Walk up from initialCwd until a directory containing `.git` or `package.json`
* 3. initialCwd itself
*
* This ensures that within the same project, even if terminals or subdirectories differ,
* `.maria/memory/session.json` is consolidated into a single location.
*/
export declare function resolveSessionRoot(initialCwd?: string): string;
export declare class SessionMemory {
private root;
constructor(root?: string);
private file;
private lockFile;
load<T = unknown>(): T | Record<string, never>;
/**
* Save session atomically with a simple file lock to avoid corruption.
* Applies masking and truncation to keep data safe and bounded.
*/
save(data: unknown): void;
/**
* Attempt to acquire a very lightweight lock. If an existing lock is older
* than 10 seconds, consider it stale and overwrite. If fresh and cannot lock
* within waitMs, proceed without throwing to avoid blocking the UX.
*/
private tryAcquireLock;
private rotateIfStale;
}