integrationPackage manifestv2.0.6

integration.agent-durable-store

Durable SQLite and Postgres session and checkpoint stores for @lssm-tech/lib.ai-agent

@lssm-tech/integration.agent-durable-store
Source, release and verification context

Source snapshot bcc79fcc · Declared package version 2.0.6. This page combines the checked-in package guide and manifest; commands and runtime behavior were not executed in this review.

Package source ↗ Manifest ↗
servernode
EXPLORE THE PACKAGE

See where this package fits.

Follow a declared connection, inspect an import, then open the source guide when you need the detail.

THIS PACKAGEintegration.agent-durable-storeintegrations

Arrows point from a package to its direct dependency. Each count is derived from the captured manifests.

7 declaraciones · se muestran las primeras 6SELECT TO INSPECT

@lssm-tech/integration.agent-durable-store

Durable implementations of @lssm-tech/lib.ai-agent's AgentSessionStore and AgentCheckpointPort. Choose embedded SQLite for a single durable worker or a provider-neutral Postgres adapter for horizontally scaled runtimes.

SQLite

ts
import {
  createSqliteAgentCheckpointStore,
  createSqliteAgentSessionStore,
} from "@lssm-tech/integration.agent-durable-store";

const sessions = createSqliteAgentSessionStore({ file: "./agent.db" });
const checkpoints = createSqliteAgentCheckpointStore({ file: "./agent.db" });

Both factories accept the same file and can share one database file. Pass createSqliteAgentSessionStore({ file }) wherever new InMemorySessionStore() is currently constructed.

Each SQLite store also exposes close() (typed SqliteDurableStoreLifecycle), which releases its database handle. Close every store opened on a file before deleting it: Windows refuses to remove a database that still has an open handle (EBUSY/EPERM). close() is idempotent; using a closed store throws.

Durability

The database opens in WAL journal mode with synchronous = NORMAL, so a committed write is recoverable after a hard process kill. A fresh process pointed at the same file recovers the last committed session and checkpoint — see src/sqlite/process-death.test.ts (agent runtime conformance case 5).

Effect-replay safety

AgentCheckpointEnvelope.effectResults (keyed by ${nonce}:${stepInstanceId}) is persisted verbatim, so approval-gated side-effecting steps replay their recorded result on resume instead of re-firing. The dedup/replay logic lives in @lssm-tech/integration.workflow-devkit; this package only persists the field.

Postgres

The Postgres adapter accepts the repository's DatabaseProvider port, so the same store works with Supabase Postgres, self-hosted Postgres, Railway Postgres, or another compatible provider.

ts
import { SupabasePostgresProvider } from "@lssm-tech/integration.provider-supabase";
import {
  createPostgresAgentCheckpointStore,
  createPostgresAgentSessionStore,
  migratePostgresAgentDurableStore,
} from "@lssm-tech/integration.agent-durable-store/postgres";

const database = new SupabasePostgresProvider({
  connectionString: process.env.SUPABASE_DATABASE_URL,
});

await migratePostgresAgentDurableStore(database);

const sessions = createPostgresAgentSessionStore({
  database,
  tenantId: "tenant-123",
});
const checkpoints = createPostgresAgentCheckpointStore({
  database,
  tenantId: "tenant-123",
});

Each store instance is bound to one non-empty tenant identifier. Every query includes that scope, persisted payloads are checked against it, session writes use optimistic revisions, and message/step histories are bounded. The adapter does not make deployment-specific security promises: the host remains responsible for credentials, TLS, database roles and RLS, backups, retention, regional placement, and tested RPO/RTO.

The same Postgres entrypoint also exposes durable stores for multiplayer collaboration sessions/events, governed improvement work orders, and tamper-evident audit events. Audit records form a per-tenant hash chain and support head verification; every adapter remains tenant-bound and uses optimistic concurrency where the domain contract requires it.

ts
import {
  createPostgresAgentAuditStore,
  createPostgresCollaborationStore,
  createPostgresImprovementWorkOrderStore,
  createPostgresImprovementWorkOrderStoreV2,
} from "@lssm-tech/integration.agent-durable-store/postgres";

const collaboration = createPostgresCollaborationStore({
  database,
  tenantId: "tenant-123",
});
const improvement = createPostgresImprovementWorkOrderStore({
  database,
  tenantId: "tenant-123",
});
const adaptiveImprovement = createPostgresImprovementWorkOrderStoreV2({
  database,
  tenantId: "tenant-123",
});
const audit = createPostgresAgentAuditStore({
  database,
  tenantId: "tenant-123",
});

