@creatornader/agent-bridge 0.2.0 → 0.3.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 (114) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/README.md +467 -29
  3. package/ROADMAP.md +104 -0
  4. package/SECURITY.md +73 -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 +3577 -250
  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 +375 -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/ecosystem.md +54 -0
  77. package/docs/postmortems/2026-07-08-wrapper-source-drift.md +82 -0
  78. package/docs/troubleshooting.md +89 -0
  79. package/llms.txt +96 -4
  80. package/openapi/agent-bridge-v2.openapi.json +9610 -0
  81. package/package.json +24 -4
  82. package/schemas/agent-bridge-v2.capabilities.json +1829 -0
  83. package/schemas/agent-bridge-v2.mcp.json +2074 -0
  84. package/schemas/agent-bridge-v2.schema.json +4560 -0
  85. package/sql/migrations/008_message_projects.sql +36 -0
  86. package/sql/migrations/009_mailbox_query_indexes.sql +28 -0
  87. package/sql/migrations/010_publisher_delivery_policy.sql +210 -0
  88. package/sql/migrations/011_credential_security.sql +875 -0
  89. package/sql/migrations/012_request_authority.sql +177 -0
  90. package/sql/migrations/013_row_isolation.sql +495 -0
  91. package/sql/migrations/014_owner_control_plane.sql +1641 -0
  92. package/sql/migrations/015_portable_archives.sql +1813 -0
  93. package/sql/migrations/016_native_dr_fence.sql +1005 -0
  94. package/bin/CLAUDE.md +0 -11
  95. package/dist/bridge-domain-BcnBeHOn.d.ts +0 -97
  96. package/dist/bridge-store-BuGjxTn4.d.ts +0 -61
  97. package/dist/chunk-4KAOBC5X.js.map +0 -1
  98. package/dist/chunk-6MAZ6YLZ.js +0 -146
  99. package/dist/chunk-6MAZ6YLZ.js.map +0 -1
  100. package/dist/chunk-AXL2I7FH.js.map +0 -1
  101. package/dist/chunk-BV6W4AJK.js +0 -211
  102. package/dist/chunk-BV6W4AJK.js.map +0 -1
  103. package/dist/chunk-CKSKUBDQ.js +0 -153
  104. package/dist/chunk-CKSKUBDQ.js.map +0 -1
  105. package/dist/chunk-JOUBDRYX.js +0 -272
  106. package/dist/chunk-JOUBDRYX.js.map +0 -1
  107. package/dist/chunk-JTC5YURG.js +0 -49
  108. package/dist/chunk-JTC5YURG.js.map +0 -1
  109. package/dist/chunk-O26W5QHS.js +0 -409
  110. package/dist/chunk-O26W5QHS.js.map +0 -1
  111. package/dist/chunk-WEULPMUY.js +0 -988
  112. package/dist/chunk-WEULPMUY.js.map +0 -1
  113. package/dist/chunk-YD6YJATN.js.map +0 -1
  114. package/dist/gateway-BULozv3K.d.ts +0 -54
