mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-31 03:32:34 +00:00
fix(cli): honor agent for model auth logout (#85326)
This commit is contained in:
committed by
GitHub
parent
4a9138556e
commit
fc47c1f55e
@@ -920,9 +920,10 @@ async function runModelAuthStatus() {
|
||||
return raw ? (JSON.parse(raw) as Record<string, unknown>) : {};
|
||||
}
|
||||
|
||||
async function runModelAuthLogout(provider: string) {
|
||||
async function runModelAuthLogout(provider: string, agent?: string) {
|
||||
const cfg = getRuntimeConfig();
|
||||
const agentDir = resolveAgentDir(cfg, resolveDefaultAgentId(cfg));
|
||||
const agentId = agent?.trim() || resolveDefaultAgentId(cfg);
|
||||
const agentDir = resolveAgentDir(cfg, agentId);
|
||||
const store = loadAuthProfileStoreForRuntime(agentDir);
|
||||
const profileIds = listProfilesForProvider(store, provider);
|
||||
const updated = await updateAuthProfileStoreWithLock({
|
||||
@@ -1882,10 +1883,14 @@ export function registerCapabilityCli(program: Command) {
|
||||
.command("logout")
|
||||
.description("Remove saved auth profiles for one provider")
|
||||
.requiredOption("--provider <id>", "Provider id")
|
||||
.option("--agent <id>", "Agent id (default: configured default agent)")
|
||||
.option("--json", "Output JSON", false)
|
||||
.action(async (opts) => {
|
||||
await runCommandWithRuntime(defaultRuntime, async () => {
|
||||
const result = await runModelAuthLogout(String(opts.provider));
|
||||
const result = await runModelAuthLogout(
|
||||
String(opts.provider),
|
||||
typeof opts.agent === "string" ? opts.agent : undefined,
|
||||
);
|
||||
emitJsonOrText(defaultRuntime, Boolean(opts.json), result, (value) =>
|
||||
JSON.stringify(value, null, 2),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user