// Documentation
TypeScript SDK reference.
The @cosmonapse/sdk surface - the idiomatic TypeScript port of the same protocol. Verified against packages/ts-sdk.
TS · 08
RegistryStore
The RegistryStore is the optional live view of every Neuron on a namespace. All three backends are ported: in-memory, SQLite (via better-sqlite3), and Postgres (via pg).
interface
RegistryStoreRecords are NeuronRecord objects keyed by neuron_id. Backends: MemoryRegistryStore, SqliteRegistryStore, PostgresRegistryStore.
storage.ts
interface RegistryStore { connect(): Promise<void>; close(): Promise<void>; upsert(record: NeuronRecord): Promise<void>; markDeregistered(neuronId: string): Promise<void>; touchHeartbeat(neuronId: string, ts: string, status?: NeuronStatus): Promise<void>; get(neuronId: string): Promise<NeuronRecord | null>; list(opts?: ListOptions): Promise<NeuronRecord[]>; } type NeuronStatus = "registered" | "draining" | "deregistered"; // All three backends are ported: const mem = new MemoryRegistryStore(); const lite = new SqliteRegistryStore("/var/lib/cosmonapse/registry.db"); // needs better-sqlite3 const pg = new PostgresRegistryStore({ dsn: "postgresql://user:pw@host/cosmonapse" }); // needs pg
NeuronRecord
record.ts
interface NeuronRecord { neuron_id: string; // wire field names stay snake_case capabilities: string[]; version: string | null; status: NeuronStatus; last_heartbeat: string | null; // ISO 8601 registered_at: string; // ISO 8601 } // Factory that fills defaults (status "registered", registered_at = now): const rec = neuronRecord({ neuron_id: "answerer", capabilities: ["qa"] });
Have a feature in mind?
The protocol, SDKs, and CLI are still pre-1.0. If something here is missing, ambiguous, or wrong - open an issue and propose a change. Every breaking change is debated in DECISIONS.md first.