@rallycry/conveyor-agent 7.1.7 → 7.1.9
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.
|
@@ -555,6 +555,15 @@ var ModeController = class {
|
|
|
555
555
|
this._hasExitedPlanMode = true;
|
|
556
556
|
return { type: "restart_query", newMode: "building" };
|
|
557
557
|
}
|
|
558
|
+
if (this._runnerMode === "task" && newMode === "auto") {
|
|
559
|
+
this._mode = newMode;
|
|
560
|
+
this._hasExitedPlanMode = true;
|
|
561
|
+
return { type: "restart_query", newMode: "auto" };
|
|
562
|
+
}
|
|
563
|
+
if (this._mode === "auto" && this._hasExitedPlanMode && newMode === "building") {
|
|
564
|
+
this._mode = newMode;
|
|
565
|
+
return { type: "noop" };
|
|
566
|
+
}
|
|
558
567
|
if (this._runnerMode !== "pm") return { type: "noop" };
|
|
559
568
|
this._mode = newMode;
|
|
560
569
|
this.updateExitedPlanModeFlag(newMode);
|
|
@@ -929,6 +938,9 @@ var PlanSync = class {
|
|
|
929
938
|
|
|
930
939
|
// src/execution/query-executor.ts
|
|
931
940
|
import { createHash } from "crypto";
|
|
941
|
+
import { existsSync } from "fs";
|
|
942
|
+
import { homedir } from "os";
|
|
943
|
+
import { join as join2 } from "path";
|
|
932
944
|
|
|
933
945
|
// src/execution/pack-runner-prompt.ts
|
|
934
946
|
function findLastAgentMessageIndex(history) {
|
|
@@ -1878,6 +1890,31 @@ function formatRepoRefs(repoRefs) {
|
|
|
1878
1890
|
}
|
|
1879
1891
|
return parts;
|
|
1880
1892
|
}
|
|
1893
|
+
function formatProjectObjectives(objectives) {
|
|
1894
|
+
const parts = [];
|
|
1895
|
+
parts.push(`
|
|
1896
|
+
## Project Objectives`);
|
|
1897
|
+
for (const obj of objectives) {
|
|
1898
|
+
const dates = `${obj.startDate.split("T")[0]} to ${obj.endDate.split("T")[0]}`;
|
|
1899
|
+
parts.push(`- **${obj.name}** (${dates})${obj.description ? ": " + obj.description : ""}`);
|
|
1900
|
+
}
|
|
1901
|
+
return parts;
|
|
1902
|
+
}
|
|
1903
|
+
function formatRecentRelatedTasks(tasks) {
|
|
1904
|
+
const parts = [];
|
|
1905
|
+
parts.push(`
|
|
1906
|
+
## Recently Completed Related Tasks`);
|
|
1907
|
+
parts.push(
|
|
1908
|
+
`These tasks in the same domain were recently completed. Use them for context on recent changes and patterns.
|
|
1909
|
+
`
|
|
1910
|
+
);
|
|
1911
|
+
for (const task of tasks) {
|
|
1912
|
+
const tags = task.tagNames.length > 0 ? ` [${task.tagNames.join(", ")}]` : "";
|
|
1913
|
+
const pr = task.githubPRUrl ? ` \u2014 PR: ${task.githubPRUrl}` : "";
|
|
1914
|
+
parts.push(`- **${task.title}**${tags}${pr}`);
|
|
1915
|
+
}
|
|
1916
|
+
return parts;
|
|
1917
|
+
}
|
|
1881
1918
|
function formatIncidents(incidents) {
|
|
1882
1919
|
const parts = [];
|
|
1883
1920
|
parts.push(`
|
|
@@ -1926,6 +1963,12 @@ ${context.plan}`);
|
|
|
1926
1963
|
}
|
|
1927
1964
|
const tagSection = await resolveTaskTagContext(context);
|
|
1928
1965
|
if (tagSection) parts.push(tagSection);
|
|
1966
|
+
if (context.projectObjectives && context.projectObjectives.length > 0) {
|
|
1967
|
+
parts.push(...formatProjectObjectives(context.projectObjectives));
|
|
1968
|
+
}
|
|
1969
|
+
if (context.recentRelatedTasks && context.recentRelatedTasks.length > 0) {
|
|
1970
|
+
parts.push(...formatRecentRelatedTasks(context.recentRelatedTasks));
|
|
1971
|
+
}
|
|
1929
1972
|
if (context.incidents && context.incidents.length > 0) {
|
|
1930
1973
|
parts.push(...formatIncidents(context.incidents));
|
|
1931
1974
|
}
|
|
@@ -5029,6 +5072,15 @@ function taskIdToSessionUuid(taskId) {
|
|
|
5029
5072
|
const hash = createHash("sha256").update(taskId).digest("hex");
|
|
5030
5073
|
return `${hash.slice(0, 8)}-${hash.slice(8, 12)}-8${hash.slice(13, 16)}-a${hash.slice(17, 20)}-${hash.slice(20, 32)}`;
|
|
5031
5074
|
}
|
|
5075
|
+
function sessionFileExists(sessionUuid, cwd) {
|
|
5076
|
+
try {
|
|
5077
|
+
const cwdSlug = cwd.replace(/\//g, "-");
|
|
5078
|
+
const sessionFile = join2(homedir(), ".claude", "projects", cwdSlug, `${sessionUuid}.jsonl`);
|
|
5079
|
+
return existsSync(sessionFile);
|
|
5080
|
+
} catch {
|
|
5081
|
+
return false;
|
|
5082
|
+
}
|
|
5083
|
+
}
|
|
5032
5084
|
function isReadOnlyMode(mode, hasExitedPlanMode) {
|
|
5033
5085
|
return mode === "discovery" || mode === "help" || mode === "auto" && !hasExitedPlanMode;
|
|
5034
5086
|
}
|
|
@@ -5077,7 +5129,6 @@ function buildQueryOptions(host, context) {
|
|
|
5077
5129
|
abortController: host.abortController ?? void 0,
|
|
5078
5130
|
disallowedTools: buildDisallowedTools(settings, mode, host.hasExitedPlanMode),
|
|
5079
5131
|
enableFileCheckpointing: settings.enableFileCheckpointing,
|
|
5080
|
-
sessionId: taskIdToSessionUuid(context.taskId),
|
|
5081
5132
|
stderr: (data) => {
|
|
5082
5133
|
logger2.warn("Claude Code stderr", { data: data.trimEnd() });
|
|
5083
5134
|
}
|
|
@@ -5150,8 +5201,13 @@ async function runSdkQuery(host, context, followUpContent) {
|
|
|
5150
5201
|
if (needsPlanSync) {
|
|
5151
5202
|
host.snapshotPlanFiles();
|
|
5152
5203
|
}
|
|
5153
|
-
const
|
|
5154
|
-
const
|
|
5204
|
+
const sessionUuid = taskIdToSessionUuid(context.taskId);
|
|
5205
|
+
const hasExistingSession = sessionFileExists(sessionUuid, host.config.workspaceDir);
|
|
5206
|
+
const options = {
|
|
5207
|
+
...buildQueryOptions(host, context),
|
|
5208
|
+
...hasExistingSession ? {} : { sessionId: sessionUuid }
|
|
5209
|
+
};
|
|
5210
|
+
const resume = hasExistingSession ? sessionUuid : void 0;
|
|
5155
5211
|
if (followUpContent) {
|
|
5156
5212
|
const prompt = await buildFollowUpPrompt(host, context, followUpContent);
|
|
5157
5213
|
const agentQuery = host.harness.executeQuery({
|
|
@@ -5204,7 +5260,10 @@ async function buildRetryQuery(host, context, options, lastErrorWasImage) {
|
|
|
5204
5260
|
);
|
|
5205
5261
|
return host.harness.executeQuery({
|
|
5206
5262
|
prompt: host.createInputStream(retryPrompt),
|
|
5207
|
-
|
|
5263
|
+
// Strip sessionId on retry — if the failing query partially created a
|
|
5264
|
+
// session with that ID, passing it again would error. Let the SDK
|
|
5265
|
+
// auto-generate on retry attempts.
|
|
5266
|
+
options: { ...options, sessionId: void 0 },
|
|
5208
5267
|
resume: void 0
|
|
5209
5268
|
});
|
|
5210
5269
|
}
|
|
@@ -5227,7 +5286,7 @@ async function handleAuthError(context, host, options) {
|
|
|
5227
5286
|
);
|
|
5228
5287
|
const freshQuery = host.harness.executeQuery({
|
|
5229
5288
|
prompt: host.createInputStream(freshPrompt),
|
|
5230
|
-
options: { ...options },
|
|
5289
|
+
options: { ...options, sessionId: void 0 },
|
|
5231
5290
|
resume: void 0
|
|
5232
5291
|
});
|
|
5233
5292
|
return runWithRetry(freshQuery, context, host, options);
|
|
@@ -5241,7 +5300,7 @@ async function handleStaleSession(context, host, options) {
|
|
|
5241
5300
|
);
|
|
5242
5301
|
const freshQuery = host.harness.executeQuery({
|
|
5243
5302
|
prompt: host.createInputStream(freshPrompt),
|
|
5244
|
-
options: { ...options },
|
|
5303
|
+
options: { ...options, sessionId: void 0 },
|
|
5245
5304
|
resume: void 0
|
|
5246
5305
|
});
|
|
5247
5306
|
return runWithRetry(freshQuery, context, host, options);
|
|
@@ -5534,7 +5593,7 @@ var QueryBridge = class {
|
|
|
5534
5593
|
|
|
5535
5594
|
// src/runner/session-runner-helpers.ts
|
|
5536
5595
|
import { readFileSync as readFileSync2 } from "fs";
|
|
5537
|
-
import { dirname, join as
|
|
5596
|
+
import { dirname, join as join3 } from "path";
|
|
5538
5597
|
import { fileURLToPath } from "url";
|
|
5539
5598
|
function mapChatHistory(messages) {
|
|
5540
5599
|
if (!messages) return [];
|
|
@@ -5562,7 +5621,7 @@ function readAgentVersion() {
|
|
|
5562
5621
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
5563
5622
|
for (const rel of ["../package.json", "../../package.json"]) {
|
|
5564
5623
|
try {
|
|
5565
|
-
const pkg = JSON.parse(readFileSync2(
|
|
5624
|
+
const pkg = JSON.parse(readFileSync2(join3(here, rel), "utf-8"));
|
|
5566
5625
|
if (pkg.version) return pkg.version;
|
|
5567
5626
|
} catch {
|
|
5568
5627
|
}
|
|
@@ -5672,11 +5731,13 @@ var SessionRunner = class _SessionRunner {
|
|
|
5672
5731
|
await this.shutdown("error");
|
|
5673
5732
|
return;
|
|
5674
5733
|
}
|
|
5675
|
-
if (
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5734
|
+
if (process.env.CONVEYOR_GIT_READY !== "1") {
|
|
5735
|
+
if (this.fullContext?.githubBranch) {
|
|
5736
|
+
ensureOnTaskBranch(this.config.workspaceDir, this.fullContext.githubBranch);
|
|
5737
|
+
}
|
|
5738
|
+
if (this.fullContext?.baseBranch) {
|
|
5739
|
+
syncWithBaseBranch(this.config.workspaceDir, this.fullContext.baseBranch);
|
|
5740
|
+
}
|
|
5680
5741
|
}
|
|
5681
5742
|
this.mode.applyServerMode(this.fullContext?.agentMode, this.fullContext?.isAuto);
|
|
5682
5743
|
this.mode.resolveInitialMode(this.taskContext);
|
|
@@ -5932,6 +5993,7 @@ var SessionRunner = class _SessionRunner {
|
|
|
5932
5993
|
taskTagIds: ctx.taskTagIds ?? void 0,
|
|
5933
5994
|
projectObjectives: ctx.projectObjectives ?? void 0,
|
|
5934
5995
|
incidents: ctx.incidents ?? void 0,
|
|
5996
|
+
recentRelatedTasks: ctx.recentRelatedTasks ?? void 0,
|
|
5935
5997
|
agentSettings: ctx.agentSettings ?? null,
|
|
5936
5998
|
agentMode: ctx.agentMode ?? void 0,
|
|
5937
5999
|
isAuto: ctx.isAuto
|
|
@@ -6402,15 +6464,15 @@ var CommitWatcher = class {
|
|
|
6402
6464
|
|
|
6403
6465
|
// src/runner/worktree.ts
|
|
6404
6466
|
import { execSync as execSync4 } from "child_process";
|
|
6405
|
-
import { existsSync } from "fs";
|
|
6406
|
-
import { join as
|
|
6467
|
+
import { existsSync as existsSync2 } from "fs";
|
|
6468
|
+
import { join as join4 } from "path";
|
|
6407
6469
|
var WORKTREE_DIR = ".worktrees";
|
|
6408
6470
|
function ensureWorktree(projectDir, taskId, branch) {
|
|
6409
6471
|
if (projectDir.includes(`/${WORKTREE_DIR}/`)) {
|
|
6410
6472
|
return projectDir;
|
|
6411
6473
|
}
|
|
6412
|
-
const worktreePath =
|
|
6413
|
-
if (
|
|
6474
|
+
const worktreePath = join4(projectDir, WORKTREE_DIR, taskId);
|
|
6475
|
+
if (existsSync2(worktreePath)) {
|
|
6414
6476
|
if (branch) {
|
|
6415
6477
|
if (hasUncommittedChanges(worktreePath)) {
|
|
6416
6478
|
return worktreePath;
|
|
@@ -6455,8 +6517,8 @@ function detachWorktreeBranch(projectDir, branch) {
|
|
|
6455
6517
|
}
|
|
6456
6518
|
}
|
|
6457
6519
|
function removeWorktree(projectDir, taskId) {
|
|
6458
|
-
const worktreePath =
|
|
6459
|
-
if (!
|
|
6520
|
+
const worktreePath = join4(projectDir, WORKTREE_DIR, taskId);
|
|
6521
|
+
if (!existsSync2(worktreePath)) return;
|
|
6460
6522
|
try {
|
|
6461
6523
|
execSync4(`git worktree remove "${worktreePath}" --force`, {
|
|
6462
6524
|
cwd: projectDir,
|
|
@@ -7494,11 +7556,11 @@ var ProjectRunner = class {
|
|
|
7494
7556
|
|
|
7495
7557
|
// src/setup/config.ts
|
|
7496
7558
|
import { readFile as readFile2 } from "fs/promises";
|
|
7497
|
-
import { join as
|
|
7559
|
+
import { join as join5 } from "path";
|
|
7498
7560
|
var DEVCONTAINER_PATH = ".devcontainer/conveyor/devcontainer.json";
|
|
7499
7561
|
async function loadForwardPorts(workspaceDir) {
|
|
7500
7562
|
try {
|
|
7501
|
-
const raw = await readFile2(
|
|
7563
|
+
const raw = await readFile2(join5(workspaceDir, DEVCONTAINER_PATH), "utf-8");
|
|
7502
7564
|
const parsed = JSON.parse(raw);
|
|
7503
7565
|
return parsed.forwardPorts ?? [];
|
|
7504
7566
|
} catch {
|
|
@@ -7546,4 +7608,4 @@ export {
|
|
|
7546
7608
|
loadForwardPorts,
|
|
7547
7609
|
loadConveyorConfig
|
|
7548
7610
|
};
|
|
7549
|
-
//# sourceMappingURL=chunk-
|
|
7611
|
+
//# sourceMappingURL=chunk-5CGROG7V.js.map
|