@creatornader/agent-bridge 0.2.0 → 0.3.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.
Files changed (115) hide show
  1. package/CHANGELOG.md +86 -4
  2. package/README.md +567 -55
  3. package/ROADMAP.md +114 -0
  4. package/SECURITY.md +90 -0
  5. package/SKILL.md +68 -2
  6. package/bin/agent-bridge +2 -2
  7. package/clients/claude-desktop.json +3 -1
  8. package/dist/archive.d.ts +163 -0
  9. package/dist/archive.js +50 -0
  10. package/dist/archive.js.map +1 -0
  11. package/dist/bridge-domain-CBX3IVqC.d.ts +153 -0
  12. package/dist/{bridge-service-CfqMcMAn.d.ts → bridge-service-hX1ZQp4W.d.ts} +15 -5
  13. package/dist/bridge-store-DPVSCwfs.d.ts +102 -0
  14. package/dist/bridge.d.ts +76 -17
  15. package/dist/bridge.js +52 -24
  16. package/dist/chunk-2DFNOLMO.js +618 -0
  17. package/dist/chunk-2DFNOLMO.js.map +1 -0
  18. package/dist/{chunk-KVR4JBRF.js → chunk-2EVLG3YA.js} +2 -2
  19. package/dist/{chunk-KVR4JBRF.js.map → chunk-2EVLG3YA.js.map} +1 -1
  20. package/dist/chunk-45BZGB77.js +709 -0
  21. package/dist/chunk-45BZGB77.js.map +1 -0
  22. package/dist/chunk-4VB44KJU.js +230 -0
  23. package/dist/chunk-4VB44KJU.js.map +1 -0
  24. package/dist/chunk-5GMB3A77.js +1013 -0
  25. package/dist/chunk-5GMB3A77.js.map +1 -0
  26. package/dist/chunk-A6W4QALF.js +1258 -0
  27. package/dist/chunk-A6W4QALF.js.map +1 -0
  28. package/dist/chunk-BZLMF5O5.js +328 -0
  29. package/dist/chunk-BZLMF5O5.js.map +1 -0
  30. package/dist/{chunk-AXL2I7FH.js → chunk-CEXBMOI5.js} +240 -79
  31. package/dist/chunk-CEXBMOI5.js.map +1 -0
  32. package/dist/chunk-GADH244D.js +527 -0
  33. package/dist/chunk-GADH244D.js.map +1 -0
  34. package/dist/chunk-MBPZXTJA.js +2428 -0
  35. package/dist/chunk-MBPZXTJA.js.map +1 -0
  36. package/dist/chunk-NCO7RLBM.js +146 -0
  37. package/dist/chunk-NCO7RLBM.js.map +1 -0
  38. package/dist/chunk-Q6PPMXJC.js +1050 -0
  39. package/dist/chunk-Q6PPMXJC.js.map +1 -0
  40. package/dist/{chunk-4KAOBC5X.js → chunk-SPSMZOCJ.js} +190 -165
  41. package/dist/chunk-SPSMZOCJ.js.map +1 -0
  42. package/dist/chunk-UAHMP6GC.js +54 -0
  43. package/dist/chunk-UAHMP6GC.js.map +1 -0
  44. package/dist/{chunk-YD6YJATN.js → chunk-VOQIDTCJ.js} +4 -2
  45. package/dist/chunk-VOQIDTCJ.js.map +1 -0
  46. package/dist/chunk-WAI2IYIQ.js +554 -0
  47. package/dist/chunk-WAI2IYIQ.js.map +1 -0
  48. package/dist/cli.d.ts +2 -1
  49. package/dist/cli.js +3555 -214
  50. package/dist/cli.js.map +1 -1
  51. package/dist/client-config.d.ts +1 -1
  52. package/dist/client-config.js +1 -1
  53. package/dist/client-runtime.d.ts +10 -6
  54. package/dist/client-runtime.js +9 -6
  55. package/dist/contracts/generate.d.ts +2 -0
  56. package/dist/contracts/generate.js +247 -0
  57. package/dist/contracts/generate.js.map +1 -0
  58. package/dist/dr.d.ts +324 -0
  59. package/dist/dr.js +124 -0
  60. package/dist/dr.js.map +1 -0
  61. package/dist/gateway-CggQ8vTC.d.ts +78 -0
  62. package/dist/gateway-main.js +190 -8
  63. package/dist/gateway-main.js.map +1 -1
  64. package/dist/gateway.d.ts +4 -3
  65. package/dist/gateway.js +4 -3
  66. package/dist/index.js +11 -8
  67. package/dist/index.js.map +1 -1
  68. package/dist/postgres-bridge-store-Bfd3hRId.d.ts +49 -0
  69. package/dist/server.d.ts +3 -2
  70. package/dist/server.js +13 -8
  71. package/dist/sqlite.d.ts +94 -12
  72. package/dist/sqlite.js +7 -4
  73. package/docs/architecture-v2.md +394 -0
  74. package/docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md +85 -0
  75. package/docs/decisions/0002-canonical-operation-contract-registry.md +46 -0
  76. package/docs/decisions/0003-host-adapters-and-consumer-instance-keys.md +88 -0
  77. package/docs/ecosystem.md +86 -0
  78. package/docs/postmortems/2026-07-08-wrapper-source-drift.md +82 -0
  79. package/docs/troubleshooting.md +89 -0
  80. package/llms.txt +107 -6
  81. package/openapi/agent-bridge-v2.openapi.json +9610 -0
  82. package/package.json +24 -4
  83. package/schemas/agent-bridge-v2.capabilities.json +1829 -0
  84. package/schemas/agent-bridge-v2.mcp.json +2074 -0
  85. package/schemas/agent-bridge-v2.schema.json +4560 -0
  86. package/sql/migrations/008_message_projects.sql +36 -0
  87. package/sql/migrations/009_mailbox_query_indexes.sql +28 -0
  88. package/sql/migrations/010_publisher_delivery_policy.sql +210 -0
  89. package/sql/migrations/011_credential_security.sql +875 -0
  90. package/sql/migrations/012_request_authority.sql +177 -0
  91. package/sql/migrations/013_row_isolation.sql +495 -0
  92. package/sql/migrations/014_owner_control_plane.sql +1641 -0
  93. package/sql/migrations/015_portable_archives.sql +1813 -0
  94. package/sql/migrations/016_native_dr_fence.sql +1005 -0
  95. package/bin/CLAUDE.md +0 -11
  96. package/dist/bridge-domain-BcnBeHOn.d.ts +0 -97
  97. package/dist/bridge-store-BuGjxTn4.d.ts +0 -61
  98. package/dist/chunk-4KAOBC5X.js.map +0 -1
  99. package/dist/chunk-6MAZ6YLZ.js +0 -146
  100. package/dist/chunk-6MAZ6YLZ.js.map +0 -1
  101. package/dist/chunk-AXL2I7FH.js.map +0 -1
  102. package/dist/chunk-BV6W4AJK.js +0 -211
  103. package/dist/chunk-BV6W4AJK.js.map +0 -1
  104. package/dist/chunk-CKSKUBDQ.js +0 -153
  105. package/dist/chunk-CKSKUBDQ.js.map +0 -1
  106. package/dist/chunk-JOUBDRYX.js +0 -272
  107. package/dist/chunk-JOUBDRYX.js.map +0 -1
  108. package/dist/chunk-JTC5YURG.js +0 -49
  109. package/dist/chunk-JTC5YURG.js.map +0 -1
  110. package/dist/chunk-O26W5QHS.js +0 -409
  111. package/dist/chunk-O26W5QHS.js.map +0 -1
  112. package/dist/chunk-WEULPMUY.js +0 -988
  113. package/dist/chunk-WEULPMUY.js.map +0 -1
  114. package/dist/chunk-YD6YJATN.js.map +0 -1
  115. package/dist/gateway-BULozv3K.d.ts +0 -54
