fix: relax image tool agentDir guard
This commit is contained in:
@@ -703,7 +703,9 @@ describe("runEmbeddedPiAgent", () => {
|
||||
).resolves.toBeTruthy();
|
||||
});
|
||||
|
||||
it("persists the first user message before assistant output", async () => {
|
||||
it(
|
||||
"persists the first user message before assistant output",
|
||||
async () => {
|
||||
const agentDir = await fs.mkdtemp(
|
||||
path.join(os.tmpdir(), "clawdbot-agent-"),
|
||||
);
|
||||
@@ -741,7 +743,9 @@ describe("runEmbeddedPiAgent", () => {
|
||||
if (firstAssistantIndex !== -1) {
|
||||
expect(firstUserIndex).toBeLessThan(firstAssistantIndex);
|
||||
}
|
||||
});
|
||||
},
|
||||
15_000,
|
||||
);
|
||||
|
||||
it("persists the user message when prompt fails before assistant output", async () => {
|
||||
const agentDir = await fs.mkdtemp(
|
||||
|
||||
@@ -25,11 +25,11 @@ describe("sandbox explain helpers", () => {
|
||||
};
|
||||
|
||||
const resolved = resolveSandboxConfigForAgent(cfg, "work");
|
||||
expect(resolved.tools.allow).toEqual(["write"]);
|
||||
expect(resolved.tools.allow).toEqual(["write", "image"]);
|
||||
expect(resolved.tools.deny).toEqual(["browser"]);
|
||||
|
||||
const policy = resolveSandboxToolPolicyForAgent(cfg, "work");
|
||||
expect(policy.allow).toEqual(["write"]);
|
||||
expect(policy.allow).toEqual(["write", "image"]);
|
||||
expect(policy.sources.allow.source).toBe("agent");
|
||||
expect(policy.deny).toEqual(["browser"]);
|
||||
expect(policy.sources.deny.source).toBe("global");
|
||||
|
||||
@@ -299,9 +299,13 @@ export function createImageTool(options?: {
|
||||
agentDir?: string;
|
||||
sandboxRoot?: string;
|
||||
}): AnyAgentTool | null {
|
||||
const agentDir = options?.agentDir;
|
||||
if (!agentDir?.trim()) {
|
||||
throw new Error("createImageTool requires agentDir when enabled");
|
||||
const agentDir = options?.agentDir?.trim();
|
||||
if (!agentDir) {
|
||||
const explicit = coerceImageModelConfig(options?.config);
|
||||
if (explicit.primary?.trim() || (explicit.fallbacks?.length ?? 0) > 0) {
|
||||
throw new Error("createImageTool requires agentDir when enabled");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const imageModelConfig = resolveImageModelConfigForTool({
|
||||
cfg: options?.config,
|
||||
|
||||
@@ -14,7 +14,9 @@ vi.mock("../commands/models.js", async () => {
|
||||
});
|
||||
|
||||
describe("models cli", () => {
|
||||
it("registers github-copilot login command", async () => {
|
||||
it(
|
||||
"registers github-copilot login command",
|
||||
async () => {
|
||||
const { Command } = await import("commander");
|
||||
const { registerModelsCli } = await import("./models-cli.js");
|
||||
|
||||
@@ -44,5 +46,7 @@ describe("models cli", () => {
|
||||
expect.objectContaining({ yes: true }),
|
||||
expect.any(Object),
|
||||
);
|
||||
});
|
||||
},
|
||||
15_000,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user