@@ -0,0 +1,85 @@
1
+ # ADR-0001: Define protocol layers and acknowledgment semantics
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Date
8
+
9
+ 2026-07-14
10
+
11
+ ## Context
12
+
13
+ Agent Bridge overlaps with agent protocols, client interfaces, message transports, and task systems. Without a firm boundary, an access adapter can become the protocol, transport state can be mistaken for task state, and different acknowledgments can acquire conflicting meanings.
14
+
15
+ Agent Bridge needs to serve agents across clients, sessions, processes, and machines without owning every protocol above or transport below it.
16
+
17
+ ## Decision
18
+
19
+ Agent Bridge is the durable, pull-first mailbox and work-delivery control plane for intermittently connected agent runtimes.
20
+
21
+ Its protocol owns:
22
+
23
+ - Immutable messages and cursored history.
24
+ - Read receipts.
25
+ - Targeted work deliveries.
26
+ - Claims, leases, retries, settlement, and dead-letter state.
27
+ - Principal-bound identity and workspace isolation.
28
+ - Durable replay after disconnection.
29
+
30
+ The surrounding layers have separate responsibilities:
31
+
32
+ - A2A and application protocols sit above Agent Bridge. They own task, conversation, artifact, and domain lifecycle semantics.
33
+ - MCP, CLI, and HTTPS are client access surfaces. They expose Agent Bridge operations without defining its stored protocol.
34
+ - Optional transports such as SLIM or NATS may sit below the core as wakeup or transport adapters. They must not replace authoritative cursor replay or durable delivery state.
35
+ - agmsg is a reference for adapters, interoperability, and client experience. Its patterns may inform clients, but it does not define Agent Bridge identity, persistence, or delivery semantics.
36
+
37
+ A2A task IDs or application status may travel through Agent Bridge fields and payloads. Agent Bridge does not infer a task lifecycle from message or delivery state.
38
+
39
+ ## Acknowledgment semantics
40
+
41
+ | Operation | Meaning | State changed | It does not mean |
42
+ | --- | --- | --- | --- |
43
+ | Read receipt | A principal records that it has read or handled a message. | Receipt record | Work ownership, delivery settlement, or task completion |
44
+ | Delivery claim | One principal and instance own a delivery until its lease expires. | Delivery state and lease | The message was read or the work succeeded |
45
+ | Lease extension | The active owner renews its claim. | Lease expiry | Progress, success, or task completion |
46
+ | Delivery acknowledgment | The worker finished processing the delivery and Agent Bridge may stop redelivery. | Delivery becomes `acked` | A read receipt or an external task status |
47
+ | Delivery negative acknowledgment | The worker releases the delivery for retry or marks it dead. | Delivery becomes `retrying` or `dead` | An A2A task failure, cancellation, or rejection |
48
+ | External task completion | An application or A2A task reaches a domain-defined terminal state. | State owned above Agent Bridge | Any automatic receipt or delivery transition |
49
+
50
+ The interfaces use overlapping names, so documentation must identify the surface:
51
+
52
+ - MCP `ack_context` and CLI `acknowledge` write read receipts.
53
+ - MCP `acknowledge` and CLI `ack` settle claimed deliveries.
54
+ - MCP `negative_acknowledge` and CLI `nack` negatively settle claimed deliveries.
55
+ - MCP `extend` and CLI `extend` renew a lease.
56
+
57
+ Read receipts and delivery settlement remain independent in both directions. Recording a receipt does not consume or settle work. Settling a delivery does not create a receipt.
58
+
59
+ ## Consequences
60
+
61
+ Agent Bridge can carry A2A messages without implementing the A2A task state machine. A client that needs both task completion and delivery settlement must record both operations explicitly.
62
+
63
+ MCP remains replaceable by another access adapter. A transport integration must preserve cursors, idempotency, identity binding, and delivery leases.
64
+
65
+ Push notifications and future brokers can reduce wakeup latency. Pull and replay remain the recovery path.
66
+
67
+ Adapters inspired by agmsg must map into Agent Bridge semantics rather than creating a second receipt, identity, or delivery model.
68
+
69
+ ## Alternatives considered
70
+
71
+ ### Make MCP the Agent Bridge protocol
72
+
73
+ Rejected because MCP is one client interface. CLI, HTTPS, and future clients need the same stored semantics.
74
+
75
+ ### Own the full task lifecycle
76
+
77
+ Rejected because A2A and applications define richer task and artifact state. Duplicating that state would create conflicting authorities.
78
+
79
+ ### Require a broker as the shared authority
80
+
81
+ Rejected for the current architecture. PostgreSQL already provides durable shared state, while cursored pull supports intermittent clients without another required service.
82
+
83
+ ### Adopt agmsg semantics as the core
84
+
85
+ Rejected because Agent Bridge must persist messages across machines, bind principals to credentials, replay from cursors, and manage leased deliveries. agmsg remains useful as an adapter and interface reference.
@@ -0,0 +1,46 @@
1
+ # ADR-0002: Canonical operation contract registry
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Date
8
+
9
+ 2026-07-14
10
+
11
+ ## Context
12
+
13
+ Agent Bridge v2 exposed the same operations through MCP, HTTPS, and the CLI, but schemas and surface metadata were maintained separately. That allowed request shapes, capability descriptions, and generated documentation to drift. Package, MCP implementation, protocol, and database migration versions also have different compatibility lifecycles.
14
+
15
+ ## Decision
16
+
17
+ `src/contracts/registry.ts` is the canonical v2 operation registry. Each operation owns its request and response schemas, reserved authorization scope metadata, provider availability, and surface metadata. The generator writes checked-in JSON Schema 2020-12, OpenAPI 3.1.2, MCP manifest, and capability documents from that registry.
18
+
19
+ External requests pass closed structural schema validation before domain validation. Responses require their known fields and accept additive unknown properties. MCP and HTTP 2.1 claim responses use `{ delivery, leaseToken? }`, and delivery controls use `{ delivery }`. HTTP 2.0 and the unversioned CLI retain direct or null delivery results. Public send requests may supply an immutable message `id`, but never a workspace. An optional `source` is an identity assertion and must match the active principal.
20
+
21
+ Authenticated HTTP operations negotiate with `X-Agent-Bridge-Protocol-Version`. Version 2.1 is current. A missing request header selects 2.0, and the gateway accepts exactly 2.0 and 2.1. Other versions return 426 with `unsupported_protocol_version`. An upgraded gateway returns the selected version in `X-Agent-Bridge-Protocol-Version` and its supported versions in `X-Agent-Bridge-Supported-Protocol-Versions`. Gateway errors use one envelope with a stable code and request ID.
22
+
23
+ The HTTP 2.1 client performs and caches a read-only status probe before its first mutation. Negotiation succeeds only when `X-Agent-Bridge-Protocol-Version` equals `2.1` and `X-Agent-Bridge-Supported-Protocol-Versions` includes `2.1`. A headerless response is classified as a released d8184fe 2.0 gateway. A selected 2.0 response, either missing response header, or contradictory values cause the client to reject mutation with a gateway-upgrade error. The client does not downgrade to the 2.0 wire contract.
24
+
25
+ Compatibility runs in the other direction. An upgraded gateway continues to serve released headerless and explicit 2.0 clients with their original message, delivery, and direct or null response shapes. This makes gateway-first deployment mandatory: deploy the upgraded gateway, verify 2.0 clients, and only then install or start 2.1 clients. Capability output reports current, selected, and supported versions separately.
26
+
27
+ The OpenAPI paths require protocol 2.1. The `x-agent-bridge-protocol-2.0` and `x-agent-bridge-schemas-2.0` vendor extensions provide limited metadata and frozen schemas for the released compatibility contract. They do not define a second set of paths or a separate OpenAPI description.
28
+
29
+ Capability documents are filtered by surface and provider. HTTP capability discovery requires a valid credential but has no named scope. The exact scope names are reserved metadata until a later security migration. Gateway credentials grant access as a whole, local mode uses process identity, and legacy mode uses its configured key. Capability documents and OpenAPI set `scopeEnforcement` to false.
30
+
31
+ Package version, MCP implementation version, Agent Bridge protocol version, and migration version remain independent. The MCP server reports the explicit `MCP_IMPLEMENTATION_VERSION` constant instead of the npm package version.
32
+
33
+ ## Consequences
34
+
35
+ - `npm run contracts:generate` updates artifacts and `npm run contracts:check` rejects drift.
36
+ - The npm package includes the generated schema and OpenAPI directories.
37
+ - New v2 operations must be added to the registry before surface wiring.
38
+ - Legacy `post_context`, `get_context`, and `ack_context` remain separate frozen compatibility contracts.
39
+ - Protocol 2.1 deployments upgrade and verify the gateway before upgrading clients.
40
+ - This decision adds no task semantics and requires no database migration.
41
+
42
+ ## Related
43
+
44
+ - [ADR-0001](0001-protocol-layers-and-acknowledgment-semantics.md) defines the protocol layers and acknowledgment meanings.
45
+ - [Architecture v2](../architecture-v2.md) describes the system that follows these decisions.
46
+ - The [README](../../README.md) documents public setup and upgrade behavior.
@@ -0,0 +1,54 @@
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 | Agent Bridge exposes MCP tools. MCP does not define Agent Bridge's 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 | LangGraph, AutoGen, agent-loop, hosted agent platforms | These systems decide what runs and how workflows advance. Agent Bridge carries messages between them. |
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
+
23
+ ## Relationship to agmsg
24
+
25
+ Agent Bridge does not claim to replace agmsg's operator interface, process management,
26
+ terminal integration, or community. It treats agmsg as a useful client and adapter
27
+ reference.
28
+
29
+ The two projects meet at the storage and delivery boundary. An agmsg adapter could map
30
+ send, inbox, history, claim, and settlement operations onto Agent Bridge while keeping
31
+ agmsg's local interaction model. Agent Bridge would then provide durable history,
32
+ principal-bound identity, and cross-machine replay. The adapter must preserve Agent
33
+ Bridge receipt and lease semantics instead of creating a second state model.
34
+
35
+ ## What Agent Bridge does not do
36
+
37
+ Agent Bridge is not:
38
+
39
+ - A workflow engine or scheduler.
40
+ - A memory or retrieval system.
41
+ - A terminal multiplexer or agent process manager.
42
+ - A replacement for A2A task semantics.
43
+ - An encrypted global network.
44
+ - A general-purpose event streaming platform.
45
+
46
+ These boundaries keep the protocol small enough to support clients from different
47
+ vendors without forcing every participant into the same runtime or deployment stack.
48
+
49
+ ## Interoperability direction
50
+
51
+ The next interoperability work is tracked in [ROADMAP.md](../ROADMAP.md). Planned
52
+ surfaces include an agmsg adapter, a thin A2A envelope mapping, runtime conformance
53
+ fixtures, and client libraries. Each integration must retain caller-bound identity,
54
+ 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,18 @@
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.
7
18
 
