@vibe-forge/client 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +1 -1
- package/dist/assets/{arc-CwMXUVsq.js → arc-DgIxeTMg.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-CGxJV7KJ.js → blockDiagram-c4efeb88-CEAob3X9.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-BKhin7cY.js → c4Diagram-c83219d4-DwIxpDKd.js} +1 -1
- package/dist/assets/channel-DhtnrNJ6.js +1 -0
- package/dist/assets/{classDiagram-beda092f-BASmn22R.js → classDiagram-beda092f-Cz1q8u_0.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-BUk9rNBX.js → classDiagram-v2-2358418a-CImgTuwd.js} +1 -1
- package/dist/assets/clone-7bHB6YkC.js +1 -0
- package/dist/assets/{createText-1719965b-2XqnWjQY.js → createText-1719965b-C1_HJcCc.js} +1 -1
- package/dist/assets/devicon-BWlTeAUU.woff +0 -0
- package/dist/assets/devicon-CirD-cQx.ttf +0 -0
- package/dist/assets/devicon-Dg8iWy0i.svg +1211 -0
- package/dist/assets/devicon-TqfHp33-.eot +0 -0
- package/dist/assets/{edges-96097737-B7e32Jeg.js → edges-96097737-BU8qStzd.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-CCR2or72.js → erDiagram-0228fc6a-DNA1Fz2L.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-B72HWT9x.js → flowDb-c6c81e3f-DjiCStMN.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-WOi0KARY.js → flowDiagram-50d868cf-CSDi0-RD.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-_13Sz5Wh.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-i_Yd0LCE.js → flowchart-elk-definition-6af322e1-DrhIMas7.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-CFH9zF14.js → ganttDiagram-a2739b55-CTZnUP5z.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-DglKfMze.js → gitGraphDiagram-82fe8481-COOW7jTi.js} +1 -1
- package/dist/assets/{graph-BKbBNGPf.js → graph-CIkpD4Kx.js} +1 -1
- package/dist/assets/{index-5325376f-BK7F9nSl.js → index-5325376f-aVVRRTIu.js} +1 -1
- package/dist/assets/index-D1giUI7r.css +1 -0
- package/dist/assets/index-DRSI_ZIL.js +514 -0
- package/dist/assets/{infoDiagram-8eee0895-BLFL77_D.js → infoDiagram-8eee0895-DQpZ1LVD.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-CS9XctDL.js → journeyDiagram-c64418c1-DoKguIuk.js} +1 -1
- package/dist/assets/{layout-By3JZZGt.js → layout-Tnmha8Nh.js} +1 -1
- package/dist/assets/{line-9GUsXbwv.js → line-BQR2SOyl.js} +1 -1
- package/dist/assets/{linear-DzGV4E9N.js → linear-DlG0eemV.js} +1 -1
- package/dist/assets/{mermaid.core-CG3Ib42Q.js → mermaid.core-BnwYO0He.js} +6 -6
- package/dist/assets/{mindmap-definition-8da855dc-WQ3LPKJU.js → mindmap-definition-8da855dc-BllYwDID.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-DHVIUZiN.js → pieDiagram-a8764435-DwCkhPVc.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-C3G9Ye8-.js → quadrantDiagram-1e28029f-c40GKTU0.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-C9ES1D5G.js → requirementDiagram-08caed73-DnQp2Tk6.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-B4BKXclQ.js → sankeyDiagram-a04cb91d-CnJrs13b.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-DrgEb25G.js → sequenceDiagram-c5b8d532-1YBwnpKu.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-CF1XWARJ.js → stateDiagram-1ecb1508-BFBxQ6Fh.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-IO3i3yXv.js → stateDiagram-v2-c2b004d7-Dmechvv2.js} +1 -1
- package/dist/assets/{styles-b4e223ce-DACN9aSc.js → styles-b4e223ce-DWWfWX8O.js} +1 -1
- package/dist/assets/{styles-ca3715f6-bekm2WLP.js → styles-ca3715f6-CKKvZxaU.js} +1 -1
- package/dist/assets/{styles-d45a18b0-OzTDVBb8.js → styles-d45a18b0-dKMOUh9p.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-BWroJerr.js → svgDrawCommon-b86b1483-CBgjChPM.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-CCfRNigO.js → timeline-definition-faaaa080-NCt-HHmb.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-C3cbfVqN.js → xychartDiagram-f5964ef8-BJhXS4dG.js} +1 -1
- package/dist/index.html +2 -7
- package/index.html +0 -5
- package/package.json +11 -6
- package/src/App.tsx +2 -0
- package/src/api/README.md +26 -0
- package/src/api/automation.ts +88 -0
- package/src/api/base.ts +54 -0
- package/src/api/benchmark.ts +45 -0
- package/src/api/config.ts +24 -0
- package/src/api/knowledge.ts +72 -0
- package/src/api/projects.ts +15 -0
- package/src/api/sessions.ts +82 -0
- package/src/api/types.ts +20 -0
- package/src/api.ts +44 -269
- package/src/components/AutomationView/AutomationView.scss +5 -1
- package/src/components/AutomationView/RuleFormPanel.tsx +3 -2
- package/src/components/AutomationView/TaskList.scss +4 -6
- package/src/components/AutomationView/TaskList.tsx +2 -1
- package/src/components/AutomationView/TriggerList.scss +4 -1
- package/src/components/BenchmarkView/BenchmarkCasePanel.scss +267 -0
- package/src/components/BenchmarkView/BenchmarkCasePanel.tsx +309 -0
- package/src/components/BenchmarkView/BenchmarkSidebar.scss +182 -0
- package/src/components/BenchmarkView/BenchmarkSidebar.tsx +262 -0
- package/src/components/BenchmarkView/BenchmarkView.scss +78 -0
- package/src/components/BenchmarkView/index.tsx +197 -0
- package/src/components/BenchmarkView/types.ts +10 -0
- package/src/components/BenchmarkView/utils.ts +21 -0
- package/src/components/Chat.tsx +37 -29
- package/src/components/{chat/CodeBlock.tsx → CodeBlock.tsx} +3 -1
- package/src/components/ConfigView.tsx +7 -0
- package/src/components/{chat/MarkdownContent.tsx → MarkdownContent.tsx} +1 -1
- package/src/components/NavRail.tsx +7 -0
- package/src/components/chat/ChatHeader.scss +37 -19
- package/src/components/chat/ChatHeader.tsx +6 -9
- package/src/components/chat/ChatHistoryView.tsx +89 -45
- package/src/components/chat/CurrentTodoList.tsx +10 -9
- package/src/components/chat/{MessageItem.scss → Messages/MessageItem.scss} +14 -0
- package/src/components/chat/{MessageItem.tsx → Messages/MessageItem.tsx} +30 -8
- package/src/components/chat/{messageUtils.ts → Messages/message-utils.ts} +1 -1
- package/src/components/chat/{Sender.scss → Sender/Sender.scss} +80 -0
- package/src/components/chat/{Sender.tsx → Sender/Sender.tsx} +161 -5
- package/src/components/chat/tools/DefaultTool.tsx +184 -21
- package/src/components/chat/tools/adapter-claude/BashTool.scss +67 -51
- package/src/components/chat/tools/adapter-claude/BashTool.tsx +83 -49
- package/src/components/chat/tools/adapter-claude/GlobTool.scss +0 -79
- package/src/components/chat/tools/adapter-claude/GlobTool.tsx +16 -36
- package/src/components/chat/tools/adapter-claude/GrepTool.scss +0 -87
- package/src/components/chat/tools/adapter-claude/GrepTool.tsx +22 -41
- package/src/components/chat/tools/adapter-claude/LSTool.scss +0 -79
- package/src/components/chat/tools/adapter-claude/LSTool.tsx +15 -15
- package/src/components/chat/tools/adapter-claude/ReadTool.scss +0 -55
- package/src/components/chat/tools/adapter-claude/ReadTool.tsx +20 -42
- package/src/components/chat/tools/adapter-claude/TodoTool.scss +8 -23
- package/src/components/chat/tools/adapter-claude/TodoTool.tsx +24 -11
- package/src/components/chat/tools/adapter-claude/WriteTool.scss +21 -69
- package/src/components/chat/tools/adapter-claude/WriteTool.tsx +22 -58
- package/src/components/chat/tools/adapter-claude/index.ts +4 -10
- package/src/components/chat/tools/adapter-claude/utils.ts +54 -0
- package/src/components/chat/tools/core/ToolCallBox.scss +356 -0
- package/src/components/chat/{ToolGroup.tsx → tools/core/ToolGroup.tsx} +26 -7
- package/src/components/chat/{ToolRenderer.tsx → tools/core/ToolRenderer.tsx} +6 -4
- package/src/components/chat/tools/plugin-chrome-devtools/ChromeDevtoolsTool.scss +11 -0
- package/src/components/chat/tools/plugin-chrome-devtools/ChromeDevtoolsTool.tsx +75 -0
- package/src/components/chat/tools/plugin-chrome-devtools/index.ts +45 -0
- package/src/components/chat/tools/task/GetTaskInfoTool.scss +2 -27
- package/src/components/chat/tools/task/GetTaskInfoTool.tsx +48 -38
- package/src/components/chat/tools/task/ListTasksTool.scss +3 -28
- package/src/components/chat/tools/task/ListTasksTool.tsx +11 -8
- package/src/components/chat/tools/task/StartTasksTool.scss +3 -28
- package/src/components/chat/tools/task/StartTasksTool.tsx +14 -17
- package/src/components/chat/tools/task/components/TaskRow.scss +105 -0
- package/src/components/chat/tools/task/components/TaskRow.tsx +163 -0
- package/src/components/chat/tools/task/components/TaskToolCard.scss +15 -15
- package/src/components/chat/tools/task/components/TaskToolCard.tsx +8 -6
- package/src/components/config/ConfigSectionForm.tsx +12 -1
- package/src/components/config/channelDefinitions.ts +6 -0
- package/src/components/config/configSchema.ts +10 -1
- package/src/components/config/recordEditors/ChannelRecordEditor.scss +1 -0
- package/src/components/config/recordEditors/ChannelRecordEditor.tsx +397 -0
- package/src/components/config/recordEditors/index.tsx +1 -0
- package/src/components/knowledge-base/components/RuleItem.tsx +1 -1
- package/src/components/knowledge-base/components/SpecItem.tsx +1 -1
- package/src/hooks/chat/use-chat-interaction.ts +26 -0
- package/src/{components/chat/useChatModels.tsx → hooks/chat/use-chat-models.tsx} +46 -15
- package/src/hooks/chat/use-chat-permission-mode.ts +47 -0
- package/src/hooks/chat/use-chat-scroll.ts +51 -0
- package/src/hooks/chat/use-chat-session-actions.ts +147 -0
- package/src/hooks/chat/use-chat-session-messages.ts +250 -0
- package/src/hooks/chat/use-chat-session.ts +57 -0
- package/src/hooks/chat/use-chat-view.ts +39 -0
- package/src/main.tsx +10 -13
- package/src/resources/locales/en.json +66 -0
- package/src/resources/locales/zh.json +66 -0
- package/src/runtime-config.ts +52 -0
- package/src/vite-env.d.ts +11 -0
- package/src/ws.ts +5 -3
- package/vite.config.ts +12 -4
- package/dist/assets/channel-jbCEHqbG.js +0 -1
- package/dist/assets/clone-CCRKqS4L.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-Baslbgn4.js +0 -1
- package/dist/assets/index-B0qfCb1G.css +0 -1
- package/dist/assets/index-CNo75dYr.js +0 -497
- package/src/components/chat/ToolCallBox.scss +0 -137
- package/src/components/chat/useChatSession.ts +0 -370
- /package/src/components/{chat/CodeBlock.scss → CodeBlock.scss} +0 -0
- /package/src/components/chat/{MessageFooter.tsx → Messages/MessageFooter.tsx} +0 -0
- /package/src/components/chat/{CompletionMenu.scss → Sender/CompletionMenu.scss} +0 -0
- /package/src/components/chat/{CompletionMenu.tsx → Sender/CompletionMenu.tsx} +0 -0
- /package/src/components/chat/{ThinkingStatus.scss → Sender/ThinkingStatus.scss} +0 -0
- /package/src/components/chat/{ThinkingStatus.tsx → Sender/ThinkingStatus.tsx} +0 -0
- /package/src/components/chat/{ToolCallBox.tsx → tools/core/ToolCallBox.tsx} +0 -0
- /package/src/components/chat/{ToolGroup.scss → tools/core/ToolGroup.scss} +0 -0
- /package/src/{components/chat/safeSerialize.ts → utils/safe-serialize.ts} +0 -0
|
@@ -1,81 +1,39 @@
|
|
|
1
1
|
.write-tool {
|
|
2
|
-
.
|
|
2
|
+
.write-tool__header {
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-width: 0;
|
|
3
5
|
display: flex;
|
|
4
6
|
align-items: center;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
|
|
9
|
-
.material-symbols-rounded {
|
|
10
|
-
font-size: 18px;
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: center;
|
|
14
|
-
color: var(--sub-text-color);
|
|
15
|
-
height: 20px;
|
|
16
|
-
width: 18px;
|
|
17
|
-
margin-right: 8px;
|
|
18
|
-
position: relative;
|
|
19
|
-
top: 1px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.file-name {
|
|
23
|
-
font-size: 13px;
|
|
24
|
-
font-weight: 500;
|
|
25
|
-
color: var(--text-color);
|
|
26
|
-
white-space: nowrap;
|
|
27
|
-
line-height: 20px;
|
|
28
|
-
display: flex;
|
|
29
|
-
align-items: center;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.file-path {
|
|
33
|
-
font-size: 12px;
|
|
34
|
-
color: var(--sub-text-color);
|
|
35
|
-
white-space: nowrap;
|
|
36
|
-
overflow: hidden;
|
|
37
|
-
text-overflow: ellipsis;
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
min-width: 0;
|
|
41
|
-
flex: 1;
|
|
42
|
-
line-height: 20px;
|
|
43
|
-
|
|
44
|
-
&::before {
|
|
45
|
-
content: '—';
|
|
46
|
-
margin: 0 8px;
|
|
47
|
-
color: var(--border-color);
|
|
48
|
-
font-weight: 300;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
gap: 8px;
|
|
51
9
|
}
|
|
52
10
|
|
|
53
|
-
.write-
|
|
11
|
+
.write-tool__header-left {
|
|
54
12
|
display: flex;
|
|
55
13
|
align-items: center;
|
|
56
|
-
gap:
|
|
14
|
+
gap: 6px;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
flex: 1;
|
|
17
|
+
}
|
|
57
18
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
19
|
+
.write-tool__status-icon {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
width: 16px;
|
|
24
|
+
height: 16px;
|
|
25
|
+
flex-shrink: 0;
|
|
61
26
|
|
|
62
|
-
.
|
|
63
|
-
font-size:
|
|
27
|
+
.material-symbols-rounded {
|
|
28
|
+
font-size: 16px;
|
|
64
29
|
}
|
|
65
30
|
|
|
66
31
|
&.error {
|
|
67
|
-
|
|
68
|
-
color: #ef4444;
|
|
69
|
-
}
|
|
32
|
+
color: var(--danger-color);
|
|
70
33
|
}
|
|
71
34
|
|
|
72
35
|
&.success {
|
|
73
|
-
|
|
74
|
-
color: #10b981;
|
|
75
|
-
}
|
|
76
|
-
.status-text {
|
|
77
|
-
color: #059669;
|
|
78
|
-
}
|
|
36
|
+
color: var(--success-color);
|
|
79
37
|
}
|
|
80
38
|
}
|
|
81
39
|
|
|
@@ -83,10 +41,4 @@
|
|
|
83
41
|
display: flex;
|
|
84
42
|
flex-direction: column;
|
|
85
43
|
}
|
|
86
|
-
|
|
87
|
-
.write-result-status {
|
|
88
|
-
display: flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
gap: 4px;
|
|
91
|
-
}
|
|
92
44
|
}
|
|
@@ -1,59 +1,40 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
1
|
import './WriteTool.scss'
|
|
3
|
-
import
|
|
4
|
-
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import type { ToolInputs } from '@vibe-forge/core'
|
|
4
|
+
import { CodeBlock } from '#~/components/CodeBlock'
|
|
5
|
+
import { ToolCallBox } from '../core/ToolCallBox'
|
|
5
6
|
import { defineToolRender } from '../defineToolRender'
|
|
6
|
-
import {
|
|
7
|
-
import { ToolCallBox } from '../../ToolCallBox'
|
|
7
|
+
import { getFileInfo, getLanguageFromPath } from './utils'
|
|
8
8
|
|
|
9
9
|
export const WriteTool = defineToolRender(({ item, resultItem }) => {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const filePath = (input.file_path != null && input.file_path !== '') ? input.file_path : 'unknown file'
|
|
13
|
-
const lastPart = filePath.split('/').pop()
|
|
14
|
-
const fileName = (lastPart != null && lastPart !== '') ? lastPart : filePath
|
|
15
|
-
const dirPath = filePath.includes('/') ? filePath.substring(0, filePath.lastIndexOf('/')) : ''
|
|
10
|
+
const input = (item.input != null ? item.input : {}) as ToolInputs['adapter:claude-code:Write']
|
|
11
|
+
const { filePath } = getFileInfo(input.file_path)
|
|
16
12
|
const content = input.content ?? ''
|
|
17
|
-
|
|
18
|
-
const getLanguage = (path: string) => {
|
|
19
|
-
const extPart = path.split('.').pop()
|
|
20
|
-
const ext = (extPart != null && extPart !== '') ? extPart.toLowerCase() : ''
|
|
21
|
-
const langMap: Record<string, string> = {
|
|
22
|
-
'js': 'javascript',
|
|
23
|
-
'jsx': 'jsx',
|
|
24
|
-
'ts': 'typescript',
|
|
25
|
-
'tsx': 'tsx',
|
|
26
|
-
'py': 'python',
|
|
27
|
-
'md': 'markdown',
|
|
28
|
-
'json': 'json',
|
|
29
|
-
'scss': 'scss',
|
|
30
|
-
'css': 'css',
|
|
31
|
-
'html': 'html',
|
|
32
|
-
'sh': 'bash',
|
|
33
|
-
'yml': 'yaml',
|
|
34
|
-
'yaml': 'yaml',
|
|
35
|
-
'sql': 'sql'
|
|
36
|
-
}
|
|
37
|
-
return langMap[ext] || 'text'
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const language = getLanguage(filePath)
|
|
13
|
+
const language = getLanguageFromPath(filePath)
|
|
41
14
|
|
|
42
15
|
return (
|
|
43
16
|
<div className='tool-group write-tool'>
|
|
44
17
|
<ToolCallBox
|
|
45
18
|
defaultExpanded={false}
|
|
46
19
|
header={
|
|
47
|
-
<div className='
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
20
|
+
<div className='write-tool__header'>
|
|
21
|
+
<div className='write-tool__header-left'>
|
|
22
|
+
<span className='material-symbols-rounded tool-header-icon'>edit_note</span>
|
|
23
|
+
<span className='tool-header-primary tool-header-mono tool-header-row-text'>{filePath}</span>
|
|
24
|
+
</div>
|
|
25
|
+
{resultItem != null && (
|
|
26
|
+
<span className={`write-tool__status-icon ${resultItem.is_error ? 'error' : 'success'}`}>
|
|
27
|
+
<span className='material-symbols-rounded'>
|
|
28
|
+
{resultItem.is_error === true ? 'error' : 'check_circle'}
|
|
29
|
+
</span>
|
|
30
|
+
</span>
|
|
31
|
+
)}
|
|
51
32
|
</div>
|
|
52
33
|
}
|
|
53
34
|
content={
|
|
54
35
|
<div className='tool-content'>
|
|
55
|
-
<div className='
|
|
56
|
-
<div className='
|
|
36
|
+
<div className='tool-scroll'>
|
|
37
|
+
<div className='tool-code-wrapper'>
|
|
57
38
|
<CodeBlock
|
|
58
39
|
code={content}
|
|
59
40
|
lang={language}
|
|
@@ -64,23 +45,6 @@ export const WriteTool = defineToolRender(({ item, resultItem }) => {
|
|
|
64
45
|
</div>
|
|
65
46
|
}
|
|
66
47
|
/>
|
|
67
|
-
{resultItem != null && (
|
|
68
|
-
<ToolCallBox
|
|
69
|
-
type='result'
|
|
70
|
-
isError={resultItem.is_error}
|
|
71
|
-
header={
|
|
72
|
-
<div className={`write-result-status ${resultItem.is_error ? 'error' : 'success'}`}>
|
|
73
|
-
<span className='material-symbols-rounded status-icon'>
|
|
74
|
-
{resultItem.is_error === true ? 'error' : 'check_circle'}
|
|
75
|
-
</span>
|
|
76
|
-
<span className='status-text'>
|
|
77
|
-
{resultItem.is_error === true ? t('chat.tools.writeFailed') : t('chat.tools.writeSuccess')}
|
|
78
|
-
</span>
|
|
79
|
-
</div>
|
|
80
|
-
}
|
|
81
|
-
content={null}
|
|
82
|
-
/>
|
|
83
|
-
)}
|
|
84
48
|
</div>
|
|
85
49
|
)
|
|
86
50
|
})
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type {} from '@vibe-forge/adapter-claude-code/schema'
|
|
2
|
+
|
|
1
3
|
import { defineToolRenders } from '../defineToolRender'
|
|
2
4
|
import { BashTool } from './BashTool'
|
|
3
5
|
import { GlobTool } from './GlobTool'
|
|
@@ -15,14 +17,6 @@ export const adapterClaudeToolRenders = defineToolRenders({
|
|
|
15
17
|
Read: ReadTool,
|
|
16
18
|
Write: WriteTool,
|
|
17
19
|
TodoWrite: TodoTool
|
|
18
|
-
})
|
|
20
|
+
}, { namespace: 'adapter:claude-code:' })
|
|
19
21
|
|
|
20
|
-
export {
|
|
21
|
-
BashTool,
|
|
22
|
-
GlobTool,
|
|
23
|
-
GrepTool,
|
|
24
|
-
LsTool,
|
|
25
|
-
ReadTool,
|
|
26
|
-
TodoTool,
|
|
27
|
-
WriteTool
|
|
28
|
-
}
|
|
22
|
+
export { BashTool, GlobTool, GrepTool, LsTool, ReadTool, TodoTool, WriteTool }
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export function getFileInfo(filePath?: string) {
|
|
2
|
+
const resolvedPath = (filePath != null && filePath !== '') ? filePath : 'unknown file'
|
|
3
|
+
const lastSlashIndex = resolvedPath.lastIndexOf('/')
|
|
4
|
+
const fileName = lastSlashIndex >= 0 ? resolvedPath.slice(lastSlashIndex + 1) : resolvedPath
|
|
5
|
+
const dirPath = lastSlashIndex >= 0 ? resolvedPath.slice(0, lastSlashIndex) : ''
|
|
6
|
+
|
|
7
|
+
return { filePath: resolvedPath, fileName, dirPath }
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getLanguageFromPath(path: string) {
|
|
11
|
+
const extPart = path.split('.').pop()
|
|
12
|
+
const ext = (extPart != null && extPart !== '') ? extPart.toLowerCase() : ''
|
|
13
|
+
const langMap: Record<string, string> = {
|
|
14
|
+
'js': 'javascript',
|
|
15
|
+
'jsx': 'jsx',
|
|
16
|
+
'ts': 'typescript',
|
|
17
|
+
'tsx': 'tsx',
|
|
18
|
+
'py': 'python',
|
|
19
|
+
'md': 'markdown',
|
|
20
|
+
'json': 'json',
|
|
21
|
+
'scss': 'scss',
|
|
22
|
+
'css': 'css',
|
|
23
|
+
'html': 'html',
|
|
24
|
+
'sh': 'bash',
|
|
25
|
+
'yml': 'yaml',
|
|
26
|
+
'yaml': 'yaml',
|
|
27
|
+
'sql': 'sql'
|
|
28
|
+
}
|
|
29
|
+
return langMap[ext] || 'text'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function normalizeResultLines(content: unknown): string[] {
|
|
33
|
+
if (Array.isArray(content)) {
|
|
34
|
+
return content.map(String)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (typeof content !== 'string') {
|
|
38
|
+
return []
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const trimmed = content.trim()
|
|
42
|
+
if (trimmed.startsWith('[') && trimmed.endsWith(']')) {
|
|
43
|
+
try {
|
|
44
|
+
const parsed = JSON.parse(trimmed)
|
|
45
|
+
if (Array.isArray(parsed)) {
|
|
46
|
+
return parsed.map(String)
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
return content.split('\n')
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return content.split('\n')
|
|
54
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
.tool-group {
|
|
2
|
+
margin: 0;
|
|
3
|
+
border: 1px solid var(--border-color);
|
|
4
|
+
border-radius: 6px;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background-color: var(--bg-color);
|
|
7
|
+
|
|
8
|
+
.tool-call-box {
|
|
9
|
+
border: none;
|
|
10
|
+
margin: 0;
|
|
11
|
+
border-radius: 0;
|
|
12
|
+
|
|
13
|
+
&.result {
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.tool-call-header {
|
|
19
|
+
padding: 6px 10px;
|
|
20
|
+
height: 32px;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
user-select: none;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
gap: 8px;
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
font-weight: 500;
|
|
30
|
+
color: var(--text-color);
|
|
31
|
+
background-color: var(--tag-bg);
|
|
32
|
+
transition: text-shadow .4s ease;
|
|
33
|
+
|
|
34
|
+
&.collapsed {
|
|
35
|
+
cursor: default;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tool-call-header-main {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 6px;
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
text-shadow: 0 0 .5px currentColor;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.material-symbols-rounded {
|
|
51
|
+
font-size: 16px;
|
|
52
|
+
color: var(--sub-text-color);
|
|
53
|
+
|
|
54
|
+
&.expand-icon {
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.tool-result-header {
|
|
61
|
+
padding: 6px 10px;
|
|
62
|
+
height: 32px;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
user-select: none;
|
|
66
|
+
border-top: 1px solid var(--border-color);
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
font-size: 12px;
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
color: var(--success-color);
|
|
73
|
+
background-color: var(--tag-bg);
|
|
74
|
+
|
|
75
|
+
&.error {
|
|
76
|
+
color: var(--danger-color);
|
|
77
|
+
.material-symbols-rounded {
|
|
78
|
+
color: var(--danger-color);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&:hover {
|
|
83
|
+
opacity: .8;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.material-symbols-rounded {
|
|
87
|
+
font-size: 16px;
|
|
88
|
+
color: var(--success-color);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.tool-call-box:first-child {
|
|
93
|
+
.tool-result-header {
|
|
94
|
+
border-top: none;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.tool-call-box.expanded {
|
|
99
|
+
.tool-call-header {
|
|
100
|
+
border-bottom: 1px solid var(--border-color);
|
|
101
|
+
}
|
|
102
|
+
.tool-result-header {
|
|
103
|
+
border-bottom: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.tool-call-box.collapsed {
|
|
108
|
+
.tool-call-header {
|
|
109
|
+
border-bottom: none;
|
|
110
|
+
}
|
|
111
|
+
.tool-result-header {
|
|
112
|
+
border-bottom: none;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.tool-call-body {
|
|
117
|
+
padding: 0;
|
|
118
|
+
overflow: hidden;
|
|
119
|
+
transition: all .2s ease-in-out;
|
|
120
|
+
background-color: var(--bg-color);
|
|
121
|
+
|
|
122
|
+
.tool-call-box.result & {
|
|
123
|
+
background-color: var(--bg-color);
|
|
124
|
+
border-top: 1px dashed var(--border-color);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.tool-content {
|
|
128
|
+
padding: 0;
|
|
129
|
+
|
|
130
|
+
// Override code block wrapper styles
|
|
131
|
+
.code-block-wrapper {
|
|
132
|
+
border: none;
|
|
133
|
+
border-radius: 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.tool-result-structured {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: 12px;
|
|
140
|
+
padding: 12px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tool-result-text {
|
|
144
|
+
font-size: 13px;
|
|
145
|
+
color: var(--text-color);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.tool-result-text-content {
|
|
149
|
+
white-space: pre-wrap;
|
|
150
|
+
line-height: 1.6;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.tool-result-image-wrapper {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
gap: 6px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.tool-result-image {
|
|
160
|
+
max-width: 100%;
|
|
161
|
+
border-radius: 6px;
|
|
162
|
+
border: 1px solid var(--border-color);
|
|
163
|
+
background: var(--bg-color);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.tool-result-image-caption {
|
|
167
|
+
font-size: 12px;
|
|
168
|
+
color: var(--sub-text-color);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
.tool-header-content {
|
|
175
|
+
display: flex;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: 6px;
|
|
178
|
+
width: 100%;
|
|
179
|
+
min-width: 0;
|
|
180
|
+
overflow: hidden;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.tool-header-icon {
|
|
184
|
+
font-size: 16px;
|
|
185
|
+
color: var(--sub-text-color);
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
justify-content: center;
|
|
189
|
+
width: 16px;
|
|
190
|
+
height: 16px;
|
|
191
|
+
flex-shrink: 0;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.tool-header-title {
|
|
195
|
+
font-size: 12px;
|
|
196
|
+
font-weight: 600;
|
|
197
|
+
color: var(--text-color);
|
|
198
|
+
white-space: nowrap;
|
|
199
|
+
flex-shrink: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.tool-header-primary {
|
|
203
|
+
font-size: 12px;
|
|
204
|
+
font-weight: 500;
|
|
205
|
+
color: var(--text-color);
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
flex-shrink: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.tool-header-secondary {
|
|
211
|
+
font-size: 12px;
|
|
212
|
+
color: var(--sub-text-color);
|
|
213
|
+
min-width: 0;
|
|
214
|
+
overflow: hidden;
|
|
215
|
+
text-overflow: ellipsis;
|
|
216
|
+
white-space: nowrap;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.tool-header-hint {
|
|
220
|
+
font-size: 11px;
|
|
221
|
+
font-weight: 400;
|
|
222
|
+
color: var(--sub-text-color);
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
flex-shrink: 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.tool-header-chip {
|
|
228
|
+
padding: 1px 6px;
|
|
229
|
+
border: 1px solid var(--border-color);
|
|
230
|
+
border-radius: 999px;
|
|
231
|
+
font-size: 10px;
|
|
232
|
+
font-weight: 600;
|
|
233
|
+
color: var(--sub-text-color);
|
|
234
|
+
background: var(--bg-color);
|
|
235
|
+
white-space: nowrap;
|
|
236
|
+
flex-shrink: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.tool-header-mono {
|
|
240
|
+
font-family: var(--font-mono);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.tool-input-grid {
|
|
244
|
+
display: flex;
|
|
245
|
+
flex-wrap: wrap;
|
|
246
|
+
gap: 8px 12px;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.tool-input-item {
|
|
250
|
+
display: flex;
|
|
251
|
+
align-items: center;
|
|
252
|
+
gap: 4px;
|
|
253
|
+
font-size: 12px;
|
|
254
|
+
color: var(--sub-text-color);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.tool-input-label {
|
|
258
|
+
font-weight: 500;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.tool-input-value {
|
|
262
|
+
font-family: var(--font-mono);
|
|
263
|
+
background: var(--bg-color-hover);
|
|
264
|
+
padding: 2px 4px;
|
|
265
|
+
border-radius: 4px;
|
|
266
|
+
color: var(--text-color);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.tool-placeholder {
|
|
270
|
+
padding: 0;
|
|
271
|
+
color: var(--sub-text-color);
|
|
272
|
+
font-size: 12px;
|
|
273
|
+
font-style: italic;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.tool-header-stack {
|
|
277
|
+
display: flex;
|
|
278
|
+
flex-direction: column;
|
|
279
|
+
gap: 2px;
|
|
280
|
+
min-width: 0;
|
|
281
|
+
flex: 1;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.tool-header-row {
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
gap: 6px;
|
|
288
|
+
min-width: 0;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.tool-header-row-text {
|
|
292
|
+
min-width: 0;
|
|
293
|
+
overflow: hidden;
|
|
294
|
+
text-overflow: ellipsis;
|
|
295
|
+
white-space: nowrap;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.tool-header-tags {
|
|
299
|
+
display: flex;
|
|
300
|
+
align-items: center;
|
|
301
|
+
gap: 6px;
|
|
302
|
+
flex-shrink: 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.tool-icon-tag {
|
|
306
|
+
display: inline-flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
gap: 4px;
|
|
309
|
+
padding: 1px 6px;
|
|
310
|
+
border: 1px solid var(--border-color);
|
|
311
|
+
border-radius: 999px;
|
|
312
|
+
background: var(--bg-color);
|
|
313
|
+
color: var(--sub-text-color);
|
|
314
|
+
font-size: 11px;
|
|
315
|
+
line-height: 1;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.tool-icon-tag__icon {
|
|
319
|
+
font-size: 14px;
|
|
320
|
+
display: flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.tool-icon-tag__text {
|
|
326
|
+
font-family: var(--font-mono);
|
|
327
|
+
font-size: 10px;
|
|
328
|
+
color: var(--text-color);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.tool-scroll {
|
|
332
|
+
max-height: 360px;
|
|
333
|
+
overflow-y: auto;
|
|
334
|
+
|
|
335
|
+
&::-webkit-scrollbar {
|
|
336
|
+
width: 4px;
|
|
337
|
+
}
|
|
338
|
+
&::-webkit-scrollbar-track {
|
|
339
|
+
background: transparent;
|
|
340
|
+
}
|
|
341
|
+
&::-webkit-scrollbar-thumb {
|
|
342
|
+
background: var(--border-color);
|
|
343
|
+
border-radius: 4px;
|
|
344
|
+
}
|
|
345
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
346
|
+
background: var(--sub-text-color);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.tool-code-wrapper {
|
|
351
|
+
background-color: transparent;
|
|
352
|
+
border: none;
|
|
353
|
+
border-radius: 0;
|
|
354
|
+
padding: 0;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
+
import './ToolGroup.scss'
|
|
2
|
+
|
|
1
3
|
import type { ChatMessage, ChatMessageContent } from '@vibe-forge/core'
|
|
2
4
|
import React, { useState } from 'react'
|
|
3
5
|
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import { MessageFooter } from '
|
|
5
|
-
import './ToolGroup.scss'
|
|
6
|
+
import { MessageFooter } from '../../Messages/MessageFooter'
|
|
6
7
|
import { ToolRenderer } from './ToolRenderer'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
items,
|
|
10
|
-
footer
|
|
11
|
-
}: {
|
|
9
|
+
type ToolGroupProps = {
|
|
12
10
|
items: {
|
|
13
11
|
item: Extract<ChatMessageContent, { type: 'tool_use' }>
|
|
14
12
|
resultItem?: Extract<ChatMessageContent, { type: 'tool_result' }>
|
|
@@ -19,7 +17,12 @@ export function ToolGroup({
|
|
|
19
17
|
createdAt: number
|
|
20
18
|
originalMessage: ChatMessage
|
|
21
19
|
}
|
|
22
|
-
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ToolGroupComponent({
|
|
23
|
+
items,
|
|
24
|
+
footer
|
|
25
|
+
}: ToolGroupProps) {
|
|
23
26
|
const { t } = useTranslation()
|
|
24
27
|
const [expanded, setExpanded] = useState(false)
|
|
25
28
|
|
|
@@ -100,3 +103,19 @@ export function ToolGroup({
|
|
|
100
103
|
</div>
|
|
101
104
|
)
|
|
102
105
|
}
|
|
106
|
+
|
|
107
|
+
const areToolGroupPropsEqual = (prev: ToolGroupProps, next: ToolGroupProps) => {
|
|
108
|
+
if (prev.items.length !== next.items.length) return false
|
|
109
|
+
for (let i = 0; i < prev.items.length; i++) {
|
|
110
|
+
if (prev.items[i].item !== next.items[i].item) return false
|
|
111
|
+
if (prev.items[i].resultItem !== next.items[i].resultItem) return false
|
|
112
|
+
}
|
|
113
|
+
if (prev.footer == null && next.footer == null) return true
|
|
114
|
+
if (prev.footer == null || next.footer == null) return false
|
|
115
|
+
return prev.footer.originalMessage === next.footer.originalMessage
|
|
116
|
+
&& prev.footer.createdAt === next.footer.createdAt
|
|
117
|
+
&& prev.footer.model === next.footer.model
|
|
118
|
+
&& prev.footer.usage === next.footer.usage
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const ToolGroup = React.memo(ToolGroupComponent, areToolGroupPropsEqual)
|