@creatornader/agent-bridge 0.5.2 → 0.6.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.
- package/CHANGELOG.md +41 -1
- package/README.md +34 -31
- package/ROADMAP.md +56 -15
- package/SECURITY.md +6 -5
- package/dist/archive.d.ts +2 -2
- package/dist/{bridge-service-CNBKdYXh.d.ts → bridge-service-DjSYfjKt.d.ts} +4 -2
- package/dist/{bridge-store-ByJ6CaJk.d.ts → bridge-store-Bi_LCX8e.d.ts} +5 -1
- package/dist/bridge.d.ts +9 -37
- package/dist/bridge.js +6 -10
- package/dist/chunk-23UDQZMT.js +54 -0
- package/dist/chunk-23UDQZMT.js.map +1 -0
- package/dist/{chunk-AWE3DFZV.js → chunk-4V2PFJEF.js} +11 -4
- package/dist/chunk-4V2PFJEF.js.map +1 -0
- package/dist/{chunk-E4OWHGUE.js → chunk-62C63PIE.js} +8 -8
- package/dist/chunk-62C63PIE.js.map +1 -0
- package/dist/{chunk-HUHG7XTB.js → chunk-AIALYLGQ.js} +30 -193
- package/dist/chunk-AIALYLGQ.js.map +1 -0
- package/dist/{chunk-JUTJRAMA.js → chunk-FGERNG4X.js} +3 -3
- package/dist/{chunk-7VJI2MXI.js → chunk-IF5OKPBK.js} +32 -14
- package/dist/chunk-IF5OKPBK.js.map +1 -0
- package/dist/{chunk-QPC6JHA3.js → chunk-IMJ47WO4.js} +12 -16
- package/dist/chunk-IMJ47WO4.js.map +1 -0
- package/dist/{chunk-2EVLG3YA.js → chunk-UKFRCP6X.js} +10 -7
- package/dist/chunk-UKFRCP6X.js.map +1 -0
- package/dist/chunk-WQ4I5XGF.js +242 -0
- package/dist/chunk-WQ4I5XGF.js.map +1 -0
- package/dist/{chunk-SN7PIVDF.js → chunk-ZUZ7TCIH.js} +13 -1
- package/dist/{chunk-SN7PIVDF.js.map → chunk-ZUZ7TCIH.js.map} +1 -1
- package/dist/cli.js +41 -34
- package/dist/cli.js.map +1 -1
- package/dist/client-config.d.ts +1 -1
- package/dist/client-config.js +1 -1
- package/dist/client-runtime.d.ts +3 -3
- package/dist/client-runtime.js +5 -5
- package/dist/contracts/generate.js +2 -3
- package/dist/contracts/generate.js.map +1 -1
- package/dist/dr.d.ts +8 -0
- package/dist/dr.js +1 -1
- package/dist/{gateway-CW-61lvs.d.ts → gateway-BqmcKam8.d.ts} +2 -2
- package/dist/gateway-main.js +3 -3
- package/dist/gateway.d.ts +3 -3
- package/dist/gateway.js +3 -3
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/{postgres-bridge-store-C9KG9Z69.d.ts → postgres-bridge-store-ChoOuFEY.d.ts} +1 -1
- package/dist/server.d.ts +0 -2
- package/dist/server.js +8 -7
- package/dist/{sqlite-edge-store-CdMIOrho.d.ts → sqlite-edge-store-BAFUeysk.d.ts} +1 -1
- package/dist/sqlite.d.ts +7 -3
- package/dist/sqlite.js +1 -1
- package/docs/architecture-v2.md +22 -14
- package/docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md +2 -1
- package/docs/decisions/0002-canonical-operation-contract-registry.md +6 -1
- package/docs/decisions/0005-retire-direct-supabase-runtime.md +52 -0
- package/docs/deployment.md +17 -12
- package/docs/ecosystem.md +6 -4
- package/docs/troubleshooting.md +15 -0
- package/llms.txt +3 -3
- package/openapi/agent-bridge-v2.openapi.json +3 -6
- package/package.json +3 -3
- package/schemas/agent-bridge-v2.capabilities.json +4 -5
- package/schemas/agent-bridge-v2.mcp.json +6 -12
- package/schemas/agent-bridge-v2.schema.json +12 -24
- package/dist/chunk-2EVLG3YA.js.map +0 -1
- package/dist/chunk-7VJI2MXI.js.map +0 -1
- package/dist/chunk-AWE3DFZV.js.map +0 -1
- package/dist/chunk-E4OWHGUE.js.map +0 -1
- package/dist/chunk-HUHG7XTB.js.map +0 -1
- package/dist/chunk-QPC6JHA3.js.map +0 -1
- package/dist/chunk-Z6JP6MYD.js +0 -584
- package/dist/chunk-Z6JP6MYD.js.map +0 -1
- /package/dist/{chunk-JUTJRAMA.js.map → chunk-FGERNG4X.js.map} +0 -0
package/docs/ecosystem.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Agent Bridge in the agent ecosystem
|
|
2
2
|
|
|
3
|
-
Agent Bridge
|
|
4
|
-
|
|
5
|
-
read receipts, delivery claims, leases, retries, and replay state.
|
|
6
|
-
full agent stack.
|
|
3
|
+
Agent Bridge lets agents exchange messages and hand off work across tools, sessions,
|
|
4
|
+
and machines. It preserves each inbox through disconnections and restarts. It stores
|
|
5
|
+
immutable messages, read receipts, delivery claims, leases, retries, and replay state.
|
|
6
|
+
It does not own the full agent stack.
|
|
7
7
|
|
|
8
8
|
## System boundaries
|
|
9
9
|
|
|
@@ -21,6 +21,8 @@ defines the protocol boundary and the separate meanings of read receipts, delive
|
|
|
21
21
|
settlement, and external task completion.
|
|
22
22
|
[ADR-0003](decisions/0003-host-adapters-and-consumer-instance-keys.md) defines
|
|
23
23
|
the host layers and consumer instance-key contract.
|
|
24
|
+
[ADR-0005](decisions/0005-retire-direct-supabase-runtime.md) keeps Supabase as a
|
|
25
|
+
PostgreSQL hosting option while removing its direct runtime adapter.
|
|
24
26
|
|
|
25
27
|
## Harnesses, hosts, adapters, and access
|
|
26
28
|
|
package/docs/troubleshooting.md
CHANGED
|
@@ -81,6 +81,21 @@ Queued sends retain their idempotency keys. Long-lived MCP clients retry them, a
|
|
|
81
81
|
`agent-bridge sync` triggers the same bounded replay manually. Claims, lease changes,
|
|
82
82
|
delivery settlement, presence, and read-receipt writes still require the gateway.
|
|
83
83
|
|
|
84
|
+
## Legacy Supabase provider was removed
|
|
85
|
+
|
|
86
|
+
Agent Bridge 0.6.0 rejects `legacy`, `supabase`, `legacy-supabase`, and key-only
|
|
87
|
+
configurations. These names selected the direct PostgREST adapter in older releases.
|
|
88
|
+
Choose local mode for one machine or create a principal-bound gateway backend:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
agent-bridge init --provider local
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Do not point new clients at `public.shared_context`. If the old table still contains
|
|
95
|
+
data that has not been migrated, preserve it and follow the historical import and
|
|
96
|
+
reconciliation steps in the
|
|
97
|
+
[README](../README.md#upgrading-historical-supabase-deployments).
|
|
98
|
+
|
|
84
99
|
## Migration gate reported by status or doctor
|
|
85
100
|
|
|
86
101
|
`clients migrate stage` does not begin a drain. `clients migrate cutover
|
package/llms.txt
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Repository: https://github.com/creatornader/agent-bridge
|
|
4
4
|
Package: @creatornader/agent-bridge
|
|
5
5
|
|
|
6
|
-
Agent Bridge
|
|
6
|
+
Agent Bridge lets AI agents send messages and hand off work across tools, sessions, and machines. Messages survive restarts and offline periods, and each agent resumes from its own inbox.
|
|
7
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
8
|
|
|
9
9
|
## Install
|
|
@@ -29,7 +29,6 @@ services can call the CLI or HTTPS API or embed the Node library without a host
|
|
|
29
29
|
|
|
30
30
|
- local: SQLite WAL, no account or daemon
|
|
31
31
|
- gateway: authenticated HTTPS, PostgreSQL authority, SQLite edge outbox and cache
|
|
32
|
-
- legacy-supabase: compatibility with the v1 shared_context schema
|
|
33
32
|
|
|
34
33
|
## Commands
|
|
35
34
|
|
|
@@ -190,7 +189,7 @@ sidecars rather than read uncheckpointed outbox state. Resume uses only the reta
|
|
|
190
189
|
request and waits for an unexpired drain lease instead of taking it over.
|
|
191
190
|
|
|
192
191
|
Project is an optional immutable message label, not a tenant or identity selector. Omitted project reads include labeled and unlabeled messages. Exact project filters are supported by CLI, MCP, HTTP, and stores. Gateway workspace assertions must match the bound credential before network access.
|
|
193
|
-
Local CLI calls may override workspace for one invocation.
|
|
192
|
+
Local CLI calls may override workspace for one invocation. Agent Bridge 0.6.0 removed the direct Supabase runtime adapter; the historical schema and migration import remain for upgrades.
|
|
194
193
|
|
|
195
194
|
## References
|
|
196
195
|
|
|
@@ -203,6 +202,7 @@ Local CLI calls may override workspace for one invocation. The legacy Supabase s
|
|
|
203
202
|
- docs/decisions/0001-protocol-layers-and-acknowledgment-semantics.md: protocol layers and acknowledgment semantics
|
|
204
203
|
- docs/decisions/0002-canonical-operation-contract-registry.md: generated contracts and version negotiation
|
|
205
204
|
- docs/decisions/0003-host-adapters-and-consumer-instance-keys.md: host layers and instance-key semantics
|
|
205
|
+
- docs/decisions/0005-retire-direct-supabase-runtime.md: runtime-provider retirement and migration boundary
|
|
206
206
|
- docs/architecture-v2.md: protocol, storage, identity, delivery, and acceptance decisions
|
|
207
207
|
- clients/*.json: v1 host-adapter manifests; `runtime` is the compatibility key for the installation target
|
|
208
208
|
- SKILL.md: concise agent operating instructions
|
|
@@ -331,8 +331,7 @@
|
|
|
331
331
|
"enum": [
|
|
332
332
|
"scoped-credential",
|
|
333
333
|
"credential-wide",
|
|
334
|
-
"process-identity"
|
|
335
|
-
"legacy-key"
|
|
334
|
+
"process-identity"
|
|
336
335
|
]
|
|
337
336
|
},
|
|
338
337
|
"surface": {
|
|
@@ -345,8 +344,7 @@
|
|
|
345
344
|
"provider": {
|
|
346
345
|
"enum": [
|
|
347
346
|
"local",
|
|
348
|
-
"gateway"
|
|
349
|
-
"legacy-supabase"
|
|
347
|
+
"gateway"
|
|
350
348
|
]
|
|
351
349
|
},
|
|
352
350
|
"grantedScopes": {
|
|
@@ -849,8 +847,7 @@
|
|
|
849
847
|
"schemaVersion": {
|
|
850
848
|
"enum": [
|
|
851
849
|
"local-v2",
|
|
852
|
-
"postgres-v2"
|
|
853
|
-
"legacy-v1"
|
|
850
|
+
"postgres-v2"
|
|
854
851
|
]
|
|
855
852
|
},
|
|
856
853
|
"deliverySupported": {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creatornader/agent-bridge",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Messaging and work delivery for AI agents across tools, sessions, and machines.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Nader Helmy",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"pretest": "npm run build",
|
|
88
88
|
"test": "vitest run",
|
|
89
89
|
"test:built": "vitest run",
|
|
90
|
-
"test:postgres:contract": "vitest run test/postgres_integration.test.ts --maxWorkers=1 --hookTimeout=60000",
|
|
90
|
+
"test:postgres:contract": "vitest run test/postgres_integration.test.ts --maxWorkers=1 --testTimeout=30000 --hookTimeout=60000",
|
|
91
91
|
"test:postgres:preflight": "node scripts/postgres-preflight.mjs",
|
|
92
92
|
"test:postgres:preflight:full": "node scripts/postgres-preflight.mjs --full",
|
|
93
93
|
"preflight:postgres:production": "npm run build --silent && node dist/postgres-production-preflight.js",
|
|
@@ -70,8 +70,7 @@
|
|
|
70
70
|
"enum": [
|
|
71
71
|
"scoped-credential",
|
|
72
72
|
"credential-wide",
|
|
73
|
-
"process-identity"
|
|
74
|
-
"legacy-key"
|
|
73
|
+
"process-identity"
|
|
75
74
|
]
|
|
76
75
|
},
|
|
77
76
|
"surface": {
|
|
@@ -84,8 +83,7 @@
|
|
|
84
83
|
"provider": {
|
|
85
84
|
"enum": [
|
|
86
85
|
"local",
|
|
87
|
-
"gateway"
|
|
88
|
-
"legacy-supabase"
|
|
86
|
+
"gateway"
|
|
89
87
|
]
|
|
90
88
|
},
|
|
91
89
|
"grantedScopes": {
|
|
@@ -219,7 +217,8 @@
|
|
|
219
217
|
"retry-max-ms",
|
|
220
218
|
"retry-jitter",
|
|
221
219
|
"not-before",
|
|
222
|
-
"message-id"
|
|
220
|
+
"message-id",
|
|
221
|
+
"queue-only"
|
|
223
222
|
],
|
|
224
223
|
"outputSchema": {
|
|
225
224
|
"type": "object",
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
"protocolVersion": "2.1",
|
|
4
4
|
"scopeEnforcementByProvider": {
|
|
5
5
|
"local": false,
|
|
6
|
-
"gateway": true
|
|
7
|
-
"legacy-supabase": false
|
|
6
|
+
"gateway": true
|
|
8
7
|
},
|
|
9
8
|
"tools": [
|
|
10
9
|
{
|
|
@@ -59,8 +58,7 @@
|
|
|
59
58
|
"enum": [
|
|
60
59
|
"scoped-credential",
|
|
61
60
|
"credential-wide",
|
|
62
|
-
"process-identity"
|
|
63
|
-
"legacy-key"
|
|
61
|
+
"process-identity"
|
|
64
62
|
]
|
|
65
63
|
},
|
|
66
64
|
"surface": {
|
|
@@ -73,8 +71,7 @@
|
|
|
73
71
|
"provider": {
|
|
74
72
|
"enum": [
|
|
75
73
|
"local",
|
|
76
|
-
"gateway"
|
|
77
|
-
"legacy-supabase"
|
|
74
|
+
"gateway"
|
|
78
75
|
]
|
|
79
76
|
},
|
|
80
77
|
"grantedScopes": {
|
|
@@ -118,8 +115,7 @@
|
|
|
118
115
|
"requiredScopes": [],
|
|
119
116
|
"providers": [
|
|
120
117
|
"local",
|
|
121
|
-
"gateway"
|
|
122
|
-
"legacy-supabase"
|
|
118
|
+
"gateway"
|
|
123
119
|
]
|
|
124
120
|
},
|
|
125
121
|
{
|
|
@@ -387,8 +383,7 @@
|
|
|
387
383
|
],
|
|
388
384
|
"providers": [
|
|
389
385
|
"local",
|
|
390
|
-
"gateway"
|
|
391
|
-
"legacy-supabase"
|
|
386
|
+
"gateway"
|
|
392
387
|
]
|
|
393
388
|
},
|
|
394
389
|
{
|
|
@@ -627,8 +622,7 @@
|
|
|
627
622
|
],
|
|
628
623
|
"providers": [
|
|
629
624
|
"local",
|
|
630
|
-
"gateway"
|
|
631
|
-
"legacy-supabase"
|
|
625
|
+
"gateway"
|
|
632
626
|
]
|
|
633
627
|
},
|
|
634
628
|
{
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
"protocolVersion": "2.1",
|
|
6
6
|
"scopeEnforcementByProvider": {
|
|
7
7
|
"local": false,
|
|
8
|
-
"gateway": true
|
|
9
|
-
"legacy-supabase": false
|
|
8
|
+
"gateway": true
|
|
10
9
|
},
|
|
11
10
|
"$defs": {
|
|
12
11
|
"ErrorEnvelope": {
|
|
@@ -320,8 +319,7 @@
|
|
|
320
319
|
"enum": [
|
|
321
320
|
"scoped-credential",
|
|
322
321
|
"credential-wide",
|
|
323
|
-
"process-identity"
|
|
324
|
-
"legacy-key"
|
|
322
|
+
"process-identity"
|
|
325
323
|
]
|
|
326
324
|
},
|
|
327
325
|
"surface": {
|
|
@@ -334,8 +332,7 @@
|
|
|
334
332
|
"provider": {
|
|
335
333
|
"enum": [
|
|
336
334
|
"local",
|
|
337
|
-
"gateway"
|
|
338
|
-
"legacy-supabase"
|
|
335
|
+
"gateway"
|
|
339
336
|
]
|
|
340
337
|
},
|
|
341
338
|
"grantedScopes": {
|
|
@@ -420,8 +417,7 @@
|
|
|
420
417
|
"enum": [
|
|
421
418
|
"scoped-credential",
|
|
422
419
|
"credential-wide",
|
|
423
|
-
"process-identity"
|
|
424
|
-
"legacy-key"
|
|
420
|
+
"process-identity"
|
|
425
421
|
]
|
|
426
422
|
},
|
|
427
423
|
"surface": {
|
|
@@ -434,8 +430,7 @@
|
|
|
434
430
|
"provider": {
|
|
435
431
|
"enum": [
|
|
436
432
|
"local",
|
|
437
|
-
"gateway"
|
|
438
|
-
"legacy-supabase"
|
|
433
|
+
"gateway"
|
|
439
434
|
]
|
|
440
435
|
},
|
|
441
436
|
"grantedScopes": {
|
|
@@ -495,8 +490,7 @@
|
|
|
495
490
|
"schemaVersion": {
|
|
496
491
|
"enum": [
|
|
497
492
|
"local-v2",
|
|
498
|
-
"postgres-v2"
|
|
499
|
-
"legacy-v1"
|
|
493
|
+
"postgres-v2"
|
|
500
494
|
]
|
|
501
495
|
},
|
|
502
496
|
"deliverySupported": {
|
|
@@ -780,8 +774,7 @@
|
|
|
780
774
|
"provider": {
|
|
781
775
|
"enum": [
|
|
782
776
|
"local",
|
|
783
|
-
"gateway"
|
|
784
|
-
"legacy-supabase"
|
|
777
|
+
"gateway"
|
|
785
778
|
]
|
|
786
779
|
},
|
|
787
780
|
"workspace": {
|
|
@@ -803,8 +796,7 @@
|
|
|
803
796
|
"schemaVersion": {
|
|
804
797
|
"enum": [
|
|
805
798
|
"local-v2",
|
|
806
|
-
"postgres-v2"
|
|
807
|
-
"legacy-v1"
|
|
799
|
+
"postgres-v2"
|
|
808
800
|
]
|
|
809
801
|
},
|
|
810
802
|
"endpoint": {
|
|
@@ -854,8 +846,7 @@
|
|
|
854
846
|
"schemaVersion": {
|
|
855
847
|
"enum": [
|
|
856
848
|
"local-v2",
|
|
857
|
-
"postgres-v2"
|
|
858
|
-
"legacy-v1"
|
|
849
|
+
"postgres-v2"
|
|
859
850
|
]
|
|
860
851
|
},
|
|
861
852
|
"deliverySupported": {
|
|
@@ -1161,8 +1152,7 @@
|
|
|
1161
1152
|
"provider": {
|
|
1162
1153
|
"enum": [
|
|
1163
1154
|
"local",
|
|
1164
|
-
"gateway"
|
|
1165
|
-
"legacy-supabase"
|
|
1155
|
+
"gateway"
|
|
1166
1156
|
]
|
|
1167
1157
|
},
|
|
1168
1158
|
"workspace": {
|
|
@@ -1184,8 +1174,7 @@
|
|
|
1184
1174
|
"schemaVersion": {
|
|
1185
1175
|
"enum": [
|
|
1186
1176
|
"local-v2",
|
|
1187
|
-
"postgres-v2"
|
|
1188
|
-
"legacy-v1"
|
|
1177
|
+
"postgres-v2"
|
|
1189
1178
|
]
|
|
1190
1179
|
},
|
|
1191
1180
|
"endpoint": {
|
|
@@ -1235,8 +1224,7 @@
|
|
|
1235
1224
|
"schemaVersion": {
|
|
1236
1225
|
"enum": [
|
|
1237
1226
|
"local-v2",
|
|
1238
|
-
"postgres-v2"
|
|
1239
|
-
"legacy-v1"
|
|
1227
|
+
"postgres-v2"
|
|
1240
1228
|
]
|
|
1241
1229
|
},
|
|
1242
1230
|
"deliverySupported": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client-config.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { BridgePrincipal } from \"./bridge-domain.js\";\n\nexport type ClientProvider = \"local\" | \"gateway\" | \"legacy-supabase\";\n\nexport interface ClientEnvironment extends NodeJS.ProcessEnv {\n AGENT_BRIDGE_PROVIDER?: string;\n AGENT_BRIDGE_URL?: string;\n AGENT_BRIDGE_KEY?: string;\n AGENT_BRIDGE_TOKEN?: string;\n AGENT_BRIDGE_AGENT?: string;\n AGENT_BRIDGE_WORKSPACE?: string;\n AGENT_BRIDGE_INSTANCE?: string;\n AGENT_BRIDGE_DB?: string;\n AGENT_BRIDGE_EDGE_DB?: string;\n AGENT_BRIDGE_CONFIG?: string;\n AGENT_BRIDGE_CURSOR?: string;\n}\n\nexport interface ClientConfig {\n provider: ClientProvider;\n principal: BridgePrincipal;\n url?: string;\n credential?: string;\n databasePath: string;\n edgeDatabasePath: string;\n cursorPath: string;\n configPath: string;\n}\n\nfunction pathComponent(value: string): string {\n const readable = value.replace(/[^A-Za-z0-9._-]+/g, \"_\").slice(0, 48) || \"_\";\n const suffix = createHash(\"sha256\").update(value).digest(\"hex\").slice(0, 12);\n return `${readable}-${suffix}`;\n}\n\nfunction clean(value: string | undefined): string | undefined {\n return value?.trim() || undefined;\n}\n\nfunction unquote(value: string): string {\n const input = value.trim();\n if (input.length > 1 && ((input[0] === '\"' && input[input.length - 1] === '\"') || (input[0] === \"'\" && input[input.length - 1] === \"'\"))) return input.slice(1, -1);\n return input;\n}\n\nexport function readClientConfigFile(path: string): Record<string, string> {\n if (!existsSync(path)) return {};\n const result: Record<string, string> = {};\n for (const raw of readFileSync(path, \"utf8\").split(/\\r?\\n/)) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\")) continue;\n const separator = line.indexOf(\"=\");\n if (separator > 0) result[line.slice(0, separator).trim()] = unquote(line.slice(separator + 1));\n }\n return result;\n}\n\nexport function resolveClientConfig(\n env: ClientEnvironment = process.env,\n explicitAgent?: string,\n): ClientConfig {\n const home = clean(env.HOME) ?? homedir();\n const configPath = clean(env.AGENT_BRIDGE_CONFIG) ?? join(home, \".agent-bridge\", \"config\");\n const file = readClientConfigFile(configPath);\n const value = (key: keyof ClientEnvironment) => clean(env[key]) ?? clean(file[key]);\n const rawProvider = value(\"AGENT_BRIDGE_PROVIDER\") ?? (value(\"AGENT_BRIDGE_TOKEN\") ? \"gateway\" : value(\"AGENT_BRIDGE_URL\") ? \"legacy-supabase\" : \"local\");\n const provider = rawProvider === \"legacy\" || rawProvider === \"supabase\" ? \"legacy-supabase\" : rawProvider;\n if (!([\"local\", \"gateway\", \"legacy-supabase\"] as string[]).includes(provider)) throw new Error(`Unsupported AGENT_BRIDGE_PROVIDER: ${rawProvider}`);\n // Identity belongs to the active client process. A shared config file must\n // never make one runtime impersonate the client that initialized the bridge.\n const configuredAgent = clean(env.AGENT_BRIDGE_AGENT);\n const requestedAgent = clean(explicitAgent);\n if (configuredAgent && requestedAgent && configuredAgent !== requestedAgent) {\n throw new Error(`source must match AGENT_BRIDGE_AGENT (${configuredAgent}); got ${requestedAgent}`);\n }\n const agent = requestedAgent ?? configuredAgent;\n if (!agent) throw new Error(\"AGENT_BRIDGE_AGENT is required\");\n const url = value(\"AGENT_BRIDGE_URL\");\n const credential = provider === \"gateway\" ? value(\"AGENT_BRIDGE_TOKEN\") : value(\"AGENT_BRIDGE_KEY\");\n if (provider !== \"local\" && (!url || !credential)) throw new Error(`${provider} requires AGENT_BRIDGE_URL and ${provider === \"gateway\" ? \"AGENT_BRIDGE_TOKEN\" : \"AGENT_BRIDGE_KEY\"}`);\n const workspace = provider === \"legacy-supabase\"\n ? \"*\"\n : value(\"AGENT_BRIDGE_WORKSPACE\") ?? \"default\";\n const instance = clean(env.AGENT_BRIDGE_INSTANCE);\n const databasePath = value(\"AGENT_BRIDGE_DB\") ?? join(home, \".agent-bridge\", \"bridge.sqlite3\");\n const edgeDatabasePath = value(\"AGENT_BRIDGE_EDGE_DB\") ?? join(home, \".agent-bridge\", \"edge.sqlite3\");\n const cursorScope = createHash(\"sha256\")\n .update(`${provider}\\0${provider === \"local\" ? databasePath : url}`)\n .digest(\"hex\")\n .slice(0, 16);\n return {\n provider: provider as ClientProvider,\n principal: { workspace, agent, instance },\n url,\n credential,\n databasePath,\n edgeDatabasePath,\n cursorPath: value(\"AGENT_BRIDGE_CURSOR\") ?? join(\n home,\n \".agent-bridge\",\n \"cursors\",\n pathComponent(provider),\n cursorScope,\n pathComponent(workspace),\n pathComponent(agent),\n pathComponent(instance ?? \"default\"),\n ),\n configPath,\n };\n}\n"],"mappings":";;;AAAA,SAAS,YAAY,oBAAoB;AACzC,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,YAAY;AA8BrB,SAAS,cAAc,OAAuB;AAC5C,QAAM,WAAW,MAAM,QAAQ,qBAAqB,GAAG,EAAE,MAAM,GAAG,EAAE,KAAK;AACzE,QAAM,SAAS,WAAW,QAAQ,EAAE,OAAO,KAAK,EAAE,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE;AAC3E,SAAO,GAAG,QAAQ,IAAI,MAAM;AAC9B;AAEA,SAAS,MAAM,OAA+C;AAC5D,SAAO,OAAO,KAAK,KAAK;AAC1B;AAEA,SAAS,QAAQ,OAAuB;AACtC,QAAM,QAAQ,MAAM,KAAK;AACzB,MAAI,MAAM,SAAS,MAAO,MAAM,CAAC,MAAM,OAAO,MAAM,MAAM,SAAS,CAAC,MAAM,OAAS,MAAM,CAAC,MAAM,OAAO,MAAM,MAAM,SAAS,CAAC,MAAM,KAAO,QAAO,MAAM,MAAM,GAAG,EAAE;AAClK,SAAO;AACT;AAEO,SAAS,qBAAqB,MAAsC;AACzE,MAAI,CAAC,WAAW,IAAI,EAAG,QAAO,CAAC;A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