@vibe-forge/client 0.2.0-alpha.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.
Files changed (184) hide show
  1. package/LICENSE +21 -0
  2. package/cli.cjs +6 -0
  3. package/index.html +27 -0
  4. package/package.json +42 -0
  5. package/src/App.tsx +174 -0
  6. package/src/api.ts +241 -0
  7. package/src/components/ArchiveView.scss +168 -0
  8. package/src/components/ArchiveView.tsx +299 -0
  9. package/src/components/AutomationView/AutomationView.scss +26 -0
  10. package/src/components/AutomationView/RuleFormPanel.scss +129 -0
  11. package/src/components/AutomationView/RuleFormPanel.tsx +257 -0
  12. package/src/components/AutomationView/RuleSidebar.scss +219 -0
  13. package/src/components/AutomationView/RuleSidebar.tsx +258 -0
  14. package/src/components/AutomationView/RunHistoryPanel.scss +286 -0
  15. package/src/components/AutomationView/RunHistoryPanel.tsx +320 -0
  16. package/src/components/AutomationView/TaskList.scss +128 -0
  17. package/src/components/AutomationView/TaskList.tsx +79 -0
  18. package/src/components/AutomationView/TriggerList.scss +153 -0
  19. package/src/components/AutomationView/TriggerList.tsx +217 -0
  20. package/src/components/AutomationView/index.tsx +228 -0
  21. package/src/components/AutomationView/types.ts +21 -0
  22. package/src/components/Chat.scss +89 -0
  23. package/src/components/Chat.tsx +92 -0
  24. package/src/components/ConfigView.scss +185 -0
  25. package/src/components/ConfigView.tsx +258 -0
  26. package/src/components/NavRail.scss +71 -0
  27. package/src/components/NavRail.tsx +188 -0
  28. package/src/components/Sidebar.scss +112 -0
  29. package/src/components/Sidebar.tsx +291 -0
  30. package/src/components/chat/ChatHeader.scss +401 -0
  31. package/src/components/chat/ChatHeader.tsx +342 -0
  32. package/src/components/chat/ChatHistoryView.tsx +122 -0
  33. package/src/components/chat/ChatSettingsView.tsx +22 -0
  34. package/src/components/chat/ChatTimelineView.scss +53 -0
  35. package/src/components/chat/ChatTimelineView.tsx +158 -0
  36. package/src/components/chat/CodeBlock.scss +87 -0
  37. package/src/components/chat/CodeBlock.tsx +179 -0
  38. package/src/components/chat/CompletionMenu.scss +70 -0
  39. package/src/components/chat/CompletionMenu.tsx +58 -0
  40. package/src/components/chat/CurrentTodoList.scss +217 -0
  41. package/src/components/chat/CurrentTodoList.tsx +103 -0
  42. package/src/components/chat/MarkdownContent.tsx +43 -0
  43. package/src/components/chat/MessageFooter.tsx +48 -0
  44. package/src/components/chat/MessageItem.scss +251 -0
  45. package/src/components/chat/MessageItem.tsx +78 -0
  46. package/src/components/chat/NewSessionGuide.scss +186 -0
  47. package/src/components/chat/NewSessionGuide.tsx +167 -0
  48. package/src/components/chat/Sender.scss +367 -0
  49. package/src/components/chat/Sender.tsx +541 -0
  50. package/src/components/chat/SessionTimelinePanel/EventList.scss +58 -0
  51. package/src/components/chat/SessionTimelinePanel/EventList.tsx +212 -0
  52. package/src/components/chat/SessionTimelinePanel/gantt.ts +177 -0
  53. package/src/components/chat/SessionTimelinePanel/git-graph.ts +518 -0
  54. package/src/components/chat/SessionTimelinePanel/index.scss +28 -0
  55. package/src/components/chat/SessionTimelinePanel/index.tsx +121 -0
  56. package/src/components/chat/SessionTimelinePanel/mermaid.ts +4 -0
  57. package/src/components/chat/SessionTimelinePanel/types.ts +64 -0
  58. package/src/components/chat/SessionTimelinePanel/utils.ts +20 -0
  59. package/src/components/chat/ThinkingStatus.scss +70 -0
  60. package/src/components/chat/ThinkingStatus.tsx +13 -0
  61. package/src/components/chat/ToolCallBox.scss +137 -0
  62. package/src/components/chat/ToolCallBox.tsx +55 -0
  63. package/src/components/chat/ToolGroup.scss +154 -0
  64. package/src/components/chat/ToolGroup.tsx +102 -0
  65. package/src/components/chat/ToolRenderer.tsx +45 -0
  66. package/src/components/chat/messageUtils.ts +171 -0
  67. package/src/components/chat/safeSerialize.ts +84 -0
  68. package/src/components/chat/tools/DefaultTool.tsx +63 -0
  69. package/src/components/chat/tools/adapter-claude/BashTool.scss +71 -0
  70. package/src/components/chat/tools/adapter-claude/BashTool.tsx +82 -0
  71. package/src/components/chat/tools/adapter-claude/GlobTool.scss +88 -0
  72. package/src/components/chat/tools/adapter-claude/GlobTool.tsx +85 -0
  73. package/src/components/chat/tools/adapter-claude/GrepTool.scss +96 -0
  74. package/src/components/chat/tools/adapter-claude/GrepTool.tsx +114 -0
  75. package/src/components/chat/tools/adapter-claude/LSTool.scss +85 -0
  76. package/src/components/chat/tools/adapter-claude/LSTool.tsx +94 -0
  77. package/src/components/chat/tools/adapter-claude/ReadTool.scss +57 -0
  78. package/src/components/chat/tools/adapter-claude/ReadTool.tsx +87 -0
  79. package/src/components/chat/tools/adapter-claude/TodoTool.scss +78 -0
  80. package/src/components/chat/tools/adapter-claude/TodoTool.tsx +60 -0
  81. package/src/components/chat/tools/adapter-claude/WriteTool.scss +92 -0
  82. package/src/components/chat/tools/adapter-claude/WriteTool.tsx +86 -0
  83. package/src/components/chat/tools/adapter-claude/components/FileList.scss +65 -0
  84. package/src/components/chat/tools/adapter-claude/components/FileList.tsx +185 -0
  85. package/src/components/chat/tools/adapter-claude/index.ts +28 -0
  86. package/src/components/chat/tools/defineToolRender.ts +28 -0
  87. package/src/components/chat/tools/task/GetTaskInfoTool.scss +50 -0
  88. package/src/components/chat/tools/task/GetTaskInfoTool.tsx +88 -0
  89. package/src/components/chat/tools/task/ListTasksTool.scss +56 -0
  90. package/src/components/chat/tools/task/ListTasksTool.tsx +83 -0
  91. package/src/components/chat/tools/task/StartTasksTool.scss +56 -0
  92. package/src/components/chat/tools/task/StartTasksTool.tsx +96 -0
  93. package/src/components/chat/tools/task/components/TaskToolCard.scss +127 -0
  94. package/src/components/chat/tools/task/components/TaskToolCard.tsx +177 -0
  95. package/src/components/chat/tools/task/index.ts +15 -0
  96. package/src/components/chat/useChatModels.tsx +206 -0
  97. package/src/components/chat/useChatSession.ts +370 -0
  98. package/src/components/config/ConfigAboutSection.scss +111 -0
  99. package/src/components/config/ConfigAboutSection.tsx +86 -0
  100. package/src/components/config/ConfigDisplayValue.scss +22 -0
  101. package/src/components/config/ConfigDisplayValue.tsx +62 -0
  102. package/src/components/config/ConfigEditors.scss +65 -0
  103. package/src/components/config/ConfigEditors.tsx +98 -0
  104. package/src/components/config/ConfigFieldRow.scss +97 -0
  105. package/src/components/config/ConfigFieldRow.tsx +36 -0
  106. package/src/components/config/ConfigSectionForm.scss +94 -0
  107. package/src/components/config/ConfigSectionForm.tsx +436 -0
  108. package/src/components/config/ConfigSectionPanel.tsx +67 -0
  109. package/src/components/config/ConfigShortcutInput.scss +11 -0
  110. package/src/components/config/ConfigShortcutInput.tsx +52 -0
  111. package/src/components/config/ConfigSourceSwitch.tsx +57 -0
  112. package/src/components/config/configSchema.ts +319 -0
  113. package/src/components/config/configUtils.ts +83 -0
  114. package/src/components/config/index.tsx +5 -0
  115. package/src/components/config/recordEditors/BooleanRecordEditor.scss +1 -0
  116. package/src/components/config/recordEditors/BooleanRecordEditor.tsx +75 -0
  117. package/src/components/config/recordEditors/KeyValueEditor.scss +1 -0
  118. package/src/components/config/recordEditors/KeyValueEditor.tsx +97 -0
  119. package/src/components/config/recordEditors/McpServersRecordEditor.scss +1 -0
  120. package/src/components/config/recordEditors/McpServersRecordEditor.tsx +258 -0
  121. package/src/components/config/recordEditors/ModelServicesRecordEditor.scss +1 -0
  122. package/src/components/config/recordEditors/ModelServicesRecordEditor.tsx +233 -0
  123. package/src/components/config/recordEditors/RecordEditors.scss +117 -0
  124. package/src/components/config/recordEditors/RecordJsonEditor.scss +1 -0
  125. package/src/components/config/recordEditors/RecordJsonEditor.tsx +113 -0
  126. package/src/components/config/recordEditors/index.tsx +5 -0
  127. package/src/components/knowledge-base/KnowledgeBaseView.scss +19 -0
  128. package/src/components/knowledge-base/KnowledgeBaseView.tsx +186 -0
  129. package/src/components/knowledge-base/components/ActionButton.scss +5 -0
  130. package/src/components/knowledge-base/components/ActionButton.tsx +9 -0
  131. package/src/components/knowledge-base/components/EmptyState.scss +19 -0
  132. package/src/components/knowledge-base/components/EmptyState.tsx +42 -0
  133. package/src/components/knowledge-base/components/EntitiesTab.scss +5 -0
  134. package/src/components/knowledge-base/components/EntitiesTab.tsx +80 -0
  135. package/src/components/knowledge-base/components/EntityItem.scss +82 -0
  136. package/src/components/knowledge-base/components/EntityItem.tsx +79 -0
  137. package/src/components/knowledge-base/components/EntityList.scss +5 -0
  138. package/src/components/knowledge-base/components/EntityList.tsx +70 -0
  139. package/src/components/knowledge-base/components/FilterBar.scss +21 -0
  140. package/src/components/knowledge-base/components/FilterBar.tsx +51 -0
  141. package/src/components/knowledge-base/components/FlowsTab.scss +5 -0
  142. package/src/components/knowledge-base/components/FlowsTab.tsx +80 -0
  143. package/src/components/knowledge-base/components/KnowledgeBaseHeader.scss +27 -0
  144. package/src/components/knowledge-base/components/KnowledgeBaseHeader.tsx +29 -0
  145. package/src/components/knowledge-base/components/KnowledgeList.scss +19 -0
  146. package/src/components/knowledge-base/components/KnowledgeList.tsx +19 -0
  147. package/src/components/knowledge-base/components/LoadingState.scss +5 -0
  148. package/src/components/knowledge-base/components/LoadingState.tsx +11 -0
  149. package/src/components/knowledge-base/components/MetaList.scss +19 -0
  150. package/src/components/knowledge-base/components/MetaList.tsx +18 -0
  151. package/src/components/knowledge-base/components/RulesTab.scss +5 -0
  152. package/src/components/knowledge-base/components/RulesTab.tsx +49 -0
  153. package/src/components/knowledge-base/components/SectionHeader.scss +22 -0
  154. package/src/components/knowledge-base/components/SectionHeader.tsx +21 -0
  155. package/src/components/knowledge-base/components/SkillsTab.scss +5 -0
  156. package/src/components/knowledge-base/components/SkillsTab.tsx +49 -0
  157. package/src/components/knowledge-base/components/SpecItem.scss +138 -0
  158. package/src/components/knowledge-base/components/SpecItem.tsx +131 -0
  159. package/src/components/knowledge-base/components/SpecList.scss +5 -0
  160. package/src/components/knowledge-base/components/SpecList.tsx +70 -0
  161. package/src/components/knowledge-base/components/TabContent.scss +8 -0
  162. package/src/components/knowledge-base/components/TabContent.tsx +17 -0
  163. package/src/components/knowledge-base/components/TabLabel.scss +10 -0
  164. package/src/components/knowledge-base/components/TabLabel.tsx +15 -0
  165. package/src/components/knowledge-base/index.tsx +1 -0
  166. package/src/components/sidebar/SessionItem.scss +256 -0
  167. package/src/components/sidebar/SessionItem.tsx +265 -0
  168. package/src/components/sidebar/SessionList.scss +92 -0
  169. package/src/components/sidebar/SessionList.tsx +166 -0
  170. package/src/components/sidebar/SidebarHeader.scss +79 -0
  171. package/src/components/sidebar/SidebarHeader.tsx +128 -0
  172. package/src/connectionManager.ts +172 -0
  173. package/src/hooks/useGlobalShortcut.ts +26 -0
  174. package/src/hooks/useQueryParams.ts +54 -0
  175. package/src/i18n.ts +22 -0
  176. package/src/main.tsx +41 -0
  177. package/src/resources/locales/en.json +765 -0
  178. package/src/resources/locales/zh.json +766 -0
  179. package/src/store/index.ts +23 -0
  180. package/src/styles/global.scss +100 -0
  181. package/src/utils/shortcutUtils.ts +88 -0
  182. package/src/vite-env.d.ts +12 -0
  183. package/src/ws.ts +33 -0
  184. package/vite.config.ts +26 -0
