refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -10,7 +10,7 @@ import {
import { resolveDefaultAgentWorkspaceDir } from "../../agents/workspace.js";
import { parseDurationMs } from "../../cli/parse-duration.js";
import { formatCliCommand } from "../../cli/command-format.js";
import { readConfigFileSnapshot, type MoltbotConfig } from "../../config/config.js";
import { readConfigFileSnapshot, type OpenClawConfig } from "../../config/config.js";
import { logConfigUpdated } from "../../config/logging.js";
import type { RuntimeEnv } from "../../runtime.js";
import { stylePromptHint, stylePromptMessage } from "../../terminal/prompt-style.js";
@@ -283,7 +283,7 @@ function mergeConfigPatch<T>(base: T, patch: unknown): T {
return next as T;
}
function applyDefaultModel(cfg: MoltbotConfig, model: string): MoltbotConfig {
function applyDefaultModel(cfg: OpenClawConfig, model: string): OpenClawConfig {
const models = { ...cfg.agents?.defaults?.models };
models[model] = models[model] ?? {};
@@ -332,7 +332,7 @@ export async function modelsAuthLoginCommand(opts: LoginOptions, runtime: Runtim
const providers = resolvePluginProviders({ config, workspaceDir });
if (providers.length === 0) {
throw new Error(
`No provider plugins found. Install one via \`${formatCliCommand("moltbot plugins install")}\`.`,
`No provider plugins found. Install one via \`${formatCliCommand("openclaw plugins install")}\`.`,
);
}

View File

@@ -7,14 +7,14 @@ import {
resolveProfileUnusableUntilForDisplay,
} from "../../agents/auth-profiles.js";
import { getCustomProviderApiKey, resolveEnvApiKey } from "../../agents/model-auth.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { shortenHomePath } from "../../utils.js";
import { maskApiKey } from "./list.format.js";
import type { ProviderAuthOverview } from "./list.types.js";
export function resolveProviderAuthOverview(params: {
provider: string;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
store: AuthProfileStore;
modelsPath: string;
}): ProviderAuthOverview {

View File

@@ -4,11 +4,11 @@ import {
resolveConfiguredModelRef,
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { ConfiguredEntry } from "./list.types.js";
import { DEFAULT_MODEL, DEFAULT_PROVIDER, modelKey } from "./shared.js";
export function resolveConfiguredEntries(cfg: MoltbotConfig) {
export function resolveConfiguredEntries(cfg: OpenClawConfig) {
const resolvedDefault = resolveConfiguredModelRef({
cfg,
defaultProvider: DEFAULT_PROVIDER,

View File

@@ -1,7 +1,7 @@
import crypto from "node:crypto";
import fs from "node:fs/promises";
import { resolveMoltbotAgentDir } from "../../agents/agent-paths.js";
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
import {
ensureAuthProfileStore,
listProfilesForProvider,
@@ -15,7 +15,7 @@ import { getCustomProviderApiKey, resolveEnvApiKey } from "../../agents/model-au
import { normalizeProviderId, parseModelRef } from "../../agents/model-selection.js";
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agents/agent-scope.js";
import { resolveDefaultAgentWorkspaceDir } from "../../agents/workspace.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import {
resolveSessionTranscriptPath,
resolveSessionTranscriptsDirForAgent,
@@ -117,7 +117,7 @@ function selectProbeModel(params: {
}
function buildProbeTargets(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
providers: string[];
modelCandidates: string[];
options: AuthProbeOptions;
@@ -260,7 +260,7 @@ function buildProbeTargets(params: {
}
async function probeTarget(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
agentDir: string;
workspaceDir: string;
@@ -335,7 +335,7 @@ async function probeTarget(params: {
}
async function runTargetsWithConcurrency(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
targets: AuthProbeTarget[];
timeoutMs: number;
maxTokens: number;
@@ -346,7 +346,7 @@ async function runTargetsWithConcurrency(params: {
const concurrency = Math.max(1, Math.min(targets.length || 1, params.concurrency));
const agentId = resolveDefaultAgentId(cfg);
const agentDir = resolveMoltbotAgentDir();
const agentDir = resolveOpenClawAgentDir();
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId) ?? resolveDefaultAgentWorkspaceDir();
const sessionDir = resolveSessionTranscriptsDirForAgent(agentId);
@@ -389,7 +389,7 @@ async function runTargetsWithConcurrency(params: {
}
export async function runAuthProbes(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
providers: string[];
modelCandidates: string[];
options: AuthProbeOptions;

View File

@@ -1,7 +1,7 @@
import type { Api, Model } from "@mariozechner/pi-ai";
import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent";
import { resolveMoltbotAgentDir } from "../../agents/agent-paths.js";
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
import { listProfilesForProvider } from "../../agents/auth-profiles.js";
import {
@@ -9,8 +9,8 @@ import {
resolveAwsSdkEnvVarName,
resolveEnvApiKey,
} from "../../agents/model-auth.js";
import { ensureMoltbotModelsJson } from "../../agents/models-config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { ensureOpenClawModelsJson } from "../../agents/models-config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { ModelRow } from "./list.types.js";
import { modelKey } from "./shared.js";
@@ -30,7 +30,7 @@ const isLocalBaseUrl = (baseUrl: string) => {
}
};
const hasAuthForProvider = (provider: string, cfg: MoltbotConfig, authStore: AuthProfileStore) => {
const hasAuthForProvider = (provider: string, cfg: OpenClawConfig, authStore: AuthProfileStore) => {
if (listProfilesForProvider(authStore, provider).length > 0) return true;
if (provider === "amazon-bedrock" && resolveAwsSdkEnvVarName()) return true;
if (resolveEnvApiKey(provider)) return true;
@@ -38,9 +38,9 @@ const hasAuthForProvider = (provider: string, cfg: MoltbotConfig, authStore: Aut
return false;
};
export async function loadModelRegistry(cfg: MoltbotConfig) {
await ensureMoltbotModelsJson(cfg);
const agentDir = resolveMoltbotAgentDir();
export async function loadModelRegistry(cfg: OpenClawConfig) {
await ensureOpenClawModelsJson(cfg);
const agentDir = resolveOpenClawAgentDir();
const authStorage = discoverAuthStorage(agentDir);
const registry = discoverModels(authStorage, agentDir);
const models = registry.getAll() as Model<Api>[];
@@ -55,7 +55,7 @@ export function toModelRow(params: {
tags: string[];
aliases?: string[];
availableKeys?: Set<string>;
cfg?: MoltbotConfig;
cfg?: OpenClawConfig;
authStore?: AuthProfileStore;
}): ModelRow {
const { model, key, tags, aliases = [], availableKeys, cfg, authStore } = params;

View File

@@ -1,5 +1,5 @@
import path from "node:path";
import { resolveMoltbotAgentDir } from "../../agents/agent-paths.js";
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
import {
buildAuthHealthSummary,
DEFAULT_OAUTH_WARN_MS,
@@ -93,7 +93,7 @@ export async function modelsStatusCommand(
);
const allowed = Object.keys(cfg.agents?.defaults?.models ?? {});
const agentDir = resolveMoltbotAgentDir();
const agentDir = resolveOpenClawAgentDir();
const store = ensureAuthProfileStore();
const modelsPath = path.join(agentDir, "models.json");
@@ -487,8 +487,8 @@ export async function modelsStatusCommand(
for (const provider of missingProvidersInUse) {
const hint =
provider === "anthropic"
? `Run \`claude setup-token\`, then \`${formatCliCommand("moltbot models auth setup-token")}\` or \`${formatCliCommand("moltbot configure")}\`.`
: `Run \`${formatCliCommand("moltbot configure")}\` or set an API key env var.`;
? `Run \`claude setup-token\`, then \`${formatCliCommand("openclaw models auth setup-token")}\` or \`${formatCliCommand("openclaw configure")}\`.`
: `Run \`${formatCliCommand("openclaw configure")}\` or set an API key env var.`;
runtime.log(`- ${theme.heading(provider)} ${hint}`);
}
}

View File

@@ -29,7 +29,7 @@ const mocks = vi.hoisted(() => {
return {
store,
resolveMoltbotAgentDir: vi.fn().mockReturnValue("/tmp/moltbot-agent"),
resolveOpenClawAgentDir: vi.fn().mockReturnValue("/tmp/openclaw-agent"),
ensureAuthProfileStore: vi.fn().mockReturnValue(store),
listProfilesForProvider: vi.fn((s: typeof store, provider: string) => {
return Object.entries(s.profiles)
@@ -39,7 +39,7 @@ const mocks = vi.hoisted(() => {
resolveAuthProfileDisplayLabel: vi.fn(({ profileId }: { profileId: string }) => profileId),
resolveAuthStorePathForDisplay: vi
.fn()
.mockReturnValue("/tmp/moltbot-agent/auth-profiles.json"),
.mockReturnValue("/tmp/openclaw-agent/auth-profiles.json"),
resolveEnvApiKey: vi.fn((provider: string) => {
if (provider === "openai") {
return {
@@ -72,7 +72,7 @@ const mocks = vi.hoisted(() => {
});
vi.mock("../../agents/agent-paths.js", () => ({
resolveMoltbotAgentDir: mocks.resolveMoltbotAgentDir,
resolveOpenClawAgentDir: mocks.resolveOpenClawAgentDir,
}));
vi.mock("../../agents/auth-profiles.js", async (importOriginal) => {
@@ -118,7 +118,7 @@ describe("modelsStatusCommand auth overview", () => {
const payload = JSON.parse(String((runtime.log as vi.Mock).mock.calls[0][0]));
expect(payload.defaultModel).toBe("anthropic/claude-opus-4-5");
expect(payload.auth.storePath).toBe("/tmp/moltbot-agent/auth-profiles.json");
expect(payload.auth.storePath).toBe("/tmp/openclaw-agent/auth-profiles.json");
expect(payload.auth.shellEnvFallback.enabled).toBe(true);
expect(payload.auth.shellEnvFallback.appliedKeys).toContain("OPENAI_API_KEY");
expect(payload.auth.missingProvidersInUse).toEqual([]);

View File

@@ -6,7 +6,7 @@ import {
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import {
type MoltbotConfig,
type OpenClawConfig,
readConfigFileSnapshot,
writeConfigFile,
} from "../../config/config.js";
@@ -31,8 +31,8 @@ export const formatMs = (value?: number | null) => {
};
export async function updateConfig(
mutator: (cfg: MoltbotConfig) => MoltbotConfig,
): Promise<MoltbotConfig> {
mutator: (cfg: OpenClawConfig) => OpenClawConfig,
): Promise<OpenClawConfig> {
const snapshot = await readConfigFileSnapshot();
if (!snapshot.valid) {
const issues = snapshot.issues.map((issue) => `- ${issue.path}: ${issue.message}`).join("\n");
@@ -43,7 +43,7 @@ export async function updateConfig(
return next;
}
export function resolveModelTarget(params: { raw: string; cfg: MoltbotConfig }): {
export function resolveModelTarget(params: { raw: string; cfg: OpenClawConfig }): {
provider: string;
model: string;
} {
@@ -62,7 +62,7 @@ export function resolveModelTarget(params: { raw: string; cfg: MoltbotConfig }):
return resolved.ref;
}
export function buildAllowlistSet(cfg: MoltbotConfig): Set<string> {
export function buildAllowlistSet(cfg: OpenClawConfig): Set<string> {
const allowed = new Set<string>();
const models = cfg.agents?.defaults?.models ?? {};
for (const raw of Object.keys(models)) {