@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/dist/cli.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
legacyContextMetadata,
|
|
4
|
+
legacyNumericMessageId
|
|
5
|
+
} from "./chunk-23UDQZMT.js";
|
|
2
6
|
import {
|
|
3
7
|
PortableArchiveError,
|
|
4
8
|
PortableArchiveFile,
|
|
@@ -10,23 +14,20 @@ import {
|
|
|
10
14
|
import {
|
|
11
15
|
readClientConfigFile,
|
|
12
16
|
resolveClientConfig
|
|
13
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UKFRCP6X.js";
|
|
14
18
|
import {
|
|
15
19
|
createClientRuntime
|
|
16
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-IMJ47WO4.js";
|
|
17
21
|
import {
|
|
18
22
|
BridgeHttpError,
|
|
19
|
-
HttpBridgeStore
|
|
20
|
-
|
|
21
|
-
legacyContextMetadata,
|
|
22
|
-
legacyNumericMessageId
|
|
23
|
-
} from "./chunk-Z6JP6MYD.js";
|
|
23
|
+
HttpBridgeStore
|
|
24
|
+
} from "./chunk-WQ4I5XGF.js";
|
|
24
25
|
import {
|
|
25
26
|
SQLiteEdgeStore,
|
|
26
27
|
SyncingBridgeStore,
|
|
27
28
|
edgeScopeKey,
|
|
28
29
|
inspectEdgeScopeReadOnly
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-ZUZ7TCIH.js";
|
|
30
31
|
import {
|
|
31
32
|
NativeDrBundleError,
|
|
32
33
|
NativeDrBundleReader,
|
|
@@ -41,7 +42,7 @@ import {
|
|
|
41
42
|
verifyNativeDrBundle,
|
|
42
43
|
verifyPostgresNativeDrArtifacts,
|
|
43
44
|
writeNativeDrBundle
|
|
44
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-IF5OKPBK.js";
|
|
45
46
|
import "./chunk-IVG4XWWS.js";
|
|
46
47
|
import {
|
|
47
48
|
PrivatePathError,
|
|
@@ -55,13 +56,13 @@ import {
|
|
|
55
56
|
runMigrations
|
|
56
57
|
} from "./chunk-QNXHDOJ5.js";
|
|
57
58
|
import "./chunk-VOQIDTCJ.js";
|
|
58
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-4V2PFJEF.js";
|
|
59
60
|
import {
|
|
60
61
|
capabilityDocument,
|
|
61
62
|
operationForCli,
|
|
62
63
|
parseCliResponse,
|
|
63
64
|
validateRequest
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-62C63PIE.js";
|
|
65
66
|
import "./chunk-BZLMF5O5.js";
|
|
66
67
|
|
|
67
68
|
// src/cli.ts
|
|
@@ -1000,7 +1001,7 @@ function writeClientBackendConfig(runtime2, identity2, instance, options) {
|
|
|
1000
1001
|
const inferredGateway = !configuredProvider && Boolean(
|
|
1001
1002
|
env.AGENT_BRIDGE_TOKEN?.trim() || shared.AGENT_BRIDGE_TOKEN?.trim()
|
|
1002
1003
|
);
|
|
1003
|
-
const provider3 = configuredProvider
|
|
1004
|
+
const provider3 = configuredProvider ?? (inferredGateway ? "gateway" : void 0);
|
|
1004
1005
|
const clientToken = options.token?.trim() || env.AGENT_BRIDGE_CLIENT_TOKEN?.trim();
|
|
1005
1006
|
if (provider3 === "gateway" && !clientToken) {
|
|
1006
1007
|
throw new Error(
|
|
@@ -1028,7 +1029,6 @@ function writeClientBackendConfig(runtime2, identity2, instance, options) {
|
|
|
1028
1029
|
AGENT_BRIDGE_WORKSPACE: resolved.principal.workspace,
|
|
1029
1030
|
AGENT_BRIDGE_URL: resolved.url,
|
|
1030
1031
|
AGENT_BRIDGE_TOKEN: resolved.provider === "gateway" ? resolved.credential : void 0,
|
|
1031
|
-
AGENT_BRIDGE_KEY: resolved.provider === "legacy-supabase" ? resolved.credential : void 0,
|
|
1032
1032
|
AGENT_BRIDGE_DB: resolved.provider === "local" ? resolved.databasePath : void 0,
|
|
1033
1033
|
AGENT_BRIDGE_EDGE_DB: resolved.provider === "gateway" ? resolved.edgeDatabasePath : void 0,
|
|
1034
1034
|
AGENT_BRIDGE_CREDENTIAL_ID: options.binding?.credentialId,
|
|
@@ -6227,7 +6227,16 @@ function edgeIdentity(path) {
|
|
|
6227
6227
|
verifyPrivatePathAccess(path, "file");
|
|
6228
6228
|
const details = lstatSync6(path);
|
|
6229
6229
|
if (!details.isFile() || details.isSymbolicLink()) fail3("EDGE_ALIAS", "edge database is not a private regular file");
|
|
6230
|
-
return { dev: details.dev, ino: details.ino };
|
|
6230
|
+
return { dev: details.dev, ino: details.ino, nlink: details.nlink };
|
|
6231
|
+
}
|
|
6232
|
+
function edgeIdentitiesAlias(left, right) {
|
|
6233
|
+
const leftHasFileId = left.dev !== 0 || left.ino !== 0;
|
|
6234
|
+
const rightHasFileId = right.dev !== 0 || right.ino !== 0;
|
|
6235
|
+
if (leftHasFileId && rightHasFileId) return left.dev === right.dev && left.ino === right.ino;
|
|
6236
|
+
if (left.nlink > 1 && right.nlink > 1) {
|
|
6237
|
+
fail3("EDGE_ALIAS", "edge file identity is ambiguous on this platform");
|
|
6238
|
+
}
|
|
6239
|
+
return false;
|
|
6231
6240
|
}
|
|
6232
6241
|
function managedEdgeCohort(metadata, edgePath, env, scopeKey) {
|
|
6233
6242
|
const directory = dirname7(managedClientMetadataPath(metadata.runtime, metadata.instance, env));
|
|
@@ -6247,7 +6256,7 @@ function managedEdgeCohort(metadata, edgePath, env, scopeKey) {
|
|
|
6247
6256
|
if (scopeKey !== void 0 && candidateScope !== scopeKey) continue;
|
|
6248
6257
|
const candidateIdentity = edgeIdentity(candidateProjection.edgeDatabasePath);
|
|
6249
6258
|
const samePath = resolve7(candidateProjection.edgeDatabasePath) === resolve7(edgePath);
|
|
6250
|
-
const sameFile = edgePathIdentity !== null && candidateIdentity !== null && edgePathIdentity
|
|
6259
|
+
const sameFile = edgePathIdentity !== null && candidateIdentity !== null && edgeIdentitiesAlias(edgePathIdentity, candidateIdentity);
|
|
6251
6260
|
if (samePath || sameFile) matches.push(candidate.backendConfigPath);
|
|
6252
6261
|
} catch {
|
|
6253
6262
|
fail3("SHARED_EDGE_COHORT", "managed edge cohort could not be inspected");
|
|
@@ -6418,7 +6427,7 @@ function assertDistinctEdges(sourcePath, targetPath, requirePresent = true) {
|
|
|
6418
6427
|
const source = edgeIdentity(sourcePath);
|
|
6419
6428
|
const target = edgeIdentity(targetPath);
|
|
6420
6429
|
if (requirePresent && (!source || !target)) fail3("EDGE_ALIAS", "source and target edge paths must be initialized before mutation");
|
|
6421
|
-
if (source && target && source
|
|
6430
|
+
if (source && target && edgeIdentitiesAlias(source, target)) {
|
|
6422
6431
|
fail3("EDGE_ALIAS", "source and target edges must not alias the same file");
|
|
6423
6432
|
}
|
|
6424
6433
|
}
|
|
@@ -8570,9 +8579,10 @@ var SUPPORTED_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
8570
8579
|
"recover-lock",
|
|
8571
8580
|
"scope-set",
|
|
8572
8581
|
"workspace-name",
|
|
8573
|
-
"exclusive-edge"
|
|
8582
|
+
"exclusive-edge",
|
|
8583
|
+
"queue-only"
|
|
8574
8584
|
]);
|
|
8575
|
-
var BOOLEAN_OPTIONS2 = /* @__PURE__ */ new Set(["apply", "dead", "force", "invalidate-immediately", "json", "latest", "recover-lock", "exclusive-edge"]);
|
|
8585
|
+
var BOOLEAN_OPTIONS2 = /* @__PURE__ */ new Set(["apply", "dead", "force", "invalidate-immediately", "json", "latest", "recover-lock", "exclusive-edge", "queue-only"]);
|
|
8576
8586
|
function parse5(argv) {
|
|
8577
8587
|
const command = argv[0] ?? "help";
|
|
8578
8588
|
const options = {};
|
|
@@ -8644,7 +8654,7 @@ function cliOutput(operationId, value, invocation) {
|
|
|
8644
8654
|
output(parseCliResponse(operationId, value, invocation));
|
|
8645
8655
|
}
|
|
8646
8656
|
function failedClientStatus(config, error, failure) {
|
|
8647
|
-
const schemaVersion = config.provider === "
|
|
8657
|
+
const schemaVersion = config.provider === "gateway" ? "postgres-v2" : "local-v2";
|
|
8648
8658
|
const remote = config.provider === "local" || !failure.remoteAttempted ? null : false;
|
|
8649
8659
|
const localHealthy = failure.component !== "local-store";
|
|
8650
8660
|
const code = error && typeof error === "object" && "code" in error && typeof error.code === "string" ? error.code : "diagnostics_failed";
|
|
@@ -8774,7 +8784,7 @@ async function initialize(options) {
|
|
|
8774
8784
|
}
|
|
8775
8785
|
const values = {
|
|
8776
8786
|
AGENT_BRIDGE_PROVIDER: provider3,
|
|
8777
|
-
AGENT_BRIDGE_WORKSPACE: one(options, "workspace") ?? process.env.AGENT_BRIDGE_WORKSPACE ??
|
|
8787
|
+
AGENT_BRIDGE_WORKSPACE: one(options, "workspace") ?? process.env.AGENT_BRIDGE_WORKSPACE ?? "default",
|
|
8778
8788
|
AGENT_BRIDGE_DB: one(options, "db") ?? process.env.AGENT_BRIDGE_DB,
|
|
8779
8789
|
AGENT_BRIDGE_EDGE_DB: process.env.AGENT_BRIDGE_EDGE_DB,
|
|
8780
8790
|
AGENT_BRIDGE_URL: one(options, "url") ?? process.env.AGENT_BRIDGE_URL,
|
|
@@ -8833,9 +8843,6 @@ function configFor(options, command) {
|
|
|
8833
8843
|
if (config.provider === "gateway" && assertedWorkspace && assertedWorkspace !== config.principal.workspace) {
|
|
8834
8844
|
throw new Error("--workspace must match the workspace bound to the gateway credential");
|
|
8835
8845
|
}
|
|
8836
|
-
if (config.provider === "legacy-supabase" && assertedWorkspace && assertedWorkspace !== "*") {
|
|
8837
|
-
throw new Error("--workspace is not supported by the global legacy Supabase schema");
|
|
8838
|
-
}
|
|
8839
8846
|
if (config.provider === "local" && assertedWorkspace && assertedWorkspace !== config.principal.workspace) {
|
|
8840
8847
|
return resolveClientConfig(
|
|
8841
8848
|
{ ...environment, AGENT_BRIDGE_WORKSPACE: assertedWorkspace },
|
|
@@ -9166,16 +9173,16 @@ async function runCli(argv = process.argv.slice(2)) {
|
|
|
9166
9173
|
}
|
|
9167
9174
|
let runtime2;
|
|
9168
9175
|
try {
|
|
9176
|
+
const queueOnly = command === "send" && boolean(options, "queue-only");
|
|
9169
9177
|
runtime2 = await createClientRuntime(config, {
|
|
9170
|
-
autoSync: command !== "doctor" && command !== "status",
|
|
9178
|
+
autoSync: command !== "doctor" && command !== "status" && !queueOnly,
|
|
9171
9179
|
initializationMode: command === "status" ? "passive" : "active"
|
|
9172
9180
|
});
|
|
9173
9181
|
} catch (error) {
|
|
9174
9182
|
if (command !== "doctor" && command !== "status") throw error;
|
|
9175
|
-
const remoteInitialization = command === "doctor" && config.provider === "legacy-supabase";
|
|
9176
9183
|
failedClientStatus(config, error, {
|
|
9177
|
-
component:
|
|
9178
|
-
remoteAttempted:
|
|
9184
|
+
component: "local-store",
|
|
9185
|
+
remoteAttempted: false
|
|
9179
9186
|
});
|
|
9180
9187
|
process.exitCode = 1;
|
|
9181
9188
|
return;
|
|
@@ -9185,15 +9192,15 @@ async function runCli(argv = process.argv.slice(2)) {
|
|
|
9185
9192
|
validateRequest("client_status", {});
|
|
9186
9193
|
const active = command === "doctor";
|
|
9187
9194
|
try {
|
|
9188
|
-
const diagnostics = await runtime2.store.diagnostics?.(config.principal, { mode: active ? "probe" : "snapshot" }) ?? { schemaVersion:
|
|
9189
|
-
const remoteReachable = "remoteReachable" in diagnostics ? diagnostics.remoteReachable ?? null :
|
|
9195
|
+
const diagnostics = await runtime2.store.diagnostics?.(config.principal, { mode: active ? "probe" : "snapshot" }) ?? { schemaVersion: "local-v2", deliverySupported: false, pending: null, claimed: null, retrying: null, dead: null };
|
|
9196
|
+
const remoteReachable = "remoteReachable" in diagnostics ? diagnostics.remoteReachable ?? null : null;
|
|
9190
9197
|
const checks = [{
|
|
9191
9198
|
name: "local-store",
|
|
9192
9199
|
status: "ok",
|
|
9193
9200
|
message: "local diagnostics are readable"
|
|
9194
9201
|
}];
|
|
9195
9202
|
if (config.provider !== "local") {
|
|
9196
|
-
const provider3 =
|
|
9203
|
+
const provider3 = "gateway";
|
|
9197
9204
|
const remoteError2 = "remoteError" in diagnostics && typeof diagnostics.remoteError === "string" ? diagnostics.remoteError : void 0;
|
|
9198
9205
|
checks.push({
|
|
9199
9206
|
name: "remote",
|
|
@@ -9263,7 +9270,7 @@ async function runCli(argv = process.argv.slice(2)) {
|
|
|
9263
9270
|
if (command === "send") {
|
|
9264
9271
|
const message = draft(options, positionals);
|
|
9265
9272
|
validateRequest("publish_message", { ...message, source: one(options, "source") });
|
|
9266
|
-
cliOutput("publish_message", await runtime2.service.publish(config.principal, message));
|
|
9273
|
+
cliOutput("publish_message", await runtime2.service.publish(config.principal, message, { queueOnly: boolean(options, "queue-only") }));
|
|
9267
9274
|
return;
|
|
9268
9275
|
}
|
|
9269
9276
|
if (command === "join") {
|
|
@@ -9289,14 +9296,14 @@ async function runCli(argv = process.argv.slice(2)) {
|
|
|
9289
9296
|
const query = validateRequest("history", { cursor: one(options, "cursor"), limit: integer(options, "limit", 20), types: list(options, "type").concat(list(options, "category")), source: one(options, "source"), project: one(options, "project"), since: since(options), mailbox: command === "inbox" ? "inbox" : command === "sent" ? "sent" : one(options, "mailbox"), receiptState: one(options, "receipt-state"), unacknowledgedBy: assertedUnackedBy, threadId: one(options, "thread-id"), latest: raw === "get" || boolean(options, "latest") });
|
|
9290
9297
|
const page = await runtime2.service.history(config.principal, query);
|
|
9291
9298
|
if (raw === "get") {
|
|
9292
|
-
cliOutput("history", page.messages.map((message) => ({ id:
|
|
9299
|
+
cliOutput("history", page.messages.map((message) => ({ id: message.id, source: message.source, category: message.type, content: message.content, priority: message.priority, project: message.project ?? null, metadata: legacyContextMetadata(message), created_at: message.createdAt })), { command: raw, optionNames: Object.keys(options) });
|
|
9293
9300
|
} else cliOutput("history", page);
|
|
9294
9301
|
return;
|
|
9295
9302
|
}
|
|
9296
9303
|
if (command === "acknowledge" || command === "ack" && one(options, "ids")) {
|
|
9297
9304
|
const rawIds = list(options, "ids");
|
|
9298
9305
|
validateRequest("record_receipt", { messageIds: rawIds });
|
|
9299
|
-
const acknowledged =
|
|
9306
|
+
const acknowledged = await runtime2.service.acknowledge(
|
|
9300
9307
|
config.principal,
|
|
9301
9308
|
rawIds.map(legacyNumericMessageId)
|
|
9302
9309
|
);
|
|
@@ -9374,7 +9381,7 @@ async function runCli(argv = process.argv.slice(2)) {
|
|
|
9374
9381
|
saveCursor(checkpointPath, current);
|
|
9375
9382
|
interval = page.messages.length ? baseInterval : Math.min(maxInterval, Math.max(baseInterval, interval * 2));
|
|
9376
9383
|
} catch (error) {
|
|
9377
|
-
const status = error instanceof BridgeHttpError
|
|
9384
|
+
const status = error instanceof BridgeHttpError ? error.status : void 0;
|
|
9378
9385
|
const retryable = status !== void 0 && (status === 0 || status === 408 || status === 425 || status === 429 || status >= 500);
|
|
9379
9386
|
if (!retryable) throw error;
|
|
9380
9387
|
interval = Math.min(maxInterval, Math.max(baseInterval, interval * 2));
|