Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e0baa7a
feat: add WarpGrep AI-powered codebase search tool
DhruvBhatia0 Mar 6, 2026
5c623aa
fix: align warpgrep with Morph XML protocol
DhruvBhatia0 Mar 6, 2026
72b2bab
chore: drop warpgrep test changes from branch
DhruvBhatia0 Mar 6, 2026
5c4f320
chore: remove warpgrep test files from branch
DhruvBhatia0 Mar 6, 2026
18c187d
Merge branch 'main' into feat/warpgrep-integration
DhruvBhatia0 Mar 6, 2026
870806b
refactor: replace custom WarpGrep implementation with @morphllm/morphsdk
DhruvBhatia0 Mar 7, 2026
5646d40
feat: rename warpgrep to codebase_search, add error toast for 429/402
DhruvBhatia0 Mar 12, 2026
941efc5
build: bump @morphllm/morphsdk to 0.2.141
DhruvBhatia0 Mar 12, 2026
4d66704
Merge branch 'main' into feat/warpgrep-integration
DhruvBhatia0 Mar 12, 2026
f076350
fix: use Bus.publish for toast, revert global.event subscription
DhruvBhatia0 Mar 13, 2026
2ee083c
feat: add codebase search toggle to experimental settings
DhruvBhatia0 Mar 13, 2026
c28d1ea
build: merge main and resolve bun.lock conflict
DhruvBhatia0 Mar 13, 2026
da98f6e
Merge branch 'main' into feat/warpgrep-integration
chrarnoldus Mar 16, 2026
160c9fc
Update packages/opencode/src/tool/warpgrep.ts
DhruvBhatia0 Mar 16, 2026
08dbb3b
feat: limit codebase_search output to prevent context bloat
DhruvBhatia0 Mar 16, 2026
4adc1f0
build: bump @morphllm/morphsdk to 0.2.148
DhruvBhatia0 Mar 17, 2026
fa8297f
fix: format codebaseSearch i18n strings to respect prettier line width
marius-kilocode Mar 17, 2026
aa2cd8f
fix: only advertise codebase_search in explore prompt when feature fl…
marius-kilocode Mar 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@
"dependencies": {
"@aws-sdk/client-s3": "3.933.0",
"@kilocode/plugin": "workspace:*",
"@opencode-ai/script": "workspace:*",
"@kilocode/sdk": "workspace:*",
"@morphllm/morphsdk": "0.2.141",
"@opencode-ai/script": "workspace:*",
"typescript": "catalog:"
},
"repository": {
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@hono/standard-validator": "0.1.5",
"@hono/zod-validator": "catalog:",
"@modelcontextprotocol/sdk": "1.25.2",
"@morphllm/morphsdk": "^0.2.129",
"@octokit/graphql": "9.0.2",
"@octokit/rest": "catalog:",
"@openauthjs/openauth": "catalog:",
Expand Down
11 changes: 10 additions & 1 deletion packages/opencode/src/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import PROMPT_ASK from "./prompt/ask.txt"
import PROMPT_ORCHESTRATOR from "./prompt/orchestrator.txt"
import PROMPT_SUMMARY from "./prompt/summary.txt"
import PROMPT_TITLE from "./prompt/title.txt"
import { Flag } from "@/flag/flag" // kilocode_change
import { PermissionNext } from "@/permission/next"
import { mergeDeep, pipe, sortBy, values } from "remeda"
import { Global } from "@/global"
Expand Down Expand Up @@ -158,6 +159,7 @@ export namespace Agent {
webfetch: "allow",
websearch: "allow",
codesearch: "allow",
codebase_search: "allow", // kilocode_change
external_directory: {
[Truncate.GLOB]: "allow",
},
Expand Down Expand Up @@ -190,6 +192,7 @@ export namespace Agent {
webfetch: "allow",
websearch: "allow",
codesearch: "allow",
codebase_search: "allow", // kilocode_change
external_directory: {
[Truncate.GLOB]: "allow",
},
Expand Down Expand Up @@ -227,6 +230,7 @@ export namespace Agent {
webfetch: "allow",
websearch: "allow",
codesearch: "allow",
codebase_search: "allow", // kilocode_change
read: "allow",
external_directory: {
"*": "ask",
Expand All @@ -236,7 +240,12 @@ export namespace Agent {
user,
),
description: `Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. "src/components/**/*.tsx"), search code for keywords (eg. "API endpoints"), or answer questions about the codebase (eg. "how do API endpoints work?"). When calling this agent, specify the desired thoroughness level: "quick" for basic searches, "medium" for moderate exploration, or "very thorough" for comprehensive analysis across multiple locations and naming conventions.`,
prompt: PROMPT_EXPLORE,
// kilocode_change start
prompt:
Flag.KILO_ENABLE_WARPGREP
? `Prefer using the codebase_search tool for codebase searches — it performs intelligent multi-step code search and returns the most relevant code spans.\n\n${PROMPT_EXPLORE}`
: PROMPT_EXPLORE,
// kilocode_change end
options: {},
mode: "subagent",
native: true,
Expand Down
11 changes: 10 additions & 1 deletion packages/opencode/src/cli/cmd/tui/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ function createWorkerFetch(client: RpcClient): typeof fetch {

function createEventSource(client: RpcClient): EventSource {
return {
on: (handler) => client.on<Event>("event", handler),
on: (handler) => {
Comment thread
DhruvBhatia0 marked this conversation as resolved.
Resolved
const unsub1 = client.on<Event>("event", handler)
const unsub2 = client.on<{ directory: string; payload: Event }>("global.event", (evt) =>
handler(evt.payload),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid double-delivering TUI events

Subscribing to both event and global.event here causes duplicate event delivery in the default direct-RPC TUI path (no --port/--hostname): worker.ts already emits per-instance bus events on event, and Bus.publish also mirrors those same events to GlobalBus, which the worker forwards on global.event. Forwarding evt.payload unconditionally therefore replays normal session events twice, which can duplicate UI updates (stream/message/state events) during regular kilo tui usage.

Useful? React with 👍 / 👎.

)
return () => {
unsub1()
unsub2()
}
},
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/flag/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export namespace Flag {
export const KILO_SERVER_PASSWORD = process.env["KILO_SERVER_PASSWORD"]
export const KILO_SERVER_USERNAME = process.env["KILO_SERVER_USERNAME"]
export const KILO_ENABLE_QUESTION_TOOL = truthy("KILO_ENABLE_QUESTION_TOOL")
export const KILO_ENABLE_WARPGREP = truthy("KILO_ENABLE_WARPGREP") // kilocode_change

// Experimental
export const KILO_EXPERIMENTAL = truthy("KILO_EXPERIMENTAL")
Expand Down
6 changes: 6 additions & 0 deletions packages/opencode/src/tool/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import z from "zod"
import { Plugin } from "../plugin"
import { WebSearchTool } from "./websearch"
import { CodeSearchTool } from "./codesearch"
import { CodebaseSearchTool } from "./warpgrep" // kilocode_change
import { Flag } from "@/flag/flag"
import { Log } from "@/util/log"
import { LspTool } from "./lsp"
Expand Down Expand Up @@ -115,6 +116,7 @@ export namespace ToolRegistry {
// TodoReadTool,
WebSearchTool,
CodeSearchTool,
CodebaseSearchTool, // kilocode_change
SkillTool,
ApplyPatchTool,
...(Flag.KILO_EXPERIMENTAL_LSP_TOOL ? [LspTool] : []),
Expand Down Expand Up @@ -146,6 +148,10 @@ export namespace ToolRegistry {
}
// kilocode_change end

// kilocode_change start
if (t.id === "codebase_search") return Flag.KILO_ENABLE_WARPGREP
// kilocode_change end

// use apply tool in same format as codex
const usePatch =
model.modelID.includes("gpt-") && !model.modelID.includes("oss") && !model.modelID.includes("gpt-4")
Expand Down
Loading
Loading