UNPKG

@essentialai/cogent-bridge

Version:

Cogent Bridge — cross-agent comms for Claude Code, OpenAI Codex and Slack. Codex users: install with `curl -fsSL https://cogent.tools/install.sh | sh`, then start with `cogent-codex` for real-time peer wake.

56 lines • 2.45 kB
/** Bounded so an always-on peer cannot grow this without limit. Oldest are dropped. */ export declare const WAKE_LOG_MAX_RECORDS = 500; export type WakeOutcome = "replied" | "failed" | "refused" | "threw"; export interface WakeRecord { /** ISO timestamp, stamped on append. */ ts: string; traceId: string; /** The relay message id that triggered this wake — the join key the report asked for. */ messageId: string; fromPeerId: string; toPeerId: string; cwd: string; sessionId: string; platform: string; outcome: WakeOutcome; exitCode: number | null; durationMs: number; /** Paths changed during the wake window; "HEAD" if it committed. null = not a git repo. */ filesChanged: string[] | null; messagePreview: string; } /** * `~/.cogent/wake-log/<sha256(cwd)[..16]>.jsonl` * * Homedir-based, NOT COGENT_STATE_PATH — same reasoning as wake-inflight note 1. The whole * point is that a process which is NOT this bridge (the operator's shell, the interactive * session) can find it. An .mcp.json env var reaches only the bridge, so keying on * COGENT_STATE_PATH would hide the log from precisely the readers it exists for. */ export declare function wakeLogPath(cwd: string): string; /** A git snapshot: HEAD plus every dirty path. null when cwd is not a git worktree. */ export interface TreeState { head: string; entries: Record<string, string>; } /** * Snapshot the worktree. Returns null (never throws, never guesses) when cwd is not a git * repo or git is unavailable — "I cannot tell" is a legitimate answer and is recorded as one. */ export declare function captureTreeState(cwd: string): TreeState | null; /** * Paths that differ between two snapshots, plus "HEAD" when the wake committed. * null when either side could not be captured. */ export declare function diffTreeState(before: TreeState | null, after: TreeState | null): string[] | null; /** * Append one record. Never throws: a read-only home, a full disk or a race must cost the * log entry, never the wake. */ export declare function appendWakeRecord(record: Omit<WakeRecord, "ts">, cwd: string): void; /** * Read the log back, oldest first. A corrupt line is SKIPPED, not fatal: a forensic log * that throws on one bad byte is useless exactly when it is needed. */ export declare function readWakeLog(cwd: string, limit?: number): WakeRecord[]; //# sourceMappingURL=wake-log.d.ts.map