@creatornader/agent-bridge 0.3.1 → 0.5.0

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +222 -1
  2. package/README.md +312 -12
  3. package/ROADMAP.md +88 -7
  4. package/SECURITY.md +78 -5
  5. package/SKILL.md +108 -1
  6. package/dist/archive.d.ts +2 -2
  7. package/dist/archive.js +2 -2
  8. package/dist/{bridge-service-hX1ZQp4W.d.ts → bridge-service-CNBKdYXh.d.ts} +2 -1
  9. package/dist/{bridge-store-DPVSCwfs.d.ts → bridge-store-ByJ6CaJk.d.ts} +3 -0
  10. package/dist/bridge.d.ts +25 -8
  11. package/dist/bridge.js +19 -9
  12. package/dist/{chunk-MBPZXTJA.js → chunk-7VJI2MXI.js} +285 -42
  13. package/dist/chunk-7VJI2MXI.js.map +1 -0
  14. package/dist/{chunk-4VB44KJU.js → chunk-AWE3DFZV.js} +3 -2
  15. package/dist/chunk-AWE3DFZV.js.map +1 -0
  16. package/dist/{chunk-GADH244D.js → chunk-E4OWHGUE.js} +16 -5
  17. package/dist/chunk-E4OWHGUE.js.map +1 -0
  18. package/dist/{chunk-NCO7RLBM.js → chunk-GTK4KOED.js} +108 -8
  19. package/dist/chunk-GTK4KOED.js.map +1 -0
  20. package/dist/{chunk-SPSMZOCJ.js → chunk-HUHG7XTB.js} +6 -5
  21. package/dist/chunk-HUHG7XTB.js.map +1 -0
  22. package/dist/{chunk-5GMB3A77.js → chunk-IVG4XWWS.js} +26 -14
  23. package/dist/chunk-IVG4XWWS.js.map +1 -0
  24. package/dist/{chunk-WAI2IYIQ.js → chunk-P635FAN4.js} +50 -7
  25. package/dist/chunk-P635FAN4.js.map +1 -0
  26. package/dist/{chunk-45BZGB77.js → chunk-QNXHDOJ5.js} +218 -24
  27. package/dist/chunk-QNXHDOJ5.js.map +1 -0
  28. package/dist/{chunk-UAHMP6GC.js → chunk-QPC6JHA3.js} +10 -7
  29. package/dist/chunk-QPC6JHA3.js.map +1 -0
  30. package/dist/{chunk-Q6PPMXJC.js → chunk-SN7PIVDF.js} +377 -21
  31. package/dist/chunk-SN7PIVDF.js.map +1 -0
  32. package/dist/{chunk-A6W4QALF.js → chunk-TC6A7GMF.js} +2 -2
  33. package/dist/{chunk-2DFNOLMO.js → chunk-XDNT6ZNZ.js} +9 -6
  34. package/dist/chunk-XDNT6ZNZ.js.map +1 -0
  35. package/dist/{chunk-CEXBMOI5.js → chunk-Z6JP6MYD.js} +2 -2
  36. package/dist/cli.js +5867 -438
  37. package/dist/cli.js.map +1 -1
  38. package/dist/client-runtime.d.ts +4 -2
  39. package/dist/client-runtime.js +7 -7
  40. package/dist/contracts/generate.js +1 -1
  41. package/dist/dr.d.ts +9 -2
  42. package/dist/dr.js +6 -4
  43. package/dist/{gateway-CggQ8vTC.d.ts → gateway-CW-61lvs.d.ts} +27 -3
  44. package/dist/gateway-main.js +71 -7
  45. package/dist/gateway-main.js.map +1 -1
  46. package/dist/gateway.d.ts +3 -3
  47. package/dist/gateway.js +3 -3
  48. package/dist/index.js +8 -8
  49. package/dist/{postgres-bridge-store-Bfd3hRId.d.ts → postgres-bridge-store-C9KG9Z69.d.ts} +1 -1
  50. package/dist/postgres-production-preflight.d.ts +32 -0
  51. package/dist/postgres-production-preflight.js +249 -0
  52. package/dist/postgres-production-preflight.js.map +1 -0
  53. package/dist/server.js +8 -8
  54. package/dist/sqlite-edge-store-CdMIOrho.d.ts +148 -0
  55. package/dist/sqlite.d.ts +19 -80
  56. package/dist/sqlite.js +11 -3
  57. package/docs/architecture-v2.md +292 -15
  58. package/docs/decisions/0004-client-lifecycle-and-endpoint-migration.md +204 -0
  59. package/docs/deployment.md +349 -0
  60. package/docs/troubleshooting.md +23 -0
  61. package/llms.txt +69 -1
  62. package/openapi/agent-bridge-v2.openapi.json +1151 -124
  63. package/package.json +10 -2
  64. package/schemas/agent-bridge-v2.capabilities.json +26 -1
  65. package/schemas/agent-bridge-v2.mcp.json +11 -1
  66. package/schemas/agent-bridge-v2.schema.json +167 -0
  67. package/sql/migrations/007_runtime_role.sql +8 -4
  68. package/sql/migrations/013_row_isolation.sql +71 -8
  69. package/sql/migrations/014_owner_control_plane.sql +124 -31
  70. package/sql/migrations/015_portable_archives.sql +143 -41
  71. package/sql/migrations/016_native_dr_fence.sql +102 -35
  72. package/sql/migrations/017_gateway_authority_binding.sql +99 -0
  73. package/sql/migrations/018_endpoint_migration_challenges.sql +1054 -0
  74. package/sql/migrations/019_endpoint_migration_same_successor.sql +348 -0
  75. package/sql/migrations/020_managed_authority_compat.sql +698 -0
  76. package/sql/migrations/021_native_backup_reader.sql +421 -0
  77. package/sql/setup.sql +1 -3
  78. package/dist/chunk-2DFNOLMO.js.map +0 -1
  79. package/dist/chunk-45BZGB77.js.map +0 -1
  80. package/dist/chunk-4VB44KJU.js.map +0 -1
  81. package/dist/chunk-5GMB3A77.js.map +0 -1
  82. package/dist/chunk-GADH244D.js.map +0 -1
  83. package/dist/chunk-MBPZXTJA.js.map +0 -1
  84. package/dist/chunk-NCO7RLBM.js.map +0 -1
  85. package/dist/chunk-Q6PPMXJC.js.map +0 -1
  86. package/dist/chunk-SPSMZOCJ.js.map +0 -1
  87. package/dist/chunk-UAHMP6GC.js.map +0 -1
  88. package/dist/chunk-WAI2IYIQ.js.map +0 -1
  89. /package/dist/{chunk-A6W4QALF.js.map → chunk-TC6A7GMF.js.map} +0 -0
  90. /package/dist/{chunk-CEXBMOI5.js.map → chunk-Z6JP6MYD.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,225 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.5.0] - 2026-07-20
