@creatornader/agent-bridge 0.3.0 → 0.4.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 (75) hide show
  1. package/CHANGELOG.md +174 -5
  2. package/README.md +341 -33
  3. package/ROADMAP.md +78 -16
  4. package/SECURITY.md +68 -1
  5. package/SKILL.md +104 -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-YTjGr91A.d.ts} +1 -1
  9. package/dist/{bridge-store-DPVSCwfs.d.ts → bridge-store-Boaj-ZbO.d.ts} +2 -0
  10. package/dist/bridge.d.ts +17 -7
  11. package/dist/bridge.js +15 -7
  12. package/dist/{chunk-WAI2IYIQ.js → chunk-3YHVUPU2.js} +48 -5
  13. package/dist/chunk-3YHVUPU2.js.map +1 -0
  14. package/dist/{chunk-45BZGB77.js → chunk-6BTJE6D4.js} +168 -7
  15. package/dist/chunk-6BTJE6D4.js.map +1 -0
  16. package/dist/{chunk-5GMB3A77.js → chunk-DQOZJJZ2.js} +22 -10
  17. package/dist/chunk-DQOZJJZ2.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-GADH244D.js → chunk-IHZFI7TH.js} +12 -4
  21. package/dist/chunk-IHZFI7TH.js.map +1 -0
  22. package/dist/{chunk-CEXBMOI5.js → chunk-LAHNQZDN.js} +2 -2
  23. package/dist/{chunk-UAHMP6GC.js → chunk-MCKKVNCE.js} +9 -6
  24. package/dist/chunk-MCKKVNCE.js.map +1 -0
  25. package/dist/{chunk-MBPZXTJA.js → chunk-PDIHDBP3.js} +173 -20
  26. package/dist/chunk-PDIHDBP3.js.map +1 -0
  27. package/dist/{chunk-Q6PPMXJC.js → chunk-SV3SVBYS.js} +377 -21
  28. package/dist/chunk-SV3SVBYS.js.map +1 -0
  29. package/dist/{chunk-SPSMZOCJ.js → chunk-SYGONYMM.js} +4 -4
  30. package/dist/{chunk-A6W4QALF.js → chunk-TC6A7GMF.js} +2 -2
  31. package/dist/cli.js +5856 -413
  32. package/dist/cli.js.map +1 -1
  33. package/dist/client-runtime.d.ts +4 -2
  34. package/dist/client-runtime.js +6 -6
  35. package/dist/contracts/generate.js +1 -1
  36. package/dist/dr.d.ts +9 -2
  37. package/dist/dr.js +6 -4
  38. package/dist/{gateway-CggQ8vTC.d.ts → gateway-BQHpV-MZ.d.ts} +27 -3
  39. package/dist/gateway-main.js +69 -5
  40. package/dist/gateway-main.js.map +1 -1
  41. package/dist/gateway.d.ts +3 -3
  42. package/dist/gateway.js +2 -2
  43. package/dist/index.js +7 -7
  44. package/dist/{postgres-bridge-store-Bfd3hRId.d.ts → postgres-bridge-store-WASumj26.d.ts} +1 -1
  45. package/dist/server.js +7 -7
  46. package/dist/sqlite-edge-store-Bc15DvpX.d.ts +148 -0
  47. package/dist/sqlite.d.ts +19 -80
  48. package/dist/sqlite.js +11 -3
  49. package/docs/architecture-v2.md +278 -13
  50. package/docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md +2 -2
  51. package/docs/decisions/0003-host-adapters-and-consumer-instance-keys.md +88 -0
  52. package/docs/decisions/0004-client-lifecycle-and-endpoint-migration.md +204 -0
  53. package/docs/deployment.md +205 -0
  54. package/docs/ecosystem.md +35 -3
  55. package/docs/troubleshooting.md +23 -0
  56. package/llms.txt +79 -3
  57. package/openapi/agent-bridge-v2.openapi.json +1023 -0
  58. package/package.json +6 -2
  59. package/schemas/agent-bridge-v2.capabilities.json +24 -0
  60. package/schemas/agent-bridge-v2.mcp.json +6 -0
  61. package/schemas/agent-bridge-v2.schema.json +163 -0
  62. package/sql/migrations/017_gateway_authority_binding.sql +99 -0
  63. package/sql/migrations/018_endpoint_migration_challenges.sql +1028 -0
  64. package/sql/migrations/019_endpoint_migration_same_successor.sql +324 -0
  65. package/dist/chunk-45BZGB77.js.map +0 -1
  66. package/dist/chunk-5GMB3A77.js.map +0 -1
  67. package/dist/chunk-GADH244D.js.map +0 -1
  68. package/dist/chunk-MBPZXTJA.js.map +0 -1
  69. package/dist/chunk-NCO7RLBM.js.map +0 -1
  70. package/dist/chunk-Q6PPMXJC.js.map +0 -1
  71. package/dist/chunk-UAHMP6GC.js.map +0 -1
  72. package/dist/chunk-WAI2IYIQ.js.map +0 -1
  73. /package/dist/{chunk-CEXBMOI5.js.map → chunk-LAHNQZDN.js.map} +0 -0
  74. /package/dist/{chunk-SPSMZOCJ.js.map → chunk-SYGONYMM.js.map} +0 -0
  75. /package/dist/{chunk-A6W4QALF.js.map → chunk-TC6A7GMF.js.map} +0 -0