Call the migration through a serialized deployment step before serving traffic. Use a shared external Postgres service for multiple workers; do not place the SQLite file on an ephemeral or multi-writer filesystem.

The V2 improvement store uses the same table with an explicit contract-version discriminator. V1 and V2 queries are isolated, CAS remains revision-bound, and due observing work survives process restarts without duplicate scheduling.

Governed self-improvement lifecycle

migratePostgresSelfImprovementStore creates tenant/workspace-scoped program, candidate, signal, and append-only lifecycle tables. By default, the migration applies and forces database-enforced tenant and workspace policies for least-privilege runtime roles. Every repository transaction establishes both claims locally before querying. createPostgresSelfImprovementStores returns typed program, candidate, and signal ports. Candidate transitions are fenced by their previous status, state digest, and timestamp, so duplicate identifiers and stale, reordered, invalid, non-monotonic, or tampered receipts are rejected transactionally.

The candidate store also implements SelfImprovementLifecycleStorePortV1. Call state(id) to obtain the fenced status, digest, sequence, and immutable initial state, and receipts(id) to load the ordered append-only chain for exact replay. These reads remain tenant/workspace scoped and do not grant execution authority.

The returned program, candidate, and signal stores also implement the additive query ports. Lists are deterministic, tenant/workspace scoped, and bounded to 500 records per request. Candidate list results overlay the current fenced status on the immutable candidate document; they do not rewrite its canonical fingerprint or lifecycle receipts.

Protocol artifact persistence

migratePostgresAgentProtocolArtifactStore creates tenant-, space-, product-, application-, purpose-, session-, run-, kind-, and artifact-scoped head and append-only revision tables. createPostgresAgentProtocolArtifactStore stores context manifests, model capability profiles, routes, qualifications, evaluation decisions, canary states, selections, fallback decisions, execution plans, plan validations, run budgets, bounded epochs, checkpoints, progress, reflections, help requests, help responses, context projections, task graphs, delegations, task results, team syntheses, immutable Agent Host application bindings, terminal decisions, protocol run state, memory proposals, owner decisions, mutation receipts, projections, projection revocations, automation definitions, previews, materializations, lifecycle transitions, claims, run receipts, and follow-ups without gaining execution authority.

Every write binds the contract identity digest to the payload, computes an independent canonical payload digest, rejects raw credential fields and common credential values, and uses optimistic revisions. Context manifests, routes, selections, evaluation decisions, and fallback decisions are immutable and idempotent. Model qualification and canary records evolve only through append-only CAS revisions. Epoch and run-state records also evolve through append-only CAS. Automation lifecycle state is the only mutable automation artifact and also evolves through append-only CAS; its definitions, previews, materializations, transitions, claims, receipts, and follow-ups are immutable. Every other execution artifact is immutable. Reads revalidate both digests before returning data. Protocol state binds the exact historical epoch revision and digest, so a crash after an epoch write but before the state commit can retry idempotently without accepting substituted work.

The migration enables and forces RLS by default and scopes policies to transaction-local tenant and space settings. The runtime still includes exact scope predicates on every query. For Supabase, keep these tables server-side, do not grant browser roles access, and pass only opaque secretRef values—never database URLs, provider keys, access tokens, or refresh tokens.

Founder-operations stores

migratePostgresFounderOpsStore (migration founder-ops-v1) creates three tenant-scoped tables: agent_supervised_coding_sessions, agent_proactive_proposals and agent_workflow_improvement_briefs. Table names and the schema are configurable, and the usual role grants and tenant RLS options apply. Run it as a serialized deployment step after the existing agent migrations. The tables do not depend on earlier agent tables.

The stores are structurally typed. The owning module supplies a codec that validates every payload read back, so this integration never imports a product module:

ts
import {
  createPostgresProactiveProposalLedger,
  createPostgresSupervisedCodingSessionStore,
  createPostgresWorkflowImprovementBriefStore,
  migratePostgresFounderOpsStore,
} from "@lssm-tech/integration.agent-durable-store/postgres";
import {
  proactiveLedgerRecordCodecV1,
  supervisedCodingSessionCodecV1,
  workflowImprovementBriefCodecV1,
} from "@lssm-tech/module.agent-fleet/core";

await migratePostgresFounderOpsStore(database);
const sessions = createPostgresSupervisedCodingSessionStore({
  database,
  tenantId,
  codec: supervisedCodingSessionCodecV1,
});

