@buildautomaton/cli 0.1.72 → 0.1.73

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/dist/cli.js CHANGED
@@ -31064,7 +31064,7 @@ var {
31064
31064
  } = import_index.default;
31065
31065
 
31066
31066
  // src/cli-version.ts
31067
- var CLI_VERSION = "0.1.72".length > 0 ? "0.1.72" : "0.0.0-dev";
31067
+ var CLI_VERSION = "0.1.73".length > 0 ? "0.1.73" : "0.0.0-dev";
31068
31068
 
31069
31069
  // src/cli/defaults.ts
31070
31070
  var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
@@ -35985,12 +35985,32 @@ function attachSdkStdioStderrAuthWatch(options) {
35985
35985
 
35986
35986
  // src/agents/acp/clients/sdk/spawn-sdk-stdio-process.ts
35987
35987
  import { spawn } from "node:child_process";
35988
+
35989
+ // src/agents/acp/clients/bridge-installed-agent-auth-env.ts
35990
+ var authEnv = /* @__PURE__ */ new Map();
35991
+ function setBridgeInstalledAgentAuthEnv(entries) {
35992
+ authEnv.clear();
35993
+ for (const entry of entries) {
35994
+ const envVar = typeof entry.envVar === "string" ? entry.envVar.trim() : "";
35995
+ const token = typeof entry.token === "string" ? entry.token.trim() : "";
35996
+ if (envVar && token) authEnv.set(envVar, token);
35997
+ }
35998
+ }
35999
+ function bridgeInstalledAgentAuthProcessEnv(base = process.env) {
36000
+ if (authEnv.size === 0) return base;
36001
+ return { ...base, ...Object.fromEntries(authEnv) };
36002
+ }
36003
+ function cursorAgentUsesApiKeyAuth(env = process.env) {
36004
+ return Boolean(env.CURSOR_API_KEY?.trim() || env.CURSOR_AUTH_TOKEN?.trim());
36005
+ }
36006
+
36007
+ // src/agents/acp/clients/sdk/spawn-sdk-stdio-process.ts
35988
36008
  function spawnSdkStdioProcess(options) {
35989
36009
  const isWindows = process.platform === "win32";
35990
36010
  const child = spawn(options.command[0], options.command.slice(1), {
35991
36011
  cwd: options.cwd,
35992
36012
  stdio: ["pipe", "pipe", "pipe"],
35993
- env: process.env,
36013
+ env: bridgeInstalledAgentAuthProcessEnv(process.env),
35994
36014
  shell: isWindows
35995
36015
  });
35996
36016
  const stderrCapture = createStderrCapture(child);
@@ -36450,10 +36470,11 @@ function createCursorAcpIncomingLineHandler(deps) {
36450
36470
 
36451
36471
  // src/agents/acp/clients/cursor/cursor-json-rpc-acp-transport.ts
36452
36472
  function createCursorJsonRpcAcpTransport(deps) {
36453
- const { send, cancelSessionNotification } = deps;
36473
+ const { send, cancelSessionNotification, skipBrowserAuthenticate } = deps;
36454
36474
  return {
36455
36475
  initialize: (request) => send("initialize", request),
36456
36476
  afterInitialize: async () => {
36477
+ if (skipBrowserAuthenticate) return;
36457
36478
  await send("authenticate", { methodId: "cursor_login" });
36458
36479
  },
36459
36480
  resumeSession: (p) => send("session/resume", p),
@@ -36562,7 +36583,8 @@ async function initCursorAcpWire(options) {
36562
36583
  rl.on("line", (line) => incoming.handleLine(line));
36563
36584
  const transport = createCursorJsonRpcAcpTransport({
36564
36585
  send: wire.send,
36565
- cancelSessionNotification: wire.cancelSessionNotification
36586
+ cancelSessionNotification: wire.cancelSessionNotification,
36587
+ skipBrowserAuthenticate: options.skipBrowserAuthenticate
36566
36588
  });
36567
36589
  const established = await bootstrapAcpWireSession(transport, options.sessionCtx, CURSOR_ACP_CLIENT_INFO);
36568
36590
  return { wire, transport, established, incoming, pendingRequests: pendingRequests2 };
@@ -36575,7 +36597,7 @@ function spawnCursorAcpProcess(options) {
36575
36597
  const child = spawn2(options.command[0], options.command.slice(1), {
36576
36598
  cwd: options.cwd,
36577
36599
  stdio: ["pipe", "pipe", "pipe"],
36578
- env: process.env,
36600
+ env: bridgeInstalledAgentAuthProcessEnv(process.env),
36579
36601
  shell: isWindows
36580
36602
  });
36581
36603
  const stderrCapture = createStderrCapture(child);
@@ -36607,11 +36629,13 @@ async function createCursorAcpClient(options) {
36607
36629
  onAgentSubprocessExit
36608
36630
  } = options;
36609
36631
  const dbgFs = process.env.BUILDAUTOMATON_DEBUG_ACP_FS === "1";
36632
+ const spawnEnv = bridgeInstalledAgentAuthProcessEnv(process.env);
36610
36633
  const { child, stderrCapture } = spawnCursorAcpProcess({
36611
36634
  command,
36612
36635
  cwd,
36613
36636
  onAgentSubprocessExit
36614
36637
  });
36638
+ const skipBrowserAuthenticate = cursorAgentUsesApiKeyAuth(spawnEnv);
36615
36639
  const sessionCtx = createCursorAcpSessionContext({
36616
36640
  cwd,
36617
36641
  mcpServers: options.mcpServers,
@@ -36634,6 +36658,7 @@ async function createCursorAcpClient(options) {
36634
36658
  const { wire, transport, established, incoming, pendingRequests: pendingRequests2 } = await initCursorAcpWire({
36635
36659
  child,
36636
36660
  sessionCtx,
36661
+ skipBrowserAuthenticate,
36637
36662
  incomingDeps: { dbgFs, sessionCtx, onSessionUpdate, onRequest }
36638
36663
  });
36639
36664
  resolve37(
@@ -51554,6 +51579,7 @@ function buildBridgeUrl(apiUrl, workspaceId, authToken) {
51554
51579
  var API_TO_BRIDGE_MESSAGE_TYPES = [
51555
51580
  "auth_token",
51556
51581
  "bridge_identified",
51582
+ "installed_agent_auth_sync",
51557
51583
  "ha",
51558
51584
  "preview_environments_config",
51559
51585
  "preview_environment_control",
@@ -51642,6 +51668,16 @@ var handleBridgeIdentified = (msg, deps) => {
51642
51668
  });
51643
51669
  };
51644
51670
 
51671
+ // src/routing/handlers/installed-agent-auth-sync.ts
51672
+ var handleInstalledAgentAuthSync = (msg) => {
51673
+ const entries = Array.isArray(msg.entries) ? msg.entries : [];
51674
+ setBridgeInstalledAgentAuthEnv(
51675
+ entries.filter(
51676
+ (e) => e != null && typeof e === "object" && typeof e.envVar === "string" && typeof e.token === "string"
51677
+ )
51678
+ );
51679
+ };
51680
+
51645
51681
  // src/connection/heartbeat/ack.ts
51646
51682
  var handleBridgeHeartbeatAck = (msg, deps) => {
51647
51683
  const raw = msg.s;
@@ -51658,6 +51694,9 @@ function dispatchBridgeConnectionMessage(msg, deps) {
51658
51694
  case "bridge_identified":
51659
51695
  handleBridgeIdentified(msg, deps);
51660
51696
  break;
51697
+ case "installed_agent_auth_sync":
51698
+ handleInstalledAgentAuthSync(msg, deps);
51699
+ break;
51661
51700
  case "ha":
51662
51701
  handleBridgeHeartbeatAck(msg, deps);
51663
51702
  break;
@@ -53512,6 +53551,7 @@ function dispatchBridgeMessage(msg, deps) {
53512
53551
  switch (msg.type) {
53513
53552
  case "auth_token":
53514
53553
  case "bridge_identified":
53554
+ case "installed_agent_auth_sync":
53515
53555
  case "ha":
53516
53556
  dispatchBridgeConnectionMessage(msg, deps);
53517
53557
  break;