package/llms.txt CHANGED
@@ -11,11 +11,20 @@ History uses mailbox `inbox` (default), `sent`, or `all`. Receipt state is `any`
11
11
  - `npm install --global @creatornader/agent-bridge`
12
12
  - `agent-bridge init --provider local`
13
13
  - `agent-bridge demo`
14
+ - Development gateway: create `.secrets/postgres_password` and
15
+ `.secrets/runtime_password`, then run `docker compose up --build --wait gateway`.
16
+ Both checked-in port bindings are loopback-only. See `docs/deployment.md` before a
17
+ non-loopback deployment.
14
18
 
15
19
  If an MCP client cannot attach, run `agent-bridge doctor --json` and see
16
20
  `docs/troubleshooting.md`. Normal client installation resolves the MCP launch command;
17
21
  do not copy another runtime's identity or backend file.
18
22
 
23
+ The `codex` host adapter configures the profile shared by the Codex CLI and the Codex
24
+ surface in the ChatGPT desktop app. Claude Code and Claude Desktop use separate
25
+ adapters. OpenClaw and generic MCP manifests are operator-managed. Scripts and
26
+ services can call the CLI or HTTPS API or embed the Node library without a host adapter.
27
+
19
28
  ## Modes
20
29
 
21
30
  - local: SQLite WAL, no account or daemon
@@ -24,6 +33,8 @@ do not copy another runtime's identity or backend file.
24
33
 
25
34
  ## Commands
26
35
 
36
+ - `agent-bridge --version` or `agent-bridge -V`: print the installed package version without loading backend configuration.
37
+ - `agent-bridge --help`, `agent-bridge -h`, or a command followed by either help flag: print help without loading backend configuration or dispatching the command.
27
38
  - `agent-bridge capabilities`: print the canonical v2 operation and protocol capability document.
28
39
 
29
40
  - agent-bridge init --provider local
@@ -35,11 +46,49 @@ do not copy another runtime's identity or backend file.
35
46
  - agent-bridge claim, extend, ack, nack, deliveries, delivery-events, cancel, requeue
36
47
  - agent-bridge sync, watch, join, presence
37
48
  - agent-bridge clients install <runtime> --identity <principal>
49
+ - agent-bridge clients inspect <runtime> --identity <principal> --instance <stable-key> --backend-config <absolute path>
50
+ - agent-bridge clients adopt <runtime> --identity <principal> --instance <stable-key> --backend-config <absolute path> [--apply]
51
+ - agent-bridge clients repair <runtime> --identity <principal> --instance <stable-key> [--apply] [--resume <uuid>] [--recover-lock]
52
+ - agent-bridge clients update <runtime> --identity <principal> --instance <stable-key> [--command <command>] [--apply] [--resume <uuid>] [--recover-lock]
53
+ - agent-bridge clients uninstall <runtime> --identity <principal> --instance <stable-key> [--apply] [--resume <uuid>] [--recover-lock]
54
+ - agent-bridge clients rollback <update-operation-id> --identity <principal> [--apply] [--recover-lock]
55
+ - agent-bridge clients migrate stage <runtime> --identity <principal> --instance <stable-key> --enrollment-file <private-path> [--apply] [--recover-lock]
56
+ - agent-bridge clients migrate cutover <stage-operation-id> --exclusive-edge [--apply] [--recover-lock]
57
+ - agent-bridge clients migrate finalize <cutover-operation-id> --exclusive-edge [--apply] [--recover-lock]
58
+ - agent-bridge clients resume <operation-id> [--recover-lock] # resumes recorded v3, supported v4, v5 stage, or v6 migration authority
59
+ - agent-bridge clients operations [<operation-id>] # read-only resumable/classification-required/blocked/complete summaries
38
60
  - agent-bridge owner provision|inventory|rotate|revoke
39
61
  - agent-bridge clients install <runtime> --enrollment-file <private path>
