mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:08:27 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
loadAgentIdentityFromWorkspace,
|
||||
parseIdentityMarkdown as parseIdentityMarkdownFile,
|
||||
} from "../agents/identity-file.js";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import { normalizeAgentId } from "../routing/session-key.js";
|
||||
|
||||
export type AgentSummary = {
|
||||
@@ -28,11 +28,11 @@ export type AgentSummary = {
|
||||
isDefault: boolean;
|
||||
};
|
||||
|
||||
type AgentEntry = NonNullable<NonNullable<ClawdbotConfig["agents"]>["list"]>[number];
|
||||
type AgentEntry = NonNullable<NonNullable<MoltbotConfig["agents"]>["list"]>[number];
|
||||
|
||||
export type AgentIdentity = AgentIdentityFile;
|
||||
|
||||
export function listAgentEntries(cfg: ClawdbotConfig): AgentEntry[] {
|
||||
export function listAgentEntries(cfg: MoltbotConfig): AgentEntry[] {
|
||||
const list = cfg.agents?.list;
|
||||
if (!Array.isArray(list)) return [];
|
||||
return list.filter((entry): entry is AgentEntry => Boolean(entry && typeof entry === "object"));
|
||||
@@ -43,14 +43,14 @@ export function findAgentEntryIndex(list: AgentEntry[], agentId: string): number
|
||||
return list.findIndex((entry) => normalizeAgentId(entry.id) === id);
|
||||
}
|
||||
|
||||
function resolveAgentName(cfg: ClawdbotConfig, agentId: string) {
|
||||
function resolveAgentName(cfg: MoltbotConfig, agentId: string) {
|
||||
const entry = listAgentEntries(cfg).find(
|
||||
(agent) => normalizeAgentId(agent.id) === normalizeAgentId(agentId),
|
||||
);
|
||||
return entry?.name?.trim() || undefined;
|
||||
}
|
||||
|
||||
function resolveAgentModel(cfg: ClawdbotConfig, agentId: string) {
|
||||
function resolveAgentModel(cfg: MoltbotConfig, agentId: string) {
|
||||
const entry = listAgentEntries(cfg).find(
|
||||
(agent) => normalizeAgentId(agent.id) === normalizeAgentId(agentId),
|
||||
);
|
||||
@@ -78,7 +78,7 @@ export function loadAgentIdentity(workspace: string): AgentIdentity | null {
|
||||
return identityHasValues(parsed) ? parsed : null;
|
||||
}
|
||||
|
||||
export function buildAgentSummaries(cfg: ClawdbotConfig): AgentSummary[] {
|
||||
export function buildAgentSummaries(cfg: MoltbotConfig): AgentSummary[] {
|
||||
const defaultAgentId = normalizeAgentId(resolveDefaultAgentId(cfg));
|
||||
const configuredAgents = listAgentEntries(cfg);
|
||||
const orderedIds =
|
||||
@@ -122,7 +122,7 @@ export function buildAgentSummaries(cfg: ClawdbotConfig): AgentSummary[] {
|
||||
}
|
||||
|
||||
export function applyAgentConfig(
|
||||
cfg: ClawdbotConfig,
|
||||
cfg: MoltbotConfig,
|
||||
params: {
|
||||
agentId: string;
|
||||
name?: string;
|
||||
@@ -130,7 +130,7 @@ export function applyAgentConfig(
|
||||
agentDir?: string;
|
||||
model?: string;
|
||||
},
|
||||
): ClawdbotConfig {
|
||||
): MoltbotConfig {
|
||||
const agentId = normalizeAgentId(params.agentId);
|
||||
const name = params.name?.trim();
|
||||
const list = listAgentEntries(cfg);
|
||||
@@ -162,10 +162,10 @@ export function applyAgentConfig(
|
||||
}
|
||||
|
||||
export function pruneAgentConfig(
|
||||
cfg: ClawdbotConfig,
|
||||
cfg: MoltbotConfig,
|
||||
agentId: string,
|
||||
): {
|
||||
config: ClawdbotConfig;
|
||||
config: MoltbotConfig;
|
||||
removedBindings: number;
|
||||
removedAllow: number;
|
||||
} {
|
||||
|
||||
Reference in New Issue
Block a user