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 déclarations · les 6 premières affichéesSELECT 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 imports · 35 affichés

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
Votre vue

Make room for your context.

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

Votre contexte

The different parts of you

Choose a starting point

Un mélange utile de contexte, de visuels et de guidage discret.

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

Confort de lecture

Choisir votre langue

La langue de l’interface change uniquement le texte. Les marchés, les prix et les parcours conservent leurs propres paramètres.

Couverture des traductions

Une partie du contenu est affichée en anglais.

Navigation151
Graphe616
Catégories378
Portfolio833
Exemples2 035
Aperçu de la source1 542

D’autres traductions seront ajoutées à mesure que le contenu sera relu.

Cette préférence est enregistrée dans ce navigateur.

Rechercher sur le site

Des points de départ utiles

Aucun résultat. Essayez une expression plus courte, un nom d’opération ou un autre périmètre de recherche.

UN PEU DE PLACE POUR EXPLORER

Trouvez quelque chose à explorer.

Ouvrez un aperçu détaillé sur cette page, essayez une autre perspective ou suivez le détail vers sa propre page.

Fonctionnement des aperçus et des commandes
01

Regarder avant de partir

Survolez un lien ou sélectionnez-le avec Tab pour voir un aperçu. Cliquer sur le lien d’origine ou appuyer sur Entrée ouvre toujours sa destination.

02

Rester dans le contexte

Entrez dans l’aperçu pour explorer ses sections. Depuis un lien sélectionné, utilisez Alt + ↓ pour y entrer au clavier. Échap le ferme.

03

Ouvrir les possibilités

Les lignes dépliables, les choix de perspective et les commandes mises en évidence révèlent davantage. Votre vue adapte le confort de lecture et le contexte exploré.

Un bouton séparé pour voir de plus près

Affichez de petits boutons d’aperçu à côté des liens quand l’espace le permet. Touchez l’œil pour examiner ou le lien pour y aller directement. Ce choix reste dans cet onglet.

Aucun historique de navigation n’est collecté. La réduction des animations suit votre appareil et Votre vue.