@rallycry/conveyor-agent 4.10.1 → 4.10.2
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.
|
@@ -272,6 +272,10 @@ var ConveyorConnection = class _ConveyorConnection {
|
|
|
272
272
|
if (!this.socket) return;
|
|
273
273
|
this.socket.emit("agentRunner:statusUpdate", { status });
|
|
274
274
|
}
|
|
275
|
+
emitAuthToken(token) {
|
|
276
|
+
if (!this.socket) return;
|
|
277
|
+
this.socket.emit("agentRunner:authToken", { token });
|
|
278
|
+
}
|
|
275
279
|
emitRateLimitPause(resetsAt) {
|
|
276
280
|
if (!this.socket) return;
|
|
277
281
|
this.socket.emit("agentRunner:rateLimitPause", { resetsAt });
|
|
@@ -560,6 +564,18 @@ async function loadForwardPorts(workspaceDir) {
|
|
|
560
564
|
}
|
|
561
565
|
}
|
|
562
566
|
async function loadConveyorConfig(workspaceDir) {
|
|
567
|
+
const envSetup = process.env.CONVEYOR_SETUP_COMMAND;
|
|
568
|
+
const envStart = process.env.CONVEYOR_START_COMMAND;
|
|
569
|
+
const envPort = process.env.CONVEYOR_PREVIEW_PORT;
|
|
570
|
+
const envAuth = process.env.CONVEYOR_AUTH_TOKEN_COMMAND;
|
|
571
|
+
if (envSetup || envStart || envAuth) {
|
|
572
|
+
return {
|
|
573
|
+
setupCommand: envSetup,
|
|
574
|
+
startCommand: envStart,
|
|
575
|
+
previewPort: envPort ? Number(envPort) : void 0,
|
|
576
|
+
authTokenCommand: envAuth
|
|
577
|
+
};
|
|
578
|
+
}
|
|
563
579
|
try {
|
|
564
580
|
const raw = await readFile(join2(workspaceDir, CONVEYOR_CONFIG_PATH), "utf-8");
|
|
565
581
|
const parsed = JSON.parse(raw);
|
|
@@ -570,7 +586,7 @@ async function loadConveyorConfig(workspaceDir) {
|
|
|
570
586
|
}
|
|
571
587
|
|
|
572
588
|
// src/setup/commands.ts
|
|
573
|
-
import { spawn } from "child_process";
|
|
589
|
+
import { spawn, execSync as execSync2 } from "child_process";
|
|
574
590
|
function runSetupCommand(cmd, cwd, onOutput) {
|
|
575
591
|
return new Promise((resolve2, reject) => {
|
|
576
592
|
const child = spawn("sh", ["-c", cmd], {
|
|
@@ -596,6 +612,21 @@ function runSetupCommand(cmd, cwd, onOutput) {
|
|
|
596
612
|
});
|
|
597
613
|
});
|
|
598
614
|
}
|
|
615
|
+
var AUTH_TOKEN_TIMEOUT_MS = 3e4;
|
|
616
|
+
function runAuthTokenCommand(cmd, userEmail, cwd) {
|
|
617
|
+
try {
|
|
618
|
+
const output = execSync2(`${cmd} ${JSON.stringify(userEmail)}`, {
|
|
619
|
+
cwd,
|
|
620
|
+
timeout: AUTH_TOKEN_TIMEOUT_MS,
|
|
621
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
622
|
+
env: { ...process.env }
|
|
623
|
+
});
|
|
624
|
+
const token = output.toString().trim();
|
|
625
|
+
return token || null;
|
|
626
|
+
} catch {
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
599
630
|
function runStartCommand(cmd, cwd, onOutput) {
|
|
600
631
|
const child = spawn("sh", ["-c", cmd], {
|
|
601
632
|
cwd,
|
|
@@ -614,17 +645,17 @@ function runStartCommand(cmd, cwd, onOutput) {
|
|
|
614
645
|
}
|
|
615
646
|
|
|
616
647
|
// src/setup/codespace.ts
|
|
617
|
-
import { execSync as
|
|
648
|
+
import { execSync as execSync3 } from "child_process";
|
|
618
649
|
function initRtk() {
|
|
619
650
|
try {
|
|
620
|
-
|
|
621
|
-
|
|
651
|
+
execSync3("rtk --version", { stdio: "ignore" });
|
|
652
|
+
execSync3("rtk init --global --auto-patch", { stdio: "ignore" });
|
|
622
653
|
} catch {
|
|
623
654
|
}
|
|
624
655
|
}
|
|
625
656
|
function unshallowRepo(workspaceDir) {
|
|
626
657
|
try {
|
|
627
|
-
|
|
658
|
+
execSync3("git fetch --unshallow", {
|
|
628
659
|
cwd: workspaceDir,
|
|
629
660
|
stdio: "ignore",
|
|
630
661
|
timeout: 6e4
|
|
@@ -635,7 +666,7 @@ function unshallowRepo(workspaceDir) {
|
|
|
635
666
|
|
|
636
667
|
// src/runner/agent-runner.ts
|
|
637
668
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
638
|
-
import { execSync as
|
|
669
|
+
import { execSync as execSync4 } from "child_process";
|
|
639
670
|
|
|
640
671
|
// src/execution/event-processor.ts
|
|
641
672
|
function epochSecondsToISO(value) {
|
|
@@ -2897,6 +2928,17 @@ The agent cannot start until this is resolved.`
|
|
|
2897
2928
|
return { ok: false, deferredStartConfig: null };
|
|
2898
2929
|
}
|
|
2899
2930
|
}
|
|
2931
|
+
function runAuthTokenSafe(config, connection, taskContext) {
|
|
2932
|
+
const authCmd = process.env.CONVEYOR_AUTH_TOKEN_COMMAND;
|
|
2933
|
+
if (!authCmd || !taskContext.userEmail) return;
|
|
2934
|
+
try {
|
|
2935
|
+
const token = runAuthTokenCommand(authCmd, taskContext.userEmail, config.workspaceDir);
|
|
2936
|
+
if (token) {
|
|
2937
|
+
connection.emitAuthToken(token);
|
|
2938
|
+
}
|
|
2939
|
+
} catch {
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2900
2942
|
function runDeferredStartCommand(deferredStartConfig, runnerConfig, connection, setupLog) {
|
|
2901
2943
|
if (!deferredStartConfig?.startCommand) return;
|
|
2902
2944
|
pushSetupLog(setupLog, `$ ${deferredStartConfig.startCommand} & (background, deferred)`);
|
|
@@ -3125,6 +3167,9 @@ var AgentRunner = class {
|
|
|
3125
3167
|
initRtk();
|
|
3126
3168
|
this.tryInitWorktree();
|
|
3127
3169
|
if (!await this.fetchAndInitContext()) return;
|
|
3170
|
+
if (process.env.CODESPACES === "true" && this.taskContext) {
|
|
3171
|
+
runAuthTokenSafe(this.config, this.connection, this.taskContext);
|
|
3172
|
+
}
|
|
3128
3173
|
this.tryPostContextWorktree();
|
|
3129
3174
|
this.checkoutWorktreeBranch();
|
|
3130
3175
|
await this.executeInitialMode();
|
|
@@ -3181,7 +3226,7 @@ var AgentRunner = class {
|
|
|
3181
3226
|
if (!this.worktreeActive || !this.taskContext?.githubBranch) return;
|
|
3182
3227
|
try {
|
|
3183
3228
|
const branch = this.taskContext.githubBranch;
|
|
3184
|
-
|
|
3229
|
+
execSync4(`git fetch origin ${branch} && git checkout ${branch}`, {
|
|
3185
3230
|
cwd: this.config.workspaceDir,
|
|
3186
3231
|
stdio: "ignore"
|
|
3187
3232
|
});
|
|
@@ -3458,7 +3503,7 @@ var AgentRunner = class {
|
|
|
3458
3503
|
|
|
3459
3504
|
// src/runner/project-runner.ts
|
|
3460
3505
|
import { fork } from "child_process";
|
|
3461
|
-
import { execSync as
|
|
3506
|
+
import { execSync as execSync5 } from "child_process";
|
|
3462
3507
|
import * as path from "path";
|
|
3463
3508
|
import { fileURLToPath } from "url";
|
|
3464
3509
|
|
|
@@ -3637,10 +3682,10 @@ function setupWorkDir(projectDir, assignment) {
|
|
|
3637
3682
|
}
|
|
3638
3683
|
if (branch && branch !== devBranch) {
|
|
3639
3684
|
try {
|
|
3640
|
-
|
|
3685
|
+
execSync5(`git checkout ${branch}`, { cwd: workDir, stdio: "ignore" });
|
|
3641
3686
|
} catch {
|
|
3642
3687
|
try {
|
|
3643
|
-
|
|
3688
|
+
execSync5(`git checkout -b ${branch}`, { cwd: workDir, stdio: "ignore" });
|
|
3644
3689
|
} catch {
|
|
3645
3690
|
console.log(`[task:${shortId}] Warning: could not checkout branch ${branch}`);
|
|
3646
3691
|
}
|
|
@@ -3748,7 +3793,7 @@ var ProjectRunner = class {
|
|
|
3748
3793
|
}
|
|
3749
3794
|
try {
|
|
3750
3795
|
try {
|
|
3751
|
-
|
|
3796
|
+
execSync5("git fetch origin", { cwd: this.projectDir, stdio: "ignore" });
|
|
3752
3797
|
} catch {
|
|
3753
3798
|
console.log(`[task:${shortId}] Warning: git fetch failed`);
|
|
3754
3799
|
}
|
|
@@ -3918,4 +3963,4 @@ export {
|
|
|
3918
3963
|
ProjectRunner,
|
|
3919
3964
|
FileCache
|
|
3920
3965
|
};
|
|
3921
|
-
//# sourceMappingURL=chunk-
|
|
3966
|
+
//# sourceMappingURL=chunk-VJRAWAWQ.js.map
|