feat(local-deploy): replace supabase-js with direct postgres + autosync#2
Merged
safixdev merged 1 commit intoJun 8, 2026
Conversation
|
Hey @KainanYuval — welcome to Open Brain Source! 👋 Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what. Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days. If you have questions, check out CONTRIBUTING.md or open an issue. |
…action Rebased cleanly on top of the db.ts driver refactor (PR #1). - server/artifactory.ts: restore Artifactory client (diffSince, fetchArtifact, pushArtifact) — needed by autosync and capture_thought Artifactory write path - server/db.ts: add hasEmbedding(id) method to Db interface and both drivers (supabase: checks embedding column via select; postgres: checks via IS NOT NULL query). Used by autosync to skip Ollama calls for already-embedded thoughts. - server/index.ts: add autosync loop — fires on startup then every 5 min (AUTOSYNC_INTERVAL_MS env var). Uses in-memory cursor advanced after each successful run; calls diffSince(cursor) for incremental diff; skips embedding generation when hasEmbedding returns true. Co-authored-by: Cursor <cursoragent@cursor.com>
dcbe65e to
3a76c13
Compare
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.
Summary
server/index.ts— replaced withnpm:postgres@3(direct TCP connection to Postgres), the same driversync.tsalready uses. No PostgREST / Supabase REST stack required.SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEY,MCP_ACCESS_KEY). Connection is now driven byPOSTGRES_URL(or individualPOSTGRES_HOST/POSTGRES_PASSWORD/POSTGRES_DBvars), compatible with theob1-postgresdocker container out of the box.AUTOSYNC_INTERVAL_MS), the MCP server callsdiffSince(cursor)to fetch only new Artifactory artifacts, upserts them viaupsert_thought(), and generates embeddings only for rows whereembedding IS NULL. Already-embedded thoughts cost zero Ollama calls.artifactory.tsandsync.tsas tracked files (were previously untracked on this branch).deno.json— drop@supabase/supabase-js, addpostgres@3.Test plan
POSTGRES_URL=postgres://postgres:ob1local@localhost:5432/ob1 deno task start— server listens on:8000[autosync] started — interval 300sand immediately runs a syncskipped embedding (already present)— no Ollama callsearch,fetch,search_thoughts,list_thoughts,thought_stats,capture_thought) return correct resultsMade with Cursor