mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 08:21:26 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -4,7 +4,7 @@ import path from "node:path";
|
||||
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { __testing, createImageTool, resolveImageModelConfigForTool } from "./image-tool.js";
|
||||
|
||||
async function writeAuthProfiles(agentDir: string, profiles: unknown) {
|
||||
@@ -37,8 +37,8 @@ describe("image tool implicit imageModel config", () => {
|
||||
});
|
||||
|
||||
it("stays disabled without auth when no pairing is possible", async () => {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-"));
|
||||
const cfg: MoltbotConfig = {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "openai/gpt-5.2" } } },
|
||||
};
|
||||
expect(resolveImageModelConfigForTool({ cfg, agentDir })).toBeNull();
|
||||
@@ -46,11 +46,11 @@ describe("image tool implicit imageModel config", () => {
|
||||
});
|
||||
|
||||
it("pairs minimax primary with MiniMax-VL-01 (and fallbacks) when auth exists", async () => {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-"));
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
vi.stubEnv("OPENAI_API_KEY", "openai-test");
|
||||
vi.stubEnv("ANTHROPIC_API_KEY", "anthropic-test");
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "minimax/MiniMax-M2.1" } } },
|
||||
};
|
||||
expect(resolveImageModelConfigForTool({ cfg, agentDir })).toEqual({
|
||||
@@ -61,14 +61,14 @@ describe("image tool implicit imageModel config", () => {
|
||||
});
|
||||
|
||||
it("pairs a custom provider when it declares an image-capable model", async () => {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-"));
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
await writeAuthProfiles(agentDir, {
|
||||
version: 1,
|
||||
profiles: {
|
||||
"acme:default": { type: "api_key", provider: "acme", key: "sk-test" },
|
||||
},
|
||||
});
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "acme/text-1" } } },
|
||||
models: {
|
||||
providers: {
|
||||
@@ -88,8 +88,8 @@ describe("image tool implicit imageModel config", () => {
|
||||
});
|
||||
|
||||
it("prefers explicit agents.defaults.imageModel", async () => {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-"));
|
||||
const cfg: MoltbotConfig = {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: { primary: "minimax/MiniMax-M2.1" },
|
||||
@@ -107,8 +107,8 @@ describe("image tool implicit imageModel config", () => {
|
||||
// because images are auto-injected into prompts. The tool description is
|
||||
// adjusted via modelHasVision to discourage redundant usage.
|
||||
vi.stubEnv("OPENAI_API_KEY", "test-key");
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-"));
|
||||
const cfg: MoltbotConfig = {
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-"));
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: { primary: "acme/vision-1" },
|
||||
@@ -135,7 +135,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
});
|
||||
|
||||
it("sandboxes image paths like the read tool", async () => {
|
||||
const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-sandbox-"));
|
||||
const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-sandbox-"));
|
||||
const agentDir = path.join(stateDir, "agent");
|
||||
const sandboxRoot = path.join(stateDir, "sandbox");
|
||||
await fs.mkdir(agentDir, { recursive: true });
|
||||
@@ -143,7 +143,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
await fs.writeFile(path.join(sandboxRoot, "img.png"), "fake", "utf8");
|
||||
|
||||
vi.stubEnv("OPENAI_API_KEY", "openai-test");
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "minimax/MiniMax-M2.1" } } },
|
||||
};
|
||||
const tool = createImageTool({ config: cfg, agentDir, sandboxRoot });
|
||||
@@ -160,7 +160,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
});
|
||||
|
||||
it("rewrites inbound absolute paths into sandbox media/inbound", async () => {
|
||||
const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-image-sandbox-"));
|
||||
const stateDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-image-sandbox-"));
|
||||
const agentDir = path.join(stateDir, "agent");
|
||||
const sandboxRoot = path.join(stateDir, "sandbox");
|
||||
await fs.mkdir(agentDir, { recursive: true });
|
||||
@@ -188,7 +188,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
global.fetch = fetch;
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: { primary: "minimax/MiniMax-M2.1" },
|
||||
@@ -202,7 +202,7 @@ describe("image tool implicit imageModel config", () => {
|
||||
|
||||
const res = await tool.execute("t1", {
|
||||
prompt: "Describe the image.",
|
||||
image: "@/Users/steipete/.clawdbot/media/inbound/photo.png",
|
||||
image: "@/Users/steipete/.openclaw/media/inbound/photo.png",
|
||||
});
|
||||
|
||||
expect(fetch).toHaveBeenCalledTimes(1);
|
||||
@@ -259,9 +259,9 @@ describe("image tool MiniMax VLM routing", () => {
|
||||
// @ts-expect-error partial global
|
||||
global.fetch = fetch;
|
||||
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-minimax-vlm-"));
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-minimax-vlm-"));
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "minimax/MiniMax-M2.1" } } },
|
||||
};
|
||||
const tool = createImageTool({ config: cfg, agentDir });
|
||||
@@ -301,9 +301,9 @@ describe("image tool MiniMax VLM routing", () => {
|
||||
// @ts-expect-error partial global
|
||||
global.fetch = fetch;
|
||||
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-minimax-vlm-"));
|
||||
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-minimax-vlm-"));
|
||||
vi.stubEnv("MINIMAX_API_KEY", "minimax-test");
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: { defaults: { model: { primary: "minimax/MiniMax-M2.1" } } },
|
||||
};
|
||||
const tool = createImageTool({ config: cfg, agentDir });
|
||||
|
||||
Reference in New Issue
Block a user