mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:40:43 +00:00
refactor: remove legacy agent dir resolver
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
import {
|
||||
resolveDefaultAgentId,
|
||||
resolveAgentDir,
|
||||
@@ -221,12 +220,7 @@ export async function runProviderPluginAuthMethod(params: {
|
||||
opts?: Partial<ProviderAuthOptionBag>;
|
||||
}): Promise<{ config: OpenClawConfig; defaultModel?: string }> {
|
||||
const agentId = params.agentId ?? resolveDefaultAgentId(params.config);
|
||||
const defaultAgentId = resolveDefaultAgentId(params.config);
|
||||
const agentDir =
|
||||
params.agentDir ??
|
||||
(agentId === defaultAgentId
|
||||
? resolveOpenClawAgentDir()
|
||||
: resolveAgentDir(params.config, agentId));
|
||||
const agentDir = params.agentDir ?? resolveAgentDir(params.config, agentId);
|
||||
const workspaceDir =
|
||||
params.workspaceDir ??
|
||||
resolveAgentWorkspaceDir(params.config, agentId) ??
|
||||
@@ -469,10 +463,7 @@ export async function applyAuthChoicePluginProvider(
|
||||
}
|
||||
|
||||
const agentId = params.agentId ?? resolveDefaultAgentId(nextConfig);
|
||||
const defaultAgentId = resolveDefaultAgentId(nextConfig);
|
||||
const agentDir =
|
||||
params.agentDir ??
|
||||
(agentId === defaultAgentId ? resolveOpenClawAgentDir() : resolveAgentDir(nextConfig, agentId));
|
||||
const agentDir = params.agentDir ?? resolveAgentDir(nextConfig, agentId);
|
||||
const workspaceDir =
|
||||
resolveAgentWorkspaceDir(nextConfig, agentId) ?? resolveDefaultAgentWorkspaceDir();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import type { OAuthCredentials } from "@mariozechner/pi-ai";
|
||||
import { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
import { resolveDefaultAgentDir } from "../agents/agent-scope-config.js";
|
||||
import { buildAuthProfileId } from "../agents/auth-profiles/identity.js";
|
||||
import { upsertAuthProfile } from "../agents/auth-profiles/profiles.js";
|
||||
import { resolveProviderIdForAuth } from "../agents/provider-auth-aliases.js";
|
||||
@@ -19,7 +19,8 @@ import type { SecretInputMode } from "./provider-auth-types.js";
|
||||
|
||||
const ENV_REF_PATTERN = /^\$\{([A-Z][A-Z0-9_]*)\}$/;
|
||||
|
||||
const resolveAuthAgentDir = (agentDir?: string) => agentDir ?? resolveOpenClawAgentDir();
|
||||
const resolveAuthAgentDir = (agentDir?: string, config?: OpenClawConfig) =>
|
||||
agentDir ?? resolveDefaultAgentDir(config ?? {});
|
||||
|
||||
export type ApiKeyStorageOptions = {
|
||||
secretInputMode?: SecretInputMode;
|
||||
@@ -127,7 +128,7 @@ export function upsertApiKeyProfile(params: {
|
||||
params.metadata,
|
||||
params.options,
|
||||
),
|
||||
agentDir: resolveAuthAgentDir(params.agentDir),
|
||||
agentDir: resolveAuthAgentDir(params.agentDir, params.options?.config),
|
||||
});
|
||||
return profileId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user