@@ -0,0 +1,86 @@
1
+ # Agent Bridge in the agent ecosystem
2
+
3
+ Agent Bridge is a durable mailbox and work-delivery control plane for agent runtimes
4
+ that may disconnect, restart, or move between machines. It stores immutable messages,
5
+ read receipts, delivery claims, leases, retries, and replay state. It does not own the
6
+ full agent stack.
7
+
8
+ ## System boundaries
9
+
10
+ | Layer | Examples | Relationship to Agent Bridge |
11
+ | --- | --- | --- |
12
+ | Tool and context access | MCP, CLI, HTTPS, Node library | These surfaces expose Agent Bridge operations. They do not define its stored message or delivery protocol. |
13
+ | Agent task semantics | A2A and application protocols | These systems own tasks, artifacts, status, and domain completion. Agent Bridge can carry their identifiers and payloads. |
14
+ | Durable mailbox | Agent Bridge | Agent Bridge owns cursored history, receipts, work claims, leases, retry state, and offline replay. |
15
+ | Live transport and brokers | SLIM, NATS, RabbitMQ, Kafka | A future adapter may use one of these systems for transport or wakeups. Cursored pull remains the recovery path. |
16
+ | Agent execution | Codex, Claude Code, OpenClaw, Hermes, Pi, LangGraph, AutoGen, agent-loop | These harnesses decide what runs and how workflows advance. Agent Bridge can carry messages when their host implements a supported access surface. |
17
+ | Local operator experience | agmsg and similar tools | These tools may provide terminal placement, agent spawning, roles, and local coordination. They can use Agent Bridge when they need its durable cross-machine state. |
18
+
19
+ [ADR-0001](decisions/0001-protocol-layers-and-acknowledgment-semantics.md)
20
+ defines the protocol boundary and the separate meanings of read receipts, delivery
21
+ settlement, and external task completion.
22
+ [ADR-0003](decisions/0003-host-adapters-and-consumer-instance-keys.md) defines
23
+ the host layers and consumer instance-key contract.
24
+
25
+ ## Harnesses, hosts, adapters, and access
26
+
27
+ Agent Bridge keeps four integration concepts separate:
28
+
29
+ - A harness runs an agent loop, such as Codex, Claude Code, OpenClaw, Hermes, or Pi.
30
+ - A host is the CLI, desktop application, daemon, CI job, or service that contains the
31
+ harness or invokes Agent Bridge.
32
+ - A host adapter configures that host to use Agent Bridge.
33
+ - An access surface is MCP over stdio, the CLI, the HTTPS API, or the Node library.
34
+
35
+ This distinction matters when one profile serves more than one host surface. The
36
+ `codex` adapter configures the profile shared by the Codex CLI and the Codex surface
37
+ in the ChatGPT desktop app. It does not create two independent Agent Bridge
38
+ registrations. Claude Code and Claude Desktop have separate adapters and registrations.
39
+
40
+ | Adapter or integration | Host coverage | Access | Support level |
41
+ | --- | --- | --- | --- |
42
+ | `codex` | Codex CLI and Codex in the ChatGPT desktop app | MCP stdio | Automated install |
43
+ | `claude-code` | Claude Code CLI | MCP stdio | Automated install |
44
+ | `claude-desktop` | Claude Desktop | MCP stdio | Automated install |
45
+ | `openclaw` | OpenClaw daemon or host | MCP stdio | Manifest included; operator-managed |
46
+ | `generic-mcp` | Any compatible MCP host | MCP stdio | Manifest included; operator-managed |
47
+ | Direct integration | Scripts, CI, daemons, and services | CLI, HTTPS, or Node library | No host adapter required |
48
+ | Generic harness integration | Hermes, Pi, and other harnesses | Any access surface their host supports | No dedicated adapter or conformance claim yet |
49
+
50
+ Scripts are orthogonal to harnesses. A script may start a harness, invoke the CLI,
51
+ call the HTTPS API, or embed the Node library. It is not a separate agent category.
52
+ The MCP server currently uses stdio. The gateway exposes the Agent Bridge HTTPS
53
+ protocol, not MCP over HTTP.
54
+
55
+ ## Relationship to agmsg
56
+
57
+ Agent Bridge does not claim to replace agmsg's operator interface, process management,
58
+ terminal integration, or community. It treats agmsg as a useful client and adapter
59
+ reference.
60
+
61
+ The two projects meet at the storage and delivery boundary. An agmsg adapter could map
62
+ send, inbox, history, claim, and settlement operations onto Agent Bridge while keeping
63
+ agmsg's local interaction model. Agent Bridge would then provide durable history,
64
+ principal-bound identity, and cross-machine replay. The adapter must preserve Agent
65
+ Bridge receipt and lease semantics instead of creating a second state model.
66
+
67
+ ## What Agent Bridge does not do
68
+
69
+ Agent Bridge is not:
70
+
71
+ - A workflow engine or scheduler.
72
+ - A memory or retrieval system.
73
+ - A terminal multiplexer or agent process manager.
74
+ - A replacement for A2A task semantics.
75
+ - An encrypted global network.
76
+ - A general-purpose event streaming platform.
77
+
78
+ These boundaries keep the protocol small enough to support clients from different
79
+ vendors without forcing every participant into the same runtime or deployment stack.
80
+
81
+ ## Interoperability direction
82
+
83
+ The next interoperability work is tracked in [ROADMAP.md](../ROADMAP.md). Planned
84
+ surfaces include an agmsg adapter, a thin A2A envelope mapping, host-adapter conformance
85
+ fixtures, and client libraries. Each integration must retain caller-bound identity,
86
+ idempotent publication, cursored replay, and at-least-once delivery semantics.
@@ -0,0 +1,82 @@
1
+ # 2026-07-08 Agent Bridge Wrapper Source Drift
2
+
3
+ ## Status
4
+
5
+ Resolved for basic Codex, Claude Code, and Claude Desktop availability.
6
+
7
+ Codex, Claude Code, and Claude Desktop now launch the source repo MCP server
8
+ directly from its built `dist/index.js` entrypoint with a pinned Node binary.
9
+ The direct server reads credentials from `~/.agent-bridge/config`, so client
10
+ configs no longer need to duplicate the Supabase URL or anon key.
11
+
12
+ The broken Codex, Claude Code, and Claude Desktop signed-wrapper launchd jobs
13
+ were removed after their labels stayed loaded while `/mcp/health` refused
14
+ connections. The wrapper code still exists as an optional signed attribution
15
+ layer.
16
+
17
+ ## Impact
18
+
19
+ Codex, Claude Code, and Claude Desktop could not use Agent Bridge through MCP
20
+ while their client configs pointed at signed HTTP wrapper ports:
21
+
22
+ - Codex: `http://127.0.0.1:8794/mcp`
23
+ - Claude Code: `http://127.0.0.1:8793/mcp`
24
+ - Claude Desktop: `http://127.0.0.1:8791/mcp`
25
+
26
+ The source repo CLI and Supabase connection stayed healthy. The outage was in
27
+ the local wrapper path and client wiring, not in the shared context database.
28
+
29
+ ## Root Cause
30
+
31
+ The live client configs made the wrapper the only MCP path. That turned an
32
+ optional signing layer into the availability boundary for Agent Bridge.
33
+
34
+ The wrapper launchd jobs also treated process supervision as enough. A label
35
+ could be loaded while the HTTP health route was unavailable. Nothing moved the
36
+ clients back to the source MCP server when `/mcp/health` failed.
37
+
38
+ The source MCP server made the fallback harder than it should have been because
39
+ it required `AGENT_BRIDGE_URL` and `AGENT_BRIDGE_KEY` in process env. The CLI
40
+ already read `~/.agent-bridge/config`, so the two source-repo entrypoints had
41
+ drifted.
42
+
43
+ During recovery, the wrapper installer also selected `node` from ambient
44
+ `PATH`. That allowed restarts to drift to a local Node shim instead of the
45
+ Homebrew Node binary that had previously run the service.
46
+
47
+ ## Fixes
48
+
49
+ - `src/server.ts` now reads `~/.agent-bridge/config` when env credentials are
50
+ absent. Env values still take precedence.
51
+ - `test/server_factory.test.ts` covers config-file fallback, env precedence,
52
+ quoted config values, explicit config paths, and missing credentials.
53
+ - Local Codex, Claude Code, and Claude Desktop configs now launch the source
54
+ MCP server directly with `/opt/homebrew/bin/node` and only set
55
+ `AGENT_BRIDGE_AGENT`.
56
+ - The dead Codex, Claude Code, and Claude Desktop wrapper launchd jobs were
57
+ uninstalled.
58
+ - The internal wrapper installer now prefers `/opt/homebrew/bin/node` by default
59
+ while still honoring `NODE_BIN`.
60
+
61
+ ## Wrapper Policy
62
+
63
+ Keep the signed wrapper for attribution receipts and local-substrate metadata.
64
+ Do not make it the only Agent Bridge path for Codex, Claude Code, or Claude
65
+ Desktop.
66
+
67
+ Only reinstall those wrapper jobs as active client targets after the wrapper has
68
+ health-based supervision. A loaded launchd label is not proof that Agent Bridge
69
+ MCP is available. The proof is a successful `/mcp/health` probe and a real MCP
70
+ tool call.
71
+
72
+ ## Verification
73
+
74
+ - `npm test`: 24 tests passed.
75
+ - `npm run build`: passed.
76
+ - Direct stdio MCP smoke: listed `post_context`, `get_context`, and
77
+ `ack_context`, then read live context.
78
+ - CLI status: returned `{"status":"ok","message":"Agent Bridge is connected to Supabase"}`.
79
+ - Claude Desktop launch proof: fresh Desktop log showed `initialize` and
80
+ `tools/list` succeeding against the direct source MCP entrypoint.
81
+ - Wrapper cleanup: Codex, Claude Code, and Claude Desktop wrapper labels are
82
+ absent, and their launchd plist files are absent.
@@ -0,0 +1,89 @@
1
+ # Troubleshooting Agent Bridge
2
+
3
+ Start with the command line even when the failure appears inside an MCP client:
4
+
5
+ ```bash
6
+ agent-bridge doctor --json
7
+ ```
8
+
9
+ `doctor` checks the configured backend and reports named failures. It exits 0 when the
10
+ client is ready, 2 when it is degraded, and 1 when a required check fails. `status` is
11
+ passive and does not test remote reachability.
12
+
13
+ ## MCP server disconnected or could not attach
14
+
15
+ An MCP client must be able to start the server in its own process environment. Desktop
16
+ applications do not always inherit the `PATH` from an interactive shell, so the normal
17
+ Claude Desktop installer records an absolute Node executable and an absolute server
18
+ entry point.
19
+
20
+ 1. Reinstall the Claude Desktop registration:
21
+
22
+ ```bash
23
+ agent-bridge clients install claude-desktop --identity claude-desktop
24
+ ```
25
+
26
+ 2. Restart Claude Desktop completely. Closing only its window may leave the old process
27
+ running.
28
+
29
+ 3. Run `agent-bridge doctor --json` again from a shell.
30
+
31
+ Use `--command` only when an operator intentionally maintains a separate executable.
32
+ Pass an absolute path:
33
+
34
+ ```bash
35
+ agent-bridge clients install claude-desktop \
36
+ --identity claude-desktop \
37
+ --command "$(command -v agent-bridge-mcp)"
38
+ ```
39
+
40
+ Claude Desktop stores its Agent Bridge registration under `mcpServers.agent-bridge` in:
41
+
42
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
43
+ - Windows: `%APPDATA%/Claude/claude_desktop_config.json`
44
+
45
+ The registered environment must contain distinct `AGENT_BRIDGE_AGENT`,
46
+ `AGENT_BRIDGE_INSTANCE`, and `AGENT_BRIDGE_CONFIG` values for that client. Do not copy
47
+ another client's identity or backend file into the entry.
48
+
49
+ ## The executable is missing
50
+
51
+ Install the published package globally, then repeat the normal client installation:
52
+
53
+ ```bash
54
+ npm install --global @creatornader/agent-bridge
55
+ agent-bridge clients install claude-desktop --identity claude-desktop
56
+ ```
57
+
58
+ The normal Claude Desktop registration does not depend on the application's inherited
59
+ `PATH`. If an explicit `--command` override is necessary, locate that executable and
60
+ pass its absolute path.
61
+
62
+ ## Identity mismatch
63
+
64
+ The active runtime owns its identity. Shared backend config must not contain
65
+ `AGENT_BRIDGE_AGENT`, and one client must not claim another client's source label.
66
+
67
+ Check the client registration and its private backend file. Reinstall that client with
68
+ its intended principal if the values differ. Do not work around the error by adding a
69
+ literal `--source` for normal MCP traffic.
70
+
71
+ ## Gateway failures
72
+
73
+ Use the doctor output to distinguish local edge health from remote reachability.
74
+
75
+ - `unknown` means no active probe established remote state.
76
+ - `degraded` can mean cached inbox data or queued outbox messages remain usable while
77
+ the gateway is unavailable.
78
+ - `failed` means a required local or remote check did not pass.
79
+
80
+ Queued sends retain their idempotency keys. Long-lived MCP clients retry them, and
81
+ `agent-bridge sync` triggers the same bounded replay manually. Claims, lease changes,
82
+ delivery settlement, presence, and read-receipt writes still require the gateway.
83
+
84
+ ## Report a defect
85
+
86
+ Include the client name, operating system, package version, sanitized `doctor --json`
87
+ output, and whether the executable path is absolute. Remove tokens, database URLs,
88
+ message content, and private backend contents before posting an issue. Report possible
89
+ security defects through the private process in [SECURITY.md](../SECURITY.md).
package/llms.txt CHANGED
@@ -3,7 +3,23 @@
3
3
  Repository: https://github.com/creatornader/agent-bridge
