@vibe-forge/client 0.3.0 → 0.5.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 +2 -1
- package/dist/assets/{arc-CwMXUVsq.js → arc-C4ymrcSQ.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-CGxJV7KJ.js → blockDiagram-c4efeb88-CeB7-kgP.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-BKhin7cY.js → c4Diagram-c83219d4-C935Im8S.js} +1 -1
- package/dist/assets/channel-84s1ACzD.js +1 -0
- package/dist/assets/{classDiagram-beda092f-BASmn22R.js → classDiagram-beda092f-B9IV13KI.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-BUk9rNBX.js → classDiagram-v2-2358418a-CXF_K4fE.js} +1 -1
- package/dist/assets/clone-B2E8tddE.js +1 -0
- package/dist/assets/{createText-1719965b-2XqnWjQY.js → createText-1719965b-DwX8iC5F.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-9P1uH1RE.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-CCR2or72.js → erDiagram-0228fc6a-ixeGTFvg.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-B72HWT9x.js → flowDb-c6c81e3f-G1gSTTBI.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-WOi0KARY.js → flowDiagram-50d868cf-CzrG99nD.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-CJfJYbME.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-i_Yd0LCE.js → flowchart-elk-definition-6af322e1-sFCoysWa.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-CFH9zF14.js → ganttDiagram-a2739b55-Ccsk_Lru.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-DglKfMze.js → gitGraphDiagram-82fe8481-CwathJ6H.js} +1 -1
- package/dist/assets/{graph-BKbBNGPf.js → graph-DRCU-8Rz.js} +1 -1
- package/dist/assets/{index-5325376f-BK7F9nSl.js → index-5325376f-Bq-fg2i_.js} +1 -1
- package/dist/assets/index-CHMuZ5-1.css +1 -0
- package/dist/assets/index-cGZvDhhU.js +542 -0
- package/dist/assets/{infoDiagram-8eee0895-BLFL77_D.js → infoDiagram-8eee0895-JBcUkJ6T.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-CS9XctDL.js → journeyDiagram-c64418c1-DsdQU-R8.js} +1 -1
- package/dist/assets/{layout-By3JZZGt.js → layout-s0slG1OL.js} +1 -1
- package/dist/assets/{line-9GUsXbwv.js → line-CymFqgW6.js} +1 -1
- package/dist/assets/{linear-DzGV4E9N.js → linear-lDQVZ6aQ.js} +1 -1
- package/dist/assets/{mermaid.core-CG3Ib42Q.js → mermaid.core-Cmlqga_E.js} +6 -6
- package/dist/assets/{mindmap-definition-8da855dc-WQ3LPKJU.js → mindmap-definition-8da855dc-CqqTDJn_.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-DHVIUZiN.js → pieDiagram-a8764435-BL2Ajx7Z.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-C3G9Ye8-.js → quadrantDiagram-1e28029f-ClL_3ASt.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-C9ES1D5G.js → requirementDiagram-08caed73-CB1RgE3K.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-B4BKXclQ.js → sankeyDiagram-a04cb91d-tgleEYiD.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-DrgEb25G.js → sequenceDiagram-c5b8d532-DlatQT5R.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-CF1XWARJ.js → stateDiagram-1ecb1508-B--MLqRs.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-IO3i3yXv.js → stateDiagram-v2-c2b004d7-CRMZ6Dpx.js} +1 -1
- package/dist/assets/{styles-b4e223ce-DACN9aSc.js → styles-b4e223ce-CPiYHfUz.js} +1 -1
- package/dist/assets/{styles-ca3715f6-bekm2WLP.js → styles-ca3715f6-B9UKPAzX.js} +1 -1
- package/dist/assets/{styles-d45a18b0-OzTDVBb8.js → styles-d45a18b0-BC1Ak1So.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-BWroJerr.js → svgDrawCommon-b86b1483-DV8R0g-n.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-CCfRNigO.js → timeline-definition-faaaa080-CiqGS5DC.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-C3cbfVqN.js → xychartDiagram-f5964ef8-h6VSD3GE.js} +1 -1
- package/dist/index.html +2 -7
- package/index.html +0 -5
- package/package.json +12 -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 +84 -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 +43 -29
- package/src/components/{chat/CodeBlock.tsx → CodeBlock.tsx} +3 -1
- package/src/components/ConfigView.tsx +32 -25
- 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 +99 -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} +146 -3
- package/src/components/chat/{Sender.tsx → Sender/Sender.tsx} +183 -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/ConfigSourceSwitch.tsx +12 -34
- 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/components/sidebar/SessionItem.scss +17 -0
- package/src/components/sidebar/SessionItem.tsx +21 -13
- package/src/hooks/chat/use-chat-adapter.ts +81 -0
- package/src/hooks/chat/use-chat-interaction.ts +26 -0
- package/src/{components/chat/useChatModels.tsx → hooks/chat/use-chat-models.tsx} +117 -22
- 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 +153 -0
- package/src/hooks/chat/use-chat-session-messages.ts +262 -0
- package/src/hooks/chat/use-chat-session.ts +63 -0
- package/src/hooks/chat/use-chat-view.ts +39 -0
- package/src/main.tsx +10 -13
- package/src/resources/adapters.ts +20 -0
- 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,22 +1,15 @@
|
|
|
1
1
|
import './BashTool.scss'
|
|
2
|
-
import
|
|
2
|
+
import type { ToolInputs } from '@vibe-forge/core'
|
|
3
|
+
import React, { useState } from 'react'
|
|
3
4
|
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import { CodeBlock } from '#~/components/CodeBlock'
|
|
6
|
+
import { ToolCallBox } from '../core/ToolCallBox'
|
|
7
|
+
import { safeJsonStringify } from '#~/utils/safe-serialize'
|
|
7
8
|
import { defineToolRender } from '../defineToolRender'
|
|
8
|
-
import { CodeBlock } from '../../CodeBlock'
|
|
9
|
-
import { ToolCallBox } from '../../ToolCallBox'
|
|
10
|
-
import { safeJsonStringify } from '../../safeSerialize'
|
|
11
9
|
|
|
12
10
|
export const BashTool = defineToolRender(({ item, resultItem }) => {
|
|
13
11
|
const { t } = useTranslation()
|
|
14
|
-
const input = (item.input != null ? item.input : {}) as
|
|
15
|
-
command?: string
|
|
16
|
-
reason?: string
|
|
17
|
-
thought?: string
|
|
18
|
-
description?: string
|
|
19
|
-
}
|
|
12
|
+
const input = (item.input != null ? item.input : {}) as Partial<ToolInputs['adapter:claude-code:Bash']>
|
|
20
13
|
const command = input.command ?? ''
|
|
21
14
|
const reason = (input.description != null && input.description !== '')
|
|
22
15
|
? input.description
|
|
@@ -25,58 +18,99 @@ export const BashTool = defineToolRender(({ item, resultItem }) => {
|
|
|
25
18
|
: (input.thought != null && input.thought !== '')
|
|
26
19
|
? input.thought
|
|
27
20
|
: ''
|
|
21
|
+
const timeout = input.timeout
|
|
22
|
+
const runInBackground = input.run_in_background
|
|
23
|
+
const dangerouslyDisableSandbox = input.dangerouslyDisableSandbox
|
|
24
|
+
const reasonLine = reason.replaceAll('\n', ' ').replace(/\s+/g, ' ').trim()
|
|
25
|
+
const commandLine = command.split('\n')[0] ?? ''
|
|
26
|
+
const hasMoreCommand = command.trim() !== commandLine.trim()
|
|
27
|
+
const showCommandExpand = hasMoreCommand || commandLine.length > 80
|
|
28
|
+
const [showCommandDetail, setShowCommandDetail] = useState(false)
|
|
28
29
|
|
|
29
30
|
return (
|
|
30
31
|
<div className='tool-group bash-tool'>
|
|
31
32
|
<ToolCallBox
|
|
32
|
-
|
|
33
|
+
defaultExpanded={true}
|
|
34
|
+
type={resultItem != null ? 'result' : 'call'}
|
|
35
|
+
isError={resultItem?.is_error ?? false}
|
|
33
36
|
header={
|
|
34
|
-
<div className='bash-
|
|
35
|
-
<span className='material-symbols-rounded
|
|
36
|
-
<
|
|
37
|
+
<div className='bash-tool__header'>
|
|
38
|
+
<span className='material-symbols-rounded bash-tool__icon'>terminal</span>
|
|
39
|
+
<div className='bash-tool__header-main'>
|
|
40
|
+
<div className='bash-tool__reason-row'>
|
|
41
|
+
<span className='bash-tool__reason-text tool-header-hint'>
|
|
42
|
+
{reasonLine !== '' ? reasonLine : commandLine}
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
{reasonLine !== '' && (
|
|
46
|
+
<div className='bash-tool__command-row'>
|
|
47
|
+
<span
|
|
48
|
+
className={`bash-tool__command-text tool-header-mono${
|
|
49
|
+
showCommandExpand ? ' bash-tool__command-text--clickable' : ''
|
|
50
|
+
}`}
|
|
51
|
+
title={showCommandExpand ? t('chat.tools.viewCommand') : undefined}
|
|
52
|
+
onClick={(e) => {
|
|
53
|
+
if (!showCommandExpand) return
|
|
54
|
+
e.stopPropagation()
|
|
55
|
+
setShowCommandDetail(prev => !prev)
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{commandLine}
|
|
59
|
+
{hasMoreCommand ? ' …' : ''}
|
|
60
|
+
</span>
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
<div className='bash-tool__header-tags'>
|
|
65
|
+
{typeof timeout === 'number' && Number.isFinite(timeout) && (
|
|
66
|
+
<span
|
|
67
|
+
className='tool-icon-tag'
|
|
68
|
+
title={`${t('chat.tools.timeout')}: ${timeout}ms`}
|
|
69
|
+
>
|
|
70
|
+
<span className='material-symbols-rounded tool-icon-tag__icon'>timer</span>
|
|
71
|
+
<span className='tool-icon-tag__text'>
|
|
72
|
+
{timeout % 1000 === 0 ? `${timeout / 1000}s` : `${timeout}ms`}
|
|
73
|
+
</span>
|
|
74
|
+
</span>
|
|
75
|
+
)}
|
|
76
|
+
{runInBackground === true && (
|
|
77
|
+
<span className='tool-icon-tag' title={t('chat.tools.runInBackground')}>
|
|
78
|
+
<span className='material-symbols-rounded tool-icon-tag__icon'>schedule</span>
|
|
79
|
+
</span>
|
|
80
|
+
)}
|
|
81
|
+
{dangerouslyDisableSandbox === true && (
|
|
82
|
+
<span className='tool-icon-tag' title={t('chat.tools.dangerouslyDisableSandbox')}>
|
|
83
|
+
<span className='material-symbols-rounded tool-icon-tag__icon'>shield_lock</span>
|
|
84
|
+
</span>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
37
87
|
</div>
|
|
38
88
|
}
|
|
39
89
|
content={
|
|
40
90
|
<div className='tool-content'>
|
|
41
|
-
{
|
|
42
|
-
<div className='
|
|
43
|
-
<
|
|
91
|
+
{showCommandDetail && (
|
|
92
|
+
<div className='bash-tool__command-detail'>
|
|
93
|
+
<div className='tool-code-wrapper'>
|
|
94
|
+
<CodeBlock code={command} lang='shell' hideHeader={true} />
|
|
95
|
+
</div>
|
|
44
96
|
</div>
|
|
45
97
|
)}
|
|
46
|
-
<div className='
|
|
47
|
-
<div className='
|
|
48
|
-
|
|
98
|
+
<div className='tool-scroll'>
|
|
99
|
+
<div className='tool-code-wrapper'>
|
|
100
|
+
{resultItem
|
|
101
|
+
? (typeof resultItem.content === 'string'
|
|
102
|
+
? <CodeBlock code={resultItem.content} lang='text' hideHeader={true} />
|
|
103
|
+
: <CodeBlock code={safeJsonStringify(resultItem.content, 2)} lang='json' hideHeader={true} />)
|
|
104
|
+
: (
|
|
105
|
+
<div className='tool-placeholder'>
|
|
106
|
+
{t('chat.result')}
|
|
107
|
+
</div>
|
|
108
|
+
)}
|
|
49
109
|
</div>
|
|
50
110
|
</div>
|
|
51
111
|
</div>
|
|
52
112
|
}
|
|
53
113
|
/>
|
|
54
|
-
|
|
55
|
-
{resultItem != null && (
|
|
56
|
-
<ToolCallBox
|
|
57
|
-
type='result'
|
|
58
|
-
isError={resultItem.is_error}
|
|
59
|
-
header={
|
|
60
|
-
<div className='result-header'>
|
|
61
|
-
<span className='material-symbols-rounded status-icon'>
|
|
62
|
-
{resultItem.is_error === true ? 'error' : 'check_circle'}
|
|
63
|
-
</span>
|
|
64
|
-
<span className='result-title'>{t('chat.result')}</span>
|
|
65
|
-
</div>
|
|
66
|
-
}
|
|
67
|
-
content={
|
|
68
|
-
<div className='tool-content'>
|
|
69
|
-
<div className='bash-content-scroll'>
|
|
70
|
-
<div className='bash-code-wrapper'>
|
|
71
|
-
{typeof resultItem.content === 'string'
|
|
72
|
-
? <CodeBlock code={resultItem.content} lang='text' />
|
|
73
|
-
: <CodeBlock code={safeJsonStringify(resultItem.content, 2)} lang='json' />}
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
}
|
|
78
|
-
/>
|
|
79
|
-
)}
|
|
80
114
|
</div>
|
|
81
115
|
)
|
|
82
116
|
})
|
|
@@ -1,83 +1,4 @@
|
|
|
1
1
|
.glob-tool {
|
|
2
|
-
.tool-header-content {
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
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
|
-
.command-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
|
-
margin-right: 8px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.pattern {
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
color: var(--sub-text-color);
|
|
36
|
-
white-space: nowrap;
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
text-overflow: ellipsis;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
min-width: 0;
|
|
42
|
-
flex: 1;
|
|
43
|
-
line-height: 20px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.file-count {
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
color: var(--sub-text-color);
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
margin-left: 8px;
|
|
51
|
-
flex-shrink: 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.input-details {
|
|
56
|
-
padding: 8px 12px;
|
|
57
|
-
font-size: 12px;
|
|
58
|
-
color: var(--sub-text-color);
|
|
59
|
-
border-bottom: 1px solid var(--border-color);
|
|
60
|
-
|
|
61
|
-
.label {
|
|
62
|
-
font-weight: 500;
|
|
63
|
-
margin-right: 8px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.value {
|
|
67
|
-
font-family: var(--font-mono);
|
|
68
|
-
background: var(--bg-color-hover);
|
|
69
|
-
padding: 2px 4px;
|
|
70
|
-
border-radius: 4px;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.tool-placeholder {
|
|
75
|
-
padding: 8px 12px;
|
|
76
|
-
color: var(--sub-text-color);
|
|
77
|
-
font-size: 12px;
|
|
78
|
-
font-style: italic;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
2
|
.file-list-container {
|
|
82
3
|
border-radius: 0;
|
|
83
4
|
border-left: none;
|
|
@@ -1,42 +1,20 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
1
|
import './GlobTool.scss'
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import React, { useMemo } from 'react'
|
|
3
|
+
import type { ToolInputs } from '@vibe-forge/core'
|
|
4
|
+
import { ToolCallBox } from '../core/ToolCallBox'
|
|
5
|
+
import { safeJsonStringify } from '#~/utils/safe-serialize'
|
|
5
6
|
import { defineToolRender } from '../defineToolRender'
|
|
6
|
-
import { ToolCallBox } from '../../ToolCallBox'
|
|
7
|
-
import { safeJsonStringify } from '../../safeSerialize'
|
|
8
7
|
import { FileList } from './components/FileList'
|
|
8
|
+
import { normalizeResultLines } from './utils'
|
|
9
9
|
|
|
10
10
|
export const GlobTool = defineToolRender(({ item, resultItem }) => {
|
|
11
|
-
const
|
|
12
|
-
const input = (item.input != null ? item.input : {}) as { pattern?: string; path?: string }
|
|
11
|
+
const input = (item.input != null ? item.input : {}) as ToolInputs['adapter:claude-code:Glob']
|
|
13
12
|
const pattern = (input.pattern != null && input.pattern !== '') ? input.pattern : '*'
|
|
14
13
|
const path = input.path
|
|
15
14
|
|
|
16
15
|
const fileCount = useMemo(() => {
|
|
17
16
|
if (!resultItem) return null
|
|
18
|
-
const
|
|
19
|
-
let lines: string[] = []
|
|
20
|
-
|
|
21
|
-
if (typeof content === 'string') {
|
|
22
|
-
if (content.trim().startsWith('[') && content.trim().endsWith(']')) {
|
|
23
|
-
try {
|
|
24
|
-
const parsed = JSON.parse(content)
|
|
25
|
-
if (Array.isArray(parsed)) {
|
|
26
|
-
lines = parsed.map(String)
|
|
27
|
-
} else {
|
|
28
|
-
lines = content.split('\n')
|
|
29
|
-
}
|
|
30
|
-
} catch (e) {
|
|
31
|
-
lines = content.split('\n')
|
|
32
|
-
}
|
|
33
|
-
} else {
|
|
34
|
-
lines = content.split('\n')
|
|
35
|
-
}
|
|
36
|
-
} else if (Array.isArray(content)) {
|
|
37
|
-
lines = content.map(String)
|
|
38
|
-
}
|
|
39
|
-
|
|
17
|
+
const lines = normalizeResultLines(resultItem.content)
|
|
40
18
|
const count = lines.filter(line => line.trim() !== '').length
|
|
41
19
|
return count
|
|
42
20
|
}, [resultItem])
|
|
@@ -46,20 +24,22 @@ export const GlobTool = defineToolRender(({ item, resultItem }) => {
|
|
|
46
24
|
<ToolCallBox
|
|
47
25
|
header={
|
|
48
26
|
<div className='tool-header-content'>
|
|
49
|
-
<span className='material-symbols-rounded'>search</span>
|
|
50
|
-
<span className='
|
|
51
|
-
<span className='
|
|
27
|
+
<span className='material-symbols-rounded tool-header-icon'>search</span>
|
|
28
|
+
<span className='tool-header-title'>Glob</span>
|
|
29
|
+
<span className='tool-header-secondary'>{pattern}</span>
|
|
52
30
|
{fileCount !== null && (
|
|
53
|
-
<span className='
|
|
31
|
+
<span className='tool-header-chip'>{fileCount} files</span>
|
|
54
32
|
)}
|
|
55
33
|
</div>
|
|
56
34
|
}
|
|
57
35
|
content={
|
|
58
36
|
<div className='tool-content'>
|
|
59
37
|
{path && (
|
|
60
|
-
<div className='input-
|
|
61
|
-
<
|
|
62
|
-
|
|
38
|
+
<div className='tool-input-grid'>
|
|
39
|
+
<div className='tool-input-item'>
|
|
40
|
+
<span className='tool-input-label'>Path</span>
|
|
41
|
+
<span className='tool-input-value'>{path}</span>
|
|
42
|
+
</div>
|
|
63
43
|
</div>
|
|
64
44
|
)}
|
|
65
45
|
{resultItem
|
|
@@ -1,91 +1,4 @@
|
|
|
1
1
|
.grep-tool {
|
|
2
|
-
.tool-header-content {
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
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
|
-
.command-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
|
-
margin-right: 8px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.pattern {
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
color: var(--sub-text-color);
|
|
36
|
-
white-space: nowrap;
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
text-overflow: ellipsis;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
min-width: 0;
|
|
42
|
-
flex: 1;
|
|
43
|
-
line-height: 20px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.file-count {
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
color: var(--sub-text-color);
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
margin-left: 8px;
|
|
51
|
-
flex-shrink: 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.input-details-grid {
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-wrap: wrap;
|
|
58
|
-
gap: 12px;
|
|
59
|
-
padding: 8px 12px;
|
|
60
|
-
border-bottom: 1px solid var(--border-color);
|
|
61
|
-
|
|
62
|
-
.input-detail-item {
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
font-size: 12px;
|
|
66
|
-
color: var(--sub-text-color);
|
|
67
|
-
|
|
68
|
-
.label {
|
|
69
|
-
font-weight: 500;
|
|
70
|
-
margin-right: 6px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.value {
|
|
74
|
-
font-family: var(--font-mono);
|
|
75
|
-
background: var(--bg-color-hover);
|
|
76
|
-
padding: 2px 4px;
|
|
77
|
-
border-radius: 4px;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.tool-placeholder {
|
|
83
|
-
padding: 8px 12px;
|
|
84
|
-
color: var(--sub-text-color);
|
|
85
|
-
font-size: 12px;
|
|
86
|
-
font-style: italic;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
2
|
.file-list-container {
|
|
90
3
|
border-radius: 0;
|
|
91
4
|
border-left: none;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
1
|
import './GrepTool.scss'
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import React, { useMemo } from 'react'
|
|
3
|
+
import { CodeBlock } from '#~/components/CodeBlock'
|
|
4
|
+
import { ToolCallBox } from '../core/ToolCallBox'
|
|
5
|
+
import { safeJsonStringify } from '#~/utils/safe-serialize'
|
|
5
6
|
import { defineToolRender } from '../defineToolRender'
|
|
6
|
-
import { CodeBlock } from '../../CodeBlock'
|
|
7
|
-
import { ToolCallBox } from '../../ToolCallBox'
|
|
8
|
-
import { safeJsonStringify } from '../../safeSerialize'
|
|
9
7
|
import { FileList } from './components/FileList'
|
|
8
|
+
import { normalizeResultLines } from './utils'
|
|
10
9
|
|
|
11
10
|
export const GrepTool = defineToolRender(({ item, resultItem }) => {
|
|
12
|
-
const { t } = useTranslation()
|
|
13
11
|
const input = (item.input != null ? item.input : {}) as {
|
|
14
12
|
pattern?: string
|
|
15
13
|
path?: string
|
|
@@ -23,28 +21,7 @@ export const GrepTool = defineToolRender(({ item, resultItem }) => {
|
|
|
23
21
|
|
|
24
22
|
const fileCount = useMemo(() => {
|
|
25
23
|
if (!resultItem) return null
|
|
26
|
-
const
|
|
27
|
-
let lines: string[] = []
|
|
28
|
-
|
|
29
|
-
if (typeof content === 'string') {
|
|
30
|
-
if (content.trim().startsWith('[') && content.trim().endsWith(']')) {
|
|
31
|
-
try {
|
|
32
|
-
const parsed = JSON.parse(content)
|
|
33
|
-
if (Array.isArray(parsed)) {
|
|
34
|
-
lines = parsed.map(String)
|
|
35
|
-
} else {
|
|
36
|
-
lines = content.split('\n')
|
|
37
|
-
}
|
|
38
|
-
} catch (e) {
|
|
39
|
-
lines = content.split('\n')
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
lines = content.split('\n')
|
|
43
|
-
}
|
|
44
|
-
} else if (Array.isArray(content)) {
|
|
45
|
-
lines = content.map(String)
|
|
46
|
-
}
|
|
47
|
-
|
|
24
|
+
const lines = normalizeResultLines(resultItem.content)
|
|
48
25
|
const count = lines.filter(line => line.trim() !== '').length
|
|
49
26
|
return count
|
|
50
27
|
}, [resultItem])
|
|
@@ -54,30 +31,34 @@ export const GrepTool = defineToolRender(({ item, resultItem }) => {
|
|
|
54
31
|
<ToolCallBox
|
|
55
32
|
header={
|
|
56
33
|
<div className='tool-header-content'>
|
|
57
|
-
<span className='material-symbols-rounded'>find_in_page</span>
|
|
58
|
-
<span className='
|
|
59
|
-
<span className='
|
|
34
|
+
<span className='material-symbols-rounded tool-header-icon'>find_in_page</span>
|
|
35
|
+
<span className='tool-header-title'>Grep</span>
|
|
36
|
+
<span className='tool-header-secondary'>{pattern}</span>
|
|
60
37
|
{fileCount !== null && (
|
|
61
|
-
<span className='
|
|
38
|
+
<span className='tool-header-chip'>{fileCount} matches</span>
|
|
62
39
|
)}
|
|
63
40
|
</div>
|
|
64
41
|
}
|
|
65
42
|
content={
|
|
66
43
|
<div className='tool-content'>
|
|
67
|
-
{(path || fileGlob) && (
|
|
68
|
-
<div className='input-
|
|
44
|
+
{(path || fileGlob || outputMode) && (
|
|
45
|
+
<div className='tool-input-grid'>
|
|
69
46
|
{path && (
|
|
70
|
-
<div className='input-
|
|
71
|
-
<span className='label'>Path
|
|
72
|
-
<span className='value'>{path}</span>
|
|
47
|
+
<div className='tool-input-item'>
|
|
48
|
+
<span className='tool-input-label'>Path</span>
|
|
49
|
+
<span className='tool-input-value'>{path}</span>
|
|
73
50
|
</div>
|
|
74
51
|
)}
|
|
75
52
|
{fileGlob && (
|
|
76
|
-
<div className='input-
|
|
77
|
-
<span className='label'>Glob
|
|
78
|
-
<span className='value'>{fileGlob}</span>
|
|
53
|
+
<div className='tool-input-item'>
|
|
54
|
+
<span className='tool-input-label'>Glob</span>
|
|
55
|
+
<span className='tool-input-value'>{fileGlob}</span>
|
|
79
56
|
</div>
|
|
80
57
|
)}
|
|
58
|
+
<div className='tool-input-item'>
|
|
59
|
+
<span className='tool-input-label'>Mode</span>
|
|
60
|
+
<span className='tool-input-value'>{outputMode}</span>
|
|
61
|
+
</div>
|
|
81
62
|
</div>
|
|
82
63
|
)}
|
|
83
64
|
{resultItem
|
|
@@ -1,83 +1,4 @@
|
|
|
1
1
|
.ls-tool {
|
|
2
|
-
.tool-header-content {
|
|
3
|
-
display: flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
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
|
-
.command-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
|
-
margin-right: 8px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.path {
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
color: var(--sub-text-color);
|
|
36
|
-
white-space: nowrap;
|
|
37
|
-
overflow: hidden;
|
|
38
|
-
text-overflow: ellipsis;
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
min-width: 0;
|
|
42
|
-
flex: 1;
|
|
43
|
-
line-height: 20px;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.file-count {
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
color: var(--sub-text-color);
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
margin-left: 8px;
|
|
51
|
-
flex-shrink: 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.input-details {
|
|
56
|
-
padding: 8px 12px;
|
|
57
|
-
font-size: 12px;
|
|
58
|
-
color: var(--sub-text-color);
|
|
59
|
-
border-bottom: 1px solid var(--border-color);
|
|
60
|
-
|
|
61
|
-
.label {
|
|
62
|
-
font-weight: 500;
|
|
63
|
-
margin-right: 8px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
code {
|
|
67
|
-
font-family: var(--font-mono);
|
|
68
|
-
background: var(--bg-color-hover);
|
|
69
|
-
padding: 2px 4px;
|
|
70
|
-
border-radius: 4px;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.tool-placeholder {
|
|
75
|
-
padding: 8px 12px;
|
|
76
|
-
color: var(--sub-text-color);
|
|
77
|
-
font-size: 12px;
|
|
78
|
-
font-style: italic;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
2
|
.file-list-container {
|
|
82
3
|
border-radius: 0;
|
|
83
4
|
border: none;
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import React, { useMemo } from 'react'
|
|
2
1
|
import './LsTool.scss'
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import React, { useMemo } from 'react'
|
|
3
|
+
import type { ToolInputs } from '@vibe-forge/core'
|
|
5
4
|
import { defineToolRender } from '../defineToolRender'
|
|
6
|
-
import { CodeBlock } from '
|
|
7
|
-
import { ToolCallBox } from '
|
|
8
|
-
import { safeJsonStringify } from '
|
|
5
|
+
import { CodeBlock } from '#~/components/CodeBlock'
|
|
6
|
+
import { ToolCallBox } from '../core/ToolCallBox'
|
|
7
|
+
import { safeJsonStringify } from '#~/utils/safe-serialize'
|
|
9
8
|
import { FileList } from './components/FileList'
|
|
10
9
|
|
|
11
10
|
export const LsTool = defineToolRender(({ item, resultItem }) => {
|
|
12
|
-
const
|
|
13
|
-
const input = (item.input != null ? item.input : {}) as { path?: string; ignore?: string[] }
|
|
11
|
+
const input = (item.input != null ? item.input : {}) as ToolInputs['adapter:claude-code:LS']
|
|
14
12
|
const path = (input.path != null && input.path !== '') ? input.path : 'current directory'
|
|
15
13
|
const ignore = input.ignore
|
|
16
14
|
|
|
@@ -43,20 +41,22 @@ export const LsTool = defineToolRender(({ item, resultItem }) => {
|
|
|
43
41
|
<ToolCallBox
|
|
44
42
|
header={
|
|
45
43
|
<div className='tool-header-content'>
|
|
46
|
-
<span className='material-symbols-rounded'>folder_open</span>
|
|
47
|
-
<span className='
|
|
48
|
-
<span className='
|
|
44
|
+
<span className='material-symbols-rounded tool-header-icon'>folder_open</span>
|
|
45
|
+
<span className='tool-header-title'>LS</span>
|
|
46
|
+
<span className='tool-header-secondary'>{path}</span>
|
|
49
47
|
{fileCount !== null && (
|
|
50
|
-
<span className='
|
|
48
|
+
<span className='tool-header-chip'>{fileCount} files</span>
|
|
51
49
|
)}
|
|
52
50
|
</div>
|
|
53
51
|
}
|
|
54
52
|
content={
|
|
55
53
|
<div className='tool-content'>
|
|
56
54
|
{ignore && ignore.length > 0 && (
|
|
57
|
-
<div className='input-
|
|
58
|
-
<
|
|
59
|
-
|
|
55
|
+
<div className='tool-input-grid'>
|
|
56
|
+
<div className='tool-input-item'>
|
|
57
|
+
<span className='tool-input-label'>Ignore</span>
|
|
58
|
+
<span className='tool-input-value'>{JSON.stringify(ignore)}</span>
|
|
59
|
+
</div>
|
|
60
60
|
</div>
|
|
61
61
|
)}
|
|
62
62
|
|