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.

14 lines • 783 B
import { createHash } from "node:crypto"; /** * Slice 5 / Story 8.6 — derive a DURABLE workspace identifier from the absolute * cwd. A stable SHA-256 (first 16 hex = 64 bits) is deterministic AND injective, * unlike CC's lossy cwd→escaped-path map (`/[^a-zA-Z0-9-]/g → '-'`, non-injective * → distinct cwds can collide into one project dir). The relay can route/resolve * on this instead of the mutable cwd hint. Single-sourced so the register path * and the auto-reconnect re-register path (startup.ts) derive it IDENTICALLY — * a peer keeps the same workspaceId across an eviction/WS-cycle reconnect. */ export function deriveWorkspaceId(cwd) { return createHash("sha256").update(cwd).digest("hex").slice(0, 16); } //# sourceMappingURL=durable-identity.js.map