8
19
  ## Modes
9
20
 
@@ -13,27 +24,108 @@ Agent Bridge carries durable context and executable work between AI agents in di
13
24
 
14
25
  ## Commands
15
26
 
27
+ - `agent-bridge capabilities`: print the canonical v2 operation and protocol capability document.
28
+
16
29
  - agent-bridge init --provider local
17
30
  - agent-bridge demo
18
- - agent-bridge doctor
31
+ - `agent-bridge status`: passive JSON snapshot; never probes or synchronizes. Unprobed remote reachability returns unknown with `connected: false`.
32
+ - `agent-bridge doctor`: active named checks; exits 0 ok, 2 degraded, 1 failed. Blocked outbox rows cannot be healthy.
19
33
  - agent-bridge pending
20
34
  - agent-bridge send, inbox, history, acknowledge
21
- - agent-bridge claim, extend, ack, nack
35
+ - agent-bridge claim, extend, ack, nack, deliveries, delivery-events, cancel, requeue
22
36
  - agent-bridge sync, watch, join, presence
23
37
  - agent-bridge clients install <runtime> --identity <principal>
38
+ - agent-bridge owner provision|inventory|rotate|revoke
39
+ - agent-bridge clients install <runtime> --enrollment-file <private path>
40
+ - agent-bridge archive export|verify|import
41
+ - agent-bridge dr backup|verify|restore
42
+
43
+ Archive export moves one workspace's immutable messages and read receipts between
44
+ canonical local SQLite and PostgreSQL stores. Import defaults to a rollback-backed dry
45
+ run and requires `--apply` to commit. PostgreSQL archive authority comes only from
46
+ `AGENT_BRIDGE_ARCHIVE_DATABASE_URL`. The digest detects changed bytes; it is neither
47
+ encryption nor authentication. Archives exclude delivery, event, presence, credential,
48
+ control, and security state. Import uses one private file descriptor for format,
49
+ message, and receipt passes with a 4 MiB batch budget. Export completes its audit only
50
+ after durable publication. `--dry-run` and `--apply` are exclusive. Library import:
51
+ `@creatornader/agent-bridge/archive`.
52
+ Portable v1 requires current-domain records, lowercase UUIDs, and six-digit UTC
53
+ timestamps. It does not trim, deduplicate, default, or rewrite message content.
54
+ Legacy or direct rows that fail validation require native database recovery.
55
+ Export accepts a request ID, stores it as header `exportRequestId`, and returns it.
56
+ Verify and import return the same provenance; an import request ID is independent.
57
+ Same-ID export retries verify completed files or reconcile matching started files
58
+ without streaming again. Deterministic adjacent recovery files are derived from the
59
+ export ID. Force replacement keeps a private backup until the new file is durable and
60
+ reports recovery paths plus backup, durability, and audit uncertainty.
61
+
62
+ Native DR preserves a complete local SQLite authority or shared PostgreSQL authority;
63
+ it does not translate between providers. Local DR rejects gateway edge stores.
64
+ PostgreSQL source and target URLs come only from AGENT_BRIDGE_DR_SOURCE_DATABASE_URL
65
+ and AGENT_BRIDGE_DR_TARGET_DATABASE_URL. Restore requires a dedicated fresh database
66
+ with the same name and PostgreSQL major, superuser authority, an explicit request ID,
67
+ and --accept-source-sql-risk. The backup includes role membership and default ACL state,
68
+ excludes transient request, rate-limit, instance, and archive-authorization rows, and
69
+ normalizes claimed deliveries on restore. Never run source and restored target at the
70
+ same time. The package API is @creatornader/agent-bridge/dr. Bundle hashes detect
71
+ changed bytes but do not encrypt or authenticate the source.
24
72
 
