usebeeline 0.0.105 → 0.0.106

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 (2) hide show
  1. package/dist/usebeeline.mjs +117 -40
  2. package/package.json +1 -1
@@ -3987,7 +3987,7 @@ __export(self_update_exports, {
3987
3987
  import { createHash as createHash7 } from "node:crypto";
3988
3988
  import { constants as fsConstants2 } from "node:fs";
3989
3989
  import { access, chmod as chmod5, lstat as lstat3, mkdir as mkdir15, open, readFile as readFile10, rename as rename4, rm as rm6, symlink as symlink3, writeFile as writeFile10 } from "node:fs/promises";
3990
- import { spawn as spawn5 } from "node:child_process";
3990
+ import { spawn as spawn6 } from "node:child_process";
3991
3991
  import { homedir as homedir9 } from "node:os";
3992
3992
  import { dirname as dirname11, join as join9, resolve as resolve22 } from "node:path";
3993
3993
  function anchorLayout(rawLibDir) {
@@ -4137,7 +4137,7 @@ async function fetchText(url, fetchImpl) {
4137
4137
  }
4138
4138
  function run(command, args, timeoutMs) {
4139
4139
  return new Promise((resolveRun) => {
4140
- const child = spawn5(command, args, { stdio: ["ignore", "ignore", "pipe"] });
4140
+ const child = spawn6(command, args, { stdio: ["ignore", "ignore", "pipe"] });
4141
4141
  let stderr = "";
4142
4142
  child.stderr?.setEncoding("utf8");
4143
4143
  child.stderr?.on("data", (chunk) => {
@@ -4210,7 +4210,7 @@ async function stageRelease(layout, manifestUrl, published, opts = {}) {
4210
4210
  }
4211
4211
  await writeFile10(tempArchive, Buffer.concat(chunks), { mode: 384 });
4212
4212
  const entries = (await new Promise((resolveList, rejectList) => {
4213
- const child = spawn5("tar", ["-tzf", tempArchive], { stdio: ["ignore", "pipe", "inherit"] });
4213
+ const child = spawn6("tar", ["-tzf", tempArchive], { stdio: ["ignore", "pipe", "inherit"] });
4214
4214
  let out = "";
4215
4215
  child.stdout?.on("data", (chunk) => {
4216
4216
  out += chunk.toString("utf8");
@@ -8157,8 +8157,8 @@ async function syncAgentModelCatalog(input) {
8157
8157
  }
8158
8158
 
8159
8159
  // apps/body/dist/connector-squire.js
8160
- import { execFile } from "node:child_process";
8161
- var REMOTE_LOGIN_BINARIES = ["Xvfb", "x11vnc", "websockify", "cloudflared"];
8160
+ import { execFile, spawn as spawn2 } from "node:child_process";
8161
+ var REMOTE_LOGIN_BINARIES = ["xvfb-run", "Xvfb", "x11vnc", "websockify", "cloudflared"];
8162
8162
  var SQUIRE_CONNECT_PACKAGE = "@trusty-squire/mcp";
8163
8163
  var defaultShellRunner = (command, args) => new Promise((resolve31) => {
8164
8164
  execFile(command, [...args], { timeout: 12e4, maxBuffer: 4 * 1024 * 1024, encoding: "utf8" }, (error, stdout6, stderr) => {
@@ -8170,6 +8170,58 @@ var defaultShellRunner = (command, args) => new Promise((resolve31) => {
8170
8170
  });
8171
8171
  });
8172
8172
  });
8173
+ var CONNECT_TIMEOUT_MS = 3e5;
8174
+ var defaultStreamedRunner = (command, args) => new Promise((resolve31) => {
8175
+ const child = spawn2(command, args, {
8176
+ stdio: ["ignore", "pipe", "pipe"]
8177
+ });
8178
+ let stdout6 = "";
8179
+ let stderr = "";
8180
+ let resolved = false;
8181
+ const safetyTimer = setTimeout(() => {
8182
+ if (!resolved) {
8183
+ resolved = true;
8184
+ resolve31({ stdout: stdout6, stderr, signIn: void 0, abort: () => {
8185
+ } });
8186
+ }
8187
+ child.kill();
8188
+ }, CONNECT_TIMEOUT_MS);
8189
+ const abort = () => {
8190
+ clearTimeout(safetyTimer);
8191
+ child.kill();
8192
+ };
8193
+ const finish = (result) => {
8194
+ if (!resolved) {
8195
+ resolved = true;
8196
+ clearTimeout(safetyTimer);
8197
+ resolve31(result);
8198
+ }
8199
+ };
8200
+ const checkOutput = () => {
8201
+ const combined = `${stdout6}
8202
+ ${stderr}`;
8203
+ const signIn = parseConnectOutput(combined);
8204
+ if (signIn) {
8205
+ finish({ stdout: stdout6, stderr, signIn, abort });
8206
+ }
8207
+ };
8208
+ child.stdout?.on("data", (chunk) => {
8209
+ stdout6 += String(chunk);
8210
+ checkOutput();
8211
+ });
8212
+ child.stderr?.on("data", (chunk) => {
8213
+ stderr += String(chunk);
8214
+ checkOutput();
8215
+ });
8216
+ child.on("close", () => {
8217
+ finish({ stdout: stdout6, stderr, signIn: void 0, abort: () => {
8218
+ } });
8219
+ });
8220
+ child.on("error", () => {
8221
+ finish({ stdout: stdout6, stderr, signIn: void 0, abort: () => {
8222
+ } });
8223
+ });
8224
+ });
8173
8225
  var step = (label, status, reason) => ({
8174
8226
  label,
8175
8227
  status,
@@ -8212,6 +8264,7 @@ function parseSignedInAs(output) {
8212
8264
  }
8213
8265
  async function installSquire(options) {
8214
8266
  const run2 = options.run ?? defaultShellRunner;
8267
+ const streamRun = options.streamRun ?? defaultStreamedRunner;
8215
8268
  const steps = [step("helper reached", "done")];
8216
8269
  const emit = () => options.onProgress?.([...steps]);
8217
8270
  const push = (next) => {
@@ -8230,28 +8283,26 @@ async function installSquire(options) {
8230
8283
  return fail("this helper cannot host the remote sign-in surface");
8231
8284
  }
8232
8285
  push(step("remote sign-in prerequisites", "done"));
8233
- const install = await run2("npx", [
8286
+ const install = await streamRun("xvfb-run", [
8287
+ "-a",
8288
+ "npx",
8234
8289
  "-y",
8235
8290
  SQUIRE_CONNECT_PACKAGE,
8236
8291
  "connect",
8237
- "--target=pi",
8238
- "--skip-browser"
8292
+ "--force-relogin=google",
8293
+ "--target=codex"
8239
8294
  ]);
8240
- if (install.code !== 0) {
8241
- push(step("trusty-squire installed", "failed", install.stderr.trim() || "connect failed"));
8242
- return fail("the trusty-squire install command failed");
8295
+ if (!install.signIn) {
8296
+ const stderr = install.stderr.trim();
8297
+ push(step("trusty-squire installed", "failed", stderr || "connect printed no sign-in URL"));
8298
+ return fail(stderr || "the trusty-squire connect command printed no sign-in surface");
8243
8299
  }
8244
8300
  const version = await installedSquireVersion(run2);
8245
8301
  push(step(`trusty-squire${version ? ` ${version}` : ""} installed`, "done"));
8246
- const output = `${install.stdout}
8247
- ${install.stderr}`;
8248
- const signIn = parseConnectOutput(output);
8249
- if (!signIn) {
8250
- push(step("waiting for sign-in", "failed", "connect printed no sign-in URL"));
8251
- return fail("the trusty-squire connect command printed no sign-in surface");
8252
- }
8302
+ const signIn = install.signIn;
8303
+ const signedInAs = parseSignedInAs(`${install.stdout}
8304
+ ${install.stderr}`);
8253
8305
  push(step("waiting for sign-in", "done"));
8254
- const signedInAs = parseSignedInAs(output);
8255
8306
  const pair = await pairSquire(options.mcp, options.workspaceId);
8256
8307
  if (!pair.ok) {
8257
8308
  push(step("paired to workspace", "failed", pair.reason));
@@ -8346,7 +8397,7 @@ async function revokeGrants(mcp, ref) {
8346
8397
  }
8347
8398
 
8348
8399
  // apps/body/dist/squire-mcp-client.js
8349
- import { spawn as spawn2 } from "node:child_process";
8400
+ import { spawn as spawn3 } from "node:child_process";
8350
8401
  var INITIALIZE_TIMEOUT_MS = 3e4;
8351
8402
  var CALL_TIMEOUT_MS = 12e4;
8352
8403
  var StdioSquireMcpClient = class {
@@ -8402,7 +8453,7 @@ var StdioSquireMcpClient = class {
8402
8453
  return this.initialized;
8403
8454
  }
8404
8455
  initialize() {
8405
- const child = (this.options.spawn ?? spawn2)(this.options.command ?? "npx", [
8456
+ const child = (this.options.spawn ?? spawn3)(this.options.command ?? "npx", [
8406
8457
  ...this.options.args ?? ["-y", "@trusty-squire/mcp"]
8407
8458
  ]);
8408
8459
  this.child = child;
@@ -8692,7 +8743,7 @@ import { closeSync, openSync } from "node:fs";
8692
8743
  import { mkdir, readFile as readFile2, readdir, rename, stat, writeFile as writeFile2 } from "node:fs/promises";
8693
8744
  import { homedir as homedir2 } from "node:os";
8694
8745
  import { dirname as dirname2, resolve as resolve6 } from "node:path";
8695
- import { spawn as spawn3 } from "node:child_process";
8746
+ import { spawn as spawn4 } from "node:child_process";
8696
8747
  import { promisify } from "node:util";
8697
8748
 
8698
8749
  // node_modules/@noble/hashes/_u64.js
@@ -17413,7 +17464,7 @@ async function launchRuntimeDaemon(configPath, opts = {}) {
17413
17464
  const entrypoint = opts.entrypoint ?? process.argv[1];
17414
17465
  if (!entrypoint)
17415
17466
  throw new Error("cannot resolve daemon CLI entrypoint");
17416
- const child = spawn3(process.execPath, [...opts.execArgv ?? [], entrypoint, "daemon", "--config", resolve6(configPath)], {
17467
+ const child = spawn4(process.execPath, [...opts.execArgv ?? [], entrypoint, "daemon", "--config", resolve6(configPath)], {
17417
17468
  cwd: directory,
17418
17469
  env: opts.env ?? process.env,
17419
17470
  detached: !foreground,
@@ -18351,9 +18402,9 @@ var GrantCommandRunner = class {
18351
18402
  ...Object.fromEntries(secrets)
18352
18403
  };
18353
18404
  const cap = this.options.outputCapBytes ?? GRANT_COMMAND_OUTPUT_CAP_BYTES;
18354
- const spawn9 = surfaceAllows(policy.surface, "run-host-command") ? { command: argv[0], args: argv.slice(1) } : roomSandboxCommand(policy, room.cwd, argv);
18405
+ const spawn10 = surfaceAllows(policy.surface, "run-host-command") ? { command: argv[0], args: argv.slice(1) } : roomSandboxCommand(policy, room.cwd, argv);
18355
18406
  const outcome = await new Promise((resolveRun) => {
18356
- const child = execFile3(spawn9.command, spawn9.args, {
18407
+ const child = execFile3(spawn10.command, spawn10.args, {
18357
18408
  cwd: room.cwd,
18358
18409
  env,
18359
18410
  timeout: this.options.timeoutMs ?? GRANT_COMMAND_TIMEOUT_MS,
@@ -25210,9 +25261,10 @@ async function runStartCommand(args, interactiveUi) {
25210
25261
  }
25211
25262
 
25212
25263
  // apps/body/dist/connect-command.js
25213
- import { spawn as spawn6 } from "node:child_process";
25214
- import { createHash as createHash8 } from "node:crypto";
25264
+ import { spawn as spawn7 } from "node:child_process";
25265
+ import { createHash as createHash8, randomUUID as randomUUID5 } from "node:crypto";
25215
25266
  import { chmod as chmod6, mkdir as mkdir16, readFile as readFile11, unlink as unlink2, writeFile as writeFile11 } from "node:fs/promises";
25267
+ import { homedir as homedir10, hostname } from "node:os";
25216
25268
  import { dirname as dirname12, resolve as resolve23 } from "node:path";
25217
25269
  import { stdin as stdin3, stdout as stdout4 } from "node:process";
25218
25270
 
@@ -25297,7 +25349,7 @@ async function verifyProviderKey(input) {
25297
25349
  }
25298
25350
 
25299
25351
  // apps/body/dist/pair-agent-selection.js
25300
- import { spawn as spawn4 } from "node:child_process";
25352
+ import { spawn as spawn5 } from "node:child_process";
25301
25353
  import { stdin as stdin2, stdout as stdout3 } from "node:process";
25302
25354
  var NO_AGENT_MESSAGE = `No supported ACP-capable coding agent was detected.
25303
25355
  Install one of these supported agents:
@@ -25325,7 +25377,7 @@ async function clackSelectAgent(candidates) {
25325
25377
  }
25326
25378
  async function installAdapter(install, opts) {
25327
25379
  await new Promise((resolveInstall, rejectInstall) => {
25328
- const child = spawn4(install.command, install.args, {
25380
+ const child = spawn5(install.command, install.args, {
25329
25381
  cwd: opts.cwd,
25330
25382
  env: opts.env ?? process.env,
25331
25383
  stdio: "inherit"
@@ -25826,7 +25878,29 @@ function parseConnectSubscriptions(value) {
25826
25878
  ...new Set((value ?? "").split(",").map((entry) => entry.trim().toLowerCase()).filter(Boolean))
25827
25879
  ];
25828
25880
  }
25829
- function requestConnectGrant(baseUrl, pairingCode, selection, fetchImpl) {
25881
+ async function readMachineId(env = process.env) {
25882
+ const configDir = resolve23(env.XDG_CONFIG_HOME ?? resolve23(homedir10(), ".config"), "beeline");
25883
+ const machineIdPath = resolve23(configDir, "machine-id");
25884
+ let machineId;
25885
+ let machineName = hostname();
25886
+ try {
25887
+ const existing = await readFile11(machineIdPath, "utf8");
25888
+ machineId = existing.trim();
25889
+ if (!/^[0-9a-f-]{32,}$/.test(machineId))
25890
+ throw new Error("invalid persisted machine id");
25891
+ } catch {
25892
+ machineId = randomUUID5();
25893
+ try {
25894
+ await mkdir16(configDir, { recursive: true, mode: 448 });
25895
+ await writeFile11(machineIdPath, `${machineId}
25896
+ `, { mode: 384 });
25897
+ } catch {
25898
+ machineId = createHash8("sha256").update(machineName).digest("hex").slice(0, 36);
25899
+ }
25900
+ }
25901
+ return { machineId, machineName };
25902
+ }
25903
+ function requestConnectGrant(baseUrl, pairingCode, selection, fetchImpl, machineInfo) {
25830
25904
  const normalizedPairingCode = normalizeAgentPairingCode(pairingCode);
25831
25905
  if (!normalizedPairingCode)
25832
25906
  throw new Error("invalid pairing code");
@@ -25841,7 +25915,8 @@ function requestConnectGrant(baseUrl, pairingCode, selection, fetchImpl) {
25841
25915
  // This wizard always finishes the join itself (`finishConnectedAgentPairing`,
25842
25916
  // called once the rename prompt below settles), so the claim must not
25843
25917
  // join Rooms or announce yet.
25844
- defer_join: true
25918
+ defer_join: true,
25919
+ ...machineInfo ? { machine_id: machineInfo.machineId, machine_name: machineInfo.machineName } : {}
25845
25920
  }, fetchImpl);
25846
25921
  }
25847
25922
  async function renameConnectedAgent(baseUrl, pairingCode, name, fetchImpl) {
@@ -25920,7 +25995,7 @@ async function writeProviderEnv(selection, agentPubkey) {
25920
25995
  }
25921
25996
  async function runInstalledFinish(binary, grantPath) {
25922
25997
  await new Promise((resolveRun, rejectRun) => {
25923
- const child = spawn6(binary, ["connect-finish", grantPath], {
25998
+ const child = spawn7(binary, ["connect-finish", grantPath], {
25924
25999
  stdio: ["ignore", "pipe", "pipe"]
25925
26000
  });
25926
26001
  let diagnostic = "";
@@ -25971,7 +26046,8 @@ async function runConnectWizard(code, fetchImpl, eventSubscriptions, accessPolic
25971
26046
  });
25972
26047
  const selection = await collectConnectWizard(clackPrompts, loadConnectModelCatalog, fileConnectKeyStore, process.env, (input) => verifyProviderKey({ ...input, fetchImpl }));
25973
26048
  const baseUrl = (process.env.BEELINE_AUTH_URL ?? "https://server.usebeeline.app").replace(/\/$/, "");
25974
- const claimed = await brassSpinner("Connecting to your Beeline Workspace\u2026", () => requestConnectGrant(baseUrl, pairingCode, selection, fetchImpl), (connectedGrant) => `Connected to ${connectedGrant.workspace_name}`);
26049
+ const machineInfo = await readMachineId(process.env);
26050
+ const claimed = await brassSpinner("Connecting to your Beeline Workspace\u2026", () => requestConnectGrant(baseUrl, pairingCode, selection, fetchImpl, machineInfo), (connectedGrant) => `Connected to ${connectedGrant.workspace_name}`);
25975
26051
  const grant = { ...claimed, agent_name: await confirmSeededName(baseUrl, pairingCode, claimed, fetchImpl) };
25976
26052
  await finishConnectedAgentPairing(baseUrl, pairingCode, grant.workspace_joined, eventSubscriptions, fetchImpl);
25977
26053
  const installedRelease = await brassSpinner("Installing the Beeline daemon\u2026", () => installCurrentRelease(fetchImpl), (release) => `Installed Beeline helper ${release.version}`);
@@ -26093,7 +26169,7 @@ init_self_update_manifest();
26093
26169
 
26094
26170
  // apps/body/dist/managed-update.js
26095
26171
  init_self_update();
26096
- import { spawn as spawn7 } from "node:child_process";
26172
+ import { spawn as spawn8 } from "node:child_process";
26097
26173
  import { mkdir as mkdir18, rm as rm7, stat as stat3, writeFile as writeFile13 } from "node:fs/promises";
26098
26174
  import { dirname as dirname14, resolve as resolve25 } from "node:path";
26099
26175
 
@@ -26507,7 +26583,7 @@ async function runManagedUpdateWorkerProcess() {
26507
26583
  if (!entrypoint)
26508
26584
  throw new Error("cannot resolve the current Beeline entrypoint");
26509
26585
  await new Promise((resolveWorker, rejectWorker) => {
26510
- const child = spawn7(process.execPath, [entrypoint, "managed-update-worker"], {
26586
+ const child = spawn8(process.execPath, [entrypoint, "managed-update-worker"], {
26511
26587
  detached: true,
26512
26588
  env: { ...process.env, BEELINE_INTERNAL_UPDATE_WORKER: "1" },
26513
26589
  stdio: ["ignore", "pipe", "pipe"]
@@ -26861,7 +26937,7 @@ async function clearDaemonStartFailures(runtimeDir) {
26861
26937
 
26862
26938
  // apps/body/dist/update-functional-probe.js
26863
26939
  import { mkdir as mkdir20, rm as rm9 } from "node:fs/promises";
26864
- import { homedir as homedir10 } from "node:os";
26940
+ import { homedir as homedir11 } from "node:os";
26865
26941
  import { resolve as resolve27 } from "node:path";
26866
26942
  var UPDATE_PROBE_SESSION_TIMEOUT_MS = 1e4;
26867
26943
  var UPDATE_PROBE_SESSION_OPEN_TIMEOUT_MS = 2e4;
@@ -26967,7 +27043,7 @@ async function runUpdateFunctionalProbe(input) {
26967
27043
  ...input.config.agentEnv,
26968
27044
  ...await prepareRoomAgentHome({
26969
27045
  root: homeRoot,
26970
- operatorHome: input.config.operatorHome ?? homedir10(),
27046
+ operatorHome: input.config.operatorHome ?? homedir11(),
26971
27047
  sharedSkills: input.config.sharedSkills ?? [],
26972
27048
  ...input.config.agentKind ? { agentKind: input.config.agentKind } : {},
26973
27049
  skillReleaseId: input.releaseId,
@@ -26988,7 +27064,7 @@ async function runUpdateFunctionalProbe(input) {
26988
27064
  let turnCompleted = true;
26989
27065
  if (input.config.bwrapPath) {
26990
27066
  const { stateDirs, tmpDir } = harnessStateDirsFromEnv(agentEnv);
26991
- const operatorHome = input.config.operatorHome ?? homedir10();
27067
+ const operatorHome = input.config.operatorHome ?? homedir11();
26992
27068
  const homeStateDirs = harnessHomeStateDirs(command, agentEnv.HOME ?? operatorHome);
26993
27069
  await Promise.all(homeStateDirs.map((dir) => mkdir20(dir, { recursive: true })));
26994
27070
  spawnCommand = wrapAgentCommand({
@@ -27139,7 +27215,7 @@ async function runUpdateFunctionalProbe(input) {
27139
27215
  }
27140
27216
 
27141
27217
  // apps/body/dist/current-release-probe.js
27142
- import { spawn as spawn8 } from "node:child_process";
27218
+ import { spawn as spawn9 } from "node:child_process";
27143
27219
  import { dirname as dirname16, join as join10 } from "node:path";
27144
27220
  init_self_update();
27145
27221
  var CURRENT_RELEASE_PROBE_TIMEOUT_MS = 12e4;
@@ -27190,7 +27266,7 @@ async function probeReleaseInSubprocess(input) {
27190
27266
  }
27191
27267
  const timeoutMs = input.timeoutMs ?? CURRENT_RELEASE_PROBE_TIMEOUT_MS;
27192
27268
  return new Promise((resolve31) => {
27193
- const child = spawn8(input.execPath ?? process.execPath, [entrypoint, UPDATE_PROBE_COMMAND, "--config", input.runtimeConfigPath], { env: input.env ?? process.env, stdio: ["ignore", "pipe", "pipe"] });
27269
+ const child = spawn9(input.execPath ?? process.execPath, [entrypoint, UPDATE_PROBE_COMMAND, "--config", input.runtimeConfigPath], { env: input.env ?? process.env, stdio: ["ignore", "pipe", "pipe"] });
27194
27270
  let stdout6 = "";
27195
27271
  let stderr = "";
27196
27272
  let settled = false;
@@ -27608,6 +27684,7 @@ async function runStoredDaemon(pathOrPointer) {
27608
27684
  ...runtime.modelSelection ? { runtimeSelection: runtime.modelSelection } : {},
27609
27685
  ...config.modelUnavailable ? { startupUnavailable: config.modelUnavailable.unavailable.label } : {}
27610
27686
  });
27687
+ void readMachineId(process.env).then(({ machineId, machineName }) => daemonApi.execute("postAgentMachineReport", { machineId, machineName }));
27611
27688
  connectorLoop ??= new ConnectorAssignmentLoop({
27612
27689
  api: daemonApi,
27613
27690
  agentId: runtime.agent.publicKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "usebeeline",
3
- "version": "0.0.105",
3
+ "version": "0.0.106",
4
4
  "description": "Connect an AI coding agent to Beeline with one command.",
5
5
  "homepage": "https://usebeeline.app",
6
6
  "bugs": {