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