

























@@ -1,3 +1,7 @@
1+/**
2+ * Activates and injects OpenAI/Codex native web-search tools when config,
3+ * model API, and auth state allow it.
4+ */
15import type { OpenClawConfig } from "../config/types.openclaw.js";
26import { isRecord } from "../utils.js";
37import { externalCliDiscoveryForProviderAuth } from "./auth-profiles/external-cli-discovery.js";
@@ -32,6 +36,7 @@ function isOpenAIAuthProviderId(provider: string | undefined): boolean {
3236return OPENAI_AUTH_PROVIDER_IDS.some((candidate) => candidate === provider);
3337}
343839+/** Returns whether a model API can accept the native Codex web_search tool. */
3540export function isCodexNativeSearchEligibleModel(params: {
3641modelProvider?: string;
3742modelApi?: string;
@@ -48,6 +53,7 @@ function hasCodexNativeWebSearchTool(tools: unknown): boolean {
4853);
4954}
505556+/** Checks whether OpenAI/Codex auth is available for native web search. */
5157export function hasAvailableCodexAuth(params: {
5258config?: OpenClawConfig;
5359agentDir?: string;
@@ -85,6 +91,7 @@ export function hasAvailableCodexAuth(params: {
8591return false;
8692}
879394+/** Resolves whether native search is active or why managed search should remain. */
8895export function resolveCodexNativeSearchActivation(params: {
8996config?: OpenClawConfig;
9097modelProvider?: string;
@@ -157,6 +164,7 @@ export function resolveCodexNativeSearchActivation(params: {
157164};
158165}
159166167+/** Builds the OpenAI Responses `web_search` tool payload from config. */
160168export function buildCodexNativeWebSearchTool(
161169config: OpenClawConfig | undefined,
162170): Record<string, unknown> {
@@ -186,6 +194,7 @@ export function buildCodexNativeWebSearchTool(
186194return tool;
187195}
188196197+/** Injects a native Codex web-search tool into a mutable provider payload. */
189198export function patchCodexNativeWebSearchPayload(params: {
190199payload: unknown;
191200config?: OpenClawConfig;
@@ -205,6 +214,7 @@ export function patchCodexNativeWebSearchPayload(params: {
205214return { status: "injected" };
206215}
207216217+/** Returns whether the managed OpenClaw web-search tool should be hidden. */
208218export function shouldSuppressManagedWebSearchTool(params: {
209219config?: OpenClawConfig;
210220modelProvider?: string;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。