@creatornader/agent-bridge 0.2.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 (74) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/LICENSE +216 -0
  3. package/README.md +338 -0
  4. package/SKILL.md +24 -0
  5. package/bin/CLAUDE.md +11 -0
  6. package/bin/agent-bridge +7 -0
  7. package/clients/claude-code.json +20 -0
  8. package/clients/claude-desktop.json +20 -0
  9. package/clients/codex.json +20 -0
  10. package/clients/generic-mcp.json +13 -0
  11. package/clients/openclaw.json +13 -0
  12. package/dist/bridge-domain-BcnBeHOn.d.ts +97 -0
  13. package/dist/bridge-service-CfqMcMAn.d.ts +28 -0
  14. package/dist/bridge-store-BuGjxTn4.d.ts +61 -0
  15. package/dist/bridge.d.ts +102 -0
  16. package/dist/bridge.js +83 -0
  17. package/dist/bridge.js.map +1 -0
  18. package/dist/chunk-4KAOBC5X.js +773 -0
  19. package/dist/chunk-4KAOBC5X.js.map +1 -0
  20. package/dist/chunk-6MAZ6YLZ.js +146 -0
  21. package/dist/chunk-6MAZ6YLZ.js.map +1 -0
  22. package/dist/chunk-AXL2I7FH.js +423 -0
  23. package/dist/chunk-AXL2I7FH.js.map +1 -0
  24. package/dist/chunk-BV6W4AJK.js +211 -0
  25. package/dist/chunk-BV6W4AJK.js.map +1 -0
  26. package/dist/chunk-CKSKUBDQ.js +153 -0
  27. package/dist/chunk-CKSKUBDQ.js.map +1 -0
  28. package/dist/chunk-JOUBDRYX.js +272 -0
  29. package/dist/chunk-JOUBDRYX.js.map +1 -0
  30. package/dist/chunk-JTC5YURG.js +49 -0
  31. package/dist/chunk-JTC5YURG.js.map +1 -0
  32. package/dist/chunk-KVR4JBRF.js +80 -0
  33. package/dist/chunk-KVR4JBRF.js.map +1 -0
  34. package/dist/chunk-O26W5QHS.js +409 -0
  35. package/dist/chunk-O26W5QHS.js.map +1 -0
  36. package/dist/chunk-WEULPMUY.js +988 -0
  37. package/dist/chunk-WEULPMUY.js.map +1 -0
  38. package/dist/chunk-YD6YJATN.js +48 -0
  39. package/dist/chunk-YD6YJATN.js.map +1 -0
  40. package/dist/cli.d.ts +3 -0
  41. package/dist/cli.js +670 -0
  42. package/dist/cli.js.map +1 -0
  43. package/dist/client-config.d.ts +30 -0
  44. package/dist/client-config.js +10 -0
  45. package/dist/client-config.js.map +1 -0
  46. package/dist/client-runtime.d.ts +15 -0
  47. package/dist/client-runtime.js +15 -0
  48. package/dist/client-runtime.js.map +1 -0
  49. package/dist/gateway-BULozv3K.d.ts +54 -0
  50. package/dist/gateway-main.d.ts +2 -0
  51. package/dist/gateway-main.js +105 -0
  52. package/dist/gateway-main.js.map +1 -0
  53. package/dist/gateway.d.ts +4 -0
  54. package/dist/gateway.js +10 -0
  55. package/dist/gateway.js.map +1 -0
  56. package/dist/index.d.ts +2 -0
  57. package/dist/index.js +18 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/server.d.ts +34 -0
  60. package/dist/server.js +19 -0
  61. package/dist/server.js.map +1 -0
  62. package/dist/sqlite.d.ts +156 -0
  63. package/dist/sqlite.js +24 -0
  64. package/dist/sqlite.js.map +1 -0
  65. package/llms.txt +39 -0
  66. package/package.json +104 -0
  67. package/sql/migrations/001_schema_state.sql +34 -0
  68. package/sql/migrations/002_workspaces_agents_credentials.sql +77 -0
  69. package/sql/migrations/003_messages_receipts_deliveries.sql +116 -0
  70. package/sql/migrations/004_message_query_indexes.sql +31 -0
  71. package/sql/migrations/005_delivery_events_presence.sql +79 -0
  72. package/sql/migrations/006_legacy_shared_context_import.sql +139 -0
  73. package/sql/migrations/007_runtime_role.sql +59 -0
  74. package/sql/setup.sql +68 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "schema": "agent-bridge.runtime-manifest.v1",