10
+
11
+ ### Added
12
+
13
+ - Add migration 020 to converge databases released through migration 019 on the managed-authority
14
+ function and attestation contract. Migration readiness accepts only the exact
15
+ released checksums or the current checksums for changed migrations, so existing
16
+ databases can advance without allowing arbitrary ledger drift.
17
+
18
+ - Add migration 021 with an attested, database-derived backup-reader role. The role is
19
+ `NOLOGIN`, receives read-only access to Agent Bridge tables and sequences, and is
20
+ granted only to the schema owner so managed PostgreSQL can produce complete native
21
+ backups without exposing backup access to runtime or control principals. Migrations
22
+ accept `CREATEROLE`, while source native backups require a true superuser or
23
+ `BYPASSRLS`. A restore target superuser can validate a suspended restored schema owner.
24
+
25
+ - Add a PostgreSQL 15 through 18 integration path that applies every migration as a
26
+ non-superuser with `CREATEROLE` and `BYPASSRLS`, matching the authority available on
27
+ managed providers such as Supabase.
28
+
29
+ - Add a read-only production PostgreSQL preflight. It rejects unsupported server
30
+ majors, insufficient migration authority, migration-ledger drift, derived-role
31
+ collisions, and incompatible legacy import tables before any schema change runs.
32
+ It reports migration authority separately from native DR authority. Reports omit
33
+ connection URLs and database identities.
34
+
35
+ - Add a manual production proof workflow for an existing Agent Bridge gateway. It
36
+ uses separate sender, receiver, Fly machine-cycle, and verifier jobs behind the
37
+ `agent-bridge-production-proof` environment. A versioned, phase-specific receipt
38
+ contract records offline queue replay, exact idempotency, cross-host claim and
39
+ acknowledgment, a changed Fly runtime instance ID, and fresh-edge verification without
40
+ storing credentials, message content, database URLs, or SQLite files.
41
+ - Add an optional `messageId` filter to HTTP 2.1, MCP, and CLI delivery claims. It
42
+ atomically selects and maintains only that eligible recipient delivery. Omitting the
43
+ filter preserves claim-next behavior, and HTTP 2.0 rejects the new field.
44
+
45
+ - Add a maintained Fly.io reference config with one always-running shared VM, HTTPS
46
+ ingress, `/readyz` checks, and a 30-second SIGTERM budget. Add a read-only preflight
47
+ that checks the local contract and, when an app is supplied, reports value-safe Fly
48
+ account and app observations. The deployment docs keep migration, restricted-runtime
49
+ bootstrap, secret changes, deployment, and cross-machine proof behind operator gates.
50
+
51
+ ### Fixed
52
+
53
+ - Support managed PostgreSQL role administration without restating protected role
54
+ attributes. PostgreSQL 16 and newer may split one schema-owner membership across an
55
+ administrator grant and a separate inherit-and-set grant. Readiness and native DR
56
+ now validate and preserve the effective authority while rejecting unexpected grant
57
+ shapes. Ownership transfers receive schema `CREATE` only for the transaction that
58
+ needs it, and runtime bootstrap verifies an existing login before changing its
59
+ password or membership.
60
+
61
+ - Make runtime bootstrap transactional and reject derived authority names, object
62
+ owners, unexpected memberships, and reverse membership edges before changing an
63
+ existing login.
64
+
65
+ - Suspend restored runtime, control, and archive principals as `NOLOGIN` roles without
66
+ authority memberships. Control and archive registration histories receive explicit
67
+ revocation events. Restore may reuse one preexisting role only when it is the source
68
+ schema owner, the target session user, and a true superuser.
69
+
70
+ - Resolve the Fly Dockerfile from the deployment config directory and reject missing
71
+ configured build files during the production preflight.
72
+
73
+ - Check the client TLS socket during the production PostgreSQL preflight when a
74
+ session pooler terminates TLS before opening its database connection.
75
+
76
+ - Fix the legacy Supabase setup script's column comment so PostgreSQL accepts the
77
+ checked-in schema without manual editing. The PostgreSQL integration suite now runs
78
+ that script before testing the v2 legacy import.
79
+
80
+ ## [0.4.0] - 2026-07-19
81
+
82
+ ### Added
83
+
84
+ - Add v6 managed-client endpoint cutover and finalization commands. A
85
+ committed v5 stage authorizes a credential-free v6 journal only after both live
86
+ gateways negotiate HTTP 2.1, bind the recorded principal and credential IDs, report
87
+ one immutable authority ID, and complete a route challenge. Cutover drains the
88
+ source edge under an exclusive lease before changing a host registration. The initial
89
+ proof uses the predecessor and successor. Once a journal exists, every proof and
90
+ replay uses the successor credential at both URLs, then drains the source edge
91
+ through the target gateway. Finalization retires the source only after the
92
+ predecessor grace cutoff. Dry runs inspect edge state without opening SQLite for
93
+ write access or contacting a gateway. Resume classifies durable before and after
94
+ proofs and cannot take over a live lease.
95
+
96
+ - Add migration 019 for successor-only endpoint-migration challenges. A challenge now
97
+ accepts either a direct predecessor-to-successor pair or the same active successor
98
+ credential on both endpoints. The migration preserves the migration 018 challenge
99
+ records and readiness controls, adds v2 endpoint and v6 owner attestations, and does
100
+ not grant cutover authority. Authenticated HTTP 2.1 capabilities now return the
101
+ credential's `grantedScopes`.
102
+
103
+ - Add migration 017 with an immutable PostgreSQL gateway authority UUID. Production
104
+ request authority now uses a bound opener without changing the released opener's
105
+ return shape. Authenticated gateway status adds optional `gatewayAuthorityId` and
106
+ `credentialId` fields under HTTP 2.1. Native DR preserves the UUID as logical
107
+ authority continuity, not live-clone fencing. Deployments must drain old gateway
108
+ instances before the migration.
109
+
110
+ - Add `clients migrate stage <runtime>` for inert gateway-client migration
111
+ preparation. The command probes the active and successor bearer credentials, records
112
+ enrollment credential IDs and credential-free source and target bindings, and
113
+ prepares a private successor backend without changing the active registration or
114
+ backend. It does not authorize cutover. The source SQLite edge gate prevents new
115
+ outbox inserts once a later drain starts, including from a client that opened the
116
+ database before the gate changed. Staging requires an absolute, normalized source
117
+ edge database path and rejects in-memory edge state.
118
+
119
+ - Add explicit, plan-first `clients rollback <update-operation-id> --identity <name>`
120
+ for committed same-host v4 updates. `--apply` creates a separate reverse journal.
121
+ It verifies the source inverse contract and current forward metadata and
122
+ registration before it removes the forward native entry, restores the prior entry,
123
+ and writes prior metadata last. Claude Desktop replaces only its Agent Bridge entry.
124
+ Generic `clients resume` also resumes a reverse journal. The v4 source completion
125
+ keeps only a bounded credential-free inverse contract. Repair remains monotonic and
126
+ uninstall stays forward-only. Managed operation summaries preserve the durable
127
+ manifest version and include the `rollback` kind.
128
+
129
+ - Add forward-only `clients uninstall` for metadata-owned Codex, Claude Code, and
130
+ Claude Desktop registrations. Uninstall proves and removes the managed
131
+ registration, deletes an already private backend file, then deletes management
132
+ metadata. It never snapshots backend bytes or reverses a completed step. POSIX
133
+ deletion syncs the private parent directory. Windows verifies deletion and records
134
+ unavailable directory durability. Native and Desktop writes retain their documented
135
+ same-user advisory race boundaries.
136
+ Add `clients resume <operation-id> [--recover-lock]`, which derives repair and
137
+ uninstall authority from recorded v3 requests, and update or rollback authority
138
+ from recorded v4 requests. It also accepts pre-v4 update journals. It accepts no
139
+ replacement identity, runtime, instance, launch, or file locator. Version 2
140
+ journals remain inspectable only. Generic resume also completes an uninstall
141
+ interrupted after its final metadata deletion.
142
+
143
+ - Add plan-first `clients repair` and `clients update` for metadata-owned Codex,
144
+ Claude Code, and Claude Desktop registrations. Runtime and stable instance locate
145
+ strict owner-private metadata. Identity binds the record and immutable repair or
146
+ update request. Repair restores the stored launch contract, while update journals a
147
+ normalized credential-free launch request.
148
+ Applied native changes prove remove, absence, add, and exact target before a
149
+ metadata-last launch update. Desktop replaces only the Agent Bridge entry and
150
+ preserves unrelated JSON values. Backend privacy repair records only policy proofs
151
+ and tightens permissions without reading or snapshotting backend content. Full
152
+ metadata and bounded registration proofs prevent drifted state from advancing a
153
+ prior journal. Unknown environment keys and unsafe registration fields stop before
154
+ journal creation. Native update commands reject argument, credential, and URL-like
155
+ surfaces. Desktop publication uses a private operation-scoped temporary file and
156
+ detects the checked races that Node can observe, but it cannot provide an OS
157
+ transaction with Claude Desktop. Same-action same-host resume and stale-lock recovery
158
+ use the existing operation substrate.
159
+ New journals use operation format version 3. Version 2 journals remain inspectable,
160
+ but incomplete records cannot resume without an identity-bound request.
161
+
162
+ - Give local and edge SQLite initialization a 15-second minimum busy-retry window
163
+ for concurrent first-start schema work. Normal database operations retain their
164
+ configured timeout. Concurrency tests also terminate hung child processes before
165
+ temporary-directory cleanup.
166
+
167
+ - Add the crash-safe managed-client operation substrate and read-only `clients
168
+ operations [<operation-id>]` inspection. Owner-private revisioned manifests,
169
+ immutable ordered step plans, snapshot artifacts, pinned directory identities,
170
+ per-client locks, and same-host stale-lock proof keep private contents out of JSON
171
+ and errors. Restart classification distinguishes exact before-state retries,
172
+ verified after-state advancement, and blocked ambiguity. Snapshot publication never
173
+ replaces residue, every step requires a verified before-state snapshot, and bounded
174
+ manifests reject contradictory state. Typed credential-agnostic requests,
175
+ no-replace before/after artifacts, lock-covered begin, and same-host resume now feed
176
+ distinct resumable, classification-required, blocked, and complete inspection.
177
+ Crash-restartable per-artifact cleanup advances `applied` through `cleaning` to a
178
+ `committed` manifest after verified unlink and POSIX directory sync, or an explicit
179
+ Windows unavailable-durability result. Exact after-publication and post-intent unlink
180
+ residue can resume; every other missing or extra artifact blocks. Terminal manifests
181
+ retain a bounded credential-free completion record. Windows mutations reuse native
182
+ ACL results only within one held lock and for the same verified directory path
183
+ identity. File checks, new or resumed locks, and passive inspection recheck the
184
+ policy. POSIX checks remain per-access. Repair, update, and uninstall use this substrate.
185
+
186
+ - Add read-only `clients inspect` and plan-first `clients adopt` for Codex, Claude
187
+ Code, and Claude Desktop. Exact unmanaged registrations can be adopted only with
188
+ `--apply`, which writes owner-only credential-free management metadata. Inspection
189
+ reports absent, unmanaged, managed, or drifted state without reading backend values
190
+ or contacting a gateway. Registration comparison is structural and health-neutral,
191
+ backend paths enforce the owner-only no-link policy, Desktop inspection shares the
192
+ installer launch resolver, and apply re-inspects its postcondition. Enrollment-based
193
+ provision collision behavior is unchanged. Managed metadata also binds Desktop to
194
+ its normalized config path, Codex to its active profile config, and Claude Code
195
+ local or project scope to its invocation directory so later operations cannot guess
196
+ at a registration target.
197
+
198
+ - Add a pinned, non-root gateway image and a loopback-only Compose development stack.
199
+ The stack runs migrations separately, creates a restricted runtime login, reads
200
+ database passwords from private secret files, and retains PostgreSQL data in a named
201
+ volume.
202
+ - Add a Linux Compose acceptance test for credential-bound identity, targeted delivery,
203
+ lease settlement, denied runtime access to credential hashes, and PostgreSQL
204
+ persistence across a full stack restart.
205
+ - Add a deployment guide for production TLS, network isolation, secret handling,
206
+ backup, upgrade order, and rollback.
207
+
208
+ ### Fixed
209
+
210
+ - Defer Windows SQLite sidecar ACL application until the opened connection establishes
211
+ WAL and completes its serialized schema transaction. Concurrent first-open processes
212
+ no longer race a transient sidecar before their own connection holds it. Replacement
213
+ during one ACL validation still fails.
214
+ - Treat a Windows SQLite sidecar that disappears during ACL validation as an expected
215
+ race only when the path remains absent. A replacement or reparse object still fails
216
+ validation.
217
+ - Handle `-h` and `--help` before command parsing and dispatch so help never opens a
218
+ backend or performs a command side effect.
219
+
220
+ ### Changed
221
+
222
+ - Require the exact release commit to pass the full `test.yml` matrix on `main` before
223
+ release packaging begins. Pin GitHub Actions and reusable workflows to verified
224
+ commit SHAs.
225
+ - Keep Dependabot's grouped npm updates to patch and minor versions. Major updates now
226
+ require separate review.
227
+
9
228
  ## [0.3.1] - 2026-07-15
10
229
 
11
230
  ### Added
@@ -136,7 +355,9 @@ First tagged release. Marks the point where agent-bridge has shipped its initial
136
355
  - Narrative-leak detection in CI + on commit via `creatornader/textleaks@v0.2.0` (renamed from leakguard).
137
356
 
138
357
  [0.1.0]: https://github.com/creatornader/agent-bridge/releases/tag/v0.1.0
139
- [Unreleased]: https://github.com/creatornader/agent-bridge/compare/v0.3.1...HEAD
358
+ [Unreleased]: https://github.com/creatornader/agent-bridge/compare/v0.5.0...HEAD
359
+ [0.5.0]: https://github.com/creatornader/agent-bridge/compare/v0.4.0...v0.5.0
360
+ [0.4.0]: https://github.com/creatornader/agent-bridge/compare/v0.3.1...v0.4.0
140
361
  [0.3.1]: https://github.com/creatornader/agent-bridge/compare/v0.3.0...v0.3.1
141
362
  [0.3.0]: https://github.com/creatornader/agent-bridge/compare/v0.2.0...v0.3.0
142
363
  [0.2.0]: https://github.com/creatornader/agent-bridge/compare/v0.1.0...v0.2.0