@agentconnect.md/computer 2.12.0-rc.15 → 2.12.0-rc.19

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.
@@ -68048,7 +68048,9 @@ var ComputerAuthOk = external_exports.object({
68048
68048
  // The retention in effect for this Computer's screenshots (§9); 0 or absent means none are stored.
68049
68049
  screenshotRetentionDays: external_exports.number().int().min(0).max(COMPUTER_SCREENSHOT_RETENTION_MAX_DAYS).optional(),
68050
68050
  // A managed desktop's egress (§15.4); absent means direct unless `computer-egress-v1` is advertised. Secret, never logged.
68051
- egress: ComputerEgress.optional()
68051
+ egress: ComputerEgress.optional(),
68052
+ // A managed desktop's arrangement (§3.9): per-agent desktops for a `manual` one agents share, else one; absent, the owner's switch decides.
68053
+ desktops: external_exports.enum(["per-agent", "shared"]).optional()
68052
68054
  });
68053
68055
  var COMPUTER_DESKTOPS_FEATURE = "computer-desktops-v1";
68054
68056
  var COMPUTER_DESKTOPS_MAX = 64;
@@ -85371,6 +85373,14 @@ function describeDesktops(switchedOn, support) {
85371
85373
  if (!switchedOn) return "off (switched off): agents take turns on this desktop";
85372
85374
  return `on: each agent gets its own desktop (Xvfb + ${support.session === "xfce" ? "Xfce" : "xfwm4"})`;
85373
85375
  }
85376
+ function desktopsNotice(command) {
85377
+ return [
85378
+ "Per-agent desktops are on: each agent works on a desktop of its own, not on this screen; watch it in the console",
85379
+ "or the viewer. Agents' browsers start with a copy of this desktop's Chromium logins (the console policy",
85380
+ `"Share browser logins" turns that off). Turn per-agent desktops off with the tray's "Separate desktop for each`,
85381
+ `agent" or: ${command} desktops off`
85382
+ ].join("\n");
85383
+ }
85374
85384
  function desktopsCheck(switchedOn, support, command, install) {
85375
85385
  const detail = describeDesktops(switchedOn, support);
85376
85386
  const browserNote = support.browser ? "" : "; no Chromium found, so agents get no shared browser logins";
@@ -85446,13 +85456,21 @@ exec ${self2.map(quote).join(" ")} browser --desktop ${quote(id)} -- "$@" >>${qu
85446
85456
  writeFileSync3(join6(apps, file2), entry);
85447
85457
  }
85448
85458
  }
