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
@@ -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: 't1',
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
- workspaceId: 'w1', paneKey: 'p1', terminalId: 't1', title: 'U1 login', state: 'working', receivedAt: 1
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'), '- U1 login: trabajando\n- U2 pagos: bloqueado')
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: {
@@ -153,3 +261,177 @@ test('la barra parte de los agentes que ya existen y se oculta si se desactiva',
153
261
  const hidden = await start({ settings: { statusBar: false } })
154
262
  assert.deepEqual(hidden.host.callsOf('statusBar.update').at(-1), { id: 'agents', visible: false })
155
263
  })
264
+
265
+ test('el panel ejecuta las mismas acciones que la paleta', async () => {
266
+ const w = await start()
267
+ assert.deepEqual(await w.request('kit.run', { action: 'verify' }), {
268
+ message: 'Ejecutando `omk verify` en un terminal nuevo del workspace activo.'
269
+ })
270
+ await w.request('kit.run', { action: 'init' })
271
+ assert.equal(w.host.callsOf('terminal.create').length, 1)
272
+ assert.equal(w.host.callsOf('agent.launch').length, 1)
273
+ })
274
+
275
+ test('el panel no puede pedir una acción fuera de la lista', async () => {
276
+ const w = await start()
277
+ for (const action of ['rm -rf ~', 'verify; omk update', undefined]) {
278
+ await assert.rejects(
279
+ // Simula lo que un panel podría enviar sin respetar el tipo declarado.
280
+ w.request('kit.run', { action } as unknown as { action: 'verify' }),
281
+ (error: unknown) => (error as { code?: string }).code === 'invalid_params'
282
+ )
283
+ }
284
+ assert.equal(w.host.callsOf('terminal.create').length, 0)
285
+ assert.equal(w.host.callsOf('agent.launch').length, 0)
286
+ })
287
+
288
+ test('el panel recibe los agentes y solo los cambios', async () => {
289
+ const w = await start()
290
+ assert.deepEqual(await w.request('agents.summary'), {
291
+ text: 'MAW', tone: 'neutral', tooltip: 'Orca Multiagent Kit: ningún agente activo', groups: []
292
+ })
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' }))
295
+ const changes = w.posts.filter((p) => p.event === 'agents.changed')
296
+ // El arranque envía el estado vacío; el segundo evento no cambia nada y no se reenvía.
297
+ assert.equal(changes.length, 2)
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ó')), [])
437
+ })