bingocode 1.0.3 → 1.0.4
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 +1 -1
- 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,407 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
|
-
import { useTaskStore } from '../../stores/taskStore'
|
|
3
|
-
import { useSessionStore } from '../../stores/sessionStore'
|
|
4
|
-
import { useAdapterStore } from '../../stores/adapterStore'
|
|
5
|
-
import { Modal } from '../shared/Modal'
|
|
6
|
-
import { Input } from '../shared/Input'
|
|
7
|
-
import { Button } from '../shared/Button'
|
|
8
|
-
import { PromptEditor } from './PromptEditor'
|
|
9
|
-
import { DayOfWeekPicker } from './DayOfWeekPicker'
|
|
10
|
-
import { useTranslation } from '../../i18n'
|
|
11
|
-
import { describeCron, isValidCron, parseCron, type FrequencyKey } from '../../lib/cronDescribe'
|
|
12
|
-
import type { PermissionMode } from '../../types/settings'
|
|
13
|
-
import type { CronTask } from '../../types/task'
|
|
14
|
-
|
|
15
|
-
type Props = {
|
|
16
|
-
open: boolean
|
|
17
|
-
onClose: () => void
|
|
18
|
-
editTask?: CronTask
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const MINUTE_INTERVALS = [5, 10, 15, 20, 30]
|
|
22
|
-
const HOUR_INTERVALS = [1, 2, 3, 4, 6, 8, 12]
|
|
23
|
-
const MINUTE_OFFSETS = [0, 15, 30, 45]
|
|
24
|
-
|
|
25
|
-
function buildCron(
|
|
26
|
-
freq: FrequencyKey,
|
|
27
|
-
time: string,
|
|
28
|
-
opts: {
|
|
29
|
-
minuteInterval: number
|
|
30
|
-
hourInterval: number
|
|
31
|
-
minuteOffset: number
|
|
32
|
-
selectedDays: number[]
|
|
33
|
-
monthDay: number
|
|
34
|
-
customCron: string
|
|
35
|
-
},
|
|
36
|
-
): string {
|
|
37
|
-
const [hours, minutes] = time.split(':').map(Number)
|
|
38
|
-
switch (freq) {
|
|
39
|
-
case 'everyNMinutes':
|
|
40
|
-
return `*/${opts.minuteInterval} * * * *`
|
|
41
|
-
case 'everyNHours':
|
|
42
|
-
return `${opts.minuteOffset} */${opts.hourInterval} * * *`
|
|
43
|
-
case 'daily':
|
|
44
|
-
return `${minutes} ${hours} * * *`
|
|
45
|
-
case 'weekdays':
|
|
46
|
-
return `${minutes} ${hours} * * 1-5`
|
|
47
|
-
case 'specificDays':
|
|
48
|
-
return `${minutes} ${hours} * * ${[...opts.selectedDays].sort((a, b) => a - b).join(',')}`
|
|
49
|
-
case 'monthly':
|
|
50
|
-
return `${minutes} ${hours} ${opts.monthDay} * *`
|
|
51
|
-
case 'customCron':
|
|
52
|
-
return opts.customCron.trim()
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function NewTaskModal({ open, onClose, editTask }: Props) {
|
|
57
|
-
const t = useTranslation()
|
|
58
|
-
const { createTask, updateTask } = useTaskStore()
|
|
59
|
-
const sessions = useSessionStore((s) => s.sessions)
|
|
60
|
-
const activeSessionId = useSessionStore((s) => s.activeSessionId)
|
|
61
|
-
const activeSession = sessions.find((s) => s.id === activeSessionId)
|
|
62
|
-
const defaultWorkDir = activeSession?.workDir || ''
|
|
63
|
-
const adapterConfig = useAdapterStore((s) => s.config)
|
|
64
|
-
const fetchAdapterConfig = useAdapterStore((s) => s.fetchConfig)
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (open) fetchAdapterConfig()
|
|
68
|
-
}, [open])
|
|
69
|
-
|
|
70
|
-
const isFeishuConfigured = !!(adapterConfig.feishu?.appId && adapterConfig.feishu?.appSecret
|
|
71
|
-
&& ((adapterConfig.feishu?.pairedUsers?.length ?? 0) > 0 || (adapterConfig.feishu?.allowedUsers?.length ?? 0) > 0))
|
|
72
|
-
const isTelegramConfigured = !!(adapterConfig.telegram?.botToken
|
|
73
|
-
&& ((adapterConfig.telegram?.pairedUsers?.length ?? 0) > 0 || (adapterConfig.telegram?.allowedUsers?.length ?? 0) > 0))
|
|
74
|
-
|
|
75
|
-
const isEdit = !!editTask
|
|
76
|
-
const parsed = editTask ? parseCron(editTask.cron) : null
|
|
77
|
-
|
|
78
|
-
const FREQUENCY_OPTIONS: Array<{ value: FrequencyKey; label: string }> = [
|
|
79
|
-
{ value: 'everyNMinutes', label: t('newTask.everyNMinutes') },
|
|
80
|
-
{ value: 'everyNHours', label: t('newTask.everyNHours') },
|
|
81
|
-
{ value: 'daily', label: t('newTask.daily') },
|
|
82
|
-
{ value: 'weekdays', label: t('newTask.weekdays') },
|
|
83
|
-
{ value: 'specificDays', label: t('newTask.specificDays') },
|
|
84
|
-
{ value: 'monthly', label: t('newTask.monthly') },
|
|
85
|
-
{ value: 'customCron', label: t('newTask.customCron') },
|
|
86
|
-
]
|
|
87
|
-
|
|
88
|
-
const [name, setName] = useState(editTask?.name || '')
|
|
89
|
-
const [description, setDescription] = useState(editTask?.description || '')
|
|
90
|
-
const [prompt, setPrompt] = useState(editTask?.prompt || '')
|
|
91
|
-
const [frequency, setFrequency] = useState<FrequencyKey>(parsed?.frequency || 'daily')
|
|
92
|
-
const [time, setTime] = useState(parsed?.time || '09:00')
|
|
93
|
-
const [model, setModel] = useState(editTask?.model || '')
|
|
94
|
-
const [permissionMode, setPermissionMode] = useState<PermissionMode>((editTask?.permissionMode as PermissionMode) || 'default')
|
|
95
|
-
const [folderPath, setFolderPath] = useState(editTask?.folderPath || defaultWorkDir)
|
|
96
|
-
const [useWorktree, setUseWorktree] = useState(editTask?.useWorktree || false)
|
|
97
|
-
const [notifyEnabled, setNotifyEnabled] = useState(editTask?.notification?.enabled || false)
|
|
98
|
-
const [notifyChannels, setNotifyChannels] = useState<('telegram' | 'feishu')[]>(editTask?.notification?.channels || [])
|
|
99
|
-
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
100
|
-
|
|
101
|
-
// Enhanced scheduling state
|
|
102
|
-
const [minuteInterval, setMinuteInterval] = useState(parsed?.minuteInterval || 15)
|
|
103
|
-
const [hourInterval, setHourInterval] = useState(parsed?.hourInterval || 1)
|
|
104
|
-
const [minuteOffset, setMinuteOffset] = useState(parsed?.minuteOffset || 0)
|
|
105
|
-
const [selectedDays, setSelectedDays] = useState<number[]>(parsed?.selectedDays || [1])
|
|
106
|
-
const [monthDay, setMonthDay] = useState(parsed?.monthDay || 1)
|
|
107
|
-
const [customCron, setCustomCron] = useState(parsed?.customCron || '0 9 * * *')
|
|
108
|
-
|
|
109
|
-
const showTime = ['daily', 'weekdays', 'specificDays', 'monthly'].includes(frequency)
|
|
110
|
-
|
|
111
|
-
const cronValue = buildCron(frequency, time, {
|
|
112
|
-
minuteInterval, hourInterval, minuteOffset, selectedDays, monthDay, customCron,
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
const canSubmit =
|
|
116
|
-
name.trim() &&
|
|
117
|
-
description.trim() &&
|
|
118
|
-
prompt.trim() &&
|
|
119
|
-
(frequency !== 'customCron' || isValidCron(customCron)) &&
|
|
120
|
-
(frequency !== 'specificDays' || selectedDays.length > 0)
|
|
121
|
-
|
|
122
|
-
const handleSubmit = async () => {
|
|
123
|
-
if (!canSubmit) return
|
|
124
|
-
setIsSubmitting(true)
|
|
125
|
-
try {
|
|
126
|
-
const payload = {
|
|
127
|
-
name: name.trim(),
|
|
128
|
-
description: description.trim(),
|
|
129
|
-
cron: cronValue,
|
|
130
|
-
prompt: prompt.trim(),
|
|
131
|
-
model: model || undefined,
|
|
132
|
-
permissionMode: permissionMode !== 'default' ? permissionMode : undefined,
|
|
133
|
-
folderPath: folderPath.trim() || undefined,
|
|
134
|
-
useWorktree: useWorktree || undefined,
|
|
135
|
-
notification: notifyEnabled && notifyChannels.length > 0
|
|
136
|
-
? { enabled: true, channels: notifyChannels }
|
|
137
|
-
: undefined,
|
|
138
|
-
}
|
|
139
|
-
if (isEdit) {
|
|
140
|
-
await updateTask(editTask!.id, payload)
|
|
141
|
-
} else {
|
|
142
|
-
await createTask({ ...payload, enabled: true, recurring: true })
|
|
143
|
-
}
|
|
144
|
-
onClose()
|
|
145
|
-
} catch (err) {
|
|
146
|
-
console.error(`Failed to ${isEdit ? 'update' : 'create'} task:`, err)
|
|
147
|
-
} finally {
|
|
148
|
-
setIsSubmitting(false)
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const selectClass = 'w-full h-10 px-3 pr-8 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] text-sm text-[var(--color-text-primary)] outline-none focus:border-[var(--color-border-focus)] appearance-none cursor-pointer'
|
|
153
|
-
|
|
154
|
-
return (
|
|
155
|
-
<Modal
|
|
156
|
-
open={open}
|
|
157
|
-
onClose={onClose}
|
|
158
|
-
title={isEdit ? t('tasks.editTitle') : t('newTask.title')}
|
|
159
|
-
footer={
|
|
160
|
-
<>
|
|
161
|
-
<Button variant="secondary" onClick={onClose}>{t('common.cancel')}</Button>
|
|
162
|
-
<Button onClick={handleSubmit} disabled={!canSubmit} loading={isSubmitting}>
|
|
163
|
-
{isEdit ? t('tasks.saveChanges') : t('newTask.create')}
|
|
164
|
-
</Button>
|
|
165
|
-
</>
|
|
166
|
-
}
|
|
167
|
-
>
|
|
168
|
-
{/* Info banner */}
|
|
169
|
-
<div className="flex items-center gap-2.5 px-3.5 py-2.5 rounded-[var(--radius-md)] bg-[var(--color-surface-container)] mb-5">
|
|
170
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-secondary)]">info</span>
|
|
171
|
-
<span className="text-xs text-[var(--color-text-secondary)]">
|
|
172
|
-
{t('newTask.localWarning')}
|
|
173
|
-
</span>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div className="flex flex-col gap-4">
|
|
177
|
-
<Input
|
|
178
|
-
label={t('newTask.name')}
|
|
179
|
-
required
|
|
180
|
-
value={name}
|
|
181
|
-
onChange={(e) => setName(e.target.value)}
|
|
182
|
-
placeholder={t('newTask.namePlaceholder')}
|
|
183
|
-
/>
|
|
184
|
-
|
|
185
|
-
<Input
|
|
186
|
-
label={t('newTask.description')}
|
|
187
|
-
required
|
|
188
|
-
value={description}
|
|
189
|
-
onChange={(e) => setDescription(e.target.value)}
|
|
190
|
-
placeholder={t('newTask.descPlaceholder')}
|
|
191
|
-
/>
|
|
192
|
-
|
|
193
|
-
{/* Prompt editor with embedded controls */}
|
|
194
|
-
<PromptEditor
|
|
195
|
-
value={prompt}
|
|
196
|
-
onChange={setPrompt}
|
|
197
|
-
placeholder={t('newTask.promptPlaceholder')}
|
|
198
|
-
permissionMode={permissionMode}
|
|
199
|
-
onPermissionModeChange={setPermissionMode}
|
|
200
|
-
modelId={model}
|
|
201
|
-
onModelChange={setModel}
|
|
202
|
-
folderPath={folderPath}
|
|
203
|
-
onFolderPathChange={setFolderPath}
|
|
204
|
-
useWorktree={useWorktree}
|
|
205
|
-
onUseWorktreeChange={setUseWorktree}
|
|
206
|
-
/>
|
|
207
|
-
|
|
208
|
-
{/* Frequency */}
|
|
209
|
-
<div className="flex flex-col gap-1">
|
|
210
|
-
<label className="text-sm font-medium text-[var(--color-text-primary)]">{t('newTask.frequency')}</label>
|
|
211
|
-
<div className="relative">
|
|
212
|
-
<select
|
|
213
|
-
value={frequency}
|
|
214
|
-
onChange={(e) => setFrequency(e.target.value as FrequencyKey)}
|
|
215
|
-
className={selectClass}
|
|
216
|
-
>
|
|
217
|
-
{FREQUENCY_OPTIONS.map((opt) => (
|
|
218
|
-
<option key={opt.value} value={opt.value}>{opt.label}</option>
|
|
219
|
-
))}
|
|
220
|
-
</select>
|
|
221
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-tertiary)] absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
222
|
-
expand_more
|
|
223
|
-
</span>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
{/* Sub-controls based on frequency */}
|
|
228
|
-
{frequency === 'everyNMinutes' && (
|
|
229
|
-
<div className="relative">
|
|
230
|
-
<select
|
|
231
|
-
value={minuteInterval}
|
|
232
|
-
onChange={(e) => setMinuteInterval(Number(e.target.value))}
|
|
233
|
-
className={selectClass}
|
|
234
|
-
>
|
|
235
|
-
{MINUTE_INTERVALS.map((n) => (
|
|
236
|
-
<option key={n} value={n}>{t('newTask.intervalMinutes', { n })}</option>
|
|
237
|
-
))}
|
|
238
|
-
</select>
|
|
239
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-tertiary)] absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
240
|
-
expand_more
|
|
241
|
-
</span>
|
|
242
|
-
</div>
|
|
243
|
-
)}
|
|
244
|
-
|
|
245
|
-
{frequency === 'everyNHours' && (
|
|
246
|
-
<div className="flex gap-2">
|
|
247
|
-
<div className="relative flex-1">
|
|
248
|
-
<select
|
|
249
|
-
value={hourInterval}
|
|
250
|
-
onChange={(e) => setHourInterval(Number(e.target.value))}
|
|
251
|
-
className={selectClass}
|
|
252
|
-
>
|
|
253
|
-
{HOUR_INTERVALS.map((n) => (
|
|
254
|
-
<option key={n} value={n}>{t('newTask.intervalHours', { n })}</option>
|
|
255
|
-
))}
|
|
256
|
-
</select>
|
|
257
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-tertiary)] absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
258
|
-
expand_more
|
|
259
|
-
</span>
|
|
260
|
-
</div>
|
|
261
|
-
<div className="relative flex-1">
|
|
262
|
-
<select
|
|
263
|
-
value={minuteOffset}
|
|
264
|
-
onChange={(e) => setMinuteOffset(Number(e.target.value))}
|
|
265
|
-
className={selectClass}
|
|
266
|
-
>
|
|
267
|
-
{MINUTE_OFFSETS.map((m) => (
|
|
268
|
-
<option key={m} value={m}>{t('newTask.atMinute', { m: m.toString().padStart(2, '0') })}</option>
|
|
269
|
-
))}
|
|
270
|
-
</select>
|
|
271
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-tertiary)] absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
272
|
-
expand_more
|
|
273
|
-
</span>
|
|
274
|
-
</div>
|
|
275
|
-
</div>
|
|
276
|
-
)}
|
|
277
|
-
|
|
278
|
-
{frequency === 'specificDays' && (
|
|
279
|
-
<DayOfWeekPicker selected={selectedDays} onChange={setSelectedDays} />
|
|
280
|
-
)}
|
|
281
|
-
|
|
282
|
-
{frequency === 'monthly' && (
|
|
283
|
-
<div className="relative">
|
|
284
|
-
<select
|
|
285
|
-
value={monthDay}
|
|
286
|
-
onChange={(e) => setMonthDay(Number(e.target.value))}
|
|
287
|
-
className={selectClass}
|
|
288
|
-
>
|
|
289
|
-
{Array.from({ length: 28 }, (_, i) => i + 1).map((d) => (
|
|
290
|
-
<option key={d} value={d}>{t('newTask.onMonthDay', { d })}</option>
|
|
291
|
-
))}
|
|
292
|
-
</select>
|
|
293
|
-
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-tertiary)] absolute right-2.5 top-1/2 -translate-y-1/2 pointer-events-none">
|
|
294
|
-
expand_more
|
|
295
|
-
</span>
|
|
296
|
-
</div>
|
|
297
|
-
)}
|
|
298
|
-
|
|
299
|
-
{frequency === 'customCron' && (
|
|
300
|
-
<div className="flex flex-col gap-1">
|
|
301
|
-
<input
|
|
302
|
-
type="text"
|
|
303
|
-
value={customCron}
|
|
304
|
-
onChange={(e) => setCustomCron(e.target.value)}
|
|
305
|
-
placeholder={t('newTask.cronFormatHint')}
|
|
306
|
-
className="w-full h-10 px-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] text-sm text-[var(--color-text-primary)] font-[var(--font-mono)] outline-none focus:border-[var(--color-border-focus)]"
|
|
307
|
-
/>
|
|
308
|
-
<span className="text-xs text-[var(--color-text-tertiary)]">{t('newTask.cronFormatHint')}</span>
|
|
309
|
-
{customCron.trim() && !isValidCron(customCron) && (
|
|
310
|
-
<span className="text-xs text-[var(--color-error)]">{t('newTask.invalidCron')}</span>
|
|
311
|
-
)}
|
|
312
|
-
</div>
|
|
313
|
-
)}
|
|
314
|
-
|
|
315
|
-
{/* Time picker — shown for daily, weekdays, specificDays, monthly */}
|
|
316
|
-
{showTime && (
|
|
317
|
-
<div className="flex flex-col gap-1">
|
|
318
|
-
<input
|
|
319
|
-
type="time"
|
|
320
|
-
value={time}
|
|
321
|
-
onChange={(e) => setTime(e.target.value)}
|
|
322
|
-
className="w-auto h-10 px-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] text-sm text-[var(--color-text-primary)] outline-none focus:border-[var(--color-border-focus)]"
|
|
323
|
-
style={{ maxWidth: 120 }}
|
|
324
|
-
/>
|
|
325
|
-
</div>
|
|
326
|
-
)}
|
|
327
|
-
|
|
328
|
-
{/* Notification */}
|
|
329
|
-
<div className="flex flex-col gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] p-3">
|
|
330
|
-
<label className="flex items-center gap-3 cursor-pointer">
|
|
331
|
-
<input
|
|
332
|
-
type="checkbox"
|
|
333
|
-
checked={notifyEnabled}
|
|
334
|
-
onChange={(e) => setNotifyEnabled(e.target.checked)}
|
|
335
|
-
className="w-4 h-4 rounded border-[var(--color-border)] accent-[var(--color-brand)]"
|
|
336
|
-
/>
|
|
337
|
-
<div>
|
|
338
|
-
<span className="text-sm font-medium text-[var(--color-text-primary)]">{t('newTask.notifyOnComplete')}</span>
|
|
339
|
-
<p className="text-xs text-[var(--color-text-tertiary)]">{t('newTask.notifyHint')}</p>
|
|
340
|
-
</div>
|
|
341
|
-
</label>
|
|
342
|
-
{notifyEnabled && (
|
|
343
|
-
<div className="flex flex-col gap-2 pl-7">
|
|
344
|
-
<div className="flex items-center gap-4">
|
|
345
|
-
<label className={`flex items-center gap-2 ${isFeishuConfigured ? 'cursor-pointer' : 'opacity-50 cursor-not-allowed'}`}>
|
|
346
|
-
<input
|
|
347
|
-
type="checkbox"
|
|
348
|
-
checked={notifyChannels.includes('feishu')}
|
|
349
|
-
disabled={!isFeishuConfigured}
|
|
350
|
-
onChange={(e) => {
|
|
351
|
-
setNotifyChannels((prev) =>
|
|
352
|
-
e.target.checked ? [...prev, 'feishu'] : prev.filter((c) => c !== 'feishu'),
|
|
353
|
-
)
|
|
354
|
-
}}
|
|
355
|
-
className="w-3.5 h-3.5 rounded border-[var(--color-border)] accent-[var(--color-brand)]"
|
|
356
|
-
/>
|
|
357
|
-
<span className="text-sm text-[var(--color-text-primary)]">{t('settings.adapters.feishu')}</span>
|
|
358
|
-
{!isFeishuConfigured && (
|
|
359
|
-
<span className="text-[10px] text-[var(--color-warning)]">{t('newTask.notConfigured')}</span>
|
|
360
|
-
)}
|
|
361
|
-
</label>
|
|
362
|
-
<label className={`flex items-center gap-2 ${isTelegramConfigured ? 'cursor-pointer' : 'opacity-50 cursor-not-allowed'}`}>
|
|
363
|
-
<input
|
|
364
|
-
type="checkbox"
|
|
365
|
-
checked={notifyChannels.includes('telegram')}
|
|
366
|
-
disabled={!isTelegramConfigured}
|
|
367
|
-
onChange={(e) => {
|
|
368
|
-
setNotifyChannels((prev) =>
|
|
369
|
-
e.target.checked ? [...prev, 'telegram'] : prev.filter((c) => c !== 'telegram'),
|
|
370
|
-
)
|
|
371
|
-
}}
|
|
372
|
-
className="w-3.5 h-3.5 rounded border-[var(--color-border)] accent-[var(--color-brand)]"
|
|
373
|
-
/>
|
|
374
|
-
<span className="text-sm text-[var(--color-text-primary)]">{t('settings.adapters.telegram')}</span>
|
|
375
|
-
{!isTelegramConfigured && (
|
|
376
|
-
<span className="text-[10px] text-[var(--color-warning)]">{t('newTask.notConfigured')}</span>
|
|
377
|
-
)}
|
|
378
|
-
</label>
|
|
379
|
-
</div>
|
|
380
|
-
{!isFeishuConfigured && !isTelegramConfigured && (
|
|
381
|
-
<p className="text-xs text-[var(--color-warning)]">
|
|
382
|
-
<span className="material-symbols-outlined text-[12px] align-middle mr-1">warning</span>
|
|
383
|
-
{t('newTask.noChannelConfigured')}
|
|
384
|
-
</p>
|
|
385
|
-
)}
|
|
386
|
-
</div>
|
|
387
|
-
)}
|
|
388
|
-
</div>
|
|
389
|
-
|
|
390
|
-
{/* Cron preview */}
|
|
391
|
-
<div className="flex items-center gap-2 px-3 py-2 rounded-[var(--radius-md)] bg-[var(--color-surface-container)] text-xs text-[var(--color-text-secondary)]">
|
|
392
|
-
<span className="material-symbols-outlined text-[16px]">schedule</span>
|
|
393
|
-
<span>
|
|
394
|
-
{frequency === 'customCron' && customCron.trim() && !isValidCron(customCron)
|
|
395
|
-
? t('newTask.invalidCron')
|
|
396
|
-
: describeCron(cronValue, t)
|
|
397
|
-
}
|
|
398
|
-
</span>
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<p className="text-xs text-[var(--color-text-tertiary)]">
|
|
402
|
-
{t('newTask.delayNote')}
|
|
403
|
-
</p>
|
|
404
|
-
</div>
|
|
405
|
-
</Modal>
|
|
406
|
-
)
|
|
407
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { PermissionModeSelector } from '../controls/PermissionModeSelector'
|
|
2
|
-
import { ModelSelector } from '../controls/ModelSelector'
|
|
3
|
-
import { DirectoryPicker } from '../shared/DirectoryPicker'
|
|
4
|
-
import { useTranslation } from '../../i18n'
|
|
5
|
-
import type { PermissionMode } from '../../types/settings'
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
value: string
|
|
9
|
-
onChange: (value: string) => void
|
|
10
|
-
placeholder?: string
|
|
11
|
-
|
|
12
|
-
permissionMode: PermissionMode
|
|
13
|
-
onPermissionModeChange: (mode: PermissionMode) => void
|
|
14
|
-
|
|
15
|
-
modelId: string
|
|
16
|
-
onModelChange: (modelId: string) => void
|
|
17
|
-
|
|
18
|
-
folderPath: string
|
|
19
|
-
onFolderPathChange: (path: string) => void
|
|
20
|
-
|
|
21
|
-
useWorktree: boolean
|
|
22
|
-
onUseWorktreeChange: (checked: boolean) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function PromptEditor({
|
|
26
|
-
value,
|
|
27
|
-
onChange,
|
|
28
|
-
placeholder,
|
|
29
|
-
permissionMode,
|
|
30
|
-
onPermissionModeChange,
|
|
31
|
-
modelId,
|
|
32
|
-
onModelChange,
|
|
33
|
-
folderPath,
|
|
34
|
-
onFolderPathChange,
|
|
35
|
-
useWorktree: _useWorktree,
|
|
36
|
-
onUseWorktreeChange: _onUseWorktreeChange,
|
|
37
|
-
}: Props) {
|
|
38
|
-
const t = useTranslation()
|
|
39
|
-
return (
|
|
40
|
-
<div className="rounded-[var(--radius-lg)] border border-[var(--color-border)] focus-within:border-[var(--color-border-focus)] transition-colors overflow-visible">
|
|
41
|
-
{/* Prompt textarea */}
|
|
42
|
-
<textarea
|
|
43
|
-
value={value}
|
|
44
|
-
onChange={(e) => onChange(e.target.value)}
|
|
45
|
-
placeholder={placeholder}
|
|
46
|
-
rows={4}
|
|
47
|
-
className="w-full resize-y bg-transparent px-3 py-2.5 text-sm leading-relaxed text-[var(--color-text-primary)] outline-none placeholder:text-[var(--color-text-tertiary)]"
|
|
48
|
-
style={{ minHeight: 120 }}
|
|
49
|
-
/>
|
|
50
|
-
|
|
51
|
-
{/* Bottom toolbar */}
|
|
52
|
-
<div className="border-t border-[var(--color-border)]/40 px-3 py-2 flex flex-col gap-2 bg-[var(--color-surface-container-low)] rounded-b-[var(--radius-lg)]">
|
|
53
|
-
{/* Row 1: Permission + Model selectors */}
|
|
54
|
-
<div className="flex items-center justify-between">
|
|
55
|
-
<PermissionModeSelector value={permissionMode} onChange={onPermissionModeChange} workDir={folderPath || undefined} />
|
|
56
|
-
<ModelSelector value={modelId} onChange={onModelChange} />
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
{/* Row 2: Folder picker */}
|
|
60
|
-
<div className="flex items-center justify-between">
|
|
61
|
-
<DirectoryPicker value={folderPath} onChange={onFolderPathChange} />
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
{/* Bypass + no folder warning */}
|
|
65
|
-
{permissionMode === 'bypassPermissions' && (
|
|
66
|
-
<div className="flex items-center gap-1.5 px-2 py-1.5 rounded-md bg-[var(--color-error)]/8 text-[10px] text-[var(--color-error)]">
|
|
67
|
-
<span className="material-symbols-outlined text-[12px]">warning</span>
|
|
68
|
-
{t('promptEditor.bypassWarning')}{folderPath ? ` ${t('promptEditor.within')} ${folderPath}` : ` ${t('promptEditor.selectFolder')}`}.
|
|
69
|
-
</div>
|
|
70
|
-
)}
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Button } from '../shared/Button'
|
|
2
|
-
import { useTranslation } from '../../i18n'
|
|
3
|
-
|
|
4
|
-
type Props = {
|
|
5
|
-
onCreateTask: () => void
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function TaskEmptyState({ onCreateTask }: Props) {
|
|
9
|
-
const t = useTranslation()
|
|
10
|
-
return (
|
|
11
|
-
<div className="flex flex-col items-center justify-center py-20">
|
|
12
|
-
{/* Clock icon */}
|
|
13
|
-
<div className="w-16 h-16 rounded-full bg-[var(--color-surface-info)] flex items-center justify-center mb-4">
|
|
14
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="var(--color-text-tertiary)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round">
|
|
15
|
-
<circle cx="12" cy="12" r="10" />
|
|
16
|
-
<polyline points="12 6 12 12 16 14" />
|
|
17
|
-
</svg>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<h3 className="text-sm font-medium text-[var(--color-text-primary)] mb-1">
|
|
21
|
-
{t('tasks.emptyTitle')}
|
|
22
|
-
</h3>
|
|
23
|
-
<p className="text-sm text-[var(--color-text-tertiary)] mb-4 text-center max-w-sm">
|
|
24
|
-
{t('tasks.emptyDesc')}
|
|
25
|
-
</p>
|
|
26
|
-
|
|
27
|
-
<Button onClick={onCreateTask}>{t('tasks.newTask')}</Button>
|
|
28
|
-
</div>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
import type { CronTask } from '../../types/task'
|
|
3
|
-
import { TaskRow } from './TaskRow'
|
|
4
|
-
import { useTranslation } from '../../i18n'
|
|
5
|
-
|
|
6
|
-
type Props = {
|
|
7
|
-
tasks: CronTask[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function TaskList({ tasks }: Props) {
|
|
11
|
-
const t = useTranslation()
|
|
12
|
-
const enabledCount = tasks.filter((task) => task.enabled).length
|
|
13
|
-
const [expandedLogsId, setExpandedLogsId] = useState<string | null>(null)
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
{/* Stats */}
|
|
18
|
-
<div className="grid grid-cols-3 gap-4 mb-6">
|
|
19
|
-
<StatCard label={t('tasks.totalTasks')} value={String(tasks.length)} />
|
|
20
|
-
<StatCard label={t('tasks.active')} value={String(enabledCount)} />
|
|
21
|
-
<StatCard label={t('tasks.disabled')} value={String(tasks.length - enabledCount)} />
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
{/* Task rows — accordion: only one logs panel open at a time */}
|
|
25
|
-
<div className="flex flex-col">
|
|
26
|
-
{tasks.map((task) => (
|
|
27
|
-
<TaskRow
|
|
28
|
-
key={task.id}
|
|
29
|
-
task={task}
|
|
30
|
-
showLogs={expandedLogsId === task.id}
|
|
31
|
-
onToggleLogs={() => setExpandedLogsId(expandedLogsId === task.id ? null : task.id)}
|
|
32
|
-
/>
|
|
33
|
-
))}
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function StatCard({ label, value }: { label: string; value: string }) {
|
|
40
|
-
return (
|
|
41
|
-
<div className="px-4 py-3 rounded-[var(--radius-lg)] bg-[var(--color-surface-info)]">
|
|
42
|
-
<div className="text-2xl font-bold text-[var(--color-text-primary)]">{value}</div>
|
|
43
|
-
<div className="text-xs text-[var(--color-text-secondary)]">{label}</div>
|
|
44
|
-
</div>
|
|
45
|
-
)
|
|
46
|
-
}
|