@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/index.js CHANGED
@@ -29997,12 +29997,32 @@ function attachSdkStdioStderrAuthWatch(options) {
29997
29997
 
29998
29998
  // src/agents/acp/clients/sdk/spawn-sdk-stdio-process.ts
29999
29999
  import { spawn } from "node:child_process";
30000
+
30001
+ // src/agents/acp/clients/bridge-installed-agent-auth-env.ts
30002
+ var authEnv = /* @__PURE__ */ new Map();
30003
+ function setBridgeInstalledAgentAuthEnv(entries) {
30004
+ authEnv.clear();
30005
+ for (const entry of entries) {
30006
+ const envVar = typeof entry.envVar === "string" ? entry.envVar.trim() : "";
30007
+ const token = typeof entry.token === "string" ? entry.token.trim() : "";
30008
+ if (envVar && token) authEnv.set(envVar, token);
30009
+ }
30010
+ }
30011
+ function bridgeInstalledAgentAuthProcessEnv(base = process.env) {
30012
+ if (authEnv.size === 0) return base;
30013
+ return { ...base, ...Object.fromEntries(authEnv) };
30014
+ }
30015
+ function cursorAgentUsesApiKeyAuth(env = process.env) {
30016
+ return Boolean(env.CURSOR_API_KEY?.trim() || env.CURSOR_AUTH_TOKEN?.trim());
30017
+ }
30018
+
30019
+ // src/agents/acp/clients/sdk/spawn-sdk-stdio-process.ts
30000
30020
  function spawnSdkStdioProcess(options) {
30001
30021
  const isWindows = process.platform === "win32";
30002
30022
  const child = spawn(options.command[0], options.command.slice(1), {
30003
30023
  cwd: options.cwd,
30004
30024
  stdio: ["pipe", "pipe", "pipe"],
30005
- env: process.env,
30025
+ env: bridgeInstalledAgentAuthProcessEnv(process.env),
30006
30026
  shell: isWindows
30007
30027
  });
30008
30028
  const stderrCapture = createStderrCapture(child);
@@ -30586,7 +30606,7 @@ function installBridgeProcessResilience() {
30586
30606
  }
30587
30607
 
30588
30608
  // src/cli-version.ts
30589
- var CLI_VERSION = "0.1.72".length > 0 ? "0.1.72" : "0.0.0-dev";
30609
+ var CLI_VERSION = "0.1.73".length > 0 ? "0.1.73" : "0.0.0-dev";
30590
30610
 
30591
30611
  // src/connection/heartbeat/constants.ts
30592
30612
  var BRIDGE_APP_HEARTBEAT_INTERVAL_MS = 1e4;
@@ -33469,10 +33489,11 @@ function createCursorAcpIncomingLineHandler(deps) {
33469
33489
 
33470
33490
  // src/agents/acp/clients/cursor/cursor-json-rpc-acp-transport.ts
33471
33491
  function createCursorJsonRpcAcpTransport(deps) {
33472
- const { send, cancelSessionNotification } = deps;
33492
+ const { send, cancelSessionNotification, skipBrowserAuthenticate } = deps;
33473
33493
  return {
33474
33494
  initialize: (request) => send("initialize", request),
33475
33495
  afterInitialize: async () => {
33496
+ if (skipBrowserAuthenticate) return;
33476
33497
  await send("authenticate", { methodId: "cursor_login" });
33477
33498
  },
33478
33499
  resumeSession: (p) => send("session/resume", p),
@@ -33581,7 +33602,8 @@ async function initCursorAcpWire(options) {
33581
33602
  rl.on("line", (line) => incoming.handleLine(line));
33582
33603
  const transport = createCursorJsonRpcAcpTransport({
33583
33604
  send: wire.send,
33584
- cancelSessionNotification: wire.cancelSessionNotification
33605
+ cancelSessionNotification: wire.cancelSessionNotification,
33606
+ skipBrowserAuthenticate: options.skipBrowserAuthenticate
33585
33607
  });
33586
33608
  const established = await bootstrapAcpWireSession(transport, options.sessionCtx, CURSOR_ACP_CLIENT_INFO);
33587
33609
  return { wire, transport, established, incoming, pendingRequests: pendingRequests2 };
@@ -33594,7 +33616,7 @@ function spawnCursorAcpProcess(options) {
33594
33616
  const child = spawn3(options.command[0], options.command.slice(1), {
33595
33617
  cwd: options.cwd,
33596
33618
  stdio: ["pipe", "pipe", "pipe"],
33597
- env: process.env,
33619
+ env: bridgeInstalledAgentAuthProcessEnv(process.env),
33598
33620
  shell: isWindows
33599
33621
  });
33600
33622
  const stderrCapture = createStderrCapture(child);
@@ -33626,11 +33648,13 @@ async function createCursorAcpClient(options) {
33626
33648
  onAgentSubprocessExit
33627
33649
  } = options;
33628
33650
  const dbgFs = process.env.BUILDAUTOMATON_DEBUG_ACP_FS === "1";
33651
+ const spawnEnv = bridgeInstalledAgentAuthProcessEnv(process.env);
33629
33652
  const { child, stderrCapture } = spawnCursorAcpProcess({
33630
33653
  command,
33631
33654
  cwd,
33632
33655
  onAgentSubprocessExit
33633
33656
  });
33657
+ const skipBrowserAuthenticate = cursorAgentUsesApiKeyAuth(spawnEnv);
33634
33658
  const sessionCtx = createCursorAcpSessionContext({
33635
33659
  cwd,
33636
33660
  mcpServers: options.mcpServers,
@@ -33653,6 +33677,7 @@ async function createCursorAcpClient(options) {
33653
33677
  const { wire, transport, established, incoming, pendingRequests: pendingRequests2 } = await initCursorAcpWire({
33654
33678
  child,
33655
33679
  sessionCtx,
33680
+ skipBrowserAuthenticate,
33656
33681
  incomingDeps: { dbgFs, sessionCtx, onSessionUpdate, onRequest }
33657
33682
  });
33658
33683
  resolve35(
@@ -48508,6 +48533,7 @@ function buildBridgeUrl(apiUrl, workspaceId, authToken) {
48508
48533
  var API_TO_BRIDGE_MESSAGE_TYPES = [
48509
48534
  "auth_token",
48510
48535
  "bridge_identified",
48536
+ "installed_agent_auth_sync",
48511
48537
  "ha",
48512
48538
  "preview_environments_config",
48513
48539
  "preview_environment_control",
@@ -48596,6 +48622,16 @@ var handleBridgeIdentified = (msg, deps) => {
48596
48622
  });
48597
48623
  };
48598
48624
 
48625
+ // src/routing/handlers/installed-agent-auth-sync.ts
48626
+ var handleInstalledAgentAuthSync = (msg) => {
48627
+ const entries = Array.isArray(msg.entries) ? msg.entries : [];
48628
+ setBridgeInstalledAgentAuthEnv(
48629
+ entries.filter(
48630
+ (e) => e != null && typeof e === "object" && typeof e.envVar === "string" && typeof e.token === "string"
48631
+ )
48632
+ );
48633
+ };
48634
+
48599
48635
  // src/connection/heartbeat/ack.ts
48600
48636
  var handleBridgeHeartbeatAck = (msg, deps) => {
48601
48637
  const raw = msg.s;
@@ -48612,6 +48648,9 @@ function dispatchBridgeConnectionMessage(msg, deps) {
48612
48648
  case "bridge_identified":
48613
48649
  handleBridgeIdentified(msg, deps);
48614
48650
  break;
48651
+ case "installed_agent_auth_sync":
48652
+ handleInstalledAgentAuthSync(msg, deps);
48653
+ break;
48615
48654
  case "ha":
48616
48655
  handleBridgeHeartbeatAck(msg, deps);
48617
48656
  break;
@@ -50292,6 +50331,7 @@ function dispatchBridgeMessage(msg, deps) {
50292
50331
  switch (msg.type) {
50293
50332
  case "auth_token":
50294
50333
  case "bridge_identified":
50334
+ case "installed_agent_auth_sync":
50295
50335
  case "ha":
50296
50336
  dispatchBridgeConnectionMessage(msg, deps);
50297
50337
  break;