40
62
  - agent-bridge archive export|verify|import
41
63
  - agent-bridge dr backup|verify|restore
42
64
 
65
+ Client inspection is local, read-only, secret-free, and reports absent, unmanaged,
66
+ managed, or drifted. Adoption is a plan unless `--apply` is explicit. It writes only
67
+ owner-private credential-free management metadata after the identity, stable instance,
68
+ backend path, scope, and launch contract match exactly; it never rewrites the host
69
+ registration or backend file. Enrollment-based first-time provisioning continues to
70
+ refuse registration and backend-file collisions. Metadata binds Desktop to its
71
+ normalized config path and Codex to its active profile config. Claude Code local and
72
+ project scope bind to the invocation directory because its native CLI exposes no
73
+ stronger registration target.
74
+ The backend and its immediate parent must pass the owner-only no-link policy. Codex
75
+ registration comparison ignores diagnostic fields and JSON property order but requires
76
+ exactly AGENT_BRIDGE_AGENT, AGENT_BRIDGE_INSTANCE, and AGENT_BRIDGE_CONFIG. Claude Code
77
+ connectivity status is not registration state. Desktop inspection uses the installer's
78
+ validated absolute launch resolver, and applied adoption re-inspects its postcondition.
79
+ Only Claude Code accepts `--scope`; only Claude Desktop accepts `--config-path` for
80
+ inspect and adopt. Repair, update, and uninstall derive those locators from strict managed metadata.
81
+ They reject backend, scope, and config-path authority flags. `--identity` binds the
82
+ metadata record and immutable request. Repair restores the recorded launch contract.
83
+ Update records a normalized credential-free launch request, including only fixed Agent
84
+ Bridge environment key names. Native commands are one executable contract and reject
85
+ arguments, URL-like selectors, and credential surfaces. Plan-only calls create no lock
86
+ or operation. Native changes prove remove then add. Desktop replaces only the Agent
87
+ Bridge config entry through a private operation-scoped temporary file. Its same-user
88
+ writer race is advisory because Node cannot provide an OS transaction. Resume requires
89
+ the same action and managed identity. Lock recovery requires
90
+ same-host process-death proof.
91
+
43
92
  Archive export moves one workspace's immutable messages and read receipts between
44
93
  canonical local SQLite and PostgreSQL stores. Import defaults to a rollback-backed dry
45
94
  run and requires `--apply` to commit. PostgreSQL archive authority comes only from
@@ -69,11 +118,16 @@ excludes transient request, rate-limit, instance, and archive-authorization rows
69
118
  normalizes claimed deliveries on restore. Never run source and restored target at the
70
119
  same time. The package API is @creatornader/agent-bridge/dr. Bundle hashes detect
71
120
  changed bytes but do not encrypt or authenticate the source.
121
+ The immutable PostgreSQL gateway authority UUID is preserved by native DR. It identifies
122
+ one logical authority across restore but does not fence a live clone.
72
123
 
73
124
  ## MCP tools
74
125
 
75
126
  - `capabilities`: return operations, required scopes, provider-specific enforcement, and supported protocol versions. Gateway access needs an active credential but no named scope for this operation.
76
127
  - Production gateway capabilities report `requestAuthority: true` and `rowIsolation: true` only after the migration and live catalog, role, policy, privilege, and function checks pass. PostgreSQL forces RLS on messages, receipts, deliveries, delivery events, and presence. Lease transitions and target-to-delivery membership remain service-enforced.
128
+ - Authenticated gateway `/v2/status` returns optional `gatewayAuthorityId` and
129
+ `credentialId` fields when PostgreSQL request authority is active. They are additive
130
+ in HTTP 2.1 and do not appear in capabilities.
77
131
 
78
132
  Compatibility: post_context, get_context, ack_context.
79
133
  Reliable messaging: send, history, claim, extend, acknowledge, negative_acknowledge, heartbeat, presence, sync.
@@ -84,7 +138,9 @@ Gateway MCP clients sync automatically and expose manual sync for bounded outbox
84
138
  ## Protocol boundary
85
139
 
86
140
  A2A and application task semantics sit above Agent Bridge.
87
- MCP, CLI, and HTTPS are client access surfaces.
141
+ MCP, CLI, HTTPS, and the Node library are access surfaces.
142
+ Harnesses, host applications, host adapters, and access surfaces are separate layers.
143
+ The MCP server uses stdio. The gateway HTTPS API is not MCP over HTTP.
88
144
  Optional transports such as SLIM or NATS may sit below the core.
89
145
  agmsg is a reference for adapters, interoperability, and client experience.
