mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:10:43 +00:00
refactor: remove legacy agent dir resolver
This commit is contained in:
11
src/plugin-sdk/agent-dir-compat.ts
Normal file
11
src/plugin-sdk/agent-dir-compat.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { resolveDefaultAgentDir } from "../agents/agent-scope-config.js";
|
||||
import { resolveUserPath } from "../utils.js";
|
||||
|
||||
/**
|
||||
* @deprecated Prefer resolveAgentDir(cfg, agentId) or resolveDefaultAgentDir(cfg).
|
||||
* Kept for third-party plugin SDK compatibility.
|
||||
*/
|
||||
export function resolveOpenClawAgentDir(env: NodeJS.ProcessEnv = process.env): string {
|
||||
const override = env.OPENCLAW_AGENT_DIR?.trim() || env.PI_CODING_AGENT_DIR?.trim();
|
||||
return override ? resolveUserPath(override, env) : resolveDefaultAgentDir({}, env);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export {
|
||||
filterToolResultMediaUrls,
|
||||
} from "../agents/pi-embedded-subscribe.tools.js";
|
||||
export { normalizeUsage } from "../agents/usage.js";
|
||||
export { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
export { resolveOpenClawAgentDir } from "./agent-dir-compat.js";
|
||||
export { resolveSessionAgentIds } from "../agents/agent-scope.js";
|
||||
export { resolveModelAuthMode } from "../agents/model-auth.js";
|
||||
export { supportsModelTools } from "../agents/model-tool-support.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Public agent/model/runtime helpers for plugins that integrate with core agent flows.
|
||||
|
||||
export * from "../agents/agent-scope.js";
|
||||
export { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
export { resolveOpenClawAgentDir } from "./agent-dir-compat.js";
|
||||
export * from "../agents/current-time.js";
|
||||
export * from "../agents/date-time.js";
|
||||
export * from "../agents/defaults.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Public auth/onboarding helpers for provider plugins.
|
||||
|
||||
import path from "node:path";
|
||||
import { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
import { resolveDefaultAgentDir } from "../agents/agent-scope-config.js";
|
||||
import { resolveApiKeyForProfile } from "../agents/auth-profiles/oauth.js";
|
||||
import { resolveAuthProfileOrder } from "../agents/auth-profiles/order.js";
|
||||
import { listProfilesForProvider } from "../agents/auth-profiles/profiles.js";
|
||||
@@ -72,7 +72,7 @@ export { createProviderApiKeyAuthMethod } from "../plugins/provider-api-key-auth
|
||||
export { coerceSecretRef, hasConfiguredSecretInput } from "../config/types.secrets.js";
|
||||
export { resolveDefaultSecretProviderAlias } from "../secrets/ref-contract.js";
|
||||
export { resolveRequiredHomeDir } from "../infra/home-dir.js";
|
||||
export { resolveOpenClawAgentDir } from "../agents/agent-paths.js";
|
||||
export { resolveOpenClawAgentDir } from "./agent-dir-compat.js";
|
||||
export {
|
||||
normalizeOptionalSecretInput,
|
||||
normalizeSecretInput,
|
||||
@@ -279,7 +279,7 @@ export function listUsableProviderAuthProfileIds(params: {
|
||||
agentDir?: string;
|
||||
}): { agentDir: string; profileIds: string[] } {
|
||||
try {
|
||||
const agentDir = params.agentDir?.trim() || resolveOpenClawAgentDir();
|
||||
const agentDir = params.agentDir?.trim() || resolveDefaultAgentDir(params.cfg ?? {});
|
||||
const store = ensureAuthProfileStore(agentDir, {
|
||||
allowKeychainPrompt: false,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user