Skip to content

[Feature] refactor and harden search browser tooling#864

Merged
dingyi222666 merged 7 commits into
v1-devfrom
feat/new-search-service
May 18, 2026
Merged

[Feature] refactor and harden search browser tooling#864
dingyi222666 merged 7 commits into
v1-devfrom
feat/new-search-service

Conversation

@dingyi222666
Copy link
Copy Markdown
Member

@dingyi222666 dingyi222666 commented May 16, 2026

This pr refactors the search service browser tooling into reusable browser manager and tool modules, while updating search configuration, agent integration, and browser tool safety for the new search flow.

New Features

  • Add dedicated browser manager and browser tools for page navigation, content extraction, summarization, screenshots, HTML retrieval, and structured URL extraction.
  • Add configurable search service options for browser behavior and search strategy.
  • Allow browser screenshots to be saved through ChatLuna agent computer sessions when the agent extension is available.

Bug fixes

  • Improve search result document creation so quality and balanced modes can fetch page content consistently.
  • Continue search and browsing workflows when individual result fetches fail instead of failing the whole batch.
  • Normalize parsed search actions with a shared parser that can recover malformed JSON or skip markers.
  • Harden browser screenshot and upload file paths to avoid unsafe writes or arbitrary uploads.
  • Clean up newly created browser pages when navigation fails and restore the previous selected page.
  • Filter same-page hash links while preserving meaningful cross-page links with hashes.
  • Normalize screenshot output file names and extensions based on the requested screenshot format.
  • Disable browser evaluate by default and tighten browser debug tool availability.
  • Make browser summarization read full page text directly without max-length truncation.
  • Require an available model before running browser summarization.
  • Always release keyboard modifier keys after browser key press actions fail or complete.
  • Improve Bing API response typing and result handling.

Other Changes

  • Replace the old monolithic Puppeteer browser tool with modular browser manager/tools implementation.
  • Update browsing chain, search plugin wiring, provider registration, and locale schema entries for the new search service flow.
  • Update agent sub-agent defaults and skill guidance for search-related behavior.
  • Bump package alpha versions for the current branch.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Review Change Stack

Warning

Rate limit exceeded

@dingyi222666 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 14 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e1c34301-9591-4dd7-810d-60816a32b122

📥 Commits

Reviewing files that changed from the base of the PR and between 708ddf8 and 6dc25b4.

📒 Files selected for processing (1)
  • packages/service-search/src/tools/browser/tools.ts

Walkthrough

引入 PlatformService 构造注入;用 BrowserManager + 细粒度 browser_* 工具替代旧 PuppeteerBrowserTool,重构搜索链、工具注册、配置与搜索动作解析以适配新浏览器体系。

Changes

平台服务构造注入

Layer / File(s) Summary
类型契约与适配器更新
packages/adapter-zhipu/src/types.ts
ChatCompletionTool.type 字面量移除 web_browser,新增 code_interpreter
ConversationService 依赖注入
packages/core/src/services/conversation.ts
构造函数新增 PlatformService 参数,内部对 platform 能力的调用由 ctx.chatluna.platform -> this.platform。
服务构造与测试帮助更新
packages/core/src/services/chat.ts, packages/core/tests/helpers.ts
ChatLunaService 与测试 helper 在构造 ConversationService 时传入 platform 实例以匹配新签名。

浏览器工具系统重构

Layer / File(s) Summary
BrowserManager 核心实现
packages/service-search/src/tools/browser/manager.ts
新增 BrowserManager/BrowserPage/会话管理与内容抽取、summarize/readText/getHtml/getLinks、snapshot/getElement、formatOutput 与空闲会话清理等实现与导出类型。
浏览器工具集合与工具注册
packages/service-search/src/tools/browser/tools.ts
新增 registerBrowserTools 并注册一组 browser_* StructuredTool(打开/导航/读取/摘要/快照/截图/交互/上传/执行/诊断等),每工具带 zod schema 并调用 BrowserManager。