90
146
  HTTP protocol 2.1 is current. Upgraded gateways continue to serve released headerless and explicit 2.0 clients. New 2.1 clients probe before mutation and proceed only after complete, consistent negotiation selects and advertises 2.1. They reject headerless or selected 2.0 gateways instead of downgrading. Upgrade the gateway before 2.1 clients. Capabilities distinguish current, selected, and supported versions.
@@ -100,7 +156,7 @@ Lease extension does not report progress or external task completion.
100
156
 
101
157
  ## Identity rule
102
158
 
103
- The active runtime supplies AGENT_BRIDGE_AGENT and AGENT_BRIDGE_INSTANCE. Do not hardcode another client name and do not store agent identity in the shared backend config. Gateway installations use a separate principal-bound token and owner-only backend file for each client.
159
+ The active client supplies AGENT_BRIDGE_AGENT and may supply a stable AGENT_BRIDGE_INSTANCE consumer key. Do not hardcode another client name and do not store agent identity in the shared backend config. Gateway installations use a separate principal-bound token and owner-only backend file for each client. Supported installers generate and persist the instance key; direct clients may do so when they need separate consumer state or presence. The gateway does not bind it to an installer registration. It is not a PID, unique live process, session, or thread. Unless AGENT_BRIDGE_CURSOR is explicit, processes that share one key also share its cursor path. They also share delivery lease ownership and instance-keyed presence. Without a key or explicit cursor path, cursor storage uses `default`. Leases use the principal, and presence is unavailable.
104
160
 
105
161
  Owner commands are offline and use only AGENT_BRIDGE_OPERATOR_DATABASE_URL. They are
106
162
  not MCP, HTTP, or public gateway operations. Provision and rotation write private
@@ -114,6 +170,24 @@ workspace, and live MCP registration matches. Consumed-file deletion and lock re
114
170
  report retained, missing, durable, and durability-unknown outcomes without claiming that
115
171
  an unlinked path was retained.
116
172
 
173
+ `clients migrate stage` is a plan-first gateway migration preparation command. An
174
+ applied stage creates an owner-private successor backend and credential-free operation
175
+ record. It leaves the active registration, active backend, and source edge scope
176
+ active after initializing its gate. Staging requires an absolute, normalized source
177
+ edge database path and rejects `:memory:`.
178
+
179
+ `clients migrate cutover` requires a committed v5 stage and `--exclusive-edge`. Initial
180
+ preflight checks exact HTTP 2.1 status bindings at both gateways, one immutable
181
+ authority ID, the successor's `status:read` and `messages:write` grants, and a direct
182
+ predecessor-to-successor route challenge. Once it creates the journal, it uses a
183
+ retained normalized source URL and the successor credential for every route proof and
184
+ source outbox replay through the target gateway. `finalize` requires a fresh assertion
185
+ after grace expires and retires the source. To return to a former endpoint, rotate a
186
+ new owner credential and run an ordinary forward cutover to that endpoint. Dry runs
187
+ read private edge state without SQLite writes or gateway requests. They refuse live WAL
188
+ sidecars rather than read uncheckpointed outbox state. Resume uses only the retained v6
189
+ request and waits for an unexpired drain lease instead of taking it over.
190
+
117
191
  Project is an optional immutable message label, not a tenant or identity selector. Omitted project reads include labeled and unlabeled messages. Exact project filters are supported by CLI, MCP, HTTP, and stores. Gateway workspace assertions must match the bound credential before network access.
118
192
  Local CLI calls may override workspace for one invocation. The legacy Supabase schema is global and always reports workspace `*`; use project labels for legacy filtering.
119
193
 
@@ -124,8 +198,10 @@ Local CLI calls may override workspace for one invocation. The legacy Supabase s
124
198
  - SECURITY.md: reporting process and security boundaries
125
199
  - docs/ecosystem.md: relationship to adjacent protocols, brokers, and runtimes
126
200
  - docs/troubleshooting.md: MCP startup and client recovery
201
+ - docs/deployment.md: Compose development stack and production deployment constraints
127
202
  - docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md: protocol layers and acknowledgment semantics
128
203
  - docs/decisions/0002-canonical-operation-contract-registry.md: generated contracts and version negotiation
204
+ - docs/decisions/0003-host-adapters-and-consumer-instance-keys.md: host layers and instance-key semantics
129
205
  - docs/architecture-v2.md: protocol, storage, identity, delivery, and acceptance decisions
130
- - clients/*.json: runtime adapter manifests
206
+ - clients/*.json: v1 host-adapter manifests; `runtime` is the compatibility key for the installation target
131
207
  - SKILL.md: concise agent operating instructions