@rallycry/conveyor-agent 7.1.6 → 7.1.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.
|
@@ -684,7 +684,11 @@ function ensureOnTaskBranch(cwd, taskBranch) {
|
|
|
684
684
|
return false;
|
|
685
685
|
}
|
|
686
686
|
try {
|
|
687
|
-
execSync(`git checkout ${taskBranch}`, {
|
|
687
|
+
execSync(`git checkout -B ${taskBranch} origin/${taskBranch}`, {
|
|
688
|
+
cwd,
|
|
689
|
+
stdio: "ignore",
|
|
690
|
+
timeout: 3e4
|
|
691
|
+
});
|
|
688
692
|
} catch {
|
|
689
693
|
process.stderr.write(`[conveyor-agent] Warning: git checkout ${taskBranch} failed
|
|
690
694
|
`);
|
|
@@ -925,6 +929,9 @@ var PlanSync = class {
|
|
|
925
929
|
|
|
926
930
|
// src/execution/query-executor.ts
|
|
927
931
|
import { createHash } from "crypto";
|
|
932
|
+
import { existsSync } from "fs";
|
|
933
|
+
import { homedir } from "os";
|
|
934
|
+
import { join as join2 } from "path";
|
|
928
935
|
|
|
929
936
|
// src/execution/pack-runner-prompt.ts
|
|
930
937
|
function findLastAgentMessageIndex(history) {
|
|
@@ -5025,6 +5032,15 @@ function taskIdToSessionUuid(taskId) {
|
|
|
5025
5032
|
const hash = createHash("sha256").update(taskId).digest("hex");
|
|
5026
5033
|
return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-8${hash.slice(13, 16)}-a${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
|
|
5027
5034
|
}
|
|
5035
|
+
function sessionFileExists(sessionUuid, cwd) {
|
|
5036
|
+
try {
|
|
5037
|
+
const cwdSlug = cwd.replace(/\//g, "-");
|
|
5038
|
+
const sessionFile = join2(homedir(), ".claude", "projects", cwdSlug, `${sessionUuid}.jsonl`);
|
|
5039
|
+
return existsSync(sessionFile);
|
|
5040
|
+
} catch {
|
|
5041
|
+
return false;
|
|
5042
|
+
}
|
|
5043
|
+
}
|
|
5028
5044
|
function isReadOnlyMode(mode, hasExitedPlanMode) {
|
|
5029
5045
|
return mode === "discovery" || mode === "help" || mode === "auto" && !hasExitedPlanMode;
|
|
5030
5046
|
}
|
|
@@ -5073,7 +5089,6 @@ function buildQueryOptions(host, context) {
|
|
|
5073
5089
|
abortController: host.abortController ?? void 0,
|
|
5074
5090
|
disallowedTools: buildDisallowedTools(settings, mode, host.hasExitedPlanMode),
|
|
5075
5091
|
enableFileCheckpointing: settings.enableFileCheckpointing,
|
|
5076
|
-
sessionId: taskIdToSessionUuid(context.taskId),
|
|
5077
5092
|
stderr: (data) => {
|
|
5078
5093
|
logger2.warn("Claude Code stderr", { data: data.trimEnd() });
|
|
5079
5094
|
}
|
|
@@ -5146,8 +5161,13 @@ async function runSdkQuery(host, context, followUpContent) {
|
|
|
5146
5161
|
if (needsPlanSync) {
|
|
5147
5162
|
host.snapshotPlanFiles();
|
|
5148
5163
|
}
|
|
5149
|
-
const
|
|
5150
|
-
const
|
|
5164
|
+
const sessionUuid = taskIdToSessionUuid(context.taskId);
|
|
5165
|
+
const hasExistingSession = sessionFileExists(sessionUuid, host.config.workspaceDir);
|
|
5166
|
+
const options = {
|
|
5167
|
+
...buildQueryOptions(host, context),
|
|
5168
|
+
...hasExistingSession ? {} : { sessionId: sessionUuid }
|
|
5169
|
+
};
|
|
5170
|
+
const resume = hasExistingSession ? sessionUuid : void 0;
|
|
5151
5171
|
if (followUpContent) {
|
|
5152
5172
|
const prompt = await buildFollowUpPrompt(host, context, followUpContent);
|
|
5153
5173
|
const agentQuery = host.harness.executeQuery({
|
|
@@ -5200,7 +5220,10 @@ async function buildRetryQuery(host, context, options, lastErrorWasImage) {
|
|
|
5200
5220
|
);
|
|
5201
5221
|
return host.harness.executeQuery({
|
|
5202
5222
|
prompt: host.createInputStream(retryPrompt),
|
|
5203
|
-
|
|
5223
|
+
// Strip sessionId on retry — if the failing query partially created a
|
|
5224
|
+
// session with that ID, passing it again would error. Let the SDK
|
|
5225
|
+
// auto-generate on retry attempts.
|
|
5226
|
+
options: { ...options, sessionId: void 0 },
|
|
5204
5227
|
resume: void 0
|
|
5205
5228
|
});
|
|
5206
5229
|
}
|
|
@@ -5223,7 +5246,7 @@ async function handleAuthError(context, host, options) {
|
|
|
5223
5246
|
);
|
|
5224
5247
|
const freshQuery = host.harness.executeQuery({
|
|
5225
5248
|
prompt: host.createInputStream(freshPrompt),
|
|
5226
|
-
options: { ...options },
|
|
5249
|
+
options: { ...options, sessionId: void 0 },
|
|
5227
5250
|
resume: void 0
|
|
5228
5251
|
});
|
|
5229
5252
|
return runWithRetry(freshQuery, context, host, options);
|
|
@@ -5237,7 +5260,7 @@ async function handleStaleSession(context, host, options) {
|
|
|
5237
5260
|
);
|
|
5238
5261
|
const freshQuery = host.harness.executeQuery({
|
|
5239
5262
|
prompt: host.createInputStream(freshPrompt),
|
|
5240
|
-
options: { ...options },
|
|
5263
|
+
options: { ...options, sessionId: void 0 },
|
|
5241
5264
|
resume: void 0
|
|
5242
5265
|
});
|
|
5243
5266
|
return runWithRetry(freshQuery, context, host, options);
|
|
@@ -5530,7 +5553,7 @@ var QueryBridge = class {
|
|
|
5530
5553
|
|
|
5531
5554
|
// src/runner/session-runner-helpers.ts
|
|
5532
5555
|
import { readFileSync as readFileSync2 } from "fs";
|
|
5533
|
-
import { dirname, join as
|
|
5556
|
+
import { dirname, join as join3 } from "path";
|
|
5534
5557
|
import { fileURLToPath } from "url";
|
|
5535
5558
|
function mapChatHistory(messages) {
|
|
5536
5559
|
if (!messages) return [];
|
|
@@ -5558,7 +5581,7 @@ function readAgentVersion() {
|
|
|
5558
5581
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
5559
5582
|
for (const rel of ["../package.json", "../../package.json"]) {
|
|
5560
5583
|
try {
|
|
5561
|
-
const pkg = JSON.parse(readFileSync2(
|
|
5584
|
+
const pkg = JSON.parse(readFileSync2(join3(here, rel), "utf-8"));
|
|
5562
5585
|
if (pkg.version) return pkg.version;
|
|
5563
5586
|
} catch {
|
|
5564
5587
|
}
|
|
@@ -5668,11 +5691,13 @@ var SessionRunner = class _SessionRunner {
|
|
|
5668
5691
|
await this.shutdown("error");
|
|
5669
5692
|
return;
|
|
5670
5693
|
}
|
|
5671
|
-
if (
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5694
|
+
if (process.env.CONVEYOR_GIT_READY !== "1") {
|
|
5695
|
+
if (this.fullContext?.githubBranch) {
|
|
5696
|
+
ensureOnTaskBranch(this.config.workspaceDir, this.fullContext.githubBranch);
|
|
5697
|
+
}
|
|
5698
|
+
if (this.fullContext?.baseBranch) {
|
|
5699
|
+
syncWithBaseBranch(this.config.workspaceDir, this.fullContext.baseBranch);
|
|
5700
|
+
}
|
|
5676
5701
|
}
|
|
5677
5702
|
this.mode.applyServerMode(this.fullContext?.agentMode, this.fullContext?.isAuto);
|
|
5678
5703
|
this.mode.resolveInitialMode(this.taskContext);
|
|
@@ -6398,15 +6423,15 @@ var CommitWatcher = class {
|
|
|
6398
6423
|
|
|
6399
6424
|
// src/runner/worktree.ts
|
|
6400
6425
|
import { execSync as execSync4 } from "child_process";
|
|
6401
|
-
import { existsSync } from "fs";
|
|
6402
|
-
import { join as
|
|
6426
|
+
import { existsSync as existsSync2 } from "fs";
|
|
6427
|
+
import { join as join4 } from "path";
|
|
6403
6428
|
var WORKTREE_DIR = ".worktrees";
|
|
6404
6429
|
function ensureWorktree(projectDir, taskId, branch) {
|
|
6405
6430
|
if (projectDir.includes(`/${WORKTREE_DIR}/`)) {
|
|
6406
6431
|
return projectDir;
|
|
6407
6432
|
}
|
|
6408
|
-
const worktreePath =
|
|
6409
|
-
if (
|
|
6433
|
+
const worktreePath = join4(projectDir, WORKTREE_DIR, taskId);
|
|
6434
|
+
if (existsSync2(worktreePath)) {
|
|
6410
6435
|
if (branch) {
|
|
6411
6436
|
if (hasUncommittedChanges(worktreePath)) {
|
|
6412
6437
|
return worktreePath;
|
|
@@ -6451,8 +6476,8 @@ function detachWorktreeBranch(projectDir, branch) {
|
|
|
6451
6476
|
}
|
|
6452
6477
|
}
|
|
6453
6478
|
function removeWorktree(projectDir, taskId) {
|
|
6454
|
-
const worktreePath =
|
|
6455
|
-
if (!
|
|
6479
|
+
const worktreePath = join4(projectDir, WORKTREE_DIR, taskId);
|
|
6480
|
+
if (!existsSync2(worktreePath)) return;
|
|
6456
6481
|
try {
|
|
6457
6482
|
execSync4(`git worktree remove "${worktreePath}" --force`, {
|
|
6458
6483
|
cwd: projectDir,
|
|
@@ -7490,11 +7515,11 @@ var ProjectRunner = class {
|
|
|
7490
7515
|
|
|
7491
7516
|
// src/setup/config.ts
|
|
7492
7517
|
import { readFile as readFile2 } from "fs/promises";
|
|
7493
|
-
import { join as
|
|
7518
|
+
import { join as join5 } from "path";
|
|
7494
7519
|
var DEVCONTAINER_PATH = ".devcontainer/conveyor/devcontainer.json";
|
|
7495
7520
|
async function loadForwardPorts(workspaceDir) {
|
|
7496
7521
|
try {
|
|
7497
|
-
const raw = await readFile2(
|
|
7522
|
+
const raw = await readFile2(join5(workspaceDir, DEVCONTAINER_PATH), "utf-8");
|
|
7498
7523
|
const parsed = JSON.parse(raw);
|
|
7499
7524
|
return parsed.forwardPorts ?? [];
|
|
7500
7525
|
} catch {
|
|
@@ -7542,4 +7567,4 @@ export {
|
|
|
7542
7567
|
loadForwardPorts,
|
|
7543
7568
|
loadConveyorConfig
|
|
7544
7569
|
};
|
|
7545
|
-
//# sourceMappingURL=chunk-
|
|
7570
|
+
//# sourceMappingURL=chunk-WUBCS4RB.js.map
|