conbridge-agent 0.9.1 → 0.9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # conbridge-agent
2
2
 
3
- ConBridge Desktop Agent 0.9.1: connects a computer or server to ConBridge so the AI apps you approve (ChatGPT,
3
+ ConBridge Desktop Agent 0.9.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
 
Binary file
@@ -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.9.1", commit: "8d2be2cfc4ba", built_at: "2026-11-23T15:05:57.439Z", keychain_helper_sha256: "0a2d65388c0acc75305386ce0d6b7ee2e522ed939f291eb5a50055197674c023", distribution: "npm" };
32
+ var define_CONBRIDGE_BUILD_default = { version: "0.9.2", commit: "5b372fab5c1f", built_at: "2026-11-23T16:14:56.890Z", keychain_helper_sha256: "5a29362ad38d1b42cab3b8c6cec774fedfd1157a1a0152d7763899a1480ea123", distribution: "npm" };
33
33
 
34
34
  // dist/cli.js
35
35
  var import_promises22 = require("node:readline/promises");
@@ -24584,9 +24584,10 @@ var import_node_fs = require("node:fs");
24584
24584
  var import_node_path = require("node:path");
24585
24585
  var import_node_sea = require("node:sea");
24586
24586
  var import_node_url = require("node:url");
24587
- var SOURCE_VERSION = "0.9.1";
24587
+ var SOURCE_VERSION = "0.9.2";
24588
24588
  var BUILD_INFO = typeof define_CONBRIDGE_BUILD_default === "object" && define_CONBRIDGE_BUILD_default !== null ? define_CONBRIDGE_BUILD_default : null;
24589
24589
  var AGENT_VERSION = BUILD_INFO?.version ?? SOURCE_VERSION;
24590
+ var RUNTIME_DIR_NAME = "runtime";
24590
24591
  function runningAsSea() {
24591
24592
  try {
24592
24593
  return (0, import_node_sea.isSea)();
@@ -25540,10 +25541,43 @@ function chooseKeyStoreType(requested, helperPath, platform2 = process.platform)
25540
25541
  }
25541
25542
  return platform2 === "darwin" && helperPath !== null ? "keychain" : "file";
25542
25543
  }
25544
+ var KEPT_HELPER_NAME = `${KEYCHAIN_HELPER_NAME}.kept`;
25545
+ var KEPT_HELPER_PIN_NAME = `${KEYCHAIN_HELPER_NAME}.kept.json`;
25546
+ var keptHelperPinSchema = external_exports.strictObject({
25547
+ version: external_exports.literal(1),
25548
+ key_id: external_exports.string().regex(KEY_ID),
25549
+ sha256: external_exports.string().regex(/^[0-9a-f]{64}$/)
25550
+ });
25551
+ function keptHelperPaths(stateDir) {
25552
+ const dir = (0, import_node_path6.join)(stateDir, RUNTIME_DIR_NAME);
25553
+ return { helper: (0, import_node_path6.join)(dir, KEPT_HELPER_NAME), pin: (0, import_node_path6.join)(dir, KEPT_HELPER_PIN_NAME) };
25554
+ }
25555
+ async function keptKeychainHelper(stateDir, keyId, platform2 = process.platform) {
25556
+ if (platform2 !== "darwin")
25557
+ return null;
25558
+ const paths = keptHelperPaths(stateDir);
25559
+ let pin;
25560
+ try {
25561
+ pin = keptHelperPinSchema.parse(JSON.parse(await (0, import_promises5.readFile)(paths.pin, "utf8")));
25562
+ } catch {
25563
+ return null;
25564
+ }
25565
+ if (pin.key_id !== keyId)
25566
+ return null;
25567
+ try {
25568
+ return await verifyKeychainHelper(paths.helper, pin.sha256);
25569
+ } catch {
25570
+ return null;
25571
+ }
25572
+ }
25543
25573
  async function openKeyStore(paths, descriptor, options = {}) {
25544
25574
  if (!descriptor || descriptor.type === "file")
25545
25575
  return new FileKeyStore(paths.key);
25546
- const helperPath = options.helperPath !== void 0 ? options.helperPath : await findKeychainHelper({ ...options.env ? { env: options.env } : {}, ...options.platform ? { platform: options.platform } : {} });
25576
+ const helperPath = options.helperPath !== void 0 ? options.helperPath : await keptKeychainHelper(paths.dir, descriptor.key_id, options.platform) ?? await findKeychainHelper({
25577
+ ...options.env ? { env: options.env } : {},
25578
+ ...options.platform ? { platform: options.platform } : {},
25579
+ ...options.codeDir ? { codeDir: options.codeDir } : {}
25580
+ });
25547
25581
  if (helperPath === null) {
25548
25582
  throw new KeychainError("HELPER_INVALID", "This identity keeps its key in the Keychain, but no valid Keychain helper (conbridge-agent-keychain) was found (it must exist next to the agent, not be writable by others and match this build)");
25549
25583
  }
@@ -26151,7 +26185,7 @@ async function purgeAgent(options, deps = {}) {
26151
26185
 
26152
26186
  // dist/cli.js
26153
26187
  var import_node_child_process12 = require("node:child_process");
26154
- var import_node_crypto13 = require("node:crypto");
26188
+ var import_node_crypto14 = require("node:crypto");
26155
26189
  var import_node_fs5 = require("node:fs");
26156
26190
  var import_promises23 = require("node:fs/promises");
26157
26191
  var import_node_os15 = require("node:os");
@@ -27103,12 +27137,13 @@ var Journal = class _Journal {
27103
27137
  };
27104
27138
 
27105
27139
  // dist/install.js
27140
+ var import_node_crypto7 = require("node:crypto");
27106
27141
  var import_promises10 = require("node:fs/promises");
27107
27142
  var import_node_path13 = require("node:path");
27108
27143
  var import_node_url2 = require("node:url");
27109
27144
  var RUNTIME_ENTRY = "conbridge-agent.cjs";
27110
27145
  function runtimeDir(stateDir) {
27111
- return (0, import_node_path13.join)(stateDir, "runtime");
27146
+ return (0, import_node_path13.join)(stateDir, RUNTIME_DIR_NAME);
27112
27147
  }
27113
27148
  function runtimeEntry(stateDir) {
27114
27149
  return (0, import_node_path13.join)(runtimeDir(stateDir), RUNTIME_ENTRY);
@@ -27161,6 +27196,65 @@ async function installRuntime(stateDir, from = {}) {
27161
27196
  }
27162
27197
  return { entry, changed };
27163
27198
  }
27199
+ async function helperReadsKey(helperPath, descriptor) {
27200
+ if (helperPath === null)
27201
+ return false;
27202
+ try {
27203
+ const store = new KeychainKeyStore({
27204
+ helperPath,
27205
+ keyId: descriptor.key_id,
27206
+ ...descriptor.keychain !== void 0 ? { keychainPath: descriptor.keychain } : {}
27207
+ });
27208
+ return await store.load() !== null;
27209
+ } catch {
27210
+ return false;
27211
+ }
27212
+ }
27213
+ async function dropKeptHelper(stateDir) {
27214
+ const kept = keptHelperPaths(stateDir);
27215
+ for (const path of [kept.pin, kept.helper]) {
27216
+ await (0, import_promises10.unlink)(path).catch((error63) => {
27217
+ if (errorCode2(error63) !== "ENOENT")
27218
+ throw error63;
27219
+ });
27220
+ }
27221
+ }
27222
+ async function keepKeychainHelper(stateDir, descriptor, options = {}) {
27223
+ if (!descriptor || descriptor.type !== "keychain")
27224
+ return "not-keychain";
27225
+ const platform2 = options.platform ?? process.platform;
27226
+ if (await helperReadsKey(await keptKeychainHelper(stateDir, descriptor.key_id, platform2), descriptor))
27227
+ return "kept";
27228
+ const shipped = await findKeychainHelper({
27229
+ platform: platform2,
27230
+ ...options.env ? { env: options.env } : {},
27231
+ ...options.codeDir ? { codeDir: options.codeDir } : {}
27232
+ });
27233
+ if (await helperReadsKey(shipped, descriptor)) {
27234
+ await dropKeptHelper(stateDir);
27235
+ return "shipped";
27236
+ }
27237
+ if (platform2 !== "darwin")
27238
+ return "unreadable";
27239
+ let installed;
27240
+ try {
27241
+ installed = await verifyKeychainHelper((0, import_node_path13.join)(runtimeDir(stateDir), KEYCHAIN_HELPER_NAME), null);
27242
+ } catch {
27243
+ return "unreadable";
27244
+ }
27245
+ if (!await helperReadsKey(installed, descriptor))
27246
+ return "unreadable";
27247
+ const bytes3 = await (0, import_promises10.readFile)(installed);
27248
+ const pin = { version: 1, key_id: descriptor.key_id, sha256: (0, import_node_crypto7.createHash)("sha256").update(bytes3).digest("hex") };
27249
+ const kept = keptHelperPaths(stateDir);
27250
+ await dropKeptHelper(stateDir);
27251
+ await writeFileAtomic(kept.helper, bytes3, 493);
27252
+ await writeFileAtomic(kept.pin, JSON.stringify(pin) + "\n", 384);
27253
+ if (await helperReadsKey(await keptKeychainHelper(stateDir, descriptor.key_id, platform2), descriptor))
27254
+ return "kept";
27255
+ await dropKeptHelper(stateDir);
27256
+ return "unreadable";
27257
+ }
27164
27258
  async function snapshotRuntime(stateDir) {
27165
27259
  const dir = runtimeDir(stateDir);
27166
27260
  const backup = `${dir}.previous`;
@@ -27436,12 +27530,12 @@ async function acquireLock(path) {
27436
27530
  }
27437
27531
 
27438
27532
  // dist/envelope.js
27439
- var import_node_crypto7 = require("node:crypto");
27440
- function buildEnvelope(identity, kind, taskId2, body, correlationId = (0, import_node_crypto7.randomUUID)()) {
27533
+ var import_node_crypto8 = require("node:crypto");
27534
+ function buildEnvelope(identity, kind, taskId2, body, correlationId = (0, import_node_crypto8.randomUUID)()) {
27441
27535
  return {
27442
27536
  version: 1,
27443
27537
  kind,
27444
- message_id: (0, import_node_crypto7.randomUUID)(),
27538
+ message_id: (0, import_node_crypto8.randomUUID)(),
27445
27539
  correlation_id: correlationId,
27446
27540
  tenant_id: identity.tenant_id,
27447
27541
  user_id: identity.user_id,
@@ -27485,12 +27579,12 @@ function excerpt(value) {
27485
27579
  var import_node_os14 = require("node:os");
27486
27580
 
27487
27581
  // dist/dispatcher.js
27488
- var import_node_crypto9 = require("node:crypto");
27582
+ var import_node_crypto10 = require("node:crypto");
27489
27583
 
27490
27584
  // dist/fileops.js
27491
27585
  var import_node_fs3 = require("node:fs");
27492
27586
  var import_promises12 = require("node:fs/promises");
27493
- var import_node_crypto8 = require("node:crypto");
27587
+ var import_node_crypto9 = require("node:crypto");
27494
27588
  var import_node_path15 = require("node:path");
27495
27589
 
27496
27590
  // dist/glob.js
@@ -27650,7 +27744,7 @@ function decodeText(bytes3) {
27650
27744
  }
27651
27745
  }
27652
27746
  async function hashHandle(handle) {
27653
- const hash2 = (0, import_node_crypto8.createHash)("sha256");
27747
+ const hash2 = (0, import_node_crypto9.createHash)("sha256");
27654
27748
  const buffer = Buffer.allocUnsafe(READ_BLOCK);
27655
27749
  let position2 = 0;
27656
27750
  for (; ; ) {
@@ -27663,7 +27757,7 @@ async function hashHandle(handle) {
27663
27757
  return hash2.digest("hex");
27664
27758
  }
27665
27759
  function sha256OfBytes(bytes3) {
27666
- return (0, import_node_crypto8.createHash)("sha256").update(bytes3).digest("hex");
27760
+ return (0, import_node_crypto9.createHash)("sha256").update(bytes3).digest("hex");
27667
27761
  }
27668
27762
  var RootedFs = class {
27669
27763
  #root;
@@ -27780,7 +27874,7 @@ var RootedFs = class {
27780
27874
  try {
27781
27875
  if (!info.isFile())
27782
27876
  throw new FileOpError("NOT_A_FILE", "Path is not a regular file", { path: rel });
27783
- const hash2 = (0, import_node_crypto8.createHash)("sha256");
27877
+ const hash2 = (0, import_node_crypto9.createHash)("sha256");
27784
27878
  const kept = [];
27785
27879
  let keptBytes = 0;
27786
27880
  let size = 0;
@@ -28721,7 +28815,7 @@ var Dispatcher = class {
28721
28815
  const state2 = { phase: "pending", cancelled: false, stopRequested: false, meta: meta3 };
28722
28816
  this.#inFlight.set(taskId2, state2);
28723
28817
  try {
28724
- const executionNonce = (0, import_node_crypto9.randomUUID)();
28818
+ const executionNonce = (0, import_node_crypto10.randomUUID)();
28725
28819
  this.#sendAck(dispatch2, "RECEIVED", executionNonce);
28726
28820
  let fileTask = isSshTask(authorized) || isShellTask(authorized) || isAgentTask(authorized) || isDiagTask(authorized) ? null : authorized;
28727
28821
  let fs = fileTask ? new RootedFs(fileTask.root, effectiveDenyGlobs(config2), { protectedPaths: this.#protectedPaths }) : null;
@@ -29171,7 +29265,7 @@ var MonitorLoop = class {
29171
29265
  };
29172
29266
 
29173
29267
  // dist/inventory/loop.js
29174
- var import_node_crypto11 = require("node:crypto");
29268
+ var import_node_crypto12 = require("node:crypto");
29175
29269
  var import_node_os9 = require("node:os");
29176
29270
  var import_node_zlib2 = require("node:zlib");
29177
29271
 
@@ -32555,13 +32649,13 @@ async function collectPlatformFacts(c) {
32555
32649
  var import_node_zlib = require("node:zlib");
32556
32650
 
32557
32651
  // dist/inventory/parsers/kernel-facts.js
32558
- var import_node_crypto10 = require("node:crypto");
32652
+ var import_node_crypto11 = require("node:crypto");
32559
32653
  var SYMBOL2 = /^[A-Z0-9_]{1,80}$/;
32560
32654
  var MODULE2 = /^[A-Za-z0-9_]{1,64}$/;
32561
32655
  var MODULE_SUFFIX = /\.ko(?:\.(?:zst|xz|gz))?$/;
32562
32656
  var sortUnique = (values) => [...new Set(values)].sort();
32563
32657
  function kernelConfigSha256(raw) {
32564
- return (0, import_node_crypto10.createHash)("sha256").update(raw).digest("hex");
32658
+ return (0, import_node_crypto11.createHash)("sha256").update(raw).digest("hex");
32565
32659
  }
32566
32660
  function parseKernelConfig(text6) {
32567
32661
  const builtin = [];
@@ -34293,7 +34387,7 @@ function mergeQueued(earlier, later) {
34293
34387
  return { requestId: null };
34294
34388
  }
34295
34389
  function partsOf(gz, requestId, runId, resourceId) {
34296
- const sha2563 = (0, import_node_crypto11.createHash)("sha256").update(gz).digest("hex");
34390
+ const sha2563 = (0, import_node_crypto12.createHash)("sha256").update(gz).digest("hex");
34297
34391
  const data = gz.toString("base64");
34298
34392
  const total = Math.max(1, Math.ceil(data.length / INVENTORY_PART_CHARS));
34299
34393
  return Array.from({ length: total }, (_, sequence) => ({
@@ -34356,7 +34450,7 @@ function contentSha256(snapshot) {
34356
34450
  const parsed = inventorySnapshotSchema.safeParse(JSON.parse(JSON.stringify(snapshot)));
34357
34451
  if (!parsed.success)
34358
34452
  return null;
34359
- return (0, import_node_crypto11.createHash)("sha256").update(inventoryContentCanonical(parsed.data), "utf8").digest("hex");
34453
+ return (0, import_node_crypto12.createHash)("sha256").update(inventoryContentCanonical(parsed.data), "utf8").digest("hex");
34360
34454
  }
34361
34455
  function sshFailureReason(reason2) {
34362
34456
  if (reason2 === "ssh could not be started")
@@ -34612,7 +34706,7 @@ var InventoryLoop = class {
34612
34706
  if (!this.#features.has("inventory_status.v1") || !this.#options.sendStatus)
34613
34707
  return;
34614
34708
  try {
34615
- this.#options.sendStatus({ run_id: (0, import_node_crypto11.randomUUID)(), ...body });
34709
+ this.#options.sendStatus({ run_id: (0, import_node_crypto12.randomUUID)(), ...body });
34616
34710
  } catch (error63) {
34617
34711
  this.#logger.warn("software inventory status not sent", { error: error63 instanceof Error ? error63.name : "unknown" });
34618
34712
  }
@@ -34653,7 +34747,7 @@ var InventoryLoop = class {
34653
34747
  if (!fitted)
34654
34748
  return "too_large";
34655
34749
  const sentDigest = fitted.snapshot === snapshot ? digest : contentSha256(fitted.snapshot);
34656
- const runId = (0, import_node_crypto11.randomUUID)();
34750
+ const runId = (0, import_node_crypto12.randomUUID)();
34657
34751
  const parts = partsOf(fitted.gz, requestId, runId, target.resourceId ?? void 0);
34658
34752
  return this.#exclusive(async () => {
34659
34753
  if (!await this.#awaitSpacing() || !stillWanted())
@@ -34696,7 +34790,7 @@ var InventoryLoop = class {
34696
34790
  const sendUnchanged = this.#options.sendUnchanged;
34697
34791
  if (!sendUnchanged)
34698
34792
  return "not_sent";
34699
- const runId = (0, import_node_crypto11.randomUUID)();
34793
+ const runId = (0, import_node_crypto12.randomUUID)();
34700
34794
  const body = {
34701
34795
  run_id: runId,
34702
34796
  request_id: null,
@@ -37181,7 +37275,7 @@ function jittered(base2, spread, random = Math.random) {
37181
37275
  }
37182
37276
 
37183
37277
  // dist/ssh/handler.js
37184
- var import_node_crypto12 = require("node:crypto");
37278
+ var import_node_crypto13 = require("node:crypto");
37185
37279
 
37186
37280
  // dist/diagnostics/parsers.js
37187
37281
  var failed2 = (status, facts = {}) => ({ status, facts });
@@ -38390,7 +38484,7 @@ var SshExecutor = class {
38390
38484
  stdout_bytes: result2.stdoutBytes,
38391
38485
  stderr_bytes: result2.stderrBytes,
38392
38486
  output_truncated: result2.truncated,
38393
- output_sha256: (0, import_node_crypto12.createHash)("sha256").update(result2.stdout).update("\0").update(result2.stderr).digest("hex"),
38487
+ output_sha256: (0, import_node_crypto13.createHash)("sha256").update(result2.stdout).update("\0").update(result2.stderr).digest("hex"),
38394
38488
  duration_ms: result2.durationMs
38395
38489
  };
38396
38490
  }
@@ -39945,13 +40039,14 @@ async function runInstalledCopy(paths, argv, io, keepsIdentity = true) {
39945
40039
  if (!runningFromNpm() || await runningFromRuntime(paths.dir))
39946
40040
  return null;
39947
40041
  const previous = await loadIdentity(paths).catch(() => null);
40042
+ const kept = await keepKeychainHelper(paths.dir, previous?.key_store, { env: io.env }).catch(() => "unreadable");
39948
40043
  const blocked = await keychainUpdateProblem(previous, (descriptor) => openKeyStore(paths, descriptor, { env: io.env }));
39949
40044
  if (blocked && keepsIdentity) {
39950
40045
  io.err(blocked);
39951
40046
  return 2;
39952
40047
  }
39953
40048
  await ensureStateDir(paths.dir);
39954
- const snapshot = blocked ? await snapshotRuntime(paths.dir) : null;
40049
+ const snapshot = blocked || kept === "kept" ? await snapshotRuntime(paths.dir) : null;
39955
40050
  let status;
39956
40051
  try {
39957
40052
  const { entry } = await installRuntime(paths.dir);
@@ -39978,9 +40073,9 @@ async function keychainUpdateProblem(identity, open8) {
39978
40073
  await (await open8(descriptor)).load();
39979
40074
  return null;
39980
40075
  } catch (error63) {
39981
- const reason2 = error63 instanceof KeychainError && error63.code === "DENIED" ? `macOS does not let agent ${AGENT_VERSION} read this Mac's device key (it was created by an older agent build, or the Keychain is locked)` : `agent ${AGENT_VERSION} could not check this Mac's device key (${errorMessage(error63)})`;
40076
+ const reason2 = error63 instanceof KeychainError && error63.code === "DENIED" ? `macOS does not let agent ${AGENT_VERSION} or the installed agent read this Mac's device key (the Keychain is locked, for example in an SSH session while nobody is logged in to the Mac, or the key was created by another agent install)` : `agent ${AGENT_VERSION} could not check this Mac's device key (${errorMessage(error63)})`;
39982
40077
  return `${reason2}. Nothing was changed; the installed agent keeps running.
39983
- 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).`;
40078
+ Log in to the Mac and run the update again. If it still fails, 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).`;
39984
40079
  }
39985
40080
  }
39986
40081
  function pendingKeyPath(paths) {
@@ -40004,7 +40099,7 @@ async function newKeyStore(paths, values, env) {
40004
40099
  throw new UsageError("--keychain needs an absolute path");
40005
40100
  return new KeychainKeyStore({
40006
40101
  helperPath: helper,
40007
- keyId: (0, import_node_crypto13.randomUUID)(),
40102
+ keyId: (0, import_node_crypto14.randomUUID)(),
40008
40103
  ...values.keychain !== void 0 ? { keychainPath: (0, import_node_path22.resolve)(values.keychain) } : {}
40009
40104
  });
40010
40105
  }
@@ -40313,6 +40408,9 @@ async function cmdStatus(paths, args, io) {
40313
40408
  io.out(` Fingerprint: ${identity.fingerprint}`);
40314
40409
  const store = identity.key_store ?? { type: "file" };
40315
40410
  io.out(` Key store: ${store.type === "keychain" ? `macOS Keychain (key id ${store.key_id}${store.keychain ? `, keychain ${store.keychain}` : ""})` : `file ${paths.key}`}`);
40411
+ if (store.type === "keychain" && await keptKeychainHelper(paths.dir, store.key_id)) {
40412
+ io.out(" Keychain helper: kept from the agent build that created the key (macOS trusts only that build)");
40413
+ }
40316
40414
  io.out(` Device key: ${await keyStatus(paths, identity, io.env)}`);
40317
40415
  }
40318
40416
  io.out(`Roots: ${config2.roots.length}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conbridge-agent",
3
- "version": "0.9.1",
3
+ "version": "0.9.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",