4
4
  Package: @creatornader/agent-bridge
5
5
 
6
- Agent Bridge carries durable context and executable work between AI agents in different clients, processes, sessions, and machines.
6
+ Agent Bridge is a durable, pull-first mailbox and work-delivery control plane for AI agents in different clients, processes, sessions, and machines.
7
+ History uses mailbox `inbox` (default), `sent`, or `all`. Receipt state is `any` (default), `unread`, or `read`; it is caller-relative and inbox-only. CLI: `inbox`, `sent`, and `history --mailbox/--receipt-state`. Deprecated unacked-principal arguments must equal the configured identity.
8
+
9
+ ## Install
10
+
11
+ - `npm install --global @creatornader/agent-bridge`
12
+ - `agent-bridge init --provider local`
13
+ - `agent-bridge demo`
14
+
15
+ If an MCP client cannot attach, run `agent-bridge doctor --json` and see
16
+ `docs/troubleshooting.md`. Normal client installation resolves the MCP launch command;
17
+ do not copy another runtime's identity or backend file.
18
+
19
+ The `codex` host adapter configures the profile shared by the Codex CLI and the Codex
20
+ surface in the ChatGPT desktop app. Claude Code and Claude Desktop use separate
21
+ adapters. OpenClaw and generic MCP manifests are operator-managed. Scripts and
22
+ services can call the CLI or HTTPS API or embed the Node library without a host adapter.
7
23
 
