mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:11:22 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import {
|
||||
resolveAgentConfig,
|
||||
resolveAgentModelFallbacksOverride,
|
||||
@@ -8,15 +8,15 @@ import {
|
||||
|
||||
describe("resolveAgentConfig", () => {
|
||||
it("should return undefined when no agents config exists", () => {
|
||||
const cfg: MoltbotConfig = {};
|
||||
const cfg: OpenClawConfig = {};
|
||||
const result = resolveAgentConfig(cfg, "main");
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should return undefined when agent id does not exist", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [{ id: "main", workspace: "~/clawd" }],
|
||||
list: [{ id: "main", workspace: "~/openclaw" }],
|
||||
},
|
||||
};
|
||||
const result = resolveAgentConfig(cfg, "nonexistent");
|
||||
@@ -24,14 +24,14 @@ describe("resolveAgentConfig", () => {
|
||||
});
|
||||
|
||||
it("should return basic agent config", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
id: "main",
|
||||
name: "Main Agent",
|
||||
workspace: "~/clawd",
|
||||
agentDir: "~/.clawdbot/agents/main",
|
||||
workspace: "~/openclaw",
|
||||
agentDir: "~/.openclaw/agents/main",
|
||||
model: "anthropic/claude-opus-4",
|
||||
},
|
||||
],
|
||||
@@ -40,8 +40,8 @@ describe("resolveAgentConfig", () => {
|
||||
const result = resolveAgentConfig(cfg, "main");
|
||||
expect(result).toEqual({
|
||||
name: "Main Agent",
|
||||
workspace: "~/clawd",
|
||||
agentDir: "~/.clawdbot/agents/main",
|
||||
workspace: "~/openclaw",
|
||||
agentDir: "~/.openclaw/agents/main",
|
||||
model: "anthropic/claude-opus-4",
|
||||
identity: undefined,
|
||||
groupChat: undefined,
|
||||
@@ -52,7 +52,7 @@ describe("resolveAgentConfig", () => {
|
||||
});
|
||||
|
||||
it("supports per-agent model primary+fallbacks", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
defaults: {
|
||||
model: {
|
||||
@@ -76,7 +76,7 @@ describe("resolveAgentConfig", () => {
|
||||
expect(resolveAgentModelFallbacksOverride(cfg, "linus")).toEqual(["openai/gpt-5.2"]);
|
||||
|
||||
// If fallbacks isn't present, we don't override the global fallbacks.
|
||||
const cfgNoOverride: MoltbotConfig = {
|
||||
const cfgNoOverride: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
@@ -91,7 +91,7 @@ describe("resolveAgentConfig", () => {
|
||||
expect(resolveAgentModelFallbacksOverride(cfgNoOverride, "linus")).toBe(undefined);
|
||||
|
||||
// Explicit empty list disables global fallbacks for that agent.
|
||||
const cfgDisable: MoltbotConfig = {
|
||||
const cfgDisable: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
@@ -108,12 +108,12 @@ describe("resolveAgentConfig", () => {
|
||||
});
|
||||
|
||||
it("should return agent-specific sandbox config", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
id: "work",
|
||||
workspace: "~/clawd-work",
|
||||
workspace: "~/openclaw-work",
|
||||
sandbox: {
|
||||
mode: "all",
|
||||
scope: "agent",
|
||||
@@ -136,12 +136,12 @@ describe("resolveAgentConfig", () => {
|
||||
});
|
||||
|
||||
it("should return agent-specific tools config", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
id: "restricted",
|
||||
workspace: "~/clawd-restricted",
|
||||
workspace: "~/openclaw-restricted",
|
||||
tools: {
|
||||
allow: ["read"],
|
||||
deny: ["exec", "write", "edit"],
|
||||
@@ -166,12 +166,12 @@ describe("resolveAgentConfig", () => {
|
||||
});
|
||||
|
||||
it("should return both sandbox and tools config", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [
|
||||
{
|
||||
id: "family",
|
||||
workspace: "~/clawd-family",
|
||||
workspace: "~/openclaw-family",
|
||||
sandbox: {
|
||||
mode: "all",
|
||||
scope: "agent",
|
||||
@@ -190,14 +190,14 @@ describe("resolveAgentConfig", () => {
|
||||
});
|
||||
|
||||
it("should normalize agent id", () => {
|
||||
const cfg: MoltbotConfig = {
|
||||
const cfg: OpenClawConfig = {
|
||||
agents: {
|
||||
list: [{ id: "main", workspace: "~/clawd" }],
|
||||
list: [{ id: "main", workspace: "~/openclaw" }],
|
||||
},
|
||||
};
|
||||
// Should normalize to "main" (default)
|
||||
const result = resolveAgentConfig(cfg, "");
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.workspace).toBe("~/clawd");
|
||||
expect(result?.workspace).toBe("~/openclaw");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user