@ricsam/r5d-worker 0.0.32 → 0.0.34
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/README.md +2 -0
- package/dist/cjs/main.cjs +65 -26
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/main.mjs +63 -26
- package/dist/mjs/package.json +1 -1
- package/dist/types/main.d.ts +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@ The worker uses the existing `r5dctl` config file and accepts `R5D_WORKER_TOKEN`
|
|
|
15
15
|
|
|
16
16
|
Web shells and agent shell commands receive a server-issued `r5dctl` credential automatically. The credential is scoped to the signed-in user and revoked when the shell or command finishes, so commands such as `r5dctl auth status` do not require a separate login on the worker host.
|
|
17
17
|
|
|
18
|
+
When the user has signed in with GitHub, web shells and agent commands also receive that OAuth credential through `GH_TOKEN`. GitHub CLI commands such as `gh pr`, `gh issue`, and `gh workflow` therefore use the signed-in user's permissions without a separate `gh auth login` on the worker host. Signing in again refreshes the granted OAuth scopes for subsequently started commands and shells.
|
|
19
|
+
|
|
18
20
|
Visible branch checkouts are the user/agent workbench. Their `origin` remains the connected GitHub repository for manual Git work. r5d internal sync git metadata lives separately under `~/.r5d/sync`; when a worker connects, every idle registered branch is force-synchronized from that internal remote. The same destructive sync can be requested for a live worker from User Settings.
|
|
19
21
|
|
|
20
22
|
Worker labels are mandatory and unique per user. Choose labels that describe host capabilities, such as `macos`, `linux`, `ios`, or `ec2-build`.
|
package/dist/cjs/main.cjs
CHANGED
|
@@ -32,6 +32,7 @@ __export(main_exports, {
|
|
|
32
32
|
ensureVisibleGitCheckout: () => ensureVisibleGitCheckout,
|
|
33
33
|
findRepositorySyncBlockers: () => findRepositorySyncBlockers,
|
|
34
34
|
findWorkerFiles: () => findWorkerFiles,
|
|
35
|
+
githubCliEnv: () => githubCliEnv,
|
|
35
36
|
grepWorkerFiles: () => grepWorkerFiles,
|
|
36
37
|
isArtifactEnvPath: () => isArtifactEnvPath,
|
|
37
38
|
listWorkerDirectory: () => listWorkerDirectory,
|
|
@@ -42,6 +43,7 @@ __export(main_exports, {
|
|
|
42
43
|
resolveHostShell: () => resolveHostShell,
|
|
43
44
|
resolveProjectFilePath: () => resolveProjectFilePath,
|
|
44
45
|
resolveWorkerFilePath: () => resolveWorkerFilePath,
|
|
46
|
+
selectManifestSyncTargets: () => selectManifestSyncTargets,
|
|
45
47
|
syncManifestProjectsFromInternal: () => syncManifestProjectsFromInternal,
|
|
46
48
|
syncProjectPlans: () => syncProjectPlans,
|
|
47
49
|
syncSessionArtifacts: () => syncSessionArtifacts
|
|
@@ -72,7 +74,7 @@ const activeProcesses = /* @__PURE__ */ new Map();
|
|
|
72
74
|
const cancelledProcessRuns = /* @__PURE__ */ new Set();
|
|
73
75
|
const activePtys = /* @__PURE__ */ new Map();
|
|
74
76
|
let currentWorkerSocket = null;
|
|
75
|
-
let
|
|
77
|
+
let githubCredential = null;
|
|
76
78
|
let visibleGitIdentity = null;
|
|
77
79
|
function defaultConfigPath() {
|
|
78
80
|
return import_node_path.default.join(import_node_os.default.homedir(), ".config", "r5d", "r5dctl", "config.json");
|
|
@@ -928,8 +930,8 @@ function writeRegistryAuthFile(filePath, credential) {
|
|
|
928
930
|
const auths = existingAuths;
|
|
929
931
|
auths[credential.registry] = {
|
|
930
932
|
username: credential.username,
|
|
931
|
-
password: credential.
|
|
932
|
-
auth: Buffer.from(`${credential.username}:${credential.
|
|
933
|
+
password: credential.token,
|
|
934
|
+
auth: Buffer.from(`${credential.username}:${credential.token}`).toString("base64")
|
|
933
935
|
};
|
|
934
936
|
config.auths = auths;
|
|
935
937
|
import_node_fs.default.mkdirSync(import_node_path.default.dirname(filePath), { recursive: true });
|
|
@@ -937,8 +939,8 @@ function writeRegistryAuthFile(filePath, credential) {
|
|
|
937
939
|
`, { mode: 384 });
|
|
938
940
|
import_node_fs.default.chmodSync(filePath, 384);
|
|
939
941
|
}
|
|
940
|
-
function
|
|
941
|
-
|
|
942
|
+
function configureGitHubAuth(credential) {
|
|
943
|
+
githubCredential = credential;
|
|
942
944
|
if (!credential) {
|
|
943
945
|
return;
|
|
944
946
|
}
|
|
@@ -946,25 +948,41 @@ function configureContainerRegistryAuth(credential) {
|
|
|
946
948
|
writeRegistryAuthFile(containersAuthPath(), credential);
|
|
947
949
|
if (credential.missingScopes.length > 0) {
|
|
948
950
|
process.stderr.write(
|
|
949
|
-
`[r5d-worker] GitHub token is missing
|
|
951
|
+
`[r5d-worker] GitHub token is missing scope(s): ${credential.missingScopes.join(", ")}. Sign in with GitHub again if gh or GHCR access fails.
|
|
950
952
|
`
|
|
951
953
|
);
|
|
952
954
|
} else {
|
|
953
|
-
process.stdout.write(`[r5d-worker] configured GHCR auth for ${credential.username}
|
|
955
|
+
process.stdout.write(`[r5d-worker] configured GitHub CLI and GHCR auth for ${credential.username}
|
|
954
956
|
`);
|
|
955
957
|
}
|
|
956
958
|
}
|
|
957
959
|
function containerRegistryEnv() {
|
|
958
|
-
if (!
|
|
960
|
+
if (!githubCredential) {
|
|
959
961
|
return {};
|
|
960
962
|
}
|
|
961
963
|
return {
|
|
962
|
-
R5D_GHCR_REGISTRY:
|
|
963
|
-
R5D_GHCR_NAMESPACE:
|
|
964
|
+
R5D_GHCR_REGISTRY: githubCredential.registry,
|
|
965
|
+
R5D_GHCR_NAMESPACE: githubCredential.username,
|
|
964
966
|
R5D_GHCR_AUTH_FILE: containersAuthPath(),
|
|
965
967
|
REGISTRY_AUTH_FILE: containersAuthPath(),
|
|
966
|
-
GHCR_REGISTRY:
|
|
967
|
-
GHCR_NAMESPACE:
|
|
968
|
+
GHCR_REGISTRY: githubCredential.registry,
|
|
969
|
+
GHCR_NAMESPACE: githubCredential.username
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
function githubCliEnv(token) {
|
|
973
|
+
if (!token) {
|
|
974
|
+
return {};
|
|
975
|
+
}
|
|
976
|
+
return {
|
|
977
|
+
GH_TOKEN: token,
|
|
978
|
+
GH_HOST: "github.com",
|
|
979
|
+
GH_PROMPT_DISABLED: "1"
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
function githubProcessEnv() {
|
|
983
|
+
return {
|
|
984
|
+
...containerRegistryEnv(),
|
|
985
|
+
...githubCliEnv(githubCredential?.token)
|
|
968
986
|
};
|
|
969
987
|
}
|
|
970
988
|
function checkoutVisibleBranch(input) {
|
|
@@ -1145,11 +1163,28 @@ function findRepositorySyncBlockers(input) {
|
|
|
1145
1163
|
}
|
|
1146
1164
|
return blockedBy;
|
|
1147
1165
|
}
|
|
1166
|
+
function selectManifestSyncTargets(input) {
|
|
1167
|
+
if (!input.requestedTargets) {
|
|
1168
|
+
return input.manifests.flatMap((manifest) => {
|
|
1169
|
+
const branches = manifest.branches.length > 0 ? manifest.branches : [manifest.defaultBranch || "main"];
|
|
1170
|
+
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
const manifestsByProjectId = new Map(input.manifests.map((manifest) => [manifest.projectId, manifest]));
|
|
1174
|
+
const selected = /* @__PURE__ */ new Map();
|
|
1175
|
+
for (const target of input.requestedTargets) {
|
|
1176
|
+
const manifest = manifestsByProjectId.get(target.projectId);
|
|
1177
|
+
if (!manifest) {
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
selected.set(`${target.projectId}\0${target.branchName}`, { manifest, branchName: target.branchName });
|
|
1181
|
+
}
|
|
1182
|
+
return [...selected.values()];
|
|
1183
|
+
}
|
|
1148
1184
|
async function syncManifestProjectsFromInternal(input) {
|
|
1149
|
-
const
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1185
|
+
const targets = selectManifestSyncTargets({
|
|
1186
|
+
manifests: input.manifests,
|
|
1187
|
+
requestedTargets: input.requestedTargets
|
|
1153
1188
|
});
|
|
1154
1189
|
const blockedBy = findRepositorySyncBlockers({
|
|
1155
1190
|
targets: targets.map(({ manifest, branchName }) => ({
|
|
@@ -1168,11 +1203,12 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1168
1203
|
branchName: active.branchName
|
|
1169
1204
|
}))
|
|
1170
1205
|
});
|
|
1171
|
-
|
|
1172
|
-
return { status: "blocked", results: [], blockedBy };
|
|
1173
|
-
}
|
|
1206
|
+
const blockedTargetKeys = new Set(blockedBy.map((blocker) => `${blocker.projectId}\0${blocker.branchName}`));
|
|
1174
1207
|
const results = [];
|
|
1175
1208
|
for (const { manifest, branchName } of targets) {
|
|
1209
|
+
if (blockedTargetKeys.has(`${manifest.projectId}\0${branchName}`)) {
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1176
1212
|
try {
|
|
1177
1213
|
const commitHash = await forceSyncManifestBranchFromInternal({
|
|
1178
1214
|
projectId: manifest.projectId,
|
|
@@ -1200,10 +1236,11 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1200
1236
|
});
|
|
1201
1237
|
}
|
|
1202
1238
|
}
|
|
1239
|
+
const hasFailures = results.some((result) => result.status === "failed");
|
|
1203
1240
|
return {
|
|
1204
|
-
status:
|
|
1241
|
+
status: blockedBy.length > 0 && results.length === 0 ? "blocked" : blockedBy.length > 0 || hasFailures ? "partial" : "completed",
|
|
1205
1242
|
results,
|
|
1206
|
-
blockedBy
|
|
1243
|
+
blockedBy
|
|
1207
1244
|
};
|
|
1208
1245
|
}
|
|
1209
1246
|
function resolveCommandCwd(branchPath, cwd) {
|
|
@@ -1910,7 +1947,7 @@ async function executeCommand(input) {
|
|
|
1910
1947
|
detached: true,
|
|
1911
1948
|
env: {
|
|
1912
1949
|
...process.env,
|
|
1913
|
-
...
|
|
1950
|
+
...githubProcessEnv(),
|
|
1914
1951
|
...input.message.env ?? {},
|
|
1915
1952
|
...internalGitProcessEnv(workspace, input.message.env),
|
|
1916
1953
|
...artifactProcessEnv,
|
|
@@ -2015,7 +2052,7 @@ async function executeStreamingCommand(input) {
|
|
|
2015
2052
|
detached: true,
|
|
2016
2053
|
env: {
|
|
2017
2054
|
...process.env,
|
|
2018
|
-
...
|
|
2055
|
+
...githubProcessEnv(),
|
|
2019
2056
|
...input.message.env ?? {},
|
|
2020
2057
|
...internalGitProcessEnv(workspace, input.message.env),
|
|
2021
2058
|
...artifactProcessEnv,
|
|
@@ -2346,7 +2383,7 @@ async function openPty(input) {
|
|
|
2346
2383
|
cwd: branchPath.branchPath,
|
|
2347
2384
|
env: {
|
|
2348
2385
|
...process.env,
|
|
2349
|
-
...
|
|
2386
|
+
...githubProcessEnv(),
|
|
2350
2387
|
...input.message.env ?? {},
|
|
2351
2388
|
...planProcessEnv,
|
|
2352
2389
|
R5D_PROJECT_ID: input.projectId,
|
|
@@ -2530,7 +2567,7 @@ async function startWorker(options) {
|
|
|
2530
2567
|
return;
|
|
2531
2568
|
}
|
|
2532
2569
|
if (message.type === "project_manifest") {
|
|
2533
|
-
|
|
2570
|
+
configureGitHubAuth(message.githubCredential);
|
|
2534
2571
|
visibleGitIdentity = message.gitIdentity;
|
|
2535
2572
|
manifestByProjectId.clear();
|
|
2536
2573
|
for (const project of message.projects) {
|
|
@@ -2563,7 +2600,7 @@ async function startWorker(options) {
|
|
|
2563
2600
|
projectsRoot,
|
|
2564
2601
|
syncRoot,
|
|
2565
2602
|
manifests: [...manifestByProjectId.values()],
|
|
2566
|
-
|
|
2603
|
+
requestedTargets: message.targets
|
|
2567
2604
|
});
|
|
2568
2605
|
for (const result of syncResult.results) {
|
|
2569
2606
|
if (result.status !== "synced") continue;
|
|
@@ -2920,6 +2957,7 @@ if (isCliEntrypoint()) {
|
|
|
2920
2957
|
ensureVisibleGitCheckout,
|
|
2921
2958
|
findRepositorySyncBlockers,
|
|
2922
2959
|
findWorkerFiles,
|
|
2960
|
+
githubCliEnv,
|
|
2923
2961
|
grepWorkerFiles,
|
|
2924
2962
|
isArtifactEnvPath,
|
|
2925
2963
|
listWorkerDirectory,
|
|
@@ -2930,6 +2968,7 @@ if (isCliEntrypoint()) {
|
|
|
2930
2968
|
resolveHostShell,
|
|
2931
2969
|
resolveProjectFilePath,
|
|
2932
2970
|
resolveWorkerFilePath,
|
|
2971
|
+
selectManifestSyncTargets,
|
|
2933
2972
|
syncManifestProjectsFromInternal,
|
|
2934
2973
|
syncProjectPlans,
|
|
2935
2974
|
syncSessionArtifacts
|
package/dist/cjs/package.json
CHANGED
package/dist/mjs/main.mjs
CHANGED
|
@@ -23,7 +23,7 @@ const activeProcesses = /* @__PURE__ */ new Map();
|
|
|
23
23
|
const cancelledProcessRuns = /* @__PURE__ */ new Set();
|
|
24
24
|
const activePtys = /* @__PURE__ */ new Map();
|
|
25
25
|
let currentWorkerSocket = null;
|
|
26
|
-
let
|
|
26
|
+
let githubCredential = null;
|
|
27
27
|
let visibleGitIdentity = null;
|
|
28
28
|
function defaultConfigPath() {
|
|
29
29
|
return path.join(os.homedir(), ".config", "r5d", "r5dctl", "config.json");
|
|
@@ -879,8 +879,8 @@ function writeRegistryAuthFile(filePath, credential) {
|
|
|
879
879
|
const auths = existingAuths;
|
|
880
880
|
auths[credential.registry] = {
|
|
881
881
|
username: credential.username,
|
|
882
|
-
password: credential.
|
|
883
|
-
auth: Buffer.from(`${credential.username}:${credential.
|
|
882
|
+
password: credential.token,
|
|
883
|
+
auth: Buffer.from(`${credential.username}:${credential.token}`).toString("base64")
|
|
884
884
|
};
|
|
885
885
|
config.auths = auths;
|
|
886
886
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
@@ -888,8 +888,8 @@ function writeRegistryAuthFile(filePath, credential) {
|
|
|
888
888
|
`, { mode: 384 });
|
|
889
889
|
fs.chmodSync(filePath, 384);
|
|
890
890
|
}
|
|
891
|
-
function
|
|
892
|
-
|
|
891
|
+
function configureGitHubAuth(credential) {
|
|
892
|
+
githubCredential = credential;
|
|
893
893
|
if (!credential) {
|
|
894
894
|
return;
|
|
895
895
|
}
|
|
@@ -897,25 +897,41 @@ function configureContainerRegistryAuth(credential) {
|
|
|
897
897
|
writeRegistryAuthFile(containersAuthPath(), credential);
|
|
898
898
|
if (credential.missingScopes.length > 0) {
|
|
899
899
|
process.stderr.write(
|
|
900
|
-
`[r5d-worker] GitHub token is missing
|
|
900
|
+
`[r5d-worker] GitHub token is missing scope(s): ${credential.missingScopes.join(", ")}. Sign in with GitHub again if gh or GHCR access fails.
|
|
901
901
|
`
|
|
902
902
|
);
|
|
903
903
|
} else {
|
|
904
|
-
process.stdout.write(`[r5d-worker] configured GHCR auth for ${credential.username}
|
|
904
|
+
process.stdout.write(`[r5d-worker] configured GitHub CLI and GHCR auth for ${credential.username}
|
|
905
905
|
`);
|
|
906
906
|
}
|
|
907
907
|
}
|
|
908
908
|
function containerRegistryEnv() {
|
|
909
|
-
if (!
|
|
909
|
+
if (!githubCredential) {
|
|
910
910
|
return {};
|
|
911
911
|
}
|
|
912
912
|
return {
|
|
913
|
-
R5D_GHCR_REGISTRY:
|
|
914
|
-
R5D_GHCR_NAMESPACE:
|
|
913
|
+
R5D_GHCR_REGISTRY: githubCredential.registry,
|
|
914
|
+
R5D_GHCR_NAMESPACE: githubCredential.username,
|
|
915
915
|
R5D_GHCR_AUTH_FILE: containersAuthPath(),
|
|
916
916
|
REGISTRY_AUTH_FILE: containersAuthPath(),
|
|
917
|
-
GHCR_REGISTRY:
|
|
918
|
-
GHCR_NAMESPACE:
|
|
917
|
+
GHCR_REGISTRY: githubCredential.registry,
|
|
918
|
+
GHCR_NAMESPACE: githubCredential.username
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
function githubCliEnv(token) {
|
|
922
|
+
if (!token) {
|
|
923
|
+
return {};
|
|
924
|
+
}
|
|
925
|
+
return {
|
|
926
|
+
GH_TOKEN: token,
|
|
927
|
+
GH_HOST: "github.com",
|
|
928
|
+
GH_PROMPT_DISABLED: "1"
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
function githubProcessEnv() {
|
|
932
|
+
return {
|
|
933
|
+
...containerRegistryEnv(),
|
|
934
|
+
...githubCliEnv(githubCredential?.token)
|
|
919
935
|
};
|
|
920
936
|
}
|
|
921
937
|
function checkoutVisibleBranch(input) {
|
|
@@ -1096,11 +1112,28 @@ function findRepositorySyncBlockers(input) {
|
|
|
1096
1112
|
}
|
|
1097
1113
|
return blockedBy;
|
|
1098
1114
|
}
|
|
1115
|
+
function selectManifestSyncTargets(input) {
|
|
1116
|
+
if (!input.requestedTargets) {
|
|
1117
|
+
return input.manifests.flatMap((manifest) => {
|
|
1118
|
+
const branches = manifest.branches.length > 0 ? manifest.branches : [manifest.defaultBranch || "main"];
|
|
1119
|
+
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
const manifestsByProjectId = new Map(input.manifests.map((manifest) => [manifest.projectId, manifest]));
|
|
1123
|
+
const selected = /* @__PURE__ */ new Map();
|
|
1124
|
+
for (const target of input.requestedTargets) {
|
|
1125
|
+
const manifest = manifestsByProjectId.get(target.projectId);
|
|
1126
|
+
if (!manifest) {
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
selected.set(`${target.projectId}\0${target.branchName}`, { manifest, branchName: target.branchName });
|
|
1130
|
+
}
|
|
1131
|
+
return [...selected.values()];
|
|
1132
|
+
}
|
|
1099
1133
|
async function syncManifestProjectsFromInternal(input) {
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
return [...new Set(branches)].map((branchName) => ({ manifest, branchName }));
|
|
1134
|
+
const targets = selectManifestSyncTargets({
|
|
1135
|
+
manifests: input.manifests,
|
|
1136
|
+
requestedTargets: input.requestedTargets
|
|
1104
1137
|
});
|
|
1105
1138
|
const blockedBy = findRepositorySyncBlockers({
|
|
1106
1139
|
targets: targets.map(({ manifest, branchName }) => ({
|
|
@@ -1119,11 +1152,12 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1119
1152
|
branchName: active.branchName
|
|
1120
1153
|
}))
|
|
1121
1154
|
});
|
|
1122
|
-
|
|
1123
|
-
return { status: "blocked", results: [], blockedBy };
|
|
1124
|
-
}
|
|
1155
|
+
const blockedTargetKeys = new Set(blockedBy.map((blocker) => `${blocker.projectId}\0${blocker.branchName}`));
|
|
1125
1156
|
const results = [];
|
|
1126
1157
|
for (const { manifest, branchName } of targets) {
|
|
1158
|
+
if (blockedTargetKeys.has(`${manifest.projectId}\0${branchName}`)) {
|
|
1159
|
+
continue;
|
|
1160
|
+
}
|
|
1127
1161
|
try {
|
|
1128
1162
|
const commitHash = await forceSyncManifestBranchFromInternal({
|
|
1129
1163
|
projectId: manifest.projectId,
|
|
@@ -1151,10 +1185,11 @@ async function syncManifestProjectsFromInternal(input) {
|
|
|
1151
1185
|
});
|
|
1152
1186
|
}
|
|
1153
1187
|
}
|
|
1188
|
+
const hasFailures = results.some((result) => result.status === "failed");
|
|
1154
1189
|
return {
|
|
1155
|
-
status:
|
|
1190
|
+
status: blockedBy.length > 0 && results.length === 0 ? "blocked" : blockedBy.length > 0 || hasFailures ? "partial" : "completed",
|
|
1156
1191
|
results,
|
|
1157
|
-
blockedBy
|
|
1192
|
+
blockedBy
|
|
1158
1193
|
};
|
|
1159
1194
|
}
|
|
1160
1195
|
function resolveCommandCwd(branchPath, cwd) {
|
|
@@ -1861,7 +1896,7 @@ async function executeCommand(input) {
|
|
|
1861
1896
|
detached: true,
|
|
1862
1897
|
env: {
|
|
1863
1898
|
...process.env,
|
|
1864
|
-
...
|
|
1899
|
+
...githubProcessEnv(),
|
|
1865
1900
|
...input.message.env ?? {},
|
|
1866
1901
|
...internalGitProcessEnv(workspace, input.message.env),
|
|
1867
1902
|
...artifactProcessEnv,
|
|
@@ -1966,7 +2001,7 @@ async function executeStreamingCommand(input) {
|
|
|
1966
2001
|
detached: true,
|
|
1967
2002
|
env: {
|
|
1968
2003
|
...process.env,
|
|
1969
|
-
...
|
|
2004
|
+
...githubProcessEnv(),
|
|
1970
2005
|
...input.message.env ?? {},
|
|
1971
2006
|
...internalGitProcessEnv(workspace, input.message.env),
|
|
1972
2007
|
...artifactProcessEnv,
|
|
@@ -2297,7 +2332,7 @@ async function openPty(input) {
|
|
|
2297
2332
|
cwd: branchPath.branchPath,
|
|
2298
2333
|
env: {
|
|
2299
2334
|
...process.env,
|
|
2300
|
-
...
|
|
2335
|
+
...githubProcessEnv(),
|
|
2301
2336
|
...input.message.env ?? {},
|
|
2302
2337
|
...planProcessEnv,
|
|
2303
2338
|
R5D_PROJECT_ID: input.projectId,
|
|
@@ -2481,7 +2516,7 @@ async function startWorker(options) {
|
|
|
2481
2516
|
return;
|
|
2482
2517
|
}
|
|
2483
2518
|
if (message.type === "project_manifest") {
|
|
2484
|
-
|
|
2519
|
+
configureGitHubAuth(message.githubCredential);
|
|
2485
2520
|
visibleGitIdentity = message.gitIdentity;
|
|
2486
2521
|
manifestByProjectId.clear();
|
|
2487
2522
|
for (const project of message.projects) {
|
|
@@ -2514,7 +2549,7 @@ async function startWorker(options) {
|
|
|
2514
2549
|
projectsRoot,
|
|
2515
2550
|
syncRoot,
|
|
2516
2551
|
manifests: [...manifestByProjectId.values()],
|
|
2517
|
-
|
|
2552
|
+
requestedTargets: message.targets
|
|
2518
2553
|
});
|
|
2519
2554
|
for (const result of syncResult.results) {
|
|
2520
2555
|
if (result.status !== "synced") continue;
|
|
@@ -2870,6 +2905,7 @@ export {
|
|
|
2870
2905
|
ensureVisibleGitCheckout,
|
|
2871
2906
|
findRepositorySyncBlockers,
|
|
2872
2907
|
findWorkerFiles,
|
|
2908
|
+
githubCliEnv,
|
|
2873
2909
|
grepWorkerFiles,
|
|
2874
2910
|
isArtifactEnvPath,
|
|
2875
2911
|
listWorkerDirectory,
|
|
@@ -2880,6 +2916,7 @@ export {
|
|
|
2880
2916
|
resolveHostShell,
|
|
2881
2917
|
resolveProjectFilePath,
|
|
2882
2918
|
resolveWorkerFilePath,
|
|
2919
|
+
selectManifestSyncTargets,
|
|
2883
2920
|
syncManifestProjectsFromInternal,
|
|
2884
2921
|
syncProjectPlans,
|
|
2885
2922
|
syncSessionArtifacts
|
package/dist/mjs/package.json
CHANGED
package/dist/types/main.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ type WorkerRepositorySyncTarget = {
|
|
|
26
26
|
projectPath: string;
|
|
27
27
|
branchName: string;
|
|
28
28
|
};
|
|
29
|
+
type WorkerRepositorySyncSelector = {
|
|
30
|
+
projectId: string;
|
|
31
|
+
branchName: string;
|
|
32
|
+
};
|
|
29
33
|
type WorkerRepositorySyncResult = {
|
|
30
34
|
status: "completed" | "partial" | "blocked";
|
|
31
35
|
results: Array<WorkerRepositorySyncTarget & ({
|
|
@@ -119,6 +123,7 @@ export declare function resolveWorkerFilePath(branchPath: string, inputPath: str
|
|
|
119
123
|
export declare function resolveProjectFilePath(branchPath: string, inputPath: string): Extract<ResolvedWorkerFilePath, {
|
|
120
124
|
scope: "project";
|
|
121
125
|
}>;
|
|
126
|
+
export declare function githubCliEnv(token: string | null | undefined): Record<string, string>;
|
|
122
127
|
export declare function ensureVisibleGitCheckout(input: {
|
|
123
128
|
projectRoot: string;
|
|
124
129
|
branchName: string;
|
|
@@ -141,13 +146,20 @@ export declare function findRepositorySyncBlockers(input: {
|
|
|
141
146
|
branchName: string;
|
|
142
147
|
}>;
|
|
143
148
|
}): WorkerRepositorySyncResult["blockedBy"];
|
|
149
|
+
export declare function selectManifestSyncTargets(input: {
|
|
150
|
+
manifests: WorkerProjectManifestEntry[];
|
|
151
|
+
requestedTargets?: WorkerRepositorySyncSelector[];
|
|
152
|
+
}): Array<{
|
|
153
|
+
manifest: WorkerProjectManifestEntry;
|
|
154
|
+
branchName: string;
|
|
155
|
+
}>;
|
|
144
156
|
export declare function syncManifestProjectsFromInternal(input: {
|
|
145
157
|
baseUrl: string;
|
|
146
158
|
token: string;
|
|
147
159
|
projectsRoot: string;
|
|
148
160
|
syncRoot: string;
|
|
149
161
|
manifests: WorkerProjectManifestEntry[];
|
|
150
|
-
|
|
162
|
+
requestedTargets?: WorkerRepositorySyncSelector[];
|
|
151
163
|
}): Promise<WorkerRepositorySyncResult>;
|
|
152
164
|
export declare function readWorkerTextFile(branchPath: string, filePath: string, offset?: number, limit?: number): WorkerReadFileResult;
|
|
153
165
|
export declare function grepWorkerFiles(branchPath: string, input: {
|