Files
openclaw/src/agents/tool-runtime-config.ts
T
VACInc 092bd16b79 fix: resolve Tavily SecretRefs in agent tools (#97827)
* fix(tools): preserve resolved search credentials

Co-authored-by: VACInc <3279061+VACInc@users.noreply.github.com>

Co-authored-by: Karol Zalewski <karol.zalewski@4zal.net>

* test(agents): isolate Tool Search runtime config coverage

* test(agents): isolate Tool Search runtime config coverage

* test(agents): isolate Tool Search runtime config coverage

* test(agents): isolate Tool Search runtime config coverage

* fix(tools): restore reviewed search credential delta

* docs(changelog): defer release-owned entry

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Karol Zalewski <karol.zalewski@4zal.net>
2026-07-15 03:56:12 -07:00

30 lines
923 B
TypeScript

// Selects the resolved runtime snapshot for agent tool surfaces.
import {
getRuntimeConfigSnapshot,
getRuntimeConfigSourceSnapshot,
selectApplicableRuntimeConfig,
} from "../config/config.js";
import type { OpenClawConfig } from "../config/types.openclaw.js";
export function resolveAgentRuntimeToolConfig(
inputConfig?: OpenClawConfig,
): OpenClawConfig | undefined {
const runtimeConfig = getRuntimeConfigSnapshot() ?? undefined;
if (!runtimeConfig) {
return inputConfig;
}
if (!inputConfig || inputConfig === runtimeConfig) {
return runtimeConfig;
}
const runtimeSourceConfig = getRuntimeConfigSourceSnapshot() ?? undefined;
// Without source identity, a process-global snapshot must not replace an explicit run config.
if (!runtimeSourceConfig) {
return inputConfig;
}
return selectApplicableRuntimeConfig({
inputConfig,
runtimeConfig,
runtimeSourceConfig,
});
}