- Go 71.4%
- TypeScript 27.5%
- CSS 0.5%
- PLpgSQL 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
- Introduce `ledgerLines` to split work items into summary and body based on fold state, ensuring the live reasoning step remains visible below open folds. - Update `RunFold` and `MessageRow` to use memoized pause states, preventing folds from closing when the user has opened them for pending questions or approvals. - Refactor `session.ts` to fix suggestion prompt construction in review mode and improve code formatting. - Update `STYLE.md` to document the new ledger behavior for live steps. |
||
| cmd | ||
| docs | ||
| internal | ||
| pkg | ||
| web | ||
| .air.toml | ||
| .dockerignore | ||
| .gitignore | ||
| AGENTS.md | ||
| compose.yaml | ||
| Dockerfile | ||
| example.branch.config.yaml | ||
| example.config.yaml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| mise.toml | ||
| README.md | ||
ersa-agent
PostgreSQL / ParadeDB
Ersa stores all state in PostgreSQL. The Compose service uses
paradedb/paradedb:0.26.7-pg18; no ParadeDB-specific search features are used.
Start ParadeDB with Docker Compose:
docker compose up -d --wait paradedb
The database listens on 127.0.0.1:5432 with user ersa, password ersa, and
database ersa. Its connection URL is:
postgresql://ersa:ersa@localhost:5432/ersa?sslmode=disable
To override these defaults, set PARADEDB_USER, PARADEDB_PASSWORD,
PARADEDB_DB, or PARADEDB_PORT in .env before starting the service.
The ersa password is for local development. Before exposing the database
beyond localhost or storing real data, set PARADEDB_PASSWORD in .env to a
strong value.
Set the server config's db.url to the application connection URL:
db:
url: postgresql://ersa:ersa@127.0.0.1:5432/ersa?sslmode=disable
For a remote PostgreSQL or ParadeDB server, require certificate and hostname
verification with sslmode=verify-full; the server rejects other SSL modes for
remote hosts. Supply the CA and credentials through protected libpq settings or
files rather than committing them:
postgresql://ersa@db.example.com/ersa?sslmode=verify-full
The server takes session-level advisory locks, so connect directly or through a session-mode pooler. Transaction-mode poolers such as PgBouncer are not supported.
Open a SQL shell with:
docker compose exec paradedb sh -c 'psql -U "$POSTGRES_USER" -d "$POSTGRES_DB"'
From a host with PostgreSQL client tools, store the password in an 0600
~/.pgpass or another protected PGPASSFILE, then use a password-free
application URL. The scratch seed tools use the same variable:
export ERSA_DATABASE_URL='postgresql://ersa@127.0.0.1:5432/ersa?sslmode=disable'
psql "$ERSA_DATABASE_URL"
Avoid putting production credentials directly in shell history; use a protected
environment, .pgpass, or the platform's secret store.
Stop the service with docker compose down. Data persists in the
paradedb_data Docker volume across restarts.
Ersa server in Compose
Create the host-owned output directory, then start the services:
mkdir -p out
docker compose up -d --wait
This builds the server from the server target of the Dockerfile and starts it
on http://localhost:8080, next to ParadeDB. It connects to the database over
the postgres_socket volume rather than TCP, so its db.url keeps a socket host
instead of the published port.
The config lives at out/compose.config.yaml. The first start generates it with
fresh keys and db.url from ERSA_DATABASE_URL; later starts reuse it. If you
publish a different port with ERSA_PORT, set domain in that file to match.
The service runs as UID and GID 1000 by default; set ERSA_UID and ERSA_GID
in .env to your id -u and id -g values if they differ. Database credentials
are passed through PGUSER, PGPASSWORD, and PGDATABASE, so URL-reserved
characters in the ParadeDB settings do not need percent-encoding.
Tests
Go integration tests and the web smoke test require ERSA_TEST_DATABASE_URL.
It must be a postgres:// or postgresql:// URL for an administrative
connection whose user can create and drop test databases. Point it at a
maintenance database, not the application database:
export ERSA_TEST_DATABASE_URL='postgresql://ersa@127.0.0.1:5432/postgres?sslmode=disable'
mise run test-web
Each test gets a unique database. The smoke test installs db.url for one
ersa_smoke_<uuid> database in out/test/config.yaml, verifies that its derived
connection selects that database, then drops it after the server stops,
including on failures and signals. It requires psql. Inline connection
passwords are removed from psql arguments and supplied through protected 0600
libpq files, which ordinary teardown removes. With --keep-server, it retains
both the server and database and prints the database name and an exact teardown
command using a password-free admin URL and the same protected credentials.
Cutover from Turso/SQLite
The PostgreSQL/ParadeDB deployment starts with a clean slate. There is no
Turso/SQLite importer: existing sessions, users, provider settings, and other
application data are not copied automatically. Keep the previous deployment and
its database files intact, configure a new empty ParadeDB database through
db.url, and complete first-run setup again.
Roll back to the previous deployment and its preserved Turso/SQLite files only before the new ParadeDB instance accepts application writes. New ParadeDB writes do not exist in the old files, so a later rollback is not data-preserving.
Backups
See docs/BACKUP.md for encrypted, off-host scheduled pg_dump
backups and restore rehearsals, including credential custody, retention, and
recovery objectives.