conbridge-agent 0.3.1 → 0.3.2
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/README.md +1 -1
- package/conbridge-agent.cjs +67 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# conbridge-agent
|
|
2
2
|
|
|
3
|
-
ConBridge Desktop Agent 0.3.
|
|
3
|
+
ConBridge Desktop Agent 0.3.2: connects a computer or server to ConBridge so the AI apps you approve (ChatGPT,
|
|
4
4
|
Claude) can use the folders you share, or, with full access, its terminal. macOS, Linux (servers too), Raspberry Pi and
|
|
5
5
|
Windows; Node.js 22 or later.
|
|
6
6
|
|
package/conbridge-agent.cjs
CHANGED
|
@@ -29,7 +29,7 @@ __export(cli_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(cli_exports);
|
|
30
30
|
|
|
31
31
|
// <define:__CONBRIDGE_BUILD__>
|
|
32
|
-
var define_CONBRIDGE_BUILD_default = { version: "0.3.
|
|
32
|
+
var define_CONBRIDGE_BUILD_default = { version: "0.3.2", commit: "3e6c8cc1bb37", built_at: "2026-10-30T02:48:39.631Z", keychain_helper_sha256: "359d0b3f3fedc26561d0e0b27a93df624fa55c1519c120e23fae46e9f2c2dc6a", distribution: "npm" };
|
|
33
33
|
|
|
34
34
|
// dist/cli.js
|
|
35
35
|
var import_node_child_process10 = require("node:child_process");
|
|
@@ -21994,7 +21994,7 @@ var import_node_fs = require("node:fs");
|
|
|
21994
21994
|
var import_node_path2 = require("node:path");
|
|
21995
21995
|
var import_node_sea = require("node:sea");
|
|
21996
21996
|
var import_node_url = require("node:url");
|
|
21997
|
-
var SOURCE_VERSION = "0.3.
|
|
21997
|
+
var SOURCE_VERSION = "0.3.2";
|
|
21998
21998
|
var BUILD_INFO = typeof define_CONBRIDGE_BUILD_default === "object" && define_CONBRIDGE_BUILD_default !== null ? define_CONBRIDGE_BUILD_default : null;
|
|
21999
21999
|
var AGENT_VERSION = BUILD_INFO?.version ?? SOURCE_VERSION;
|
|
22000
22000
|
function runningAsSea() {
|
|
@@ -22800,6 +22800,7 @@ async function pairDevice(options) {
|
|
|
22800
22800
|
paired_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22801
22801
|
key_store: options.keyStore.descriptor
|
|
22802
22802
|
};
|
|
22803
|
+
await options.onApproved?.();
|
|
22803
22804
|
await saveIdentity(options.paths, identity);
|
|
22804
22805
|
succeeded = true;
|
|
22805
22806
|
return identity;
|
|
@@ -23452,6 +23453,38 @@ async function installRuntime(stateDir, from = {}) {
|
|
|
23452
23453
|
}
|
|
23453
23454
|
return { entry, changed };
|
|
23454
23455
|
}
|
|
23456
|
+
async function snapshotRuntime(stateDir) {
|
|
23457
|
+
const dir = runtimeDir(stateDir);
|
|
23458
|
+
const backup = `${dir}.previous`;
|
|
23459
|
+
await (0, import_promises7.rm)(backup, { recursive: true, force: true });
|
|
23460
|
+
await (0, import_promises7.mkdir)(backup, { recursive: true, mode: 448 });
|
|
23461
|
+
const saved = /* @__PURE__ */ new Map();
|
|
23462
|
+
for (const name3 of [RUNTIME_ENTRY, KEYCHAIN_HELPER_NAME]) {
|
|
23463
|
+
const info = await (0, import_promises7.stat)((0, import_node_path10.join)(dir, name3)).catch(() => null);
|
|
23464
|
+
if (!info?.isFile())
|
|
23465
|
+
continue;
|
|
23466
|
+
await (0, import_promises7.copyFile)((0, import_node_path10.join)(dir, name3), (0, import_node_path10.join)(backup, name3));
|
|
23467
|
+
saved.set(name3, info.mode & 511);
|
|
23468
|
+
}
|
|
23469
|
+
const discard = () => (0, import_promises7.rm)(backup, { recursive: true, force: true });
|
|
23470
|
+
return {
|
|
23471
|
+
async restore() {
|
|
23472
|
+
await (0, import_promises7.mkdir)(dir, { recursive: true, mode: 448 });
|
|
23473
|
+
for (const name3 of [RUNTIME_ENTRY, KEYCHAIN_HELPER_NAME]) {
|
|
23474
|
+
const mode = saved.get(name3);
|
|
23475
|
+
if (mode !== void 0)
|
|
23476
|
+
await copyAtomic((0, import_node_path10.join)(backup, name3), (0, import_node_path10.join)(dir, name3), mode);
|
|
23477
|
+
else
|
|
23478
|
+
await (0, import_promises7.unlink)((0, import_node_path10.join)(dir, name3)).catch((error63) => {
|
|
23479
|
+
if (errorCode2(error63) !== "ENOENT")
|
|
23480
|
+
throw error63;
|
|
23481
|
+
});
|
|
23482
|
+
}
|
|
23483
|
+
await discard();
|
|
23484
|
+
},
|
|
23485
|
+
discard
|
|
23486
|
+
};
|
|
23487
|
+
}
|
|
23455
23488
|
async function runningFromRuntime(stateDir, entry = currentEntry()) {
|
|
23456
23489
|
const [running, installed] = await Promise.all([realpathLenient(entry), realpathLenient(runtimeEntry(stateDir))]);
|
|
23457
23490
|
return running === installed;
|
|
@@ -28222,7 +28255,6 @@ async function cmdSsh(stateDir, args, io) {
|
|
|
28222
28255
|
}
|
|
28223
28256
|
|
|
28224
28257
|
// dist/cli.js
|
|
28225
|
-
var import_promises16 = require("node:fs/promises");
|
|
28226
28258
|
var USAGE = `conbridge-agent ${AGENT_VERSION}
|
|
28227
28259
|
|
|
28228
28260
|
Usage:
|
|
@@ -28271,17 +28303,30 @@ async function exists(path) {
|
|
|
28271
28303
|
async function runInstalledCopy(paths, argv, io, keepsIdentity = true) {
|
|
28272
28304
|
if (!runningFromNpm() || await runningFromRuntime(paths.dir))
|
|
28273
28305
|
return null;
|
|
28274
|
-
const
|
|
28275
|
-
|
|
28306
|
+
const previous = await loadIdentity(paths).catch(() => null);
|
|
28307
|
+
const blocked = await keychainUpdateProblem(previous, (descriptor) => openKeyStore(paths, descriptor, { env: io.env }));
|
|
28308
|
+
if (blocked && keepsIdentity) {
|
|
28276
28309
|
io.err(blocked);
|
|
28277
28310
|
return 2;
|
|
28278
28311
|
}
|
|
28279
28312
|
await ensureStateDir(paths.dir);
|
|
28280
|
-
const
|
|
28281
|
-
|
|
28282
|
-
|
|
28283
|
-
|
|
28284
|
-
|
|
28313
|
+
const snapshot = blocked ? await snapshotRuntime(paths.dir) : null;
|
|
28314
|
+
let status;
|
|
28315
|
+
try {
|
|
28316
|
+
const { entry } = await installRuntime(paths.dir);
|
|
28317
|
+
const child = (0, import_node_child_process10.spawnSync)(process.execPath, [entry, ...argv], { stdio: "inherit", env: io.env });
|
|
28318
|
+
if (child.error)
|
|
28319
|
+
throw child.error;
|
|
28320
|
+
status = child.status ?? 1;
|
|
28321
|
+
} catch (error63) {
|
|
28322
|
+
await snapshot?.restore();
|
|
28323
|
+
throw error63;
|
|
28324
|
+
}
|
|
28325
|
+
if (snapshot) {
|
|
28326
|
+
const replaced = (await loadIdentity(paths).catch(() => null))?.device_uuid !== previous?.device_uuid;
|
|
28327
|
+
await (status !== 0 && !replaced ? snapshot.restore() : snapshot.discard());
|
|
28328
|
+
}
|
|
28329
|
+
return status;
|
|
28285
28330
|
}
|
|
28286
28331
|
async function keychainUpdateProblem(identity, open6) {
|
|
28287
28332
|
const descriptor = identity?.key_store;
|
|
@@ -28296,6 +28341,9 @@ async function keychainUpdateProblem(identity, open6) {
|
|
|
28296
28341
|
To move to ${AGENT_VERSION}, create a pairing code in the ConBridge Console and run: npx --yes conbridge-agent@latest pair --force --code XXXX-XXXX (then remove the old device in the Console).`;
|
|
28297
28342
|
}
|
|
28298
28343
|
}
|
|
28344
|
+
function pendingKeyPath(paths) {
|
|
28345
|
+
return `${paths.key}.pending`;
|
|
28346
|
+
}
|
|
28299
28347
|
async function newKeyStore(paths, values, env) {
|
|
28300
28348
|
const helper = await findKeychainHelper({ env });
|
|
28301
28349
|
const requested = values["key-store"] ?? (values.keychain !== void 0 ? "keychain" : void 0);
|
|
@@ -28308,7 +28356,7 @@ async function newKeyStore(paths, values, env) {
|
|
|
28308
28356
|
if (type === "file") {
|
|
28309
28357
|
if (values.keychain !== void 0)
|
|
28310
28358
|
throw new UsageError("--keychain only applies to the keychain key store");
|
|
28311
|
-
return new FileKeyStore(paths
|
|
28359
|
+
return new FileKeyStore(pendingKeyPath(paths));
|
|
28312
28360
|
}
|
|
28313
28361
|
if (values.keychain !== void 0 && !(0, import_node_path17.isAbsolute)(values.keychain))
|
|
28314
28362
|
throw new UsageError("--keychain needs an absolute path");
|
|
@@ -28348,12 +28396,8 @@ async function cmdPair(paths, args, io) {
|
|
|
28348
28396
|
const name3 = (values.name ?? (0, import_node_os8.hostname)()).trim().slice(0, 64) || "My computer";
|
|
28349
28397
|
const keyStore = await newKeyStore(paths, values, io.env);
|
|
28350
28398
|
const previous = await loadIdentity(paths);
|
|
28351
|
-
if (previous)
|
|
28352
|
-
|
|
28353
|
-
throw new UsageError("This agent is already paired; use --force to pair again (the old identity is discarded)");
|
|
28354
|
-
await (0, import_promises16.unlink)(paths.identity).catch(() => void 0);
|
|
28355
|
-
await discardOldKey(paths, previous, io.env);
|
|
28356
|
-
}
|
|
28399
|
+
if (previous && !values.force)
|
|
28400
|
+
throw new UsageError("This agent is already paired; use --force to pair again (the old identity is replaced once the new pairing is approved)");
|
|
28357
28401
|
await ensureStateDir(paths.dir);
|
|
28358
28402
|
io.out(`Device key store: ${keyStore.descriptor.type === "keychain" ? "macOS Keychain" : `file ${paths.key}`}`);
|
|
28359
28403
|
const identity = await pairDevice({
|
|
@@ -28365,8 +28409,14 @@ async function cmdPair(paths, args, io) {
|
|
|
28365
28409
|
onOffered: ({ fingerprint }) => {
|
|
28366
28410
|
io.out(`Offer sent. Device fingerprint: ${fingerprint}`);
|
|
28367
28411
|
io.out("Approve this device in the ConBridge Console and check that the fingerprint matches. Waiting...");
|
|
28412
|
+
},
|
|
28413
|
+
onApproved: async () => {
|
|
28414
|
+
if (keyStore.descriptor.type === "file")
|
|
28415
|
+
await (0, import_promises15.rename)(pendingKeyPath(paths), paths.key);
|
|
28368
28416
|
}
|
|
28369
28417
|
});
|
|
28418
|
+
if (previous && !(keyStore.descriptor.type === "file" && previous.key_store?.type !== "keychain"))
|
|
28419
|
+
await discardOldKey(paths, previous, io.env);
|
|
28370
28420
|
io.out(`Paired as "${identity.display_name}" (device ${identity.device_uuid}).`);
|
|
28371
28421
|
if (values["full-access"])
|
|
28372
28422
|
await cmdAccess(paths, ["full"], io);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "conbridge-agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "ConBridge Desktop Agent: connect this computer to ConBridge so approved AI apps can use the folders you share.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://conbridge.app",
|