@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/SECURITY.md CHANGED
@@ -14,19 +14,24 @@ fixed. The npm package and GitHub release page are the public version authoritie
14
14
 
15
15
  ## Release integrity
16
16
 
17
- GitHub immutable releases are enabled, and GitHub reports release `v0.3.0` as
17
+ GitHub immutable releases are enabled, and GitHub reports release `v0.3.1` as
18
18
  immutable. A repository ruleset also blocks updates and deletion for every `v*` tag
19
- without a bypass actor. The `v0.3.0` tag is unsigned.
19
+ without a bypass actor. The `v0.3.1` tag is unsigned.
20
20
 
21
21
  npm publication uses a protected GitHub environment, an OIDC trusted-publisher
22
22
  binding, and provenance for the package artifact. Verify the package digest and
23
- attestation before treating provenance as source identity. The `v0.3.0`
23
+ attestation before treating provenance as source identity. The
24
+ [`v0.3.1` release run](https://github.com/creatornader/agent-bridge/actions/runs/29465467036)
25
+ used package commit `d17ba544d31beaa33b4955e41c3b3d4e3f141900`.
26
+
27
+ The historical `v0.3.0`
24
28
  [recovery run](https://github.com/creatornader/agent-bridge/actions/runs/29461308262)
25
29
  checked out package commit `95eb861`, while its attestation names recovery commit
26
30
  `c23d9df` as the workflow identity. GitHub Actions logs expire, so the
27
31
  [release notes](https://github.com/creatornader/agent-bridge/releases/tag/v0.3.0)
28
- also record this boundary. Future recovery dispatches must run at the release tag, and
29
- the workflow enforces that match before packaging.
32
+ also record this boundary. Recovery dispatches must run at the release tag. The
33
+ workflow also requires a successful `test.yml` run from `main` for the exact package
34
+ commit before packaging.
30
35
 
31
36
  ## Report a vulnerability
32
37
 
@@ -46,6 +51,13 @@ Local mode relies on operating-system account isolation and private file permiss
46
51
  Anyone who can act as the same operating-system user can generally read or replace that
47
52
  user's Agent Bridge state. Local mode is not a hostile multi-user boundary.
48
53
 
54
+ Managed-client mutations may cache a successful native Windows ACL check while one
55
+ operation lock remains held. The cache is bound to the verified directory identity and is
56
+ discarded with the lock. New locks, resumed operations, and passive inspection check
57
+ the ACL again. POSIX permission checks are not cached. A same-user process can still
58
+ change an ACL on an unchanged object or replace a directory with one that reuses the
59
+ same filesystem identity. Both actions are within the local-mode trust boundary.
60
+
49
61
  ### Gateway mode
50
62
 
51
63
  Gateway credentials bind one workspace and principal. The gateway derives remote
@@ -53,10 +65,54 @@ identity from the credential, applies operation scopes and rate policy, and uses
53
65
  transaction-bound PostgreSQL request authority. Production runtime roles must not be
54
66
  superusers or hold `BYPASSRLS`. Put every non-loopback gateway behind TLS.
55
67
 
68
+ Do not publish PostgreSQL on a public interface. Put it on a private network reachable
69
+ only by the migration, runtime bootstrap, gateway, backup, and recovery jobs that need
70
+ it. The checked-in Compose file binds both published ports to loopback and serves plain
71
+ HTTP for local development. It is not a public deployment template.
72
+
56
73
  Keep the schema-owner, runtime, operator, archive, backup, and restore database
57
74
  authorities separate. Do not copy one client's token or backend file into another
58
75
  client's configuration.
59
76
 
77
+ Managed PostgreSQL may expose a schema-owner administrator with `CREATEROLE` instead
78
+ of true superuser authority. That capability is sufficient for migrations. Native backup
79
+ requires the schema owner to be a true superuser or hold `BYPASSRLS`, because the source
80
+ backup must read tables protected by RLS. A restore target validates a suspended restored
81
+ schema-owner shell through its own superuser session. Agent Bridge creates internal roles with safe
82
+ defaults and fails if an existing role has elevated attributes. PostgreSQL 16 and newer
83
+ may split the schema owner's admin, inherit, and set authority across two catalog rows.
84
+ Native DR may restore the same authority as one combined bootstrap-superuser row.
85
+ Security readiness accepts only those documented grant shapes, then checks their
86
+ effective authority. Registered runtime, control, and archive logins do not receive
87
+ that exception.
88
+
89
+ The database-derived backup-reader role is `NOLOGIN` and has read-only access to Agent
90
+ Bridge tables and sequences. Only the schema owner may inherit it. The runtime role,
91
+ control and archive roles, and external principals must not hold it. Native-backup
92
+ readiness fails on a missing object grant, an added privilege, an unexpected member, or
93
+ a source schema owner without true-superuser or `BYPASSRLS` authority. A restricted
94
+ runtime login cannot validate a suspended restored schema owner.
95
+
96
+ PostgreSQL native restore does not reactivate external identities. Runtime memberships
97
+ are omitted. Active control and archive memberships are replaced by explicit revocation
98
+ events after the restored history. Re-enrollment requires a separate operator action.
99
+
100
+ Run migrations as a one-shot schema-owner job before starting a new gateway image.
101
+ Take and verify a native DR backup first. Gateway readiness checks the exact migration
102
+ plan and protected catalog state. Once a migration changes the database, starting an
103
+ older image is not a safe rollback. Apply a forward fix or restore the backup into a
104
+ fresh target and switch authority only after verification.
105
+
106
+ Drain old gateway instances before migrations 017 and 018. An old image reports `/readyz` as
107
+ not ready after the new migration is visible, but a process that was already running
108
+ can still serve ordinary requests until traffic is removed or it exits. Start the new
109
+ gateway only after the migration and runtime bootstrap finish.
110
+
111
+ Migration 018 accepts raw endpoint-migration challenges only as SQL function input. It
112
+ stores a domain-separated SHA-256 commitment, never the raw challenge, and excludes
113
+ live challenge rows from native DR data dumps. The challenge proves an active direct
114
+ credential replacement on one authority. It does not authorize endpoint cutover.
115
+
60
116
  ### Legacy Supabase mode
61
117
 
62
118
  The legacy adapter keeps existing v1 deployments working, but its publishable key can
@@ -74,6 +130,9 @@ through a separately trusted channel.
74
130
  PostgreSQL restore executes SQL from the source dump. Use
75
131
  `--accept-source-sql-risk` only for a bundle from a trusted source. Never activate the
76
132
  source and restored target as authorities at the same time.
133
+ The restored gateway authority UUID identifies the same logical authority. It does not
134
+ prevent an operator from activating a live clone, so the deployment cutover remains an
135
+ operator-controlled safety boundary.
77
136
 
78
137
  ### Optional integrations
79
138
 
@@ -86,5 +145,19 @@ when wrapper health is uncertain.
86
145
  - Pass gateway tokens through private enrollment or backend files, not shell arguments.
87
146
  - Keep database URLs in the documented environment variables. Do not put them in CLI
88
147
  arguments, logs, issues, or examples.
148
+ - Store Compose password files outside version control with owner-only permissions.
149
+ Use the deployment platform's secret manager in production. Do not bake passwords or
150
+ tokens into images, Compose environment blocks, or image layers.
151
+ - File-backed Compose secrets retain host ownership on native Linux. The development
152
+ stack starts a small Node entrypoint as root with `DAC_OVERRIDE`, `SETUID`, and
153
+ `SETGID`, reads one granted secret, then drops supplementary groups and UID/GID to
154
+ 1000 before it imports the gateway. The final process has no effective capabilities
155
+ and cannot regain them under `no-new-privileges`. The fixed runtime-bootstrap job
156
+ keeps `DAC_OVERRIDE`, `SETUID`, and `SETGID` while it reads its two secrets, then runs
157
+ `psql` as the PostgreSQL account. It rejects runtime passwords shorter than 32
158
+ characters.
89
159
  - Treat client backend files, enrollment files, archives, and DR bundles as secrets.
90
160
  - Sanitize `doctor` output and logs before sharing them publicly.
161
+
162
+ A Docker volume provides persistence, not backup. Keep verified native DR bundles on a
163
+ separate failure domain with retention and restore drills appropriate to the deployment.
package/SKILL.md CHANGED
@@ -7,6 +7,11 @@ description: Share context and reliable work between agents across runtimes and
7
7
 
8
8
  Discover the active v2 operation contract with MCP `capabilities`, CLI `agent-bridge capabilities`, or authenticated `GET /v2/capabilities`. Released 2.0 clients continue to work after the gateway is upgraded. A new 2.1 client must receive complete, consistent negotiation headers that select and advertise 2.1 before it mutates remote state. If the probe is headerless, selects 2.0, or returns partial or contradictory headers, do not mutate. Upgrade the gateway first instead of downgrading the client.
9
9
 
10
+ An authenticated PostgreSQL gateway status response can include `gatewayAuthorityId`
11
+ and `credentialId`. They are additive in HTTP 2.1. `clients migrate cutover`
12
+ requires and validates both fields before it switches a managed gateway endpoint.
13
+ Do not switch an endpoint by editing its backend file.
14
+
10
15
  Use the Agent Bridge MCP tools for normal traffic. Let the active runtime supply its own identity. Do not pass a literal source unless a standalone CLI process has no configured identity.
11
16
 
12
17
  If the MCP server is unavailable or disconnects, report the outage instead of implying
@@ -34,7 +39,11 @@ Use v2 delivery tools for executable work. MCP `ack_context` and CLI `acknowledg
34
39
 
35
40
  Publish executable work with `deliveryPolicy`; consumers never select retry limits or backoff. Leased policy accepts `maxAttempts`, `retryBaseDelayMs`, `retryMaxDelayMs`, `retryJitterRatio`, and optional `notBefore`. Untargeted messages default to mailbox mode and targeted messages to leased mode. Only publishers cancel or requeue. Publishers and recipients can inspect delivery history. Requeue starts a new cycle without resetting lifetime attempts. Consumer `maxAttempts` on claim and `retryPolicy` on nack are validated but ignored for one compatibility release. External task completion stays outside Agent Bridge.
36
41
 
37
- Claim a delivery before acting. Renew a long lease only to retain ownership. A lease extension does not report progress or success. Record external task completion through the application or A2A protocol, then settle the Agent Bridge delivery separately.
42
+ Claim a delivery before acting. Use `messageId` or CLI `--message-id` when the caller
43
+ must atomically claim one known message instead of the next due item. Renew a long
44
+ lease only to retain ownership. A lease extension does not report progress or success.
45
+ Record external task completion through the application or A2A protocol, then settle
46
+ the Agent Bridge delivery separately.
38
47
 
39
48
  Use `agent-bridge pending` as a cheap process gate before starting an agent. Exit 0 means unread candidates or due delivery work are visible. Exit 1 means the authoritative state is empty. Exit 2 means the remote state is unknown. During a gateway outage, cached unacknowledged results are degraded candidates with unknown acknowledgement state.
40
49
 
@@ -51,6 +60,104 @@ If a crash leaves the adjacent enrollment lock, wait at least 60 seconds and pas
51
60
  `--recover-lock` with the resume or install command. Recovery must prove that the
52
61
  same-host process recorded in the lock has stopped. Never remove the lock manually.
53
62
 
63
+ Before Agent Bridge takes lifecycle ownership of an existing Codex, Claude Code, or
64
+ Claude Desktop registration, run `agent-bridge clients inspect <runtime>` with its
65
+ exact `--identity`, stable `--instance`, and absolute `--backend-config` path. Supply
66
+ the installed command and Claude Code scope when they differ from defaults. Treat
67
+ `drifted` as a stop condition. `agent-bridge clients adopt` returns a plan by default;
68
+ only add `--apply` after reviewing an exact `unmanaged` result. Adoption writes
69
+ credential-free owner-private metadata only. It does not rewrite the MCP registration
70
+ or backend file, and inspection never returns backend values or contacts the gateway.
71
+ Desktop adoption records the normalized config path. Codex adoption records the active
72
+ profile config. Run Claude Code local or project adoption from the directory that
73
+ later lifecycle operations should use; the native CLI exposes no stronger target.
74
+ The backend and its immediate parent must already pass the owner-only no-link policy.
75
+ Treat registration state separately from connectivity health; applied adoption
76
+ re-inspects the registration before it reports success. Enrollment-based first-time
77
+ provisioning continues to refuse registration and backend-file collisions.
78
+ Use `agent-bridge clients operations` or append an operation UUID to inspect local
79
+ crash-safe operation state. Artifact contents remain confined to owner-private files;
80
+ inspection reports resumable, classification-required, blocked, or complete and names
81
+ the exact pending step only. Begin is lock-covered, resume is same-host only, and
82
+ ordered steps use no-replace before and verified after artifacts. Treat corrupt,
83
+ cross-host, or ambiguous state as a stop condition. Cleanup is restartable per artifact
84
+ and `committed` means verified writes plus removed artifacts. The terminal manifest
85
+ keeps a credential-free completion record but no request, step, digest, locator, or
86
+ artifact metadata.
87
+
88
+ For a managed registration, use `clients repair <runtime> --identity <name> --instance
89
+ <key>` to preview its recorded launch contract and backend privacy repair. Add `--apply`
90
+ only after reviewing the plan. Use `clients update` with the same metadata-selected
91
+ runtime and instance to validate a replacement launch contract. The same identity must
92
+ match the stored metadata and the immutable request. Native commands are one executable
93
+ contract. Do not pass arguments, URLs, or credential selectors in `--command`. Repair, update, and uninstall reject
94
+ `--backend-config`, `--scope`, and `--config-path`; `--identity` is an assertion, not a
95
+ locator. A no-op exact registration creates no journal. Native updates remove, prove
96
+ absence, add, and prove the target before metadata changes. Desktop updates replace only
97
+ the Agent Bridge entry and retain unrelated JSON values in memory. It publishes through
98
+ a private operation-scoped temporary file. A concurrent same-user Desktop writer can
99
+ still race this advisory single-file update because Node cannot provide an OS transaction.
100
+
101
+ Use `clients uninstall <runtime> --identity <name> --instance <key>` to preview a
102
+ forward-only removal. With `--apply`, it proves and removes the managed registration,
103
+ deletes the already private backend file, then deletes metadata. It refuses a backend
104
+ that needs privacy repair and never recreates an earlier target after a later failure.
105
+ Desktop removes only its Agent Bridge entry. Backend content never enters the journal.
106
+
107
+ Use `clients rollback <update-operation-id> --identity <name>` to inspect an explicit
108
+ reverse plan for a committed same-host v4 update. Add `--apply` only after reviewing
109
+ that plan. The source record retains only prior nonsecret managed metadata, its exact
110
+ registration contract, and forward-state digests. Rollback verifies those digests
111
+ against the current registration, then creates a separate reverse journal. Native
112
+ rollback removes the forward entry, adds the prior entry, and writes prior metadata
113
+ last. Claude Desktop replaces only its Agent Bridge entry and preserves unrelated JSON.
114
+ Repair has no rollback. Uninstall remains forward-only, so recovery is re-enrollment.
115
+
116
+ Use `clients migrate stage <runtime> --identity <name> --instance <key>
117
+ --enrollment-file <path>` to review a gateway successor prepared from a non-immediate
118
+ rotation enrollment. Add `--apply` only after reviewing the plan. Staging writes a
119
+ private successor backend and a credential-free operation record. It leaves the active
120
+ registration and active backend unchanged. It initializes the source edge gate but
121
+ leaves that gate active. It does not drain, cut over, or prove that two gateway URLs
122
+ reach the same database authority. The source backend must use an absolute, normalized
123
+ edge database path, not `:memory:`. Resume an interrupted stage with `clients resume
124
+ <operation-id> [--recover-lock]`. Use lock
125
+ recovery only after the recorded same-host process has stopped. Never remove a lock
126
+ manually.
127
+
128
+ Use `clients migrate cutover <stage-operation-id> --exclusive-edge` to inspect the
129
+ host switch. Add `--apply` only after checking the plan. The applied command requires
130
+ an active source edge and an active empty target edge. It verifies both HTTP 2.1
131
+ gateways against the recorded workspace, principal, credential IDs, and authority ID.
132
+ It also requires the successor `status:read` and `messages:write` grants, then completes
133
+ a direct predecessor-to-successor route challenge. Once its journal exists, it uses the
134
+ retained normalized source URL with the successor credential for route proofs and
135
+ source-edge replay through the target gateway. It leases and drains the source edge to
136
+ exact zero outbox work before changing a host registration. Native clients remove the
137
+ source and add the target. Claude Desktop replaces its one Agent Bridge entry. Managed
138
+ metadata changes last. The command rechecks gateway authority and the source lease
139
+ before each host write.
140
+
141
+ Every phase needs `--exclusive-edge`. Agent Bridge verifies the managed registrations
142
+ that share the edge file, including hardlink aliases. It cannot enumerate unmanaged
143
+ publishers, so the operator must assert that cohort is exclusive. `clients migrate
144
+ finalize <cutover-operation-id> --exclusive-edge --apply` works after
145
+ grace expires and retires the source edge. To return to a previous endpoint, rotate a
146
+ new owner credential and cut forward to it as a new successor. Resume any interrupted
147
+ v6 phase with `clients resume <operation-id> [--recover-lock]`. A new worker must wait
148
+ for the held drain lease to expire. Dry planning never contacts a gateway or writes
149
+ SQLite. It refuses an edge with live WAL sidecars rather than read stale outbox state.
150
+
151
+ Resume an action-specific operation with the same action, runtime, instance, and
152
+ identity: `--apply --resume <uuid>`. The stored request controls resume. Do not supply
153
+ a new command unless it exactly matches the recorded update request. Use
154
+ `clients resume <uuid> [--recover-lock]` to resume from a recorded v3, supported v4,
155
+ v5 migration-stage, or v6 endpoint-migration request alone. It does not accept
156
+ replacement client authority. Use the generic form after uninstall has
157
+ deleted metadata. `--recover-lock` on an action-specific command also requires
158
+ `--apply`; it only recovers a stale same-host lock after process-death proof. Never
159
+ remove operation locks by hand.
160
+
54
161
  Portable archive work is an offline operator task, not normal MCP traffic. Use
55
162
  `agent-bridge archive export --provider local|postgres --workspace <workspace>
56
163
  --output <file>` to create an archive, then run `agent-bridge archive verify --file
package/dist/archive.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { J as JsonValue, i as MessagePriority, f as DeliveryPolicy } from './bridge-domain-CBX3IVqC.js';
2
- import { P as PgQueryable } from './postgres-bridge-store-Bfd3hRId.js';
3
- import './bridge-store-DPVSCwfs.js';
2
+ import { P as PgQueryable } from './postgres-bridge-store-C9KG9Z69.js';
3
+ import './bridge-store-ByJ6CaJk.js';
4
4
 
5
5
  interface PortableArchiveMessage {
6
6
  id: string;
package/dist/archive.js CHANGED
@@ -21,8 +21,8 @@ import {
21
21
  streamPortableArchive,
22
22
  validateArchiveWorkspace,
23
23
  validatePortableArchiveRequestId
24
- } from "./chunk-A6W4QALF.js";
25
- import "./chunk-NCO7RLBM.js";
24
+ } from "./chunk-TC6A7GMF.js";
25
+ import "./chunk-GTK4KOED.js";
26
26
  import "./chunk-BZLMF5O5.js";
27
27
  export {
28
28
  PORTABLE_ARCHIVE_BATCH_BYTES,
@@ -1,4 +1,4 @@
1
- import { a as BridgeStore, I as InsertMessageResult, d as MessageQuery, M as MessagePage, c as DeliveryQuery, b as DeliveryPage, D as DeliveryEventPage } from './bridge-store-DPVSCwfs.js';
1
+ import { a as BridgeStore, I as InsertMessageResult, d as MessageQuery, M as MessagePage, c as DeliveryQuery, b as DeliveryPage, D as DeliveryEventPage } from './bridge-store-ByJ6CaJk.js';
2
2
  import { c as BridgePrincipal, M as MessageDraft, B as BridgeDelivery, A as AgentPresence } from './bridge-domain-CBX3IVqC.js';
3
3
 
4
4
  type PublicMessageQuery = MessageQuery & {
@@ -12,6 +12,7 @@ declare class BridgeService {
12
12
  acknowledge(principalInput: BridgePrincipal, messageIds: string[]): Promise<number>;
13
13
  claim(principalInput: BridgePrincipal, options?: {
14
14
  leaseMs?: number;
15
+ messageId?: string;
15
16
  maxAttempts?: number;
16
17
  }): Promise<{
17
18
  delivery: BridgeDelivery;
@@ -35,6 +35,8 @@ interface BridgeDiagnostics {
35
35
  expiredLeases?: number | null;
36
36
  oldestDueAt?: string;
37
37
  queueLagMs?: number | null;
38
+ gatewayAuthorityId?: string;
39
+ credentialId?: string;
38
40
  principal?: {
39
41
  workspace: string;
40
42
  agent: string;
@@ -42,6 +44,7 @@ interface BridgeDiagnostics {
42
44
  }
43
45
  interface ClaimOptions {
44
46
  leaseMs: number;
47
+ messageId?: string;
45
48
  now?: Date;
46
49
  maxAttempts?: number;
47
50
  }
package/dist/bridge.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  import { b as BridgeMessage, c as BridgePrincipal, B as BridgeDelivery, R as RetryPolicy, A as AgentPresence } from './bridge-domain-CBX3IVqC.js';
2
2
  export { a as BridgeDeliveryEvent, d as BridgePrincipalMismatchError, e as BridgeValidationError, D as DeliveryAction, f as DeliveryPolicy, g as DeliveryState, h as DeliveryStateConflictError, J as JsonValue, L as LeasedDeliveryPolicy, M as MessageDraft, i as MessagePriority, j as cursorScope, k as decodeCursor, l as decodeScopedCursor, m as encodeCursor, n as encodeScopedCursor, s as scopedCursorScope, u as uuidv7, v as validateDeliveryCursorPosition, o as validateDeliveryPolicy, p as validateEventCursorPosition, q as validateLeasedDeliveryPolicy, r as validateMessageDraft, t as validatePrincipal, w as validateProject, x as validateUuid } from './bridge-domain-CBX3IVqC.js';
3
- import { a as BridgeStore, I as InsertMessageResult, d as MessageQuery, M as MessagePage, C as ClaimOptions, B as BridgeDiagnostics, c as DeliveryQuery } from './bridge-store-DPVSCwfs.js';
4
- export { D as DeliveryEventPage, b as DeliveryPage } from './bridge-store-DPVSCwfs.js';
5
- export { B as BridgeService, P as PublicMessageQuery } from './bridge-service-hX1ZQp4W.js';
6
- import { P as PgQueryable } from './postgres-bridge-store-Bfd3hRId.js';
7
- export { a as PgTransactionClient, b as PostgresBridgeStore } from './postgres-bridge-store-Bfd3hRId.js';
8
- export { A as AuthenticatedCredential, C as CredentialResolver, G as GatewayOptions, P as PostgresCredentialResolver, b as bearerToken, c as createGateway, h as hashCredential, s as safeTokenHashEqual } from './gateway-CggQ8vTC.js';
9
- export { CachedMessagePage, EdgeConflictError, EdgeEnqueueResult, EdgeOutboxRecord, EdgeScope, EdgeStats, PendingMessage, SQLiteBridgeStore, SQLiteEdgeStore, SyncDiagnostics, SyncInsertResult, SyncReport, SyncingBridgeStore, SyncingBridgeStoreOptions, edgeMessageFingerprint, edgeScopeKey, isRetryableSyncError, stableIdempotency } from './sqlite.js';
3
+ import { a as BridgeStore, I as InsertMessageResult, d as MessageQuery, M as MessagePage, C as ClaimOptions, B as BridgeDiagnostics, c as DeliveryQuery } from './bridge-store-ByJ6CaJk.js';
4
+ export { D as DeliveryEventPage, b as DeliveryPage } from './bridge-store-ByJ6CaJk.js';
5
+ export { B as BridgeService, P as PublicMessageQuery } from './bridge-service-CNBKdYXh.js';
6
+ import { P as PgQueryable } from './postgres-bridge-store-C9KG9Z69.js';
7
+ export { a as PgTransactionClient, b as PostgresBridgeStore } from './postgres-bridge-store-C9KG9Z69.js';
8
+ export { A as AuthenticatedCredential, C as CredentialResolver, G as GatewayOptions, P as PostgresCredentialResolver, b as bearerToken, c as createGateway, h as hashCredential, s as safeTokenHashEqual } from './gateway-CW-61lvs.js';
9
+ export { E as EdgeConflictError, a as EdgeDrainLease, b as EdgeEnqueueResult, c as EdgeMigrationDrainingError, d as EdgeMigrationGate, e as EdgeMigrationGateState, f as EdgeMigrationLeaseError, g as EdgeMigrationRetiredError, h as EdgeOutboxRecord, i as EdgeReadOnlyInspection, j as EdgeScope, k as EdgeStats, P as PendingMessage, S as SQLiteEdgeStore, l as edgeMessageFingerprint, m as edgeScopeKey, n as inspectEdgeScopeReadOnly, s as stableIdempotency } from './sqlite-edge-store-CdMIOrho.js';
10
+ export { CachedMessagePage, SQLiteBridgeStore, SyncDiagnostics, SyncInsertResult, SyncReport, SyncingBridgeStore, SyncingBridgeStoreOptions, isRetryableSyncError } from './sqlite.js';
10
11
  import 'node:http';
11
12
 
12
13
  declare class LegacySupabaseError extends Error {
@@ -101,6 +102,7 @@ interface AppliedMigration {
101
102
  interface MigrationPlanEntry extends AppliedMigration {
102
103
  source: string;
103
104
  }
105
+ declare function migrationRecordMatches(recorded: Pick<AppliedMigration, "version" | "name" | "checksum">, required: Pick<AppliedMigration, "version" | "name" | "checksum">): boolean;
104
106
  declare const REQUIRED_MIGRATIONS: readonly [{
105
107
  readonly version: 1;
106
108
  readonly name: "schema_state";
@@ -149,6 +151,21 @@ declare const REQUIRED_MIGRATIONS: readonly [{
149
151
  }, {
150
152
  readonly version: 16;
151
153
  readonly name: "native_dr_fence";
154
+ }, {
155
+ readonly version: 17;
156
+ readonly name: "gateway_authority_binding";
157
+ }, {
158
+ readonly version: 18;
159
+ readonly name: "endpoint_migration_challenges";
160
+ }, {
161
+ readonly version: 19;
162
+ readonly name: "endpoint_migration_same_successor";
163
+ }, {
164
+ readonly version: 20;
165
+ readonly name: "managed_authority_compat";
166
+ }, {
167
+ readonly version: 21;
168
+ readonly name: "native_backup_reader";
152
169
  }];
153
170
  declare function loadMigrationPlan(directory: string): Promise<MigrationPlanEntry[]>;
154
171
  declare function migrationsReady(db: PgQueryable, expected: ReadonlyArray<Pick<MigrationPlanEntry, "version" | "name" | "checksum">>): Promise<boolean>;
@@ -158,4 +175,4 @@ declare function runtimeSchemaReady(db: PgQueryable, options?: {
158
175
  }): Promise<boolean>;
159
176
  declare function runMigrations(db: PgQueryable, directory: string): Promise<AppliedMigration[]>;
160
177
 
161
- export { AgentPresence, type AppliedMigration, BridgeDelivery, BridgeDiagnostics, BridgeHttpError, BridgeMessage, BridgePrincipal, BridgeStore, ClaimOptions, DeliveryQuery, HttpBridgeStore, type HttpBridgeStoreOptions, InsertMessageResult, LegacySupabaseError, LegacySupabaseRestStore, MessagePage, MessageQuery, type MigrationPlanEntry, NATIVE_DR_ADVISORY_LOCK_KEY, PgQueryable, REQUIRED_MIGRATIONS, RetryPolicy, loadMigrationPlan, migrationsReady, rowIsolationReady, runMigrations, runtimeSchemaReady };
178
+ export { AgentPresence, type AppliedMigration, BridgeDelivery, BridgeDiagnostics, BridgeHttpError, BridgeMessage, BridgePrincipal, BridgeStore, ClaimOptions, DeliveryQuery, HttpBridgeStore, type HttpBridgeStoreOptions, InsertMessageResult, LegacySupabaseError, LegacySupabaseRestStore, MessagePage, MessageQuery, type MigrationPlanEntry, NATIVE_DR_ADVISORY_LOCK_KEY, PgQueryable, REQUIRED_MIGRATIONS, RetryPolicy, loadMigrationPlan, migrationRecordMatches, migrationsReady, rowIsolationReady, runMigrations, runtimeSchemaReady };
package/dist/bridge.js CHANGED
@@ -4,32 +4,37 @@ import {
4
4
  HttpBridgeStore,
5
5
  LegacySupabaseError,
6
6
  LegacySupabaseRestStore
7
- } from "./chunk-CEXBMOI5.js";
7
+ } from "./chunk-Z6JP6MYD.js";
8
8
  import {
9
9
  EdgeConflictError,
10
+ EdgeMigrationDrainingError,
11
+ EdgeMigrationLeaseError,
12
+ EdgeMigrationRetiredError,
10
13
  SQLiteEdgeStore,
11
14
  SyncingBridgeStore,
12
15
  edgeMessageFingerprint,
13
16
  edgeScopeKey,
17
+ inspectEdgeScopeReadOnly,
14
18
  isRetryableSyncError,
15
19
  stableIdempotency
16
- } from "./chunk-Q6PPMXJC.js";
20
+ } from "./chunk-SN7PIVDF.js";
17
21
  import {
18
22
  SQLiteBridgeStore
19
- } from "./chunk-5GMB3A77.js";
20
- import "./chunk-NCO7RLBM.js";
23
+ } from "./chunk-IVG4XWWS.js";
24
+ import "./chunk-GTK4KOED.js";
21
25
  import {
22
26
  PostgresBridgeStore
23
- } from "./chunk-2DFNOLMO.js";
27
+ } from "./chunk-XDNT6ZNZ.js";
24
28
  import {
25
29
  NATIVE_DR_ADVISORY_LOCK_KEY,
26
30
  REQUIRED_MIGRATIONS,
27
31
  loadMigrationPlan,
32
+ migrationRecordMatches,
28
33
  migrationsReady,
29
34
  rowIsolationReady,
30
35
  runMigrations,
31
36
  runtimeSchemaReady
32
- } from "./chunk-45BZGB77.js";
37
+ } from "./chunk-QNXHDOJ5.js";
33
38
  import "./chunk-VOQIDTCJ.js";
34
39
  import {
35
40
  PostgresCredentialResolver,
@@ -37,11 +42,11 @@ import {
37
42
  createGateway,
38
43
  hashCredential,
39
44
  safeTokenHashEqual
40
- } from "./chunk-WAI2IYIQ.js";
45
+ } from "./chunk-P635FAN4.js";
41
46
  import {
42
47
  BridgeService
43
- } from "./chunk-4VB44KJU.js";
44
- import "./chunk-GADH244D.js";
48
+ } from "./chunk-AWE3DFZV.js";
49
+ import "./chunk-E4OWHGUE.js";
45
50
  import {
46
51
  BridgePrincipalMismatchError,
47
52
  BridgeValidationError,
@@ -69,6 +74,9 @@ export {
69
74
  BridgeValidationError,
70
75
  DeliveryStateConflictError,
71
76
  EdgeConflictError,
77
+ EdgeMigrationDrainingError,
78
+ EdgeMigrationLeaseError,
79
+ EdgeMigrationRetiredError,
72
80
  HttpBridgeStore,
73
81
  LegacySupabaseError,
74
82
  LegacySupabaseRestStore,
@@ -89,8 +97,10 @@ export {
89
97
  encodeCursor,
90
98
  encodeScopedCursor,
91
99
  hashCredential,
100
+ inspectEdgeScopeReadOnly,
92
101
  isRetryableSyncError,
93
102
  loadMigrationPlan,
103
+ migrationRecordMatches,
94
104
  migrationsReady,
95
105
  rowIsolationReady,
96
106
  runMigrations,