@@ -0,0 +1,87 @@
1
+ .code-block-wrapper {
2
+ --cb-border: #e5e7eb;
3
+ --cb-bg: #ffffff;
4
+ --cb-header-bg: #f6f8fa;
5
+ --cb-hover-bg: rgba(0, 0, 0, .05);
6
+ --cb-text: #000000;
7
+ --cb-sub-text: #6b7280;
8
+
9
+ width: 100%;
10
+ margin: 0;
11
+ border-radius: 8px;
12
+ overflow: hidden;
13
+ border: 1px solid var(--cb-border);
14
+ background-color: var(--cb-bg);
15
+ display: flex;
16
+ flex-direction: column;
17
+
18
+ .code-block-header {
19
+ display: flex;
20
+ justify-content: space-between;
21
+ align-items: center;
22
+ padding: 8px 12px;
23
+ background-color: var(--cb-header-bg);
24
+ border-bottom: 1px solid var(--cb-border);
25
+ user-select: none;
26
+
27
+ .code-lang-container {
28
+ display: flex;
29
+ align-items: center;
30
+ gap: 8px;
31
+
32
+ .code-lang {
33
+ font-size: 11px;
34
+ color: var(--cb-sub-text);
35
+ font-family:
36
+ 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
37
+ text-transform: uppercase;
38
+ font-weight: 600;
39
+ letter-spacing: .5px;
40
+ }
41
+ }
42
+
43
+ .copy-button {
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ padding: 4px;
48
+ border: none;
49
+ background: transparent;
50
+ cursor: pointer;
51
+ color: var(--cb-sub-text);
52
+ border-radius: 4px;
53
+ transition: all .2s ease;
54
+
55
+ &:hover {
56
+ background-color: var(--cb-hover-bg);
57
+ color: var(--cb-text);
58
+ }
59
+
60
+ .material-symbols-rounded {
61
+ font-size: 16px;
62
+ }
63
+ }
64
+ }
65
+
66
+ pre.shiki {
67
+ margin: 0;
68
+ padding: 12px;
69
+ overflow-x: auto;
70
+ font-size: 13px;
71
+ line-height: 1.6;
72
+ width: 100%;
73
+ box-sizing: border-box;
74
+ background-color: transparent !important;
75
+ }
76
+ }
77
+
78
+ html.dark {
79
+ .code-block-wrapper {
80
+ --cb-border: #30363d;
81
+ --cb-bg: #0d1117;
82
+ --cb-header-bg: #161b22;
83
+ --cb-hover-bg: rgba(255, 255, 255, .1);
84
+ --cb-text: #e5e7eb;
85
+ --cb-sub-text: #8b949e;
86
+ }
87
+ }
@@ -0,0 +1,179 @@
1
+ import './CodeBlock.scss'
2
+ import { useAtomValue } from 'jotai'
3
+ import React, { useEffect, useState } from 'react'
4
+ import { codeToHtml } from 'shiki'
5
+ import { themeAtom } from '../../store'
6
+
7
+ export function CodeBlock({
8
+ code,
9
+ lang = 'json',
10
+ showLineNumbers = false,
11
+ hideHeader = false
12
+ }: {
13
+ code: string
14
+ lang?: string
15
+ showLineNumbers?: boolean
16
+ hideHeader?: boolean
17
+ }) {
18
+ const [html, setHtml] = useState<string>('')
19
+ const [copied, setCopied] = useState(false)
20
+ const themeMode = useAtomValue(themeAtom)
21
+
22
+ const handleCopy = async () => {
23
+ try {
24
+ await navigator.clipboard.writeText(code)
25
+ setCopied(true)
26
+ setTimeout(() => setCopied(false), 2000)
27
+ } catch (err) {
28
+ console.error('Failed to copy code:', err)
29
+ }
30
+ }
31
+
32
+ const getLangIcon = (language: string) => {
33
+ const lang = language.toLowerCase()
34
+ const iconMap: Record<string, string> = {
35
+ js: 'javascript-plain',
36
+ javascript: 'javascript-plain',
37
+ ts: 'typescript-plain',
38
+ typescript: 'typescript-plain',
39
+ html: 'html5-plain',
40
+ css: 'css3-plain',
41
+ python: 'python-plain',
42
+ py: 'python-plain',
43
+ java: 'java-plain',
44
+ cpp: 'cplusplus-plain',
45
+ c: 'c-plain',
46
+ csharp: 'csharp-plain',
47
+ cs: 'csharp-plain',
48
+ go: 'go-original-wordmark',
49
+ rust: 'rust-original',
50
+ rs: 'rust-original',
51
+ php: 'php-plain',
52
+ ruby: 'ruby-plain',
53
+ rb: 'ruby-plain',
54
+ swift: 'swift-plain',
55
+ kotlin: 'kotlin-plain',
56
+ kt: 'kotlin-plain',
57
+ scala: 'scala-plain',
58
+ shell: 'bash-plain',
59
+ sh: 'bash-plain',
60
+ bash: 'bash-plain',
61
+ sql: 'sqlline-plain',
62
+ json: 'json-plain',
63
+ yaml: 'yaml-plain',
64
+ yml: 'yaml-plain',
65
+ markdown: 'markdown-original',
66
+ md: 'markdown-original',
67
+ docker: 'docker-plain',
68
+ dockerfile: 'docker-plain',
69
+ react: 'react-original',
70
+ jsx: 'react-original',
71
+ tsx: 'react-original',
72
+ vue: 'vuejs-plain',
73
+ angular: 'angularjs-plain',
74
+ sass: 'sass-original',
75
+ scss: 'sass-original',
76
+ less: 'less-plain-wordmark',
77
+ stylus: 'stylus-plain',
78
+ mongodb: 'mongodb-plain',
79
+ mysql: 'mysql-plain',
80
+ postgresql: 'postgresql-plain',
81
+ redis: 'redis-plain',
82
+ git: 'git-plain',
83
+ npm: 'npm-original-wordmark',
84
+ yarn: 'yarn-plain',
85
+ nginx: 'nginx-original',
86
+ bash_profile: 'bash-plain'
87
+ }
88
+
89
+ const iconClass = iconMap[lang] || 'code-plain'
90
+ return <i className={`devicon-${iconClass} colored`} style={{ fontSize: '14px' }} />
91
+ }
92
+
93
+ useEffect(() => {
94
+ let isMounted = true
95
+ const isDark = themeMode === 'dark' ||
96
+ (themeMode === 'system' && window.matchMedia('(prefers-color-scheme: dark)').matches)
97
+
98
+ void codeToHtml(code, {
99
+ lang,
100
+ theme: isDark ? 'github-dark' : 'github-light',
101
+ transformers: showLineNumbers
102
+ ? [
103
+ {
104
+ name: 'line-numbers',
105
+ line(node, line) {
106
+ node.children.unshift({
107
+ type: 'element',
108
+ tagName: 'span',
109
+ properties: {
110
+ class: 'line-number',
111
+ style:
112
+ 'display: inline-block; width: 2rem; margin-right: 1rem; text-align: right; color: #9ca3af; user-select: none;'
113
+ },
114
+ children: [{ type: 'text', value: String(line) }]
115
+ })
116
+ }
117
+ }
118
+ ]
119
+ : []
120
+ }).then(h => {
121
+ if (isMounted) setHtml(h)
122
+ })
123
+ return () => {
124
+ isMounted = false
125
+ }
126
+ }, [code, lang, showLineNumbers, themeMode])
127
+
128
+ if (html === '') {
129
+ return (
130
+ <div className='code-block-wrapper'>
131
+ {!hideHeader && (
132
+ <div className='code-block-header'>
133
+ <div className='code-lang-container'>
134
+ {getLangIcon(lang)}
135
+ <span className='code-lang'>{lang}</span>
136
+ </div>
137
+ <button
138
+ className='copy-button'
139
+ onClick={() => {
140
+ void handleCopy()
141
+ }}
142
+ >
143
+ <span className='material-symbols-rounded'>
144
+ {copied ? 'check' : 'content_copy'}
145
+ </span>
146
+ </button>
147
+ </div>
148
+ )}
149
+ <pre style={{ margin: 0, padding: 12, fontSize: 12, color: '#4b5563', overflowX: 'auto' }}>
150
+ <code>{code}</code>
151
+ </pre>
152
+ </div>
153
+ )
154
+ }
155
+
156
+ return (
157
+ <div className='code-block-wrapper'>
158
+ {!hideHeader && (<div className='code-block-header'>
159
+ <div className='code-lang-container'>
160
+ {getLangIcon(lang)}
161
+ <span className='code-lang'>{lang}</span>
162
+ </div>
163
+ <button
164
+ className='copy-button'
165
+ onClick={() => {
166
+ void handleCopy()
167
+ }}
168
+ >
169
+ <span className='material-symbols-rounded'>
170
+ {copied ? 'check' : 'content_copy'}
171
+ </span>
172
+ </button>
173
+ </div>)}
174
+ <div
175
+ dangerouslySetInnerHTML={{ __html: html }}
176
+ />
177
+ </div>
178
+ )
179
+ }
@@ -0,0 +1,70 @@
1
+ .completion-menu {
2
+ z-index: 1000;
3
+ position: absolute;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 100%;
7
+ margin-bottom: 8px;
8
+ background: white;
9
+ border: 1px solid #e5e7eb;
10
+ border-radius: 8px;
11
+ box-shadow:
12
+ 0 10px 15px -3px rgba(0, 0, 0, .1),
13
+ 0 4px 6px -2px rgba(0, 0, 0, .05);
14
+ overflow: hidden;
15
+
16
+ &-content {
17
+ max-height: 240px;
18
+ overflow-y: auto;
19
+ padding: 4px;
20
+ }
21
+
22
+ .completion-item {
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 8px;
26
+ padding: 8px 12px;
27
+ border-radius: 6px;
28
+ cursor: pointer;
29
+ transition: background-color .1s;
30
+
31
+ &:hover, &.active {
32
+ background-color: #eff6ff;
33
+ }
34
+
35
+ &.active {
36
+ .label {
37
+ color: #2563eb;
38
+ font-weight: 500;
39
+ }
40
+ }
41
+
42
+ .icon {
43
+ font-size: 18px;
44
+ color: #6b7280;
45
+ }
46
+
47
+ .item-info {
48
+ display: flex;
49
+ flex-direction: column;
50
+ flex: 1;
51
+ min-width: 0;
52
+
53
+ .label {
54
+ font-size: 13px;
55
+ color: #111827;
56
+ white-space: nowrap;
57
+ overflow: hidden;
58
+ text-overflow: ellipsis;
59
+ }
60
+
61
+ .description {
62
+ font-size: 11px;
63
+ color: #6b7280;
64
+ white-space: nowrap;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,58 @@
1
+ import './CompletionMenu.scss'
2
+ import React, { useEffect, useRef } from 'react'
3
+
4
+ export interface CompletionItem {
5
+ label: string
6
+ value: string
7
+ description?: string
8
+ icon?: string
9
+ }
10
+
11
+ interface CompletionMenuProps {
12
+ items: CompletionItem[]
13
+ onSelect: (item: CompletionItem) => void
14
+ onClose: () => void
15
+ selectedIndex: number
16
+ }
17
+
18
+ export function CompletionMenu({
19
+ items,
20
+ onSelect,
21
+ selectedIndex
22
+ }: CompletionMenuProps) {
23
+ const menuRef = useRef<HTMLDivElement>(null)
24
+
25
+ useEffect(() => {
26
+ const activeItem = menuRef.current?.querySelector('.active')
27
+ if (activeItem) {
28
+ activeItem.scrollIntoView({ block: 'nearest' })
29
+ }
30
+ }, [selectedIndex])
31
+
32
+ if (items.length === 0) return null
33
+
34
+ return (
35
+ <div
36
+ ref={menuRef}
37
+ className='completion-menu'
38
+ >
39
+ <div className='completion-menu-content'>
40
+ {items.map((item, index) => (
41
+ <div
42
+ key={item.value}
43
+ className={`completion-item ${index === selectedIndex ? 'active' : ''}`}
44
+ onClick={() => onSelect(item)}
45
+ >
46
+ {item.icon != null && item.icon !== '' &&
47
+ <span className='material-symbols-rounded icon'>{item.icon}</span>}
48
+ <div className='item-info'>
49
+ <span className='label'>{item.label}</span>
50
+ {item.description != null && item.description !== '' &&
51
+ <span className='description'>{item.description}</span>}
52
+ </div>
53
+ </div>
54
+ ))}
55
+ </div>
56
+ </div>
57
+ )
58
+ }
@@ -0,0 +1,217 @@
1
+ .current-todo-container {
2
+ position: relative;
3
+ margin: 12px 24px 0 24px;
4
+ z-index: 10;
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ &.empty {
9
+ opacity: .6;
10
+ .todo-progress-bar {
11
+ cursor: default;
12
+ background: #f9fafb;
13
+ box-shadow: none;
14
+ &:hover {
15
+ border-color: #e5e7eb;
16
+ }
17
+ .progress-info .material-symbols-rounded {
18
+ color: #9ca3af;
19
+ }
20
+ }
21
+ }
22
+
23
+ .todo-progress-bar {
24
+ background: white;
25
+ border: 1px solid #e5e7eb;
26
+ border-radius: 8px;
27
+ padding: 8px 16px;
28
+ display: flex;
29
+ align-items: center;
30
+ gap: 12px;
31
+ box-shadow: 0 2px 4px -1px rgba(0, 0, 0, .06);
32
+ cursor: pointer;
33
+ transition: all .2s ease;
34
+
35
+ &:hover {
36
+ border-color: #3b82f6;
37
+ }
38
+
39
+ .progress-info {
40
+ display: flex;
41
+ align-items: center;
42
+ gap: 8px;
43
+ flex-shrink: 0;
44
+
45
+ .material-symbols-rounded {
46
+ font-size: 20px;
47
+ color: #3b82f6;
48
+ }
49
+
50
+ .text {
51
+ font-size: 13px;
52
+ font-weight: 500;
53
+ color: #374151;
54
+ }
55
+ }
56
+
57
+ .progress-track {
58
+ flex: 1;
59
+ height: 6px;
60
+ background: #f3f4f6;
61
+ border-radius: 3px;
62
+ overflow: hidden;
63
+
64
+ .progress-fill {
65
+ height: 100%;
66
+ background: #3b82f6;
67
+ transition: width .3s ease;
68
+ }
69
+ }
70
+
71
+ .expand-btn {
72
+ background: none;
73
+ border: none;
74
+ padding: 0;
75
+ cursor: pointer;
76
+ color: #9ca3af;
77
+ display: flex;
78
+ align-items: center;
79
+
80
+ &:hover {
81
+ color: #374151;
82
+ }
83
+ }
84
+ }
85
+
86
+ .todo-items-overlay {
87
+ position: absolute;
88
+ bottom: calc(100% + 8px);
89
+ left: 0;
90
+ right: 0;
91
+ background: white;
92
+ border: 1px solid #e5e7eb;
93
+ border-radius: 8px;
94
+ box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
95
+ animation: slideUp .3s cubic-bezier(.4, 0, .2, 1);
96
+ overflow: hidden;
97
+ z-index: 100;
98
+
99
+ .todo-items-scroll-container {
100
+ max-height: calc(36px * 8);
101
+ overflow-y: auto;
102
+ padding: 8px 0;
103
+
104
+ .todo-item-vertical {
105
+ display: flex;
106
+ align-items: flex-start;
107
+ gap: 10px;
108
+ padding: 8px 16px;
109
+ transition: background-color .2s;
110
+
111
+ &:hover {
112
+ background-color: #f9fafb;
113
+ }
114
+
115
+ .icon {
116
+ font-size: 18px;
117
+ margin-top: 1px;
118
+ flex-shrink: 0;
119
+ }
120
+
121
+ &.status-completed {
122
+ opacity: .6;
123
+ .icon {
124
+ color: #10b981;
125
+ }
126
+ .text {
127
+ text-decoration: line-through;
128
+ }
129
+ }
130
+
131
+ &.status-in_progress {
132
+ .icon {
133
+ color: #3b82f6;
134
+ animation: spin 2s linear infinite;
135
+ }
136
+ .text {
137
+ color: #111827;
138
+ font-weight: 500;
139
+ }
140
+ }
141
+
142
+ &.status-pending {
143
+ .icon {
144
+ color: #9ca3af;
145
+ }
146
+ .text {
147
+ color: #4b5563;
148
+ }
149
+ }
150
+
151
+ .todo-content-wrapper {
152
+ flex: 1;
153
+ display: flex;
154
+ align-items: center;
155
+ gap: 8px;
156
+
157
+ .text {
158
+ font-size: 13px;
159
+ line-height: 1.5;
160
+ }
161
+
162
+ .priority-tag {
163
+ font-size: 10px;
164
+ padding: 1px 4px;
165
+ border-radius: 4px;
166
+ text-transform: uppercase;
167
+ font-weight: 600;
168
+
169
+ &.high {
170
+ background: #fee2e2;
171
+ color: #ef4444;
172
+ }
173
+ &.medium {
174
+ background: #fef3c7;
175
+ color: #d97706;
176
+ }
177
+ &.low {
178
+ background: #d1fae5;
179
+ color: #10b981;
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }
186
+ }
187
+
188
+ @keyframes slideDown {
189
+ from {
190
+ opacity: 0;
191
+ transform: translateY(-10px);
192
+ }
193
+ to {
194
+ opacity: 1;
195
+ transform: translateY(0);
196
+ }
197
+ }
198
+
199
+ @keyframes slideUp {
200
+ from {
201
+ opacity: 0;
202
+ transform: translateY(10px);
203
+ }
204
+ to {
205
+ opacity: 1;
206
+ transform: translateY(0);
207
+ }
208
+ }
209
+
210
+ @keyframes spin {
211
+ from {
212
+ transform: rotate(0deg);
213
+ }
214
+ to {
215
+ transform: rotate(360deg);
216
+ }
217
+ }
@@ -0,0 +1,103 @@
1
+ import './CurrentTodoList.scss'
2
+ import type { ChatMessage } from '@vibe-forge/core'
3
+ import React, { useState } from 'react'
4
+ import { useTranslation } from 'react-i18next'
5
+
6
+ interface TodoItem {
7
+ id: string
8
+ content: string
9
+ status: 'pending' | 'in_progress' | 'completed'
10
+ priority: string
11
+ }
12
+
13
+ export function CurrentTodoList({ messages }: { messages: ChatMessage[] }) {
14
+ const { t } = useTranslation()
15
+ const [isExpanded, setIsExpanded] = useState(false)
16
+
17
+ // Find the latest TodoWrite tool use
18
+ let latestTodos: TodoItem[] = []
19
+
20
+ for (let i = messages.length - 1; i >= 0; i--) {
21
+ const msg = messages[i]
22
+ if (msg.role === 'assistant' && Array.isArray(msg.content)) {
23
+ const todoUse = msg.content.find(c =>
24
+ c != null && c.type === 'tool_use' && (c.name === 'TodoWrite' || c.name === 'todo_write')
25
+ )
26
+ if (
27
+ todoUse != null && todoUse.type === 'tool_use' && todoUse.input != null && typeof todoUse.input === 'object'
28
+ ) {
29
+ const input = todoUse.input as { todos?: TodoItem[] }
30
+ if (Array.isArray(input.todos)) {
31
+ latestTodos = input.todos
32
+ break
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ if (latestTodos.length === 0) return null
39
+
40
+ const completedCount = latestTodos.filter(t => t.status === 'completed').length
41
+ const totalCount = latestTodos.length
42
+
43
+ if (totalCount === 0) {
44
+ return (
45
+ <div className='current-todo-container empty'>
46
+ <div className='todo-progress-bar empty'>
47
+ <div className='progress-info'>
48
+ <span className='material-symbols-rounded'>assignment_late</span>
49
+ <span className='text'>{t('chat.todo.noTasks')}</span>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ )
54
+ }
55
+
56
+ return (
57
+ <div className={`current-todo-container ${isExpanded ? 'expanded' : ''}`}>
58
+ <div className='todo-progress-bar' onClick={() => setIsExpanded(!isExpanded)}>
59
+ <div className='progress-info'>
60
+ <span className='material-symbols-rounded'>assignment</span>
61
+ <span className='text'>{t('chat.todo.progress', { completed: completedCount, total: totalCount })}</span>
62
+ </div>
63
+ <div className='progress-track'>
64
+ <div
65
+ className='progress-fill'
66
+ style={{ width: `${(completedCount / totalCount) * 100}%` }}
67
+ />
68
+ </div>
69
+ <button className='expand-btn'>
70
+ <span className='material-symbols-rounded'>
71
+ {isExpanded ? 'expand_more' : 'expand_less'}
72
+ </span>
73
+ </button>
74
+ </div>
75
+
76
+ {isExpanded && (
77
+ <div className='todo-items-overlay'>
78
+ <div className='todo-items-scroll-container'>
79
+ {latestTodos.map((todo, idx) => (
80
+ <div
81
+ key={todo.id || idx}
82
+ className={`todo-item-vertical status-${todo.status}`}
83
+ >
84
+ <span className='material-symbols-rounded icon'>
85
+ {todo.status === 'completed'
86
+ ? 'check_circle'
87
+ : todo.status === 'in_progress'
88
+ ? 'clock_loader_40'
89
+ : 'radio_button_unchecked'}
90
+ </span>
91
+ <div className='todo-content-wrapper'>
92
+ <span className='text'>{todo.content}</span>
93
+ {todo.priority != null && todo.priority !== '' &&
94
+ <span className={`priority-tag ${todo.priority}`}>{todo.priority}</span>}
95
+ </div>
96
+ </div>
97
+ ))}
98
+ </div>
99
+ </div>
100
+ )}
101
+ </div>
102
+ )
103
+ }