refactor(xai): move bundled xai runtime into plugin

Co-authored-by: Harold Hunt <harold@pwrdrvr.com>
This commit is contained in:
Peter Steinberger
2026-03-28 05:01:59 +00:00
parent 85064256a2
commit c4e6fdf94d
25 changed files with 655 additions and 527 deletions

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "../config/config.js";
import { normalizeResolvedSecretInputString } from "../config/types.secrets.js";
import { normalizeSecretInputString, resolveSecretInputRef } from "../config/types.secrets.js";
import { logVerbose } from "../globals.js";
import type {
PluginWebSearchProviderEntry,
@@ -86,12 +86,18 @@ function hasEntryCredential(
const rawValue =
provider.getConfiguredCredentialValue?.(config) ??
provider.getCredentialValue(search as Record<string, unknown> | undefined);
const fromConfig = normalizeSecretInput(
normalizeResolvedSecretInputString({
value: rawValue,
path: provider.credentialPath,
}),
);
const configuredRef = resolveSecretInputRef({
value: rawValue,
}).ref;
if (configuredRef && configuredRef.source !== "env") {
return true;
}
const fromConfig = normalizeSecretInput(normalizeSecretInputString(rawValue));
if (configuredRef?.source === "env") {
return Boolean(
normalizeSecretInput(process.env[configuredRef.id]) || readProviderEnvValue(provider.envVars),
);
}
return Boolean(fromConfig || readProviderEnvValue(provider.envVars));
}