integration.company-intelligence-postgres
Postgres persistence for Company Intelligence canonical records and the durable document evidence ledger.
@lssm-tech/integration.company-intelligence-postgresbun add @lssm-tech/integration.company-intelligence-postgresManifest 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:
CompanyIntelligenceRecordRepositorycommits validated canonical record packets idempotently (append-only records, references, receipts, outbox event).createCompanyIntelligenceDocumentEvidenceLedgerFromDatabase(database)returns a durableDocumentEvidenceLedger(@lssm-tech/lib.knowledge/evidence). Originals and extraction runs live inmanaged_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 })returnsundefinedwhen 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 inmanaged_companyos_ci_evidence_vectors(pgvectorvector(1536)from theextensionsschema, HNSW cosine index, RLS onapp.tenant_id). Every upsert, search and delete must carry the owningtenantId(knowledge evidence vector tenancy) and runs in that tenant's transaction; the host injects the generic store, e.g.SupabaseVectorProviderwithcreateTableIfMissing: falseandextensionSchema: '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
Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.
5 declarations
@lssm-tech/integration.provider-databaseworkspace:^
Read the package manual ↗@lssm-tech/lib.companyos-runtimeworkspace:^
Read the package manual ↗@lssm-tech/lib.companyos-specworkspace:^
Read the package manual ↗@lssm-tech/lib.contracts-integrationsworkspace:^
Read the package manual ↗@lssm-tech/lib.knowledgeworkspace:^
Read the package manual ↗
Declared capabilities
Commit canonical Company Intelligence record packets and persist durable document evidence (originals, extraction runs, lineage lifecycle) with tenant RLS.
Scripts
buildcontractspec-bun-build buildbuild:bundlecontractspec-bun-build transpilebuild:typescontractspec-bun-build typeslint:checknode ../../../scripts/biome.cjs check .testbun testtypechecktsgo --noEmit