Skip to content
ContractSpec
Start here

Package manual · integrations

·Company, work and service operations

integration.company-intelligence-postgres

Postgres persistence for Company Intelligence canonical records and the durable document evidence ledger.

integrationsintegrationv0.1.0experimentalserverbunnode
@lssm-tech/integration.company-intelligence-postgres
bun add @lssm-tech/integration.company-intelligence-postgres
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

Postgres persistence owned by Company Intelligence, usable by any host:

  • CompanyIntelligenceRecordRepository commits validated canonical record packets idempotently (append-only records, references, receipts, outbox event).
  • createCompanyIntelligenceDocumentEvidenceLedgerFromDatabase(database) returns a durable DocumentEvidenceLedger (@lssm-tech/lib.knowledge/evidence). Originals and extraction runs live in managed_companyos_ci_document_originals / managed_companyos_ci_document_extractions; lineage (source → version → asset → part → fragment → evidence) is committed as canonical records, and supersession or withdrawal are append-only tombstones, so every Company Intelligence read path honours them.
  • createCompanyIntelligenceDocumentEvidenceLedgerFromUrl({ connectionString }) returns undefined when no connection string is configured, so hosts report the ledger as missing instead of falling back.
  • createCompanyIntelligenceEvidenceVectorStore({ runTenantTx, createStore }) is the tenant-isolated evidence search projection in managed_companyos_ci_evidence_vectors (pgvector vector(1536) from the extensions schema, HNSW cosine index, RLS on app.tenant_id). Every upsert, search and delete must carry the owning tenantId (knowledge evidence vector tenancy) and runs in that tenant's transaction; the host injects the generic store, e.g. SupabaseVectorProvider with createTableIfMissing: false and extensionSchema: 'extensions'. A missing tenant, a payload owned by another tenant or a vector of another dimension fails closed.

Every operation runs in a transaction with app.tenant_id set for forced row-level security. List parameters are JSON-encoded, so the adapter works with any DatabaseProvider driver.

The schema is migrated by the Company Intelligence host (api-application-monolith migrations 0022–0027, 0099, 0110 and 0180); this package never runs DDL.

Relationships

THIS PACKAGEintegration.company-intelligence-postgres1 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

5 declarations

Declared capabilities

Company Intelligence Postgres

Commit canonical Company Intelligence record packets and persist durable document evidence (originals, extraction runs, lineage lifecycle) with tenant RLS.

Scripts

  • buildcontractspec-bun-build build
  • build:bundlecontractspec-bun-build transpile
  • build:typescontractspec-bun-build types
  • lint:checknode ../../../scripts/biome.cjs check .
  • testbun test
  • typechecktsgo --noEmit