搜索服务集成与工具适配

Layer / File(s) Summary
搜索配置完整定义
packages/service-search/src/config.ts
新增并导出完整的 Config 接口与 Schema,包括搜索/摘要/压缩/浏览器超时等字段与多语言提示模板。
搜索服务主模块与工作流程
packages/service-search/src/index.ts, packages/service-search/src/plugin.ts
apply() 中实例化 BrowserManager、调用 registerBrowserTools,并把 browserManager 传入 browsing 链;index.ts 不再内联 Config 并改写 inject 结构;plugin 的 Context 导入来源调整。
搜索浏览链重构
packages/service-search/src/chain/browsing_chain.ts
ChatLunaBrowsingChain 引入 browserManager,拆分搜索/浏览/上下文拼接逻辑,使用 parseSearchAction 与 raceAbort 并按 action 分流。
SearchTool 与提供者适配
packages/service-search/src/tools/search.ts, packages/service-search/src/providers/bing_api.ts
SearchTool 切换为依赖 BrowserManager,readResult/文档 chunk 化/重排逻辑重构;Bing provider 的请求参数与响应解析优化。
搜索动作解析与 JSON 工具
packages/service-search/src/utils/parse.ts
泛型化 tryParseJSON 并新增 parseSearchAction,用于解析或修复用户提交的搜索动作指令。
搜索提供与聚合优化
packages/service-search/src/provide.ts
多源聚合逻辑:空提供者时立即返回、average 模式下 signalLimit 强制下界为 1、重排触发基于聚合结果数量。

文档与扩展配置更新

Layer / File(s) Summary
子代理技能文档
packages/extension-agent/resources/skills/sub-agent-creator/SKILL.md
文档中将 web_browser 示例替换为更细粒度的 browser_* 工具示例并更新权限示例。
代理权限映射更新
packages/extension-agent/src/sub-agent/parse.ts
applyOpencodeFrontmatter 与 mapCompatToolName 的 webfetch 映射改为返回 web_search 与一组 browser_* 工具名。
扩展代理工具元数据注册
packages/extension-agent/src/config/defaults.ts
在默认工具 registry 中添加并配置多项 browser_* 工具的元数据(group/tags/defaultAvailability 等)。

Sequence Diagram

sequenceDiagram
  participant Client
  participant ChatLunaBrowsingChain
  participant BrowserManager
  participant PuppeteerPage
  participant ChatLunaChatModel

  Client->>ChatLunaBrowsingChain: 提交搜索请求/问题
  ChatLunaBrowsingChain->>BrowserManager: 请求 readText / summarize 或调度 web_search
  BrowserManager->>PuppeteerPage: 打开/导航/执行 DOM 抽取
  PuppeteerPage-->>BrowserManager: 返回文本/HTML/链接/快照
  BrowserManager->>ChatLunaChatModel: 若需要摘要,构造提示并调用模型.invoke
  ChatLunaChatModel-->>BrowserManager: 返回摘要文本
  BrowserManager-->>ChatLunaBrowsingChain: 返回读取/摘要结果
  ChatLunaBrowsingChain-->>Client: 追加上下文并继续对话流程
Loading

🎯 4 (Complex) | ⏱️ ~60 minutes

可能相关的 PR:

  • ChatLunaLab/chatluna#562: 与本次对 web_search 与浏览器/摘要模型引用与 wiring 修正相关联,涉及浏览/搜索子系统的接入调整。

