test(parallels): write Windows provider config via batch file

This commit is contained in:
Peter Steinberger
2026-05-01 15:19:59 +01:00
parent 4f7286ce86
commit efe6b37407
2 changed files with 15 additions and 2 deletions

View File

@@ -20,8 +20,20 @@ export function windowsModelProviderTimeoutScript(modelId: string): string {
if (!providerId || !configJson) {
return "";
}
return `Invoke-OpenClaw config set ${psSingleQuote(`models.providers.${providerId}`)} ${psSingleQuote(configJson)} --strict-json
if ($LASTEXITCODE -ne 0) { throw "model provider timeout config set failed" }`;
const batchJson = JSON.stringify([
{
path: `models.providers.${providerId}`,
value: JSON.parse(configJson) as unknown,
},
]);
return `$providerTimeoutBatchPath = Join-Path ([System.IO.Path]::GetTempPath()) 'openclaw-provider-timeout.batch.json'
@'
${batchJson}
'@ | Set-Content -Path $providerTimeoutBatchPath -Encoding UTF8
Invoke-OpenClaw config set --batch-file $providerTimeoutBatchPath --strict-json
$providerTimeoutExit = $LASTEXITCODE
Remove-Item $providerTimeoutBatchPath -Force -ErrorAction SilentlyContinue
if ($providerTimeoutExit -ne 0) { throw "model provider timeout config set failed" }`;
}
export const windowsOpenClawResolver = String.raw`function Resolve-OpenClawCommand {

View File

@@ -324,6 +324,7 @@ console.log(JSON.stringify(result));
expect(readFileSync(TS_PATHS.macos, "utf8")).toContain("providerTimeoutConfigJson");
expect(readFileSync(TS_PATHS.linux, "utf8")).toContain("providerTimeoutConfigJson");
expect(readFileSync(TS_PATHS.windows, "utf8")).toContain("windowsModelProviderTimeoutScript");
expect(readFileSync(TS_PATHS.powershell, "utf8")).toContain("config set --batch-file");
const npmUpdateScripts = readFileSync(TS_PATHS.npmUpdateScripts, "utf8");
expect(npmUpdateScripts).toContain("posixAgentWorkspaceScript");