@rallycry/conveyor-agent 10.13.57 → 10.13.58
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/{boot-37ZX7POR.js → boot-7OPX55AO.js} +4 -4
- package/dist/{chunk-MS43QSHO.js → chunk-AXA55U4Z.js} +2 -2
- package/dist/{chunk-VIEBOAJ7.js → chunk-HYP7BK2B.js} +72 -15
- package/dist/chunk-HYP7BK2B.js.map +1 -0
- package/dist/{chunk-PWYJZY3P.js → chunk-NAK6FY5U.js} +85 -9
- package/dist/chunk-NAK6FY5U.js.map +1 -0
- package/dist/{chunk-WVUQ5CH5.js → chunk-QZN6HVUY.js} +3 -2
- package/dist/chunk-QZN6HVUY.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/index.d.ts +22 -1
- package/dist/index.js +3 -3
- package/dist/{server-7UW4X3XF.js → server-ZACB5T5S.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-PWYJZY3P.js.map +0 -1
- package/dist/chunk-VIEBOAJ7.js.map +0 -1
- package/dist/chunk-WVUQ5CH5.js.map +0 -1
- /package/dist/{boot-37ZX7POR.js.map → boot-7OPX55AO.js.map} +0 -0
- /package/dist/{chunk-MS43QSHO.js.map → chunk-AXA55U4Z.js.map} +0 -0
- /package/dist/{server-7UW4X3XF.js.map → server-ZACB5T5S.js.map} +0 -0
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
readAgentVersion,
|
|
10
10
|
redactToken,
|
|
11
11
|
reportBootMilestone
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QZN6HVUY.js";
|
|
13
13
|
import {
|
|
14
14
|
workbenchPort
|
|
15
15
|
} from "./chunk-4VUQ2NPF.js";
|
|
16
16
|
import {
|
|
17
17
|
startWorkbenchServer
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-AXA55U4Z.js";
|
|
19
|
+
import "./chunk-NAK6FY5U.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_WORKBENCH_PORT
|
|
22
22
|
} from "./chunk-JIGG755T.js";
|
|
@@ -1316,4 +1316,4 @@ export {
|
|
|
1316
1316
|
runBoot,
|
|
1317
1317
|
workbenchBootSteps
|
|
1318
1318
|
};
|
|
1319
|
-
//# sourceMappingURL=boot-
|
|
1319
|
+
//# sourceMappingURL=boot-7OPX55AO.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadPtySpawn,
|
|
3
3
|
terminateProcessGroup
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NAK6FY5U.js";
|
|
5
5
|
import {
|
|
6
6
|
FrameReader,
|
|
7
7
|
timingSafeTokenEqual,
|
|
@@ -296,4 +296,4 @@ async function runReaddir(socket, req) {
|
|
|
296
296
|
export {
|
|
297
297
|
startWorkbenchServer
|
|
298
298
|
};
|
|
299
|
-
//# sourceMappingURL=chunk-
|
|
299
|
+
//# sourceMappingURL=chunk-AXA55U4Z.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
readAgentVersion,
|
|
8
8
|
registerBootMilestoneSocketFallback,
|
|
9
9
|
reportBootMilestone
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QZN6HVUY.js";
|
|
11
11
|
import {
|
|
12
12
|
LoopLagMonitor,
|
|
13
13
|
buildConveyorSocketOptions,
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
buildPromptBytes,
|
|
31
31
|
buildSpawnArgs,
|
|
32
32
|
cleanTerminalOutput,
|
|
33
|
+
ghHostsExternallyOwned,
|
|
33
34
|
gitCredentialHelper,
|
|
34
35
|
githubTokenFilePath,
|
|
35
36
|
inheritedEnv,
|
|
@@ -53,7 +54,7 @@ import {
|
|
|
53
54
|
transcriptSize,
|
|
54
55
|
turnOptionsFrom,
|
|
55
56
|
writeGitCredential
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-NAK6FY5U.js";
|
|
57
58
|
|
|
58
59
|
// src/setup/bootstrap.ts
|
|
59
60
|
var BOOTSTRAP_TIMEOUT_MS = 3e4;
|
|
@@ -1463,24 +1464,43 @@ async function isAuthError(cwd) {
|
|
|
1463
1464
|
return errLooksLikeAuth(err);
|
|
1464
1465
|
}
|
|
1465
1466
|
}
|
|
1467
|
+
function credentialErrorText(err) {
|
|
1468
|
+
const raw = err instanceof Error ? err.message : String(err);
|
|
1469
|
+
return raw.replace(/\/\/[^@\s]+@/g, "//***@");
|
|
1470
|
+
}
|
|
1466
1471
|
async function updateRemoteCredential(cwd, credential) {
|
|
1472
|
+
const result = { ok: false, storeWritten: false, helperConfigured: false };
|
|
1467
1473
|
try {
|
|
1468
1474
|
const currentUrl = await git(cwd, ["remote", "get-url", "origin"]);
|
|
1469
1475
|
const cloneUrl = credential.cloneUrl ?? currentUrl;
|
|
1470
|
-
writeGitCredential(cwd, cloneUrl, credential);
|
|
1471
|
-
|
|
1472
|
-
|
|
1476
|
+
const normalizedUrl = writeGitCredential(cwd, cloneUrl, credential);
|
|
1477
|
+
result.storeWritten = true;
|
|
1478
|
+
if (currentUrl !== normalizedUrl) {
|
|
1479
|
+
await git(cwd, ["remote", "set-url", "origin", normalizedUrl]);
|
|
1473
1480
|
}
|
|
1474
1481
|
await git(cwd, ["config", "--local", "credential.helper", gitCredentialHelper(cwd)]);
|
|
1475
|
-
|
|
1482
|
+
result.helperConfigured = true;
|
|
1483
|
+
result.ok = true;
|
|
1484
|
+
} catch (err) {
|
|
1485
|
+
result.error = credentialErrorText(err);
|
|
1476
1486
|
}
|
|
1487
|
+
return result;
|
|
1477
1488
|
}
|
|
1478
1489
|
async function updateRemoteToken(cwd, token) {
|
|
1479
1490
|
const username = process.env.CONVEYOR_GIT_USERNAME || "x-access-token";
|
|
1480
1491
|
const cloneUrl = process.env.CONVEYOR_GIT_CLONE_URL || void 0;
|
|
1481
|
-
await updateRemoteCredential(cwd, { username, secret: token, cloneUrl });
|
|
1492
|
+
const credential = await updateRemoteCredential(cwd, { username, secret: token, cloneUrl });
|
|
1482
1493
|
process.env.CONVEYOR_GIT_SECRET = token;
|
|
1483
|
-
syncGithubTokenFiles(token);
|
|
1494
|
+
const files = syncGithubTokenFiles(token);
|
|
1495
|
+
return { credential, files };
|
|
1496
|
+
}
|
|
1497
|
+
async function verifyGitCredential(cwd) {
|
|
1498
|
+
try {
|
|
1499
|
+
await git(cwd, ["ls-remote", "--heads", "origin"], 3e4);
|
|
1500
|
+
return { ok: true };
|
|
1501
|
+
} catch (err) {
|
|
1502
|
+
return { ok: false, error: credentialErrorText(err) };
|
|
1503
|
+
}
|
|
1484
1504
|
}
|
|
1485
1505
|
function wipRefForBranch(branch) {
|
|
1486
1506
|
return `conveyor-wip/${branch}`;
|
|
@@ -11169,18 +11189,48 @@ function buildRefreshGithubTokenTool(connection, config) {
|
|
|
11169
11189
|
const result = await connection.call("refreshGithubToken", {
|
|
11170
11190
|
sessionId: connection.sessionId
|
|
11171
11191
|
});
|
|
11172
|
-
await updateRemoteToken(config.workspaceDir, result.token);
|
|
11192
|
+
const written = await updateRemoteToken(config.workspaceDir, result.token);
|
|
11173
11193
|
process.env.GITHUB_TOKEN = result.token;
|
|
11174
11194
|
process.env.GH_TOKEN = result.token;
|
|
11175
11195
|
const tokenFile = githubTokenFilePath();
|
|
11196
|
+
const failures = [];
|
|
11197
|
+
if (!written.credential.storeWritten) {
|
|
11198
|
+
failures.push(
|
|
11199
|
+
`- git credential store NOT written${written.credential.error ? `: ${written.credential.error}` : ""}`
|
|
11200
|
+
);
|
|
11201
|
+
} else if (!written.credential.helperConfigured) {
|
|
11202
|
+
failures.push(
|
|
11203
|
+
`- git credential helper NOT configured${written.credential.error ? `: ${written.credential.error}` : ""}`
|
|
11204
|
+
);
|
|
11205
|
+
}
|
|
11206
|
+
if (!written.files.tokenFile) failures.push(`- token file ${tokenFile} NOT written`);
|
|
11207
|
+
if (!written.files.ghHosts && !ghHostsExternallyOwned()) {
|
|
11208
|
+
failures.push("- gh CLI config NOT written");
|
|
11209
|
+
}
|
|
11210
|
+
const probe = await verifyGitCredential(config.workspaceDir);
|
|
11211
|
+
if (!probe.ok) {
|
|
11212
|
+
failures.push(
|
|
11213
|
+
`- git could not authenticate to origin: ${probe.error ?? "unknown error"}`
|
|
11214
|
+
);
|
|
11215
|
+
}
|
|
11216
|
+
if (failures.length > 0) {
|
|
11217
|
+
return textResult(
|
|
11218
|
+
[
|
|
11219
|
+
probe.ok ? "GitHub token refreshed, but some credential copies did not update." : "GitHub token refresh did NOT produce a working git credential.",
|
|
11220
|
+
...failures,
|
|
11221
|
+
`A current token is available at ${tokenFile} when that file was written.`,
|
|
11222
|
+
"Do not retry this tool more than once. Report the failing lines above to the team \u2014 the GitHub App install may be missing for this project, or the pod's credential directory may not be writable."
|
|
11223
|
+
].join("\n")
|
|
11224
|
+
);
|
|
11225
|
+
}
|
|
11176
11226
|
return textResult(
|
|
11177
11227
|
[
|
|
11178
|
-
"GitHub token refreshed.",
|
|
11179
|
-
"- git: the credential store
|
|
11228
|
+
"GitHub token refreshed and verified against origin.",
|
|
11229
|
+
"- git: the credential store and helper are updated, so `git push` works now with no extra step.",
|
|
11180
11230
|
"- gh: the CLI config is updated, so `gh` works now with no extra step.",
|
|
11181
11231
|
`- shell/scripts: read the current token from ${tokenFile}.`,
|
|
11182
11232
|
` For a command that needs it in the environment: GITHUB_TOKEN=$(cat ${tokenFile}) <command>`,
|
|
11183
|
-
"Retry the failed command.
|
|
11233
|
+
"Retry the failed command."
|
|
11184
11234
|
].join("\n")
|
|
11185
11235
|
);
|
|
11186
11236
|
} catch (error) {
|
|
@@ -16148,10 +16198,17 @@ var SessionRunner = class _SessionRunner {
|
|
|
16148
16198
|
const res = await this.connection.call("refreshGithubToken", {
|
|
16149
16199
|
sessionId: this.connection.sessionId
|
|
16150
16200
|
});
|
|
16151
|
-
await updateRemoteToken(this.config.workspaceDir, res.token);
|
|
16201
|
+
const written = await updateRemoteToken(this.config.workspaceDir, res.token);
|
|
16152
16202
|
process.env.GITHUB_TOKEN = res.token;
|
|
16153
16203
|
process.env.GH_TOKEN = res.token;
|
|
16154
|
-
|
|
16204
|
+
if (written.credential.ok) {
|
|
16205
|
+
process.stderr.write("[conveyor-agent] Proactively refreshed GitHub token\n");
|
|
16206
|
+
} else {
|
|
16207
|
+
process.stderr.write(
|
|
16208
|
+
`[conveyor-agent] Warning: refreshed GitHub token but the git credential did not update: ${written.credential.error ?? "unknown error"}
|
|
16209
|
+
`
|
|
16210
|
+
);
|
|
16211
|
+
}
|
|
16155
16212
|
} catch (err) {
|
|
16156
16213
|
const msg = err instanceof Error ? err.message : String(err);
|
|
16157
16214
|
process.stderr.write(`[conveyor-agent] Warning: proactive token refresh failed: ${msg}
|
|
@@ -16365,4 +16422,4 @@ export {
|
|
|
16365
16422
|
loadConveyorConfig,
|
|
16366
16423
|
unshallowRepo
|
|
16367
16424
|
};
|
|
16368
|
-
//# sourceMappingURL=chunk-
|
|
16425
|
+
//# sourceMappingURL=chunk-HYP7BK2B.js.map
|