🐰 旧工具谢幕风拂面,BrowserManager 新芽冒;
细粒度工具列队行,页与会话井然畅;
平台注入静默移,调用处上换新;
搜索链中逻辑新,兔儿挥笔庆良辰。

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.85% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地反映了本次PR的主要变化:搜索浏览工具的重构和加固,涵盖了核心功能改进和新增的浏览器管理器模块。
Description check ✅ Passed 描述详尽地说明了PR的目标、新功能、bug修复和其他改动,与代码变更内容密切相关,涵盖浏览器管理器、搜索服务配置、代理集成和工具安全性等方面。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/new-search-service

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request replaces the legacy web_browser tool with a comprehensive BrowserManager and a suite of granular browser_* tools, updating the Sydney preset, agent skills, and browsing chain accordingly. The review feedback highlights several critical concerns: the use of Promise.all in search operations could cause total failure if a single URL fails; security vulnerabilities exist where the LLM can specify arbitrary file paths for screenshots or uploads; potential infinite loops and resource leaks were identified in browser page management and file storage; and the use of locale-dependent date strings in prompts may lead to inconsistent behavior.

Comment thread packages/service-search/src/tools/search.ts Outdated
Comment thread packages/service-search/src/tools/browser/tools.ts Outdated
Comment thread packages/service-search/src/tools/browser/tools.ts
Comment thread packages/service-search/src/tools/browser/manager.ts
Comment thread packages/service-search/src/tools/browser/manager.ts
Comment thread packages/service-search/src/chain/browsing_chain.ts Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3bbec08d37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/service-search/src/tools/search.ts Outdated
Comment thread packages/service-search/src/tools/browser/tools.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/extension-agent/resources/skills/sub-agent-creator/SKILL.md`:
- Around line 39-40: 在“Web research agents” 的默认工具列表中补入缺失的 browser_open,使默认集合包含
browser_open、web_search、browser_read_text 和 browser_summarize;打开 SKILL.md 中“Web
research agents”相关段落并在列举 web_search、browser_read_text、browser_summarize 的同一条目中新增
browser_open(保持与其它工具名称相同的格式和标点),以确保示例配置能先打开页面再执行后续浏览与摘要步骤。

In `@packages/service-search/src/chain/browsing_chain.ts`:
- Around line 398-422: The current use of Promise.all inside raceAbort causes a
fail-fast behavior that discards all results if any question/tool.invoke
rejects; update the block that builds results (the Promise.all over questions
invoking tool.invoke in browsing_chain.ts) to use Promise.allSettled instead,
then extract only the fulfilled values, JSON.parse each fulfilled value into
SearchResultLike[], and merge/return those while skipping rejected entries
(optionally logging or session.send errors); apply the same change to the
similar block around the 441-461 range so failures for individual questions/URLs
don't wipe out all results.
- Line 518: Summary: Fix grammatical errors in the system prompt string that
uses "your's". Locate the prompt string in browsing_chain.ts (the system prompt
/ message text used in the browsing chain) and replace the incorrect "your's"
occurrences with the correct possessive "your" and remove the extra "the" so the
sentence reads clearly (e.g., "OK. I understand. I will respond to your question
using the same language as your input. What's your question?"). Ensure both
instances in that string are updated and run a quick lint or test to verify no
other prompt formatting was altered.
- Around line 557-566: The raceAbort function doesn't immediately reject when
the provided AbortSignal is already aborted; update raceAbort to first check
signal?.aborted and synchronously reject with new
ChatLunaError(ChatLunaErrorCode.ABORTED) if true, otherwise attach the 'abort'
listener as before and ensure the listener is removed in the finally block;
reference the raceAbort function and the AbortSignal usage
(signal?.addEventListener, signal?.removeEventListener) so the change is applied
in that function.

In `@packages/service-search/src/tools/browser/manager.ts`:
- Around line 359-366: The cloned snapshot nodes lose prototype methods (like
elementHandle) because assignSnapshotIds uses Object.assign({}, raw, ...) which
copies only own properties; update assignSnapshotIds to preserve the original
prototype when cloning nodes—e.g. create the clone with
Object.create(Object.getPrototypeOf(raw)) and then Object.assign(clone, raw, {
uid: ... }) or explicitly bind/copy the elementHandle method
(clone.elementHandle = raw.elementHandle.bind(raw)); ensure this change
preserves elementHandle so getElement, browser_click, browser_fill,
browser_upload_file, etc. can call node.elementHandle() successfully.

In `@packages/service-search/src/tools/browser/tools.ts`:
- Around line 209-230: The schema declares url is required for action 'url' but
doesn't enforce it; update the zod schema (the schema built from pageIdSchema)
to conditionally require url when action === 'url' (e.g., use
z.discriminatedUnion or .refine/when on action to enforce url presence), and add
a runtime guard in the _call method to throw a clear error if input.action ===
'url' and !input.url before calling BrowserManager.navigate so invalid input is
rejected at the tool boundary.
- Around line 396-416: The uid branch acquires an element handle via
this.manager.getElement but never releases it, causing remote handle leaks;
modify the screenshot flow around getElement/target.screenshot to mirror other
tools by using a try/finally: obtain page via this.manager.getPage, if input.uid
call this.manager.getElement and store the handle in a local (e.g.
targetHandle), use it for targetHandle.screenshot, and in the finally block
release the handle (either await targetHandle.dispose() or call the manager's
release method if one exists) only when a handle was created (i.e. when target
is not the page.page) so long-running sessions don't accumulate element handles.

In `@packages/service-search/src/tools/search.ts`:
- Around line 83-90: The current Promise.all over results calling
this.createDocuments(result, query, llm, runConfig) will reject the whole batch
if any single browser/read call throws; replace the all-or-nothing behavior by
making each call resilient — either use Promise.allSettled and keep only
fulfilled values (flattening their arrays) or wrap each invocation in a
try/catch that returns an empty array or a fallback descriptive document on
error; apply the same defensive change to the other bulk call in this file that
follows the same pattern so single-page read failures are skipped instead of
failing the entire retrieval.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 319f96a1-2b8a-4cb8-9223-02ac7fb92446

📥 Commits

Reviewing files that changed from the base of the PR and between e70df1d and 3bbec08.

⛔ Files ignored due to path filters (3)
  • packages/core/resources/presets/sydney.yml is excluded by !**/*.yml
  • packages/service-search/src/locales/en-US.schema.yml is excluded by !**/*.yml
  • packages/service-search/src/locales/zh-CN.schema.yml is excluded by !**/*.yml
📒 Files selected for processing (18)
  • packages/adapter-zhipu/src/types.ts
  • packages/core/src/services/chat.ts
  • packages/core/src/services/conversation.ts
  • packages/core/tests/helpers.ts
  • packages/extension-agent/resources/skills/sub-agent-creator/SKILL.md
  • packages/extension-agent/src/config/defaults.ts
  • packages/extension-agent/src/sub-agent/parse.ts
  • packages/service-search/src/chain/browsing_chain.ts
  • packages/service-search/src/config.ts
  • packages/service-search/src/index.ts
  • packages/service-search/src/plugin.ts
  • packages/service-search/src/provide.ts
  • packages/service-search/src/providers/bing_api.ts
  • packages/service-search/src/tools/browser/manager.ts
  • packages/service-search/src/tools/browser/tools.ts
  • packages/service-search/src/tools/puppeteerBrowserTool.ts
  • packages/service-search/src/tools/search.ts
  • packages/service-search/src/utils/parse.ts
💤 Files with no reviewable changes (1)
  • packages/service-search/src/tools/puppeteerBrowserTool.ts

Comment thread packages/extension-agent/resources/skills/sub-agent-creator/SKILL.md Outdated
Comment thread packages/service-search/src/chain/browsing_chain.ts
Comment thread packages/service-search/src/chain/browsing_chain.ts Outdated
Comment thread packages/service-search/src/chain/browsing_chain.ts
Comment thread packages/service-search/src/tools/browser/manager.ts
Comment thread packages/service-search/src/tools/browser/tools.ts
Comment thread packages/service-search/src/tools/browser/tools.ts Outdated
Comment thread packages/service-search/src/tools/browser/tools.ts Outdated
Comment thread packages/service-search/src/tools/search.ts Outdated
@dingyi222666 dingyi222666 changed the title [Feature] refactor search service browser tooling [Feature] refactor and harden search browser tooling May 16, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/service-search/src/tools/browser/manager.ts`:
- Around line 326-331: The summary flow currently calls readText(), which runs
formatOutput() and returns a truncated "Output too large..." preview to
model.invoke(createSummaryPrompt...), causing summaries to miss content; change
manager.ts to bypass readText()/formatOutput() for summary generation by using
the raw extracted page text (the original extractor result) as the input to
createSummaryPrompt/model.invoke so the model receives the full page text, and
keep truncation only when preparing the user-facing return value (i.e., apply
browserOutputLimit / formatOutput only on the output shown to users, not on the
prompt passed to model.invoke).

