orca-multiagent-kit 1.4.1 → 1.6.0

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 (70) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/README.md +13 -7
  3. package/VERSION +1 -1
  4. package/bin/omk.js +47 -4
  5. package/bin/orca.js +170 -0
  6. package/bin/sea.js +95 -0
  7. package/bin/setup.js +326 -0
  8. package/bin/team.js +353 -0
  9. package/core/AGENTS.md +1 -1
  10. package/docs/EJECUTABLE.md +70 -0
  11. package/docs/PLUGIN-ORCA.md +126 -28
  12. package/orca-plugin/README.md +5 -1
  13. package/orca-plugin/assets/logos/README.md +10 -0
  14. package/orca-plugin/assets/logos/agent.png +0 -0
  15. package/orca-plugin/assets/logos/aider.png +0 -0
  16. package/orca-plugin/assets/logos/amp.png +0 -0
  17. package/orca-plugin/assets/logos/antigravity.png +0 -0
  18. package/orca-plugin/assets/logos/claude.png +0 -0
  19. package/orca-plugin/assets/logos/cline.png +0 -0
  20. package/orca-plugin/assets/logos/codex.png +0 -0
  21. package/orca-plugin/assets/logos/copilot.png +0 -0
  22. package/orca-plugin/assets/logos/cursor.png +0 -0
  23. package/orca-plugin/assets/logos/devin.png +0 -0
  24. package/orca-plugin/assets/logos/droid.png +0 -0
  25. package/orca-plugin/assets/logos/gemini.png +0 -0
  26. package/orca-plugin/assets/logos/goose.png +0 -0
  27. package/orca-plugin/assets/logos/grok.png +0 -0
  28. package/orca-plugin/assets/logos/kimi.png +0 -0
  29. package/orca-plugin/assets/logos/kiro.png +0 -0
  30. package/orca-plugin/assets/logos/opencode.png +0 -0
  31. package/orca-plugin/assets/logos/qwen-code.png +0 -0
  32. package/orca-plugin/orca-plugin.json +28 -7
  33. package/orca-plugin/src/icons.test.ts +14 -0
  34. package/orca-plugin/src/icons.ts +30 -0
  35. package/orca-plugin/src/kit.test.ts +456 -9
  36. package/orca-plugin/src/kit.ts +639 -16
  37. package/orca-plugin/src/models.test.ts +28 -0
  38. package/orca-plugin/src/models.ts +29 -0
  39. package/orca-plugin/src/node.d.ts +40 -0
  40. package/orca-plugin/src/panel-state.ts +28 -0
  41. package/orca-plugin/src/panel.test.tsx +298 -0
  42. package/orca-plugin/src/panel.tsx +609 -0
  43. package/orca-plugin/src/plan-card.test.ts +99 -0
  44. package/orca-plugin/src/plan-card.ts +107 -0
  45. package/orca-plugin/src/protocol.ts +179 -0
  46. package/orca-plugin/src/tabs/autonomy.tsx +70 -0
  47. package/orca-plugin/src/tabs/history.test.tsx +78 -0
  48. package/orca-plugin/src/tabs/history.tsx +118 -0
  49. package/orca-plugin/src/tabs/notices.test.tsx +183 -0
  50. package/orca-plugin/src/tabs/notices.tsx +274 -0
  51. package/orca-plugin/src/tabs/worktrees.test.tsx +130 -0
  52. package/orca-plugin/src/tabs/worktrees.tsx +138 -0
  53. package/orca-plugin/src/ui/agent-icon.tsx +13 -0
  54. package/orca-plugin/src/worker/context.test.ts +32 -0
  55. package/orca-plugin/src/worker/context.ts +92 -0
  56. package/orca-plugin/src/worker/history.test.ts +149 -0
  57. package/orca-plugin/src/worker/history.ts +181 -0
  58. package/orca-plugin/src/worker/notices.test.ts +356 -0
  59. package/orca-plugin/src/worker/notices.ts +291 -0
  60. package/orca-plugin/src/worker/system.test.ts +58 -0
  61. package/orca-plugin/src/worker/system.ts +122 -0
  62. package/orca-plugin/src/worker/worktrees.test.ts +177 -0
  63. package/orca-plugin/src/worker/worktrees.ts +188 -0
  64. package/orca-plugin/src/worker.test.ts +297 -15
  65. package/orca-plugin/src/worker.ts +353 -32
  66. package/package.json +3 -2
  67. package/skills/orca/SKILL.md +1 -0
  68. package/skills/orca/references/engine-orca.md +1 -0
  69. package/skills/orca/references/olimpo.md +1 -0
  70. package/skills/orca/references/plan-card.md +45 -0
