orca-multiagent-kit 1.5.0 → 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.
- package/CHANGELOG.md +30 -1
- package/README.md +2 -1
- package/VERSION +1 -1
- package/bin/omk.js +7 -0
- package/bin/team.js +353 -0
- package/core/AGENTS.md +1 -1
- package/docs/PLUGIN-ORCA.md +107 -18
- package/orca-plugin/README.md +5 -1
- package/orca-plugin/assets/logos/README.md +10 -0
- package/orca-plugin/assets/logos/agent.png +0 -0
- package/orca-plugin/assets/logos/aider.png +0 -0
- package/orca-plugin/assets/logos/amp.png +0 -0
- package/orca-plugin/assets/logos/antigravity.png +0 -0
- package/orca-plugin/assets/logos/claude.png +0 -0
- package/orca-plugin/assets/logos/cline.png +0 -0
- package/orca-plugin/assets/logos/codex.png +0 -0
- package/orca-plugin/assets/logos/copilot.png +0 -0
- package/orca-plugin/assets/logos/cursor.png +0 -0
- package/orca-plugin/assets/logos/devin.png +0 -0
- package/orca-plugin/assets/logos/droid.png +0 -0
- package/orca-plugin/assets/logos/gemini.png +0 -0
- package/orca-plugin/assets/logos/goose.png +0 -0
- package/orca-plugin/assets/logos/grok.png +0 -0
- package/orca-plugin/assets/logos/kimi.png +0 -0
- package/orca-plugin/assets/logos/kiro.png +0 -0
- package/orca-plugin/assets/logos/opencode.png +0 -0
- package/orca-plugin/assets/logos/qwen-code.png +0 -0
- package/orca-plugin/orca-plugin.json +25 -7
- package/orca-plugin/src/icons.test.ts +14 -0
- package/orca-plugin/src/icons.ts +30 -0
- package/orca-plugin/src/kit.test.ts +456 -9
- package/orca-plugin/src/kit.ts +626 -21
- package/orca-plugin/src/models.test.ts +28 -0
- package/orca-plugin/src/models.ts +29 -0
- package/orca-plugin/src/node.d.ts +40 -0
- package/orca-plugin/src/panel-state.ts +28 -0
- package/orca-plugin/src/panel.test.tsx +228 -30
- package/orca-plugin/src/panel.tsx +482 -78
- package/orca-plugin/src/plan-card.test.ts +99 -0
- package/orca-plugin/src/plan-card.ts +107 -0
- package/orca-plugin/src/protocol.ts +166 -5
- package/orca-plugin/src/tabs/autonomy.tsx +70 -0
- package/orca-plugin/src/tabs/history.test.tsx +78 -0
- package/orca-plugin/src/tabs/history.tsx +118 -0
- package/orca-plugin/src/tabs/notices.test.tsx +183 -0
- package/orca-plugin/src/tabs/notices.tsx +274 -0
- package/orca-plugin/src/tabs/worktrees.test.tsx +130 -0
- package/orca-plugin/src/tabs/worktrees.tsx +138 -0
- package/orca-plugin/src/ui/agent-icon.tsx +13 -0
- package/orca-plugin/src/worker/context.test.ts +32 -0
- package/orca-plugin/src/worker/context.ts +92 -0
- package/orca-plugin/src/worker/history.test.ts +149 -0
- package/orca-plugin/src/worker/history.ts +181 -0
- package/orca-plugin/src/worker/notices.test.ts +356 -0
- package/orca-plugin/src/worker/notices.ts +291 -0
- package/orca-plugin/src/worker/system.test.ts +58 -0
- package/orca-plugin/src/worker/system.ts +122 -0
- package/orca-plugin/src/worker/worktrees.test.ts +177 -0
- package/orca-plugin/src/worker/worktrees.ts +188 -0
- package/orca-plugin/src/worker.test.ts +265 -22
- package/orca-plugin/src/worker.ts +318 -34
- package/package.json +2 -2
- package/skills/orca/SKILL.md +1 -0
- package/skills/orca/references/engine-orca.md +1 -0
- package/skills/orca/references/olimpo.md +1 -0
- package/skills/orca/references/plan-card.md +45 -0
|
@@ -1,36 +1,92 @@
|
|
|
1
|
-
// Panel lateral del kit
|
|
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.
|
|
2
5
|
// Los ajustes son los mismos de Settings → Plugins → Orca Multiagent Kit: cambiarlos aquí o allí
|
|
3
6
|
// es lo mismo, y el worker se entera por `settings.onDidChange`.
|
|
4
7
|
// Orca transpila este fichero al cargarlo: no hay paso de build.
|
|
5
8
|
import {
|
|
6
9
|
atom,
|
|
10
|
+
Badge,
|
|
11
|
+
Box,
|
|
7
12
|
Button,
|
|
8
13
|
Callout,
|
|
9
14
|
Card,
|
|
15
|
+
Checkbox,
|
|
10
16
|
Code,
|
|
17
|
+
Collapsible,
|
|
11
18
|
EmptyState,
|
|
12
19
|
Heading,
|
|
13
20
|
Input,
|
|
14
|
-
|
|
15
|
-
ListItem,
|
|
21
|
+
KeyValue,
|
|
16
22
|
plugin,
|
|
17
23
|
read,
|
|
24
|
+
RelativeTime,
|
|
18
25
|
Row,
|
|
19
26
|
Select,
|
|
20
27
|
set,
|
|
21
28
|
settings,
|
|
22
29
|
Stack,
|
|
23
30
|
Switch,
|
|
31
|
+
Tab,
|
|
32
|
+
Tabs,
|
|
24
33
|
Text,
|
|
34
|
+
Textarea,
|
|
25
35
|
type PanelContext
|
|
26
36
|
} from 'orca'
|
|
27
|
-
import {
|
|
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'
|
|
28
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'
|
|
29
74
|
|
|
30
|
-
type Preferences = {
|
|
31
|
-
|
|
75
|
+
type Preferences = {
|
|
76
|
+
contractHint: ContractHintMode
|
|
77
|
+
autoOrchestrate: boolean
|
|
78
|
+
statusBar: boolean
|
|
79
|
+
notify: boolean
|
|
80
|
+
initAgent: string
|
|
81
|
+
}
|
|
32
82
|
|
|
33
|
-
const DEFAULTS: Preferences = {
|
|
83
|
+
const DEFAULTS: Preferences = {
|
|
84
|
+
contractHint: 'kit',
|
|
85
|
+
autoOrchestrate: true,
|
|
86
|
+
statusBar: true,
|
|
87
|
+
notify: true,
|
|
88
|
+
initAgent: 'claude'
|
|
89
|
+
}
|
|
34
90
|
|
|
35
91
|
const CONTRACT_OPTIONS: readonly { value: ContractHintMode; label: string }[] = [
|
|
36
92
|
{ value: 'kit', label: 'Solo despachos del kit' },
|
|
@@ -44,29 +100,52 @@ const ACTIONS: readonly { action: KitAction; label: string; hint: string }[] = [
|
|
|
44
100
|
{ action: 'update', label: 'Actualizar kit', hint: 'omk update en un terminal nuevo' }
|
|
45
101
|
]
|
|
46
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
|
+
|
|
47
126
|
const preferences = atom<Preferences>(DEFAULTS)
|
|
48
|
-
const agentDraft = atom(DEFAULTS.initAgent)
|
|
49
127
|
const agents = atom<AgentsView | null>(null)
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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')
|
|
56
135
|
|
|
57
136
|
function fromSettings(values: Record<string, unknown>): Preferences {
|
|
58
137
|
return {
|
|
59
138
|
contractHint: parseContractHintMode(values.contractHint),
|
|
139
|
+
autoOrchestrate: values.autoOrchestrate !== false,
|
|
60
140
|
statusBar: values.statusBar !== false,
|
|
61
|
-
|
|
141
|
+
notify: values.notify !== false,
|
|
142
|
+
initAgent: isValidAgentId(values.initAgent) ? values.initAgent : DEFAULTS.initAgent
|
|
62
143
|
}
|
|
63
144
|
}
|
|
64
145
|
|
|
65
146
|
async function loadPreferences(): Promise<void> {
|
|
66
147
|
try {
|
|
67
|
-
|
|
68
|
-
set(preferences, next)
|
|
69
|
-
set(agentDraft, next.initAgent)
|
|
148
|
+
set(preferences, fromSettings(await settings.get()))
|
|
70
149
|
} catch (error) {
|
|
71
150
|
set(outcome, { tone: 'danger', text: `No pude leer los ajustes: ${describeError(error)}` })
|
|
72
151
|
}
|
|
@@ -82,39 +161,351 @@ async function save(key: keyof Preferences, value: string | boolean): Promise<vo
|
|
|
82
161
|
}
|
|
83
162
|
}
|
|
84
163
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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.' })
|
|
89
185
|
return
|
|
90
186
|
}
|
|
91
|
-
await
|
|
187
|
+
await ask('team', () => plugin.request('team.apply', { team: ready }))
|
|
92
188
|
}
|
|
93
189
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
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 })
|
|
104
214
|
}
|
|
105
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
|
+
|
|
106
223
|
export function setup(ctx: PanelContext): void {
|
|
107
224
|
ctx.subscriptions.push(plugin.on('agents.changed', (view) => set(agents, view)))
|
|
108
225
|
ctx.subscriptions.push(settings.onDidChange(() => void loadPreferences()))
|
|
109
226
|
void loadPreferences()
|
|
227
|
+
setupNotices(ctx)
|
|
228
|
+
setupWorktrees(ctx)
|
|
229
|
+
setupHistory(ctx)
|
|
110
230
|
void plugin
|
|
111
231
|
.request('agents.summary')
|
|
112
232
|
.then((view) => set(agents, view))
|
|
113
233
|
.catch((error: unknown) => set(outcome, { tone: 'danger', text: `Agentes no leídos: ${describeError(error)}` }))
|
|
114
234
|
}
|
|
115
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
|
+
|
|
116
507
|
function Actions() {
|
|
117
|
-
const
|
|
508
|
+
const current = read(busy)
|
|
118
509
|
return (
|
|
119
510
|
<Card title="Acciones" description="Se ejecutan en el workspace activo.">
|
|
120
511
|
<Stack gap="sm">
|
|
@@ -122,10 +513,10 @@ function Actions() {
|
|
|
122
513
|
<Button
|
|
123
514
|
icon={action === 'verify' ? 'check' : action === 'init' ? 'play' : 'refresh'}
|
|
124
515
|
tooltip={hint}
|
|
125
|
-
disabled={
|
|
516
|
+
disabled={current !== null}
|
|
126
517
|
onPress={() => run(action)}
|
|
127
518
|
>
|
|
128
|
-
{
|
|
519
|
+
{current === action ? `${label}…` : label}
|
|
129
520
|
</Button>
|
|
130
521
|
))}
|
|
131
522
|
</Stack>
|
|
@@ -135,7 +526,6 @@ function Actions() {
|
|
|
135
526
|
|
|
136
527
|
function Settings() {
|
|
137
528
|
const prefs = read(preferences)
|
|
138
|
-
const draft = read(agentDraft)
|
|
139
529
|
return (
|
|
140
530
|
<Card title="Ajustes" description="Los mismos que Settings → Plugins → Orca Multiagent Kit.">
|
|
141
531
|
<Stack gap="md">
|
|
@@ -145,61 +535,75 @@ function Settings() {
|
|
|
145
535
|
options={CONTRACT_OPTIONS}
|
|
146
536
|
onChange={(value) => save('contractHint', parseContractHintMode(value))}
|
|
147
537
|
/>
|
|
538
|
+
<Switch
|
|
539
|
+
label="Repartir al lanzar un agente con tarea"
|
|
540
|
+
checked={prefs.autoOrchestrate}
|
|
541
|
+
onChange={(on) => save('autoOrchestrate', on)}
|
|
542
|
+
/>
|
|
148
543
|
<Switch label="Agentes en la barra de estado" checked={prefs.statusBar} onChange={(on) => save('statusBar', on)} />
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/>
|
|
159
|
-
<Button variant="outline" disabled={draft.trim() === prefs.initAgent} onPress={saveInitAgent}>
|
|
160
|
-
Guardar
|
|
161
|
-
</Button>
|
|
162
|
-
</Row>
|
|
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
|
+
/>
|
|
163
553
|
</Stack>
|
|
164
554
|
</Card>
|
|
165
555
|
)
|
|
166
556
|
}
|
|
167
557
|
|
|
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
558
|
export default function Panel() {
|
|
188
559
|
const last = read(outcome)
|
|
189
560
|
return (
|
|
190
561
|
<Stack gap="md">
|
|
191
562
|
<Heading>Orca Multiagent Kit</Heading>
|
|
192
563
|
{last ? (
|
|
193
|
-
<Callout
|
|
194
|
-
|
|
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>
|
|
195
575
|
</Callout>
|
|
196
576
|
) : null}
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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>
|
|
203
607
|
</Stack>
|
|
204
608
|
)
|
|
205
609
|
}
|