mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 20:34:31 +00:00
refactor(agent): dedupe harness and command workflows
This commit is contained in:
@@ -54,6 +54,21 @@ function appendBaseUrlBit(bits: string[], account: Record<string, unknown>) {
|
||||
}
|
||||
}
|
||||
|
||||
function buildChannelAccountLine(
|
||||
provider: ChatChannel,
|
||||
account: Record<string, unknown>,
|
||||
bits: string[],
|
||||
): string {
|
||||
const accountId = typeof account.accountId === "string" ? account.accountId : "default";
|
||||
const name = typeof account.name === "string" ? account.name.trim() : "";
|
||||
const labelText = formatChannelAccountLabel({
|
||||
channel: provider,
|
||||
accountId,
|
||||
name: name || undefined,
|
||||
});
|
||||
return `- ${labelText}: ${bits.join(", ")}`;
|
||||
}
|
||||
|
||||
export function formatGatewayChannelsStatusLines(payload: Record<string, unknown>): string[] {
|
||||
const lines: string[] = [];
|
||||
lines.push(theme.success("Gateway reachable."));
|
||||
@@ -131,14 +146,7 @@ export function formatGatewayChannelsStatusLines(payload: Record<string, unknown
|
||||
if (typeof account.lastError === "string" && account.lastError) {
|
||||
bits.push(`error:${account.lastError}`);
|
||||
}
|
||||
const accountId = typeof account.accountId === "string" ? account.accountId : "default";
|
||||
const name = typeof account.name === "string" ? account.name.trim() : "";
|
||||
const labelText = formatChannelAccountLabel({
|
||||
channel: provider,
|
||||
accountId,
|
||||
name: name || undefined,
|
||||
});
|
||||
return `- ${labelText}: ${bits.join(", ")}`;
|
||||
return buildChannelAccountLine(provider, account, bits);
|
||||
});
|
||||
|
||||
const plugins = listChannelPlugins();
|
||||
@@ -199,14 +207,7 @@ async function formatConfigChannelsStatusLines(
|
||||
appendModeBit(bits, account);
|
||||
appendTokenSourceBits(bits, account);
|
||||
appendBaseUrlBit(bits, account);
|
||||
const accountId = typeof account.accountId === "string" ? account.accountId : "default";
|
||||
const name = typeof account.name === "string" ? account.name.trim() : "";
|
||||
const labelText = formatChannelAccountLabel({
|
||||
channel: provider,
|
||||
accountId,
|
||||
name: name || undefined,
|
||||
});
|
||||
return `- ${labelText}: ${bits.join(", ")}`;
|
||||
return buildChannelAccountLine(provider, account, bits);
|
||||
});
|
||||
|
||||
const plugins = listChannelPlugins();
|
||||
|
||||
Reference in New Issue
Block a user