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,20 +1,23 @@
|
|
|
1
1
|
// El worker tal como lo carga Orca, contra un host simulado con las capacidades del manifiesto.
|
|
2
2
|
import { afterEach, assert, hostError, mockHost, mountWorker, test, type TestWorker } from 'orca/testing'
|
|
3
|
-
import { CONTRACT_HINT } from './kit.ts'
|
|
3
|
+
import { CONTRACT_HINT, ORCHESTRATE_HINT, encodeTeam, orchestratePrompt, type Team } from './kit.ts'
|
|
4
|
+
import type { AgentsView } from './protocol.ts'
|
|
4
5
|
import * as main from './worker.ts'
|
|
5
6
|
|
|
6
7
|
const KIT_SPEC = 'UNIT: U1 — Login RUN: 20261107-auth BASE: abc123'
|
|
8
|
+
const KIT_DISPATCH = `${KIT_SPEC}\nROL: Proteo · implementación · nivel medio — una unidad cada vez`
|
|
7
9
|
|
|
8
10
|
const baseResults = (overrides: Record<string, unknown> = {}) => ({
|
|
9
11
|
'workspace.readContext': { branch: 'main', displayName: 'app', terminals: [] },
|
|
10
12
|
'workspace.list': {
|
|
11
|
-
workspaces: [{ id: 'w1', kind: 'worktree', name: 'app', path: '/repo/app', branch: 'main', hostId: null }],
|
|
13
|
+
workspaces: [{ id: 'w1', kind: 'worktree', name: 'app', path: '/repo/app', branch: 'refs/heads/main', hostId: null }],
|
|
12
14
|
truncated: false
|
|
13
15
|
},
|
|
14
16
|
'agents.list': { agents: [] },
|
|
15
17
|
'terminal.create': { terminalId: 't9' },
|
|
16
18
|
'terminal.read': { lines: [], truncated: false },
|
|
17
19
|
'agent.launch': { terminalId: 't10' },
|
|
20
|
+
'workspace.open': { opened: true },
|
|
18
21
|
'notifications.show': { delivered: true },
|
|
19
22
|
'statusBar.update': { ok: true },
|
|
20
23
|
...overrides
|
|
@@ -33,13 +36,26 @@ const start = async (options: { results?: Record<string, unknown>; settings?: Re
|
|
|
33
36
|
return worker
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
const prompt = (text: string, inputKind: 'orchestration' | 'launch' | 'driving' = 'orchestration') => ({
|
|
39
|
+
const prompt = (text: string, inputKind: 'orchestration' | 'launch' | 'driving' = 'orchestration', terminalId = 't1') => ({
|
|
37
40
|
agent: 'claude',
|
|
38
|
-
terminalId
|
|
41
|
+
terminalId,
|
|
39
42
|
prompt: text,
|
|
40
43
|
inputKind
|
|
41
44
|
})
|
|
42
45
|
|
|
46
|
+
type State = 'working' | 'blocked' | 'waiting' | 'done'
|
|
47
|
+
const status = (terminalId: string, state: State, receivedAt: number, extra: { title?: string; workspaceId?: string } = {}) => ({
|
|
48
|
+
workspaceId: extra.workspaceId ?? 'w1',
|
|
49
|
+
paneKey: `p-${terminalId}`,
|
|
50
|
+
terminalId,
|
|
51
|
+
state,
|
|
52
|
+
receivedAt,
|
|
53
|
+
...(extra.title ? { title: extra.title } : {})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const summary = async (w: TestWorker) => (await w.request('agents.summary')) as AgentsView
|
|
57
|
+
const names = async (w: TestWorker) => (await summary(w)).groups.flatMap((g) => g.agents.map((a) => a.title))
|
|
58
|
+
|
|
43
59
|
test('añade el contrato del worker a un despacho del kit', async () => {
|
|
44
60
|
const w = await start()
|
|
45
61
|
assert.deepEqual(await w.hooks.fire('agent.prompt.before', prompt(KIT_SPEC)), {
|
|
@@ -55,6 +71,24 @@ test('deja intactos los prompts que no son despachos del kit', async () => {
|
|
|
55
71
|
}
|
|
56
72
|
})
|
|
57
73
|
|
|
74
|
+
test('un agente que Orca arranca con una tarea pasa primero por la skill orca', async () => {
|
|
75
|
+
const w = await start()
|
|
76
|
+
const task = prompt('Login con Google', 'launch')
|
|
77
|
+
assert.deepEqual(await w.hooks.fire('agent.prompt.before', task), {
|
|
78
|
+
kind: 'continue',
|
|
79
|
+
event: prompt(`Login con Google\n\n${ORCHESTRATE_HINT}`, 'launch')
|
|
80
|
+
})
|
|
81
|
+
// Un despacho del kit lleva el contrato, no la indicación de repartir.
|
|
82
|
+
const dispatch = await w.hooks.fire('agent.prompt.before', prompt(KIT_SPEC))
|
|
83
|
+
assert.equal(dispatch.kind === 'continue' && dispatch.event.prompt.includes(ORCHESTRATE_HINT), false)
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('el ajuste autoOrchestrate apagado deja los prompts de arranque intactos', async () => {
|
|
87
|
+
const w = await start({ settings: { autoOrchestrate: false } })
|
|
88
|
+
const task = prompt('Login con Google', 'launch')
|
|
89
|
+
assert.deepEqual(await w.hooks.fire('agent.prompt.before', task), { kind: 'continue', event: task })
|
|
90
|
+
})
|
|
91
|
+
|
|
58
92
|
test('el ajuste off desactiva el hook', async () => {
|
|
59
93
|
const w = await start({ settings: { contractHint: 'off' } })
|
|
60
94
|
const event = prompt(KIT_SPEC)
|
|
@@ -115,30 +149,104 @@ test('inicializar rechaza un id de agente no válido sin lanzar nada', async ()
|
|
|
115
149
|
|
|
116
150
|
test('la barra de estado sigue los cambios de estado de los agentes', async () => {
|
|
117
151
|
const w = await start()
|
|
118
|
-
await w.emit('agent.status.changed', {
|
|
119
|
-
|
|
120
|
-
})
|
|
121
|
-
await w.emit('agent.status.changed', {
|
|
122
|
-
workspaceId: 'w2', paneKey: 'p2', terminalId: 't2', title: 'U2 pagos', state: 'blocked', receivedAt: 2
|
|
123
|
-
})
|
|
152
|
+
await w.emit('agent.status.changed', status('t1', 'working', 1, { title: 'U1 login' }))
|
|
153
|
+
await w.emit('agent.status.changed', status('t2', 'blocked', 2, { title: 'U2 pagos', workspaceId: 'w2' }))
|
|
124
154
|
const last = () => w.host.callsOf('statusBar.update').at(-1)
|
|
125
155
|
assert.deepEqual(last(), {
|
|
126
156
|
id: 'agents',
|
|
127
157
|
visible: true,
|
|
128
158
|
text: 'MAW · 1 trabajando · 1 bloqueado',
|
|
129
159
|
tone: 'warning',
|
|
130
|
-
tooltip: 'Orca Multiagent Kit: 1 trabajando, 1 bloqueado en todos los workspaces'
|
|
160
|
+
tooltip: 'Orca Multiagent Kit: 1 trabajando, 1 bloqueado en todos los workspaces\nU2 pagos: bloqueado\nU1 login: trabajando'
|
|
131
161
|
})
|
|
132
|
-
assert.equal(await w.command('agents.status'), '-
|
|
162
|
+
assert.equal(await w.command('agents.status'), '- U2 pagos: bloqueado\n- U1 login: trabajando (app)')
|
|
133
163
|
|
|
134
164
|
await w.emit('workspace.removed', { workspaceId: 'w2', kind: 'worktree', path: '/repo/u2' })
|
|
135
|
-
await w.emit('agent.status.changed',
|
|
136
|
-
workspaceId: 'w1', paneKey: 'p1', terminalId: 't1', state: 'done', receivedAt: 3
|
|
137
|
-
})
|
|
165
|
+
await w.emit('agent.status.changed', status('t1', 'done', 3))
|
|
138
166
|
assert.equal((last() as { text: string }).text, 'MAW')
|
|
139
167
|
assert.deepEqual(w.refusals, [])
|
|
140
168
|
})
|
|
141
169
|
|
|
170
|
+
test('un cambio de estado sin título no borra el nombre del agente', async () => {
|
|
171
|
+
const w = await start()
|
|
172
|
+
await w.emit('agent.status.changed', status('t1', 'working', 1, { title: 'Arreglar login' }))
|
|
173
|
+
await w.emit('agent.status.changed', status('t1', 'waiting', 2))
|
|
174
|
+
assert.deepEqual(await names(w), ['Arreglar login'])
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
test('un despacho del kit da nombre a su agente, llegue antes o después del estado', async () => {
|
|
178
|
+
const w = await start()
|
|
179
|
+
await w.hooks.fire('agent.prompt.before', prompt(KIT_DISPATCH, 'orchestration', 't1'))
|
|
180
|
+
await w.emit('agent.status.changed', status('t1', 'working', 1))
|
|
181
|
+
await w.emit('agent.status.changed', status('t2', 'working', 2))
|
|
182
|
+
await w.hooks.fire('agent.prompt.before', prompt(KIT_DISPATCH.replace('U1 — Login', 'U2 — Pagos'), 'orchestration', 't2'))
|
|
183
|
+
const view = await summary(w)
|
|
184
|
+
assert.deepEqual(view.groups.map((g) => g.title), ['RUN 20261107-auth'])
|
|
185
|
+
assert.deepEqual(await names(w), ['U1 · Proteo — Login', 'U2 · Proteo — Pagos'])
|
|
186
|
+
assert.equal(view.groups[0]?.agents[0]?.detail, 'claude · app')
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
test('el hook de lanzamiento dice qué agente es aunque no tenga título', async () => {
|
|
190
|
+
const w = await start()
|
|
191
|
+
const launch = { agent: 'codex', workspaceId: 'w1', workspaceKind: 'worktree', terminalId: 't5', command: 'codex', env: {} } as const
|
|
192
|
+
assert.deepEqual(await w.hooks.fire('agent.launch.before', launch), { kind: 'continue', event: launch })
|
|
193
|
+
await w.emit('agent.status.changed', status('t5', 'working', 1))
|
|
194
|
+
assert.equal(await w.command('agents.status'), '- codex: trabajando (app)')
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
test('los agentes que ya existen al arrancar llevan su agente y el workspace enfocado', async () => {
|
|
198
|
+
const w = await start({
|
|
199
|
+
results: {
|
|
200
|
+
'agents.list': {
|
|
201
|
+
agents: [{ terminalId: 't1', title: null, agent: 'claude', state: 'blocked', stateStartedAt: 7 }]
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
const [line] = (await summary(w)).groups[0]?.agents ?? []
|
|
206
|
+
assert.equal(line?.title, 'claude')
|
|
207
|
+
assert.equal(line?.detail, 'app')
|
|
208
|
+
assert.equal(line?.since, 7)
|
|
209
|
+
assert.deepEqual(line?.facts, [
|
|
210
|
+
{ label: 'Agente', value: 'Claude Code' },
|
|
211
|
+
{ label: 'Workspace', value: 'app' },
|
|
212
|
+
{ label: 'Rama', value: 'main' },
|
|
213
|
+
{ label: 'Carpeta', value: '/repo/app' },
|
|
214
|
+
{ label: 'Dónde corre', value: 'terminal t1' }
|
|
215
|
+
])
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
test('avisa cuando un agente se bloquea, una vez, y no si se desactiva', async () => {
|
|
219
|
+
const w = await start()
|
|
220
|
+
await w.emit('agent.status.changed', status('t1', 'working', 1, { title: 'U1 login' }))
|
|
221
|
+
await w.emit('agent.status.changed', status('t1', 'blocked', 2))
|
|
222
|
+
await w.emit('agent.status.changed', status('t1', 'blocked', 3))
|
|
223
|
+
assert.deepEqual(w.host.callsOf('notifications.show'), [
|
|
224
|
+
{ title: 'U1 login: bloqueado', body: 'En app. Necesita tu respuesta en Orca.' }
|
|
225
|
+
])
|
|
226
|
+
await w.deactivate()
|
|
227
|
+
|
|
228
|
+
const quiet = await start({ settings: { notify: false } })
|
|
229
|
+
await quiet.emit('agent.status.changed', status('t1', 'blocked', 1))
|
|
230
|
+
assert.equal(quiet.host.callsOf('notifications.show').length, 0)
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
test('avisa cuando terminan todas las unidades lanzadas de un run', async () => {
|
|
234
|
+
const w = await start()
|
|
235
|
+
for (const [terminalId, unit] of [['t1', 'U1 — Login'], ['t2', 'U2 — Pagos']] as const) {
|
|
236
|
+
await w.hooks.fire('agent.prompt.before', prompt(KIT_DISPATCH.replace('U1 — Login', unit), 'orchestration', terminalId))
|
|
237
|
+
await w.emit('agent.status.changed', status(terminalId, 'working', 1))
|
|
238
|
+
}
|
|
239
|
+
await w.emit('agent.status.changed', status('t1', 'done', 2))
|
|
240
|
+
assert.equal(w.host.callsOf('notifications.show').length, 0)
|
|
241
|
+
await w.emit('agent.status.changed', status('t2', 'done', 3))
|
|
242
|
+
assert.deepEqual(w.host.callsOf('notifications.show'), [
|
|
243
|
+
{
|
|
244
|
+
title: 'RUN 20261107-auth: unidades terminadas',
|
|
245
|
+
body: 'Las 2 unidades lanzadas han terminado. Vuelve al coordinador para revisar e integrar.'
|
|
246
|
+
}
|
|
247
|
+
])
|
|
248
|
+
})
|
|
249
|
+
|
|
142
250
|
test('la barra parte de los agentes que ya existen y se oculta si se desactiva', async () => {
|
|
143
251
|
const seeded = await start({
|
|
144
252
|
results: {
|
|
@@ -180,15 +288,150 @@ test('el panel no puede pedir una acción fuera de la lista', async () => {
|
|
|
180
288
|
test('el panel recibe los agentes y solo los cambios', async () => {
|
|
181
289
|
const w = await start()
|
|
182
290
|
assert.deepEqual(await w.request('agents.summary'), {
|
|
183
|
-
text: 'MAW', tone: 'neutral', tooltip: 'Orca Multiagent Kit: ningún agente activo',
|
|
291
|
+
text: 'MAW', tone: 'neutral', tooltip: 'Orca Multiagent Kit: ningún agente activo', groups: []
|
|
184
292
|
})
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
} as const
|
|
188
|
-
await w.emit('agent.status.changed', working)
|
|
189
|
-
await w.emit('agent.status.changed', { ...working, receivedAt: 2 })
|
|
293
|
+
await w.emit('agent.status.changed', status('t1', 'working', 1, { title: 'U1 login' }))
|
|
294
|
+
await w.emit('agent.status.changed', status('t1', 'working', 2, { title: 'U1 login' }))
|
|
190
295
|
const changes = w.posts.filter((p) => p.event === 'agents.changed')
|
|
191
296
|
// El arranque envía el estado vacío; el segundo evento no cambia nada y no se reenvía.
|
|
192
297
|
assert.equal(changes.length, 2)
|
|
193
|
-
|
|
298
|
+
const [group] = (changes.at(-1)?.payload as AgentsView).groups
|
|
299
|
+
assert.equal(group?.title, 'app')
|
|
300
|
+
assert.deepEqual(
|
|
301
|
+
group?.agents.map(({ id, title, state, since, canOpen }) => ({ id, title, state, since, canOpen })),
|
|
302
|
+
[{ id: 't:t1', title: 'U1 login', state: 'trabajando', since: 1, canOpen: true }]
|
|
303
|
+
)
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
test('el panel abre el workspace de un agente activo y nada más', async () => {
|
|
307
|
+
const w = await start()
|
|
308
|
+
await w.emit('agent.status.changed', status('t1', 'working', 1))
|
|
309
|
+
assert.deepEqual(await w.request('agents.open', { id: 't:t1' }), { message: 'Abierto app.' })
|
|
310
|
+
assert.deepEqual(w.host.callsOf('workspace.open'), [{ workspaceId: 'w1' }])
|
|
311
|
+
await assert.rejects(
|
|
312
|
+
w.request('agents.open', { id: 't:nadie' }),
|
|
313
|
+
(error: unknown) => (error as { code?: string }).code === 'invalid_params'
|
|
314
|
+
)
|
|
315
|
+
assert.deepEqual(w.refusals, [])
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
test('aplicar el equipo ejecuta omk team set con el equipo en base64url', async () => {
|
|
319
|
+
const w = await start()
|
|
320
|
+
const team: Team = {
|
|
321
|
+
coordinator: 'claude',
|
|
322
|
+
providers: ['claude', 'codex'],
|
|
323
|
+
cross: 'todas',
|
|
324
|
+
roles: { casandra: 'codex' },
|
|
325
|
+
custom: [{ name: 'Hermes', work: 'Textos; $(rm -rf ~)', level: 'bajo', review: 'argos', guard: '', provider: null }]
|
|
326
|
+
}
|
|
327
|
+
await w.request('team.apply', { team })
|
|
328
|
+
assert.deepEqual(w.host.callsOf('terminal.create'), [
|
|
329
|
+
{ workspaceId: 'w1', title: 'omk team', command: `omk team set --data ${encodeTeam(team)}` }
|
|
330
|
+
])
|
|
331
|
+
assert.match((w.host.callsOf('terminal.create')[0] as { command: string }).command, /^omk team set --data [A-Za-z0-9_-]+$/)
|
|
332
|
+
await w.request('team.show')
|
|
333
|
+
assert.equal((w.host.callsOf('terminal.create')[1] as { command: string }).command, 'omk team')
|
|
334
|
+
})
|
|
335
|
+
|
|
336
|
+
test('la autonomía del proyecto va con una orden literal y nada más', async () => {
|
|
337
|
+
const w = await start()
|
|
338
|
+
await w.request('team.autonomy', { autonomy: 'auto' })
|
|
339
|
+
assert.deepEqual(w.host.callsOf('terminal.create'), [
|
|
340
|
+
{ workspaceId: 'w1', title: 'omk team', command: 'omk team set --autonomy auto' }
|
|
341
|
+
])
|
|
342
|
+
for (const autonomy of ['total', 'auto; rm -rf ~', '', null]) {
|
|
343
|
+
await assert.rejects(
|
|
344
|
+
w.request('team.autonomy', { autonomy } as unknown as { autonomy: 'auto' }),
|
|
345
|
+
(error: unknown) => (error as { code?: string }).code === 'invalid_params'
|
|
346
|
+
)
|
|
347
|
+
}
|
|
348
|
+
assert.equal(w.host.callsOf('terminal.create').length, 1)
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
test('repartir con autonomía para el run la pasa en el prompt; una desconocida no lanza nada', async () => {
|
|
352
|
+
const w = await start()
|
|
353
|
+
await w.request('team.orchestrate', { agent: 'claude', task: 'Login', source: 'chat', autonomy: 'manual' })
|
|
354
|
+
const [launch] = w.host.callsOf('agent.launch') as { prompt: string }[]
|
|
355
|
+
assert.match(launch?.prompt ?? '', /Autonomía de este run: manual/)
|
|
356
|
+
await assert.rejects(
|
|
357
|
+
w.request('team.orchestrate', { agent: 'claude', task: 'Login', source: 'chat', autonomy: 'yolo' } as unknown as {
|
|
358
|
+
agent: string
|
|
359
|
+
task: string
|
|
360
|
+
source: 'chat'
|
|
361
|
+
}),
|
|
362
|
+
(error: unknown) => (error as { code?: string }).code === 'invalid_params'
|
|
363
|
+
)
|
|
364
|
+
assert.equal(w.host.callsOf('agent.launch').length, 1)
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
test('un equipo con texto que no es un id no llega al terminal', async () => {
|
|
368
|
+
const w = await start()
|
|
369
|
+
const hostile = [
|
|
370
|
+
{ coordinator: 'claude', providers: ['claude; rm -rf ~'], cross: 'todas', roles: {}, custom: [] },
|
|
371
|
+
{ coordinator: 'claude', providers: ['claude'], cross: 'todas', roles: { casandra: 'claude && x' }, custom: [] },
|
|
372
|
+
{ coordinator: 'claude', providers: ['claude'], cross: '$(whoami)', roles: {}, custom: [] },
|
|
373
|
+
{ coordinator: 'claude', providers: ['claude'], cross: 'todas', roles: {}, custom: [{ name: 'Ariadna' }] }
|
|
374
|
+
]
|
|
375
|
+
for (const team of hostile) {
|
|
376
|
+
await assert.rejects(
|
|
377
|
+
// Simula lo que un panel podría enviar sin respetar el tipo declarado.
|
|
378
|
+
w.request('team.apply', { team } as unknown as { team: Team }),
|
|
379
|
+
(error: unknown) => (error as { code?: string }).code === 'invalid_params'
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
assert.equal(w.host.callsOf('terminal.create').length, 0)
|
|
383
|
+
})
|
|
384
|
+
|
|
385
|
+
test('orquestar lanza el coordinador con la skill orca, la entrada y la tarea', async () => {
|
|
386
|
+
const w = await start()
|
|
387
|
+
assert.deepEqual(await w.request('team.orchestrate', { agent: 'codex', task: 'Login con Google', source: 'chat' }), {
|
|
388
|
+
message: 'Lanzado codex con la skill orca en el workspace activo.'
|
|
389
|
+
})
|
|
390
|
+
assert.deepEqual(w.host.callsOf('agent.launch'), [
|
|
391
|
+
{ workspaceId: 'w1', agent: 'codex', prompt: orchestratePrompt('Login con Google', 'chat') }
|
|
392
|
+
])
|
|
393
|
+
await w.request('team.orchestrate', { agent: 'claude', task: '', source: 'plan' })
|
|
394
|
+
assert.match((w.host.callsOf('agent.launch')[1] as { prompt: string }).prompt, /plan-file/)
|
|
395
|
+
const bad = [
|
|
396
|
+
{ agent: 'codex', task: ' ', source: 'chat' },
|
|
397
|
+
{ agent: 'x y', task: 'algo', source: 'chat' },
|
|
398
|
+
{ agent: 'codex', task: 'algo', source: 'jira' }
|
|
399
|
+
]
|
|
400
|
+
for (const input of bad) {
|
|
401
|
+
await assert.rejects(
|
|
402
|
+
// Simula lo que un panel podría enviar sin respetar el tipo declarado.
|
|
403
|
+
w.request('team.orchestrate', input as unknown as { agent: string; task: string; source: 'chat' }),
|
|
404
|
+
(error: unknown) => (error as { code?: string }).code === 'invalid_params'
|
|
405
|
+
)
|
|
406
|
+
}
|
|
407
|
+
assert.equal(w.host.callsOf('agent.launch').length, 2)
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
test('un chat de Orca con el workspace en formato repo::ruta sale con su agente y su workspace', async () => {
|
|
411
|
+
const w = await start()
|
|
412
|
+
await w.emit('agent.status.changed', {
|
|
413
|
+
workspaceId: 'repo-1::/repo/app/',
|
|
414
|
+
paneKey: 'structured-agent-session-claude_66ff6cb8:1224b7d3',
|
|
415
|
+
state: 'working',
|
|
416
|
+
receivedAt: 1
|
|
417
|
+
})
|
|
418
|
+
assert.equal(await w.command('agents.status'), '- claude: trabajando (app)')
|
|
419
|
+
const [line] = (await summary(w)).groups[0]?.agents ?? []
|
|
420
|
+
assert.equal(line?.canOpen, true)
|
|
421
|
+
await w.request('agents.open', { id: line?.id ?? '' })
|
|
422
|
+
assert.deepEqual(w.host.callsOf('workspace.open'), [{ workspaceId: 'w1' }])
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
test('las pestañas nuevas responden con su contrato aunque estén vacías', async () => {
|
|
426
|
+
const w = await start()
|
|
427
|
+
assert.deepEqual(await w.request('notices.list'), { items: [] })
|
|
428
|
+
assert.deepEqual(await w.request('worktrees.list'), { groups: [] })
|
|
429
|
+
assert.deepEqual(await w.request('history.list'), { items: [] })
|
|
430
|
+
})
|
|
431
|
+
|
|
432
|
+
test('el hook agent.tool.after solo observa: nunca cambia ni para nada', async () => {
|
|
433
|
+
const w = await start()
|
|
434
|
+
const call = { agent: 'claude', workspaceId: 'w1', terminalId: 't1', tool: 'Write', input: { file_path: 'x' } }
|
|
435
|
+
assert.deepEqual(await w.hooks.fire('agent.tool.after', call), { kind: 'continue', event: call })
|
|
436
|
+
assert.deepEqual(w.logs.filter((line) => line.includes('falló')), [])
|
|
194
437
|
})
|