Persistent database — replace in memory stores#357
Open
clintjeff2 wants to merge 4 commits into
Hidden character warning
The head ref may contain hidden characters: "Persistent-database-\u2014-replace-in-memory-stores"
Open
Conversation
…ercel-postgres Add optional Postgres (Prisma) + Vercel KV persistence for agents, receipts, reputation and task queue
- Fix TypeScript error in drain route by adding required 'result' property to 'task.completed' event. - Fix TypeScript errors in task-drain tests by correctly awaiting async 'drainAgentTasks' calls. - Synchronize package-lock.json with package.json to fix 'npm ci' failures. - Increase 'MAX_PENDING_PER_AGENT' to 300 to support existing test cases. Co-authored-by: clintjeff2 <119521983+clintjeff2@users.noreply.github.com>
…e-9749460999197247886 Fix TypeScript errors and synchronize lockfile
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Motivation
Description
prisma/schema.prisma) forAgent,X402Receipt, andReputationEntrytables and addedprisma/@prisma/client/Vercel client deps inpackage.json.lib/db/postgres.tsandlib/db/kv.tswhich only enable when env vars are present and skip during tests; they dynamically import the Vercel SDKs to avoid hard failures when not configured.lib/protocols/x402-receipt-store.tsand exposedsave/get/listasync variants; wired async flow intolib/protocols/x402.tsand the settle/receipts routes.lib/reputation/reputation-store.ts(getReputationAsync,applyReputationActionAsync,listReputationsAsync) that write/readReputationEntryrows when configured and kept in-memory snapshot behavior as fallback.lib/agent-runtime/task-queue.tsand wired async enqueue/get/list intoapp/api/tasksroutes while preserving the in-memory queue fallback.app/api/agents/stateimplemented inlib/agents/agent-state-store.tsto read/upsert agents via Postgres with seeded in-memory data when DB is not configured.Testing
npm test -- lib/protocols/x402.test.ts lib/reputation/reputation-store.test.tsand the targeted tests passed.npm test -- __tests__/api/tasks.test.ts __tests__/api/protocol/x402-receipts.test.tsand those API-level tests passed after wiring async helpers.npm test; some pre-existing failures remain (tests around task-drain max caps and a few unrelated expectations) and are not caused by the DB/KV changes.npx tsc --noEmit; TypeScript reported unrelated type errors in areas outside this change (task-drain typings and a missing connector type), not blocking the new adapters.npm run build; build was blocked by environment network failures fetching Google Fonts fornext/fontin this environment (not related to DB/KV changes).Closes #25