Files
openclaw/src/auto-reply/reply/directive-handling.auth-profile.ts
Vincent Koc 041f0b87ec perf(inbound): trim cold startup import graph (#52082)
* perf(inbound): trim cold startup import graph

* chore(reply): drop redundant inline action type import

* fix(inbound): restore warning and maintenance seams

* fix(reply): restore type seam and secure forked transcripts
2026-03-21 22:32:21 -07:00

28 lines
796 B
TypeScript

import { ensureAuthProfileStore } from "../../agents/auth-profiles.js";
import type { OpenClawConfig } from "../../config/config.js";
export function resolveProfileOverride(params: {
rawProfile?: string;
provider: string;
cfg: OpenClawConfig;
agentDir?: string;
}): { profileId?: string; error?: string } {
const raw = params.rawProfile?.trim();
if (!raw) {
return {};
}
const store = ensureAuthProfileStore(params.agentDir, {
allowKeychainPrompt: false,
});
const profile = store.profiles[raw];
if (!profile) {
return { error: `Auth profile "${raw}" not found.` };
}
if (profile.provider !== params.provider) {
return {
error: `Auth profile "${raw}" is for ${profile.provider}, not ${params.provider}.`,
};
}
return { profileId: raw };
}