fix: configure JD01 workspace git proxy

This commit is contained in:
Codex
2026-06-29 14:34:15 +00:00
parent 10c5daf618
commit 2f21b7836b
9 changed files with 308 additions and 22 deletions
+31
View File
@@ -353,6 +353,7 @@ export interface HwlabRuntimeCodeAgentRuntimeSpec {
}
export interface HwlabRuntimeSourceWorkspaceSpec {
readonly git?: HwlabRuntimeSourceWorkspaceGitSpec;
readonly requiredCommands: readonly string[];
readonly requiredFiles: readonly string[];
readonly hostDependencies?: HwlabRuntimeSourceWorkspaceHostDependenciesSpec;
@@ -365,6 +366,16 @@ export interface HwlabRuntimeSourceWorkspaceSpec {
};
}
export interface HwlabRuntimeSourceWorkspaceGitSpec {
readonly remoteName: string;
readonly remoteUrl: string;
readonly identityTarget?: string;
readonly identityId?: string;
readonly proxyEnvPath?: string;
readonly verifyRemote: boolean;
readonly requireUpToDate: boolean;
}
export interface HwlabRuntimeSourceWorkspaceHostDependenciesSpec {
readonly checkCommands: readonly string[];
readonly stateDir: string;
@@ -873,11 +884,31 @@ function absoluteHostPathField(value: string, path: string): string {
return value;
}
function gitRemoteNameField(value: string, path: string): string {
if (!/^[A-Za-z0-9._-]+$/u.test(value)) throw new Error(`${path} must be a git remote name`);
return value;
}
function sourceWorkspaceGitConfig(value: unknown, path: string): HwlabRuntimeSourceWorkspaceGitSpec | undefined {
if (value === undefined) return undefined;
const raw = asRecord(value, path);
return {
remoteName: gitRemoteNameField(stringField(raw, "remoteName", path), `${path}.remoteName`),
remoteUrl: stringField(raw, "remoteUrl", path),
...(raw.identityTarget === undefined ? {} : { identityTarget: stringField(raw, "identityTarget", path) }),
...(raw.identityId === undefined ? {} : { identityId: stringField(raw, "identityId", path) }),
...(raw.proxyEnvPath === undefined ? {} : { proxyEnvPath: absoluteHostPathField(stringField(raw, "proxyEnvPath", path), `${path}.proxyEnvPath`) }),
verifyRemote: booleanField(raw, "verifyRemote", path),
requireUpToDate: booleanField(raw, "requireUpToDate", path),
};
}
function sourceWorkspaceConfig(value: unknown, path: string): HwlabRuntimeSourceWorkspaceSpec | undefined {
if (value === undefined) return undefined;
const raw = asRecord(value, path);
const install = asRecord(raw.install, `${path}.install`);
return {
git: sourceWorkspaceGitConfig(raw.git, `${path}.git`),
requiredCommands: stringArrayField(raw, "requiredCommands", path)
.map((item, index) => commandNameField(item, `${path}.requiredCommands[${index}]`)),
requiredFiles: stringArrayField(raw, "requiredFiles", path)