Skip to content

Commit 101c88a

Browse files
committed
Add read_url to base2!
1 parent aa94c61 commit 101c88a

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

agents/base2/base2.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ export function createBase2(
108108
!isFree && 'propose_str_replace',
109109
!isFree && 'propose_write_file',
110110
!noAskUser && 'ask_user',
111+
'read_url',
111112
'skill',
112113
'set_output',
113114
'list_directory',
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { SimpleToolCallItem } from './tool-call-item'
2+
import { defineToolComponent } from './types'
3+
4+
import type { ChatTheme } from '../../types/theme-system'
5+
import type { ToolRenderConfig } from './types'
6+
7+
/**
8+
* UI component for read_url tool.
9+
* Displays the URL being read in a compact format.
10+
*/
11+
export const ReadURLComponent = defineToolComponent({
12+
toolName: 'read_url',
13+
14+
render(toolBlock, theme): ToolRenderConfig {
15+
const input = toolBlock.input as { url?: string } | undefined
16+
17+
const url = typeof input?.url === 'string' ? input.url.trim() : ''
18+
19+
if (!url) {
20+
return { content: null }
21+
}
22+
23+
return {
24+
content: (
25+
<SimpleToolCallItem
26+
name="Read URL"
27+
description={url}
28+
descriptionColor={theme.muted}
29+
/>
30+
),
31+
}
32+
},
33+
})

cli/src/components/tools/registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ListDirectoryComponent } from './list-directory'
66
import { ReadDocsComponent } from './read-docs'
77
import { ReadFilesComponent } from './read-files'
88
import { ReadSubtreeComponent } from './read-subtree'
9+
import { ReadURLComponent } from './read-url'
910
import { RenderUIComponent } from './render-ui'
1011
import { RunTerminalCommandComponent } from './run-terminal-command'
1112
import { SkillComponent } from './skill'
@@ -38,6 +39,7 @@ const toolComponentRegistry = new Map<ToolName, ToolComponent>([
3839
[ReadDocsComponent.toolName, ReadDocsComponent],
3940
[ReadFilesComponent.toolName, ReadFilesComponent],
4041
[ReadSubtreeComponent.toolName, ReadSubtreeComponent],
42+
[ReadURLComponent.toolName, ReadURLComponent],
4143
[RenderUIComponent.toolName, RenderUIComponent],
4244
[WriteTodosComponent.toolName, WriteTodosComponent],
4345
[StrReplaceComponent.toolName, StrReplaceComponent],

0 commit comments

Comments
 (0)