@buildautomaton/cli 0.1.83 → 0.1.85

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
@@ -30462,7 +30462,7 @@ var {
30462
30462
  } = import_index.default;
30463
30463
 
30464
30464
  // src/cli-version.ts
30465
- var CLI_VERSION = "0.1.83".length > 0 ? "0.1.83" : "0.0.0-dev";
30465
+ var CLI_VERSION = "0.1.85".length > 0 ? "0.1.85" : "0.0.0-dev";
30466
30466
 
30467
30467
  // src/cli/defaults.ts
30468
30468
  var DEFAULT_API_URL = process.env.BUILDAUTOMATON_API_URL ?? "https://api.buildautomaton.com";
@@ -38438,7 +38438,7 @@ var FLY_LEGACY_HOST_SKU = defineHostSku({
38438
38438
  storage: { storageGb: 1 },
38439
38439
  monthlyPriceCents: 750
38440
38440
  });
38441
- var FLY_DEFAULT_HOST_SKU = defineHostSku({
38441
+ var FLY_LEGACY_1G_HOST_SKU = defineHostSku({
38442
38442
  id: "fly-shared-1x1024-1gb",
38443
38443
  provider: "fly",
38444
38444
  compute: { cpus: 1, cpuKind: "shared" },
@@ -38446,8 +38446,17 @@ var FLY_DEFAULT_HOST_SKU = defineHostSku({
38446
38446
  storage: { storageGb: 1 },
38447
38447
  monthlyPriceCents: 1e3
38448
38448
  });
38449
+ var FLY_DEFAULT_HOST_SKU = defineHostSku({
38450
+ id: "fly-shared-2x2048-1gb",
38451
+ provider: "fly",
38452
+ compute: { cpus: 2, cpuKind: "shared" },
38453
+ memory: { memoryMb: 2048 },
38454
+ storage: { storageGb: 1 },
38455
+ monthlyPriceCents: 2e3
38456
+ });
38449
38457
  var HOST_SKUS_BY_ID = {
38450
38458
  [FLY_LEGACY_HOST_SKU.id]: FLY_LEGACY_HOST_SKU,
38459
+ [FLY_LEGACY_1G_HOST_SKU.id]: FLY_LEGACY_1G_HOST_SKU,
38451
38460
  [FLY_DEFAULT_HOST_SKU.id]: FLY_DEFAULT_HOST_SKU
38452
38461
  };
38453
38462
 
@@ -38459,6 +38468,11 @@ var INSTALLABLE_BRIDGE_AGENTS = [
38459
38468
  { value: "opencode", label: "OpenCode agent", tokenLabel: "Provider API key", tokenEnvVar: "OPENCODE_API_KEY" }
38460
38469
  ];
38461
38470
 
38471
+ // ../types/src/agent-subscriptions.ts
38472
+ var AGENT_SUBSCRIPTION_TYPES = INSTALLABLE_BRIDGE_AGENTS.map(
38473
+ (a) => a.value
38474
+ );
38475
+
38462
38476
  // src/paths/session-layout-paths.ts
38463
38477
  import * as path26 from "node:path";
38464
38478
  function resolveIsolatedSessionParentPathFromCheckouts(worktreePaths) {
@@ -39816,13 +39830,40 @@ function createCursorAcpHandle(options) {
39816
39830
  // src/agents/acp/clients/cursor/cursor-acp-init.ts
39817
39831
  import * as readline from "node:readline";
39818
39832
 
39833
+ // src/agents/acp/clients/cursor/cursor-incoming-cursor-task.ts
39834
+ function buildCursorTaskToolCallUpdate(params) {
39835
+ const toolCallId = params.toolCallId ?? params.tool_call_id;
39836
+ if (typeof toolCallId !== "string" || !toolCallId.trim()) return null;
39837
+ const description = typeof params.description === "string" ? params.description.trim() : "";
39838
+ const prompt = typeof params.prompt === "string" ? params.prompt : void 0;
39839
+ const subagentType = params.subagentType ?? params.subagent_type;
39840
+ const model = typeof params.model === "string" ? params.model : void 0;
39841
+ const agentId = typeof params.agentId === "string" ? params.agentId : typeof params.agent_id === "string" ? params.agent_id : void 0;
39842
+ const durationMs = typeof params.durationMs === "number" ? params.durationMs : typeof params.duration_ms === "number" ? params.duration_ms : void 0;
39843
+ return {
39844
+ sessionUpdate: "tool_call_update",
39845
+ toolCallId,
39846
+ ...description ? { title: description } : {},
39847
+ cursorTask: {
39848
+ ...description ? { description } : {},
39849
+ ...prompt != null ? { prompt } : {},
39850
+ ...subagentType != null ? { subagentType } : {},
39851
+ ...model != null ? { model } : {},
39852
+ ...agentId != null ? { agentId } : {},
39853
+ ...durationMs != null ? { durationMs } : {}
39854
+ }
39855
+ };
39856
+ }
39857
+ function handleCursorIncomingCursorTask(id, msg, deps) {
39858
+ const params = msg.params ?? {};
39859
+ deps.respond(id, {});
39860
+ const update = buildCursorTaskToolCallUpdate(params);
39861
+ if (update) deps.onSessionUpdate?.(update);
39862
+ }
39863
+
39819
39864
  // src/agents/acp/clients/cursor/cursor-incoming-cursor-methods.ts
39820
39865
  var CURSOR_BRIDGE_METHODS = /* @__PURE__ */ new Set(["cursor/create_plan", "cursor/ask_question"]);
39821
- var CURSOR_NOOP_METHODS = /* @__PURE__ */ new Set([
39822
- "cursor/update_todos",
39823
- "cursor/task",
39824
- "cursor/generate_image"
39825
- ]);
39866
+ var CURSOR_NOOP_METHODS = /* @__PURE__ */ new Set(["cursor/update_todos", "cursor/generate_image"]);
39826
39867
  function handleCursorIncomingCursorMethods(method, id, msg, deps) {
39827
39868
  if (CURSOR_BRIDGE_METHODS.has(method)) {
39828
39869
  const params = msg.params ?? {};
@@ -39834,6 +39875,10 @@ function handleCursorIncomingCursorMethods(method, id, msg, deps) {
39834
39875
  });
39835
39876
  return true;
39836
39877
  }
39878
+ if (method === "cursor/task") {
39879
+ handleCursorIncomingCursorTask(id, msg, deps);
39880
+ return true;
39881
+ }
39837
39882
  if (CURSOR_NOOP_METHODS.has(method)) {
39838
39883
  deps.respond(id, {});
39839
39884
  return true;
@@ -39993,6 +40038,7 @@ function createCursorAcpIncomingLineHandler(deps) {
39993
40038
  respond: deps.respond,
39994
40039
  respondJsonRpcError: deps.respondJsonRpcError,
39995
40040
  onRequest: deps.onRequest,
40041
+ onSessionUpdate: deps.onSessionUpdate,
39996
40042
  pendingRequests: deps.pendingRequests
39997
40043
  };
39998
40044
  return {
@@ -50828,12 +50874,6 @@ async function pushAheadOfUpstreamForPaths(paths) {
50828
50874
  }
50829
50875
 
50830
50876
  // src/worktrees/manager/resolve-commit-targets.ts
50831
- function bridgeRootBinding(bridgeRoot) {
50832
- return {
50833
- sessionParentPath: bridgeRoot,
50834
- repoCheckoutPaths: [bridgeRoot]
50835
- };
50836
- }
50837
50877
  async function resolveCommitTargetsAsync(sessionId, cache2, discover) {
50838
50878
  const sid = sessionId.trim();
50839
50879
  const paths = cache2.getRepoCheckoutPathsRef(sid);
@@ -50843,9 +50883,7 @@ async function resolveCommitTargetsAsync(sessionId, cache2, discover) {
50843
50883
  cache2.remember(sid, disc);
50844
50884
  return disc.repoCheckoutPaths;
50845
50885
  }
50846
- const bridgeRoot = getBridgeRoot();
50847
- cache2.remember(sid, bridgeRootBinding(bridgeRoot));
50848
- return [bridgeRoot];
50886
+ return [getBridgeRoot()];
50849
50887
  }
50850
50888
 
50851
50889
  // src/worktrees/manager/git/get-session-working-tree-status.ts
@@ -52052,33 +52090,42 @@ async function removeSessionWorktreeCheckouts(cache2, sessionId, worktreesRootPa
52052
52090
  await removeSessionWorktrees(paths, worktreesRootPath, log2);
52053
52091
  }
52054
52092
 
52093
+ // src/worktrees/manager/git/rename-session-worktree-branch.ts
52094
+ init_normalize_resolved_path();
52095
+
52055
52096
  // src/git/branches/rename-branch.ts
52056
52097
  async function gitRenameCurrentBranch(repoDir, newName) {
52057
52098
  const g = cliSimpleGit(repoDir);
52058
52099
  await g.raw(["branch", "-m", newName]);
52059
52100
  }
52060
52101
 
52102
+ // src/worktrees/sanitize-git-branch-name.ts
52103
+ function sanitizeGitBranchName(newBranch) {
52104
+ return newBranch.replace(/[^a-zA-Z0-9/_-]+/g, "-").slice(0, 80) || "session-branch";
52105
+ }
52106
+
52061
52107
  // src/worktrees/rename-session-worktree-branches.ts
52062
52108
  async function renameSessionWorktreeBranches(paths, newBranch, log2) {
52063
- const safe = newBranch.replace(/[^a-zA-Z0-9/_-]+/g, "-").slice(0, 80) || "session-branch";
52109
+ const safe = sanitizeGitBranchName(newBranch);
52064
52110
  await forEachWithGitYield(paths, async (wt) => {
52065
52111
  if (!await isGitRepoDirectory(wt)) return;
52066
- try {
52067
- await gitRenameCurrentBranch(wt, safe);
52068
- log2(`[worktrees] Renamed branch in ${wt} \u2192 ${safe}`);
52069
- } catch (e) {
52070
- log2(
52071
- `[worktrees] Branch rename failed in ${wt}: ${e instanceof Error ? e.message : String(e)}`
52072
- );
52073
- }
52112
+ await gitRenameCurrentBranch(wt, safe);
52113
+ log2(`[worktrees] Renamed branch in ${wt} \u2192 ${safe}`);
52074
52114
  });
52115
+ return safe;
52075
52116
  }
52076
52117
 
52077
52118
  // src/worktrees/manager/git/rename-session-worktree-branch.ts
52078
52119
  async function renameSessionWorktreeBranch(cache2, sessionId, newBranch, log2) {
52079
52120
  const paths = cache2.getRepoCheckoutPathsRef(sessionId);
52080
- if (!paths?.length) return;
52081
- await renameSessionWorktreeBranches(paths, newBranch, log2);
52121
+ if (!paths?.length) return null;
52122
+ const bridgeRoot = normalizeResolvedPath(getBridgeRoot());
52123
+ const worktreePaths = paths.filter((p) => normalizeResolvedPath(p) !== bridgeRoot);
52124
+ if (!worktreePaths.length) {
52125
+ log2(`[worktrees] Skipping branch rename for ${sessionId}: no session worktree paths`);
52126
+ return null;
52127
+ }
52128
+ return renameSessionWorktreeBranches(worktreePaths, newBranch, log2);
52082
52129
  }
52083
52130
 
52084
52131
  // src/worktrees/discovery/discover-session-worktree-on-disk.ts
@@ -52878,7 +52925,20 @@ function createSessionWorktreeGitApi(ctx) {
52878
52925
  await removeSessionWorktreeCheckouts(ctx.cache, sessionId, ctx.worktreesRootPath, ctx.log);
52879
52926
  },
52880
52927
  async commitSession(params) {
52881
- return commitSessionWorktree(ctx.cache, params);
52928
+ let branch = params.branch;
52929
+ if (params.renameBranch) {
52930
+ const renamed = await renameSessionWorktreeBranch(
52931
+ ctx.cache,
52932
+ params.sessionId,
52933
+ params.branch,
52934
+ ctx.log
52935
+ );
52936
+ if (renamed == null) {
52937
+ return { ok: false, error: "Branch rename is only supported for session worktrees" };
52938
+ }
52939
+ branch = renamed;
52940
+ }
52941
+ return commitSessionWorktree(ctx.cache, { ...params, branch });
52882
52942
  },
52883
52943
  async getSessionWorkingTreeStatus(sessionId) {
52884
52944
  return getSessionWorkingTreeStatus(ctx.cache, sessionId, (sid) => paths.discoverAsync(sid));
@@ -56186,6 +56246,7 @@ async function handleSessionGitCommitAction(deps, sessionId, msg, reply) {
56186
56246
  const branch = typeof msg.branch === "string" ? msg.branch : "";
56187
56247
  const message = typeof msg.message === "string" ? msg.message : "";
56188
56248
  const pushAfterCommit = msg.pushAfterCommit === true;
56249
+ const renameBranch = msg.renameBranch === true;
56189
56250
  if (!branch.trim() || !message.trim()) {
56190
56251
  reply({ ok: false, error: "branch and message are required for commit" });
56191
56252
  return;
@@ -56194,7 +56255,8 @@ async function handleSessionGitCommitAction(deps, sessionId, msg, reply) {
56194
56255
  sessionId,
56195
56256
  branch: branch.trim(),
56196
56257
  message: message.trim(),
56197
- push: pushAfterCommit
56258
+ push: pushAfterCommit,
56259
+ renameBranch
56198
56260
  });
56199
56261
  if (!commitRes.ok) {
56200
56262
  reply({ ok: false, error: commitRes.error ?? "Commit failed" });