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,205 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
-
import { fireEvent, render, screen } from '@testing-library/react'
|
|
3
|
-
import '@testing-library/jest-dom'
|
|
4
|
-
|
|
5
|
-
import { Settings } from '../pages/Settings'
|
|
6
|
-
import { useSkillStore } from '../stores/skillStore'
|
|
7
|
-
import { useSettingsStore } from '../stores/settingsStore'
|
|
8
|
-
import { useSessionStore } from '../stores/sessionStore'
|
|
9
|
-
import { useTabStore, SETTINGS_TAB_ID } from '../stores/tabStore'
|
|
10
|
-
|
|
11
|
-
vi.mock('../api/agents', () => ({
|
|
12
|
-
agentsApi: {
|
|
13
|
-
list: vi.fn().mockResolvedValue({ activeAgents: [], allAgents: [] }),
|
|
14
|
-
},
|
|
15
|
-
}))
|
|
16
|
-
|
|
17
|
-
vi.mock('../stores/providerStore', () => ({
|
|
18
|
-
useProviderStore: () => ({
|
|
19
|
-
providers: [],
|
|
20
|
-
activeId: null,
|
|
21
|
-
isLoading: false,
|
|
22
|
-
fetchProviders: vi.fn(),
|
|
23
|
-
deleteProvider: vi.fn(),
|
|
24
|
-
activateProvider: vi.fn(),
|
|
25
|
-
activateOfficial: vi.fn(),
|
|
26
|
-
testProvider: vi.fn(),
|
|
27
|
-
createProvider: vi.fn(),
|
|
28
|
-
updateProvider: vi.fn(),
|
|
29
|
-
testConfig: vi.fn(),
|
|
30
|
-
}),
|
|
31
|
-
}))
|
|
32
|
-
|
|
33
|
-
vi.mock('../pages/AdapterSettings', () => ({
|
|
34
|
-
AdapterSettings: () => <div>Adapter Settings Mock</div>,
|
|
35
|
-
}))
|
|
36
|
-
|
|
37
|
-
vi.mock('../stores/agentStore', () => ({
|
|
38
|
-
useAgentStore: () => ({
|
|
39
|
-
activeAgents: [],
|
|
40
|
-
allAgents: [],
|
|
41
|
-
isLoading: false,
|
|
42
|
-
error: null,
|
|
43
|
-
selectedAgent: null,
|
|
44
|
-
fetchAgents: vi.fn(),
|
|
45
|
-
selectAgent: vi.fn(),
|
|
46
|
-
}),
|
|
47
|
-
}))
|
|
48
|
-
|
|
49
|
-
vi.mock('../components/chat/CodeViewer', () => ({
|
|
50
|
-
CodeViewer: ({ code }: { code: string }) => <pre data-testid="code-viewer">{code}</pre>,
|
|
51
|
-
}))
|
|
52
|
-
|
|
53
|
-
const MOCK_FETCH_SKILLS = vi.fn()
|
|
54
|
-
const MOCK_FETCH_SKILL_DETAIL = vi.fn()
|
|
55
|
-
const MOCK_CLEAR_SELECTION = vi.fn()
|
|
56
|
-
|
|
57
|
-
function switchToSkillsTab() {
|
|
58
|
-
fireEvent.click(screen.getByText('Skills'))
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
describe('Settings > Skills tab', () => {
|
|
62
|
-
beforeEach(() => {
|
|
63
|
-
vi.clearAllMocks()
|
|
64
|
-
useSettingsStore.setState({ locale: 'en' })
|
|
65
|
-
useSessionStore.setState({
|
|
66
|
-
sessions: [
|
|
67
|
-
{
|
|
68
|
-
id: 'session-1',
|
|
69
|
-
title: 'Active session',
|
|
70
|
-
createdAt: '2026-04-20T00:00:00.000Z',
|
|
71
|
-
modifiedAt: '2026-04-20T00:00:00.000Z',
|
|
72
|
-
messageCount: 1,
|
|
73
|
-
projectPath: '/workspace/project',
|
|
74
|
-
workDir: '/workspace/project',
|
|
75
|
-
workDirExists: true,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
activeSessionId: 'session-1',
|
|
79
|
-
isLoading: false,
|
|
80
|
-
error: null,
|
|
81
|
-
selectedProjects: [],
|
|
82
|
-
availableProjects: ['/workspace/project'],
|
|
83
|
-
})
|
|
84
|
-
useTabStore.setState({ tabs: [], activeTabId: null })
|
|
85
|
-
useSkillStore.setState({
|
|
86
|
-
skills: [],
|
|
87
|
-
selectedSkill: null,
|
|
88
|
-
isLoading: false,
|
|
89
|
-
isDetailLoading: false,
|
|
90
|
-
error: null,
|
|
91
|
-
fetchSkills: MOCK_FETCH_SKILLS,
|
|
92
|
-
fetchSkillDetail: MOCK_FETCH_SKILL_DETAIL,
|
|
93
|
-
clearSelection: MOCK_CLEAR_SELECTION,
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('renders browser summary and grouped skill cards', () => {
|
|
98
|
-
useSkillStore.setState({
|
|
99
|
-
skills: [
|
|
100
|
-
{
|
|
101
|
-
name: 'alpha',
|
|
102
|
-
displayName: 'Alpha Skill',
|
|
103
|
-
description: 'First skill description',
|
|
104
|
-
source: 'user',
|
|
105
|
-
userInvocable: true,
|
|
106
|
-
version: '1.0.0',
|
|
107
|
-
contentLength: 400,
|
|
108
|
-
hasDirectory: true,
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
name: 'beta',
|
|
112
|
-
description: 'Second skill description',
|
|
113
|
-
source: 'project',
|
|
114
|
-
userInvocable: false,
|
|
115
|
-
contentLength: 200,
|
|
116
|
-
hasDirectory: true,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
render(<Settings />)
|
|
122
|
-
switchToSkillsTab()
|
|
123
|
-
|
|
124
|
-
expect(screen.getByText('Browse installed skills')).toBeInTheDocument()
|
|
125
|
-
expect(screen.getByText('Skill Browser')).toBeInTheDocument()
|
|
126
|
-
expect(screen.getByText('Total skills')).toBeInTheDocument()
|
|
127
|
-
expect(screen.getByText('Alpha Skill')).toBeInTheDocument()
|
|
128
|
-
expect(screen.getByText('Second skill description')).toBeInTheDocument()
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
it('uses the active session workDir even when settings tab is focused', () => {
|
|
132
|
-
const fetchSkills = vi.fn()
|
|
133
|
-
useSkillStore.setState({
|
|
134
|
-
skills: [],
|
|
135
|
-
selectedSkill: null,
|
|
136
|
-
isLoading: false,
|
|
137
|
-
isDetailLoading: false,
|
|
138
|
-
error: null,
|
|
139
|
-
fetchSkills,
|
|
140
|
-
fetchSkillDetail: MOCK_FETCH_SKILL_DETAIL,
|
|
141
|
-
clearSelection: MOCK_CLEAR_SELECTION,
|
|
142
|
-
})
|
|
143
|
-
useTabStore.setState({
|
|
144
|
-
activeTabId: SETTINGS_TAB_ID,
|
|
145
|
-
tabs: [{ sessionId: SETTINGS_TAB_ID, title: 'Settings', type: 'settings', status: 'idle' }],
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
render(<Settings />)
|
|
149
|
-
switchToSkillsTab()
|
|
150
|
-
|
|
151
|
-
expect(fetchSkills).toHaveBeenCalledWith('/workspace/project')
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
it('opens skill detail with metadata cards and parsed markdown body', () => {
|
|
155
|
-
useSkillStore.setState({
|
|
156
|
-
selectedSkill: {
|
|
157
|
-
meta: {
|
|
158
|
-
name: 'alpha',
|
|
159
|
-
displayName: 'Alpha Skill',
|
|
160
|
-
description: 'First skill description',
|
|
161
|
-
source: 'user',
|
|
162
|
-
userInvocable: true,
|
|
163
|
-
version: '1.0.0',
|
|
164
|
-
contentLength: 400,
|
|
165
|
-
hasDirectory: true,
|
|
166
|
-
},
|
|
167
|
-
tree: [
|
|
168
|
-
{ name: 'SKILL.md', path: 'SKILL.md', type: 'file' },
|
|
169
|
-
{ name: 'run.ts', path: 'run.ts', type: 'file' },
|
|
170
|
-
],
|
|
171
|
-
files: [
|
|
172
|
-
{
|
|
173
|
-
path: 'SKILL.md',
|
|
174
|
-
content: '# Hello\n\nBody content',
|
|
175
|
-
body: '# Hello\n\nBody content',
|
|
176
|
-
language: 'markdown',
|
|
177
|
-
isEntry: true,
|
|
178
|
-
frontmatter: {
|
|
179
|
-
description: 'Frontmatter description',
|
|
180
|
-
'allowed-tools': ['Read', 'Edit'],
|
|
181
|
-
model: 'sonnet',
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
path: 'run.ts',
|
|
186
|
-
content: 'console.log("hello")',
|
|
187
|
-
language: 'typescript',
|
|
188
|
-
isEntry: false,
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
skillRoot: '/tmp/alpha',
|
|
192
|
-
},
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
render(<Settings />)
|
|
196
|
-
switchToSkillsTab()
|
|
197
|
-
|
|
198
|
-
expect(screen.getByText('Skill metadata')).toBeInTheDocument()
|
|
199
|
-
expect(screen.getByText('/slash')).toBeInTheDocument()
|
|
200
|
-
expect(screen.getByText('Frontmatter description')).toBeInTheDocument()
|
|
201
|
-
expect(screen.getByText('Read, Edit')).toBeInTheDocument()
|
|
202
|
-
expect(screen.getByText('Hello')).toBeInTheDocument()
|
|
203
|
-
expect(screen.queryByText(/^---$/)).not.toBeInTheDocument()
|
|
204
|
-
})
|
|
205
|
-
})
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
import type { AdapterFileConfig } from '../types/adapter'
|
|
3
|
-
|
|
4
|
-
export const adaptersApi = {
|
|
5
|
-
getConfig() {
|
|
6
|
-
return api.get<AdapterFileConfig>('/api/adapters')
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
updateConfig(patch: Partial<AdapterFileConfig>) {
|
|
10
|
-
return api.put<AdapterFileConfig>('/api/adapters', patch)
|
|
11
|
-
},
|
|
12
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
|
|
3
|
-
export type AgentSource =
|
|
4
|
-
| 'built-in'
|
|
5
|
-
| 'plugin'
|
|
6
|
-
| 'userSettings'
|
|
7
|
-
| 'projectSettings'
|
|
8
|
-
| 'localSettings'
|
|
9
|
-
| 'flagSettings'
|
|
10
|
-
| 'policySettings'
|
|
11
|
-
|
|
12
|
-
export type AgentDefinition = {
|
|
13
|
-
agentType: string
|
|
14
|
-
description?: string
|
|
15
|
-
model?: string
|
|
16
|
-
modelDisplay?: string
|
|
17
|
-
tools?: string[]
|
|
18
|
-
systemPrompt?: string
|
|
19
|
-
color?: string
|
|
20
|
-
source: AgentSource
|
|
21
|
-
baseDir?: string
|
|
22
|
-
overriddenBy?: AgentSource
|
|
23
|
-
isActive: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type AgentListResponse = {
|
|
27
|
-
activeAgents: AgentDefinition[]
|
|
28
|
-
allAgents: AgentDefinition[]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const agentsApi = {
|
|
32
|
-
list: (cwd?: string) => {
|
|
33
|
-
const query = cwd ? `?cwd=${encodeURIComponent(cwd)}` : ''
|
|
34
|
-
return api.get<AgentListResponse>(`/api/agents${query}`)
|
|
35
|
-
},
|
|
36
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
import type { CLITask, TaskListSummary } from '../types/cliTask'
|
|
3
|
-
|
|
4
|
-
type TaskListsResponse = { lists: TaskListSummary[] }
|
|
5
|
-
type TasksResponse = { tasks: CLITask[] }
|
|
6
|
-
type TaskResponse = { task: CLITask }
|
|
7
|
-
|
|
8
|
-
export const cliTasksApi = {
|
|
9
|
-
/** List all task lists with summaries */
|
|
10
|
-
listTaskLists() {
|
|
11
|
-
return api.get<TaskListsResponse>('/api/tasks/lists')
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/** Get all tasks for a specific task list */
|
|
15
|
-
getTasksForList(taskListId: string) {
|
|
16
|
-
return api.get<TasksResponse>(`/api/tasks/lists/${encodeURIComponent(taskListId)}`)
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
/** Get a single task */
|
|
20
|
-
getTask(taskListId: string, taskId: string) {
|
|
21
|
-
return api.get<TaskResponse>(`/api/tasks/lists/${encodeURIComponent(taskListId)}/${taskId}`)
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
/** List all tasks across all task lists */
|
|
25
|
-
listAll() {
|
|
26
|
-
return api.get<TasksResponse>('/api/tasks')
|
|
27
|
-
},
|
|
28
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const DEFAULT_BASE_URL = 'http://127.0.0.1:3456'
|
|
2
|
-
|
|
3
|
-
let baseUrl = DEFAULT_BASE_URL
|
|
4
|
-
|
|
5
|
-
export function setBaseUrl(url: string) {
|
|
6
|
-
baseUrl = url.replace(/\/$/, '')
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getBaseUrl() {
|
|
10
|
-
return baseUrl
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getDefaultBaseUrl() {
|
|
14
|
-
return DEFAULT_BASE_URL
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class ApiError extends Error {
|
|
18
|
-
constructor(
|
|
19
|
-
public status: number,
|
|
20
|
-
public body: unknown,
|
|
21
|
-
) {
|
|
22
|
-
super(`API error ${status}: ${typeof body === 'string' ? body : JSON.stringify(body)}`)
|
|
23
|
-
this.name = 'ApiError'
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function request<T>(method: string, path: string, body?: unknown, options?: { timeout?: number }): Promise<T> {
|
|
28
|
-
const url = `${baseUrl}${path}`
|
|
29
|
-
const headers: Record<string, string> = {
|
|
30
|
-
'Content-Type': 'application/json',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const controller = new AbortController()
|
|
34
|
-
const timeout = setTimeout(() => controller.abort(), options?.timeout ?? 30_000)
|
|
35
|
-
try {
|
|
36
|
-
const res = await fetch(url, {
|
|
37
|
-
method,
|
|
38
|
-
headers,
|
|
39
|
-
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
40
|
-
signal: controller.signal,
|
|
41
|
-
})
|
|
42
|
-
clearTimeout(timeout)
|
|
43
|
-
|
|
44
|
-
if (!res.ok) {
|
|
45
|
-
const errorBody = await res.json().catch(() => res.text())
|
|
46
|
-
throw new ApiError(res.status, errorBody)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (res.status === 204) return undefined as T
|
|
50
|
-
return res.json() as Promise<T>
|
|
51
|
-
} catch (err) {
|
|
52
|
-
clearTimeout(timeout)
|
|
53
|
-
throw err
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const api = {
|
|
58
|
-
get: <T>(path: string, options?: { timeout?: number }) => request<T>('GET', path, undefined, options),
|
|
59
|
-
post: <T>(path: string, body?: unknown, options?: { timeout?: number }) => request<T>('POST', path, body, options),
|
|
60
|
-
put: <T>(path: string, body?: unknown) => request<T>('PUT', path, body),
|
|
61
|
-
patch: <T>(path: string, body?: unknown) => request<T>('PATCH', path, body),
|
|
62
|
-
delete: <T>(path: string) => request<T>('DELETE', path),
|
|
63
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
|
|
3
|
-
export type ComputerUseStatus = {
|
|
4
|
-
platform: string
|
|
5
|
-
supported: boolean
|
|
6
|
-
python: {
|
|
7
|
-
installed: boolean
|
|
8
|
-
version: string | null
|
|
9
|
-
path: string | null
|
|
10
|
-
}
|
|
11
|
-
venv: {
|
|
12
|
-
created: boolean
|
|
13
|
-
path: string
|
|
14
|
-
}
|
|
15
|
-
dependencies: {
|
|
16
|
-
installed: boolean
|
|
17
|
-
requirementsFound: boolean
|
|
18
|
-
}
|
|
19
|
-
permissions: {
|
|
20
|
-
accessibility: boolean | null
|
|
21
|
-
screenRecording: boolean | null
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type SetupStep = {
|
|
26
|
-
name: string
|
|
27
|
-
ok: boolean
|
|
28
|
-
message: string
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type SetupResult = {
|
|
32
|
-
success: boolean
|
|
33
|
-
steps: SetupStep[]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type InstalledApp = {
|
|
37
|
-
bundleId: string
|
|
38
|
-
displayName: string
|
|
39
|
-
path: string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type AuthorizedApp = {
|
|
43
|
-
bundleId: string
|
|
44
|
-
displayName: string
|
|
45
|
-
authorizedAt: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type ComputerUseConfig = {
|
|
49
|
-
authorizedApps: AuthorizedApp[]
|
|
50
|
-
grantFlags: {
|
|
51
|
-
clipboardRead: boolean
|
|
52
|
-
clipboardWrite: boolean
|
|
53
|
-
systemKeyCombos: boolean
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const computerUseApi = {
|
|
58
|
-
getStatus() {
|
|
59
|
-
return api.get<ComputerUseStatus>('/api/computer-use/status')
|
|
60
|
-
},
|
|
61
|
-
runSetup() {
|
|
62
|
-
return api.post<SetupResult>('/api/computer-use/setup', undefined, { timeout: 300_000 })
|
|
63
|
-
},
|
|
64
|
-
getInstalledApps() {
|
|
65
|
-
return api.get<{ apps: InstalledApp[] }>('/api/computer-use/apps')
|
|
66
|
-
},
|
|
67
|
-
getAuthorizedApps() {
|
|
68
|
-
return api.get<ComputerUseConfig>('/api/computer-use/authorized-apps')
|
|
69
|
-
},
|
|
70
|
-
setAuthorizedApps(config: Partial<ComputerUseConfig>) {
|
|
71
|
-
return api.put<{ ok: true }>('/api/computer-use/authorized-apps', config)
|
|
72
|
-
},
|
|
73
|
-
openSettings(pane: 'Privacy_ScreenCapture' | 'Privacy_Accessibility') {
|
|
74
|
-
return api.post<{ ok: true }>('/api/computer-use/open-settings', { pane })
|
|
75
|
-
},
|
|
76
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
|
|
3
|
-
type DirEntry = {
|
|
4
|
-
name: string
|
|
5
|
-
path: string
|
|
6
|
-
isDirectory: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type BrowseResult = {
|
|
10
|
-
currentPath: string
|
|
11
|
-
parentPath: string
|
|
12
|
-
entries: DirEntry[]
|
|
13
|
-
query?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const filesystemApi = {
|
|
17
|
-
browse(path?: string, options?: { includeFiles?: boolean }) {
|
|
18
|
-
const q = new URLSearchParams()
|
|
19
|
-
if (path) q.set('path', path)
|
|
20
|
-
if (options?.includeFiles) q.set('includeFiles', 'true')
|
|
21
|
-
const qs = q.toString()
|
|
22
|
-
return api.get<BrowseResult>(`/api/filesystem/browse${qs ? `?${qs}` : ''}`)
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
search(query: string, cwd?: string) {
|
|
26
|
-
const q = new URLSearchParams({ search: query, maxResults: '200' })
|
|
27
|
-
if (cwd) q.set('path', cwd)
|
|
28
|
-
return api.get<BrowseResult>(`/api/filesystem/browse?${q}`)
|
|
29
|
-
},
|
|
30
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// desktop/src/api/hahaOAuth.ts
|
|
2
|
-
|
|
3
|
-
import { api, getBaseUrl } from './client'
|
|
4
|
-
|
|
5
|
-
export type HahaOAuthStatus =
|
|
6
|
-
| { loggedIn: false }
|
|
7
|
-
| {
|
|
8
|
-
loggedIn: true
|
|
9
|
-
expiresAt: number | null
|
|
10
|
-
scopes: string[]
|
|
11
|
-
subscriptionType: 'pro' | 'max' | 'team' | 'enterprise' | null
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function currentServerPort(): number {
|
|
15
|
-
const port = new URL(getBaseUrl()).port
|
|
16
|
-
const parsed = Number.parseInt(port, 10)
|
|
17
|
-
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
18
|
-
throw new Error(`Cannot determine server port from baseUrl: ${getBaseUrl()}`)
|
|
19
|
-
}
|
|
20
|
-
return parsed
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const hahaOAuthApi = {
|
|
24
|
-
start() {
|
|
25
|
-
return api.post<{ authorizeUrl: string; state: string }>(
|
|
26
|
-
'/api/haha-oauth/start',
|
|
27
|
-
{ serverPort: currentServerPort() },
|
|
28
|
-
)
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
status() {
|
|
32
|
-
return api.get<HahaOAuthStatus>('/api/haha-oauth')
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
logout() {
|
|
36
|
-
return api.delete<{ ok: true }>('/api/haha-oauth')
|
|
37
|
-
},
|
|
38
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
import type { ModelInfo, EffortLevel } from '../types/settings'
|
|
3
|
-
|
|
4
|
-
type ModelsResponse = { models: ModelInfo[]; provider: { id: string; name: string } | null }
|
|
5
|
-
type CurrentModelResponse = { model: ModelInfo }
|
|
6
|
-
type EffortResponse = { level: EffortLevel; available: EffortLevel[] }
|
|
7
|
-
|
|
8
|
-
export const modelsApi = {
|
|
9
|
-
list() {
|
|
10
|
-
return api.get<ModelsResponse>('/api/models')
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
getCurrent() {
|
|
14
|
-
return api.get<CurrentModelResponse>('/api/models/current')
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
setCurrent(modelId: string) {
|
|
18
|
-
return api.put<{ ok: true; model: string }>('/api/models/current', { modelId })
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
getEffort() {
|
|
22
|
-
return api.get<EffortResponse>('/api/effort')
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
setEffort(level: EffortLevel) {
|
|
26
|
-
return api.put<{ ok: true; level: EffortLevel }>('/api/effort', { level })
|
|
27
|
-
},
|
|
28
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// desktop/src/api/providers.ts
|
|
2
|
-
|
|
3
|
-
import { api } from './client'
|
|
4
|
-
import type {
|
|
5
|
-
SavedProvider,
|
|
6
|
-
CreateProviderInput,
|
|
7
|
-
UpdateProviderInput,
|
|
8
|
-
TestProviderConfigInput,
|
|
9
|
-
ProviderTestResult,
|
|
10
|
-
} from '../types/provider'
|
|
11
|
-
import type { ProviderPreset } from '../config/providerPresets'
|
|
12
|
-
|
|
13
|
-
type ProvidersResponse = { providers: SavedProvider[]; activeId: string | null }
|
|
14
|
-
type ProviderResponse = { provider: SavedProvider }
|
|
15
|
-
type PresetsResponse = { presets: ProviderPreset[] }
|
|
16
|
-
type TestResultResponse = { result: ProviderTestResult }
|
|
17
|
-
type AuthStatusResponse = {
|
|
18
|
-
hasAuth: boolean
|
|
19
|
-
source: 'cc-haha-provider' | 'original-settings' | 'env' | 'none'
|
|
20
|
-
activeProvider?: string
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const providersApi = {
|
|
24
|
-
list() {
|
|
25
|
-
return api.get<ProvidersResponse>('/api/providers')
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
presets() {
|
|
29
|
-
return api.get<PresetsResponse>('/api/providers/presets')
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
authStatus() {
|
|
33
|
-
return api.get<AuthStatusResponse>('/api/providers/auth-status')
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
create(input: CreateProviderInput) {
|
|
37
|
-
return api.post<ProviderResponse>('/api/providers', input)
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
update(id: string, input: UpdateProviderInput) {
|
|
41
|
-
return api.put<ProviderResponse>(`/api/providers/${id}`, input)
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
delete(id: string) {
|
|
45
|
-
return api.delete<{ ok: true }>(`/api/providers/${id}`)
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
activate(id: string) {
|
|
49
|
-
return api.post<{ ok: true }>(`/api/providers/${id}/activate`)
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
activateOfficial() {
|
|
53
|
-
return api.post<{ ok: true }>('/api/providers/official')
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
test(id: string, overrides?: { baseUrl?: string; modelId?: string; apiFormat?: string }) {
|
|
57
|
-
return api.post<TestResultResponse>(`/api/providers/${id}/test`, overrides)
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
testConfig(input: TestProviderConfigInput) {
|
|
61
|
-
return api.post<TestResultResponse>('/api/providers/test', input)
|
|
62
|
-
},
|
|
63
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
|
|
3
|
-
type SearchResult = {
|
|
4
|
-
file: string
|
|
5
|
-
line: number
|
|
6
|
-
text: string
|
|
7
|
-
context?: string[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type SearchResponse = { results: SearchResult[]; total: number }
|
|
11
|
-
|
|
12
|
-
type SessionSearchResult = {
|
|
13
|
-
sessionId: string
|
|
14
|
-
title: string
|
|
15
|
-
matchCount: number
|
|
16
|
-
matches: Array<{ line: number; text: string }>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type SessionSearchResponse = { results: SessionSearchResult[] }
|
|
20
|
-
|
|
21
|
-
export const searchApi = {
|
|
22
|
-
search(params: { query: string; cwd?: string; maxResults?: number; glob?: string }) {
|
|
23
|
-
return api.post<SearchResponse>('/api/search', params)
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
searchSessions(query: string) {
|
|
27
|
-
return api.post<SessionSearchResponse>('/api/search/sessions', { query })
|
|
28
|
-
},
|
|
29
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
import type { SessionListItem, MessageEntry } from '../types/session'
|
|
3
|
-
|
|
4
|
-
type SessionsResponse = { sessions: SessionListItem[]; total: number }
|
|
5
|
-
type MessagesResponse = { messages: MessageEntry[] }
|
|
6
|
-
type CreateSessionResponse = { sessionId: string }
|
|
7
|
-
|
|
8
|
-
export type RecentProject = {
|
|
9
|
-
projectPath: string
|
|
10
|
-
realPath: string
|
|
11
|
-
projectName: string
|
|
12
|
-
isGit: boolean
|
|
13
|
-
repoName: string | null
|
|
14
|
-
branch: string | null
|
|
15
|
-
modifiedAt: string
|
|
16
|
-
sessionCount: number
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const sessionsApi = {
|
|
20
|
-
list(params?: { project?: string; limit?: number; offset?: number }) {
|
|
21
|
-
const query = new URLSearchParams()
|
|
22
|
-
if (params?.project) query.set('project', params.project)
|
|
23
|
-
if (params?.limit) query.set('limit', String(params.limit))
|
|
24
|
-
if (params?.offset) query.set('offset', String(params.offset))
|
|
25
|
-
const qs = query.toString()
|
|
26
|
-
return api.get<SessionsResponse>(`/api/sessions${qs ? `?${qs}` : ''}`)
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
getMessages(sessionId: string) {
|
|
30
|
-
return api.get<MessagesResponse>(`/api/sessions/${sessionId}/messages`)
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
create(workDir?: string) {
|
|
34
|
-
return api.post<CreateSessionResponse>('/api/sessions', workDir ? { workDir } : {})
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
delete(sessionId: string) {
|
|
38
|
-
return api.delete<{ ok: true }>(`/api/sessions/${sessionId}`)
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
rename(sessionId: string, title: string) {
|
|
42
|
-
return api.patch<{ ok: true }>(`/api/sessions/${sessionId}`, { title })
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
getRecentProjects() {
|
|
46
|
-
return api.get<{ projects: RecentProject[] }>('/api/sessions/recent-projects')
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
getGitInfo(sessionId: string) {
|
|
50
|
-
return api.get<{ branch: string | null; repoName: string | null; workDir: string; changedFiles: number }>(`/api/sessions/${sessionId}/git-info`)
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
getSlashCommands(sessionId: string) {
|
|
54
|
-
return api.get<{ commands: Array<{ name: string; description: string }> }>(`/api/sessions/${sessionId}/slash-commands`)
|
|
55
|
-
},
|
|
56
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { api } from './client'
|
|
2
|
-
import type { PermissionMode, UserSettings } from '../types/settings'
|
|
3
|
-
|
|
4
|
-
export const settingsApi = {
|
|
5
|
-
getUser() {
|
|
6
|
-
return api.get<UserSettings>('/api/settings/user')
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
updateUser(settings: Partial<UserSettings>) {
|
|
10
|
-
return api.put<{ ok: true }>('/api/settings/user', settings)
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
getPermissionMode() {
|
|
14
|
-
return api.get<{ mode: PermissionMode }>('/api/permissions/mode')
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
setPermissionMode(mode: PermissionMode) {
|
|
18
|
-
return api.put<{ ok: true; mode: PermissionMode }>('/api/permissions/mode', { mode })
|
|
19
|
-
},
|
|
20
|
-
}
|