chore: Also format scripts and skills.
This commit is contained in:
@@ -20,9 +20,7 @@ function pickAnthropicEnv(): { type: "oauth" | "api"; value: string } | null {
|
||||
}
|
||||
|
||||
function pickZaiKey(): string | null {
|
||||
return (
|
||||
process.env.ZAI_API_KEY?.trim() ?? process.env.Z_AI_API_KEY?.trim() ?? null
|
||||
);
|
||||
return process.env.ZAI_API_KEY?.trim() ?? process.env.Z_AI_API_KEY?.trim() ?? null;
|
||||
}
|
||||
|
||||
async function runCommand(
|
||||
@@ -74,9 +72,7 @@ async function main() {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const baseDir = await fs.mkdtemp(
|
||||
path.join(os.tmpdir(), "openclaw-zai-fallback-"),
|
||||
);
|
||||
const baseDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-zai-fallback-"));
|
||||
const stateDir = path.join(baseDir, "state");
|
||||
const configPath = path.join(baseDir, "openclaw.json");
|
||||
await fs.mkdir(stateDir, { recursive: true });
|
||||
@@ -130,28 +126,14 @@ async function main() {
|
||||
"Then use the read tool to display the file contents. Reply with just the file contents.";
|
||||
const run1 = await runCommand(
|
||||
"run1",
|
||||
[
|
||||
"openclaw",
|
||||
"agent",
|
||||
"--local",
|
||||
"--session-id",
|
||||
sessionId,
|
||||
"--message",
|
||||
toolPrompt,
|
||||
],
|
||||
["openclaw", "agent", "--local", "--session-id", sessionId, "--message", toolPrompt],
|
||||
envValidAnthropic,
|
||||
);
|
||||
if (run1.code !== 0) {
|
||||
process.exit(run1.code ?? 1);
|
||||
}
|
||||
|
||||
const sessionFile = path.join(
|
||||
stateDir,
|
||||
"agents",
|
||||
"main",
|
||||
"sessions",
|
||||
`${sessionId}.jsonl`,
|
||||
);
|
||||
const sessionFile = path.join(stateDir, "agents", "main", "sessions", `${sessionId}.jsonl`);
|
||||
const transcript = await fs.readFile(sessionFile, "utf8").catch(() => "");
|
||||
if (!transcript.includes('"toolResult"')) {
|
||||
console.warn("Warning: no toolResult entries detected in session history.");
|
||||
@@ -162,15 +144,7 @@ async function main() {
|
||||
"What is the content of zai-fallback-tool.txt? Reply with just the contents.";
|
||||
const run2 = await runCommand(
|
||||
"run2",
|
||||
[
|
||||
"openclaw",
|
||||
"agent",
|
||||
"--local",
|
||||
"--session-id",
|
||||
sessionId,
|
||||
"--message",
|
||||
followupPrompt,
|
||||
],
|
||||
["openclaw", "agent", "--local", "--session-id", sessionId, "--message", followupPrompt],
|
||||
envInvalidAnthropic,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user