3
+ "runtime": "claude-code",
4
+ "transport": "stdio",
5
+ "command": "agent-bridge-mcp",
6
+ "identity": { "source": "env", "variable": "AGENT_BRIDGE_AGENT", "required": true },
7
+ "instance": { "source": "env", "variable": "AGENT_BRIDGE_INSTANCE", "required": true },
8
+ "backendConfig": { "source": "env", "variable": "AGENT_BRIDGE_CONFIG", "perClient": true },
9
+ "configLocations": ["~/.claude.json", "~/.agent-bridge/config"],
10
+ "install": {
11
+ "method": "native-cli",
12
+ "command": ["claude", "mcp", "add", "--scope", "user", "agent-bridge", "-e", "AGENT_BRIDGE_AGENT={{identity}}", "-e", "AGENT_BRIDGE_INSTANCE={{instance}}", "-e", "AGENT_BRIDGE_CONFIG={{backendConfig}}", "--", "agent-bridge-mcp"],
13
+ "identityValue": "operator-selected",
14
+ "instanceValue": "installer-generated",
15
+ "backendConfigValue": "installer-generated",
16
+ "restartRequired": true
17
+ },
18
+ "wakeModes": ["poll"],
19
+ "healthCommand": ["agent-bridge", "doctor", "--json"]
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "schema": "agent-bridge.runtime-manifest.v1",
3
+ "runtime": "claude-desktop",
4
+ "transport": "stdio",
5
+ "command": "agent-bridge-mcp",
6
+ "identity": { "source": "env", "variable": "AGENT_BRIDGE_AGENT", "required": true },
7
+ "instance": { "source": "env", "variable": "AGENT_BRIDGE_INSTANCE", "required": true },
8
+ "backendConfig": { "source": "env", "variable": "AGENT_BRIDGE_CONFIG", "perClient": true },
9
+ "configLocations": ["~/Library/Application Support/Claude/claude_desktop_config.json", "%APPDATA%/Claude/claude_desktop_config.json", "~/.agent-bridge/config"],
10
+ "install": {
11
+ "method": "json-config",
12
+ "keyPath": "mcpServers.agent-bridge",
13
+ "identityValue": "operator-selected",
14
+ "instanceValue": "installer-generated",
15
+ "backendConfigValue": "installer-generated",
16
+ "restartRequired": true
17
+ },
18
+ "wakeModes": ["poll"],
19
+ "healthCommand": ["agent-bridge", "doctor", "--json"]
20
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "schema": "agent-bridge.runtime-manifest.v1",
3
+ "runtime": "codex",
4
+ "transport": "stdio",
5
+ "command": "agent-bridge-mcp",
6
+ "identity": { "source": "env", "variable": "AGENT_BRIDGE_AGENT", "required": true },
7
+ "instance": { "source": "env", "variable": "AGENT_BRIDGE_INSTANCE", "required": true },
8
+ "backendConfig": { "source": "env", "variable": "AGENT_BRIDGE_CONFIG", "perClient": true },
9
+ "configLocations": ["~/.codex/config.toml", "~/.agent-bridge/config"],
10
+ "install": {
11
+ "method": "native-cli",
12
+ "command": ["codex", "mcp", "add", "agent-bridge", "--env", "AGENT_BRIDGE_AGENT={{identity}}", "--env", "AGENT_BRIDGE_INSTANCE={{instance}}", "--env", "AGENT_BRIDGE_CONFIG={{backendConfig}}", "--", "agent-bridge-mcp"],
13
+ "identityValue": "operator-selected",
14
+ "instanceValue": "installer-generated",
15
+ "backendConfigValue": "installer-generated",
16
+ "restartRequired": true
17
+ },
18
+ "wakeModes": ["poll"],
19
+ "healthCommand": ["agent-bridge", "doctor", "--json"]
20
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "schema": "agent-bridge.runtime-manifest.v1",
3
+ "runtime": "generic-mcp",
4
+ "transport": "stdio",
5
+ "command": "agent-bridge-mcp",
6
+ "identity": { "source": "env", "variable": "AGENT_BRIDGE_AGENT", "required": true },
7
+ "instance": { "source": "env", "variable": "AGENT_BRIDGE_INSTANCE", "required": true },
8
+ "backendConfig": { "source": "env", "variable": "AGENT_BRIDGE_CONFIG", "perClient": true },
9
+ "configLocations": ["~/.agent-bridge/config"],
10
+ "install": { "method": "operator-configured", "identityValue": "operator-selected", "instanceValue": "operator-selected", "backendConfigValue": "operator-selected", "restartRequired": true },
11
+ "wakeModes": ["poll"],
12
+ "healthCommand": ["agent-bridge", "doctor", "--json"]
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "schema": "agent-bridge.runtime-manifest.v1",
3
+ "runtime": "openclaw",
4
+ "transport": "stdio",
5
+ "command": "agent-bridge-mcp",
6
+ "identity": { "source": "env", "variable": "AGENT_BRIDGE_AGENT", "required": true },
7
+ "instance": { "source": "env", "variable": "AGENT_BRIDGE_INSTANCE", "required": true },
8
+ "backendConfig": { "source": "env", "variable": "AGENT_BRIDGE_CONFIG", "perClient": true },
9
+ "configLocations": ["~/.openclaw/openclaw.json", "~/.agent-bridge/config"],
10
+ "install": { "method": "operator-configured", "identityValue": "operator-selected", "instanceValue": "operator-selected", "backendConfigValue": "operator-selected", "restartRequired": true },
11
+ "wakeModes": ["poll", "process"],
12
+ "healthCommand": ["agent-bridge", "doctor", "--json"]
13
+ }
@@ -0,0 +1,97 @@
1
+ type JsonValue = null | boolean | number | string | JsonValue[] | {
2
+ [key: string]: JsonValue;
3
+ };
4
+ type DeliveryState = "pending" | "claimed" | "acked" | "retrying" | "dead";
5
+ type MessagePriority = "info" | "high" | "urgent";
6
+ interface RetryPolicy {
7
+ maxAttempts: number;
8
+ baseDelayMs: number;
9
+ maxDelayMs: number;
10
+ jitterRatio: number;
11
+ }
12
+ interface BridgePrincipal {
13
+ workspace: string;
14
+ agent: string;
15
+ instance?: string;
16
+ }
17
+ interface MessageDraft {
18
+ id?: string;
19
+ type: string;
20
+ content: string;
21
+ contentType?: string;
22
+ data?: JsonValue;
23
+ targets?: string[];
24
+ threadId?: string;
25
+ replyToId?: string;
26
+ correlationId?: string;
27
+ causationId?: string;
28
+ priority?: MessagePriority;
29
+ expiresAt?: string;
30
+ idempotencyKey?: string;
31
+ atribReceiptId?: string;
32
+ informedBy?: string[];
33
+ metadata?: JsonValue;
34
+ }
35
+ interface BridgeMessage extends Required<Pick<MessageDraft, "id" | "type" | "content" | "contentType" | "targets" | "priority">> {
36
+ workspace: string;
37
+ source: string;
38
+ sequence: string;
39
+ createdAt: string;
40
+ data?: JsonValue;
41
+ threadId?: string;
42
+ replyToId?: string;
43
+ correlationId?: string;
44
+ causationId?: string;
45
+ expiresAt?: string;
46
+ idempotencyKey?: string;
47
+ atribReceiptId?: string;
48
+ informedBy?: string[];
49
+ metadata?: JsonValue;
50
+ }
51
+ interface BridgeDelivery {
52
+ id: string;
53
+ messageId: string;
54
+ workspace: string;
55
+ recipient: string;
56
+ state: DeliveryState;
57
+ attempt: number;
58
+ availableAt: string;
59
+ leaseToken?: string;
60
+ leaseOwner?: string;
61
+ leaseExpiresAt?: string;
62
+ lastError?: string;
63
+ }
64
+ interface BridgeDeliveryEvent {
65
+ sequence: string;
66
+ deliveryId: string;
67
+ messageId: string;
68
+ workspace: string;
69
+ recipient: string;
70
+ fromState?: DeliveryState;
71
+ toState: DeliveryState;
72
+ attempt: number;
73
+ leaseOwner?: string;
74
+ error?: string;
75
+ createdAt: string;
76
+ }
77
+ interface AgentPresence {
78
+ workspace: string;
79
+ agent: string;
80
+ instance: string;
81
+ runtimeType?: string;
82
+ capabilities: string[];
83
+ leaseExpiresAt: string;
84
+ lastSeenAt: string;
85
+ }
86
+ declare class BridgeValidationError extends Error {
87
+ readonly code = "invalid_input";
88
+ }
89
+ declare function uuidv7(now?: number): string;
90
+ declare function validatePrincipal(value: BridgePrincipal): BridgePrincipal;
91
+ declare function validateUuid(value: unknown, field: string): string;
92
+ declare function validateRetryPolicy(input?: Partial<RetryPolicy> | null): RetryPolicy;
93
+ declare function validateMessageDraft(input: MessageDraft): Omit<BridgeMessage, "workspace" | "source" | "sequence" | "createdAt">;
94
+ declare function encodeCursor(sequence: string): string;
95
+ declare function decodeCursor(cursor: string | undefined): string | undefined;
96
+
97
+ export { type AgentPresence as A, type BridgeDelivery as B, type DeliveryState as D, type JsonValue as J, type MessageDraft as M, type RetryPolicy as R, type BridgeDeliveryEvent as a, type BridgeMessage as b, type BridgePrincipal as c, BridgeValidationError as d, type MessagePriority as e, decodeCursor as f, encodeCursor as g, validatePrincipal as h, validateRetryPolicy as i, validateUuid as j, uuidv7 as u, validateMessageDraft as v };
@@ -0,0 +1,28 @@
1
+ import { c as BridgePrincipal, M as MessageDraft, B as BridgeDelivery, R as RetryPolicy, A as AgentPresence } from './bridge-domain-BcnBeHOn.js';
2
+ import { a as BridgeStore, I as InsertMessageResult, b as MessageQuery, M as MessagePage } from './bridge-store-BuGjxTn4.js';
3
+
4
+ declare class BridgeService {
5
+ private readonly store;
6
+ constructor(store: BridgeStore);
7
+ publish(principalInput: BridgePrincipal, draftInput: MessageDraft): Promise<InsertMessageResult>;
8
+ history(principalInput: BridgePrincipal, query?: MessageQuery): Promise<MessagePage>;
9
+ acknowledge(principalInput: BridgePrincipal, messageIds: string[]): Promise<number>;
10
+ claim(principalInput: BridgePrincipal, options?: {
11
+ leaseMs?: number;
12
+ maxAttempts?: number;
13
+ }): Promise<{
14
+ delivery: BridgeDelivery;
15
+ leaseToken: string;
16
+ } | null>;
17
+ extend(principalInput: BridgePrincipal, deliveryId: string, leaseToken: string, leaseMs?: number): Promise<BridgeDelivery | null>;
18
+ ack(principalInput: BridgePrincipal, deliveryId: string, leaseToken: string): Promise<BridgeDelivery | null>;
19
+ nack(principalInput: BridgePrincipal, deliveryId: string, leaseToken: string, error: string, dead?: boolean, retryPolicy?: Partial<RetryPolicy>): Promise<BridgeDelivery | null>;
20
+ heartbeat(principalInput: BridgePrincipal, options?: {
21
+ leaseMs?: number;
22
+ runtimeType?: string;
23
+ capabilities?: string[];
24
+ }): Promise<AgentPresence>;
25
+ presence(principalInput: BridgePrincipal): Promise<AgentPresence[]>;
26
+ }
27
+
28
+ export { BridgeService as B };
@@ -0,0 +1,61 @@
1
+ import { b as BridgeMessage, c as BridgePrincipal, B as BridgeDelivery, D as DeliveryState, R as RetryPolicy, A as AgentPresence, a as BridgeDeliveryEvent } from './bridge-domain-BcnBeHOn.js';
2
+
3
+ interface InsertMessageResult {
4
+ message: BridgeMessage;
5
+ created: boolean;
6
+ }
7
+ interface MessageQuery {
8
+ cursor?: string;
9
+ limit?: number;
10
+ types?: string[];
11
+ includeExpired?: boolean;
12
+ source?: string;
13
+ since?: string;
14
+ unacknowledgedBy?: string;
15
+ threadId?: string;
16
+ latest?: boolean;
17
+ }
18
+ interface MessagePage {
19
+ messages: BridgeMessage[];
20
+ cursor?: string;
21
+ }
22
+ interface BridgeDiagnostics {
23
+ schemaVersion: "local-v2" | "postgres-v2" | "legacy-v1";
24
+ deliverySupported: boolean;
25
+ pending: number | null;
26
+ claimed: number | null;
27
+ retrying: number | null;
28
+ dead: number | null;
29
+ oldestAvailableAt?: string;
30
+ principal?: {
31
+ workspace: string;
32
+ agent: string;
33
+ };
34
+ }
35
+ interface ClaimOptions {
36
+ leaseMs: number;
37
+ maxAttempts?: number;
38
+ now?: Date;
39
+ }
40
+ interface BridgeStore {
41
+ initialize(): Promise<void>;
42
+ insertMessage(message: Omit<BridgeMessage, "sequence" | "createdAt">): Promise<InsertMessageResult>;
43
+ listMessages(principal: BridgePrincipal, query?: MessageQuery): Promise<MessagePage>;
44
+ recordReceipt(workspace: string, messageIds: string[], principal: string, readAt?: Date): Promise<number>;
45
+ recordLegacyReceipt?(legacyIds: string[], principal: string): Promise<number>;
46
+ claimDelivery(principal: BridgePrincipal, options: ClaimOptions): Promise<BridgeDelivery | null>;
47
+ renewDelivery(principal: BridgePrincipal, deliveryId: string, leaseToken: string, leaseMs: number): Promise<BridgeDelivery | null>;
48
+ settleDelivery(principal: BridgePrincipal, deliveryId: string, leaseToken: string, state: Extract<DeliveryState, "acked" | "retrying" | "dead">, error: string | undefined, retryPolicy: RetryPolicy): Promise<BridgeDelivery | null>;
49
+ diagnostics?(principal: BridgePrincipal): Promise<BridgeDiagnostics>;
50
+ heartbeat?(principal: BridgePrincipal, leaseMs: number, runtimeType?: string, capabilities?: string[]): Promise<AgentPresence>;
51
+ listPresence?(principal: BridgePrincipal): Promise<AgentPresence[]>;
52
+ listDeliveryEvents?(deliveryId: string): Promise<BridgeDeliveryEvent[]>;
53
+ sync?(options?: {
54
+ maxPush?: number;
55
+ maxPages?: number;
56
+ }): Promise<unknown>;
57
+ verifyRemote?(): Promise<void>;
58
+ close?(): Promise<void>;
59
+ }
60
+
61
+ export type { BridgeDiagnostics as B, ClaimOptions as C, InsertMessageResult as I, MessagePage as M, BridgeStore as a, MessageQuery as b };
@@ -0,0 +1,102 @@
1
+ import { b as BridgeMessage, c as BridgePrincipal, B as BridgeDelivery, R as RetryPolicy, A as AgentPresence } from './bridge-domain-BcnBeHOn.js';
2
+ export { a as BridgeDeliveryEvent, d as BridgeValidationError, D as DeliveryState, J as JsonValue, M as MessageDraft, e as MessagePriority, f as decodeCursor, g as encodeCursor, u as uuidv7, v as validateMessageDraft, h as validatePrincipal, i as validateRetryPolicy, j as validateUuid } from './bridge-domain-BcnBeHOn.js';
3
+ import { a as BridgeStore, I as InsertMessageResult, b as MessageQuery, M as MessagePage, C as ClaimOptions, B as BridgeDiagnostics } from './bridge-store-BuGjxTn4.js';
4
+ export { B as BridgeService } from './bridge-service-CfqMcMAn.js';
5
+ import { P as PgQueryable } from './gateway-BULozv3K.js';
6
+ export { A as AuthenticatedCredential, C as CredentialResolver, G as GatewayOptions, a as PostgresBridgeStore, b as PostgresCredentialResolver, c as bearerToken, d as createGateway, h as hashCredential, s as safeTokenHashEqual } from './gateway-BULozv3K.js';
7
+ export { CachedMessagePage, EdgeConflictError, EdgeEnqueueResult, EdgeOutboxRecord, EdgeScope, EdgeStats, PendingMessage, SQLiteBridgeStore, SQLiteEdgeStore, SyncDiagnostics, SyncInsertResult, SyncReport, SyncingBridgeStore, SyncingBridgeStoreOptions, edgeMessageFingerprint, edgeScopeKey, isRetryableSyncError, stableIdempotency } from './sqlite.js';
8
+ import 'node:http';
9
+
10
+ declare class LegacySupabaseError extends Error {
11
+ readonly status: number;
12
+ readonly code: string;
13
+ constructor(status: number, code: string);
14
+ }
15
+ declare class LegacySupabaseRestStore implements BridgeStore {
16
+ private readonly url;
17
+ private readonly key;
18
+ private readonly fetchImpl;
19
+ private readonly timeoutMs;
20
+ private readonly legacyIds;
21
+ private initialized;
22
+ constructor(url: string, key: string, fetchImpl?: typeof fetch, timeoutMs?: number);
23
+ initialize(): Promise<void>;
24
+ private request;
25
+ insertMessage(input: Omit<BridgeMessage, "sequence" | "createdAt">): Promise<InsertMessageResult>;
26
+ listMessages(principal: BridgePrincipal, query?: MessageQuery): Promise<MessagePage>;
27
+ recordReceipt(_workspace: string, ids: string[], principal: string): Promise<number>;
28
+ recordLegacyReceipt(ids: string[], principal: string): Promise<number>;
29
+ claimDelivery(_principal: BridgePrincipal, _options: ClaimOptions): Promise<BridgeDelivery | null>;
30
+ renewDelivery(_principal: BridgePrincipal, _deliveryId: string, _leaseToken: string, _leaseMs: number): Promise<BridgeDelivery | null>;
31
+ settleDelivery(_principal: BridgePrincipal, _deliveryId: string, _leaseToken: string, _state: "acked" | "retrying" | "dead", _error: string | undefined, _retryPolicy: RetryPolicy): Promise<BridgeDelivery | null>;
32
+ diagnostics(_principal: BridgePrincipal): Promise<BridgeDiagnostics>;
33
+ }
34
+
35
+ interface HttpBridgeStoreOptions {
36
+ baseUrl: string;
37
+ token: string;
38
+ principal: BridgePrincipal;
39
+ timeoutMs?: number;
40
+ allowInsecureRemoteHttp?: boolean;
41
+ fetch?: typeof fetch;
42
+ }
43
+ declare class BridgeHttpError extends Error {
44
+ readonly status: number;
45
+ readonly code: string;
46
+ constructor(status: number, code: string);
47
+ }
48
+ declare class HttpBridgeStore implements BridgeStore {
49
+ private readonly options;
50
+ private readonly fetchImpl;
51
+ constructor(options: HttpBridgeStoreOptions);
52
+ initialize(): Promise<void>;
53
+ private assertBoundPrincipal;
54
+ private request;
55
+ private assertPrincipal;
56
+ insertMessage(message: Omit<BridgeMessage, "sequence" | "createdAt">): Promise<InsertMessageResult>;
57
+ listMessages(principal: BridgePrincipal, query?: MessageQuery): Promise<MessagePage>;
58
+ recordReceipt(workspace: string, ids: string[], principal: string): Promise<number>;
59
+ diagnostics(principal: BridgePrincipal): Promise<BridgeDiagnostics>;
60
+ claimDelivery(principal: BridgePrincipal, options: ClaimOptions): Promise<BridgeDelivery | null>;
61
+ renewDelivery(principal: BridgePrincipal, id: string, token: string, leaseMs: number): Promise<BridgeDelivery | null>;
62
+ settleDelivery(principal: BridgePrincipal, id: string, token: string, state: "acked" | "retrying" | "dead", error: string | undefined, retryPolicy: RetryPolicy): Promise<BridgeDelivery | null>;
63
+ heartbeat(principal: BridgePrincipal, leaseMs: number, runtimeType?: string, capabilities?: string[]): Promise<AgentPresence>;
64
+ listPresence(principal: BridgePrincipal): Promise<AgentPresence[]>;
65
+ }
66
+
67
+ interface AppliedMigration {
68
+ version: number;
69
+ name: string;
70
+ checksum: string;
71
+ }
72
+ interface MigrationPlanEntry extends AppliedMigration {
73
+ source: string;
74
+ }
75
+ declare const REQUIRED_MIGRATIONS: readonly [{
76
+ readonly version: 1;
77
+ readonly name: "schema_state";
78
+ }, {
79
+ readonly version: 2;
80
+ readonly name: "workspaces_agents_credentials";
81
+ }, {
82
+ readonly version: 3;
83
+ readonly name: "messages_receipts_deliveries";
84
+ }, {
85
+ readonly version: 4;
86
+ readonly name: "message_query_indexes";
87
+ }, {
88
+ readonly version: 5;
89
+ readonly name: "delivery_events_presence";
90
+ }, {
91
+ readonly version: 6;
92
+ readonly name: "legacy_shared_context_import";
93
+ }, {
94
+ readonly version: 7;
95
+ readonly name: "runtime_role";
96
+ }];
97
+ declare function loadMigrationPlan(directory: string): Promise<MigrationPlanEntry[]>;
98
+ declare function migrationsReady(db: PgQueryable, expected: ReadonlyArray<Pick<MigrationPlanEntry, "version" | "name" | "checksum">>): Promise<boolean>;
99
+ declare function runtimeSchemaReady(db: PgQueryable): Promise<boolean>;
100
+ declare function runMigrations(db: PgQueryable, directory: string): Promise<AppliedMigration[]>;
101
+
102
+ export { AgentPresence, type AppliedMigration, BridgeDelivery, BridgeDiagnostics, BridgeHttpError, BridgeMessage, BridgePrincipal, BridgeStore, ClaimOptions, HttpBridgeStore, type HttpBridgeStoreOptions, InsertMessageResult, LegacySupabaseError, LegacySupabaseRestStore, MessagePage, MessageQuery, type MigrationPlanEntry, PgQueryable, REQUIRED_MIGRATIONS, RetryPolicy, loadMigrationPlan, migrationsReady, runMigrations, runtimeSchemaReady };
package/dist/bridge.js ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ PostgresBridgeStore
4
+ } from "./chunk-O26W5QHS.js";
5
+ import {
6
+ REQUIRED_MIGRATIONS,
7
+ loadMigrationPlan,
8
+ migrationsReady,
9
+ runMigrations,
10
+ runtimeSchemaReady
11
+ } from "./chunk-6MAZ6YLZ.js";
12
+ import {
13
+ PostgresCredentialResolver,
14
+ bearerToken,
15
+ createGateway,
16
+ hashCredential,
17
+ safeTokenHashEqual
18
+ } from "./chunk-JOUBDRYX.js";
19
+ import {
20
+ BridgeHttpError,
21
+ HttpBridgeStore,
22
+ LegacySupabaseError,
23
+ LegacySupabaseRestStore
24
+ } from "./chunk-AXL2I7FH.js";
25
+ import {
26
+ EdgeConflictError,
27
+ SQLiteBridgeStore,
28
+ SQLiteEdgeStore,
29
+ SyncingBridgeStore,
30
+ edgeMessageFingerprint,
31
+ edgeScopeKey,
32
+ isRetryableSyncError,
33
+ stableIdempotency
34
+ } from "./chunk-WEULPMUY.js";
35
+ import "./chunk-YD6YJATN.js";
36
+ import {
37
+ BridgeService
38
+ } from "./chunk-CKSKUBDQ.js";
39
+ import {
40
+ BridgeValidationError,
41
+ decodeCursor,
42
+ encodeCursor,
43
+ uuidv7,
44
+ validateMessageDraft,
45
+ validatePrincipal,
46
+ validateRetryPolicy,
47
+ validateUuid
48
+ } from "./chunk-BV6W4AJK.js";
49
+ export {
50
+ BridgeHttpError,
51
+ BridgeService,
52
+ BridgeValidationError,
53
+ EdgeConflictError,
54
+ HttpBridgeStore,
55
+ LegacySupabaseError,
56
+ LegacySupabaseRestStore,
57
+ PostgresBridgeStore,
58
+ PostgresCredentialResolver,
59
+ REQUIRED_MIGRATIONS,
60
+ SQLiteBridgeStore,
61
+ SQLiteEdgeStore,
62
+ SyncingBridgeStore,
63
+ bearerToken,
64
+ createGateway,
65
+ decodeCursor,
66
+ edgeMessageFingerprint,
67
+ edgeScopeKey,
68
+ encodeCursor,
69
+ hashCredential,
70
+ isRetryableSyncError,
71
+ loadMigrationPlan,
72
+ migrationsReady,
73
+ runMigrations,
74
+ runtimeSchemaReady,
75
+ safeTokenHashEqual,
76
+ stableIdempotency,
77
+ uuidv7,
78
+ validateMessageDraft,
79
+ validatePrincipal,
80
+ validateRetryPolicy,
81
+ validateUuid
82
+ };
83
+ //# sourceMappingURL=bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}