@@ -0,0 +1,609 @@
1
+ // Panel lateral del kit en pestañas: lo que espera tu respuesta (Avisos), los agentes activos con
2
+ // su ficha, los worktrees de la orquestación, repartir una tarea entre agentes, el historial, el
3
+ // equipo de roles del proyecto y el kit (acciones y ajustes del plugin). Avisos, Worktrees e
4
+ // Historial viven en src/tabs/; el estado que comparten todas, en src/panel-state.ts.
5
+ // Los ajustes son los mismos de Settings → Plugins → Orca Multiagent Kit: cambiarlos aquí o allí
6
+ // es lo mismo, y el worker se entera por `settings.onDidChange`.
7
+ // Orca transpila este fichero al cargarlo: no hay paso de build.
8
+ import {
9
+ atom,
10
+ Badge,
11
+ Box,
12
+ Button,
13
+ Callout,
14
+ Card,
15
+ Checkbox,
16
+ Code,
17
+ Collapsible,
18
+ EmptyState,
19
+ Heading,
20
+ Input,
21
+ KeyValue,
22
+ plugin,
23
+ read,
24
+ RelativeTime,
25
+ Row,
26
+ Select,
27
+ set,
28
+ settings,
29
+ Stack,
30
+ Switch,
31
+ Tab,
32
+ Tabs,
33
+ Text,
34
+ Textarea,
35
+ type PanelContext
36
+ } from 'orca'
37
+ import {
38
+ CROSS_REVIEW,
39
+ CUSTOM_REVIEWS,
40
+ CUSTOM_ROLES_MAX,
41
+ ROLE_GUARD_MAX,
42
+ ROLE_LEVELS,
43
+ ROLE_WORK_MAX,
44
+ TASK_MAX,
45
+ TASK_SOURCES,
46
+ TEAM_PRESETS,
47
+ TEAM_ROLES,
48
+ agentLabel,
49
+ agentOptions,
50
+ draftFromPreset,
51
+ emptyCustomRole,
52
+ isValidAgentId,
53
+ isValidRoleName,
54
+ normalizeDraft,
55
+ parseContractHintMode,
56
+ teamFromDraft,
57
+ type AgentLine,
58
+ type ContractHintMode,
59
+ type CrossReview,
60
+ type CustomRole,
61
+ type KitAction,
62
+ type RoleId,
63
+ type TaskSource,
64
+ type TeamDraft,
65
+ type TeamPreset
66
+ } from './kit.ts'
67
+ import { ask, busy, describeError, outcome } from './panel-state.ts'
68
+ import type { AgentsView } from './protocol.ts'
69
+ import { AutonomyCard, AutonomyOverride, runAutonomy } from './tabs/autonomy.tsx'
70
+ import { History, setupHistory } from './tabs/history.tsx'
71
+ import { Notices, noticesLabel, setupNotices } from './tabs/notices.tsx'
72
+ import { Worktrees, setupWorktrees } from './tabs/worktrees.tsx'
73
+ import { AgentIcon } from './ui/agent-icon.tsx'
74
+
75
+ type Preferences = {
76
+ contractHint: ContractHintMode
77
+ autoOrchestrate: boolean
78
+ statusBar: boolean
79
+ notify: boolean
80
+ initAgent: string
81
+ }
82
+
83
+ const DEFAULTS: Preferences = {
84
+ contractHint: 'kit',
85
+ autoOrchestrate: true,
86
+ statusBar: true,
87
+ notify: true,
88
+ initAgent: 'claude'
89
+ }
90
+
91
+ const CONTRACT_OPTIONS: readonly { value: ContractHintMode; label: string }[] = [
92
+ { value: 'kit', label: 'Solo despachos del kit' },
93
+ { value: 'all', label: 'Todos los despachos' },
94
+ { value: 'off', label: 'Desactivado' }
95
+ ]
96
+
97
+ const ACTIONS: readonly { action: KitAction; label: string; hint: string }[] = [
98
+ { action: 'verify', label: 'Verificar instalación', hint: 'omk verify en un terminal nuevo' },
99
+ { action: 'init', label: 'Inicializar proyecto', hint: 'el agente de inicializar con «inicializa el proyecto»' },
100
+ { action: 'update', label: 'Actualizar kit', hint: 'omk update en un terminal nuevo' }
101
+ ]
102
+
103
+ const PRESET_OPTIONS: readonly { value: TeamPreset | 'custom'; label: string }[] = [
104
+ ...(Object.keys(TEAM_PRESETS) as TeamPreset[]).map((id) => ({ value: id, label: TEAM_PRESETS[id].label })),
105
+ { value: 'custom', label: 'Personalizado' }
106
+ ]
107
+
108
+ const CROSS_LABEL: Record<CrossReview, string> = {
109
+ sensibles: 'Unidades L y sensibles',
110
+ todas: 'Todas las unidades',
111
+ nunca: 'Nunca'
112
+ }
113
+ const CROSS_OPTIONS = CROSS_REVIEW.map((value) => ({ value, label: CROSS_LABEL[value] }))
114
+ const LEVEL_OPTIONS = ROLE_LEVELS.map((value) => ({ value, label: `Nivel ${value}` }))
115
+ const REVIEW_OPTIONS = CUSTOM_REVIEWS.map(({ id, label }) => ({ value: id, label }))
116
+ const SOURCE_OPTIONS = TASK_SOURCES.map(({ id, label }) => ({ value: id, label }))
117
+ // Orca no admite una opción con valor vacío; este no puede ser un id de agente.
118
+ const AUTO_ROLE = { value: '(auto)', label: 'Lo elige el coordinador' }
119
+
120
+ const SOURCE_FIELD: Record<TaskSource, { label: string; placeholder: string }> = {
121
+ chat: { label: 'Qué quieres hacer', placeholder: 'Login con Google y su pantalla de ajustes' },
122
+ plan: { label: 'Qué plan (opcional)', placeholder: 'planes/sprint-3.md' },
123
+ speckit: { label: 'Qué feature (opcional)', placeholder: '003-recargas' }
124
+ }
125
+
126
+ const preferences = atom<Preferences>(DEFAULTS)
127
+ const agents = atom<AgentsView | null>(null)
128
+ const team = atom<TeamDraft>('team', draftFromPreset('claude'), {
129
+ persist: 'plugin',
130
+ version: 2,
131
+ migrate: (stored) => normalizeDraft(stored)
132
+ })
133
+ const task = atom('')
134
+ const source = atom<TaskSource>('chat')
135
+
136
+ function fromSettings(values: Record<string, unknown>): Preferences {
137
+ return {
138
+ contractHint: parseContractHintMode(values.contractHint),
139
+ autoOrchestrate: values.autoOrchestrate !== false,
140
+ statusBar: values.statusBar !== false,
141
+ notify: values.notify !== false,
142
+ initAgent: isValidAgentId(values.initAgent) ? values.initAgent : DEFAULTS.initAgent
143
+ }
144
+ }
145
+
146
+ async function loadPreferences(): Promise<void> {
147
+ try {
148
+ set(preferences, fromSettings(await settings.get()))
149
+ } catch (error) {
150
+ set(outcome, { tone: 'danger', text: `No pude leer los ajustes: ${describeError(error)}` })
151
+ }
152
+ }
153
+
154
+ async function save(key: keyof Preferences, value: string | boolean): Promise<void> {
155
+ try {
156
+ await settings.set(key, value)
157
+ set(preferences, { ...read(preferences), [key]: value })
158
+ set(outcome, { tone: 'success', text: 'Ajuste guardado.' })
159
+ } catch (error) {
160
+ set(outcome, { tone: 'danger', text: `No se guardó el ajuste: ${describeError(error)}` })
161
+ }
162
+ }
163
+
164
+ const run = (action: KitAction) => ask(action, () => plugin.request('kit.run', { action }))
165
+
166
+ const openAgent = (id: string) => ask('open', () => plugin.request('agents.open', { id }))
167
+
168
+ async function orchestrate(): Promise<void> {
169
+ const autonomy = read(runAutonomy)
170
+ const sent = await ask('orchestrate', () =>
171
+ plugin.request('team.orchestrate', {
172
+ agent: read(team).coordinator,
173
+ task: read(task),
174
+ source: read(source),
175
+ ...(autonomy ? { autonomy } : {})
176
+ })
177
+ )
178
+ if (sent) set(task, '')
179
+ }
180
+
181
+ async function applyTeam(): Promise<void> {
182
+ const ready = teamFromDraft(read(team))
183
+ if (!ready) {
184
+ set(outcome, { tone: 'danger', text: 'El equipo no es válido: revisa los proveedores y los roles propios.' })
185
+ return
186
+ }
187
+ await ask('team', () => plugin.request('team.apply', { team: ready }))
188
+ }
189
+
190
+ const showTeam = () => ask('team', () => plugin.request('team.show'))
191
+
192
+ // Cualquier cambio a mano convierte el equipo en personalizado; el coordinador no cuenta.
193
+ const editTeam = (patch: Partial<TeamDraft>) => set(team, { ...read(team), ...patch, preset: 'custom' })
194
+ const setCoordinator = (coordinator: string) => {
195
+ if (isValidAgentId(coordinator)) set(team, { ...read(team), coordinator })
196
+ }
197
+
198
+ function choosePreset(value: string): void {
199
+ if (value === 'custom') set(team, { ...read(team), preset: 'custom' })
200
+ else if (value in TEAM_PRESETS) set(team, { ...draftFromPreset(value as TeamPreset), custom: read(team).custom })
201
+ }
202
+
203
+ function toggleProvider(id: string, on: boolean): void {
204
+ const { providers } = read(team)
205
+ const next = on ? [...providers, id] : providers.filter((provider) => provider !== id)
206
+ if (next.length > 0) editTeam({ providers: [...new Set(next)] })
207
+ }
208
+
209
+ function setRole(role: RoleId, provider: string): void {
210
+ const roles = { ...read(team).roles }
211
+ if (provider === AUTO_ROLE.value) delete roles[role]
212
+ else roles[role] = provider
213
+ editTeam({ roles })
214
+ }
215
+
216
+ function editCustom(index: number, patch: Partial<CustomRole>): void {
217
+ editTeam({ custom: read(team).custom.map((role, i) => (i === index ? { ...role, ...patch } : role)) })
218
+ }
219
+
220
+ const addCustom = () => editTeam({ custom: [...read(team).custom, emptyCustomRole()] })
221
+ const removeCustom = (index: number) => editTeam({ custom: read(team).custom.filter((_, i) => i !== index) })
222
+
223
+ export function setup(ctx: PanelContext): void {
224
+ ctx.subscriptions.push(plugin.on('agents.changed', (view) => set(agents, view)))
225
+ ctx.subscriptions.push(settings.onDidChange(() => void loadPreferences()))
226
+ void loadPreferences()
227
+ setupNotices(ctx)
228
+ setupWorktrees(ctx)
229
+ setupHistory(ctx)
230
+ void plugin
231
+ .request('agents.summary')
232
+ .then((view) => set(agents, view))
233
+ .catch((error: unknown) => set(outcome, { tone: 'danger', text: `Agentes no leídos: ${describeError(error)}` }))
234
+ }
235
+
236
+ function AgentCard({ agent }: { agent: AgentLine }) {
237
+ const working = read(busy) !== null
238
+ // Como en la lista de worktrees de Orca: el logo del agente delante del nombre.
239
+ return (
240
+ <Row gap="xs" align="start">
241
+ <Box paddingY="sm">
242
+ <AgentIcon agent={agent.agent} />
243
+ </Box>
244
+ <Box grow>
245
+ <Collapsible
246
+ title={agent.title}
247
+ description={agent.detail ? `${agent.state} · ${agent.detail}` : agent.state}
248
+ defaultOpen={agent.blocked}
249
+ >
250
+ <Stack gap="sm">
251
+ <Row gap="xs" align="center" wrap>
252
+ <Badge tone={agent.blocked ? 'warning' : 'neutral'}>{agent.state}</Badge>
253
+ {agent.since === null ? null : (
254
+ <Text muted size="xs">
255
+ desde <RelativeTime at={agent.since} />
256
+ </Text>
257
+ )}
258
+ </Row>
259
+ {agent.facts.length > 0 ? <KeyValue label={`Datos de ${agent.title}`} items={agent.facts} /> : null}
260
+ {agent.canOpen ? (
261
+ <Button variant="outline" size="sm" icon="open-external" disabled={working} onPress={() => openAgent(agent.id)}>
262
+ Ir a su workspace
263
+ </Button>
264
+ ) : null}
265
+ </Stack>
266
+ </Collapsible>
267
+ </Box>
268
+ </Row>
269
+ )
270
+ }
271
+
272
+ function Agents() {
273
+ const view = read(agents)
274
+ return (
275
+ <Card title="Agentes activos" description={view && view.groups.length > 0 ? view.text : 'En todos los workspaces.'}>
276
+ {view === null ? (
277
+ <Text muted>Cargando…</Text>
278
+ ) : view.groups.length === 0 ? (
279
+ <EmptyState
280
+ icon="agent"
281
+ title="Ningún agente activo"
282
+ description="Aparecen aquí en cuanto uno trabaja, espera o se bloquea."
283
+ />
284
+ ) : (
285
+ <Stack gap="md">
286
+ {view.groups.map((group) => (
287
+ <Stack gap="xs">
288
+ <Text weight="semibold" size="sm">
289
+ {group.title}
290
+ </Text>
291
+ {group.agents.map((agent) => (
292
+ <AgentCard agent={agent} />
293
+ ))}
294
+ </Stack>
295
+ ))}
296
+ </Stack>
297
+ )}
298
+ </Card>
299
+ )
300
+ }
301
+
302
+ function Orchestrate() {
303
+ const text = read(task)
304
+ const from = read(source)
305
+ const { coordinator } = read(team)
306
+ const field = SOURCE_FIELD[from]
307
+ const working = read(busy) !== null
308
+ return (
309
+ <Card
310
+ title="Repartir una tarea entre agentes"
311
+ description="Abre un agente coordinador en el workspace activo con la skill orca. No necesita spec-kit."
312
+ >
313
+ <Stack gap="md">
314
+ <Text size="sm" muted>
315
+ El coordinador lee la tarea, decide si compensa repartirla, te enseña el plan de rondas para que lo
316
+ confirmes y lanza un agente por unidad, cada uno en su worktree y con su rol del equipo. Al terminar lo
317
+ integra y te pide confirmar el merge. Los agentes aparecen en la pestaña Agentes.
318
+ </Text>
319
+ <Text size="sm" muted>
320
+ No hace falta venir aquí: con el ajuste «Repartir al lanzar un agente con tarea» (pestaña Kit), cualquier
321
+ agente que Orca arranca con una tarea, por ejemplo al crear un worktree, pasa primero por la skill orca.
322
+ </Text>
323
+ <Select
324
+ label="De dónde sale el trabajo"
325
+ value={from}
326
+ options={SOURCE_OPTIONS}
327
+ onChange={(value) => {
328
+ const next = TASK_SOURCES.find(({ id }) => id === value)?.id
329
+ if (next) set(source, next)
330
+ }}
331
+ />
332
+ <Textarea
333
+ label={field.label}
334
+ rows={4}
335
+ maxLength={TASK_MAX}
336
+ value={text}
337
+ placeholder={field.placeholder}
338
+ onChange={(value) => set(task, value)}
339
+ onSubmit={() => orchestrate()}
340
+ />
341
+ <Select label="Coordinador" value={coordinator} options={agentOptions([coordinator])} onChange={setCoordinator} />
342
+ <AutonomyOverride />
343
+ <Button icon="play" disabled={working || (from === 'chat' && text.trim() === '')} onPress={orchestrate}>
344
+ {read(busy) === 'orchestrate' ? 'Lanzando…' : 'Repartir'}
345
+ </Button>
346
+ </Stack>
347
+ </Card>
348
+ )
349
+ }
350
+
351
+ type CustomRoleEditorProps = { role: CustomRole; index: number; others: string[]; providers: string[] }
352
+
353
+ function CustomRoleEditor({ role, index, others, providers }: CustomRoleEditorProps) {
354
+ const nameOk = isValidRoleName(role.name, others)
355
+ const providerOptions = [AUTO_ROLE, ...providers.map((id) => ({ value: id, label: agentLabel(id) }))]
356
+ return (
357
+ <Collapsible
358
+ title={role.name.trim() || 'Rol nuevo'}
359
+ description={role.work.trim() || 'Sin describir'}
360
+ defaultOpen={!nameOk || role.work.trim() === ''}
361
+ >
362
+ <Stack gap="sm">
363
+ <Input
364
+ label="Nombre del rol"
365
+ value={role.name}
366
+ maxLength={30}
367
+ placeholder="Hermes"
368
+ invalid={!nameOk}
369
+ onChange={(value) => editCustom(index, { name: value })}
370
+ />
371
+ <Input
372
+ label="Qué hace"
373
+ value={role.work}
374
+ maxLength={ROLE_WORK_MAX}
375
+ placeholder="Traducciones y textos de la interfaz"
376
+ invalid={role.work.trim() === ''}
377
+ onChange={(value) => editCustom(index, { work: value })}
378
+ />
379
+ <Select
380
+ label="Nivel de modelo"
381
+ value={role.level}
382
+ options={LEVEL_OPTIONS}
383
+ onChange={(value) => {
384
+ const level = ROLE_LEVELS.find((candidate) => candidate === value)
385
+ if (level) editCustom(index, { level })
386
+ }}
387
+ />
388
+ <Select
389
+ label="Revisión"
390
+ value={role.review}
391
+ options={REVIEW_OPTIONS}
392
+ onChange={(value) => {
393
+ const review = CUSTOM_REVIEWS.find((candidate) => candidate.id === value)?.id
394
+ if (review) editCustom(index, { review })
395
+ }}
396
+ />
397
+ <Select
398
+ label="Proveedor"
399
+ value={role.provider !== null && providers.includes(role.provider) ? role.provider : AUTO_ROLE.value}
400
+ options={providerOptions}
401
+ onChange={(value) => editCustom(index, { provider: value === AUTO_ROLE.value ? null : value })}
402
+ />
403
+ <Input
404
+ label="Guardarraíl (opcional)"
405
+ value={role.guard}
406
+ maxLength={ROLE_GUARD_MAX}
407
+ placeholder="No cambia textos legales sin revisión"
408
+ onChange={(value) => editCustom(index, { guard: value })}
409
+ />
410
+ <Button variant="ghost" tone="danger" size="sm" icon="delete" onPress={() => removeCustom(index)}>
411
+ Quitar rol
412
+ </Button>
413
+ </Stack>
414
+ </Collapsible>
415
+ )
416
+ }
417
+
418
+ function Team() {
419
+ const draft = read(team)
420
+ const { providers } = draft
421
+ const providerOptions = [AUTO_ROLE, ...providers.map((id) => ({ value: id, label: agentLabel(id) }))]
422
+ const fixed = TEAM_ROLES.filter(({ id }) => providers.includes(draft.roles[id] ?? '')).length
423
+ const working = read(busy) !== null
424
+ const ready = teamFromDraft(draft) !== null
425
+ return (
426
+ <Stack gap="md">
427
+ <AutonomyCard />
428
+ <Card
429
+ title="Equipo"
430
+ description="Quién hace cada rol. «Aplicar» lo escribe en ORCHESTRATION.md §1 del proyecto activo, que la skill orca lee al repartir."
431
+ >
432
+ <Stack gap="md">
433
+ <Select label="Equipo predefinido" value={draft.preset} options={PRESET_OPTIONS} onChange={choosePreset} />
434
+ <Collapsible title="Proveedores activos" description={providers.map(agentLabel).join(', ')}>
435
+ <Stack gap="xs">
436
+ {agentOptions(providers).map(({ value, label }) => (
437
+ <Checkbox
438
+ label={label}
439
+ checked={providers.includes(value)}
440
+ disabled={providers.length === 1 && providers.includes(value)}
441
+ onChange={(on) => toggleProvider(value, on)}
442
+ />
443
+ ))}
444
+ </Stack>
445
+ </Collapsible>
446
+ <Select
447
+ label="Revisión cruzada"
448
+ value={draft.cross}
449
+ options={CROSS_OPTIONS}
450
+ onChange={(value) => {
451
+ const cross = CROSS_REVIEW.find((mode) => mode === value)
452
+ if (cross) editTeam({ cross })
453
+ }}
454
+ />
455
+ <Collapsible
456
+ title="Roles de Olimpo"
457
+ description={fixed === 0 ? 'Todos los elige el coordinador' : `${fixed} de ${TEAM_ROLES.length} fijados`}
458
+ >
459
+ <Stack gap="sm">
460
+ {TEAM_ROLES.map((role) => {
461
+ const provider = draft.roles[role.id] ?? AUTO_ROLE.value
462
+ return (
463
+ <Select
464
+ label={`${role.name} · ${role.work} (nivel ${role.level})`}
465
+ value={providers.includes(provider) ? provider : AUTO_ROLE.value}
466
+ options={providerOptions}
467
+ onChange={(value) => setRole(role.id, value)}
468
+ />
469
+ )
470
+ })}
471
+ </Stack>
472
+ </Collapsible>
473
+ </Stack>
474
+ </Card>
475
+ <Card title="Roles propios" description="Roles de este proyecto que no están en Olimpo. Van a la tabla «Roles propios del proyecto».">
476
+ <Stack gap="sm">
477
+ {draft.custom.length === 0 ? (
478
+ <Text muted size="sm">
479
+ Ninguno todavía.
480
+ </Text>
481
+ ) : null}
482
+ {draft.custom.map((role, index) => (
483
+ <CustomRoleEditor
484
+ role={role}
485
+ index={index}
486
+ others={draft.custom.filter((_, i) => i !== index).map(({ name }) => name)}
487
+ providers={providers}
488
+ />
489
+ ))}
490
+ <Button variant="outline" icon="add" disabled={draft.custom.length >= CUSTOM_ROLES_MAX} onPress={addCustom}>
491
+ Añadir rol
492
+ </Button>
493
+ </Stack>
494
+ </Card>
495
+ <Row gap="xs" wrap>
496
+ <Button icon="check" disabled={working || !ready} onPress={applyTeam}>
497
+ {read(busy) === 'team' ? 'Aplicando…' : 'Aplicar al proyecto'}
498
+ </Button>
499
+ <Button variant="outline" icon="file-text" disabled={working} onPress={showTeam}>
500
+ Ver el del proyecto
501
+ </Button>
502
+ </Row>
503
+ </Stack>
504
+ )
505
+ }
506
+
507
+ function Actions() {
508
+ const current = read(busy)
509
+ return (
510
+ <Card title="Acciones" description="Se ejecutan en el workspace activo.">
511
+ <Stack gap="sm">
512
+ {ACTIONS.map(({ action, label, hint }) => (
513
+ <Button
514
+ icon={action === 'verify' ? 'check' : action === 'init' ? 'play' : 'refresh'}
515
+ tooltip={hint}
516
+ disabled={current !== null}
517
+ onPress={() => run(action)}
518
+ >
519
+ {current === action ? `${label}…` : label}
520
+ </Button>
521
+ ))}
522
+ </Stack>
523
+ </Card>
524
+ )
525
+ }
526
+
527
+ function Settings() {
528
+ const prefs = read(preferences)
529
+ return (
530
+ <Card title="Ajustes" description="Los mismos que Settings → Plugins → Orca Multiagent Kit.">
531
+ <Stack gap="md">
532
+ <Select
533
+ label="Contrato del worker en los despachos"
534
+ value={prefs.contractHint}
535
+ options={CONTRACT_OPTIONS}
536
+ onChange={(value) => save('contractHint', parseContractHintMode(value))}
537
+ />
538
+ <Switch
539
+ label="Repartir al lanzar un agente con tarea"
540
+ checked={prefs.autoOrchestrate}
541
+ onChange={(on) => save('autoOrchestrate', on)}
542
+ />
543
+ <Switch label="Agentes en la barra de estado" checked={prefs.statusBar} onChange={(on) => save('statusBar', on)} />
544
+ <Switch label="Avisos de agentes" checked={prefs.notify} onChange={(on) => save('notify', on)} />
545
+ <Select
546
+ label="Agente para inicializar"
547
+ value={prefs.initAgent}
548
+ options={agentOptions([prefs.initAgent])}
549
+ onChange={(value) => {
550
+ if (isValidAgentId(value)) void save('initAgent', value)
551
+ }}
552
+ />
553
+ </Stack>
554
+ </Card>
555
+ )
556
+ }
557
+
558
+ export default function Panel() {
559
+ const last = read(outcome)
560
+ return (
561
+ <Stack gap="md">
562
+ <Heading>Orca Multiagent Kit</Heading>
563
+ {last ? (
564
+ <Callout
565
+ tone={last.tone}
566
+ icon={last.tone === 'success' ? 'check' : 'error'}
567
+ title={last.tone === 'success' ? 'Hecho' : 'No se pudo'}
568
+ >
569
+ <Stack gap="xs">
570
+ <Text>{last.text}</Text>
571
+ <Button variant="ghost" size="sm" icon="close" onPress={() => set(outcome, null)}>
572
+ Cerrar
573
+ </Button>
574
+ </Stack>
575
+ </Callout>
576
+ ) : null}
577
+ <Tabs label="Secciones" defaultValue="notices">
578
+ <Tab value="notices" label={noticesLabel()} icon="bell">
579
+ <Notices />
580
+ </Tab>
581
+ <Tab value="agents" label="Agentes" icon="agent">
582
+ <Agents />
583
+ </Tab>
584
+ <Tab value="worktrees" label="Worktrees" icon="branch">
585
+ <Worktrees />
586
+ </Tab>
587
+ <Tab value="orchestrate" label="Repartir" icon="play">
588
+ <Orchestrate />
589
+ </Tab>
590
+ <Tab value="history" label="Historial" icon="calendar">
591
+ <History />
592
+ </Tab>
593
+ <Tab value="team" label="Equipo" icon="settings">
594
+ <Team />
595
+ </Tab>
596
+ <Tab value="kit" label="Kit" icon="wrench">
597
+ <Stack gap="md">
598
+ <Actions />
599
+ <Settings />
600
+ <Text muted size="xs">
601
+ Desde un terminal: <Code>omk setup</Code> prepara todo el entorno, <Code>omk team</Code> enseña el
602
+ equipo del proyecto y <Code>omk plugin status</Code> muestra el plugin.
603
+ </Text>
604
+ </Stack>
605
+ </Tab>
606
+ </Tabs>
607
+ </Stack>
608
+ )
609
+ }