@geminilight/mindos 0.5.9 → 0.5.11

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 (63) hide show
  1. package/README.md +1 -1
  2. package/app/app/api/settings/test-key/route.ts +111 -0
  3. package/app/app/api/skills/route.ts +1 -1
  4. package/app/app/api/sync/route.ts +16 -31
  5. package/app/app/globals.css +10 -2
  6. package/app/app/login/page.tsx +1 -1
  7. package/app/app/view/[...path]/ViewPageClient.tsx +6 -1
  8. package/app/app/view/[...path]/not-found.tsx +1 -1
  9. package/app/components/AskModal.tsx +4 -4
  10. package/app/components/Breadcrumb.tsx +2 -2
  11. package/app/components/DirView.tsx +6 -6
  12. package/app/components/FileTree.tsx +2 -2
  13. package/app/components/HomeContent.tsx +7 -7
  14. package/app/components/OnboardingView.tsx +1 -1
  15. package/app/components/SearchModal.tsx +1 -1
  16. package/app/components/SettingsModal.tsx +2 -2
  17. package/app/components/SetupWizard.tsx +1 -1400
  18. package/app/components/Sidebar.tsx +4 -4
  19. package/app/components/SidebarLayout.tsx +9 -0
  20. package/app/components/SyncStatusBar.tsx +3 -3
  21. package/app/components/TableOfContents.tsx +1 -1
  22. package/app/components/UpdateBanner.tsx +1 -1
  23. package/app/components/ask/FileChip.tsx +1 -1
  24. package/app/components/ask/MentionPopover.tsx +4 -4
  25. package/app/components/ask/MessageList.tsx +1 -1
  26. package/app/components/ask/SessionHistory.tsx +2 -2
  27. package/app/components/renderers/config/ConfigRenderer.tsx +1 -1
  28. package/app/components/renderers/csv/BoardView.tsx +2 -2
  29. package/app/components/renderers/csv/ConfigPanel.tsx +5 -5
  30. package/app/components/renderers/csv/GalleryView.tsx +1 -1
  31. package/app/components/renderers/graph/GraphRenderer.tsx +1 -1
  32. package/app/components/renderers/summary/SummaryRenderer.tsx +1 -1
  33. package/app/components/renderers/workflow/WorkflowRenderer.tsx +2 -2
  34. package/app/components/settings/AiTab.tsx +120 -2
  35. package/app/components/settings/KnowledgeTab.tsx +1 -1
  36. package/app/components/settings/McpTab.tsx +27 -23
  37. package/app/components/settings/PluginsTab.tsx +4 -4
  38. package/app/components/settings/Primitives.tsx +1 -1
  39. package/app/components/settings/SyncTab.tsx +8 -8
  40. package/app/components/setup/StepAI.tsx +67 -0
  41. package/app/components/setup/StepAgents.tsx +237 -0
  42. package/app/components/setup/StepDots.tsx +39 -0
  43. package/app/components/setup/StepKB.tsx +237 -0
  44. package/app/components/setup/StepPorts.tsx +121 -0
  45. package/app/components/setup/StepReview.tsx +211 -0
  46. package/app/components/setup/StepSecurity.tsx +78 -0
  47. package/app/components/setup/constants.tsx +13 -0
  48. package/app/components/setup/index.tsx +464 -0
  49. package/app/components/setup/types.ts +53 -0
  50. package/app/instrumentation.ts +19 -0
  51. package/app/lib/i18n.ts +22 -4
  52. package/app/next.config.ts +1 -1
  53. package/bin/cli.js +8 -1
  54. package/bin/lib/sync.js +61 -11
  55. package/package.json +4 -2
  56. package/skills/project-wiki/SKILL.md +92 -63
  57. package/assets/images/demo-flow-dark.png +0 -0
  58. package/assets/images/demo-flow-light.png +0 -0
  59. package/assets/images/demo-flow-zh-dark.png +0 -0
  60. package/assets/images/demo-flow-zh-light.png +0 -0
  61. package/assets/images/gui-sync-cv.png +0 -0
  62. package/assets/images/wechat-qr.png +0 -0
  63. package/mcp/package-lock.json +0 -1717
@@ -94,8 +94,8 @@ function ServerStatus({ status, t }: { status: McpStatus | null; t: any }) {
94
94
  <div className="space-y-1.5 text-sm pl-11">
95
95
  <div className="flex items-center gap-2">
96
96
  <span className="text-muted-foreground w-20 shrink-0 text-xs">{m?.status ?? 'Status'}</span>
97
- <span className={`text-xs flex items-center gap-1 ${status.running ? 'text-green-500' : 'text-muted-foreground'}`}>
98
- <span className={`inline-block w-1.5 h-1.5 rounded-full ${status.running ? 'bg-green-500' : 'bg-muted-foreground'}`} />
97
+ <span className={`text-xs flex items-center gap-1 ${status.running ? 'text-success' : 'text-muted-foreground'}`}>
98
+ <span className={`inline-block w-1.5 h-1.5 rounded-full ${status.running ? 'bg-success' : 'bg-muted-foreground'}`} />
99
99
  {status.running ? (m?.running ?? 'Running') : (m?.stopped ?? 'Stopped')}
100
100
  </span>
101
101
  </div>
@@ -115,7 +115,7 @@ function ServerStatus({ status, t }: { status: McpStatus | null; t: any }) {
115
115
  <span className="text-muted-foreground w-20 shrink-0 text-xs">{m?.auth ?? 'Auth'}</span>
116
116
  <span className="text-xs">
117
117
  {status.authConfigured
118
- ? <span className="text-green-500">{m?.authSet ?? 'Token set'}</span>
118
+ ? <span className="text-success">{m?.authSet ?? 'Token set'}</span>
119
119
  : <span className="text-muted-foreground">{m?.authNotSet ?? 'No token'}</span>}
120
120
  </span>
121
121
  </div>
@@ -214,22 +214,23 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
214
214
  type="checkbox"
215
215
  checked={selected.has(agent.key)}
216
216
  onChange={() => toggle(agent.key)}
217
- className="rounded border-border accent-amber-500"
217
+ className="rounded border-border"
218
+ style={{ accentColor: 'var(--amber)' }}
218
219
  />
219
220
  <span className="w-28 shrink-0 text-xs">{agent.name}</span>
220
- <span className="text-[10px] px-1.5 py-0.5 rounded font-mono"
221
+ <span className="text-2xs px-1.5 py-0.5 rounded font-mono"
221
222
  style={{ background: 'rgba(100,100,120,0.08)' }}>
222
223
  {getEffectiveTransport(agent)}
223
224
  </span>
224
225
  {agent.installed ? (
225
226
  <>
226
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-green-500/15 text-green-500 font-mono">
227
+ <span className="text-2xs px-1.5 py-0.5 rounded bg-success/15 text-success font-mono">
227
228
  {agent.transport}
228
229
  </span>
229
- <span className="text-[10px] text-muted-foreground">{agent.scope}</span>
230
+ <span className="text-2xs text-muted-foreground">{agent.scope}</span>
230
231
  </>
231
232
  ) : (
232
- <span className="text-[10px] text-muted-foreground">
233
+ <span className="text-2xs text-muted-foreground">
233
234
  {agent.present ? (m?.detected ?? 'Detected') : (m?.notFound ?? 'Not found')}
234
235
  </span>
235
236
  )}
@@ -238,7 +239,7 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
238
239
  <select
239
240
  value={scopes[agent.key] || 'project'}
240
241
  onChange={e => setScopes({ ...scopes, [agent.key]: e.target.value as 'project' | 'global' })}
241
- className="ml-auto text-[10px] px-1.5 py-0.5 rounded border border-border bg-background text-foreground"
242
+ className="ml-auto text-2xs px-1.5 py-0.5 rounded border border-border bg-background text-foreground"
242
243
  >
243
244
  <option value="project">{m?.project ?? 'Project'}</option>
244
245
  <option value="global">{m?.global ?? 'Global'}</option>
@@ -273,7 +274,8 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
273
274
  name="transport"
274
275
  checked={transport === 'auto'}
275
276
  onChange={() => setTransport('auto')}
276
- className="accent-amber-500"
277
+ className=""
278
+ style={{ accentColor: 'var(--amber)' }}
277
279
  />
278
280
  {m?.transportAuto ?? 'auto (recommended)'}
279
281
  </label>
@@ -283,7 +285,8 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
283
285
  name="transport"
284
286
  checked={transport === 'stdio'}
285
287
  onChange={() => setTransport('stdio')}
286
- className="accent-amber-500"
288
+ className=""
289
+ style={{ accentColor: 'var(--amber)' }}
287
290
  />
288
291
  {m?.transportStdio ?? 'stdio'}
289
292
  </label>
@@ -293,7 +296,8 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
293
296
  name="transport"
294
297
  checked={transport === 'http'}
295
298
  onChange={() => setTransport('http')}
296
- className="accent-amber-500"
299
+ className=""
300
+ style={{ accentColor: 'var(--amber)' }}
297
301
  />
298
302
  {m?.transportHttp ?? 'http'}
299
303
  </label>
@@ -329,7 +333,7 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
329
333
  onClick={handleInstall}
330
334
  disabled={selected.size === 0 || installing}
331
335
  className="flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed"
332
- style={{ background: 'var(--amber)', color: '#131210' }}
336
+ style={{ background: 'var(--amber)', color: 'var(--amber-foreground)' }}
333
337
  >
334
338
  {installing && <Loader2 size={12} className="animate-spin" />}
335
339
  {installing ? (m?.installing ?? 'Installing...') : (m?.installSelected ?? 'Install Selected')}
@@ -339,7 +343,7 @@ function AgentInstall({ agents, t, onRefresh }: { agents: AgentInfo[]; t: any; o
339
343
  {message && (
340
344
  <div className="flex items-center gap-1.5 text-xs" role="status">
341
345
  {message.type === 'success' ? (
342
- <><CheckCircle2 size={12} className="text-green-500" /><span className="text-green-500">{message.text}</span></>
346
+ <><CheckCircle2 size={12} className="text-success" /><span className="text-success">{message.text}</span></>
343
347
  ) : (
344
348
  <><AlertCircle size={12} className="text-destructive" /><span className="text-destructive">{message.text}</span></>
345
349
  )}
@@ -480,7 +484,7 @@ function SkillsSection({ t }: { t: any }) {
480
484
  >
481
485
  {expanded === skill.name ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
482
486
  <span className="text-xs font-medium flex-1">{skill.name}</span>
483
- <span className={`text-[10px] px-1.5 py-0.5 rounded ${
487
+ <span className={`text-2xs px-1.5 py-0.5 rounded ${
484
488
  skill.source === 'builtin' ? 'bg-blue-500/15 text-blue-500' : 'bg-purple-500/15 text-purple-500'
485
489
  }`}>
486
490
  {skill.source === 'builtin' ? (m?.skillBuiltin ?? 'Built-in') : (m?.skillUser ?? 'Custom')}
@@ -489,7 +493,7 @@ function SkillsSection({ t }: { t: any }) {
489
493
  <button
490
494
  onClick={e => { e.stopPropagation(); handleToggle(skill.name, !skill.enabled); }}
491
495
  className={`relative inline-flex h-4 w-7 items-center rounded-full transition-colors ${
492
- skill.enabled ? 'bg-green-500' : 'bg-muted-foreground/30'
496
+ skill.enabled ? 'bg-success' : 'bg-muted-foreground/30'
493
497
  }`}
494
498
  >
495
499
  <span className={`inline-block h-3 w-3 rounded-full bg-white transition-transform ${
@@ -501,11 +505,11 @@ function SkillsSection({ t }: { t: any }) {
501
505
  {expanded === skill.name && (
502
506
  <div className="px-3 py-2 border-t border-border text-xs space-y-1.5 bg-muted/20">
503
507
  <p className="text-muted-foreground">{skill.description || 'No description'}</p>
504
- <p className="text-muted-foreground font-mono text-[10px]">{skill.path}</p>
508
+ <p className="text-muted-foreground font-mono text-2xs">{skill.path}</p>
505
509
  {skill.editable && (
506
510
  <button
507
511
  onClick={() => handleDelete(skill.name)}
508
- className="flex items-center gap-1 text-[10px] text-destructive hover:underline"
512
+ className="flex items-center gap-1 text-2xs text-destructive hover:underline"
509
513
  >
510
514
  <Trash2 size={10} />
511
515
  {m?.deleteSkill ?? 'Delete'}
@@ -526,7 +530,7 @@ function SkillsSection({ t }: { t: any }) {
526
530
  </button>
527
531
  </div>
528
532
  <div className="space-y-1">
529
- <label className="text-[10px] text-muted-foreground">{m?.skillName ?? 'Name'}</label>
533
+ <label className="text-2xs text-muted-foreground">{m?.skillName ?? 'Name'}</label>
530
534
  <input
531
535
  type="text"
532
536
  value={newName}
@@ -536,7 +540,7 @@ function SkillsSection({ t }: { t: any }) {
536
540
  />
537
541
  </div>
538
542
  <div className="space-y-1">
539
- <label className="text-[10px] text-muted-foreground">{m?.skillDesc ?? 'Description'}</label>
543
+ <label className="text-2xs text-muted-foreground">{m?.skillDesc ?? 'Description'}</label>
540
544
  <input
541
545
  type="text"
542
546
  value={newDesc}
@@ -546,7 +550,7 @@ function SkillsSection({ t }: { t: any }) {
546
550
  />
547
551
  </div>
548
552
  <div className="space-y-1">
549
- <label className="text-[10px] text-muted-foreground">{m?.skillContent ?? 'Content'}</label>
553
+ <label className="text-2xs text-muted-foreground">{m?.skillContent ?? 'Content'}</label>
550
554
  <textarea
551
555
  value={newContent}
552
556
  onChange={e => setNewContent(e.target.value)}
@@ -556,7 +560,7 @@ function SkillsSection({ t }: { t: any }) {
556
560
  />
557
561
  </div>
558
562
  {error && (
559
- <p className="text-[10px] text-destructive flex items-center gap-1">
563
+ <p className="text-2xs text-destructive flex items-center gap-1">
560
564
  <AlertCircle size={10} />
561
565
  {error}
562
566
  </p>
@@ -566,7 +570,7 @@ function SkillsSection({ t }: { t: any }) {
566
570
  onClick={handleCreate}
567
571
  disabled={!newName.trim() || saving}
568
572
  className="flex items-center gap-1 px-2.5 py-1 text-xs rounded-md disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
569
- style={{ background: 'var(--amber)', color: '#131210' }}
573
+ style={{ background: 'var(--amber)', color: 'var(--amber-foreground)' }}
570
574
  >
571
575
  {saving && <Loader2 size={10} className="animate-spin" />}
572
576
  {m?.saveSkill ?? 'Save'}
@@ -33,25 +33,25 @@ export function PluginsTab({ pluginStates, setPluginStates, t }: PluginsTabProps
33
33
  <div className="flex items-center gap-2 flex-wrap">
34
34
  <span className="text-sm font-medium text-foreground">{renderer.name}</span>
35
35
  {isCore && (
36
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-amber-600/15 text-amber-600 font-mono">
36
+ <span className="text-2xs px-1.5 py-0.5 rounded bg-amber-600/15 text-amber-600 font-mono">
37
37
  core
38
38
  </span>
39
39
  )}
40
40
  {renderer.builtin && !isCore && (
41
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono">
41
+ <span className="text-2xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground font-mono">
42
42
  {t.settings.plugins.builtinBadge}
43
43
  </span>
44
44
  )}
45
45
  <div className="flex gap-1 flex-wrap">
46
46
  {renderer.tags.map(tag => (
47
- <span key={tag} className="text-[10px] px-1.5 py-0.5 rounded bg-muted/60 text-muted-foreground">
47
+ <span key={tag} className="text-2xs px-1.5 py-0.5 rounded bg-muted/60 text-muted-foreground">
48
48
  {tag}
49
49
  </span>
50
50
  ))}
51
51
  </div>
52
52
  </div>
53
53
  <p className="text-xs text-muted-foreground mt-1 leading-relaxed">{renderer.description}</p>
54
- <p className="text-[11px] text-muted-foreground/60 mt-1.5 font-mono">
54
+ <p className="text-xs text-muted-foreground/60 mt-1.5 font-mono">
55
55
  {t.settings.plugins.matchHint}: <code className="bg-muted px-1 rounded">{renderer.match.toString().match(/\/(.+)\//)?.[1] ?? '—'}</code>
56
56
  </p>
57
57
  </div>
@@ -35,7 +35,7 @@ export function Select({ className = '', ...props }: React.SelectHTMLAttributes<
35
35
  export function EnvBadge({ overridden }: { overridden: boolean }) {
36
36
  if (!overridden) return null;
37
37
  return (
38
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-500 font-mono ml-1.5">env</span>
38
+ <span className="text-2xs px-1.5 py-0.5 rounded bg-amber-500/15 text-amber-500 font-mono ml-1.5">env</span>
39
39
  );
40
40
  }
41
41
 
@@ -111,12 +111,12 @@ function SyncEmptyState({ t, onInitComplete }: { t: any; onInitComplete: () => v
111
111
  }}
112
112
  />
113
113
  {remoteUrl.trim() && !isValid && (
114
- <p className="text-[11px]" style={{ color: 'var(--destructive, red)' }}>
114
+ <p className="text-xs" style={{ color: 'var(--destructive, red)' }}>
115
115
  {syncT?.invalidUrl ?? 'Invalid Git URL — use HTTPS (https://...) or SSH (git@...)'}
116
116
  </p>
117
117
  )}
118
118
  {urlType === 'ssh' && (
119
- <p className="text-[11px] text-muted-foreground flex items-center gap-1">
119
+ <p className="text-xs text-muted-foreground flex items-center gap-1">
120
120
  <AlertCircle size={11} className="shrink-0" />
121
121
  {syncT?.sshHint ?? 'SSH URLs require SSH key configured on this machine. HTTPS with token recommended.'}
122
122
  </p>
@@ -147,7 +147,7 @@ function SyncEmptyState({ t, onInitComplete }: { t: any; onInitComplete: () => v
147
147
  {showToken ? <EyeOff size={14} /> : <Eye size={14} />}
148
148
  </button>
149
149
  </div>
150
- <p className="text-[11px] text-muted-foreground">
150
+ <p className="text-xs text-muted-foreground">
151
151
  {syncT?.tokenHint ?? 'GitHub: Settings → Developer settings → Personal access tokens → repo scope'}
152
152
  </p>
153
153
  </div>
@@ -174,7 +174,7 @@ function SyncEmptyState({ t, onInitComplete }: { t: any; onInitComplete: () => v
174
174
  onClick={handleConnect}
175
175
  disabled={!isValid || connecting}
176
176
  className="flex items-center gap-2 px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed"
177
- style={{ background: 'var(--amber)', color: '#131210' }}
177
+ style={{ background: 'var(--amber)', color: 'var(--amber-foreground)' }}
178
178
  >
179
179
  {connecting && <Loader2 size={14} className="animate-spin" />}
180
180
  {connecting
@@ -191,7 +191,7 @@ function SyncEmptyState({ t, onInitComplete }: { t: any; onInitComplete: () => v
191
191
  )}
192
192
 
193
193
  {/* Features */}
194
- <div className="grid grid-cols-2 gap-2 text-[11px] text-muted-foreground pt-2">
194
+ <div className="grid grid-cols-2 gap-2 text-xs text-muted-foreground pt-2">
195
195
  {[
196
196
  syncT?.featureAutoCommit ?? 'Auto-commit on save',
197
197
  syncT?.featureAutoPull ?? 'Auto-pull from remote',
@@ -199,7 +199,7 @@ function SyncEmptyState({ t, onInitComplete }: { t: any; onInitComplete: () => v
199
199
  syncT?.featureMultiDevice ?? 'Works across devices',
200
200
  ].map((f, i) => (
201
201
  <div key={i} className="flex items-center gap-1.5">
202
- <CheckCircle2 size={11} className="text-green-500/60 shrink-0" />
202
+ <CheckCircle2 size={11} className="text-success/60 shrink-0" />
203
203
  <span>{f}</span>
204
204
  </div>
205
205
  ))}
@@ -336,7 +336,7 @@ export function SyncTab({ t }: SyncTabProps) {
336
336
  className={`flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg border transition-colors disabled:opacity-40 disabled:cursor-not-allowed ${
337
337
  status.enabled
338
338
  ? 'border-border text-muted-foreground hover:text-destructive hover:border-destructive/50'
339
- : 'border-green-500/30 text-green-500 hover:bg-green-500/10'
339
+ : 'border-success/30 text-success hover:bg-success/10'
340
340
  }`}
341
341
  >
342
342
  {status.enabled ? 'Disable Auto-sync' : 'Enable Auto-sync'}
@@ -347,7 +347,7 @@ export function SyncTab({ t }: SyncTabProps) {
347
347
  {message && (
348
348
  <div className="flex items-center gap-1.5 text-xs" role="status" aria-live="polite">
349
349
  {message.type === 'success' ? (
350
- <><CheckCircle2 size={13} className="text-green-500" /><span className="text-green-500">{message.text}</span></>
350
+ <><CheckCircle2 size={13} className="text-success" /><span className="text-success">{message.text}</span></>
351
351
  ) : (
352
352
  <><AlertCircle size={13} className="text-destructive" /><span className="text-destructive">{message.text}</span></>
353
353
  )}
@@ -0,0 +1,67 @@
1
+ 'use client';
2
+
3
+ import { Brain, Zap, SkipForward, CheckCircle2 } from 'lucide-react';
4
+ import { Field, Input, ApiKeyInput } from '@/components/settings/Primitives';
5
+ import type { SetupState, SetupMessages } from './types';
6
+
7
+ export interface StepAIProps {
8
+ state: SetupState;
9
+ update: <K extends keyof SetupState>(key: K, val: SetupState[K]) => void;
10
+ s: SetupMessages;
11
+ }
12
+
13
+ export default function StepAI({ state, update, s }: StepAIProps) {
14
+ const providers = [
15
+ { id: 'anthropic' as const, icon: <Brain size={18} />, label: 'Anthropic', desc: 'Claude — claude-sonnet-4-6' },
16
+ { id: 'openai' as const, icon: <Zap size={18} />, label: 'OpenAI', desc: 'GPT or any OpenAI-compatible API' },
17
+ { id: 'skip' as const, icon: <SkipForward size={18} />, label: s.aiSkipTitle, desc: s.aiSkipDesc },
18
+ ];
19
+ return (
20
+ <div className="space-y-5">
21
+ <div className="grid grid-cols-1 gap-3">
22
+ {providers.map(p => (
23
+ <button key={p.id} onClick={() => update('provider', p.id)}
24
+ className="flex items-start gap-3 p-4 rounded-xl border text-left transition-all duration-150"
25
+ style={{
26
+ background: state.provider === p.id ? 'var(--amber-dim)' : 'var(--card)',
27
+ borderColor: state.provider === p.id ? 'var(--amber)' : 'var(--border)',
28
+ }}>
29
+ <span className="mt-0.5" style={{ color: state.provider === p.id ? 'var(--amber)' : 'var(--muted-foreground)' }}>
30
+ {p.icon}
31
+ </span>
32
+ <div>
33
+ <p className="text-sm font-medium" style={{ color: 'var(--foreground)' }}>{p.label}</p>
34
+ <p className="text-xs mt-0.5" style={{ color: 'var(--muted-foreground)' }}>{p.desc}</p>
35
+ </div>
36
+ {state.provider === p.id && (
37
+ <CheckCircle2 size={16} className="ml-auto mt-0.5 shrink-0" style={{ color: 'var(--amber)' }} />
38
+ )}
39
+ </button>
40
+ ))}
41
+ </div>
42
+ {state.provider !== 'skip' && (
43
+ <div className="space-y-4 pt-2">
44
+ <Field label={s.apiKey}>
45
+ <ApiKeyInput
46
+ value={state.provider === 'anthropic' ? state.anthropicKey : state.openaiKey}
47
+ onChange={v => update(state.provider === 'anthropic' ? 'anthropicKey' : 'openaiKey', v)}
48
+ placeholder={state.provider === 'anthropic' ? 'sk-ant-...' : 'sk-...'}
49
+ />
50
+ </Field>
51
+ <Field label={s.model}>
52
+ <Input
53
+ value={state.provider === 'anthropic' ? state.anthropicModel : state.openaiModel}
54
+ onChange={e => update(state.provider === 'anthropic' ? 'anthropicModel' : 'openaiModel', e.target.value)}
55
+ />
56
+ </Field>
57
+ {state.provider === 'openai' && (
58
+ <Field label={s.baseUrl} hint={s.baseUrlHint}>
59
+ <Input value={state.openaiBaseUrl} onChange={e => update('openaiBaseUrl', e.target.value)}
60
+ placeholder="https://api.openai.com/v1" />
61
+ </Field>
62
+ )}
63
+ </div>
64
+ )}
65
+ </div>
66
+ );
67
+ }
@@ -0,0 +1,237 @@
1
+ 'use client';
2
+
3
+ import { useState, useMemo } from 'react';
4
+ import {
5
+ Loader2, CheckCircle2, XCircle, Brain, ChevronDown,
6
+ } from 'lucide-react';
7
+ import { Field, Select } from '@/components/settings/Primitives';
8
+ import type { SetupMessages, McpMessages, Template, AgentEntry, AgentInstallStatus } from './types';
9
+
10
+ export interface StepAgentsProps {
11
+ agents: AgentEntry[];
12
+ agentsLoading: boolean;
13
+ selectedAgents: Set<string>;
14
+ setSelectedAgents: React.Dispatch<React.SetStateAction<Set<string>>>;
15
+ agentTransport: 'auto' | 'stdio' | 'http';
16
+ setAgentTransport: (v: 'auto' | 'stdio' | 'http') => void;
17
+ agentScope: 'global' | 'project';
18
+ setAgentScope: (v: 'global' | 'project') => void;
19
+ agentStatuses: Record<string, AgentInstallStatus>;
20
+ s: SetupMessages;
21
+ settingsMcp: McpMessages;
22
+ template: Template;
23
+ }
24
+
25
+ export default function StepAgents({
26
+ agents, agentsLoading, selectedAgents, setSelectedAgents,
27
+ agentTransport, setAgentTransport, agentScope, setAgentScope,
28
+ agentStatuses, s, settingsMcp, template,
29
+ }: StepAgentsProps) {
30
+ const toggleAgent = (key: string) => {
31
+ setSelectedAgents(prev => {
32
+ const next = new Set(prev);
33
+ if (next.has(key)) next.delete(key); else next.add(key);
34
+ return next;
35
+ });
36
+ };
37
+
38
+ const [showOtherAgents, setShowOtherAgents] = useState(false);
39
+ const [showAdvanced, setShowAdvanced] = useState(false);
40
+
41
+ const getEffectiveTransport = (agent: AgentEntry) => {
42
+ if (agentTransport === 'auto') return agent.preferredTransport;
43
+ return agentTransport;
44
+ };
45
+
46
+ const getStatusBadge = (key: string, agent: AgentEntry) => {
47
+ const st = agentStatuses[key];
48
+ if (st) {
49
+ if (st.state === 'installing') return (
50
+ <span className="flex items-center gap-1 text-xs" style={{ color: 'var(--muted-foreground)' }}>
51
+ <Loader2 size={10} className="animate-spin" /> {s.agentInstalling}
52
+ </span>
53
+ );
54
+ if (st.state === 'ok') return (
55
+ <span className="flex items-center gap-1 text-xs px-1.5 py-0.5 rounded"
56
+ style={{ background: 'color-mix(in srgb, var(--success) 12%, transparent)', color: 'var(--success)' }}>
57
+ <CheckCircle2 size={10} /> {s.agentStatusOk}
58
+ </span>
59
+ );
60
+ if (st.state === 'error') return (
61
+ <span className="flex items-center gap-1 text-xs px-1.5 py-0.5 rounded"
62
+ style={{ background: 'color-mix(in srgb, var(--error) 10%, transparent)', color: 'var(--error)' }}>
63
+ <XCircle size={10} /> {s.agentStatusError}
64
+ {st.message && <span className="ml-1 text-2xs">({st.message})</span>}
65
+ </span>
66
+ );
67
+ }
68
+ if (agent.installed) return (
69
+ <span className="text-xs px-1.5 py-0.5 rounded"
70
+ style={{ background: 'color-mix(in srgb, var(--success) 12%, transparent)', color: 'var(--success)' }}>
71
+ {settingsMcp.installed}
72
+ </span>
73
+ );
74
+ if (agent.present) return (
75
+ <span className="text-xs px-1.5 py-0.5 rounded"
76
+ style={{ background: 'var(--amber-dim)', color: 'var(--amber)' }}>
77
+ {s.agentDetected}
78
+ </span>
79
+ );
80
+ return (
81
+ <span className="text-xs px-1.5 py-0.5 rounded"
82
+ style={{ background: 'color-mix(in srgb, var(--muted-foreground) 10%, transparent)', color: 'var(--muted-foreground)' }}>
83
+ {s.agentNotFound}
84
+ </span>
85
+ );
86
+ };
87
+
88
+ const { detected, other } = useMemo(() => ({
89
+ detected: agents.filter(a => a.installed || a.present),
90
+ other: agents.filter(a => !a.installed && !a.present),
91
+ }), [agents]);
92
+
93
+ const renderAgentRow = (agent: AgentEntry, i: number) => (
94
+ <label key={agent.key}
95
+ className="flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors"
96
+ style={{
97
+ background: i % 2 === 0 ? 'var(--card)' : 'transparent',
98
+ borderTop: i > 0 ? '1px solid var(--border)' : undefined,
99
+ }}>
100
+ <input
101
+ type="checkbox"
102
+ checked={selectedAgents.has(agent.key)}
103
+ onChange={() => toggleAgent(agent.key)}
104
+ style={{ accentColor: 'var(--amber)' }}
105
+ disabled={agentStatuses[agent.key]?.state === 'installing'}
106
+ />
107
+ <span className="text-sm flex-1" style={{ color: 'var(--foreground)' }}>{agent.name}</span>
108
+ <span className="text-2xs px-1.5 py-0.5 rounded font-mono"
109
+ style={{ background: 'color-mix(in srgb, var(--muted-foreground) 8%, transparent)', color: 'var(--muted-foreground)' }}>
110
+ {getEffectiveTransport(agent)}
111
+ </span>
112
+ {getStatusBadge(agent.key, agent)}
113
+ </label>
114
+ );
115
+
116
+ return (
117
+ <div className="space-y-5">
118
+ <p className="text-sm" style={{ color: 'var(--muted-foreground)' }}>{s.agentToolsHint}</p>
119
+ {agentsLoading ? (
120
+ <div className="flex items-center gap-2 py-4" style={{ color: 'var(--muted-foreground)' }}>
121
+ <Loader2 size={14} className="animate-spin" />
122
+ <span className="text-sm">{s.agentToolsLoading}</span>
123
+ </div>
124
+ ) : agents.length === 0 ? (
125
+ <p className="text-sm py-4 text-center" style={{ color: 'var(--muted-foreground)' }}>
126
+ {s.agentToolsEmpty}
127
+ </p>
128
+ ) : (
129
+ <>
130
+ {/* Badge legend */}
131
+ <div className="flex items-center gap-4 text-2xs" style={{ color: 'var(--muted-foreground)' }}>
132
+ <span className="flex items-center gap-1">
133
+ <span className="inline-block w-1.5 h-1.5 rounded-full" style={{ background: 'var(--success)' }} />
134
+ {s.badgeInstalled}
135
+ </span>
136
+ <span className="flex items-center gap-1">
137
+ <span className="inline-block w-1.5 h-1.5 rounded-full" style={{ background: 'var(--amber)' }} />
138
+ {s.badgeDetected}
139
+ </span>
140
+ <span className="flex items-center gap-1">
141
+ <span className="inline-block w-1.5 h-1.5 rounded-full" style={{ background: 'var(--muted-foreground)' }} />
142
+ {s.badgeNotFound}
143
+ </span>
144
+ </div>
145
+
146
+ {/* Detected agents — always visible */}
147
+ {detected.length > 0 ? (
148
+ <div className="rounded-xl border overflow-hidden" style={{ borderColor: 'var(--border)' }}>
149
+ {detected.map((agent, i) => renderAgentRow(agent, i))}
150
+ </div>
151
+ ) : (
152
+ <p className="text-xs py-2" style={{ color: 'var(--muted-foreground)' }}>
153
+ {s.agentNoneDetected}
154
+ </p>
155
+ )}
156
+ {/* Other agents — collapsed by default */}
157
+ {other.length > 0 && (
158
+ <div>
159
+ <button
160
+ type="button"
161
+ onClick={() => setShowOtherAgents(!showOtherAgents)}
162
+ aria-expanded={showOtherAgents}
163
+ className="flex items-center gap-1.5 text-xs py-1.5 transition-colors"
164
+ style={{ color: 'var(--muted-foreground)' }}>
165
+ <ChevronDown size={12} className={`transition-transform ${showOtherAgents ? 'rotate-180' : ''}`} />
166
+ {s.agentShowMore(other.length)}
167
+ </button>
168
+ {showOtherAgents && (
169
+ <div className="rounded-xl border overflow-hidden mt-1" style={{ borderColor: 'var(--border)' }}>
170
+ {other.map((agent, i) => renderAgentRow(agent, i))}
171
+ </div>
172
+ )}
173
+ </div>
174
+ )}
175
+ {/* Skill context + auto-install hint */}
176
+ <div className="space-y-1.5">
177
+ <p className="text-xs" style={{ color: 'var(--muted-foreground)' }}>
178
+ {s.skillWhat}
179
+ </p>
180
+ <div className="flex items-center gap-2 px-3 py-2 rounded-lg text-xs"
181
+ style={{ background: 'color-mix(in srgb, var(--muted-foreground) 6%, transparent)', color: 'var(--muted-foreground)' }}>
182
+ <Brain size={13} className="shrink-0" />
183
+ <span>{s.skillAutoHint(template === 'zh' ? 'mindos-zh' : 'mindos')}</span>
184
+ </div>
185
+ </div>
186
+ {/* Advanced options — collapsed by default */}
187
+ <div>
188
+ <button
189
+ type="button"
190
+ onClick={() => setShowAdvanced(!showAdvanced)}
191
+ aria-expanded={showAdvanced}
192
+ className="flex items-center gap-1.5 text-xs py-1.5 transition-colors"
193
+ style={{ color: 'var(--muted-foreground)' }}>
194
+ <ChevronDown size={12} className={`transition-transform ${showAdvanced ? 'rotate-180' : ''}`} />
195
+ {s.agentAdvanced}
196
+ </button>
197
+ {showAdvanced && (
198
+ <div className="grid grid-cols-2 gap-4 mt-2">
199
+ <Field label={s.agentTransport}>
200
+ <Select value={agentTransport} onChange={e => setAgentTransport(e.target.value as 'auto' | 'stdio' | 'http')}>
201
+ <option value="auto">{s.agentTransportAuto}</option>
202
+ <option value="stdio">{settingsMcp.transportStdio}</option>
203
+ <option value="http">{settingsMcp.transportHttp}</option>
204
+ </Select>
205
+ </Field>
206
+ <Field label={s.agentScope}>
207
+ <Select value={agentScope} onChange={e => setAgentScope(e.target.value as 'global' | 'project')}>
208
+ <option value="global">{s.agentScopeGlobal}</option>
209
+ <option value="project">{s.agentScopeProject}</option>
210
+ </Select>
211
+ </Field>
212
+ </div>
213
+ )}
214
+ </div>
215
+ <div className="flex gap-2 mt-1">
216
+ <button
217
+ type="button"
218
+ onClick={() => setSelectedAgents(new Set(
219
+ agents.filter(a => a.installed || a.present).map(a => a.key)
220
+ ))}
221
+ className="text-xs px-2.5 py-1 rounded-md border transition-colors hover:bg-muted/50"
222
+ style={{ borderColor: 'var(--amber)', color: 'var(--amber)' }}>
223
+ {s.agentSelectDetected}
224
+ </button>
225
+ <button
226
+ type="button"
227
+ onClick={() => setSelectedAgents(new Set())}
228
+ className="text-xs px-2.5 py-1 rounded-md border transition-colors hover:bg-muted/50"
229
+ style={{ borderColor: 'var(--border)', color: 'var(--muted-foreground)' }}>
230
+ {s.agentSkipLater}
231
+ </button>
232
+ </div>
233
+ </>
234
+ )}
235
+ </div>
236
+ );
237
+ }
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+
3
+ export interface StepDotsProps {
4
+ step: number;
5
+ setStep: (s: number) => void;
6
+ stepTitles: readonly string[];
7
+ disabled?: boolean;
8
+ }
9
+
10
+ export default function StepDots({ step, setStep, stepTitles, disabled }: StepDotsProps) {
11
+ return (
12
+ <div className="flex items-center gap-2 mb-8" role="navigation" aria-label="Setup steps">
13
+ {stepTitles.map((title: string, i: number) => (
14
+ <div key={i} className="flex items-center gap-2">
15
+ {i > 0 && <div className="w-8 h-px" style={{ background: i <= step ? 'var(--amber)' : 'var(--border)' }} />}
16
+ <button onClick={() => setStep(i)}
17
+ aria-current={i === step ? 'step' : undefined}
18
+ aria-label={title}
19
+ className="flex items-center gap-1.5 p-1 -m-1 disabled:cursor-not-allowed disabled:opacity-60"
20
+ disabled={disabled || i >= step}>
21
+ <div
22
+ className="w-6 h-6 rounded-full text-xs font-medium flex items-center justify-center transition-colors"
23
+ style={{
24
+ background: i <= step ? 'var(--amber)' : 'var(--muted)',
25
+ color: i <= step ? 'var(--amber-foreground)' : 'var(--muted-foreground)',
26
+ opacity: i <= step ? 1 : 0.5,
27
+ }}>
28
+ {i + 1}
29
+ </div>
30
+ <span className="text-xs hidden sm:inline"
31
+ style={{ color: i === step ? 'var(--foreground)' : 'var(--muted-foreground)', opacity: i <= step ? 1 : 0.5 }}>
32
+ {title}
33
+ </span>
34
+ </button>
35
+ </div>
36
+ ))}
37
+ </div>
38
+ );
39
+ }