Skip to content

feat: add kimi-web-search builtin extension#10

Open
ckanner wants to merge 2 commits into
code-yeongyu:mainfrom
ckanner:feat/kimi-web-search
Open

feat: add kimi-web-search builtin extension#10
ckanner wants to merge 2 commits into
code-yeongyu:mainfrom
ckanner:feat/kimi-web-search

Conversation

@ckanner
Copy link
Copy Markdown

@ckanner ckanner commented May 15, 2026

Summary

Closes #9

This PR adds a new builtin extension kimi-web-search that integrates Kimi Code platform's official SearchWeb and FetchURL services into senpi.

Problem

  • senpi currently has no web search integration for the kimi-coding provider
  • The existing anthropic-web-search extension incorrectly injects Anthropic-native web_search_20250305 into kimi-coding requests (both use api: "anthropic-messages"), which Kimi API does not support
  • Kimi Code platform provides official moonshot_search/moonshot_fetch tools that should be utilized

Solution

New Files

  • packages/coding-agent/src/core/extensions/builtin/kimi-web-search/index.ts (278 lines)
    • Registers SearchWeb and FetchURL tools via pi.registerTool()
    • Calls Kimi Code service endpoints with proper headers (Authorization, X-Msh-Tool-Call-Id)
    • Falls back to local HTTP fetch on error
    • Configurable via PI_KIMI_WEB_SEARCH, PI_KIMI_SEARCH_BASE_URL, PI_KIMI_FETCH_BASE_URL

Modified Files

  • packages/coding-agent/src/core/extensions/builtin/index.ts
    • Registers kimi-web-search as builtin extension
  • packages/coding-agent/src/core/extensions/changes.md
    • Documents the fork change and expected merge conflict zones

Testing

  • Verified SearchWeb returns search results with text_query, limit, enable_page_crawling
  • Verified FetchURL fetches web pages with fallback to local HTTP
  • Tested with PI_ANTHROPIC_WEB_SEARCH=0 to ensure no conflict with anthropic-web-search

Checklist

  • Extension follows existing builtin extension patterns
  • Fork change documented in changes.md
  • Pre-commit checks pass (Biome + tsgo + browser-smoke + web-ui)
  • Atomic commits: feature code separate from documentation
  • No generated files or lockfile changes included

Summary by cubic

Add a built-in kimi-web-search extension integrating Kimi Code’s SearchWeb and FetchURL for the kimi-coding provider, enabling web search and URL fetch via Kimi’s official APIs. Closes #9.

  • New Features

    • Registers SearchWeb and FetchURL tools calling https://api.kimi.com/coding/v1/search and /fetch with Authorization and X-Msh-Tool-Call-Id (includes timeout_seconds: 30).
    • Config via PI_KIMI_WEB_SEARCH, PI_KIMI_SEARCH_BASE_URL, PI_KIMI_FETCH_BASE_URL; falls back to local HTTP fetch on service errors.
    • Resolves API key with ctx.modelRegistry.getApiKeyAndHeaders(); exposes results/content to the agent.
    • Registered in the builtin registry as id kimi-web-search.
  • Bug Fixes

    • Stops injecting Anthropic web_search_20250305 into kimi-coding requests; uses Kimi services instead.

Written for commit 9ce5adc. Summary will update on new commits. Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

@ckanner ckanner force-pushed the feat/kimi-web-search branch from 60039d2 to 7adbe57 Compare May 15, 2026 08:17
ckanner added 2 commits May 18, 2026 15:26
Integrate Kimi Code official SearchWeb/FetchURL services:
- SearchWeb: POST /search with text_query, limit, enable_page_crawling
- FetchURL: POST /fetch with url, fallback to local HTTP on error
- Pass Authorization and X-Msh-Tool-Call-Id headers per Kimi CLI
- Configurable via PI_KIMI_WEB_SEARCH, PI_KIMI_SEARCH_BASE_URL, PI_KIMI_FETCH_BASE_URL
- Resolves API key via ctx.modelRegistry.getApiKeyAndHeaders()

Fixes incorrect anthropic-web-search injection into kimi-coding provider.

Registered as builtin extension id 'kimi-web-search'.
Add fork change record explaining:
- What kimi-web-search does (SearchWeb/FetchURL for Kimi Code)
- Why it was added (Kimi had no web search integration)
- Why extension system alone couldn't handle it
- Expected merge conflict zones
@ckanner ckanner force-pushed the feat/kimi-web-search branch from 7adbe57 to 9ce5adc Compare May 18, 2026 07: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.

feat: Add kimi-web-search builtin extension for Kimi Code platform

1 participant