mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 02:00:26 +00:00
refactor: dedupe gateway agent trimmed readers
This commit is contained in:
@@ -20,6 +20,7 @@ import { inspectReadOnlyChannelAccount } from "../../channels/read-only-account-
|
||||
import type { OpenClawConfig } from "../../config/config.js";
|
||||
import { sha256HexPrefix } from "../../logging/redact-identifier.js";
|
||||
import { asRecord } from "../../shared/record-coerce.js";
|
||||
import { normalizeOptionalString } from "../../shared/string-coerce.js";
|
||||
import { formatTimeAgo } from "./format.js";
|
||||
|
||||
export type ChannelRow = {
|
||||
@@ -62,7 +63,7 @@ function summarizeSources(sources: Array<string | undefined>): {
|
||||
}
|
||||
|
||||
function existsSyncMaybe(p: string | undefined): boolean | null {
|
||||
const path = p?.trim() || "";
|
||||
const path = normalizeOptionalString(p) ?? "";
|
||||
if (!path) {
|
||||
return null;
|
||||
}
|
||||
@@ -355,14 +356,14 @@ function summarizeTokenConfig(params: {
|
||||
const unavailable = enabled.filter((a) => hasConfiguredUnavailableCredentialStatus(a.account));
|
||||
const ready = enabled.filter((a) => {
|
||||
const rec = asRecord(a.account);
|
||||
const bot = typeof rec.botToken === "string" ? rec.botToken.trim() : "";
|
||||
const app = typeof rec.appToken === "string" ? rec.appToken.trim() : "";
|
||||
const bot = normalizeOptionalString(rec.botToken) ?? "";
|
||||
const app = normalizeOptionalString(rec.appToken) ?? "";
|
||||
return Boolean(bot) && Boolean(app);
|
||||
});
|
||||
const partial = enabled.filter((a) => {
|
||||
const rec = asRecord(a.account);
|
||||
const bot = typeof rec.botToken === "string" ? rec.botToken.trim() : "";
|
||||
const app = typeof rec.appToken === "string" ? rec.appToken.trim() : "";
|
||||
const bot = normalizeOptionalString(rec.botToken) ?? "";
|
||||
const app = normalizeOptionalString(rec.appToken) ?? "";
|
||||
const hasBot = Boolean(bot);
|
||||
const hasApp = Boolean(app);
|
||||
return (hasBot && !hasApp) || (!hasBot && hasApp);
|
||||
@@ -410,7 +411,7 @@ function summarizeTokenConfig(params: {
|
||||
const unavailable = enabled.filter((a) => hasConfiguredUnavailableCredentialStatus(a.account));
|
||||
const ready = enabled.filter((a) => {
|
||||
const rec = asRecord(a.account);
|
||||
const bot = typeof rec.botToken === "string" ? rec.botToken.trim() : "";
|
||||
const bot = normalizeOptionalString(rec.botToken) ?? "";
|
||||
return Boolean(bot);
|
||||
});
|
||||
|
||||
@@ -441,7 +442,7 @@ function summarizeTokenConfig(params: {
|
||||
const unavailable = enabled.filter((a) => hasConfiguredUnavailableCredentialStatus(a.account));
|
||||
const ready = enabled.filter((a) => {
|
||||
const rec = asRecord(a.account);
|
||||
return typeof rec.token === "string" ? Boolean(rec.token.trim()) : false;
|
||||
return Boolean(normalizeOptionalString(rec.token));
|
||||
});
|
||||
if (unavailable.length > 0) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user