惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
博客园 - 司徒正美
罗磊的独立博客
D
Docker
Last Week in AI
Last Week in AI
爱范儿
爱范儿
M
MIT News - Artificial intelligence
V
V2EX
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
V
Visual Studio Blog
博客园 - 叶小钗
B
Blog RSS Feed
A
About on SuperTechFans
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
P
Proofpoint News Feed

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
Fix Tavily tool SecretRef runtime config · openclaw/openc...
VACInc · 2026-05-07 · via Recent Commits to openclaw:main

@@ -1,5 +1,6 @@

11

import type { OpenClawConfig } from "openclaw/plugin-sdk/config-types";

22

import type { OpenClawPluginApi } from "openclaw/plugin-sdk/plugin-runtime";

3+

import { createTestPluginApi } from "openclaw/plugin-sdk/plugin-test-api";

34

import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

45

import {

56

DEFAULT_TAVILY_BASE_URL,

@@ -33,13 +34,15 @@ describe("tavily tools", () => {

3334

let createTavilySearchTool: typeof import("./tavily-search-tool.js").createTavilySearchTool;

3435

let createTavilyExtractTool: typeof import("./tavily-extract-tool.js").createTavilyExtractTool;

3536

let tavilyClientTesting: typeof import("./tavily-client.js").__testing;

37+

let tavilyPlugin: typeof import("../index.js").default;

36383739

beforeAll(async () => {

3840

({ createTavilyWebSearchProvider } = await import("./tavily-search-provider.js"));

3941

({ createTavilySearchTool } = await import("./tavily-search-tool.js"));

4042

({ createTavilyExtractTool } = await import("./tavily-extract-tool.js"));

4143

({ __testing: tavilyClientTesting } =

4244

await vi.importActual<typeof import("./tavily-client.js")>("./tavily-client.js"));

45+

({ default: tavilyPlugin } = await import("../index.js"));

4346

});

44474548

beforeEach(() => {

@@ -140,6 +143,85 @@ describe("tavily tools", () => {

140143

});

141144

});

142145146+

it("late-binds dedicated tools to the resolved runtime config snapshot", async () => {

147+

const rawConfig = {

148+

plugins: {

149+

entries: {

150+

tavily: {

151+

config: {

152+

webSearch: {

153+

apiKey: { source: "exec", provider: "default", id: "printf resolved-key" },

154+

},

155+

},

156+

},

157+

},

158+

},

159+

} as OpenClawConfig;

160+

const runtimeConfig = {

161+

plugins: {

162+

entries: {

163+

tavily: {

164+

config: {

165+

webSearch: {

166+

apiKey: "resolved-key",

167+

},

168+

},

169+

},

170+

},

171+

},

172+

} as OpenClawConfig;

173+

const registeredTools: Array<Parameters<OpenClawPluginApi["registerTool"]>[0]> = [];

174+

const registeredOptions: Array<Parameters<OpenClawPluginApi["registerTool"]>[1]> = [];

175+

const api = createTestPluginApi({

176+

config: rawConfig,

177+

registerTool(tool, opts) {

178+

registeredTools.push(tool);

179+

registeredOptions.push(opts);

180+

},

181+

});

182+183+

tavilyPlugin.register(api);

184+

const searchFactory = registeredTools.find(

185+

(tool, index) =>

186+

registeredOptions[index]?.name === "tavily_search" && typeof tool === "function",

187+

);

188+

const extractFactory = registeredTools.find(

189+

(tool, index) =>

190+

registeredOptions[index]?.name === "tavily_extract" && typeof tool === "function",

191+

);

192+

if (typeof searchFactory !== "function" || typeof extractFactory !== "function") {

193+

throw new Error("Expected Tavily tools to register as runtime-context factories");

194+

}

195+196+

const searchTool = searchFactory({

197+

config: rawConfig,

198+

runtimeConfig,

199+

});

200+

const extractTool = extractFactory({

201+

config: rawConfig,

202+

getRuntimeConfig: () => runtimeConfig,

203+

});

204+

if (Array.isArray(searchTool) || !searchTool || Array.isArray(extractTool) || !extractTool) {

205+

throw new Error("Expected single Tavily tool definitions");

206+

}

207+208+

await searchTool.execute("search-call", { query: "openclaw" });

209+

await extractTool.execute("extract-call", { urls: ["https://example.com"] });

210+211+

expect(runTavilySearch).toHaveBeenCalledWith(

212+

expect.objectContaining({

213+

cfg: runtimeConfig,

214+

query: "openclaw",

215+

}),

216+

);

217+

expect(runTavilyExtract).toHaveBeenCalledWith(

218+

expect.objectContaining({

219+

cfg: runtimeConfig,

220+

urls: ["https://example.com"],

221+

}),

222+

);

223+

});

224+143225

it("drops empty domain arrays and forwards query-scoped chunking", async () => {

144226

runTavilySearch.mockImplementationOnce(async (params: Record<string, unknown>) => ({

145227

ok: true,