npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lssm/integration.communication-os-persistence

v3.0.1

Published

Server-only persistence binding that executes CommunicationOS governed-mutation descriptors against a database, with self-host (PgLite) and managed Postgres support.

Readme

@lssm/integration.communication-os-persistence

Server-only persistence binding for CommunicationOS. It executes the createCommunicationOsMutationDescriptor(...) governed-mutation descriptors from @lssm/lib.communication-spec against a database via executeGovernedMutation, enforcing the spec deploymentMode (managed / BYOK) itself — the executor never validates it.

The server-only database surface also provides additive multi-guild Discord community stores for guild sources and installations, protected raw Gateway envelopes, stable provider identities, coverage evidence, and redacted community-intelligence records. Public projections never return credential references or raw staff content. The Discord worker uses a dedicated observer database role whose RLS policies bind both app.tenant_id and app.trust_zone; the tenant-wide application role remains reserved for authorized API management and portfolio queries.

Surfaces

  • Root (.) — browser-safe. Pure types + helpers only:
    • persistCommunicationOsMutation(descriptor, runtime, options?)
    • adaptCommunicationOsDescriptor, enforceDeploymentMode
    • buildSchemaContributionDdl
    • CommunicationOsDeploymentModeError, COMMUNICATION_OS_PERSISTENCE_MODES
  • ./database — SERVER-ONLY (node-only). Reached only via this subpath, never re-exported from the root (pre-mortem #1: no node-only DB in browser bundles):
    • createPgLitePersistenceProvider (self-host, in-process Postgres/WASM)
    • migrateCommunicationOsSchema (applies communicationOsSchemaContribution)
    • createCommunicationOsPostgresProvider (the single reviewed raw-provider construction boundary for schema bootstrap and service queues; tenant records still require the scoped wrapper)
    • createPostgresCommunicationOAuthReplayStore (atomic, expiring, network-bound one-time OAuth state fingerprints; no scope, verifier, or provider token content is persisted)
    • createPostgresCommunicationRealtimeTicketReplayStore (atomic, database-clock-expiring single-use ticket IDs shared by every realtime replica; no token, principal, scope, or message content is persisted)
    • createPostgresCommunicationSecretProvider (portable AES-GCM credential vault for managed Postgres and self-host PgLite; references are hashed and the external master key and plaintext never enter the database)
    • createManagedCommunicationOsPersistence (wraps the managed createDatabaseRuntime from @lssm/integration.runtime-managed/database)
    • createPostgresCommunicationAttachmentStore (digest-verified binary content, scope isolation, upload idempotency, and immutable message linking)
    • createPostgresCommunicationSupportInternalNoteStore (encrypted immutable private-note content, exact replay/conflict detection, forced RLS, a redacted journal event, and body-free verification evidence)
    • canonical agent conversation, lifecycle, ingress receipt/context/decision, and surface-control stores over the tenant/workspace/space journal; stable logical replay keys reject digest substitution and control claims are transactionally single-winner
    • createPostgresCommunicationDeliveryArtifactStoreV1 persists revision-CAS preference sets and immutable prepared/fallback routing artifacts in that same scoped journal; restart replay revalidates every digest and binding
    • createPostgresCommunicationAgentHostExecutionStateV1 persists the scoped Runtime Node provider reservation, attempt, indeterminate recovery, and exact receipt replay state; same-digest substitution and cross-tenant reads fail closed, and the managed role is protected by forced RLS
    • createPostgresCommunicationOutboxStore persists indeterminate provider outcomes as exact, idempotent reconciliation_pending custody; those rows cannot be reclaimed after lease expiry, and accepted-result reconciliation binds outbox identity, idempotency key, work-order digest, provider ID, and the immutable observation ref/digest/time. Definitive failure uses the same exact transition without inventing a delivery receipt
    • COMMUNICATION_OS_MIGRATIONS (digest-pinned baseline, private-note, and RLS migrations with immutable communication_os.schema_migrations receipts)
  • ./transport — server-only ContractSpec REST binding:
    • createCommunicationOsEcosystemCoreRestRegistry exposes the canonical v3 space, room, account, contact, message-search, and message-send operations, plus the canonical v2 governed-work lifecycle.
    • createCommunicationOsEcosystemCoreRestHandler derives actor, tenant, workspace, space, and principal context from the authenticated host. Room creation accepts only replay-safe client intent.
    • The narrower createCommunicationOsEcosystemMessageRestRegistry and handler remain exported for consumers migrating message transport first.

Self-host (PgLite)

import {
	createPgLitePersistenceProvider,
	migrateCommunicationOsSchema,
} from '@lssm/integration.communication-os-persistence/database';
import { persistCommunicationOsMutation } from '@lssm/integration.communication-os-persistence';

const provider = createPgLitePersistenceProvider({ dataDir: './data/comms' });
await migrateCommunicationOsSchema(provider);
await persistCommunicationOsMutation(descriptor, { provider });

Use createPostgresCommunicationSecretProvider({ database: provider, masterSecret }) when a self-host or managed deployment does not use an external secret manager. The master secret must contain at least 32 bytes and must be stored outside Postgres.

Managed Postgres

import { createManagedCommunicationOsPersistence } from '@lssm/integration.communication-os-persistence/database';

const { persistenceRuntime } = createManagedCommunicationOsPersistence({
	connection: { connectionString: process.env.DATABASE_URL },
});
await persistCommunicationOsMutation(descriptor, persistenceRuntime('tenant:acme'));

Authorized send retries

Message retries recheck current membership and connection authority before returning accepted content. Reuse of a request key with a different principal, room, content, subject, reply target, metadata, encryption envelope or attachment list is denied. Object metadata key order does not change semantic identity. Missing or partial attachment resolution fails before acceptance.

The journal/outbox transaction validates a replayed message before enqueueing delivery, and insert-returned journal events preserve their tenant scope. Queued acceptance remains distinct from provider delivery. Source-bound OPA follow-up delivery, full concurrent authority fencing and production qualification remain open.

Provider queue acceptance

An external connection send requires appendForDelivery; journal-only persistence cannot claim provider queue acceptance. The event/outbox transaction validates the accepted message identity, connection and exact persisted delivery scope, command, policy and payload. Conflicting outbox keys roll back instead of silently dropping delivery. Provider delivery keys use delivery:<send idempotency key>; retries cannot substitute another key. Atomic journal replay uses the accepted message ID rather than the discarded candidate ID.

Internal room journal acceptance remains available without a provider adapter. Queued does not imply sent or delivered. Legacy malformed delivery inputs fail closed and require explicit repair; broader cross-scope key migration and OPA follow-up delivery remain separate qualification work.