8
24
  ## Modes
9
25
 
@@ -13,27 +29,112 @@ Agent Bridge carries durable context and executable work between AI agents in di
13
29
 
14
30
  ## Commands
15
31
 
32
+ - `agent-bridge --version` or `agent-bridge -V`: print the installed package version without loading backend configuration.
33
+ - `agent-bridge capabilities`: print the canonical v2 operation and protocol capability document.
34
+
16
35
  - agent-bridge init --provider local
17
36
  - agent-bridge demo
18
- - agent-bridge doctor
37
+ - `agent-bridge status`: passive JSON snapshot; never probes or synchronizes. Unprobed remote reachability returns unknown with `connected: false`.
38
+ - `agent-bridge doctor`: active named checks; exits 0 ok, 2 degraded, 1 failed. Blocked outbox rows cannot be healthy.
19
39
  - agent-bridge pending
20
40
  - agent-bridge send, inbox, history, acknowledge
21
- - agent-bridge claim, extend, ack, nack
41
+ - agent-bridge claim, extend, ack, nack, deliveries, delivery-events, cancel, requeue
22
42
  - agent-bridge sync, watch, join, presence
23
43
  - agent-bridge clients install <runtime> --identity <principal>
44
+ - agent-bridge owner provision|inventory|rotate|revoke
45
+ - agent-bridge clients install <runtime> --enrollment-file <private path>
46
+ - agent-bridge archive export|verify|import
47
+ - agent-bridge dr backup|verify|restore
48
+
49
+ Archive export moves one workspace's immutable messages and read receipts between
50
+ canonical local SQLite and PostgreSQL stores. Import defaults to a rollback-backed dry
51
+ run and requires `--apply` to commit. PostgreSQL archive authority comes only from
52
+ `AGENT_BRIDGE_ARCHIVE_DATABASE_URL`. The digest detects changed bytes; it is neither
53
+ encryption nor authentication. Archives exclude delivery, event, presence, credential,
54
+ control, and security state. Import uses one private file descriptor for format,
55
+ message, and receipt passes with a 4 MiB batch budget. Export completes its audit only
56
+ after durable publication. `--dry-run` and `--apply` are exclusive. Library import:
57
+ `@creatornader/agent-bridge/archive`.
58
+ Portable v1 requires current-domain records, lowercase UUIDs, and six-digit UTC
59
+ timestamps. It does not trim, deduplicate, default, or rewrite message content.
60
+ Legacy or direct rows that fail validation require native database recovery.
61
+ Export accepts a request ID, stores it as header `exportRequestId`, and returns it.
62
+ Verify and import return the same provenance; an import request ID is independent.
63
+ Same-ID export retries verify completed files or reconcile matching started files
64
+ without streaming again. Deterministic adjacent recovery files are derived from the
65
+ export ID. Force replacement keeps a private backup until the new file is durable and
66
+ reports recovery paths plus backup, durability, and audit uncertainty.
67
+
68
+ Native DR preserves a complete local SQLite authority or shared PostgreSQL authority;
69
+ it does not translate between providers. Local DR rejects gateway edge stores.
70
+ PostgreSQL source and target URLs come only from AGENT_BRIDGE_DR_SOURCE_DATABASE_URL
71
+ and AGENT_BRIDGE_DR_TARGET_DATABASE_URL. Restore requires a dedicated fresh database
72
+ with the same name and PostgreSQL major, superuser authority, an explicit request ID,
73
+ and --accept-source-sql-risk. The backup includes role membership and default ACL state,
74
+ excludes transient request, rate-limit, instance, and archive-authorization rows, and
75
+ normalizes claimed deliveries on restore. Never run source and restored target at the
76
+ same time. The package API is @creatornader/agent-bridge/dr. Bundle hashes detect
77
+ changed bytes but do not encrypt or authenticate the source.
24
78
 
