@bastani/atomic-storage-postgres 0.9.90-alpha.1 → 0.10.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.90] - 2026-11-19
6
+
7
+ ### Added
8
+
9
+ - Connections through an HTTP proxy: where the only way out is a proxy that opens `CONNECT` tunnels, such as a sandbox's, every connection to PostgreSQL (the pool's, the wake-ups connection and cancel requests, and their reconnects) tunnels through the proxy `HTTPS_PROXY` names, then `ALL_PROXY` or `HTTP_PROXY`, unless `NO_PROXY` exempts the database host, as for Atomic's other HTTPS clients; a database on this machine is reached directly. The new `proxy` option, an `http://` or `https://` URL or `"none"`, overrides the environment, and SDK callers can pass `socket`, a function that opens each connection, for a custom transport. TLS still runs end to end with the server: with the default `verify-full` (or `require` without `sslrootcert`) it checks the certificate against the database's host name, so the proxy sees only encrypted traffic, cancel requests included. `verify-ca` does not check the host name, so it keeps the proxy out only with an `sslrootcert` CA that signs your database servers alone; `prefer`, `allow` and `disable` let a proxy read the traffic. A proxy that refuses the tunnel fails the open with `StorageUnavailableError` naming the proxy, without its credentials, and the `host:port` it refused, and the warning an open prints while it retries a proxy that cannot be reached names the proxy rather than the database server. If you already set `HTTPS_PROXY` (or Atomic's `httpProxy` setting) and reach a remote database directly, its connections now go through that proxy: add the database host to `NO_PROXY`, or set the `proxy` option to `"none"`, to keep them direct ([#5473](https://github.com/bastani-inc/atomic/issues/5473))
10
+
11
+ ### Fixed
12
+
13
+ - A URL that names no host, used with `PGHOST`, now gets the same default `sslmode=verify-full` as a URL naming that host when `PGHOST` is not this machine, instead of connecting without TLS. A URL that names this machine in another spelling, such as `127.1`, `localhost.` or `[::ffff:127.0.0.1]`, no longer gets a default `sslmode=verify-full`, which a local server without TLS refused: it is treated as this machine, like `localhost` and `127.0.0.1` ([#5473](https://github.com/bastani-inc/atomic/issues/5473))
14
+ - Wake-ups no longer turn off for the rest of the process when the check of the listening connection had to open a new pool connection that took longer than 2 seconds, as through a slow proxy or while a cloud identity issues its first token. The check now waits for its notification only once it was sent ([#5473](https://github.com/bastani-inc/atomic/issues/5473))
15
+ - Proxy tunnels no longer fail when the proxy sends an informational reply such as `103 Early Hints` before the final `200`. The 16 KiB header limit and 8-second timeout cover all replies together, not the database traffic that follows. A proxy whose connection ends right after a CR byte of its answer is reported as closed, which the open retries, instead of as an answer that is not HTTP, which it never retries. A CR inside a header field that no LF follows is read as a space, so the answer's final status decides. A CR in a status line is still refused, and a CR where `HTTP/` should start an answer is now refused at once instead of after the 8-second deadline ([#5565](https://github.com/bastani-inc/atomic/issues/5565), [#5670](https://github.com/bastani-inc/atomic/issues/5670))
16
+
5
17
  ## [0.9.90-alpha.1] - 2026-11-19
6
18
 
7
19
  ### Added
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bastani/atomic-storage-postgres
2
2
 
3
- A [PostgreSQL](https://www.postgresql.org) storage adapter for [Atomic](https://github.com/bastani-inc/atomic). It stores sessions, workflow journals, and Intercom multi-node routing in one shared PostgreSQL database, so several machines can use the same state. It is a separate package: install it only where you want Postgres storage.
3
+ A [PostgreSQL](https://www.postgresql.org) storage adapter for [Atomic](https://github.com/bastani-inc/atomic). It stores sessions and Intercom multi-node routing in one shared PostgreSQL database, so several machines can use the same state. It is a separate package: install it only where you want Postgres storage.
4
4
 
5
5
  ## Install
6
6
 
@@ -46,7 +46,7 @@ PostgreSQL 14 or newer is required. A URL that names no `sslmode` gets `sslmode=
46
46
 
47
47
  The adapter works through a transaction-mode connection pooler (PgBouncer, Supavisor, and the poolers of managed services): it sets nothing outside a transaction, takes no session locks, and uses no named prepared statements.
48
48
 
49
- Each process also keeps one connection outside the pool that `LISTEN`s for wake-ups (`notifications` on the opened database), so worker hosts and Intercom brokers find new work at once. A transaction-mode pooler does not deliver notifications to it: the adapter detects that with a probe and falls back to polling alone, unless `listenUrl` names the server's direct endpoint. Nothing is lost without wake-ups; work is found at the next poll. `atomic storage status` says which applies.
49
+ Each process also keeps one connection outside the pool that `LISTEN`s for wake-ups (`notifications` on the opened database), so Intercom brokers find new messages at once. A transaction-mode pooler does not deliver notifications to it: the adapter detects that with a probe and falls back to polling alone, unless `listenUrl` names the server's direct endpoint. Nothing is lost without wake-ups; work is found at the next poll. `atomic storage status` says which applies.
50
50
 
51
51
  A failure that passes, such as a refused or lost connection, a lock conflict (SQLSTATE `40001`, `40P01`, `55P03`) or a cancelled statement (`57014`), is reported as `StorageTransientError`, and a call that wrote nothing runs again. Refused credentials (`28P01`), a missing database (`3D000`) and a refused server certificate fail at once. A missing privilege (`42501`) fails at once with `StorageConfigError` reason `missing-privilege`, which names the privilege and the grant or `atomic storage migrate` that fixes it. The password is redacted from error messages and diagnostics. Add a `prefix` to the `storage` block to keep projects or teams apart in one database. See [Storage](../coding-agent/docs/storage.md) for selection precedence and the other storage options.
52
52
 
@@ -166,7 +166,7 @@ const database = await openPostgresDatabase({
166
166
  });
167
167
  ```
168
168
 
169
- `password` is a string or a function called for each new connection. The returned `SqliteDatabase` can be passed as SDK `sessionStore: { kind: "database", database }` or workflow `journal: { database }`.
169
+ `password` is a string or a function called for each new connection. The returned `SqliteDatabase` can be passed as SDK `sessionStore: { kind: "database", database }`.
170
170
 
171
171
  For a custom transport, pass `socket`, a function that opens a connection to `{ host, port }` and returns a stream (or a promise of one) that carries the PostgreSQL protocol there; the adapter negotiates TLS over it as over a socket. It is used instead of a proxy from the environment; passing it with `proxy` is refused with `StorageConfigError` reason `conflicting-transport`, and a socket directory is still reached directly. `{ host, port }` is the endpoint pg connects to: the URL's, else `PGHOST` and `PGPORT`.
172
172
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bastani/atomic-storage-postgres",
3
- "version": "0.9.90-alpha.1",
4
- "description": "PostgreSQL storage adapter for Atomic sessions, workflow journals, and Intercom.",
3
+ "version": "0.10.0-alpha.1",
4
+ "description": "PostgreSQL storage adapter for Atomic sessions and Intercom.",
5
5
  "contributors": [
6
6
  "Norin Lavaee",
7
7
  "Alex Lavaee"
package/postgres.d.ts CHANGED
@@ -19,7 +19,7 @@ export interface PostgresDatabaseOptions {
19
19
  statementTimeoutMs?: number;
20
20
  /**
21
21
  * A direct (session) endpoint for the connection that listens for wake-ups, when `url` goes through a transaction
22
- * pooler. Default `url`. Without notifications, worker hosts and Intercom brokers find work by polling alone.
22
+ * pooler. Default `url`. Without notifications, Intercom brokers find work by polling alone.
23
23
  */
24
24
  listenUrl?: string;
25
25
  /**