fix: pass active agent to web search execution · openclaw/openclaw@3b21a3f
fuller-stack
·
2026-05-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -383,6 +383,36 @@ describe("web search runtime", () => {
|
383 | 383 | }); |
384 | 384 | }); |
385 | 385 | |
| 386 | +it("passes the active agentDir into selected provider tools", async () => { |
| 387 | +const activeAgentDir = mkdtempSync(path.join(os.tmpdir(), "openclaw-web-search-tool-agent-")); |
| 388 | +tempDirs.push(activeAgentDir); |
| 389 | +const provider = createCustomSearchProvider({ |
| 390 | +credentialPath: "", |
| 391 | +requiresCredential: false, |
| 392 | +createTool: ({ agentDir }) => ({ |
| 393 | +description: "custom", |
| 394 | +parameters: {}, |
| 395 | +execute: async (args) => ({ |
| 396 | + ...args, |
| 397 | + agentDir, |
| 398 | +}), |
| 399 | +}), |
| 400 | +}); |
| 401 | +resolveRuntimeWebSearchProvidersMock.mockReturnValue([provider]); |
| 402 | +resolvePluginWebSearchProvidersMock.mockReturnValue([provider]); |
| 403 | + |
| 404 | +await expect( |
| 405 | +runWebSearch({ |
| 406 | +agentDir: activeAgentDir, |
| 407 | +config: {}, |
| 408 | +args: { query: "active-agent tool context" }, |
| 409 | +}), |
| 410 | +).resolves.toEqual({ |
| 411 | +provider: "custom", |
| 412 | +result: { query: "active-agent tool context", agentDir: activeAgentDir }, |
| 413 | +}); |
| 414 | +}); |
| 415 | + |
386 | 416 | it("uses the active resolved runtime config for matching source config callers", async () => { |
387 | 417 | const provider = createCustomSearchProvider({ |
388 | 418 | createTool: ({ config }) => ({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -456,6 +456,7 @@ export async function runWebSearch(params: RunWebSearchParams): Promise<RunWebSe
|
456 | 456 | try { |
457 | 457 | const definition = candidate.createTool({ |
458 | 458 | config, |
| 459 | +agentDir: params.agentDir, |
459 | 460 | searchConfig: search as Record<string, unknown> | undefined, |
460 | 461 | runtimeMetadata: runtimeWebSearch, |
461 | 462 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。