25
79
  ## MCP tools
26
80
 
81
+ - `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.
82
+ - 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.
83
+
27
84
  Compatibility: post_context, get_context, ack_context.
28
- Reliable messaging: send, history, claim, extend, acknowledge, negative_acknowledge, heartbeat, presence.
85
+ Reliable messaging: send, history, claim, extend, acknowledge, negative_acknowledge, heartbeat, presence, sync.
86
+ Publisher delivery intent: `deliveryPolicy` mode `mailbox|leased` with `maxAttempts`, `retryBaseDelayMs`, `retryMaxDelayMs`, `retryJitterRatio`, and optional `notBefore`. MCP delivery controls: `list_deliveries`, `list_delivery_events`, `cancel_delivery`, `requeue_delivery`. Consumer `maxAttempts` and `retryPolicy` are validated but ignored for one compatibility release.
87
+
88
+ Gateway MCP clients sync automatically and expose manual sync for bounded outbox replay and inbox cache refresh. Offline unacknowledged results are degraded candidates with unknown acknowledgement state, not proof that messages are unread or that no remote work exists.
89
+
90
+ ## Protocol boundary
91
+
92
+ A2A and application task semantics sit above Agent Bridge.
93
+ MCP, CLI, HTTPS, and the Node library are access surfaces.
94
+ Harnesses, host applications, host adapters, and access surfaces are separate layers.
95
+ The MCP server uses stdio. The gateway HTTPS API is not MCP over HTTP.
96
+ Optional transports such as SLIM or NATS may sit below the core.
97
+ agmsg is a reference for adapters, interoperability, and client experience.
98
+ 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.
99
+ MCP and HTTP 2.1 use delivery response envelopes. The unversioned CLI and HTTP 2.0 retain direct or null delivery results.
100
+ OpenAPI paths describe 2.1. Embedded 2.0 vendor extensions provide limited compatibility schema metadata, not a second OpenAPI description.
101
+
102
+ ## Acknowledgment rules
103
+
104
+ MCP ack_context and CLI acknowledge write read receipts.
105
+ MCP acknowledge and CLI ack settle claimed deliveries.
106
+ A receipt does not settle work. Delivery settlement does not create a receipt.
107
+ Lease extension does not report progress or external task completion.
29
108
 
30
109
  ## Identity rule
31
110
 
32
- 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.
111
+ 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.
112
+
113
+ Owner commands are offline and use only AGENT_BRIDGE_OPERATOR_DATABASE_URL. They are
114
+ not MCP, HTTP, or public gateway operations. Provision and rotation write private
115
+ versioned enrollment files before calling PostgreSQL. The installer consumes the raw
116
+ token from that file without command arguments. Rotation updates the exact existing
117
+ client backend and does not repeat host registration. Enrollment operations hold an
118
+ exclusive per-file lock and use revisioned compare-and-swap transitions. Use explicit
119
+ `--recover-lock` only after a crash; recovery checks lock age, host, owner, and process
120
+ liveness. Rotation requires predecessor credential, principal, instance, gateway,
121
+ workspace, and live MCP registration matches. Consumed-file deletion and lock release
122
+ report retained, missing, durable, and durability-unknown outcomes without claiming that
123
+ an unlinked path was retained.
124
+
125
+ 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.
126
+ 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.
33
127
 
34
128
  ## References
35
129
 
36
130
  - README.md: setup, commands, security, and provider behavior
131
+ - ROADMAP.md: released, implemented, and remaining work
132
+ - SECURITY.md: reporting process and security boundaries
133
+ - docs/ecosystem.md: relationship to adjacent protocols, brokers, and runtimes
134
+ - docs/troubleshooting.md: MCP startup and client recovery
135
+ - docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md: protocol layers and acknowledgment semantics
136
+ - docs/decisions/0002-canonical-operation-contract-registry.md: generated contracts and version negotiation
137
+ - docs/decisions/0003-host-adapters-and-consumer-instance-keys.md: host layers and instance-key semantics
37
138
  - docs/architecture-v2.md: protocol, storage, identity, delivery, and acceptance decisions
38
- - clients/*.json: runtime adapter manifests
139
+ - clients/*.json: v1 host-adapter manifests; `runtime` is the compatibility key for the installation target
39
140
  - SKILL.md: concise agent operating instructions