85449
- function memoryGiB() {
85459
+ function memoryGiB(read = (path) => readFileSync4(path, "utf8")) {
85460
+ const GiB = 1024 * 1024 * 1024;
85461
+ const free = [];
85462
+ try {
85463
+ const match = /^MemAvailable:\s+(\d+) kB/m.exec(read("/proc/meminfo"));
85464
+ if (match) free.push(Number(match[1]) * 1024);
85465
+ } catch {
85466
+ }
85450
85467
  try {
85451
- const match = /^MemAvailable:\s+(\d+) kB/m.exec(readFileSync4("/proc/meminfo", "utf8"));
85452
- if (match) return Math.max(1, Math.floor(Number(match[1]) / (1024 * 1024)));
85468
+ const limit = read("/sys/fs/cgroup/memory.max").trim();
85469
+ if (limit !== "max") free.push(Number(limit) - Number(read("/sys/fs/cgroup/memory.current").trim()));
85453
85470
  } catch {
85454
85471
  }
85455
- return 1;
85472
+ const least = free.filter((bytes) => Number.isFinite(bytes)).reduce((a, b) => Math.min(a, b), Infinity);
85473
+ return least === Infinity ? 1 : Math.max(0, Math.floor(least / GiB));
85456
85474
  }
85457
85475
  var DesktopManager = class {
85458
85476
  constructor(deps) {
@@ -85490,7 +85508,7 @@ var DesktopManager = class {
85490
85508
  return this.deps.config.perAgentDesktops && this.deps.support().supported;
85491
85509
  }
85492
85510
  max() {
85493
- return this.deps.config.maxDesktops ?? memoryGiB();
85511
+ return this.deps.config.maxDesktops ?? Math.max(1, this.running.size + memoryGiB());
85494
85512
  }
85495
85513
  /** A desktop by id for a person in the viewer, started if it is not running; undefined for an unknown id. */
85496
85514
  async byId(id) {
@@ -86834,8 +86852,8 @@ var DaemonConfig = external_exports.object({
86834
86852
  webrtc: external_exports.boolean().default(true),
86835
86853
  // Hold the display awake while running: a sleeping display cannot be captured or controlled.
86836
86854
  keepAwake: external_exports.boolean().default(true),
86837
- // Linux: each agent gets its own desktop where the machine supports it (computer-use.md §3.9); off until it ships whole.
86838
- perAgentDesktops: external_exports.boolean().default(false),
86855
+ // Linux: each agent gets its own desktop where the machine supports it (computer-use.md §3.9); false shares this one.
86856
+ perAgentDesktops: external_exports.boolean().default(true),
86839
86857
  // An agent desktop's screen, and how long one with no lease or viewer keeps its browser, then itself, running.
86840
86858
  desktopSize: external_exports.string().regex(/^\d{3,4}x\d{3,4}$/).default("1280x800"),
86841
86859
  browserIdleMinutes: external_exports.number().int().min(1).max(1440).default(10),
@@ -90331,7 +90349,7 @@ var serviceEntry = () => managedEntry() ?? resolve3(process.argv[1]);
90331
90349
 
90332
90350
  // src/version.ts
90333
90351
  init_define_AGENTCONNECT_COMPUTER_WINDOWS_SOURCES();
90334
- var COMPUTER_DAEMON_VERSION = true ? "2.12.0-rc.15" : JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
90352
+ var COMPUTER_DAEMON_VERSION = true ? "2.12.0-rc.19" : JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
90335
90353
 
90336
90354
  // src/http-server.ts
90337
90355
  var CONTROL_HEADER = "x-agentconnect-computer";
@@ -117618,8 +117636,8 @@ Commands:
117618
117636
  start a desktop's Chromium on its own profile, first merging the
117619
117637
  logins of the other profiles into it (or hand ARGS to the running one)
117620
117638
  browser-close --profile DIR [--display :N] close that browser the way a person would, so it saves its cookies
117621
- desktops [on | off | status] Linux: give each agent its own desktop (where the machine can:
117622
- Xvfb, D-Bus and Xfce), or let agents share this one (the default)
117639
+ desktops [on | off | status] Linux: give each agent its own desktop (the default where the
117640
+ machine can: Xvfb, D-Bus and Xfce), or let agents share this one
117623
117641
  service install | uninstall [--purge] | start | stop | restart | status
117624
117642
  background service: macOS .app LaunchAgent (the app holds
117625
117643
  the permissions), Linux systemd user unit (graphical session),
@@ -117978,7 +117996,10 @@ function startCpChannel(options) {
117978
117996
  computer.applyControlLease(lease);
117979
117997
  options.onDesktopLeases?.(desktops ?? []);
117980
117998
  },
117981
- onReady: (ok) => computer.rename(ok.name),
117999
+ onReady: (ok) => {
118000
+ computer.rename(ok.name);
118001
+ if (ok.desktops) options.onArrangement?.(ok.desktops === "per-agent");
118002
+ },
117982
118003
  onRelays: (relays) => relayLinks.converge(relays),
117983
118004
  onStop: (stop) => applyConsoleStop(stop),
117984
118005
  onEgress: (egress) => options.egress?.apply(egress),
@@ -118485,6 +118506,16 @@ async function run3(dir, initial, clientName) {
118485
118506
  live2.desktops?.setShareBrowserLogins(policy.shareBrowserLogins !== false);
118486
118507
  },
118487
118508
  desktops: () => live2.desktops,
118509
+ // Not saved: the Control Plane says it again on every connect, and the allocation never changes.
118510
+ onArrangement: (on) => {
118511
+ if (config2.perAgentDesktops === on) return;
118512
+ config2.perAgentDesktops = on;
118513
+ log39(
118514
+ `per-agent desktops ${on ? "on" : "off"}: this managed computer ${on ? "is shared by agents" : "serves one agent"}`
118515
+ );
118516
+ live2.local?.update();
118517
+ if (!on) void live2.desktops?.stopAll("this managed computer serves one agent");
118518
+ },
118488
118519
  onDesktopLeases: (leases) => {
118489
118520
  live2.desktopLeases = new Map(leases.flatMap((lease) => lease.desktop ? [[lease.desktop, lease]] : []));
118490
118521
  for (const desktop of live2.desktops?.runningDesktops() ?? [])
@@ -118755,6 +118786,7 @@ async function setup(dir, initial, clientName, withService) {
118755
118786
  }
118756
118787
  if (process.platform === "linux" && config2.perAgentDesktops) {
118757
118788
  await offerDesktopInstall(await probeDesktopSupport(), { log: (line) => console.log(line) });
118789
+ if ((await probeDesktopSupport()).supported) console.log(desktopsNotice(selfCommand()));
118758
118790
  }
118759
118791
  console.log("");
118760
118792
  let checks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentconnect.md/computer",
3
- "version": "2.12.0-rc.15",
3
+ "version": "2.12.0-rc.19",
4
4
  "description": "AgentConnect computer daemon: drives a desktop through Cua Driver and serves the computer_* tools over MCP; installed and upgraded by agentconnect computer",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {