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.
Files changed (184) hide show
  1. package/package.json +1 -1
  2. package/desktop/README.md +0 -30
  3. package/desktop/bunfig.toml +0 -1
  4. package/desktop/index.html +0 -17
  5. package/desktop/package.json +0 -55
  6. package/desktop/pnpm-lock.yaml +0 -3832
  7. package/desktop/public/app-icon.jpg +0 -0
  8. package/desktop/public/fonts/inter-latin-ext.woff2 +0 -0
  9. package/desktop/public/fonts/inter-latin.woff2 +0 -0
  10. package/desktop/public/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
  11. package/desktop/public/fonts/jetbrains-mono-latin.woff2 +0 -0
  12. package/desktop/public/fonts/manrope-latin-ext.woff2 +0 -0
  13. package/desktop/public/fonts/manrope-latin.woff2 +0 -0
  14. package/desktop/public/fonts/material-symbols-outlined.woff2 +0 -0
  15. package/desktop/public/icons/bilibili.svg +0 -1
  16. package/desktop/public/icons/douyin.svg +0 -1
  17. package/desktop/public/icons/github.svg +0 -3
  18. package/desktop/public/icons/xiaohongshu.svg +0 -1
  19. package/desktop/scripts/build-macos-arm64.sh +0 -270
  20. package/desktop/scripts/build-sidecars.ts +0 -183
  21. package/desktop/scripts/build-windows-x64.ps1 +0 -295
  22. package/desktop/scripts/scan-missing-imports.ts +0 -235
  23. package/desktop/sidecars/claude-sidecar.ts +0 -156
  24. package/desktop/src/App.tsx +0 -5
  25. package/desktop/src/__tests__/agentsSettings.test.tsx +0 -349
  26. package/desktop/src/__tests__/pages.test.tsx +0 -290
  27. package/desktop/src/__tests__/skillsSettings.test.tsx +0 -205
  28. package/desktop/src/api/adapters.ts +0 -12
  29. package/desktop/src/api/agents.ts +0 -36
  30. package/desktop/src/api/cliTasks.ts +0 -28
  31. package/desktop/src/api/client.ts +0 -63
  32. package/desktop/src/api/computerUse.ts +0 -76
  33. package/desktop/src/api/filesystem.ts +0 -30
  34. package/desktop/src/api/hahaOAuth.ts +0 -38
  35. package/desktop/src/api/models.ts +0 -28
  36. package/desktop/src/api/providers.ts +0 -63
  37. package/desktop/src/api/search.ts +0 -29
  38. package/desktop/src/api/sessions.ts +0 -56
  39. package/desktop/src/api/settings.ts +0 -20
  40. package/desktop/src/api/skills.ts +0 -19
  41. package/desktop/src/api/tasks.ts +0 -36
  42. package/desktop/src/api/teams.ts +0 -44
  43. package/desktop/src/api/websocket.ts +0 -164
  44. package/desktop/src/components/chat/AskUserQuestion.tsx +0 -268
  45. package/desktop/src/components/chat/AssistantMessage.tsx +0 -29
  46. package/desktop/src/components/chat/AttachmentGallery.tsx +0 -113
  47. package/desktop/src/components/chat/ChatInput.tsx +0 -622
  48. package/desktop/src/components/chat/CodeViewer.tsx +0 -161
  49. package/desktop/src/components/chat/ComputerUsePermissionModal.test.tsx +0 -174
  50. package/desktop/src/components/chat/ComputerUsePermissionModal.tsx +0 -311
  51. package/desktop/src/components/chat/DiffViewer.tsx +0 -157
  52. package/desktop/src/components/chat/FileSearchMenu.tsx +0 -198
  53. package/desktop/src/components/chat/ImageGalleryModal.tsx +0 -91
  54. package/desktop/src/components/chat/InlineImageGallery.tsx +0 -106
  55. package/desktop/src/components/chat/InlineTaskSummary.tsx +0 -60
  56. package/desktop/src/components/chat/MermaidRenderer.test.tsx +0 -98
  57. package/desktop/src/components/chat/MermaidRenderer.tsx +0 -361
  58. package/desktop/src/components/chat/MessageActionBar.tsx +0 -27
  59. package/desktop/src/components/chat/MessageList.test.tsx +0 -313
  60. package/desktop/src/components/chat/MessageList.tsx +0 -249
  61. package/desktop/src/components/chat/PermissionDialog.tsx +0 -262
  62. package/desktop/src/components/chat/SessionTaskBar.test.tsx +0 -99
  63. package/desktop/src/components/chat/SessionTaskBar.tsx +0 -159
  64. package/desktop/src/components/chat/StreamingIndicator.tsx +0 -41
  65. package/desktop/src/components/chat/TerminalChrome.tsx +0 -35
  66. package/desktop/src/components/chat/ThinkingBlock.tsx +0 -87
  67. package/desktop/src/components/chat/ToolCallBlock.tsx +0 -247
  68. package/desktop/src/components/chat/ToolCallGroup.tsx +0 -617
  69. package/desktop/src/components/chat/ToolResultBlock.tsx +0 -107
  70. package/desktop/src/components/chat/UserMessage.tsx +0 -38
  71. package/desktop/src/components/chat/chatBlocks.test.tsx +0 -136
  72. package/desktop/src/components/chat/clipboard.ts +0 -25
  73. package/desktop/src/components/chat/composerUtils.test.ts +0 -55
  74. package/desktop/src/components/chat/composerUtils.ts +0 -149
  75. package/desktop/src/components/controls/ModelSelector.tsx +0 -156
  76. package/desktop/src/components/controls/PermissionModeSelector.tsx +0 -229
  77. package/desktop/src/components/layout/AppShell.tsx +0 -107
  78. package/desktop/src/components/layout/ContentRouter.tsx +0 -27
  79. package/desktop/src/components/layout/ProjectFilter.tsx +0 -126
  80. package/desktop/src/components/layout/Sidebar.test.tsx +0 -158
  81. package/desktop/src/components/layout/Sidebar.tsx +0 -384
  82. package/desktop/src/components/layout/StatusBar.tsx +0 -31
  83. package/desktop/src/components/layout/TabBar.test.tsx +0 -136
  84. package/desktop/src/components/layout/TabBar.tsx +0 -318
  85. package/desktop/src/components/layout/TitleBar.tsx +0 -96
  86. package/desktop/src/components/layout/WindowControls.test.tsx +0 -69
  87. package/desktop/src/components/layout/WindowControls.tsx +0 -89
  88. package/desktop/src/components/markdown/MarkdownRenderer.test.tsx +0 -100
  89. package/desktop/src/components/markdown/MarkdownRenderer.tsx +0 -229
  90. package/desktop/src/components/settings/ClaudeOfficialLogin.tsx +0 -107
  91. package/desktop/src/components/shared/Button.tsx +0 -63
  92. package/desktop/src/components/shared/CopyButton.tsx +0 -58
  93. package/desktop/src/components/shared/DirectoryPicker.tsx +0 -316
  94. package/desktop/src/components/shared/Dropdown.tsx +0 -91
  95. package/desktop/src/components/shared/Input.tsx +0 -38
  96. package/desktop/src/components/shared/Modal.tsx +0 -65
  97. package/desktop/src/components/shared/ProjectContextChip.tsx +0 -30
  98. package/desktop/src/components/shared/Spinner.tsx +0 -30
  99. package/desktop/src/components/shared/Textarea.tsx +0 -38
  100. package/desktop/src/components/shared/Toast.tsx +0 -47
  101. package/desktop/src/components/shared/UpdateChecker.tsx +0 -90
  102. package/desktop/src/components/skills/SkillDetail.test.tsx +0 -89
  103. package/desktop/src/components/skills/SkillDetail.tsx +0 -403
  104. package/desktop/src/components/skills/SkillList.tsx +0 -254
  105. package/desktop/src/components/tasks/DayOfWeekPicker.tsx +0 -57
  106. package/desktop/src/components/tasks/NewTaskModal.tsx +0 -407
  107. package/desktop/src/components/tasks/PromptEditor.tsx +0 -74
  108. package/desktop/src/components/tasks/TaskEmptyState.tsx +0 -30
  109. package/desktop/src/components/tasks/TaskList.tsx +0 -46
  110. package/desktop/src/components/tasks/TaskRow.tsx +0 -253
  111. package/desktop/src/components/tasks/TaskRunsPanel.tsx +0 -195
  112. package/desktop/src/components/teams/TeamStatusBar.tsx +0 -147
  113. package/desktop/src/config/providerPresets.ts +0 -78
  114. package/desktop/src/config/spinnerVerbs.ts +0 -193
  115. package/desktop/src/hooks/useKeyboardShortcuts.ts +0 -60
  116. package/desktop/src/i18n/index.ts +0 -54
  117. package/desktop/src/i18n/locales/en.ts +0 -670
  118. package/desktop/src/i18n/locales/zh.ts +0 -670
  119. package/desktop/src/lib/__tests__/cronDescribe.test.ts +0 -93
  120. package/desktop/src/lib/cronDescribe.ts +0 -188
  121. package/desktop/src/lib/desktopRuntime.ts +0 -54
  122. package/desktop/src/lib/parseRunOutput.ts +0 -79
  123. package/desktop/src/main.tsx +0 -13
  124. package/desktop/src/mocks/data.ts +0 -202
  125. package/desktop/src/pages/ActiveSession.test.tsx +0 -181
  126. package/desktop/src/pages/ActiveSession.tsx +0 -219
  127. package/desktop/src/pages/AdapterSettings.tsx +0 -375
  128. package/desktop/src/pages/AgentTeams.tsx +0 -200
  129. package/desktop/src/pages/ComputerUseSettings.tsx +0 -420
  130. package/desktop/src/pages/EmptySession.tsx +0 -518
  131. package/desktop/src/pages/NewTaskModal.tsx +0 -346
  132. package/desktop/src/pages/ScheduledTasks.tsx +0 -66
  133. package/desktop/src/pages/ScheduledTasksEmpty.tsx +0 -152
  134. package/desktop/src/pages/ScheduledTasksList.tsx +0 -416
  135. package/desktop/src/pages/SessionControls.tsx +0 -460
  136. package/desktop/src/pages/Settings.tsx +0 -1448
  137. package/desktop/src/pages/ToolInspection.tsx +0 -235
  138. package/desktop/src/stores/adapterStore.ts +0 -106
  139. package/desktop/src/stores/agentStore.ts +0 -34
  140. package/desktop/src/stores/chatStore.test.ts +0 -505
  141. package/desktop/src/stores/chatStore.ts +0 -850
  142. package/desktop/src/stores/cliTaskStore.ts +0 -152
  143. package/desktop/src/stores/hahaOAuthStore.test.ts +0 -77
  144. package/desktop/src/stores/hahaOAuthStore.ts +0 -97
  145. package/desktop/src/stores/providerStore.ts +0 -101
  146. package/desktop/src/stores/sessionStore.test.ts +0 -63
  147. package/desktop/src/stores/sessionStore.ts +0 -102
  148. package/desktop/src/stores/settingsStore.ts +0 -120
  149. package/desktop/src/stores/skillStore.ts +0 -51
  150. package/desktop/src/stores/tabStore.ts +0 -169
  151. package/desktop/src/stores/taskStore.ts +0 -68
  152. package/desktop/src/stores/teamStore.ts +0 -344
  153. package/desktop/src/stores/uiStore.ts +0 -100
  154. package/desktop/src/stores/updateStore.test.ts +0 -71
  155. package/desktop/src/stores/updateStore.ts +0 -221
  156. package/desktop/src/theme/globals.css +0 -465
  157. package/desktop/src/types/adapter.ts +0 -33
  158. package/desktop/src/types/chat.ts +0 -152
  159. package/desktop/src/types/cliTask.ts +0 -24
  160. package/desktop/src/types/provider.ts +0 -62
  161. package/desktop/src/types/session.ts +0 -27
  162. package/desktop/src/types/settings.ts +0 -22
  163. package/desktop/src/types/skill.ts +0 -38
  164. package/desktop/src/types/task.ts +0 -56
  165. package/desktop/src/types/team.ts +0 -38
  166. package/desktop/src-tauri/Cargo.lock +0 -5549
  167. package/desktop/src-tauri/Cargo.toml +0 -20
  168. package/desktop/src-tauri/app-icon.svg +0 -13
  169. package/desktop/src-tauri/build.rs +0 -3
  170. package/desktop/src-tauri/capabilities/default.json +0 -106
  171. package/desktop/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  172. package/desktop/src-tauri/icons/android/values/ic_launcher_background.xml +0 -4
  173. package/desktop/src-tauri/icons/icon.icns +0 -0
  174. package/desktop/src-tauri/icons/icon.ico +0 -0
  175. package/desktop/src-tauri/src/lib.rs +0 -408
  176. package/desktop/src-tauri/src/main.rs +0 -6
  177. package/desktop/src-tauri/tauri.conf.json +0 -78
  178. package/desktop/src-tauri/tauri.macos.conf.json +0 -18
  179. package/desktop/src-tauri/tauri.release-ci.json +0 -5
  180. package/desktop/src-tauri/tauri.windows.conf.json +0 -16
  181. package/desktop/src-tauri/windows-installer-hooks.nsh +0 -17
  182. package/desktop/tsconfig.json +0 -25
  183. package/desktop/vite.config.ts +0 -26
  184. package/desktop/vitest.config.ts +0 -18
@@ -1,93 +0,0 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { describeCron, isValidCron } from '../cronDescribe'
3
-
4
- // Simple mock t() that returns the key with params interpolated
5
- const t = (key: string, params?: Record<string, string | number>) => {
6
- let text = key
7
- if (params) {
8
- for (const [k, v] of Object.entries(params)) {
9
- text = text.replace(new RegExp(`\\{${k}\\}`, 'g'), String(v))
10
- }
11
- }
12
- return text
13
- }
14
-
15
- describe('describeCron', () => {
16
- it('every minute', () => {
17
- expect(describeCron('* * * * *', t)).toBe('cron.everyMinute')
18
- })
19
-
20
- it('every N minutes', () => {
21
- expect(describeCron('*/15 * * * *', t)).toBe('cron.everyNMinutes')
22
- expect(describeCron('*/5 * * * *', t)).toBe('cron.everyNMinutes')
23
- })
24
-
25
- it('*/1 is treated as every minute', () => {
26
- expect(describeCron('*/1 * * * *', t)).toBe('cron.everyMinute')
27
- })
28
-
29
- it('every hour', () => {
30
- expect(describeCron('0 */1 * * *', t)).toBe('cron.everyHour')
31
- })
32
-
33
- it('every N hours', () => {
34
- expect(describeCron('0 */4 * * *', t)).toBe('cron.everyNHours')
35
- })
36
-
37
- it('every N hours at minute offset', () => {
38
- expect(describeCron('30 */4 * * *', t)).toBe('cron.everyNHoursAtMinute')
39
- })
40
-
41
- it('daily at time', () => {
42
- expect(describeCron('30 9 * * *', t)).toBe('cron.dailyAt')
43
- })
44
-
45
- it('weekdays at time', () => {
46
- expect(describeCron('30 9 * * 1-5', t)).toBe('cron.weekdaysAt')
47
- })
48
-
49
- it('specific days of week', () => {
50
- const result = describeCron('0 9 * * 1,3,5', t)
51
- expect(result).toBe('cron.specificDaysAt')
52
- })
53
-
54
- it('monthly on specific day', () => {
55
- expect(describeCron('0 9 15 * *', t)).toBe('cron.monthlyAt')
56
- })
57
-
58
- it('unrecognized pattern falls back to custom', () => {
59
- expect(describeCron('0 9 1 6 *', t)).toBe('cron.customSchedule')
60
- })
61
-
62
- it('invalid field count falls back to custom', () => {
63
- expect(describeCron('0 9 *', t)).toBe('cron.customSchedule')
64
- })
65
- })
66
-
67
- describe('isValidCron', () => {
68
- it('accepts valid expressions', () => {
69
- expect(isValidCron('0 9 * * *')).toBe(true)
70
- expect(isValidCron('*/15 * * * *')).toBe(true)
71
- expect(isValidCron('30 14 * * 1-5')).toBe(true)
72
- expect(isValidCron('0 9 * * 1,3,5')).toBe(true)
73
- expect(isValidCron('0 9 15 * *')).toBe(true)
74
- expect(isValidCron('0 */2 * * *')).toBe(true)
75
- })
76
-
77
- it('rejects invalid expressions', () => {
78
- expect(isValidCron('')).toBe(false)
79
- expect(isValidCron('hello')).toBe(false)
80
- expect(isValidCron('0 9 *')).toBe(false) // too few fields
81
- expect(isValidCron('0 9 * * * *')).toBe(false) // too many fields
82
- expect(isValidCron('60 9 * * *')).toBe(false) // minute > 59
83
- expect(isValidCron('0 25 * * *')).toBe(false) // hour > 23
84
- expect(isValidCron('0 9 32 * *')).toBe(false) // day > 31
85
- expect(isValidCron('0 9 * 13 *')).toBe(false) // month > 12
86
- expect(isValidCron('0 9 * * 8')).toBe(false) // dow > 7
87
- })
88
-
89
- it('accepts edge case values', () => {
90
- expect(isValidCron('0 0 1 1 0')).toBe(true)
91
- expect(isValidCron('59 23 31 12 7')).toBe(true)
92
- })
93
- })
@@ -1,188 +0,0 @@
1
- /**
2
- * Cron expression utilities: human-readable description & validation.
3
- * Works with standard 5-field cron: minute hour day-of-month month day-of-week
4
- */
5
-
6
- import type { TranslationKey } from '../i18n'
7
-
8
- type TFunc = (key: TranslationKey, params?: Record<string, string | number>) => string
9
-
10
- function pad(n: number): string {
11
- return n.toString().padStart(2, '0')
12
- }
13
-
14
- function formatTime(hour: number, minute: number): string {
15
- return `${pad(hour)}:${pad(minute)}`
16
- }
17
-
18
- function describeDow(field: string, t: TFunc): string {
19
- const parts = field.split(',')
20
- const days: number[] = []
21
- for (const part of parts) {
22
- const range = part.match(/^(\d+)-(\d+)$/)
23
- if (range) {
24
- const start = parseInt(range[1]!)
25
- const end = parseInt(range[2]!)
26
- for (let i = start; i <= end; i++) days.push(i)
27
- } else {
28
- days.push(parseInt(part))
29
- }
30
- }
31
- return days.map((d) => t(`cron.dow.${d % 7}` as any)).join(', ') // dynamic key
32
- }
33
-
34
- export function describeCron(cron: string, t: TFunc): string {
35
- const fields = cron.trim().split(/\s+/)
36
- if (fields.length !== 5) return t('cron.customSchedule', { cron })
37
-
38
- const min = fields[0]!
39
- const hour = fields[1]!
40
- const dom = fields[2]!
41
- const month = fields[3]!
42
- const dow = fields[4]!
43
-
44
- // */N * * * * → every N minutes
45
- if (hour === '*' && dom === '*' && month === '*' && dow === '*') {
46
- const stepMatch = min.match(/^\*\/(\d+)$/)
47
- if (stepMatch) {
48
- const n = parseInt(stepMatch[1]!)
49
- if (n === 1) return t('cron.everyMinute')
50
- return t('cron.everyNMinutes', { n })
51
- }
52
- if (min === '*') return t('cron.everyMinute')
53
- }
54
-
55
- // M */N * * * → every N hours (optionally at :M)
56
- if (/^\d+$/.test(min) && dom === '*' && month === '*' && dow === '*') {
57
- const hourStep = hour.match(/^\*\/(\d+)$/)
58
- if (hourStep) {
59
- const n = parseInt(hourStep[1]!)
60
- const m = parseInt(min)
61
- if (m === 0) {
62
- if (n === 1) return t('cron.everyHour')
63
- return t('cron.everyNHours', { n })
64
- }
65
- return t('cron.everyNHoursAtMinute', { n, m: pad(m) })
66
- }
67
- }
68
-
69
- // M H * * <dow> → daily / weekdays / specific days
70
- if (/^\d+$/.test(min) && /^\d+$/.test(hour) && dom === '*' && month === '*') {
71
- const time = formatTime(parseInt(hour), parseInt(min))
72
-
73
- if (dow === '*') {
74
- return t('cron.dailyAt', { time })
75
- }
76
- if (dow === '1-5') {
77
- return t('cron.weekdaysAt', { time })
78
- }
79
- if (/^[\d,\-]+$/.test(dow)) {
80
- const days = describeDow(dow, t)
81
- return t('cron.specificDaysAt', { days, time })
82
- }
83
- }
84
-
85
- // M H D * * → monthly on day D
86
- if (/^\d+$/.test(min) && /^\d+$/.test(hour) && /^\d+$/.test(dom) && month === '*' && dow === '*') {
87
- const time = formatTime(parseInt(hour), parseInt(min))
88
- return t('cron.monthlyAt', { day: parseInt(dom), time })
89
- }
90
-
91
- return t('cron.customSchedule', { cron })
92
- }
93
-
94
- /**
95
- * Reverse-parse a cron expression back into UI-friendly state
96
- * for the task edit modal.
97
- */
98
- export type FrequencyKey = 'everyNMinutes' | 'everyNHours' | 'daily' | 'weekdays' | 'specificDays' | 'monthly' | 'customCron'
99
-
100
- export type ParsedCron = {
101
- frequency: FrequencyKey
102
- time: string
103
- minuteInterval: number
104
- hourInterval: number
105
- minuteOffset: number
106
- selectedDays: number[]
107
- monthDay: number
108
- customCron: string
109
- }
110
-
111
- const DEFAULTS: ParsedCron = {
112
- frequency: 'customCron',
113
- time: '09:00',
114
- minuteInterval: 15,
115
- hourInterval: 1,
116
- minuteOffset: 0,
117
- selectedDays: [1],
118
- monthDay: 1,
119
- customCron: '',
120
- }
121
-
122
- export function parseCron(cron: string): ParsedCron {
123
- const fields = cron.trim().split(/\s+/)
124
- if (fields.length !== 5) return { ...DEFAULTS, customCron: cron }
125
-
126
- const min = fields[0]!
127
- const hour = fields[1]!
128
- const dom = fields[2]!
129
- const month = fields[3]!
130
- const dow = fields[4]!
131
-
132
- // */N * * * * → everyNMinutes
133
- if (/^\*\/\d+$/.test(min) && hour === '*' && dom === '*' && month === '*' && dow === '*') {
134
- return { ...DEFAULTS, frequency: 'everyNMinutes', minuteInterval: parseInt(min.split('/')[1]!) }
135
- }
136
-
137
- // M */N * * * → everyNHours
138
- if (/^\d+$/.test(min) && /^\*\/\d+$/.test(hour) && dom === '*' && month === '*' && dow === '*') {
139
- return { ...DEFAULTS, frequency: 'everyNHours', minuteOffset: parseInt(min), hourInterval: parseInt(hour.split('/')[1]!) }
140
- }
141
-
142
- // M H ... patterns need time
143
- if (/^\d+$/.test(min) && /^\d+$/.test(hour)) {
144
- const time = formatTime(parseInt(hour), parseInt(min))
145
-
146
- // M H * * * → daily
147
- if (dom === '*' && month === '*' && dow === '*') {
148
- return { ...DEFAULTS, frequency: 'daily', time }
149
- }
150
- // M H * * 1-5 → weekdays
151
- if (dom === '*' && month === '*' && dow === '1-5') {
152
- return { ...DEFAULTS, frequency: 'weekdays', time }
153
- }
154
- // M H * * <list> → specificDays
155
- if (dom === '*' && month === '*' && /^[\d,]+$/.test(dow)) {
156
- return { ...DEFAULTS, frequency: 'specificDays', time, selectedDays: dow.split(',').map(Number) }
157
- }
158
- // M H D * * → monthly
159
- if (/^\d+$/.test(dom) && month === '*' && dow === '*') {
160
- return { ...DEFAULTS, frequency: 'monthly', time, monthDay: parseInt(dom) }
161
- }
162
- }
163
-
164
- return { ...DEFAULTS, customCron: cron }
165
- }
166
-
167
- export function isValidCron(cron: string): boolean {
168
- const fields = cron.trim().split(/\s+/)
169
- if (fields.length !== 5) return false
170
-
171
- const fieldPattern = /^(\*|(\d+(-\d+)?(\/\d+)?)(,(\d+(-\d+)?(\/\d+)?))*)$/
172
- const maxValues = [59, 23, 31, 12, 7]
173
- const minValues = [0, 0, 1, 1, 0]
174
-
175
- for (let i = 0; i < 5; i++) {
176
- const field = fields[i]!
177
- if (/^\*\/\d+$/.test(field)) continue
178
- if (field === '*') continue
179
- if (!fieldPattern.test(field)) return false
180
- const nums = field.replace(/\/\d+/g, '').split(/[,\-]/).filter((s) => /^\d+$/.test(s))
181
- for (const num of nums) {
182
- const n = parseInt(num)
183
- if (n < minValues[i]! || n > maxValues[i]!) return false
184
- }
185
- }
186
-
187
- return true
188
- }
@@ -1,54 +0,0 @@
1
- import { getDefaultBaseUrl, setBaseUrl } from '../api/client'
2
-
3
- export function isTauriRuntime() {
4
- if (typeof window === 'undefined') return false
5
- return '__TAURI_INTERNALS__' in window || '__TAURI__' in window
6
- }
7
-
8
- export async function initializeDesktopServerUrl() {
9
- const fallbackUrl = getDefaultBaseUrl()
10
-
11
- if (!isTauriRuntime()) {
12
- setBaseUrl(fallbackUrl)
13
- return fallbackUrl
14
- }
15
-
16
- try {
17
- const { invoke } = await import(/* @vite-ignore */ '@tauri-apps/api/core')
18
- const serverUrl = await invoke<string>('get_server_url')
19
- setBaseUrl(serverUrl)
20
- await waitForHealth(serverUrl)
21
- return serverUrl
22
- } catch (error) {
23
- const message =
24
- error instanceof Error ? error.message : `desktop server startup failed: ${String(error)}`
25
- console.error('[desktop] Failed to initialize desktop server URL', error)
26
- throw new Error(message || `desktop server startup failed (fallback would be ${fallbackUrl})`)
27
- }
28
- }
29
-
30
- async function waitForHealth(serverUrl: string) {
31
- let lastError: unknown
32
-
33
- for (let attempt = 0; attempt < 30; attempt++) {
34
- try {
35
- const response = await fetch(`${serverUrl}/health`, {
36
- cache: 'no-store',
37
- })
38
- if (response.ok) {
39
- return
40
- }
41
- lastError = new Error(`healthcheck returned ${response.status}`)
42
- } catch (error) {
43
- lastError = error
44
- }
45
-
46
- await new Promise((resolve) => setTimeout(resolve, 250))
47
- }
48
-
49
- throw new Error(
50
- lastError instanceof Error
51
- ? `Local server healthcheck failed: ${lastError.message}`
52
- : 'Local server healthcheck failed',
53
- )
54
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * Parse task run output into displayable text.
3
- *
4
- * The output may be in one of two formats:
5
- *
6
- * 1. **Extracted text** (new runs) — The server's `extractAssistantText` has
7
- * already parsed the raw NDJSON and stored only the AI's text response.
8
- * This is plain text / markdown that should be returned as-is.
9
- *
10
- * 2. **Raw NDJSON** (old runs before the server-side extraction was added) —
11
- * Each line is a JSON object from the CLI's stream-json output. We parse
12
- * these and extract assistant text blocks + result messages.
13
- *
14
- * Detection: if at least one line parses as JSON with a recognized `type`
15
- * field, treat as NDJSON. Otherwise return as-is.
16
- */
17
- export function parseRunOutput(raw: string): string {
18
- if (!raw || !raw.trim()) return ''
19
-
20
- const lines = raw.trim().split('\n')
21
-
22
- // Quick check: does this look like NDJSON? (first non-empty line starts with '{')
23
- const firstLine = lines.find((l) => l.trim())
24
- if (!firstLine || !firstLine.trim().startsWith('{')) {
25
- // Already extracted plain text — return as-is
26
- return raw.trim()
27
- }
28
-
29
- // Try to parse as NDJSON (legacy format)
30
- const textParts: string[] = []
31
- let anyRecognized = false
32
-
33
- for (const line of lines) {
34
- if (!line.trim()) continue
35
-
36
- let parsed: any
37
- try {
38
- parsed = JSON.parse(line)
39
- } catch {
40
- continue
41
- }
42
-
43
- const type = parsed?.type
44
-
45
- if (type === 'assistant') {
46
- anyRecognized = true
47
- const content = parsed?.message?.content
48
- if (!Array.isArray(content)) continue
49
- for (const block of content) {
50
- if (block.type === 'text' && block.text?.trim()) {
51
- textParts.push(block.text.trim())
52
- }
53
- }
54
- }
55
-
56
- if (type === 'result') {
57
- anyRecognized = true
58
- const result = parsed?.result
59
- if (typeof result === 'string' && result.trim()) {
60
- textParts.push(result.trim())
61
- } else if (result?.message?.trim()) {
62
- textParts.push(result.message.trim())
63
- }
64
- }
65
-
66
- if (type === 'system' || type === 'user') {
67
- anyRecognized = true
68
- // Skip these — not useful to display
69
- }
70
- }
71
-
72
- // If we recognized NDJSON structure, return extracted text
73
- if (anyRecognized) {
74
- return textParts.join('\n\n')
75
- }
76
-
77
- // Fallback: the JSON lines didn't have recognized types — return raw
78
- return raw.trim()
79
- }
@@ -1,13 +0,0 @@
1
- import React from 'react'
2
- import ReactDOM from 'react-dom/client'
3
- import { App } from './App'
4
- import './theme/globals.css'
5
- import { initializeTheme } from './stores/uiStore'
6
-
7
- initializeTheme()
8
-
9
- ReactDOM.createRoot(document.getElementById('root')!).render(
10
- <React.StrictMode>
11
- <App />
12
- </React.StrictMode>,
13
- )
@@ -1,202 +0,0 @@
1
- /**
2
- * Mock data for all pages — matches the UI prototypes exactly.
3
- * Replace with real API calls once server integration is done.
4
- */
5
-
6
- // ─── Sessions ─────────────────────────────────────────────────────
7
- export const mockSessions = {
8
- today: [
9
- { id: 's1', title: 'Refactor login flow', modifiedAt: new Date().toISOString() },
10
- { id: 's2', title: 'Fix CSS responsive layout', modifiedAt: new Date().toISOString() },
11
- ],
12
- previous7Days: [
13
- { id: 's3', title: 'Add user authentication', modifiedAt: new Date(Date.now() - 3 * 86400000).toISOString() },
14
- { id: 's4', title: 'Database migration script', modifiedAt: new Date(Date.now() - 5 * 86400000).toISOString() },
15
- ],
16
- older: [
17
- { id: 's5', title: 'Initial project setup', modifiedAt: new Date(Date.now() - 30 * 86400000).toISOString() },
18
- ],
19
- }
20
-
21
- // ─── Active Session Messages ──────────────────────────────────────
22
- export const mockActiveMessages = [
23
- {
24
- id: 'm1',
25
- role: 'user' as const,
26
- content: "I want to refactor the login flow in `auth.ts`. Let's move the JWT signing logic to a separate helper and add validation for the user payload.",
27
- },
28
- {
29
- id: 'm2',
30
- role: 'assistant' as const,
31
- content: "Understood. I will begin by analyzing the current implementation of `auth.ts`. I'll extract the JWT logic into a new utility function and implement the validation layer as requested.",
32
- thinking: "Looking at the auth.ts file, the JWT signing is currently inline in the login handler. I need to:\n1. Extract signToken() helper\n2. Add Zod validation for LoginPayload\n3. Update the handler to use both",
33
- },
34
- {
35
- id: 'm3',
36
- role: 'tool' as const,
37
- toolName: 'edit_file',
38
- toolStatus: 'success',
39
- filePath: 'src/lib/auth.ts',
40
- content: `export const validatePayload = (user) => { ... }
41
- export const signToken = (payload) => jwt.sign(payload, SECRET);
42
- // 8 OLD LINES REMOVED`,
43
- },
44
- ]
45
-
46
- // ─── Agent Teams ──────────────────────────────────────────────────
47
- export const mockTeam = {
48
- name: 'session-dev',
49
- memberCount: 4,
50
- members: [
51
- { id: 'a1', role: 'Architect', status: 'completed' as const, color: '#16a34a' },
52
- { id: 'a2', role: 'Frontend Dev', status: 'running' as const, color: '#dc2626' },
53
- { id: 'a3', role: 'Backend Dev', status: 'running' as const, color: '#2563eb' },
54
- { id: 'a4', role: 'Tester', status: 'idle' as const, color: '#9333ea' },
55
- ],
56
- }
57
-
58
- export const mockTeamMessages = {
59
- userMessage: "Refactor the authentication middleware to support JWT and OAuth2 simultaneously. Ensure we have proper test coverage for the edge cases.",
60
- assistantMessage: "I've initiated the agent team for this task. The architect is designing the interface, while the developers are preparing the boilerplate for the new strategies.",
61
- systemInfo: `Info: spawning child_processes for parallel development
62
- active: session-dev cluster initiated
63
- ready: 4 agents assigned`,
64
- }
65
-
66
- // ─── Agent Transcript ─────────────────────────────────────────────
67
- export const mockTranscript = {
68
- agentName: 'Frontend Dev',
69
- messages: [
70
- {
71
- id: 't1',
72
- role: 'agent' as const,
73
- timestamp: 'P1:42:11',
74
- content: "I've analyzed the component structure. I need to update the `Navigation.tsx` to include the new responsive breakpoints. Initiating local file system audit.",
75
- },
76
- {
77
- id: 't2',
78
- role: 'tool' as const,
79
- toolName: 'BASH',
80
- status: 'SUCCESS' as const,
81
- command: '$ grep -r "breakpoint" .\n./Navigation.tsx: const [isMobile, setIsMobile] = useState(false);\n./Navigation.tsx: // TODO: Add mobile breakpoint check\n./Header.tsx: @media (max-width: 768px) {',
82
- },
83
- {
84
- id: 't3',
85
- role: 'progress' as const,
86
- label: 'Patching Navigation.tsx',
87
- progress: 67,
88
- },
89
- {
90
- id: 't4',
91
- role: 'agent' as const,
92
- timestamp: 'P1:44:35',
93
- content: "Breakpoint logic implemented. I'm now verifying the CSS-in-JS injection to ensure no style collisions with the existing theme.",
94
- images: ['/placeholder-code-1.jpg', '/placeholder-code-2.jpg'],
95
- },
96
- ],
97
- teamBar: [
98
- { id: 'lead', role: 'Lead Claude', active: false, color: '#87736D' },
99
- { id: 'a2', role: 'Frontend Dev', active: true, color: '#dc2626' },
100
- { id: 'a3', role: 'Backend Architect', active: false, color: '#2563eb' },
101
- ],
102
- }
103
-
104
- // ─── Scheduled Tasks ──────────────────────────────────────────────
105
- export const mockScheduledTasks = {
106
- stats: {
107
- totalTasks: 12,
108
- activeHealthy: 9,
109
- nextRun: { name: 'Nightly linting', time: 'Today, 11:30 PM' },
110
- systemHealth: 99.8,
111
- healthPeriod: 'Last 30 days execution rate',
112
- },
113
- tasks: [
114
- {
115
- id: 'task1',
116
- name: 'Nightly linting',
117
- frequency: 'Daily',
118
- lastResult: 'Success' as const,
119
- nextExecution: 'Today, 11:30 PM',
120
- },
121
- {
122
- id: 'task2',
123
- name: 'Clean up temp files',
124
- description: 'Clean TempOutput/**',
125
- frequency: 'Weekly',
126
- lastResult: 'Success' as const,
127
- nextExecution: 'Sun, 2:00 AM',
128
- },
129
- {
130
- id: 'task3',
131
- name: 'Database Vacuum',
132
- description: 'Postgres maintenance',
133
- frequency: 'Monthly',
134
- lastResult: 'Failed (Disk Full)' as const,
135
- nextExecution: 'Dec 01, 9:01 AM',
136
- },
137
- ],
138
- }
139
-
140
- // ─── Session Controls ─────────────────────────────────────────────
141
- export const mockPermissionModes = [
142
- { id: 'ask', label: 'Ask permissions', description: 'Confirm every file edit or terminal command.', icon: 'lock' },
143
- { id: 'auto', label: 'Auto accept edits', description: 'Claude writes to disk without asking.', icon: 'edit_note' },
144
- { id: 'plan', label: 'Plan mode', description: 'Architecture & reasoning only. No writes.', icon: 'architecture' },
145
- { id: 'bypass', label: 'Bypass permissions', description: 'Full root access for shell and file system.', icon: 'warning' },
146
- ]
147
-
148
- export const mockModels = [
149
- { id: 'opus', name: 'Opus 4.7', active: false },
150
- { id: 'sonnet', name: 'Sonnet 4.6', active: true },
151
- { id: 'haiku', name: 'Haiku 4.5', active: false },
152
- ]
153
-
154
- export const mockEffortLevels = ['Low', 'Medium', 'High', 'Max']
155
-
156
- // ─── Tool Inspection (edit_file diff) ─────────────────────────────
157
- export const mockToolInspection = {
158
- toolType: 'TOOL CALL',
159
- toolName: 'edit_file',
160
- description: 'Updating login logic to use new SDK',
161
- filePath: 'src/lib/auth.ts',
162
- dryRunStatus: 'Dry-run Success',
163
- linesChanged: { added: 12, removed: 8 },
164
- diffLines: [
165
- { type: 'context' as const, lineNo: 1, content: 'export async function loginCredentials: LoginCredentials): Promise<LoginResponse> {' },
166
- { type: 'context' as const, lineNo: 2, content: ' try {' },
167
- { type: 'removed' as const, lineNo: 3, content: ' const response = await legacyHttpClient.authenticate()' },
168
- { type: 'added' as const, lineNo: 3, content: ' const response = await httpClient.authenticate({' },
169
- { type: 'added' as const, lineNo: 4, content: ' user: credentials.username,' },
170
- { type: 'added' as const, lineNo: 5, content: ' pass: credentials.password,' },
171
- { type: 'context' as const, lineNo: 6, content: ' })' },
172
- { type: 'context' as const, lineNo: 7, content: '' },
173
- { type: 'removed' as const, lineNo: 8, content: ' const client = await createClient();' },
174
- { type: 'added' as const, lineNo: 8, content: ' const client = await newSdkClient.create({' },
175
- { type: 'added' as const, lineNo: 9, content: ' identifier: credentials.username,' },
176
- { type: 'added' as const, lineNo: 10, content: ' secret: credentials.password,' },
177
- { type: 'context' as const, lineNo: 11, content: '' },
178
- { type: 'added' as const, lineNo: 12, content: ' options: { persistent: true }' },
179
- { type: 'context' as const, lineNo: 13, content: ' })' },
180
- { type: 'context' as const, lineNo: 14, content: '' },
181
- { type: 'context' as const, lineNo: 15, content: ' if (response.status === 200) {' },
182
- { type: 'context' as const, lineNo: 16, content: ' return response.data;' },
183
- ],
184
- }
185
-
186
- // ─── New Task Modal ───────────────────────────────────────────────
187
- export const mockNewTaskDefaults = {
188
- permissionModes: ['Restricted', 'Standard', 'Full Access'],
189
- models: ['Claude 3.5 Sonnet', 'Claude 3.5 Haiku', 'Claude 3.5 Opus'],
190
- frequencies: ['Hourly', 'Daily at 9:00 AM', 'Weekly', 'Monthly', 'Custom cron'],
191
- }
192
-
193
- // ─── Footer / Status Bar ──────────────────────────────────────────
194
- export const mockStatusBar = {
195
- user: 'User Avatar',
196
- username: 'username',
197
- plan: 'Pro Plan',
198
- branch: 'main-branch',
199
- worktreeToggle: 'worktree-toggle',
200
- localSwitch: 'local-switch',
201
- status: 'Ready',
202
- }