fix: align env config schema
This commit is contained in:
@@ -368,11 +368,14 @@ describe("config env vars", () => {
|
|||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
|
|
||||||
await withEnvOverride({ OPENROUTER_API_KEY: "existing-key" }, async () => {
|
await withEnvOverride(
|
||||||
const { loadConfig } = await import("./config.js");
|
{ OPENROUTER_API_KEY: "existing-key" },
|
||||||
loadConfig();
|
async () => {
|
||||||
expect(process.env.OPENROUTER_API_KEY).toBe("existing-key");
|
const { loadConfig } = await import("./config.js");
|
||||||
});
|
loadConfig();
|
||||||
|
expect(process.env.OPENROUTER_API_KEY).toBe("existing-key");
|
||||||
|
},
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -426,11 +429,7 @@ describe("config pruning defaults", () => {
|
|||||||
await fs.mkdir(configDir, { recursive: true });
|
await fs.mkdir(configDir, { recursive: true });
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
path.join(configDir, "clawdbot.json"),
|
path.join(configDir, "clawdbot.json"),
|
||||||
JSON.stringify(
|
JSON.stringify({ agent: { contextPruning: { mode: "off" } } }, null, 2),
|
||||||
{ agent: { contextPruning: { mode: "off" } } },
|
|
||||||
null,
|
|
||||||
2,
|
|
||||||
),
|
|
||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import {
|
|||||||
findDuplicateAgentDirs,
|
findDuplicateAgentDirs,
|
||||||
} from "./agent-dirs.js";
|
} from "./agent-dirs.js";
|
||||||
import {
|
import {
|
||||||
|
applyContextPruningDefaults,
|
||||||
applyIdentityDefaults,
|
applyIdentityDefaults,
|
||||||
applyLoggingDefaults,
|
applyLoggingDefaults,
|
||||||
applyMessageDefaults,
|
applyMessageDefaults,
|
||||||
applyModelDefaults,
|
applyModelDefaults,
|
||||||
applyContextPruningDefaults,
|
|
||||||
applySessionDefaults,
|
applySessionDefaults,
|
||||||
applyTalkApiKey,
|
applyTalkApiKey,
|
||||||
} from "./defaults.js";
|
} from "./defaults.js";
|
||||||
@@ -79,10 +79,7 @@ function warnOnConfigMiskeys(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyConfigEnv(
|
function applyConfigEnv(cfg: ClawdbotConfig, env: NodeJS.ProcessEnv): void {
|
||||||
cfg: ClawdbotConfig,
|
|
||||||
env: NodeJS.ProcessEnv,
|
|
||||||
): void {
|
|
||||||
const envConfig = cfg.env;
|
const envConfig = cfg.env;
|
||||||
if (!envConfig) return;
|
if (!envConfig) return;
|
||||||
|
|
||||||
|
|||||||
@@ -641,6 +641,7 @@ const RoutingSchema = z
|
|||||||
workspace: z.string().optional(),
|
workspace: z.string().optional(),
|
||||||
agentDir: z.string().optional(),
|
agentDir: z.string().optional(),
|
||||||
model: z.string().optional(),
|
model: z.string().optional(),
|
||||||
|
mentionPatterns: z.array(z.string()).optional(),
|
||||||
subagents: z
|
subagents: z
|
||||||
.object({
|
.object({
|
||||||
allowAgents: z.array(z.string()).optional(),
|
allowAgents: z.array(z.string()).optional(),
|
||||||
@@ -793,7 +794,7 @@ export const ClawdbotSchema = z.object({
|
|||||||
timeoutMs: z.number().int().nonnegative().optional(),
|
timeoutMs: z.number().int().nonnegative().optional(),
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
vars: z.record(z.string()).optional(),
|
vars: z.record(z.string(), z.string()).optional(),
|
||||||
})
|
})
|
||||||
.catchall(z.string())
|
.catchall(z.string())
|
||||||
.optional(),
|
.optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user