Session and ledger compareAndSet calls require next.revision to be exactly expectedRevision + 1 and update only when the stored revision matches. This means concurrent supervisors apply a coding-wait answer exactly once. Briefs keep the first write, so a frozen success criterion cannot be replaced.

Declared capabilities.

Integration Agent Durable Store

Durable SQLite and Postgres session and checkpoint stores for @lssm-tech/lib.ai-agent

Use it to

  • Adopt durable sqlite and postgres session and checkpoint stores for @lssm-tech/lib.ai-agent

Requires

  • TypeScript

Choose another boundary when

  • The @lssm-tech/integration.agent-durable-store package constraints do not match the target runtime or platform.

@lssm-tech/integration.agent-durable-store

@lssm-tech/integration.agent-durable-store/postgres

@lssm-tech/integration.agent-durable-store/postgres/audit-migrations

@lssm-tech/integration.agent-durable-store/postgres/audit-store

@lssm-tech/integration.agent-durable-store/postgres/checkpoint-store

@lssm-tech/integration.agent-durable-store/postgres/collaboration-migrations

@lssm-tech/integration.agent-durable-store/postgres/collaboration-options

@lssm-tech/integration.agent-durable-store/postgres/collaboration-serialization

@lssm-tech/integration.agent-durable-store/postgres/collaboration-store

@lssm-tech/integration.agent-durable-store/postgres/collaboration-store-queries

@lssm-tech/integration.agent-durable-store/postgres/collaboration-validation

@lssm-tech/integration.agent-durable-store/postgres/errors

Imports and export paths.

41 entries

These are package-manifest entry points. Named symbols listed above come from the capability catalogue; this is not an exhaustive TypeScript symbol reference.

41 importaciones · se muestran 35

Dependencies and related packages.

Runtime dependencies 7
ai
catalog:ai
Development dependencies 6
@electric-sql/pglite
catalog:data
@types/bun
catalog:types
typescript
catalog:

Package scripts.

Commands declared by this package. Review its setup requirements before running them; no command here was executed by this review.

publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose
publish:pkg:canarybun publish:pkg --tag canary
buildcontractspec-bun-build build
build:bundlecontractspec-bun-build transpile
build:typescontractspec-bun-build types
devcontractspec-bun-build dev
cleanrimraf dist .turbo
lintbun lint:fix
lint:fixnode ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .
lint:checknode ../../../scripts/biome.cjs check .
testbun test
prebuildcontractspec-bun-build prebuild
typechecktsgo --noEmit
Tu vista

Make room for your context.

Shape the presentation around this moment. You can change it whenever you need.

Tu contexto

The different parts of you

Choose a starting point

Una mezcla útil de contexto, imágenes y orientación discreta.

Tune each dimension
Each dimension can change independently. Product permissions and available actions stay unchanged.

Support the way you begin and return

Tune your support

Comodidad de lectura

Elige tu idioma

El idioma de la interfaz solo cambia el texto. Los mercados, precios y flujos de trabajo conservan sus propios ajustes.

Cobertura de traducción

Parte del contenido se muestra en inglés.

Navegación151
Grafo616
Categorías188
Portafolio332
Ejemplos2035
Vista previa de la fuente41

Se añadirán más traducciones a medida que se revise el contenido.

Esta preferencia se guarda en este navegador.

Buscar en el sitio web

Puntos de partida útiles

Sin resultados. Prueba una frase más corta, un nombre de operación u otro ámbito de búsqueda.

UN POCO DE ESPACIO PARA EXPLORAR

Encuentra algo que explorar.

Abre una vista detallada en esta página, prueba otra perspectiva o sigue el detalle a su propia página.

Cómo funcionan las vistas previas y los controles
01

Mirar antes de salir

Pasa el cursor por un enlace o enfócalo con Tab para ver una vista previa. Hacer clic en el enlace original o pulsar Intro siempre abre su destino.

02

Mantener el contexto

Entra en la vista previa para explorar sus secciones. Usa Alt + ↓ desde un enlace enfocado para entrar con el teclado. Escape la cierra.

03

Abrir las posibilidades

Las filas desplegables, las perspectivas y los controles destacados revelan más. Tu vista cambia la comodidad de lectura y el contexto que exploras.

Un botón separado para mirar más de cerca

Muestra pequeños botones de vista previa junto a los enlaces donde haya espacio. Toca el ojo para inspeccionar o el enlace para ir directamente. Esta elección permanece en esta pestaña.

No se recoge historial de navegación. El movimiento reducido sigue tu dispositivo y Tu vista.