AbsoluteJS

@absolutejs/agent-exchange-secure-messaging-stores

@absolutejs/agent-exchange-secure-messaging-storesv0.0.1betaAI

Tenant-scoped atomic memory, Redis, and PostgreSQL receipt stores for Agent Exchange secure messaging.

#Installation

BASH
bun add @absolutejs/agent-exchange-secure-messaging-stores

#Capabilities

Overview

Tenant-scoped, atomic receipt stores for @absolutejs/agent-exchange-secure-messaging. The package provides memory, Redis, and PostgreSQL implementations behind the same receipt-store contract.

The tenant is bound when a store is constructed; callers cannot select a tenant per operation. Tenant and exchange identifiers are SHA-256 digested before use in keys. Receipts are strictly parsed, size bounded, expiration aware, and compared as canonical JSON. Saving an identical receipt and expiry returns duplicate; any different receipt or expiry for that live key returns conflict.

Redis adapter

Implement get(key) and eval(script, keys, arguments_) with the official client of your choice. The exported Lua script performs compare-or-insert and absolute expiration (PXAT) as one Redis operation. Do not replace it with a client-side GET followed by SET.

PostgreSQL adapter and migration

Run AGENT_EXCHANGE_RECEIPT_POSTGRES_MIGRATION through your normal migration system before constructing the store. The same idempotent SQL ships at the exported ./migrations/postgres.sql package subpath for migration tools. Pass a client with a parameterized query(text, values) method. Save uses one INSERT ... ON CONFLICT ... RETURNING statement, including a random per-attempt token, to distinguish a new write from duplicate and conflicting concurrent writes without a read/write race.

Call deleteExpired({ now }) from a repeatable maintenance job until it returns zero. It deletes at most 1,000 rows per call by default; batchSize is bounded to 10,000. Redis expiry is automatic.

The memory store is process-local and intended for tests and examples only.

Show 1 more

Licensed under Apache-2.0.

Outcomes

What you can build

Build on the supported package contract

Use @absolutejs/agent-exchange-secure-messaging-stores through its supported public entry points.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/agent-exchange-secure-messaging-stores version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/agent-exchange-secure-messaging-stores example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#@absolutejs/agent-exchange-secure-messaging-stores quick start

Partial snippet

# @absolutejs/agent-exchange-secure-messaging-stores

TS
const receipts = createRedisAgentExchangeReceiptStore({
  client: redisAdapter,
  tenantId: authenticatedTenant.id,
});

#Public entry points

Supported entry points declared by this package manifest.

Package entry point declared in package.json.

@absolutejs/agent-exchange-secure-messaging-stores@absolutejs/agent-exchange-secure-messaging-stores/migrations/postgres.sql

#Package commands

Scripts declared by this package manifest.

bun run buildrm -rf dist && bun build src/index.ts --outdir dist --root src --sourcemap --target=browser --external @absolutejs/agent-exchange --external @absolutejs/agent-exchange-secure-messaging && tsc --project tsconfig.build.json
bun run check:packagebun run format:check && bun run typecheck && bun run test && bun run build
bun run formatprettier --write "./**/*.{ts,json,md}"
bun run format:checkprettier --check "./**/*.{ts,json,md}"
bun run testbun test tests/
bun run typechecktsc --noEmit

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

8 symbols
AgentExchangeReceiptRedisClienttypePermalinkSource
TS
type AgentExchangeReceiptRedisClient = {
    readonly eval: (script: string, keys: readonly string[], arguments_: readonly string[]) => Promise<unknown>;
    readonly get: (key: string) => Promise<string | undefined | null>;
};
Exported from @absolutejs/agent-exchange-secure-messaging-stores