mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-11 01:01:13 +00:00
perf(memory): lazy-load matrix secret config input
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export { resolveConfiguredSecretInputString } from "openclaw/plugin-sdk/config-runtime";
|
||||
@@ -1,15 +1,12 @@
|
||||
import {
|
||||
coerceSecretRef,
|
||||
resolveConfiguredSecretInputString,
|
||||
} from "openclaw/plugin-sdk/config-runtime";
|
||||
import type { PinnedDispatcherPolicy } from "openclaw/plugin-sdk/infra-runtime";
|
||||
import { coerceSecretRef } from "openclaw/plugin-sdk/provider-auth";
|
||||
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
||||
import {
|
||||
requiresExplicitMatrixDefaultAccount,
|
||||
resolveMatrixDefaultOrOnlyAccountId,
|
||||
} from "../../account-selection.js";
|
||||
import { resolveMatrixAccountStringValues } from "../../auth-precedence.js";
|
||||
import { getMatrixScopedEnvVarNames } from "../../env-vars.js";
|
||||
import { normalizeResolvedSecretInputString } from "../../runtime-api.js";
|
||||
import { getMatrixRuntime } from "../../runtime.js";
|
||||
import type { CoreConfig } from "../../types.js";
|
||||
import {
|
||||
@@ -39,8 +36,13 @@ type MatrixCredentialsReadDeps = {
|
||||
credentialsMatchConfig: typeof import("../credentials-read.js").credentialsMatchConfig;
|
||||
};
|
||||
|
||||
type MatrixSecretInputDeps = {
|
||||
resolveConfiguredSecretInputString: typeof import("./config-secret-input.runtime.js").resolveConfiguredSecretInputString;
|
||||
};
|
||||
|
||||
let matrixAuthClientDepsPromise: Promise<MatrixAuthClientDeps> | undefined;
|
||||
let matrixCredentialsReadDepsPromise: Promise<MatrixCredentialsReadDeps> | undefined;
|
||||
let matrixSecretInputDepsPromise: Promise<MatrixSecretInputDeps> | undefined;
|
||||
let matrixAuthClientDepsForTest: MatrixAuthClientDeps | undefined;
|
||||
|
||||
export function setMatrixAuthClientDepsForTest(
|
||||
@@ -77,6 +79,13 @@ async function loadMatrixCredentialsReadDeps(): Promise<MatrixCredentialsReadDep
|
||||
return await matrixCredentialsReadDepsPromise;
|
||||
}
|
||||
|
||||
async function loadMatrixSecretInputDeps(): Promise<MatrixSecretInputDeps> {
|
||||
matrixSecretInputDepsPromise ??= import("./config-secret-input.runtime.js").then((runtime) => ({
|
||||
resolveConfiguredSecretInputString: runtime.resolveConfiguredSecretInputString,
|
||||
}));
|
||||
return await matrixSecretInputDepsPromise;
|
||||
}
|
||||
|
||||
function readEnvSecretRefFallback(params: {
|
||||
value: unknown;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
@@ -273,6 +282,7 @@ async function resolveConfiguredMatrixAuthSecretInput(params: {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { resolveConfiguredSecretInputString } = await loadMatrixSecretInputDeps();
|
||||
const resolved = await resolveConfiguredSecretInputString({
|
||||
config: params.cfg,
|
||||
env: params.env,
|
||||
|
||||
Reference in New Issue
Block a user