In `@packages/service-search/src/tools/browser/tools.ts`:
- Around line 615-622: The sequence that presses modifier keys via
this.manager.getPage(...).page.keyboard.down(...) then keyboard.press(...) must
ensure all modifiers are released even if an error occurs; wrap the press call
and any preceding down calls in a try/finally where the finally iterates the
original modifiers in reverse order and calls page.page.keyboard.up(...) for
each (use a reversed copy of keys to avoid mutating the original array).
Specifically, keep using getPage and the keyboard.down/press/up calls but move
the press into the try block and perform the up calls inside finally so
Ctrl/Shift/Alt cannot leak to later actions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 81d5a3f5-c7e0-49a0-a98d-71194551eaf8

📥 Commits

Reviewing files that changed from the base of the PR and between 3bbec08 and e4dc2cb.

⛔ Files ignored due to path filters (26)
  • packages/adapter-azure-openai/package.json is excluded by !**/*.json
  • packages/adapter-claude/package.json is excluded by !**/*.json
  • packages/adapter-deepseek/package.json is excluded by !**/*.json
  • packages/adapter-dify/package.json is excluded by !**/*.json
  • packages/adapter-doubao/package.json is excluded by !**/*.json
  • packages/adapter-gemini/package.json is excluded by !**/*.json
  • packages/adapter-hunyuan/package.json is excluded by !**/*.json
  • packages/adapter-ollama/package.json is excluded by !**/*.json
  • packages/adapter-openai-like/package.json is excluded by !**/*.json
  • packages/adapter-openai/package.json is excluded by !**/*.json
  • packages/adapter-qwen/package.json is excluded by !**/*.json
  • packages/adapter-rwkv/package.json is excluded by !**/*.json
  • packages/adapter-spark/package.json is excluded by !**/*.json
  • packages/adapter-wenxin/package.json is excluded by !**/*.json
  • packages/adapter-zhipu/package.json is excluded by !**/*.json
  • packages/core/package.json is excluded by !**/*.json
  • packages/extension-agent/package.json is excluded by !**/*.json
  • packages/extension-long-memory/package.json is excluded by !**/*.json
  • packages/extension-tools/package.json is excluded by !**/*.json
  • packages/extension-variable/package.json is excluded by !**/*.json
  • packages/renderer-image/package.json is excluded by !**/*.json
  • packages/service-embeddings/package.json is excluded by !**/*.json
  • packages/service-multimodal/package.json is excluded by !**/*.json
  • packages/service-search/package.json is excluded by !**/*.json
  • packages/service-vector-store/package.json is excluded by !**/*.json
  • packages/shared-adapter/package.json is excluded by !**/*.json
