Skip to content

Commit e43512c

Browse files
committed
Simple skill tool component UI
1 parent 41ea0a0 commit e43512c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

cli/src/components/tools/registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CodeSearchComponent } from './code-search'
2+
import { SkillComponent } from './skill'
23
import { GlobComponent } from './glob'
34
import { ListDirectoryComponent } from './list-directory'
45
import { ReadDocsComponent } from './read-docs'
@@ -40,6 +41,7 @@ const toolComponentRegistry = new Map<ToolName, ToolComponent>([
4041
// Propose tools reuse the same rendering as their base counterparts
4142
['propose_str_replace', StrReplaceComponent],
4243
['propose_write_file', WriteFileComponent],
44+
[SkillComponent.toolName, SkillComponent],
4345
])
4446

4547
/**

cli/src/components/tools/skill.tsx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { SimpleToolCallItem } from './tool-call-item'
2+
import { defineToolComponent } from './types'
3+
4+
import type { ToolRenderConfig } from './types'
5+
6+
/**
7+
* UI component for skill tool.
8+
* Displays the skill name being loaded in a compact format.
9+
*/
10+
export const SkillComponent = defineToolComponent({
11+
toolName: 'skill',
12+
13+
render(toolBlock): ToolRenderConfig {
14+
const input = toolBlock.input as any
15+
16+
const skillName =
17+
typeof input?.name === 'string' ? input.name.trim() : ''
18+
19+
if (!skillName) {
20+
return { content: null }
21+
}
22+
23+
return {
24+
content: (
25+
<SimpleToolCallItem name="Load Skill" description={skillName} />
26+
),
27+
}
28+
},
29+
})

0 commit comments

Comments
 (0)