bingocode 1.0.3 → 1.0.5
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/package.json +3 -7
- package/desktop/README.md +0 -30
- package/desktop/bunfig.toml +0 -1
- package/desktop/index.html +0 -17
- package/desktop/package.json +0 -55
- package/desktop/pnpm-lock.yaml +0 -3832
- package/desktop/public/app-icon.jpg +0 -0
- package/desktop/public/fonts/inter-latin-ext.woff2 +0 -0
- package/desktop/public/fonts/inter-latin.woff2 +0 -0
- package/desktop/public/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/desktop/public/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/desktop/public/fonts/manrope-latin-ext.woff2 +0 -0
- package/desktop/public/fonts/manrope-latin.woff2 +0 -0
- package/desktop/public/fonts/material-symbols-outlined.woff2 +0 -0
- package/desktop/public/icons/bilibili.svg +0 -1
- package/desktop/public/icons/douyin.svg +0 -1
- package/desktop/public/icons/github.svg +0 -3
- package/desktop/public/icons/xiaohongshu.svg +0 -1
- package/desktop/scripts/build-macos-arm64.sh +0 -270
- package/desktop/scripts/build-sidecars.ts +0 -183
- package/desktop/scripts/build-windows-x64.ps1 +0 -295
- package/desktop/scripts/scan-missing-imports.ts +0 -235
- package/desktop/sidecars/claude-sidecar.ts +0 -156
- package/desktop/src/App.tsx +0 -5
- package/desktop/src/__tests__/agentsSettings.test.tsx +0 -349
- package/desktop/src/__tests__/pages.test.tsx +0 -290
- package/desktop/src/__tests__/skillsSettings.test.tsx +0 -205
- package/desktop/src/api/adapters.ts +0 -12
- package/desktop/src/api/agents.ts +0 -36
- package/desktop/src/api/cliTasks.ts +0 -28
- package/desktop/src/api/client.ts +0 -63
- package/desktop/src/api/computerUse.ts +0 -76
- package/desktop/src/api/filesystem.ts +0 -30
- package/desktop/src/api/hahaOAuth.ts +0 -38
- package/desktop/src/api/models.ts +0 -28
- package/desktop/src/api/providers.ts +0 -63
- package/desktop/src/api/search.ts +0 -29
- package/desktop/src/api/sessions.ts +0 -56
- package/desktop/src/api/settings.ts +0 -20
- package/desktop/src/api/skills.ts +0 -19
- package/desktop/src/api/tasks.ts +0 -36
- package/desktop/src/api/teams.ts +0 -44
- package/desktop/src/api/websocket.ts +0 -164
- package/desktop/src/components/chat/AskUserQuestion.tsx +0 -268
- package/desktop/src/components/chat/AssistantMessage.tsx +0 -29
- package/desktop/src/components/chat/AttachmentGallery.tsx +0 -113
- package/desktop/src/components/chat/ChatInput.tsx +0 -622
- package/desktop/src/components/chat/CodeViewer.tsx +0 -161
- package/desktop/src/components/chat/ComputerUsePermissionModal.test.tsx +0 -174
- package/desktop/src/components/chat/ComputerUsePermissionModal.tsx +0 -311
- package/desktop/src/components/chat/DiffViewer.tsx +0 -157
- package/desktop/src/components/chat/FileSearchMenu.tsx +0 -198
- package/desktop/src/components/chat/ImageGalleryModal.tsx +0 -91
- package/desktop/src/components/chat/InlineImageGallery.tsx +0 -106
- package/desktop/src/components/chat/InlineTaskSummary.tsx +0 -60
- package/desktop/src/components/chat/MermaidRenderer.test.tsx +0 -98
- package/desktop/src/components/chat/MermaidRenderer.tsx +0 -361
- package/desktop/src/components/chat/MessageActionBar.tsx +0 -27
- package/desktop/src/components/chat/MessageList.test.tsx +0 -313
- package/desktop/src/components/chat/MessageList.tsx +0 -249
- package/desktop/src/components/chat/PermissionDialog.tsx +0 -262
- package/desktop/src/components/chat/SessionTaskBar.test.tsx +0 -99
- package/desktop/src/components/chat/SessionTaskBar.tsx +0 -159
- package/desktop/src/components/chat/StreamingIndicator.tsx +0 -41
- package/desktop/src/components/chat/TerminalChrome.tsx +0 -35
- package/desktop/src/components/chat/ThinkingBlock.tsx +0 -87
- package/desktop/src/components/chat/ToolCallBlock.tsx +0 -247
- package/desktop/src/components/chat/ToolCallGroup.tsx +0 -617
- package/desktop/src/components/chat/ToolResultBlock.tsx +0 -107
- package/desktop/src/components/chat/UserMessage.tsx +0 -38
- package/desktop/src/components/chat/chatBlocks.test.tsx +0 -136
- package/desktop/src/components/chat/clipboard.ts +0 -25
- package/desktop/src/components/chat/composerUtils.test.ts +0 -55
- package/desktop/src/components/chat/composerUtils.ts +0 -149
- package/desktop/src/components/controls/ModelSelector.tsx +0 -156
- package/desktop/src/components/controls/PermissionModeSelector.tsx +0 -229
- package/desktop/src/components/layout/AppShell.tsx +0 -107
- package/desktop/src/components/layout/ContentRouter.tsx +0 -27
- package/desktop/src/components/layout/ProjectFilter.tsx +0 -126
- package/desktop/src/components/layout/Sidebar.test.tsx +0 -158
- package/desktop/src/components/layout/Sidebar.tsx +0 -384
- package/desktop/src/components/layout/StatusBar.tsx +0 -31
- package/desktop/src/components/layout/TabBar.test.tsx +0 -136
- package/desktop/src/components/layout/TabBar.tsx +0 -318
- package/desktop/src/components/layout/TitleBar.tsx +0 -96
- package/desktop/src/components/layout/WindowControls.test.tsx +0 -69
- package/desktop/src/components/layout/WindowControls.tsx +0 -89
- package/desktop/src/components/markdown/MarkdownRenderer.test.tsx +0 -100
- package/desktop/src/components/markdown/MarkdownRenderer.tsx +0 -229
- package/desktop/src/components/settings/ClaudeOfficialLogin.tsx +0 -107
- package/desktop/src/components/shared/Button.tsx +0 -63
- package/desktop/src/components/shared/CopyButton.tsx +0 -58
- package/desktop/src/components/shared/DirectoryPicker.tsx +0 -316
- package/desktop/src/components/shared/Dropdown.tsx +0 -91
- package/desktop/src/components/shared/Input.tsx +0 -38
- package/desktop/src/components/shared/Modal.tsx +0 -65
- package/desktop/src/components/shared/ProjectContextChip.tsx +0 -30
- package/desktop/src/components/shared/Spinner.tsx +0 -30
- package/desktop/src/components/shared/Textarea.tsx +0 -38
- package/desktop/src/components/shared/Toast.tsx +0 -47
- package/desktop/src/components/shared/UpdateChecker.tsx +0 -90
- package/desktop/src/components/skills/SkillDetail.test.tsx +0 -89
- package/desktop/src/components/skills/SkillDetail.tsx +0 -403
- package/desktop/src/components/skills/SkillList.tsx +0 -254
- package/desktop/src/components/tasks/DayOfWeekPicker.tsx +0 -57
- package/desktop/src/components/tasks/NewTaskModal.tsx +0 -407
- package/desktop/src/components/tasks/PromptEditor.tsx +0 -74
- package/desktop/src/components/tasks/TaskEmptyState.tsx +0 -30
- package/desktop/src/components/tasks/TaskList.tsx +0 -46
- package/desktop/src/components/tasks/TaskRow.tsx +0 -253
- package/desktop/src/components/tasks/TaskRunsPanel.tsx +0 -195
- package/desktop/src/components/teams/TeamStatusBar.tsx +0 -147
- package/desktop/src/config/providerPresets.ts +0 -78
- package/desktop/src/config/spinnerVerbs.ts +0 -193
- package/desktop/src/hooks/useKeyboardShortcuts.ts +0 -60
- package/desktop/src/i18n/index.ts +0 -54
- package/desktop/src/i18n/locales/en.ts +0 -670
- package/desktop/src/i18n/locales/zh.ts +0 -670
- package/desktop/src/lib/__tests__/cronDescribe.test.ts +0 -93
- package/desktop/src/lib/cronDescribe.ts +0 -188
- package/desktop/src/lib/desktopRuntime.ts +0 -54
- package/desktop/src/lib/parseRunOutput.ts +0 -79
- package/desktop/src/main.tsx +0 -13
- package/desktop/src/mocks/data.ts +0 -202
- package/desktop/src/pages/ActiveSession.test.tsx +0 -181
- package/desktop/src/pages/ActiveSession.tsx +0 -219
- package/desktop/src/pages/AdapterSettings.tsx +0 -375
- package/desktop/src/pages/AgentTeams.tsx +0 -200
- package/desktop/src/pages/ComputerUseSettings.tsx +0 -420
- package/desktop/src/pages/EmptySession.tsx +0 -518
- package/desktop/src/pages/NewTaskModal.tsx +0 -346
- package/desktop/src/pages/ScheduledTasks.tsx +0 -66
- package/desktop/src/pages/ScheduledTasksEmpty.tsx +0 -152
- package/desktop/src/pages/ScheduledTasksList.tsx +0 -416
- package/desktop/src/pages/SessionControls.tsx +0 -460
- package/desktop/src/pages/Settings.tsx +0 -1448
- package/desktop/src/pages/ToolInspection.tsx +0 -235
- package/desktop/src/stores/adapterStore.ts +0 -106
- package/desktop/src/stores/agentStore.ts +0 -34
- package/desktop/src/stores/chatStore.test.ts +0 -505
- package/desktop/src/stores/chatStore.ts +0 -850
- package/desktop/src/stores/cliTaskStore.ts +0 -152
- package/desktop/src/stores/hahaOAuthStore.test.ts +0 -77
- package/desktop/src/stores/hahaOAuthStore.ts +0 -97
- package/desktop/src/stores/providerStore.ts +0 -101
- package/desktop/src/stores/sessionStore.test.ts +0 -63
- package/desktop/src/stores/sessionStore.ts +0 -102
- package/desktop/src/stores/settingsStore.ts +0 -120
- package/desktop/src/stores/skillStore.ts +0 -51
- package/desktop/src/stores/tabStore.ts +0 -169
- package/desktop/src/stores/taskStore.ts +0 -68
- package/desktop/src/stores/teamStore.ts +0 -344
- package/desktop/src/stores/uiStore.ts +0 -100
- package/desktop/src/stores/updateStore.test.ts +0 -71
- package/desktop/src/stores/updateStore.ts +0 -221
- package/desktop/src/theme/globals.css +0 -465
- package/desktop/src/types/adapter.ts +0 -33
- package/desktop/src/types/chat.ts +0 -152
- package/desktop/src/types/cliTask.ts +0 -24
- package/desktop/src/types/provider.ts +0 -62
- package/desktop/src/types/session.ts +0 -27
- package/desktop/src/types/settings.ts +0 -22
- package/desktop/src/types/skill.ts +0 -38
- package/desktop/src/types/task.ts +0 -56
- package/desktop/src/types/team.ts +0 -38
- package/desktop/src-tauri/Cargo.lock +0 -5549
- package/desktop/src-tauri/Cargo.toml +0 -20
- package/desktop/src-tauri/app-icon.svg +0 -13
- package/desktop/src-tauri/build.rs +0 -3
- package/desktop/src-tauri/capabilities/default.json +0 -106
- package/desktop/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml +0 -5
- package/desktop/src-tauri/icons/android/values/ic_launcher_background.xml +0 -4
- package/desktop/src-tauri/icons/icon.icns +0 -0
- package/desktop/src-tauri/icons/icon.ico +0 -0
- package/desktop/src-tauri/src/lib.rs +0 -408
- package/desktop/src-tauri/src/main.rs +0 -6
- package/desktop/src-tauri/tauri.conf.json +0 -78
- package/desktop/src-tauri/tauri.macos.conf.json +0 -18
- package/desktop/src-tauri/tauri.release-ci.json +0 -5
- package/desktop/src-tauri/tauri.windows.conf.json +0 -16
- package/desktop/src-tauri/windows-installer-hooks.nsh +0 -17
- package/desktop/tsconfig.json +0 -25
- package/desktop/vite.config.ts +0 -26
- package/desktop/vitest.config.ts +0 -18
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
-
import { render } from '@testing-library/react'
|
|
3
|
-
import '@testing-library/jest-dom'
|
|
4
|
-
import { act } from 'react'
|
|
5
|
-
|
|
6
|
-
vi.mock('../components/chat/MessageList', () => ({
|
|
7
|
-
MessageList: () => <div data-testid="message-list" />,
|
|
8
|
-
}))
|
|
9
|
-
|
|
10
|
-
vi.mock('../components/chat/ChatInput', () => ({
|
|
11
|
-
ChatInput: () => <div data-testid="chat-input" />,
|
|
12
|
-
}))
|
|
13
|
-
|
|
14
|
-
vi.mock('../components/teams/TeamStatusBar', () => ({
|
|
15
|
-
TeamStatusBar: () => <div data-testid="team-status-bar" />,
|
|
16
|
-
}))
|
|
17
|
-
|
|
18
|
-
vi.mock('../components/chat/SessionTaskBar', () => ({
|
|
19
|
-
SessionTaskBar: () => <div data-testid="session-task-bar" />,
|
|
20
|
-
}))
|
|
21
|
-
|
|
22
|
-
import { ActiveSession } from './ActiveSession'
|
|
23
|
-
import { useChatStore } from '../stores/chatStore'
|
|
24
|
-
import { useCLITaskStore } from '../stores/cliTaskStore'
|
|
25
|
-
import { useSessionStore } from '../stores/sessionStore'
|
|
26
|
-
import { useTabStore } from '../stores/tabStore'
|
|
27
|
-
import { useTeamStore } from '../stores/teamStore'
|
|
28
|
-
|
|
29
|
-
afterEach(() => {
|
|
30
|
-
vi.useRealTimers()
|
|
31
|
-
useTabStore.setState({ tabs: [], activeTabId: null })
|
|
32
|
-
useSessionStore.setState({ sessions: [], activeSessionId: null, isLoading: false, error: null })
|
|
33
|
-
useChatStore.setState({ sessions: {} })
|
|
34
|
-
useTeamStore.setState({ teams: [], activeTeam: null, memberColors: new Map(), error: null })
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
describe('ActiveSession task polling', () => {
|
|
38
|
-
it('refreshes CLI tasks repeatedly while a turn is active', async () => {
|
|
39
|
-
vi.useFakeTimers()
|
|
40
|
-
|
|
41
|
-
const sessionId = 'polling-session'
|
|
42
|
-
const originalCliTaskState = useCLITaskStore.getState()
|
|
43
|
-
const fetchSessionTasks = vi.fn().mockResolvedValue(undefined)
|
|
44
|
-
|
|
45
|
-
useCLITaskStore.setState({
|
|
46
|
-
sessionId,
|
|
47
|
-
tasks: [],
|
|
48
|
-
fetchSessionTasks,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
useSessionStore.setState({
|
|
52
|
-
sessions: [{
|
|
53
|
-
id: sessionId,
|
|
54
|
-
title: 'Polling Session',
|
|
55
|
-
createdAt: '2026-04-10T00:00:00.000Z',
|
|
56
|
-
modifiedAt: '2026-04-10T00:00:00.000Z',
|
|
57
|
-
messageCount: 1,
|
|
58
|
-
projectPath: '',
|
|
59
|
-
workDir: null,
|
|
60
|
-
workDirExists: true,
|
|
61
|
-
}],
|
|
62
|
-
activeSessionId: sessionId,
|
|
63
|
-
isLoading: false,
|
|
64
|
-
error: null,
|
|
65
|
-
})
|
|
66
|
-
useTabStore.setState({
|
|
67
|
-
tabs: [{ sessionId, title: 'Polling Session', type: 'session', status: 'idle' }],
|
|
68
|
-
activeTabId: sessionId,
|
|
69
|
-
})
|
|
70
|
-
useChatStore.setState({
|
|
71
|
-
sessions: {
|
|
72
|
-
[sessionId]: {
|
|
73
|
-
messages: [],
|
|
74
|
-
chatState: 'thinking',
|
|
75
|
-
connectionState: 'connected',
|
|
76
|
-
streamingText: '',
|
|
77
|
-
streamingToolInput: '',
|
|
78
|
-
activeToolUseId: null,
|
|
79
|
-
activeToolName: null,
|
|
80
|
-
activeThinkingId: null,
|
|
81
|
-
pendingPermission: null,
|
|
82
|
-
pendingComputerUsePermission: null,
|
|
83
|
-
tokenUsage: { input_tokens: 0, output_tokens: 0 },
|
|
84
|
-
elapsedSeconds: 0,
|
|
85
|
-
statusVerb: '',
|
|
86
|
-
slashCommands: [],
|
|
87
|
-
agentTaskNotifications: {},
|
|
88
|
-
elapsedTimer: null,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
const { unmount } = render(<ActiveSession />)
|
|
94
|
-
|
|
95
|
-
expect(fetchSessionTasks).toHaveBeenCalledWith(sessionId)
|
|
96
|
-
|
|
97
|
-
await act(async () => {
|
|
98
|
-
await vi.advanceTimersByTimeAsync(2200)
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
expect(
|
|
102
|
-
fetchSessionTasks.mock.calls.filter(([currentSessionId]) => currentSessionId === sessionId),
|
|
103
|
-
).toHaveLength(3)
|
|
104
|
-
|
|
105
|
-
unmount()
|
|
106
|
-
useCLITaskStore.setState(originalCliTaskState)
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
it('keeps member sessions interactive and skips leader task polling', () => {
|
|
110
|
-
const memberSessionId = 'team-member:security-reviewer@test-team'
|
|
111
|
-
const originalCliTaskState = useCLITaskStore.getState()
|
|
112
|
-
const fetchSessionTasks = vi.fn().mockResolvedValue(undefined)
|
|
113
|
-
|
|
114
|
-
useCLITaskStore.setState({
|
|
115
|
-
sessionId: null,
|
|
116
|
-
tasks: [],
|
|
117
|
-
fetchSessionTasks,
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
useTeamStore.setState({
|
|
121
|
-
teams: [],
|
|
122
|
-
activeTeam: {
|
|
123
|
-
name: 'test-team',
|
|
124
|
-
leadAgentId: 'team-lead@test-team',
|
|
125
|
-
leadSessionId: 'leader-session',
|
|
126
|
-
members: [
|
|
127
|
-
{
|
|
128
|
-
agentId: 'team-lead@test-team',
|
|
129
|
-
role: 'team-lead',
|
|
130
|
-
status: 'running',
|
|
131
|
-
sessionId: 'leader-session',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
agentId: 'security-reviewer@test-team',
|
|
135
|
-
role: 'security-reviewer',
|
|
136
|
-
status: 'running',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
memberColors: new Map(),
|
|
141
|
-
error: null,
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
useTabStore.setState({
|
|
145
|
-
tabs: [{ sessionId: memberSessionId, title: 'security-reviewer', type: 'session', status: 'idle' }],
|
|
146
|
-
activeTabId: memberSessionId,
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
useChatStore.setState({
|
|
150
|
-
sessions: {
|
|
151
|
-
[memberSessionId]: {
|
|
152
|
-
messages: [],
|
|
153
|
-
chatState: 'thinking',
|
|
154
|
-
connectionState: 'connected',
|
|
155
|
-
streamingText: '',
|
|
156
|
-
streamingToolInput: '',
|
|
157
|
-
activeToolUseId: null,
|
|
158
|
-
activeToolName: null,
|
|
159
|
-
activeThinkingId: null,
|
|
160
|
-
pendingPermission: null,
|
|
161
|
-
pendingComputerUsePermission: null,
|
|
162
|
-
tokenUsage: { input_tokens: 0, output_tokens: 0 },
|
|
163
|
-
elapsedSeconds: 0,
|
|
164
|
-
statusVerb: '',
|
|
165
|
-
slashCommands: [],
|
|
166
|
-
agentTaskNotifications: {},
|
|
167
|
-
elapsedTimer: null,
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
const { queryByTestId, unmount } = render(<ActiveSession />)
|
|
173
|
-
|
|
174
|
-
expect(queryByTestId('chat-input')).toBeInTheDocument()
|
|
175
|
-
expect(queryByTestId('session-task-bar')).not.toBeInTheDocument()
|
|
176
|
-
expect(fetchSessionTasks).not.toHaveBeenCalled()
|
|
177
|
-
|
|
178
|
-
unmount()
|
|
179
|
-
useCLITaskStore.setState(originalCliTaskState)
|
|
180
|
-
})
|
|
181
|
-
})
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo } from 'react'
|
|
2
|
-
import { useTabStore } from '../stores/tabStore'
|
|
3
|
-
import { useSessionStore } from '../stores/sessionStore'
|
|
4
|
-
import { useChatStore } from '../stores/chatStore'
|
|
5
|
-
import { useCLITaskStore } from '../stores/cliTaskStore'
|
|
6
|
-
import { useTeamStore } from '../stores/teamStore'
|
|
7
|
-
import { useTranslation } from '../i18n'
|
|
8
|
-
import { MessageList } from '../components/chat/MessageList'
|
|
9
|
-
import { ChatInput } from '../components/chat/ChatInput'
|
|
10
|
-
import { ComputerUsePermissionModal } from '../components/chat/ComputerUsePermissionModal'
|
|
11
|
-
import { TeamStatusBar } from '../components/teams/TeamStatusBar'
|
|
12
|
-
import { SessionTaskBar } from '../components/chat/SessionTaskBar'
|
|
13
|
-
|
|
14
|
-
const TASK_POLL_INTERVAL_MS = 1000
|
|
15
|
-
|
|
16
|
-
export function ActiveSession() {
|
|
17
|
-
const activeTabId = useTabStore((s) => s.activeTabId)
|
|
18
|
-
const sessions = useSessionStore((s) => s.sessions)
|
|
19
|
-
const connectToSession = useChatStore((s) => s.connectToSession)
|
|
20
|
-
const sessionState = useChatStore((s) => activeTabId ? s.sessions[activeTabId] : undefined)
|
|
21
|
-
const pendingComputerUsePermission = sessionState?.pendingComputerUsePermission ?? null
|
|
22
|
-
const fetchSessionTasks = useCLITaskStore((s) => s.fetchSessionTasks)
|
|
23
|
-
const trackedTaskSessionId = useCLITaskStore((s) => s.sessionId)
|
|
24
|
-
const hasIncompleteTasks = useCLITaskStore((s) => s.tasks.some((task) => task.status !== 'completed'))
|
|
25
|
-
const chatState = sessionState?.chatState ?? 'idle'
|
|
26
|
-
const tokenUsage = sessionState?.tokenUsage ?? { input_tokens: 0, output_tokens: 0 }
|
|
27
|
-
|
|
28
|
-
const session = sessions.find((s) => s.id === activeTabId)
|
|
29
|
-
const memberInfo = useTeamStore((s) => activeTabId ? s.getMemberBySessionId(activeTabId) : null)
|
|
30
|
-
const activeTeam = useTeamStore((s) => s.activeTeam)
|
|
31
|
-
const isMemberSession = !!memberInfo
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
if (activeTabId && !isMemberSession) {
|
|
35
|
-
connectToSession(activeTabId)
|
|
36
|
-
}
|
|
37
|
-
}, [activeTabId, isMemberSession, connectToSession])
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (!activeTabId || isMemberSession) return
|
|
41
|
-
|
|
42
|
-
const shouldPollTasks =
|
|
43
|
-
chatState !== 'idle' ||
|
|
44
|
-
(trackedTaskSessionId === activeTabId && hasIncompleteTasks)
|
|
45
|
-
|
|
46
|
-
if (!shouldPollTasks) return
|
|
47
|
-
|
|
48
|
-
void fetchSessionTasks(activeTabId)
|
|
49
|
-
|
|
50
|
-
const timer = setInterval(() => {
|
|
51
|
-
void fetchSessionTasks(activeTabId)
|
|
52
|
-
}, TASK_POLL_INTERVAL_MS)
|
|
53
|
-
|
|
54
|
-
return () => clearInterval(timer)
|
|
55
|
-
}, [
|
|
56
|
-
activeTabId,
|
|
57
|
-
isMemberSession,
|
|
58
|
-
chatState,
|
|
59
|
-
trackedTaskSessionId,
|
|
60
|
-
hasIncompleteTasks,
|
|
61
|
-
fetchSessionTasks,
|
|
62
|
-
])
|
|
63
|
-
|
|
64
|
-
const t = useTranslation()
|
|
65
|
-
const messages = sessionState?.messages ?? []
|
|
66
|
-
const streamingText = sessionState?.streamingText ?? ''
|
|
67
|
-
const isEmpty = messages.length === 0 && !streamingText
|
|
68
|
-
|
|
69
|
-
const isActive = chatState !== 'idle'
|
|
70
|
-
const totalTokens = tokenUsage.input_tokens + tokenUsage.output_tokens
|
|
71
|
-
|
|
72
|
-
const lastUpdated = useMemo(() => {
|
|
73
|
-
if (!session?.modifiedAt) return ''
|
|
74
|
-
const diff = Date.now() - new Date(session.modifiedAt).getTime()
|
|
75
|
-
if (diff < 60000) return t('session.timeJustNow')
|
|
76
|
-
if (diff < 3600000) return t('session.timeMinutes', { n: Math.floor(diff / 60000) })
|
|
77
|
-
if (diff < 86400000) return t('session.timeHours', { n: Math.floor(diff / 3600000) })
|
|
78
|
-
return t('session.timeDays', { n: Math.floor(diff / 86400000) })
|
|
79
|
-
}, [session?.modifiedAt, t])
|
|
80
|
-
|
|
81
|
-
if (!activeTabId) return null
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<div className="flex-1 flex flex-col relative overflow-hidden bg-background text-on-surface">
|
|
85
|
-
{isMemberSession && (
|
|
86
|
-
<div className="shrink-0 border-b border-[var(--color-border)] bg-[var(--color-surface-container)]">
|
|
87
|
-
<div className="mx-auto max-w-[860px] flex items-center justify-between gap-4 px-8 py-2">
|
|
88
|
-
<div className="min-w-0">
|
|
89
|
-
<div className="flex items-center gap-3">
|
|
90
|
-
{memberInfo?.status === 'running' && (
|
|
91
|
-
<span className="flex h-2 w-2 rounded-full bg-[var(--color-warning)] animate-pulse-dot" />
|
|
92
|
-
)}
|
|
93
|
-
{memberInfo?.status === 'completed' && (
|
|
94
|
-
<span className="material-symbols-outlined text-[14px] text-[var(--color-success)]" style={{ fontVariationSettings: "'FILL' 1" }}>check_circle</span>
|
|
95
|
-
)}
|
|
96
|
-
<span className="material-symbols-outlined text-[14px] text-[var(--color-text-tertiary)]">smart_toy</span>
|
|
97
|
-
<span className="text-sm font-semibold text-[var(--color-text-primary)]">
|
|
98
|
-
{memberInfo?.role}
|
|
99
|
-
</span>
|
|
100
|
-
{activeTeam && (
|
|
101
|
-
<span className="text-[10px] text-[var(--color-text-tertiary)]">
|
|
102
|
-
@ {activeTeam.name}
|
|
103
|
-
</span>
|
|
104
|
-
)}
|
|
105
|
-
</div>
|
|
106
|
-
<p className="mt-1 text-[11px] text-[var(--color-text-tertiary)]">
|
|
107
|
-
{t('teams.memberSessionHint')}
|
|
108
|
-
</p>
|
|
109
|
-
</div>
|
|
110
|
-
<button
|
|
111
|
-
onClick={() => {
|
|
112
|
-
if (activeTeam?.leadSessionId) {
|
|
113
|
-
useTabStore.getState().openTab(
|
|
114
|
-
activeTeam.leadSessionId,
|
|
115
|
-
t('teams.leader'),
|
|
116
|
-
'session',
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
}}
|
|
120
|
-
disabled={!activeTeam?.leadSessionId}
|
|
121
|
-
className="flex shrink-0 items-center gap-1 text-xs font-medium text-[var(--color-text-secondary)] hover:text-[var(--color-text-primary)] transition-colors disabled:opacity-50 disabled:hover:text-[var(--color-text-secondary)]"
|
|
122
|
-
>
|
|
123
|
-
<span className="material-symbols-outlined text-[14px]">arrow_back</span>
|
|
124
|
-
{t('teams.backToLeader')}
|
|
125
|
-
</button>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
)}
|
|
129
|
-
|
|
130
|
-
{isEmpty ? (
|
|
131
|
-
<div className="flex flex-1 flex-col items-center justify-center p-8 pb-32">
|
|
132
|
-
<div className="flex max-w-md flex-col items-center text-center">
|
|
133
|
-
{isMemberSession ? (
|
|
134
|
-
<>
|
|
135
|
-
<span className="material-symbols-outlined text-[48px] mb-4 text-[var(--color-text-tertiary)]">smart_toy</span>
|
|
136
|
-
<p className="text-[var(--color-text-secondary)]">
|
|
137
|
-
{memberInfo?.status === 'running'
|
|
138
|
-
? `${memberInfo.role} ${t('teams.working')}`
|
|
139
|
-
: t('teams.noMessages')}
|
|
140
|
-
</p>
|
|
141
|
-
</>
|
|
142
|
-
) : (
|
|
143
|
-
<>
|
|
144
|
-
<img src="/app-icon.jpg" alt="Claude Code Haha" className="mb-6 h-24 w-24 rounded-[22px]" style={{ boxShadow: 'var(--shadow-dropdown)' }} />
|
|
145
|
-
<h1 className="mb-2 text-3xl font-extrabold tracking-tight text-[var(--color-text-primary)]" style={{ fontFamily: 'var(--font-headline)' }}>
|
|
146
|
-
{t('empty.title')}
|
|
147
|
-
</h1>
|
|
148
|
-
<p className="mx-auto max-w-xs text-[var(--color-text-secondary)]" style={{ fontFamily: 'var(--font-body)' }}>
|
|
149
|
-
{t('empty.subtitle')}
|
|
150
|
-
</p>
|
|
151
|
-
</>
|
|
152
|
-
)}
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
) : (
|
|
156
|
-
<>
|
|
157
|
-
{!isMemberSession && (
|
|
158
|
-
<div className="mx-auto flex w-full max-w-[860px] items-center border-b border-outline-variant/10 px-8 py-3">
|
|
159
|
-
<div className="flex-1">
|
|
160
|
-
<h1 className="text-lg font-bold font-headline text-on-surface leading-tight">
|
|
161
|
-
{session?.title || t('session.untitled')}
|
|
162
|
-
</h1>
|
|
163
|
-
<div className="flex items-center gap-2 text-[10px] text-outline font-medium mt-1">
|
|
164
|
-
{isActive && (
|
|
165
|
-
<span className="flex items-center gap-1">
|
|
166
|
-
<span className="w-1.5 h-1.5 rounded-full bg-[var(--color-success)] animate-pulse-dot" />
|
|
167
|
-
{t('session.active')}
|
|
168
|
-
</span>
|
|
169
|
-
)}
|
|
170
|
-
{totalTokens > 0 && (
|
|
171
|
-
<>
|
|
172
|
-
<span className="text-[var(--color-outline)]">·</span>
|
|
173
|
-
<span>{totalTokens.toLocaleString()} t</span>
|
|
174
|
-
</>
|
|
175
|
-
)}
|
|
176
|
-
{lastUpdated && (
|
|
177
|
-
<>
|
|
178
|
-
<span className="text-[var(--color-outline)]">·</span>
|
|
179
|
-
<span>{t('session.lastUpdated', { time: lastUpdated })}</span>
|
|
180
|
-
</>
|
|
181
|
-
)}
|
|
182
|
-
{session?.messageCount !== undefined && session.messageCount > 0 && (
|
|
183
|
-
<>
|
|
184
|
-
<span className="text-[var(--color-outline)]">·</span>
|
|
185
|
-
<span>{t('session.messages', { count: session.messageCount })}</span>
|
|
186
|
-
</>
|
|
187
|
-
)}
|
|
188
|
-
</div>
|
|
189
|
-
{session?.workDirExists === false && (
|
|
190
|
-
<div className="mt-2 inline-flex max-w-full items-center gap-2 rounded-lg border border-[var(--color-error)]/20 bg-[var(--color-error)]/8 px-3 py-1.5 text-[11px] text-[var(--color-error)]">
|
|
191
|
-
<span className="material-symbols-outlined text-[14px]">warning</span>
|
|
192
|
-
<span className="truncate">
|
|
193
|
-
{t('session.workspaceUnavailable', { dir: session.workDir || 'directory no longer exists' })}
|
|
194
|
-
</span>
|
|
195
|
-
</div>
|
|
196
|
-
)}
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
)}
|
|
200
|
-
|
|
201
|
-
<MessageList />
|
|
202
|
-
</>
|
|
203
|
-
)}
|
|
204
|
-
|
|
205
|
-
{!isMemberSession && <SessionTaskBar />}
|
|
206
|
-
|
|
207
|
-
<TeamStatusBar />
|
|
208
|
-
|
|
209
|
-
<ChatInput variant={isEmpty && !isMemberSession ? 'hero' : 'default'} />
|
|
210
|
-
|
|
211
|
-
{!isMemberSession && activeTabId ? (
|
|
212
|
-
<ComputerUsePermissionModal
|
|
213
|
-
sessionId={activeTabId}
|
|
214
|
-
request={pendingComputerUsePermission?.request ?? null}
|
|
215
|
-
/>
|
|
216
|
-
) : null}
|
|
217
|
-
</div>
|
|
218
|
-
)
|
|
219
|
-
}
|