@rallycry/conveyor-agent 7.3.7 → 7.3.8

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.
@@ -40,6 +40,8 @@ var AgentConnection = class _AgentConnection {
40
40
  softStopCallback = null;
41
41
  modeChangeCallback = null;
42
42
  apiKeyUpdateCallback = null;
43
+ pullBranchCallback = null;
44
+ earlyPullBranches = [];
43
45
  constructor(config) {
44
46
  this.config = config;
45
47
  }
@@ -130,6 +132,10 @@ var AgentConnection = class _AgentConnection {
130
132
  this.socket.on("agentRunner:updateApiKey", (data) => {
131
133
  if (this.apiKeyUpdateCallback) this.apiKeyUpdateCallback(data);
132
134
  });
135
+ this.socket.on("session:pullBranch", (data) => {
136
+ if (this.pullBranchCallback) this.pullBranchCallback(data);
137
+ else this.earlyPullBranches.push(data);
138
+ });
133
139
  this.socket.on("connect", () => {
134
140
  process.stderr.write("[conveyor-agent] Socket connected\n");
135
141
  if (!settled) {
@@ -251,6 +257,11 @@ var AgentConnection = class _AgentConnection {
251
257
  onApiKeyUpdate(callback) {
252
258
  this.apiKeyUpdateCallback = callback;
253
259
  }
260
+ onPullBranch(callback) {
261
+ this.pullBranchCallback = callback;
262
+ for (const data of this.earlyPullBranches) callback(data);
263
+ this.earlyPullBranches = [];
264
+ }
254
265
  // ── Convenience methods (thin wrappers around call / emit) ─────────
255
266
  async emitStatus(status) {
256
267
  this.lastEmittedStatus = status;
@@ -6572,6 +6583,48 @@ function readAgentVersion() {
6572
6583
  return null;
6573
6584
  }
6574
6585
 
6586
+ // src/runner/parent-pull-handler.ts
6587
+ import { execSync as execSync2 } from "child_process";
6588
+ function handlePullBranch(workDir, branch) {
6589
+ if (!branch) return;
6590
+ const current = getCurrentBranch(workDir);
6591
+ if (current !== branch) {
6592
+ process.stderr.write(
6593
+ `[conveyor-agent] pull_branch ignored \u2014 current branch ${current ?? "(detached)"} != ${branch}
6594
+ `
6595
+ );
6596
+ return;
6597
+ }
6598
+ if (hasUncommittedChanges(workDir)) {
6599
+ process.stderr.write(
6600
+ `[conveyor-agent] pull_branch ignored \u2014 uncommitted changes on ${branch}
6601
+ `
6602
+ );
6603
+ return;
6604
+ }
6605
+ try {
6606
+ execSync2(`git fetch origin ${branch}`, { cwd: workDir, stdio: "ignore", timeout: 6e4 });
6607
+ } catch {
6608
+ process.stderr.write(`[conveyor-agent] pull_branch: fetch failed for ${branch}
6609
+ `);
6610
+ return;
6611
+ }
6612
+ try {
6613
+ execSync2(`git pull --ff-only origin ${branch}`, {
6614
+ cwd: workDir,
6615
+ stdio: "ignore",
6616
+ timeout: 6e4
6617
+ });
6618
+ process.stderr.write(`[conveyor-agent] pull_branch: pulled origin/${branch}
6619
+ `);
6620
+ } catch {
6621
+ process.stderr.write(
6622
+ `[conveyor-agent] pull_branch: ff-only pull failed for ${branch} (likely diverged)
6623
+ `
6624
+ );
6625
+ }
6626
+ }
6627
+
6575
6628
  // src/runner/session-runner.ts
6576
6629
  var SessionRunner = class _SessionRunner {
6577
6630
  connection;
@@ -7134,6 +7187,9 @@ var SessionRunner = class _SessionRunner {
7134
7187
  delete process.env.CLAUDE_CODE_OAUTH_TOKEN;
7135
7188
  }
7136
7189
  });
7190
+ this.connection.onPullBranch(({ branch }) => {
7191
+ handlePullBranch(this.config.workspaceDir, branch);
7192
+ });
7137
7193
  }
7138
7194
  /**
7139
7195
  * Rehydrate CostTracker from server. Caps at 3s so a slow API call never
@@ -7417,7 +7473,7 @@ var ProjectConnection = class {
7417
7473
  };
7418
7474
 
7419
7475
  // src/runner/commit-watcher.ts
7420
- import { execSync as execSync2 } from "child_process";
7476
+ import { execSync as execSync3 } from "child_process";
7421
7477
  var logger5 = createServiceLogger("CommitWatcher");
7422
7478
  var CommitWatcher = class {
7423
7479
  constructor(config, callbacks) {
@@ -7451,7 +7507,7 @@ var CommitWatcher = class {
7451
7507
  this.isSyncing = false;
7452
7508
  }
7453
7509
  getLocalHeadSha() {
7454
- return execSync2("git rev-parse HEAD", {
7510
+ return execSync3("git rev-parse HEAD", {
7455
7511
  cwd: this.config.projectDir,
7456
7512
  stdio: ["ignore", "pipe", "ignore"]
7457
7513
  }).toString().trim();
@@ -7459,12 +7515,12 @@ var CommitWatcher = class {
7459
7515
  poll() {
7460
7516
  if (!this.branch || this.isSyncing) return;
7461
7517
  try {
7462
- execSync2(`git fetch origin ${this.branch} --quiet`, {
7518
+ execSync3(`git fetch origin ${this.branch} --quiet`, {
7463
7519
  cwd: this.config.projectDir,
7464
7520
  stdio: "ignore",
7465
7521
  timeout: 3e4
7466
7522
  });
7467
- const remoteSha = execSync2(`git rev-parse origin/${this.branch}`, {
7523
+ const remoteSha = execSync3(`git rev-parse origin/${this.branch}`, {
7468
7524
  cwd: this.config.projectDir,
7469
7525
  stdio: ["ignore", "pipe", "ignore"]
7470
7526
  }).toString().trim();
@@ -7485,12 +7541,12 @@ var CommitWatcher = class {
7485
7541
  let latestMessage = "";
7486
7542
  let latestAuthor = "";
7487
7543
  try {
7488
- const countOutput = execSync2(`git rev-list --count ${previousSha}..origin/${this.branch}`, {
7544
+ const countOutput = execSync3(`git rev-list --count ${previousSha}..origin/${this.branch}`, {
7489
7545
  cwd: this.config.projectDir,
7490
7546
  stdio: ["ignore", "pipe", "ignore"]
7491
7547
  }).toString().trim();
7492
7548
  commitCount = parseInt(countOutput, 10) || 1;
7493
- const logOutput = execSync2(`git log -1 --format="%s|||%an" origin/${this.branch}`, {
7549
+ const logOutput = execSync3(`git log -1 --format="%s|||%an" origin/${this.branch}`, {
7494
7550
  cwd: this.config.projectDir,
7495
7551
  stdio: ["ignore", "pipe", "ignore"]
7496
7552
  }).toString().trim();
@@ -7525,7 +7581,7 @@ var CommitWatcher = class {
7525
7581
  };
7526
7582
 
7527
7583
  // src/runner/worktree.ts
7528
- import { execSync as execSync3 } from "child_process";
7584
+ import { execSync as execSync4 } from "child_process";
7529
7585
  import { existsSync as existsSync2 } from "fs";
7530
7586
  import { join as join4 } from "path";
7531
7587
  var WORKTREE_DIR = ".worktrees";
@@ -7540,7 +7596,7 @@ function ensureWorktree(projectDir, taskId, branch) {
7540
7596
  return worktreePath;
7541
7597
  }
7542
7598
  try {
7543
- execSync3(`git checkout --detach origin/${branch}`, {
7599
+ execSync4(`git checkout --detach origin/${branch}`, {
7544
7600
  cwd: worktreePath,
7545
7601
  stdio: "ignore"
7546
7602
  });
@@ -7550,7 +7606,7 @@ function ensureWorktree(projectDir, taskId, branch) {
7550
7606
  return worktreePath;
7551
7607
  }
7552
7608
  const ref = branch ? `origin/${branch}` : "HEAD";
7553
- execSync3(`git worktree add --detach "${worktreePath}" ${ref}`, {
7609
+ execSync4(`git worktree add --detach "${worktreePath}" ${ref}`, {
7554
7610
  cwd: projectDir,
7555
7611
  stdio: "ignore"
7556
7612
  });
@@ -7558,7 +7614,7 @@ function ensureWorktree(projectDir, taskId, branch) {
7558
7614
  }
7559
7615
  function detachWorktreeBranch(projectDir, branch) {
7560
7616
  try {
7561
- const output = execSync3("git worktree list --porcelain", {
7617
+ const output = execSync4("git worktree list --porcelain", {
7562
7618
  cwd: projectDir,
7563
7619
  encoding: "utf-8"
7564
7620
  });
@@ -7571,7 +7627,7 @@ function detachWorktreeBranch(projectDir, branch) {
7571
7627
  const worktreePath = worktreeLine.replace("worktree ", "");
7572
7628
  if (!worktreePath.includes(`/${WORKTREE_DIR}/`)) continue;
7573
7629
  try {
7574
- execSync3("git checkout --detach", { cwd: worktreePath, stdio: "ignore" });
7630
+ execSync4("git checkout --detach", { cwd: worktreePath, stdio: "ignore" });
7575
7631
  } catch {
7576
7632
  }
7577
7633
  }
@@ -7582,7 +7638,7 @@ function removeWorktree(projectDir, taskId) {
7582
7638
  const worktreePath = join4(projectDir, WORKTREE_DIR, taskId);
7583
7639
  if (!existsSync2(worktreePath)) return;
7584
7640
  try {
7585
- execSync3(`git worktree remove "${worktreePath}" --force`, {
7641
+ execSync4(`git worktree remove "${worktreePath}" --force`, {
7586
7642
  cwd: projectDir,
7587
7643
  stdio: "ignore"
7588
7644
  });
@@ -7591,7 +7647,7 @@ function removeWorktree(projectDir, taskId) {
7591
7647
  }
7592
7648
 
7593
7649
  // src/setup/commands.ts
7594
- import { spawn, execSync as execSync4 } from "child_process";
7650
+ import { spawn, execSync as execSync5 } from "child_process";
7595
7651
  function runSetupCommand(cmd, cwd, onOutput) {
7596
7652
  return new Promise((resolve2, reject) => {
7597
7653
  const child = spawn("sh", ["-c", cmd], {
@@ -7620,7 +7676,7 @@ function runSetupCommand(cmd, cwd, onOutput) {
7620
7676
  var AUTH_TOKEN_TIMEOUT_MS = 3e4;
7621
7677
  function runAuthTokenCommand(cmd, userEmail, cwd) {
7622
7678
  try {
7623
- const output = execSync4(`${cmd} ${JSON.stringify(userEmail)}`, {
7679
+ const output = execSync5(`${cmd} ${JSON.stringify(userEmail)}`, {
7624
7680
  cwd,
7625
7681
  timeout: AUTH_TOKEN_TIMEOUT_MS,
7626
7682
  stdio: ["ignore", "pipe", "ignore"],
@@ -8003,15 +8059,15 @@ function parseErrorMessage(error) {
8003
8059
 
8004
8060
  // src/runner/project-runner-children.ts
8005
8061
  import { fork } from "child_process";
8006
- import { execSync as execSync7 } from "child_process";
8062
+ import { execSync as execSync8 } from "child_process";
8007
8063
  import * as path from "path";
8008
8064
  import { fileURLToPath as fileURLToPath2 } from "url";
8009
8065
 
8010
8066
  // src/runner/project-runner-git.ts
8011
- import { execSync as execSync6 } from "child_process";
8067
+ import { execSync as execSync7 } from "child_process";
8012
8068
 
8013
8069
  // src/runner/project-runner-sync.ts
8014
- import { execSync as execSync5 } from "child_process";
8070
+ import { execSync as execSync6 } from "child_process";
8015
8071
  var logger7 = createServiceLogger("ProjectRunner");
8016
8072
  var START_CMD_KILL_TIMEOUT_MS = 5e3;
8017
8073
  async function executeSetupCommand(projectDir, connection) {
@@ -8108,7 +8164,7 @@ async function handleSyncEnvironment(projectDir, branchSwitchCommand, state, con
8108
8164
  }
8109
8165
  function getChangedFiles(projectDir, previousSha, newSha) {
8110
8166
  try {
8111
- return execSync5(`git diff --name-only ${previousSha}..${newSha}`, {
8167
+ return execSync6(`git diff --name-only ${previousSha}..${newSha}`, {
8112
8168
  cwd: projectDir,
8113
8169
  stdio: ["ignore", "pipe", "ignore"]
8114
8170
  }).toString().trim().split("\n").filter(Boolean);
@@ -8119,7 +8175,7 @@ function getChangedFiles(projectDir, previousSha, newSha) {
8119
8175
  function runIndividualSyncSteps(projectDir, needsInstall, needsPrisma, stepsRun) {
8120
8176
  if (needsInstall) {
8121
8177
  try {
8122
- execSync5("bun install", { cwd: projectDir, timeout: 12e4, stdio: "pipe" });
8178
+ execSync6("bun install", { cwd: projectDir, timeout: 12e4, stdio: "pipe" });
8123
8179
  stepsRun.push("install");
8124
8180
  } catch (err) {
8125
8181
  const msg = parseErrorMessage(err);
@@ -8128,8 +8184,8 @@ function runIndividualSyncSteps(projectDir, needsInstall, needsPrisma, stepsRun)
8128
8184
  }
8129
8185
  if (needsPrisma) {
8130
8186
  try {
8131
- execSync5("bunx prisma generate", { cwd: projectDir, timeout: 6e4, stdio: "pipe" });
8132
- execSync5("bunx prisma db push --accept-data-loss", {
8187
+ execSync6("bunx prisma generate", { cwd: projectDir, timeout: 6e4, stdio: "pipe" });
8188
+ execSync6("bunx prisma db push --accept-data-loss", {
8133
8189
  cwd: projectDir,
8134
8190
  timeout: 6e4,
8135
8191
  stdio: "pipe"
@@ -8173,7 +8229,7 @@ async function smartSync(projectDir, branchSwitchCommand, state, connection, pre
8173
8229
  }
8174
8230
  await killStartCommand(state);
8175
8231
  try {
8176
- execSync5(`git pull origin ${branch}`, {
8232
+ execSync6(`git pull origin ${branch}`, {
8177
8233
  cwd: projectDir,
8178
8234
  stdio: "pipe",
8179
8235
  timeout: 6e4
@@ -8209,10 +8265,10 @@ function setupWorkDir(projectDir, assignment) {
8209
8265
  logger8.warn("Uncommitted changes, skipping checkout", { taskId: shortId, branch });
8210
8266
  } else {
8211
8267
  try {
8212
- execSync6(`git checkout ${branch}`, { cwd: workDir, stdio: "ignore" });
8268
+ execSync7(`git checkout ${branch}`, { cwd: workDir, stdio: "ignore" });
8213
8269
  } catch {
8214
8270
  try {
8215
- execSync6(`git checkout -b ${branch}`, { cwd: workDir, stdio: "ignore" });
8271
+ execSync7(`git checkout -b ${branch}`, { cwd: workDir, stdio: "ignore" });
8216
8272
  } catch {
8217
8273
  logger8.warn("Could not checkout branch", { taskId: shortId, branch });
8218
8274
  }
@@ -8231,8 +8287,8 @@ function checkoutWorkspaceBranch(projectDir) {
8231
8287
  return;
8232
8288
  }
8233
8289
  try {
8234
- execSync6(`git fetch origin ${workspaceBranch}`, { cwd: projectDir, stdio: "pipe" });
8235
- execSync6(`git checkout ${workspaceBranch}`, { cwd: projectDir, stdio: "pipe" });
8290
+ execSync7(`git fetch origin ${workspaceBranch}`, { cwd: projectDir, stdio: "pipe" });
8291
+ execSync7(`git checkout ${workspaceBranch}`, { cwd: projectDir, stdio: "pipe" });
8236
8292
  logger8.info("Checked out workspace branch", { workspaceBranch });
8237
8293
  } catch {
8238
8294
  logger8.warn("Failed to checkout workspace branch", { workspaceBranch });
@@ -8241,20 +8297,20 @@ function checkoutWorkspaceBranch(projectDir) {
8241
8297
  async function handleSwitchBranch(projectDir, branchSwitchCommand, startCmd, connection, commitWatcher, data, callback) {
8242
8298
  try {
8243
8299
  try {
8244
- execSync6("git fetch origin", { cwd: projectDir, stdio: "pipe" });
8300
+ execSync7("git fetch origin", { cwd: projectDir, stdio: "pipe" });
8245
8301
  } catch {
8246
8302
  logger8.warn("Git fetch failed during branch switch");
8247
8303
  }
8248
8304
  detachWorktreeBranch(projectDir, data.branch);
8249
8305
  try {
8250
- execSync6(`git checkout ${data.branch}`, { cwd: projectDir, stdio: "pipe" });
8306
+ execSync7(`git checkout ${data.branch}`, { cwd: projectDir, stdio: "pipe" });
8251
8307
  } catch (err) {
8252
8308
  const msg = parseErrorMessage(err);
8253
8309
  callback({ ok: false, error: `Failed to checkout branch: ${msg}` });
8254
8310
  return;
8255
8311
  }
8256
8312
  try {
8257
- execSync6(`git pull origin ${data.branch}`, { cwd: projectDir, stdio: "pipe" });
8313
+ execSync7(`git pull origin ${data.branch}`, { cwd: projectDir, stdio: "pipe" });
8258
8314
  } catch {
8259
8315
  logger8.warn("Git pull failed during branch switch");
8260
8316
  }
@@ -8397,7 +8453,7 @@ async function handleAssignment(assignment, activeAgents, projectDir, connection
8397
8453
  }
8398
8454
  try {
8399
8455
  try {
8400
- execSync7("git fetch origin", { cwd: projectDir, stdio: "ignore" });
8456
+ execSync8("git fetch origin", { cwd: projectDir, stdio: "ignore" });
8401
8457
  } catch {
8402
8458
  logger9.warn("Git fetch failed", { taskId: shortId });
8403
8459
  }
@@ -8804,4 +8860,4 @@ export {
8804
8860
  buildSessionPreviewPorts,
8805
8861
  loadConveyorConfig
8806
8862
  };
8807
- //# sourceMappingURL=chunk-PC43BKMM.js.map
8863
+ //# sourceMappingURL=chunk-RX7NQCWK.js.map