📒 Files selected for processing (7)
  • packages/extension-agent/resources/skills/sub-agent-creator/SKILL.md
  • packages/extension-agent/src/config/defaults.ts
  • packages/service-search/src/chain/browsing_chain.ts
  • packages/service-search/src/index.ts
  • packages/service-search/src/tools/browser/manager.ts
  • packages/service-search/src/tools/browser/tools.ts
  • packages/service-search/src/tools/search.ts
✅ Files skipped from review due to trivial changes (1)
  • packages/extension-agent/resources/skills/sub-agent-creator/SKILL.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/service-search/src/index.ts
  • packages/service-search/src/tools/search.ts
  • packages/service-search/src/chain/browsing_chain.ts

Comment thread packages/service-search/src/tools/browser/manager.ts Outdated
Comment thread packages/service-search/src/tools/browser/tools.ts
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/service-search/src/tools/browser/manager.ts`:
- Around line 183-198: The new page created by createPage() is left in
session.pages and set as selected even if page.page.goto(...) fails; wrap the
navigation in a try/catch so you only commit the new page on successful
navigation: save the previous selectedPageId before createPage(), call
createPage(), then try { await page.page.goto(...); session.selectedPageId =
page.id; await this.trimPages(session) } catch (err) { await page.close();
session.pages.delete(page.id); session.selectedPageId = previousSelectedId;
throw err } — reference getSession, createPage, page.page.goto,
session.selectedPageId and trimPages to locate the code to update.
- Around line 566-570: The loop currently skips any anchor with url.hash set,
which wrongly excludes external or different-path URLs with fragments; change
the logic to only skip same-document fragment links by parsing current into a
URL (e.g., const currentUrl = new URL(current)) and then continue only when
url.hash is non-empty AND url.origin === currentUrl.origin AND url.pathname ===
currentUrl.pathname AND url.search === currentUrl.search; keep the other checks
(like url.href === current) as needed. This targets the code around the anchor
iteration using document.querySelectorAll('a[href]'), the local variable url =
new URL(...), and the url.hash check.

In `@packages/service-search/src/tools/browser/tools.ts`:
- Around line 424-431: The computed filename can have an extension that
disagrees with the actual screenshot encoding (input.format →
target.screenshot({ type: format })), so change the rawName/name logic to force
the extension to match input.format: derive rawName from input.filePath if
present, strip any existing extension, append `.` + format, then sanitize into
name (keep existing regex replace). Also validate input.format is a supported
type and throw or reject if format is missing/invalid; apply the same fix to the
other occurrence handling the screenshot output (the block referenced around the
second occurrence).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 74debe63-325f-4a1b-84bc-73796b600382

📥 Commits

Reviewing files that changed from the base of the PR and between e4dc2cb and 14b5d01.

📒 Files selected for processing (2)
  • packages/service-search/src/tools/browser/manager.ts
  • packages/service-search/src/tools/browser/tools.ts

Comment thread packages/service-search/src/tools/browser/manager.ts Outdated
Comment thread packages/service-search/src/tools/browser/manager.ts Outdated
Comment thread packages/service-search/src/tools/browser/tools.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/service-search/src/tools/browser/tools.ts`:
- Around line 334-344: In _call (async _call) ensure the model is validated
before calling this.manager.summarize: check this.model.value and
cfg.configurable.model and if both are undefined throw a clear error (or choose
a sensible default) rather than passing undefined into this.manager.summarize;
update the code around the model selection so you compute a non-undefined model
variable first (e.g., const model = this.model.value ?? cfg.configurable.model)
and validate it, then pass that validated model into this.manager.summarize to
avoid runtime failures inside model.invoke().
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f7eae474-cf19-4edc-8e73-e9ef00bae120

📥 Commits

Reviewing files that changed from the base of the PR and between 14b5d01 and 708ddf8.

📒 Files selected for processing (2)
  • packages/service-search/src/tools/browser/manager.ts
  • packages/service-search/src/tools/browser/tools.ts

Comment thread packages/service-search/src/tools/browser/tools.ts
@dingyi222666 dingyi222666 merged commit 0c6b6ed into v1-dev May 18, 2026
4 of 5 checks passed
@dingyi222666 dingyi222666 deleted the feat/new-search-service branch May 18, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant