// Path helpers — single source of truth for where files live. // // All paths derive from $HOME (or os.homedir() fallback) and the agent's // resolved identity. Centralizing them here keeps inbox, hwm, sentinel, // and ack-log paths consistent across modules and trivially mockable in // tests by overriding `home`. import { homedir } from "node:os"; import { join } from "node:path"; export interface Paths { workspace: string; pingsDir: string; acksLog: string; agentsFile: string; inbox(agent: string): string; hwm(agent: string): string; watcherActive(agent: string): string; } export function makePaths(home: string = process.env.HOME ?? homedir()): Paths { const workspace = join(home, "Nyx", "workspace"); const pingsDir = join(workspace, "pings"); return { workspace, pingsDir, acksLog: join(workspace, "acks", "log"), agentsFile: join(pingsDir, ".agents"), inbox: (agent: string) => join(pingsDir, `${agent}.inbox`), hwm: (agent: string) => join(pingsDir, `.${agent}.hwm`), watcherActive: (agent: string) => join(pingsDir, `.${agent}.watcher-active`), }; }