GeezerVison is showing github.com — core: add explore agent for fast codebase navigation and improve task… · c0debrain/opencode@813d287
File treeExpand file treeCollapse file tree Open diff view settings cli/cmd/tui/routes/session
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .opencode/opencode.jsonc +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | "type": "remote", | 17 | 17 | "url": "https://mcp.exa.ai/mcp", | 18 | 18 | }, | | 19 | + "morph": { | | 20 | + "type": "local", | | 21 | + "command": ["bunx", "@morphllm/morphmcp"], | | 22 | + "environment": { | | 23 | + "ENABLED_TOOLS": "warp_grep", | | 24 | + }, | | 25 | + }, | 19 | 26 | }, | 20 | 27 | } |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/agent/agent.ts +35Lines changed: 35 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,6 +114,41 @@ export namespace Agent { | 114 | 114 | mode: "subagent", | 115 | 115 | builtIn: true, | 116 | 116 | }, | | 117 | + explore: { | | 118 | + name: "explore", | | 119 | + tools: { | | 120 | + todoread: false, | | 121 | + todowrite: false, | | 122 | + edit: false, | | 123 | + write: false, | | 124 | + ...defaultTools, | | 125 | + }, | | 126 | + 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. (Tools: All tools)`, | | 127 | + prompt: [ | | 128 | + `You are a file search specialist. You excel at thoroughly navigating and exploring codebases.`, | | 129 | + ``, | | 130 | + `Your strengths:`, | | 131 | + `- Rapidly finding files using glob patterns`, | | 132 | + `- Searching code and text with powerful regex patterns`, | | 133 | + `- Reading and analyzing file contents`, | | 134 | + ``, | | 135 | + `Guidelines:`, | | 136 | + `- Use Glob for broad file pattern matching`, | | 137 | + `- Use Grep for searching file contents with regex`, | | 138 | + `- Use Read when you know the specific file path you need to read`, | | 139 | + `- Use Bash for file operations like copying, moving, or listing directory contents`, | | 140 | + `- Adapt your search approach based on the thoroughness level specified by the caller`, | | 141 | + `- Return file paths as absolute paths in your final response`, | | 142 | + `- For clear communication, avoid using emojis`, | | 143 | + `- Do not create any files, or run bash commands that modify the user's system state in any way`, | | 144 | + ``, | | 145 | + `Complete the user's search request efficiently and report your findings clearly.`, | | 146 | + ].join("\n"), | | 147 | + options: {}, | | 148 | + permission: agentPermission, | | 149 | + mode: "subagent", | | 150 | + builtIn: true, | | 151 | + }, | 117 | 152 | build: { | 118 | 153 | name: "build", | 119 | 154 | tools: { ...defaultTools }, | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1405,8 +1405,8 @@ ToolRegistry.register<typeof TaskTool>({ | 1405 | 1405 |
| 1406 | 1406 | return ( | 1407 | 1407 | <> | 1408 | | - <ToolTitle icon="%" fallback="Delegating..." when={props.input.subagent_type ?? props.input.description}> | 1409 | | - Task [{props.input.subagent_type ?? "unknown"}] {props.input.description} | | 1408 | + <ToolTitle icon="◉" fallback="Delegating..." when={props.input.subagent_type ?? props.input.description}> | | 1409 | + {Locale.titlecase(props.input.subagent_type ?? "unknown")} Task "{props.input.description}" | 1410 | 1410 | </ToolTitle> | 1411 | 1411 | <Show when={props.metadata.summary?.length}> | 1412 | 1412 | <box> | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/config/config.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -527,6 +527,7 @@ export namespace Config { | 527 | 527 | plan: Agent.optional(), | 528 | 528 | build: Agent.optional(), | 529 | 529 | general: Agent.optional(), | | 530 | + explore: Agent.optional(), | 530 | 531 | }) | 531 | 532 | .catchall(Agent) | 532 | 533 | .optional() | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/provider/provider.ts +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -677,6 +677,21 @@ export namespace Provider { | 677 | 677 | } | 678 | 678 | } | 679 | 679 |
| | 680 | + export async function closest(providerID: string, query: string[]) { | | 681 | + const s = await state() | | 682 | + const provider = s.providers[providerID] | | 683 | + if (!provider) return undefined | | 684 | + for (const item of query) { | | 685 | + for (const modelID of Object.keys(provider.info.models)) { | | 686 | + if (modelID.includes(item)) | | 687 | + return { | | 688 | + providerID, | | 689 | + modelID, | | 690 | + } | | 691 | + } | | 692 | + } | | 693 | + } | | 694 | + | 680 | 695 | export async function getSmallModel(providerID: string) { | 681 | 696 | const cfg = await Config.get() | 682 | 697 |
| |
|