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.
- package/AI_INSTALL.md +4 -3
- package/CHANGELOG.md +70 -1
- package/GUIA.html +11 -9
- package/README.md +23 -23
- package/VERSION +1 -1
- package/bin/backup.js +44 -0
- package/bin/fetch.js +243 -0
- package/bin/hooks.js +187 -0
- package/bin/omk.js +134 -51
- package/bin/run/cleanup.js +402 -0
- package/bin/run/git.js +641 -0
- package/bin/run/glob.js +193 -0
- package/bin/run/ledger.js +243 -0
- package/bin/run/plan.js +328 -0
- package/bin/run/units.js +101 -0
- package/bin/run/util.js +116 -0
- package/bin/run.js +224 -0
- package/bin/setup.js +81 -8
- package/bin/sync.js +222 -0
- package/bin/team.js +353 -0
- package/bin/ui.js +8 -4
- package/bin/update.js +169 -0
- package/core/AGENTS.md +7 -7
- package/docs/EJECUTABLE.md +5 -4
- package/docs/MANUAL.md +16 -3
- package/docs/ORQUESTADOR.md +59 -1
- package/docs/PLUGIN-ORCA.md +131 -24
- package/hooks/orca-gate.cjs +402 -0
- package/install.sh +26 -13
- package/orca-plugin/README.md +7 -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 +491 -22
- package/orca-plugin/src/kit.ts +687 -37
- 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 +36 -0
- package/orca-plugin/src/panel.check.ts +71 -0
- package/orca-plugin/src/panel.test.tsx +296 -33
- package/orca-plugin/src/panel.tsx +501 -81
- 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 +205 -5
- package/orca-plugin/src/tabs/autonomy.tsx +72 -0
- package/orca-plugin/src/tabs/history.test.tsx +79 -0
- package/orca-plugin/src/tabs/history.tsx +119 -0
- package/orca-plugin/src/tabs/notices.test.tsx +184 -0
- package/orca-plugin/src/tabs/notices.tsx +274 -0
- package/orca-plugin/src/tabs/worktrees.test.tsx +131 -0
- package/orca-plugin/src/tabs/worktrees.tsx +138 -0
- package/orca-plugin/src/ui/action-card.tsx +112 -0
- package/orca-plugin/src/ui/agent-icon.tsx +13 -0
- package/orca-plugin/src/worker/actions.test.ts +288 -0
- package/orca-plugin/src/worker/actions.ts +292 -0
- package/orca-plugin/src/worker/context.test.ts +32 -0
- package/orca-plugin/src/worker/context.ts +95 -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 +288 -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 +285 -24
- package/orca-plugin/src/worker.ts +344 -64
- package/output-styles/csr-minimal.md +1 -0
- package/package.json +3 -3
- package/rules/50-done-gate.md +1 -1
- package/rules/95-multi-agent.md +13 -3
- package/skills/kit-init/SKILL.md +16 -4
- package/skills/orca/SKILL.md +28 -5
- package/skills/orca/references/adapters/artifact.md +2 -0
- package/skills/orca/references/adapters/chat.md +2 -0
- package/skills/orca/references/adapters/native-plan.md +6 -0
- package/skills/orca/references/adapters/plan-file.md +2 -0
- package/skills/orca/references/engine-manual.md +7 -5
- package/skills/orca/references/engine-orca.md +1 -0
- package/skills/orca/references/engine-subagents.md +4 -4
- package/skills/orca/references/integrate.md +14 -2
- package/skills/orca/references/ledger.md +1 -1
- package/skills/orca/references/olimpo.md +2 -1
- package/skills/orca/references/plan-card.md +45 -0
- package/skills/orca/references/plan.md +2 -1
- package/skills/orca/references/units.md +1 -1
- package/skills/orca/references/worker-contract.md +2 -2
- package/templates/AGENTS.md +2 -2
- package/templates/CLAUDE.md +1 -1
- package/templates/claude-settings.json +25 -0
|
@@ -1,15 +1,54 @@
|
|
|
1
1
|
import { assert, describe, test } from 'orca/testing'
|
|
2
2
|
import {
|
|
3
3
|
CONTRACT_HINT,
|
|
4
|
+
ORCHESTRATE_HINT,
|
|
5
|
+
TASK_MAX,
|
|
6
|
+
TEAM_PRESETS,
|
|
7
|
+
TEAM_ROLES,
|
|
8
|
+
agentFromPaneKey,
|
|
9
|
+
agentLabel,
|
|
10
|
+
agentOptions,
|
|
11
|
+
agentName,
|
|
12
|
+
canonicalWorkspaceId,
|
|
13
|
+
blockedNotice,
|
|
14
|
+
cellText,
|
|
15
|
+
cleanLabel,
|
|
4
16
|
describeAgents,
|
|
17
|
+
draftFromPreset,
|
|
18
|
+
emptyCustomRole,
|
|
19
|
+
encodeTeam,
|
|
20
|
+
forgetRunUnit,
|
|
21
|
+
groupAgents,
|
|
22
|
+
indexWorkspaces,
|
|
5
23
|
isKitDispatch,
|
|
6
24
|
isMissingCommand,
|
|
7
25
|
isValidAgentId,
|
|
26
|
+
isValidRoleName,
|
|
27
|
+
normalizeDraft,
|
|
28
|
+
normalizePath,
|
|
29
|
+
orchestratePrompt,
|
|
30
|
+
AUTONOMY_LEVELS,
|
|
31
|
+
autonomyCommand,
|
|
32
|
+
isAutonomy,
|
|
8
33
|
parseContractHintMode,
|
|
9
|
-
|
|
34
|
+
parseDispatch,
|
|
35
|
+
parseTeam,
|
|
36
|
+
OUTPUT_LINE_MAX,
|
|
37
|
+
exitCodeOf,
|
|
38
|
+
isYesNoPrompt,
|
|
39
|
+
lacksExitMarker,
|
|
40
|
+
outputLines,
|
|
10
41
|
resolveFocusedWorkspaceId,
|
|
11
42
|
summarizeAgents,
|
|
12
|
-
|
|
43
|
+
teamCommand,
|
|
44
|
+
teamFromDraft,
|
|
45
|
+
trackRun,
|
|
46
|
+
withContractHint,
|
|
47
|
+
withOrchestrateHint,
|
|
48
|
+
type CustomRole,
|
|
49
|
+
type RunProgress,
|
|
50
|
+
type Team,
|
|
51
|
+
type TrackedAgent
|
|
13
52
|
} from './kit.ts'
|
|
14
53
|
|
|
15
54
|
const KIT_SPEC = 'UNIT: U2 — Endpoint POST /recargas RUN: 20261107-recargas BASE: abc123\n...'
|
|
@@ -60,6 +99,40 @@ describe('withContractHint', () => {
|
|
|
60
99
|
})
|
|
61
100
|
})
|
|
62
101
|
|
|
102
|
+
describe('withOrchestrateHint', () => {
|
|
103
|
+
const task = 'Añade login con Google y su pantalla de ajustes'
|
|
104
|
+
|
|
105
|
+
test('un prompt de arranque pasa primero por la skill orca, sin spec-kit', () => {
|
|
106
|
+
assert.equal(withOrchestrateHint(task, 'launch', true), `${task}\n\n${ORCHESTRATE_HINT}`)
|
|
107
|
+
assert.match(ORCHESTRATE_HINT, /no hace falta spec-kit/)
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
test('nunca toca despachos, lo que escribe una persona ni nada con el ajuste apagado', () => {
|
|
111
|
+
assert.equal(withOrchestrateHint(task, 'orchestration', true), null)
|
|
112
|
+
assert.equal(withOrchestrateHint(task, 'driving', true), null)
|
|
113
|
+
assert.equal(withOrchestrateHint(task, 'launch', false), null)
|
|
114
|
+
assert.equal(withOrchestrateHint(' ', 'launch', true), null)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
test('no repite lo que ya va por la skill orca ni toca kit-init ni un despacho del kit', () => {
|
|
118
|
+
for (const prompt of [
|
|
119
|
+
'Usa la skill orca para repartir esta tarea entre agentes.\n\nLogin',
|
|
120
|
+
'usa la skill `orca` con el plan',
|
|
121
|
+
'inicializa el proyecto',
|
|
122
|
+
'Ejecuta kit-init',
|
|
123
|
+
'UNIT: U1 — Login RUN: r1 BASE: abc',
|
|
124
|
+
withOrchestrateHint(task, 'launch', true) ?? ''
|
|
125
|
+
]) {
|
|
126
|
+
assert.equal(withOrchestrateHint(prompt, 'launch', true), null, prompt)
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
test('mencionar otras skills con «orca» en el nombre no cuenta', () => {
|
|
131
|
+
assert.ok(withOrchestrateHint('Con la skill orca-cli abre un terminal', 'launch', true))
|
|
132
|
+
assert.ok(withOrchestrateHint('inicializa el proyecto y añade tests', 'launch', true))
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
|
|
63
136
|
describe('parseContractHintMode', () => {
|
|
64
137
|
test('acepta los tres modos y vuelve a kit ante cualquier otra cosa', () => {
|
|
65
138
|
assert.equal(parseContractHintMode('all'), 'all')
|
|
@@ -131,6 +204,175 @@ describe('isValidAgentId', () => {
|
|
|
131
204
|
})
|
|
132
205
|
})
|
|
133
206
|
|
|
207
|
+
const DISPATCH = [
|
|
208
|
+
'UNIT: U2 — Recarga con tarjeta RUN: 20261107-recargas BASE: 5d6e7f8 PUERTO DEV: 3102',
|
|
209
|
+
'ROL: Ariadna · código sensible · nivel alto — tests de casos límite antes que el código',
|
|
210
|
+
'### UNIT: U2 — Recarga con tarjeta'
|
|
211
|
+
].join('\n')
|
|
212
|
+
|
|
213
|
+
describe('parseDispatch', () => {
|
|
214
|
+
test('saca unidad, título, run y rol del despacho de la skill orca', () => {
|
|
215
|
+
assert.deepEqual(parseDispatch(DISPATCH), {
|
|
216
|
+
unit: 'U2',
|
|
217
|
+
title: 'Recarga con tarjeta',
|
|
218
|
+
run: '20261107-recargas',
|
|
219
|
+
role: 'Ariadna'
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
test('sin línea ROL ni título sigue sirviendo', () => {
|
|
224
|
+
assert.deepEqual(parseDispatch('UNIT: U7 RUN: r1 BASE: abc'), {
|
|
225
|
+
unit: 'U7', title: null, run: 'r1', role: null
|
|
226
|
+
})
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
test('acepta roles con tilde y RUN en otra línea', () => {
|
|
230
|
+
const info = parseDispatch('UNIT: U3 — Índices\nRUN: r9\nROL: Clío · mecánico · nivel bajo')
|
|
231
|
+
assert.equal(info?.role, 'Clío')
|
|
232
|
+
assert.equal(info?.run, 'r9')
|
|
233
|
+
assert.equal(info?.title, 'Índices')
|
|
234
|
+
})
|
|
235
|
+
|
|
236
|
+
test('no es un despacho del kit sin UNIT al principio de línea o sin RUN', () => {
|
|
237
|
+
assert.equal(parseDispatch('Revisa el PR 42'), null)
|
|
238
|
+
assert.equal(parseDispatch('UNIT: U2 — sin run'), null)
|
|
239
|
+
assert.equal(parseDispatch('la UNIT: U2 va en mitad RUN: x'), null)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
test('limpia caracteres de control y acota el título', () => {
|
|
243
|
+
const info = parseDispatch(`UNIT: U1 — Pagos\u001b[31m ${'x'.repeat(200)} RUN: r1`)
|
|
244
|
+
assert.ok(info?.title)
|
|
245
|
+
assert.equal(/[\u001b]/.test(info?.title ?? ''), false)
|
|
246
|
+
assert.ok((info?.title ?? '').length <= 80)
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
describe('cleanLabel', () => {
|
|
251
|
+
test('una línea, sin control y acotada', () => {
|
|
252
|
+
assert.equal(cleanLabel(' hola\n\tmundo '), 'hola mundo')
|
|
253
|
+
assert.equal(cleanLabel('\u0007'), null)
|
|
254
|
+
assert.equal(cleanLabel('abcdef', 4), 'abc…')
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
describe('workspaces', () => {
|
|
259
|
+
const index = indexWorkspaces([
|
|
260
|
+
{ id: 'identity:wt2:local:1', name: 'Palolo', path: 'C:\\Users\\ruben\\palolo' },
|
|
261
|
+
{ id: 'w2', name: 'app', path: '/repo/app' }
|
|
262
|
+
])
|
|
263
|
+
|
|
264
|
+
test('normalizePath iguala barras, barra final y mayúsculas de una unidad de Windows', () => {
|
|
265
|
+
assert.equal(normalizePath('C:\\Users\\X\\'), 'c:/users/x')
|
|
266
|
+
assert.equal(normalizePath('/Repo/App/'), '/Repo/App')
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
test('canonicalWorkspaceId cruza el formato repo::ruta con el id de la lista', () => {
|
|
270
|
+
assert.equal(canonicalWorkspaceId('repo::C:/Users/ruben/palolo', index), 'identity:wt2:local:1')
|
|
271
|
+
assert.equal(canonicalWorkspaceId('w2', index), 'w2')
|
|
272
|
+
assert.equal(canonicalWorkspaceId('repo::/otra', index), 'repo::/otra')
|
|
273
|
+
assert.equal(canonicalWorkspaceId('suelto', index), 'suelto')
|
|
274
|
+
assert.deepEqual(index.byId.get('identity:wt2:local:1'), {
|
|
275
|
+
name: 'Palolo', path: 'C:\\Users\\ruben\\palolo', branch: null, kind: null
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
test('la rama pierde refs/heads/', () => {
|
|
280
|
+
const withBranch = indexWorkspaces([{ id: 'w', name: 'w', path: '/w', branch: 'refs/heads/feat/x', kind: 'worktree' }])
|
|
281
|
+
assert.equal(withBranch.byId.get('w')?.branch, 'feat/x')
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
test('agentFromPaneKey reconoce los chats de agente de Orca', () => {
|
|
285
|
+
assert.equal(agentFromPaneKey('structured-agent-session-claude_66ff6cb8_21b6:1224'), 'claude')
|
|
286
|
+
assert.equal(agentFromPaneKey('structured-agent-session-cursor-agent_1:2'), 'cursor-agent')
|
|
287
|
+
assert.equal(agentFromPaneKey('pane-7'), null)
|
|
288
|
+
})
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
describe('agentName', () => {
|
|
292
|
+
const base: TrackedAgent = { workspaceId: null, title: null, state: 'working' }
|
|
293
|
+
|
|
294
|
+
test('la unidad del kit gana al título de Orca', () => {
|
|
295
|
+
const unit = { unit: 'U2', title: 'Pagos', run: 'r1', role: 'Ariadna' }
|
|
296
|
+
assert.equal(agentName({ ...base, title: 'claude', unit }), 'U2 · Ariadna — Pagos')
|
|
297
|
+
assert.equal(agentName({ ...base, unit: { ...unit, role: null, title: null } }), 'U2')
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
test('sin unidad: el título de Orca, luego el id del agente', () => {
|
|
301
|
+
assert.equal(agentName({ ...base, title: 'Arreglar login', agent: 'codex' }), 'Arreglar login')
|
|
302
|
+
assert.equal(agentName({ ...base, agent: 'codex' }), 'codex')
|
|
303
|
+
assert.equal(agentName(base), 'agente sin título')
|
|
304
|
+
})
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
describe('groupAgents', () => {
|
|
308
|
+
const info = (name: string, branch: string | null = null) => ({ name, path: `/repo/${name}`, branch, kind: 'worktree' })
|
|
309
|
+
const workspaces = new Map([['w1', info('palolo', 'main')], ['w2', info('u2-pagos', 'feat/u2')]])
|
|
310
|
+
const unit = (id: string, title: string) => ({ unit: id, title, run: 'r1', role: 'Proteo' })
|
|
311
|
+
|
|
312
|
+
test('agrupa por run del kit o por workspace y pone primero lo bloqueado', () => {
|
|
313
|
+
const groups = groupAgents(
|
|
314
|
+
[
|
|
315
|
+
['t:1', { workspaceId: 'w1', title: null, state: 'working', agent: 'claude', since: 5 }],
|
|
316
|
+
['t:2', { workspaceId: 'w2', title: null, state: 'blocked', agent: 'codex', unit: unit('U2', 'Pagos') }],
|
|
317
|
+
['t:3', { workspaceId: 'w2', title: null, state: 'working', agent: 'claude', unit: unit('U1', 'Login') }],
|
|
318
|
+
['t:4', { workspaceId: null, title: 'suelto', state: 'waiting' }],
|
|
319
|
+
['t:5', { workspaceId: 'w1', title: null, state: 'done' }]
|
|
320
|
+
],
|
|
321
|
+
workspaces
|
|
322
|
+
)
|
|
323
|
+
assert.deepEqual(
|
|
324
|
+
groups.map((g) => [g.title, g.agents.map((a) => a.title)]),
|
|
325
|
+
[
|
|
326
|
+
['RUN r1', ['U2 · Proteo — Pagos', 'U1 · Proteo — Login']],
|
|
327
|
+
['Sin workspace', ['suelto']],
|
|
328
|
+
['palolo', ['claude']]
|
|
329
|
+
]
|
|
330
|
+
)
|
|
331
|
+
const [blocked] = groups[0]?.agents ?? []
|
|
332
|
+
assert.equal(blocked?.detail, 'codex · u2-pagos')
|
|
333
|
+
assert.equal(blocked?.blocked, true)
|
|
334
|
+
assert.equal(blocked?.canOpen, true)
|
|
335
|
+
// El id del agente no se repite en el detalle cuando ya es su nombre.
|
|
336
|
+
assert.equal(groups[2]?.agents[0]?.detail, 'palolo')
|
|
337
|
+
assert.equal(groups[2]?.agents[0]?.since, 5)
|
|
338
|
+
assert.equal(groups[1]?.agents[0]?.canOpen, false)
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
test('la ficha junta todo lo que se sabe del agente', () => {
|
|
342
|
+
const [group] = groupAgents(
|
|
343
|
+
[
|
|
344
|
+
['t:2', {
|
|
345
|
+
workspaceId: 'w2', title: 'Implementando pagos', state: 'blocked', agent: 'codex',
|
|
346
|
+
unit: { unit: 'U2', title: 'Pagos', run: 'r1', role: 'Ariadna' }, terminalId: 't2', outcome: 'failure'
|
|
347
|
+
}]
|
|
348
|
+
],
|
|
349
|
+
workspaces
|
|
350
|
+
)
|
|
351
|
+
assert.deepEqual(group?.agents[0]?.facts, [
|
|
352
|
+
{ label: 'Agente', value: 'Codex' },
|
|
353
|
+
{ label: 'Unidad', value: 'U2 — Pagos' },
|
|
354
|
+
{ label: 'Rol', value: 'Ariadna · nivel alto' },
|
|
355
|
+
{ label: 'Run', value: 'r1' },
|
|
356
|
+
{ label: 'Título en Orca', value: 'Implementando pagos' },
|
|
357
|
+
{ label: 'Workspace', value: 'u2-pagos' },
|
|
358
|
+
{ label: 'Rama', value: 'feat/u2' },
|
|
359
|
+
{ label: 'Carpeta', value: '/repo/u2-pagos' },
|
|
360
|
+
{ label: 'Dónde corre', value: 'terminal t2' },
|
|
361
|
+
{ label: 'Último turno', value: 'falló' }
|
|
362
|
+
])
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
test('un chat de Orca lo dice y la ficha no inventa lo que no sabe', () => {
|
|
366
|
+
const [group] = groupAgents([['p:x', { workspaceId: null, title: null, state: 'working', terminalId: null }]], workspaces)
|
|
367
|
+
assert.deepEqual(group?.agents[0]?.facts, [{ label: 'Dónde corre', value: 'chat de Orca' }])
|
|
368
|
+
})
|
|
369
|
+
|
|
370
|
+
test('un workspace aún sin nombre no se confunde con ninguno', () => {
|
|
371
|
+
const groups = groupAgents([['t:1', { workspaceId: 'w9', title: 'x', state: 'working' }]], workspaces)
|
|
372
|
+
assert.equal(groups[0]?.title, 'Workspace sin nombre')
|
|
373
|
+
})
|
|
374
|
+
})
|
|
375
|
+
|
|
134
376
|
describe('summarizeAgents', () => {
|
|
135
377
|
test('sin agentes activos', () => {
|
|
136
378
|
const summary = summarizeAgents([{ workspaceId: null, title: 'x', state: 'done' }])
|
|
@@ -150,36 +392,263 @@ describe('summarizeAgents', () => {
|
|
|
150
392
|
test('solo trabajando es accent', () => {
|
|
151
393
|
assert.equal(summarizeAgents([{ workspaceId: null, title: null, state: 'working' }]).tone, 'accent')
|
|
152
394
|
})
|
|
395
|
+
|
|
396
|
+
test('el tooltip nombra a los agentes, como mucho seis', () => {
|
|
397
|
+
const agents: [string, TrackedAgent][] = Array.from({ length: 8 }, (_, i) => [
|
|
398
|
+
`t:${i}`,
|
|
399
|
+
{ workspaceId: null, title: `A${i}`, state: 'working' }
|
|
400
|
+
])
|
|
401
|
+
const tooltip = summarizeAgents(agents.map(([, a]) => a), groupAgents(agents, new Map())).tooltip.split('\n')
|
|
402
|
+
assert.equal(tooltip[0], 'Orca Multiagent Kit: 8 trabajando en todos los workspaces')
|
|
403
|
+
assert.equal(tooltip[1], 'A0: trabajando')
|
|
404
|
+
assert.equal(tooltip.length, 8)
|
|
405
|
+
assert.equal(tooltip.at(-1), '… y 2 más')
|
|
406
|
+
})
|
|
153
407
|
})
|
|
154
408
|
|
|
155
409
|
describe('describeAgents', () => {
|
|
156
|
-
test('una línea por agente activo', () => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
{ workspaceId: null, title: 'U1 login', state: 'waiting' },
|
|
160
|
-
{ workspaceId:
|
|
161
|
-
{ workspaceId: null, title: 'viejo', state: 'done' }
|
|
162
|
-
]
|
|
163
|
-
'
|
|
410
|
+
test('una línea por agente activo, con agente y workspace si se saben', () => {
|
|
411
|
+
const groups = groupAgents(
|
|
412
|
+
[
|
|
413
|
+
['t:1', { workspaceId: null, title: 'U1 login', state: 'waiting' }],
|
|
414
|
+
['t:2', { workspaceId: 'w1', title: null, state: 'blocked', agent: 'codex' }],
|
|
415
|
+
['t:3', { workspaceId: null, title: 'viejo', state: 'done' }]
|
|
416
|
+
],
|
|
417
|
+
new Map([['w1', { name: 'app', path: '/app', branch: null, kind: null }]])
|
|
164
418
|
)
|
|
419
|
+
assert.equal(describeAgents(groups), '- codex: bloqueado (app)\n- U1 login: esperando')
|
|
165
420
|
assert.equal(describeAgents([]), 'Ningún agente activo.')
|
|
166
421
|
})
|
|
167
422
|
})
|
|
168
423
|
|
|
169
|
-
describe('
|
|
170
|
-
const
|
|
424
|
+
describe('blockedNotice', () => {
|
|
425
|
+
const blocked: TrackedAgent = { workspaceId: 'w1', title: 'U1 login', state: 'blocked' }
|
|
426
|
+
|
|
427
|
+
test('avisa solo al pasar a bloqueado', () => {
|
|
428
|
+
assert.deepEqual(blockedNotice('working', blocked, 'app'), {
|
|
429
|
+
title: 'U1 login: bloqueado',
|
|
430
|
+
body: 'En app. Necesita tu respuesta en Orca.'
|
|
431
|
+
})
|
|
432
|
+
assert.equal(blockedNotice(undefined, blocked, null)?.body, 'Necesita tu respuesta en Orca.')
|
|
433
|
+
assert.equal(blockedNotice('blocked', blocked, 'app'), null)
|
|
434
|
+
assert.equal(blockedNotice('blocked', { ...blocked, state: 'working' }, 'app'), null)
|
|
435
|
+
})
|
|
436
|
+
})
|
|
171
437
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
assert.equal(
|
|
176
|
-
assert.equal(
|
|
438
|
+
describe('trackRun', () => {
|
|
439
|
+
test('avisa una vez cuando terminan todas las unidades lanzadas, y vuelve a contar', () => {
|
|
440
|
+
const runs: RunProgress = new Map()
|
|
441
|
+
assert.equal(trackRun(runs, 'r1', 't:1', 'working'), null)
|
|
442
|
+
assert.equal(trackRun(runs, 'r1', 't:2', 'working'), null)
|
|
443
|
+
assert.equal(trackRun(runs, 'r1', 't:1', 'done'), null)
|
|
444
|
+
assert.equal(trackRun(runs, 'r1', 't:1', 'done'), null)
|
|
445
|
+
assert.deepEqual(trackRun(runs, 'r1', 't:2', 'done'), {
|
|
446
|
+
title: 'RUN r1: unidades terminadas',
|
|
447
|
+
body: 'Las 2 unidades lanzadas han terminado. Vuelve al coordinador para revisar e integrar.'
|
|
448
|
+
})
|
|
449
|
+
assert.equal(runs.size, 0)
|
|
450
|
+
trackRun(runs, 'r1', 't:3', 'blocked')
|
|
451
|
+
assert.match(trackRun(runs, 'r1', 't:3', 'done')?.body ?? '', /^La unidad lanzada ha terminado/)
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
test('un done de una unidad que no se vio activa no avisa ni deja rastro', () => {
|
|
455
|
+
const runs: RunProgress = new Map()
|
|
456
|
+
assert.equal(trackRun(runs, 'r1', 't:1', 'done'), null)
|
|
457
|
+
assert.equal(runs.size, 0)
|
|
458
|
+
})
|
|
459
|
+
|
|
460
|
+
test('olvidar una unidad no avisa', () => {
|
|
461
|
+
const runs: RunProgress = new Map()
|
|
462
|
+
trackRun(runs, 'r1', 't:1', 'working')
|
|
463
|
+
forgetRunUnit(runs, 't:1')
|
|
464
|
+
assert.equal(runs.size, 0)
|
|
465
|
+
})
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
describe('agentes conocidos', () => {
|
|
469
|
+
test('los desplegables ofrecen el catálogo y conservan un valor que no está en él', () => {
|
|
470
|
+
const ids = agentOptions().map(({ value }) => value)
|
|
471
|
+
assert.ok(ids.includes('claude') && ids.includes('codex'))
|
|
472
|
+
assert.ok(ids.every(isValidAgentId))
|
|
473
|
+
assert.equal(agentOptions(['mi-agente']).at(-1)?.value, 'mi-agente')
|
|
474
|
+
assert.equal(agentOptions(['rm -rf']).length, ids.length)
|
|
475
|
+
assert.equal(agentLabel('claude'), 'Claude Code')
|
|
476
|
+
assert.equal(agentLabel('mi-agente'), 'mi-agente')
|
|
477
|
+
})
|
|
478
|
+
})
|
|
479
|
+
|
|
480
|
+
describe('equipo', () => {
|
|
481
|
+
const hermes: CustomRole = { name: 'Hermes', work: 'Traducciones', level: 'bajo', review: 'argos', guard: '', provider: 'codex' }
|
|
482
|
+
const base = { coordinator: 'claude', providers: ['claude', 'codex'], cross: 'todas', roles: { casandra: 'codex' }, custom: [] }
|
|
483
|
+
|
|
484
|
+
test('los roles son los de Olimpo menos Hefesto, con ids ASCII', () => {
|
|
485
|
+
assert.equal(TEAM_ROLES.length, 11)
|
|
486
|
+
assert.ok(TEAM_ROLES.every(({ id }) => /^[a-z]+$/.test(id)))
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
test('parseTeam valida el equipo entero', () => {
|
|
490
|
+
assert.deepEqual(parseTeam(base), base)
|
|
491
|
+
assert.equal(parseTeam({ ...base, roles: { casandra: 'gemini' } }), null)
|
|
492
|
+
assert.equal(parseTeam({ ...base, roles: { hefesto: 'claude' } }), null)
|
|
493
|
+
assert.equal(parseTeam({ ...base, cross: 'a veces' }), null)
|
|
494
|
+
assert.equal(parseTeam({ ...base, providers: ['claude', 'claude'] }), null)
|
|
495
|
+
assert.equal(parseTeam({ ...base, providers: [] }), null)
|
|
496
|
+
assert.equal(parseTeam({ ...base, coordinator: 'x y' }), null)
|
|
497
|
+
assert.equal(parseTeam({ ...base, roles: ['codex'] }), null)
|
|
498
|
+
assert.equal(parseTeam({ ...base, custom: undefined }), null)
|
|
499
|
+
assert.equal(parseTeam(null), null)
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
test('los roles propios se validan y su texto se limpia para la tabla', () => {
|
|
503
|
+
const team = parseTeam({ ...base, custom: [{ ...hermes, work: ' Textos | <b>UI</b> ', guard: 'sin\nsaltos' }] })
|
|
504
|
+
assert.deepEqual(team?.custom, [{ ...hermes, work: 'Textos b UI /b', guard: 'sin saltos' }])
|
|
505
|
+
for (const bad of [
|
|
506
|
+
{ ...hermes, name: 'Ariadna' },
|
|
507
|
+
{ ...hermes, name: 'hefesto' },
|
|
508
|
+
{ ...hermes, name: '' },
|
|
509
|
+
{ ...hermes, name: 'Rol; rm -rf' },
|
|
510
|
+
{ ...hermes, work: ' ' },
|
|
511
|
+
{ ...hermes, level: 'máximo' },
|
|
512
|
+
{ ...hermes, review: 'nadie' },
|
|
513
|
+
{ ...hermes, provider: 'gemini' }
|
|
514
|
+
]) {
|
|
515
|
+
assert.equal(parseTeam({ ...base, custom: [bad] }), null, JSON.stringify(bad))
|
|
516
|
+
}
|
|
517
|
+
assert.equal(parseTeam({ ...base, custom: [hermes, { ...hermes, name: 'hermes' }] }), null)
|
|
518
|
+
assert.equal(parseTeam({ ...base, custom: Array.from({ length: 11 }, (_, i) => ({ ...hermes, name: `Rol ${i}` })) }), null)
|
|
519
|
+
})
|
|
520
|
+
|
|
521
|
+
test('isValidRoleName y cellText', () => {
|
|
522
|
+
assert.equal(isValidRoleName('Hermes'), true)
|
|
523
|
+
assert.equal(isValidRoleName('Iris 2'), true)
|
|
524
|
+
assert.equal(isValidRoleName('Clío'), false)
|
|
525
|
+
assert.equal(isValidRoleName('Hermes', ['hermes']), false)
|
|
526
|
+
assert.equal(cellText('a | b > c', 80), 'a b c')
|
|
527
|
+
assert.equal(cellText(' ', 80), null)
|
|
528
|
+
})
|
|
529
|
+
|
|
530
|
+
test('teamCommand manda el equipo en base64url, sin nada que un shell interprete', () => {
|
|
531
|
+
const team = parseTeam({ ...base, custom: [{ ...hermes, work: 'Textos y "comillas" $(x) `y`' }] }) as Team
|
|
532
|
+
const command = teamCommand(team)
|
|
533
|
+
assert.match(command ?? '', /^omk team set --data [A-Za-z0-9_-]+$/)
|
|
534
|
+
const encoded = encodeTeam(team).replace(/-/g, '+').replace(/_/g, '/')
|
|
535
|
+
const bytes = Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0))
|
|
536
|
+
assert.deepEqual(JSON.parse(new TextDecoder().decode(bytes)), {
|
|
537
|
+
v: 1, providers: team.providers, cross: team.cross, roles: team.roles, custom: team.custom
|
|
538
|
+
})
|
|
177
539
|
})
|
|
178
540
|
|
|
179
|
-
test('se
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
assert.
|
|
541
|
+
test('teamCommand se niega si la orden no cabe en un terminal', () => {
|
|
542
|
+
// «€» ocupa tres bytes: diez roles propios con los textos al máximo no caben en cmd.exe.
|
|
543
|
+
const custom = Array.from({ length: 10 }, (_, i) => ({ ...hermes, name: `Rol ${i}`, work: '€'.repeat(80), guard: '€'.repeat(120) }))
|
|
544
|
+
const team = parseTeam({ ...base, roles: TEAM_PRESETS['claude-codex'].team.roles, custom }) as Team
|
|
545
|
+
assert.ok(team)
|
|
546
|
+
assert.equal(teamCommand(team), null)
|
|
547
|
+
assert.ok(teamCommand({ ...team, custom: team.custom.slice(0, 2) }))
|
|
548
|
+
})
|
|
549
|
+
|
|
550
|
+
test('los equipos predefinidos son válidos y Casandra revisa con el otro proveedor', () => {
|
|
551
|
+
for (const id of Object.keys(TEAM_PRESETS) as (keyof typeof TEAM_PRESETS)[]) {
|
|
552
|
+
assert.ok(teamFromDraft(draftFromPreset(id)), id)
|
|
553
|
+
}
|
|
554
|
+
assert.equal(TEAM_PRESETS['claude-codex'].team.roles.casandra, 'codex')
|
|
555
|
+
assert.equal(TEAM_PRESETS['claude-codex'].team.roles.proteo, 'claude')
|
|
556
|
+
assert.deepEqual(draftFromPreset('claude').providers, ['claude'])
|
|
557
|
+
})
|
|
558
|
+
|
|
559
|
+
test('teamFromDraft suelta los proveedores que ya no están activos', () => {
|
|
560
|
+
const draft = { ...draftFromPreset('claude-codex'), providers: ['claude'], custom: [{ ...hermes }] }
|
|
561
|
+
const team = teamFromDraft(draft)
|
|
562
|
+
assert.deepEqual(team?.providers, ['claude'])
|
|
563
|
+
assert.equal(team?.roles.casandra, undefined)
|
|
564
|
+
assert.equal(team?.roles.proteo, 'claude')
|
|
565
|
+
assert.equal(team?.custom[0]?.provider, null)
|
|
566
|
+
assert.equal(teamFromDraft({ ...draft, custom: [emptyCustomRole()] }), null)
|
|
567
|
+
})
|
|
568
|
+
|
|
569
|
+
test('normalizeDraft lee borradores antiguos o dañados', () => {
|
|
570
|
+
const old = normalizeDraft({ preset: 'custom', coordinator: 'codex', providers: 'claude, codex', cross: 'todas', roles: { argos: 'codex' } })
|
|
571
|
+
assert.deepEqual(old.providers, ['claude', 'codex'])
|
|
572
|
+
assert.equal(old.coordinator, 'codex')
|
|
573
|
+
assert.equal(old.roles.argos, 'codex')
|
|
574
|
+
assert.deepEqual(old.custom, [])
|
|
575
|
+
assert.deepEqual(normalizeDraft(42), draftFromPreset('claude'))
|
|
576
|
+
const broken = normalizeDraft({ providers: 'x;y', roles: { argos: 'gemini', hefesto: 'claude' } })
|
|
577
|
+
assert.deepEqual([broken.providers, broken.roles], [['claude'], {}])
|
|
578
|
+
})
|
|
579
|
+
})
|
|
580
|
+
|
|
581
|
+
describe('orchestratePrompt', () => {
|
|
582
|
+
test('desde el chat pide la skill orca con la tarea limpia y sin spec-kit', () => {
|
|
583
|
+
const prompt = orchestratePrompt(' Login con Google\r\ny ajustes\u0007 ')
|
|
584
|
+
assert.match(prompt ?? '', /^Usa la skill orca/)
|
|
585
|
+
assert.match(prompt ?? '', /no hace falta spec-kit/)
|
|
586
|
+
assert.ok(prompt?.endsWith('\n\nLogin con Google\ny ajustes'))
|
|
587
|
+
})
|
|
588
|
+
|
|
589
|
+
test('con un plan o spec-kit la indicación es opcional', () => {
|
|
590
|
+
assert.match(orchestratePrompt('', 'plan') ?? '', /plan-file\): no hace falta spec-kit\.$/)
|
|
591
|
+
assert.match(orchestratePrompt('003-recargas', 'speckit') ?? '', /adaptador speckit\)\.\n\nIndicaciones: 003-recargas$/)
|
|
592
|
+
})
|
|
593
|
+
|
|
594
|
+
test('rechaza vacía en el chat, demasiado larga, entrada desconocida o que no es texto', () => {
|
|
595
|
+
assert.equal(orchestratePrompt(' '), null)
|
|
596
|
+
assert.equal(orchestratePrompt('x'.repeat(TASK_MAX + 1), 'plan'), null)
|
|
597
|
+
assert.equal(orchestratePrompt('algo', 'jira'), null)
|
|
598
|
+
assert.equal(orchestratePrompt(42), null)
|
|
599
|
+
})
|
|
600
|
+
|
|
601
|
+
test('una autonomía para el run se dice en el prompt; sin ella manda ORCHESTRATION.md', () => {
|
|
602
|
+
assert.match(orchestratePrompt('Login', 'chat', 'auto') ?? '', /Autonomía de este run: auto \(manda sobre ORCHESTRATION\.md §0 solo en este run\)\.\n\nLogin$/)
|
|
603
|
+
assert.ok(!/Autonomía/.test(orchestratePrompt('Login', 'chat', null) ?? ''))
|
|
604
|
+
assert.ok(!/Autonomía/.test(orchestratePrompt('Login') ?? ''))
|
|
605
|
+
assert.equal(orchestratePrompt('Login', 'chat', 'total'), null)
|
|
606
|
+
assert.equal(orchestratePrompt('Login', 'chat', 'auto; rm -rf ~'), null)
|
|
607
|
+
})
|
|
608
|
+
})
|
|
609
|
+
|
|
610
|
+
describe('autonomía', () => {
|
|
611
|
+
test('solo los tres niveles, y cada uno con su orden literal', () => {
|
|
612
|
+
assert.deepEqual(AUTONOMY_LEVELS.map(({ id }) => id), ['manual', 'semi', 'auto'])
|
|
613
|
+
assert.equal(isAutonomy('semi'), true)
|
|
614
|
+
assert.equal(isAutonomy('Semi'), false)
|
|
615
|
+
assert.equal(isAutonomy(undefined), false)
|
|
616
|
+
assert.equal(autonomyCommand('manual'), 'omk team set --autonomy manual')
|
|
617
|
+
})
|
|
618
|
+
})
|
|
619
|
+
|
|
620
|
+
describe('salida de un comando omk en su terminal', () => {
|
|
621
|
+
test('la línea de cierre da el código de salida; sin ella, nada', () => {
|
|
622
|
+
assert.equal(exitCodeOf(['PS C:\\repo> omk verify --exit-marker', ' ✓ Todo correcto', '', '[omk:fin] verify salida=0']), 0)
|
|
623
|
+
assert.equal(exitCodeOf(['[omk:fin] update salida=1', 'PS C:\\repo>']), 1)
|
|
624
|
+
assert.equal(exitCodeOf(['\u001b[32m[omk:fin] team salida=2\u001b[0m']), 2)
|
|
625
|
+
// La orden tecleada lleva la opción, no la línea de cierre.
|
|
626
|
+
assert.equal(exitCodeOf(['$ omk update --exit-marker', ' ✓ Fuente única en ~/.agents']), null)
|
|
627
|
+
assert.equal(exitCodeOf(['[omk:fin] update salida=', '[omk:fin] salida=0', '[omk:fin] update salida=1234']), null)
|
|
628
|
+
assert.equal(exitCodeOf([]), null)
|
|
629
|
+
})
|
|
630
|
+
|
|
631
|
+
test('reconoce un omk anterior a la línea de cierre', () => {
|
|
632
|
+
assert.equal(lacksExitMarker([' Opcion desconocida: --exit-marker']), true)
|
|
633
|
+
assert.equal(lacksExitMarker(['omk team: opción desconocida para omk team: --exit-marker']), true)
|
|
634
|
+
assert.equal(lacksExitMarker(['omk: comando desconocido: --exit-marker']), true)
|
|
635
|
+
assert.equal(lacksExitMarker(['$ omk verify --exit-marker', ' ✓ núcleo en ~/.agents/AGENTS.md']), false)
|
|
636
|
+
})
|
|
637
|
+
|
|
638
|
+
test('una pregunta de sí o no solo cuenta si es lo último', () => {
|
|
639
|
+
assert.equal(isYesNoPrompt([' Orca pide tu aprobación', ' › ¿Apruebas este acceso? [s/N] ', '']), true)
|
|
640
|
+
assert.equal(isYesNoPrompt([' › ¿Apruebas este acceso? [s/N] s', ' ✓ Plugin instalado']), false)
|
|
641
|
+
assert.equal(isYesNoPrompt([]), false)
|
|
642
|
+
})
|
|
643
|
+
|
|
644
|
+
test('limpia la salida: sin escapes ni control, con sangría, sin la línea de cierre y acotada', () => {
|
|
645
|
+
assert.deepEqual(
|
|
646
|
+
outputLines(['\u001b[1m ✓ Hecho\u001b[0m\u0007', ' + models.md\u202e creado', '[omk:fin] update salida=0', '', ' ']),
|
|
647
|
+
[' ✓ Hecho', ' + models.md creado']
|
|
648
|
+
)
|
|
649
|
+
assert.equal(outputLines([`${'x'.repeat(OUTPUT_LINE_MAX)}yz`])[0]?.length, OUTPUT_LINE_MAX)
|
|
650
|
+
assert.deepEqual(outputLines(['a', 'b', 'c'], 2), ['b', 'c'])
|
|
651
|
+
// Un spinner leído como salida acumulada: cuenta el último fotograma, no todos pegados.
|
|
652
|
+
assert.deepEqual(outputLines(['\r ⠋ Claude Code…\r ⠙ Claude Code…\r ✓ Claude Code\r']), [' ✓ Claude Code'])
|
|
184
653
|
})
|
|
185
654
|
})
|