25
73
  ## MCP tools
26
74
 
75
+ - `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
+ - 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.
77
+
27
78
  Compatibility: post_context, get_context, ack_context.
28
- Reliable messaging: send, history, claim, extend, acknowledge, negative_acknowledge, heartbeat, presence.
79
+ Reliable messaging: send, history, claim, extend, acknowledge, negative_acknowledge, heartbeat, presence, sync.
80
+ 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.
81
+
82
+ 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.
83
+
84
+ ## Protocol boundary
85
+
86
+ A2A and application task semantics sit above Agent Bridge.
87
+ MCP, CLI, and HTTPS are client access surfaces.
88
+ Optional transports such as SLIM or NATS may sit below the core.
89
+ agmsg is a reference for adapters, interoperability, and client experience.
90
+ 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.
91
+ MCP and HTTP 2.1 use delivery response envelopes. The unversioned CLI and HTTP 2.0 retain direct or null delivery results.
92
+ OpenAPI paths describe 2.1. Embedded 2.0 vendor extensions provide limited compatibility schema metadata, not a second OpenAPI description.
93
+
94
+ ## Acknowledgment rules
95
+
96
+ MCP ack_context and CLI acknowledge write read receipts.
97
+ MCP acknowledge and CLI ack settle claimed deliveries.
98
+ A receipt does not settle work. Delivery settlement does not create a receipt.
99
+ Lease extension does not report progress or external task completion.
29
100
 
30
101
  ## Identity rule
31
102
 
32
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.
33
104
 
105
+ Owner commands are offline and use only AGENT_BRIDGE_OPERATOR_DATABASE_URL. They are
106
+ not MCP, HTTP, or public gateway operations. Provision and rotation write private
107
+ versioned enrollment files before calling PostgreSQL. The installer consumes the raw
108
+ token from that file without command arguments. Rotation updates the exact existing
109
+ client backend and does not repeat host registration. Enrollment operations hold an
110
+ exclusive per-file lock and use revisioned compare-and-swap transitions. Use explicit
111
+ `--recover-lock` only after a crash; recovery checks lock age, host, owner, and process
112
+ liveness. Rotation requires predecessor credential, principal, instance, gateway,
113
+ workspace, and live MCP registration matches. Consumed-file deletion and lock release
114
+ report retained, missing, durable, and durability-unknown outcomes without claiming that
115
+ an unlinked path was retained.
116
+
117
+ 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
+ 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
+
34
120
  ## References
35
121
 
36
122
  - README.md: setup, commands, security, and provider behavior
123
+ - ROADMAP.md: released, implemented, and remaining work
124
+ - SECURITY.md: reporting process and security boundaries
125
+ - docs/ecosystem.md: relationship to adjacent protocols, brokers, and runtimes
126
+ - docs/troubleshooting.md: MCP startup and client recovery
127
+ - docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md: protocol layers and acknowledgment semantics
128
+ - docs/decisions/0002-canonical-operation-contract-registry.md: generated contracts and version negotiation
37
129
  - docs/architecture-v2.md: protocol, storage, identity, delivery, and acceptance decisions
38
130
  - clients/*.json: runtime adapter manifests
39
131
  - SKILL.md: concise agent operating instructions