feat(kilo): reconhece o Kilo CLI como aiType kilo, separado do Kiro
This commit is contained in:
parent
54499b2ae6
commit
d1857811f2
@ -3930,6 +3930,15 @@ function detectAgentThinking(terminalText, isWaiting = false) {
|
||||
return { isThinking: false, isPaused: false, label: 'Pronto' };
|
||||
}
|
||||
|
||||
// 1.5 Kilo CLI (espelho de RE_KILO em src/utils/activity-detector.js): rodapé "ctrl+p commands" / "tab agents";
|
||||
// "esc interrupt" no rodapé indica turno em execução. Antes dos spinners: o rodapé ocioso do Kilo não é prompt.
|
||||
if (/ctrl\+p commands|\btab agents\b|\besc interrupt\b|Ask anything\.\.\./i.test(lastChunk) && !/Kiro CLI|kiro>/i.test(lastChunk)) {
|
||||
if (/\besc interrupt\b/i.test(lines.slice(-3).join('\n'))) {
|
||||
return { isThinking: true, isPaused: false, label: 'Kilo em execução...' };
|
||||
}
|
||||
return { isThinking: false, isPaused: false, label: 'Pronto' };
|
||||
}
|
||||
|
||||
// 2. Termos específicos de status ativo detectados
|
||||
if (/percolating/i.test(lastChunk)) {
|
||||
return { isThinking: true, isPaused: false, label: 'Processando tokens (Percolating)...' };
|
||||
|
||||
@ -225,8 +225,9 @@ export class GatewayDaemon {
|
||||
await this.adapter.sendRawInput(agentName, '\\x1b');
|
||||
await this.adapter.wait(150);
|
||||
}
|
||||
const isKiro = aiType === 'kiro' || /kiro|kilo|opencode/i.test(cachedAgent?.preset || cachedAgent?.name || '');
|
||||
return { aiType, isKiro };
|
||||
const isKiro = aiType === 'kiro' || (aiType !== 'kilo' && /kiro/i.test(cachedAgent?.preset || cachedAgent?.name || ''));
|
||||
const isKilo = aiType === 'kilo';
|
||||
return { aiType, isKiro, isKilo };
|
||||
}
|
||||
|
||||
async handleRelayMessage(msg) {
|
||||
@ -294,9 +295,25 @@ export class GatewayDaemon {
|
||||
console.log(`[Gateway] Comando de menu de modelo detectado para ${msg.agentName}: "${text}"`);
|
||||
const filterArg = (modelCommandMatch[1] || '').trim();
|
||||
|
||||
await this.prepareSlashCommandContext(msg.agentName);
|
||||
await this.adapter.sendRawInput(msg.agentName, '\\x15/model\\n');
|
||||
const { isKilo: isKiloModelTarget } = await this.prepareSlashCommandContext(msg.agentName);
|
||||
if (isKiloModelTarget) {
|
||||
// Kilo CLI: texto e Enter na mesma escrita viram colagem e o TUI não envia (popup de comandos fica aberto).
|
||||
// O Enter precisa ir em escrita separada (homologado no kilo 7.8.32).
|
||||
await this.adapter.sendRawInput(msg.agentName, '\\x15/model');
|
||||
await this.adapter.wait(150);
|
||||
await this.adapter.sendRawInput(msg.agentName, '\\n');
|
||||
if (filterArg) {
|
||||
await this.adapter.wait(300);
|
||||
await this.adapter.sendRawInput(msg.agentName, filterArg);
|
||||
} else {
|
||||
await this.adapter.wait(200);
|
||||
}
|
||||
} else {
|
||||
await this.adapter.sendRawInput(msg.agentName, '\\x15/model\\n');
|
||||
}
|
||||
if (isKiloModelTarget) {
|
||||
// já despachado acima
|
||||
} else if (filterArg) {
|
||||
await this.adapter.wait(150);
|
||||
await this.adapter.sendRawInput(msg.agentName, filterArg);
|
||||
} else {
|
||||
@ -333,7 +350,25 @@ export class GatewayDaemon {
|
||||
else if (['medio', 'médio', 'med', 'medium'].includes(rawArg)) normalizedArg = 'medium';
|
||||
else if (['alto', 'max', 'high'].includes(rawArg)) normalizedArg = 'high';
|
||||
|
||||
const { isKiro } = await this.prepareSlashCommandContext(msg.agentName);
|
||||
const { isKiro, isKilo } = await this.prepareSlashCommandContext(msg.agentName);
|
||||
|
||||
// O Kilo CLI não tem /effort (homologado no 7.8.32: o TUI não lista o comando e o texto viraria prompt).
|
||||
// Nada é enviado ao terminal; o operador é orientado a usar /models.
|
||||
if (isKilo) {
|
||||
if (this.ws && this.connected) {
|
||||
const replyMsg = '⚠️ O Kilo CLI não tem o comando /effort. Use /models para trocar o modelo.';
|
||||
this.ws.send(JSON.stringify({
|
||||
type: 'CHAT_RESPONSE',
|
||||
chatId: msg.chatId,
|
||||
agentName: msg.agentName,
|
||||
reply: replyMsg,
|
||||
response: replyMsg,
|
||||
ok: false,
|
||||
timestamp: new Date().toISOString()
|
||||
}));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (normalizedArg && ['low', 'medium', 'high'].includes(normalizedArg)) {
|
||||
await this.adapter.sendRawInput(msg.agentName, `\\x15/effort ${normalizedArg}\\n`);
|
||||
|
||||
@ -15,7 +15,9 @@ const AI_LAUNCH_SPECS = {
|
||||
agy: { preset: 'Antigravity', command: 'agy', exitSequence: '/exit\\n' },
|
||||
claude: { preset: 'Claude Code', command: 'claude', exitSequence: '/exit\\n' },
|
||||
gemini: { preset: null, command: 'gemini', exitSequence: '/exit\\n' },
|
||||
aider: { preset: null, command: 'aider', exitSequence: '/exit\\n' }
|
||||
aider: { preset: null, command: 'aider', exitSequence: '/exit\\n' },
|
||||
// Kilo CLI: `/exit` encerra o TUI e devolve o shell (homologado no kilo 7.8.32); Ctrl+C isolado nao encerra.
|
||||
kilo: { preset: null, command: 'kilo', exitSequence: '/exit\\n' }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -34,10 +36,6 @@ export function resolveTerminalLaunchSpec(rawOutput, activity) {
|
||||
}
|
||||
|
||||
if (activity.aiType === 'kiro') {
|
||||
if (/Permission required|ctrl\+f fullscreen|opencode|\bkilo\b/i.test(tail)) {
|
||||
const command = (/\bopencode\b/i.test(tail) && !/\bkilo\b/i.test(tail)) ? 'opencode' : 'kilo';
|
||||
return { preset: null, command, exitSequence: '/exit\\n' };
|
||||
}
|
||||
return { preset: null, command: 'kiro-cli', exitSequence: '/exit\\n' };
|
||||
}
|
||||
|
||||
@ -287,7 +285,10 @@ export class MaestriAdapter {
|
||||
} else if (cmd === 'gemini' || cmd.startsWith('gemini ')) {
|
||||
hasAiActivity = true;
|
||||
aiType = aiType || 'gemini';
|
||||
} else if (cmd === 'kiro' || cmd.startsWith('kiro ') || cmd === 'kilo') {
|
||||
} else if (cmd === 'kilo' || cmd.startsWith('kilo ')) {
|
||||
hasAiActivity = true;
|
||||
aiType = aiType || 'kilo';
|
||||
} else if (cmd === 'kiro' || cmd.startsWith('kiro ') || cmd === 'kiro-cli' || cmd.startsWith('kiro-cli ')) {
|
||||
hasAiActivity = true;
|
||||
aiType = aiType || 'kiro';
|
||||
} else if (cmd) {
|
||||
@ -326,7 +327,10 @@ export class MaestriAdapter {
|
||||
} else if (cmd === 'gemini' || cmd.startsWith('gemini ')) {
|
||||
hasAiActivity = true;
|
||||
aiType = 'gemini';
|
||||
} else if (cmd === 'kiro' || cmd.startsWith('kiro ') || cmd === 'kilo') {
|
||||
} else if (cmd === 'kilo' || cmd.startsWith('kilo ')) {
|
||||
hasAiActivity = true;
|
||||
aiType = 'kilo';
|
||||
} else if (cmd === 'kiro' || cmd.startsWith('kiro ') || cmd === 'kiro-cli' || cmd.startsWith('kiro-cli ')) {
|
||||
hasAiActivity = true;
|
||||
aiType = 'kiro';
|
||||
} else if (cmd) {
|
||||
|
||||
@ -19,7 +19,12 @@ const RE_CMD_HEADER = /Microsoft Windows \[Version|\(c\) Microsoft Corporation/i
|
||||
// Padrões específicos de ferramentas de IA
|
||||
const RE_AGY = /Antigravity CLI|\? for shortcuts|○ Thought for|● Ran \(|● Explored |● Edited |Google AI Pro|Gemini 3\.\d/i;
|
||||
const RE_CLAUDE = /Claude Code|Anthropics|✻ Worked for|esc to (?:cancel|interrupt)|shift\+tab to cycle|ctrl\+o to expand|percolating|Claude>/i;
|
||||
const RE_KIRO = /Kiro CLI|kiro>|Kiro is working|▸\s*Credits:\s*turn\b|ask a question or describe a task|ctrl\+s to queue|tab to switch panels|switch panels|ctrl\+t variants|Kilo Gateway|ctrl\+x m|at top for controls/i;
|
||||
const RE_KIRO = /Kiro CLI|kiro>|Kiro is working|▸\s*Credits:\s*turn\b|ask a question or describe a task|ctrl\+s to queue|tab to switch panels|switch panels|ctrl\+t variants/i;
|
||||
// Kilo CLI 7.8.x (TUI): rodapé "ctrl+p commands", "tab agents" ocioso, "esc interrupt" em execução, campo "Ask anything...",
|
||||
// categoria "Kilo Gateway" no seletor de modelos. Não usar nome de modelo: um Kilo com Gemini casaria com RE_AGY.
|
||||
const RE_KILO = /ctrl\+p commands|\btab agents\b|\besc interrupt\b|Ask anything\.\.\.|Kilo Gateway/i;
|
||||
// Menus próprios do Kilo (permissão, confirmação "Always allow", seletor de modelo)
|
||||
const RE_KILO_MENU = /ctrl\+f\s+fullscreen\s+⇆\s*select|⇆\s*select\s+enter\s+confirm|\bPermission required\b|\bAlways allow\b|\bSelect model\b/i;
|
||||
const RE_GEMINI_CLI = /Gemini CLI|gemini-cli>/i;
|
||||
const RE_AIDER = /Aider v\d|Tokens:.*?Model:/i;
|
||||
|
||||
@ -769,7 +774,7 @@ export function detectInteractiveMenu(rawOutput) {
|
||||
* @param {string} rawOutput - Saída pura retornada por `maestri check <Agent>`
|
||||
* @returns {{
|
||||
* hasAiActivity: boolean,
|
||||
* aiType: 'agy' | 'claude' | 'kiro' | 'gemini' | 'aider' | 'generic_ai' | null,
|
||||
* aiType: 'agy' | 'claude' | 'kiro' | 'kilo' | 'gemini' | 'aider' | 'generic_ai' | null,
|
||||
* shellType: 'powershell' | 'cmd' | 'bash' | 'empty' | 'unknown_shell' | null,
|
||||
* isThinking: boolean,
|
||||
* details: string
|
||||
@ -887,11 +892,13 @@ export function detectTerminalActivity(rawOutput) {
|
||||
const interactiveMenu = detectInteractiveMenu(rawOutput);
|
||||
if (interactiveMenu.hasInteractiveMenu) {
|
||||
let menuAiType = 'generic_ai';
|
||||
if (/Keyboard:\s*↑\/↓\s*Navigate/i.test(tail) || RE_AGY.test(tail)) {
|
||||
if ((RE_KILO.test(tail) || RE_KILO_MENU.test(tail)) && !RE_KIRO.test(tail)) {
|
||||
menuAiType = 'kilo';
|
||||
} else if (/Keyboard:\s*↑\/↓\s*Navigate/i.test(tail) || RE_AGY.test(tail)) {
|
||||
menuAiType = 'agy';
|
||||
} else if (/Enter to confirm\s*·\s*Esc to cancel/i.test(tail) || RE_CLAUDE.test(tail)) {
|
||||
menuAiType = 'claude';
|
||||
} else if (/esc\s+to\s+close\s*·\s*↑↓\s+to\s+navigate|ctrl\+f\s+fullscreen\s+⇆\s*select|⇆\s*select\s+enter\s+confirm|\bPermission required\b|\bAlways allow\b/i.test(tail) || RE_KIRO.test(tail)) {
|
||||
} else if (/esc\s+to\s+close\s*·\s*↑↓\s+to\s+navigate|at top for controls/i.test(tail) || RE_KIRO.test(tail)) {
|
||||
menuAiType = 'kiro';
|
||||
} else if (RE_GEMINI_CLI.test(tail)) {
|
||||
menuAiType = 'gemini';
|
||||
@ -953,6 +960,27 @@ export function detectTerminalActivity(rawOutput) {
|
||||
|
||||
const isThinking = !isUsageLimit && !isEndingInAiIdlePrompt;
|
||||
|
||||
// Kilo antes de Agy: o nome do modelo ("Gemini 3.x") aparece na tela do Kilo e casaria com RE_AGY.
|
||||
if (RE_KILO.test(tail) && !RE_KIRO.test(tail)) {
|
||||
// Em execução: "esc interrupt" no rodapé (últimas linhas). Ocioso: rodapé sem "esc interrupt".
|
||||
const kiloBusy = /\besc interrupt\b/i.test(lines.slice(-3).join('\n'));
|
||||
const kiloThinking = !isUsageLimit && kiloBusy;
|
||||
return {
|
||||
hasAiActivity: true,
|
||||
aiType: 'kilo',
|
||||
shellType: null,
|
||||
isThinking: kiloThinking,
|
||||
isPaused: isUsageLimit,
|
||||
pauseReason: isUsageLimit ? 'usage_limit' : null,
|
||||
pauseResetTime,
|
||||
hasInteractiveMenu: false,
|
||||
interactiveMenu: null,
|
||||
details: isUsageLimit
|
||||
? 'Kilo CLI pausado por limite de uso'
|
||||
: (kiloThinking ? 'Kilo CLI ativo' : 'Kilo CLI pronto')
|
||||
};
|
||||
}
|
||||
|
||||
if (RE_AGY.test(tail)) {
|
||||
return {
|
||||
hasAiActivity: true,
|
||||
|
||||
@ -307,7 +307,7 @@ Allow once Allow always Reject ctrl+f fullscreen ⇆ sel
|
||||
const actPlain = detectTerminalActivity(kiloHorizPlain);
|
||||
assert.strictEqual(actPlain.hasInteractiveMenu, true);
|
||||
assert.strictEqual(actPlain.isThinking, false);
|
||||
assert.strictEqual(actPlain.aiType, 'kiro');
|
||||
assert.strictEqual(actPlain.aiType, 'kilo');
|
||||
assert.strictEqual(actPlain.details, 'Aguardando seleção em menu interativo');
|
||||
|
||||
// Com escape ANSI de fundo reverso (\x1B[7m) destacando a 2ª opção ("Allow always")
|
||||
|
||||
32
test/fixtures/kilo/answered.txt
vendored
Normal file
32
test/fixtures/kilo/answered.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
┃
|
||||
┃ Leia o arquivo <ext>\win.ini e mostre as 3 primeiras linhas
|
||||
┃
|
||||
|
||||
→ Read <ext>\win.ini [limit=3] · auto-approved by the code agent (matched read
|
||||
`*`)
|
||||
|
||||
1: ; for 16-bit app support
|
||||
2: fonts
|
||||
3: extensions
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM) · 2m 29s
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
┃
|
||||
┃
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
21.3K ctrl+p commands
|
||||
32
test/fixtures/kilo/ask-result.txt
vendored
Normal file
32
test/fixtures/kilo/ask-result.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
┃ · índice graphify defasado: docs/ (menos de 1 dia atrás do último commit, índice
|
||||
┃ versionado)
|
||||
┃ → quem muda esse código atualiza antes do commit (`graphify update .`; em docs,
|
||||
┃ `graphify update docs --no-cluster`); não atualize o de outro papel sem avisar
|
||||
┃ · tabela "Repositórios do escopo" sem as colunas Plataforma e Design system (skill
|
||||
┃ ux-design-craft): acrescente-as como no templates/PROJETO.md do pacote
|
||||
┃ · papéis do S…
|
||||
┃
|
||||
┃ Click to expand
|
||||
┃
|
||||
|
||||
→ Skill "triagem-de-papel"
|
||||
→ Read package.json · auto-approved by the code agent (matched read `*`)
|
||||
|
||||
maestri-remote-agent
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM) · 8m 30s
|
||||
|
||||
┃
|
||||
┃ Responda apenas com a palavra OK.
|
||||
┃
|
||||
|
||||
OK
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM) · 1m 49s
|
||||
|
||||
┃
|
||||
┃
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
22.3K ctrl+p commands
|
||||
32
test/fixtures/kilo/effort-absent.txt
vendored
Normal file
32
test/fixtures/kilo/effort-absent.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
┃ $ node .context/scripts/passo0.mjs --modo ler
|
||||
┃
|
||||
┃ · git pull pelo token do az falhou (fatal: could not read Username for 'https://
|
||||
┃ winicius.visualstudio.com': terminal prompts disabled); repetindo com o git puro
|
||||
┃ · pull (git): em dia com o remoto
|
||||
┃ · credential helper do az (git puro autentica pelo az; só .git/config local, só
|
||||
┃ https://dev.azure.com, sem segredo gravado): nenhum clone
|
||||
┃ não instalado: repositório SDLC (desligado com remover-helper)
|
||||
┃ · índice graphify defasado: docs/ (menos de 1 dia atrás do último commit, índice
|
||||
┃ versionado)
|
||||
┃ → quem muda esse código atualiza antes do commit (`graphify update .`; em docs,
|
||||
┃ `graphify update docs --no-cluster`); não atualize o de outro papel sem avisar
|
||||
┃ · tabela "Repositórios do escopo" sem as colunas Plataforma e Design system (skill
|
||||
┃ ux-design-craft): acrescente-as como no templates/PROJETO.md do pacote
|
||||
┃ · papéis do S…
|
||||
┃
|
||||
┃ Click to expand
|
||||
┃
|
||||
|
||||
→ Skill "triagem-de-papel"
|
||||
→ Read package.json · auto-approved by the code agent (matched read `*`)
|
||||
|
||||
┃ /maestri-portal:skill Use a browser portal on the Maestri canvas to naviga ┃
|
||||
┃ /kilo-config:skill Guide for Kilo configuration: config paths, kilo.jso ┃
|
||||
┃ /goal Keep working toward a session goal. /goal <objective ┃
|
||||
┃ /maestri-workspace:skill Create new Maestri workspaces and floors from the co ┃
|
||||
┃
|
||||
┃ /effort
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
22.3K ctrl+p commands
|
||||
14
test/fixtures/kilo/exit-after.txt
vendored
Normal file
14
test/fixtures/kilo/exit-after.txt
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
Windows PowerShell 5.1
|
||||
Direitos Autorais (C) Microsoft Corporation. Todos os direitos reservados.
|
||||
|
||||
PS <dir>> kilo
|
||||
|
||||
██ ██ ██🬺🬏 ██ ██ ██🬺🬏 Extrair nome do pacote
|
||||
████🬺🬏 ██ ██ ██ ██ kilo -s ses_df6e70129ffeGSMXCEPG8c7fzI
|
||||
██ ██ ██████ 🬁🬬████ 🬁🬬██
|
||||
PS <dir>> kilo
|
||||
|
||||
██ ██ ██🬺🬏 ██ ██ ██🬺🬏 New session - 2026-11-23T16:04:00.611Z
|
||||
████🬺🬏 ██ ██ ██ ██ kilo -s ses_df6d99c1cffeSGF995S1UWkptB
|
||||
██ ██ ██████ 🬁🬬████ 🬁🬬██
|
||||
PS <dir>>
|
||||
32
test/fixtures/kilo/idle.txt
vendored
Normal file
32
test/fixtures/kilo/idle.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
██ ██ ██🬺🬏 ██ ██ ██🬺🬏 ████ ██ ██🬺🬏
|
||||
████🬺🬏 ▀▀██ ██ ▀▀ ██▀▀██ ██▀▀▀▀ ██ ▀▀██
|
||||
██ ██ ██████ 🬁🬬████ 🬁🬬██▀▀ 🬁🬬████ 🬁🬬████ ██████
|
||||
▀▀ ▀▀ ▀▀▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀
|
||||
|
||||
|
||||
┃
|
||||
┃ Ask anything... "Fix a TODO in the codebase"
|
||||
┃
|
||||
┃ Code ·Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via
|
||||
┃ LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
tab agents ctrl+p commands
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
● Tip Drag and drop images or PDFs into the terminal to add them as context
|
||||
|
||||
|
||||
|
||||
<dir>:main 7.8.32
|
||||
32
test/fixtures/kilo/models-popup.txt
vendored
Normal file
32
test/fixtures/kilo/models-popup.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
┃ $ node .context/scripts/passo0.mjs --modo ler
|
||||
┃
|
||||
┃ · git pull pelo token do az falhou (fatal: could not read Username for 'https://
|
||||
┃ winicius.visualstudio.com': terminal prompts disabled); repetindo com o git puro
|
||||
┃ · pull (git): em dia com o remoto
|
||||
┃ · credential helper do az (git puro autentica pelo az; só .git/config local, só
|
||||
┃ https://dev.azure.com, sem segredo gravado): nenhum clone
|
||||
┃ não instalado: repositório SDLC (desligado com remover-helper)
|
||||
┃ · índice graphify defasado: docs/ (menos de 1 dia atrás do último commit, índice
|
||||
┃ versionado)
|
||||
┃ → quem muda esse código atualiza antes do commit (`graphify update .`; em docs,
|
||||
┃ `graphify update docs --no-cluster`); não atualize o de outro papel sem avisar
|
||||
┃ · tabela "Repositórios do escopo" sem as colunas Plataforma e Design system (skill
|
||||
┃ ux-design-craft): acrescente-as como no templates/PROJETO.md do pacote
|
||||
┃ · papéis do S…
|
||||
┃
|
||||
┃ /models Switch model ┃
|
||||
┃ /maestri:skill Send messages to connected AI agents on the Maestri ┃
|
||||
┃ /maestri-portal-devices:skill Drive an Android emulator or physical Android phone ┃
|
||||
┃ /maestri-chat:skill Applies only to messages carrying a Maestri Chat hea ┃
|
||||
┃ /maestri-routines:skill Manage scheduled routines on the Maestri canvas (rec ┃
|
||||
┃ /maestri-portal:skill Use a browser portal on the Maestri canvas to naviga ┃
|
||||
┃ /maestri-manager:skill Create and connect agent terminals on the Maestri ca ┃
|
||||
┃ /maestri-workspace:skill Create new Maestri workspaces and floors from the co ┃
|
||||
┃ /kilo-config:skill Guide for Kilo configuration: config paths, kilo.jso ┃
|
||||
┃ /goal Keep working toward a session goal. /goal <objective ┃
|
||||
┃
|
||||
┃ /models
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
22.3K ctrl+p commands
|
||||
32
test/fixtures/kilo/models.txt
vendored
Normal file
32
test/fixtures/kilo/models.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
┃ $ node .context/scripts/passo0.mjs --modo ler
|
||||
┃
|
||||
┃ · git pull pelo token do az falhou (fatal: could not read Username for 'https://
|
||||
┃ winicius.visualstudio.com': terminal prompts disabled); repetindo com o git puro
|
||||
┃ · pull (git): em dia com o remoto
|
||||
┃ · credential helper do az (git puro autentica pelo az; só .git/config local, só
|
||||
┃ https://dev.azure.com, sem segredo gravado): nenhum clone
|
||||
┃ não instalado: repositório SDLC (desligado com remover-helper)
|
||||
|
||||
Select model esc
|
||||
|
||||
Search
|
||||
|
||||
Recent
|
||||
● Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
Anthropic: Claude Opus 5.5 Kilo Gateway
|
||||
NVIDIA: Nemotron 3 Ultra (free) Kilo Gateway May train
|
||||
|
||||
Recommended
|
||||
Auto Efficient
|
||||
Auto Free May train
|
||||
Anthropic: Claude Opus 5.5
|
||||
OpenAI: GPT-6.2 Sol (new)
|
||||
|
||||
Connect provider ctrl+a Favorite ctrl+f
|
||||
|
||||
┃
|
||||
┃
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
22.3K ctrl+p commands
|
||||
32
test/fixtures/kilo/permission-always-confirm.txt
vendored
Normal file
32
test/fixtures/kilo/permission-always-confirm.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
┃
|
||||
┃ Leia o arquivo <ext>\win.ini e mostre as 3 primeiras linhas
|
||||
┃
|
||||
|
||||
⠇ Read <ext>\win.ini [limit=3]
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
┃
|
||||
┃ △ Always allow
|
||||
┃
|
||||
┃ This will allow the following patterns permanently
|
||||
┃
|
||||
┃ - <ext>\*
|
||||
┃
|
||||
┃
|
||||
┃ Confirm Cancel ⇆ select enter confirm
|
||||
┃
|
||||
32
test/fixtures/kilo/permission-bash.txt
vendored
Normal file
32
test/fixtures/kilo/permission-bash.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
┃
|
||||
┃ Leia o arquivo package.json e diga o nome do pacote
|
||||
┃
|
||||
|
||||
$ node .context/scripts/passo0.mjs --modo ler
|
||||
→ Skill "triagem-de-papel"
|
||||
→ Read package.json · auto-approved by the code agent (matched read `*`)
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
┃
|
||||
┃ △ Permission required
|
||||
┃ # Executes Passo 0 read mode for SDLC workflow
|
||||
┃
|
||||
┃ $ node .context/scripts/passo0.mjs --modo ler
|
||||
┃
|
||||
┃
|
||||
┃ Allow once Allow always Reject ctrl+f fullscreen ⇆ select enter confirm
|
||||
┃
|
||||
32
test/fixtures/kilo/permission-external.txt
vendored
Normal file
32
test/fixtures/kilo/permission-external.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
┃
|
||||
┃ Leia o arquivo <ext>\win.ini e mostre as 3 primeiras linhas
|
||||
┃
|
||||
|
||||
⠴ Read <ext>\win.ini [limit=3]
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
┃
|
||||
┃ △ Permission required
|
||||
┃ ← Access external directory <ext>
|
||||
┃
|
||||
┃ Patterns
|
||||
┃
|
||||
┃ - <ext>\*
|
||||
┃
|
||||
┃
|
||||
┃ Allow once Allow always Reject ctrl+f fullscreen ⇆ select enter confirm
|
||||
┃
|
||||
32
test/fixtures/kilo/thinking.txt
vendored
Normal file
32
test/fixtures/kilo/thinking.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
┃
|
||||
┃ Leia o arquivo package.json e diga o nome do pacote
|
||||
┃
|
||||
|
||||
⠇ Initializing snapshot…
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
┃
|
||||
┃
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
⬝⬝⬝⬝⬝⬝⬝⬝ esc interrupt tab agents ctrl+p commands
|
||||
32
test/fixtures/kilo/tool-exec.txt
vendored
Normal file
32
test/fixtures/kilo/tool-exec.txt
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
┃
|
||||
┃ Leia o arquivo <ext>\win.ini e mostre as 3 primeiras linhas
|
||||
┃
|
||||
|
||||
→ Read <ext>\win.ini [limit=3] · auto-approved by the code agent (matched read
|
||||
`*`)
|
||||
|
||||
▣ Code · Gemini 3.1 Flash Lite (LiteLLM)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
┃
|
||||
┃
|
||||
┃
|
||||
┃ Code · Gemini 3.1 Flash Lite (LiteLLM) OmniRoute (chaves Gemini via LiteLLM)
|
||||
╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
|
||||
⬝⬝■■■■■■ esc interrupt 21.2K ctrl+p commands
|
||||
20
test/fixtures/kiro/idle.txt
vendored
Normal file
20
test/fixtures/kiro/idle.txt
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
⣀⣤⣤⣶⣶⣤⣤⣄⡀
|
||||
⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣄
|
||||
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄
|
||||
⢸⣿⣿⣿⣿⣿⣿⠁⢹⣿⠁⢹⣿⣿⣧ Welcome to Kiro CLI V3
|
||||
⢸⣿⣿⣿⣿⣿⣿⣄⣼⣿⣄⣼⣿⣿⣿ Learn more: https://kiro.dev/docs/cli/v3/
|
||||
⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
|
||||
⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ kiro-cli --v2 Launch the previous experience instead
|
||||
⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃
|
||||
⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁
|
||||
⠙⠛⠛⠛⠋⠁⠙⠛⠛⠉
|
||||
|
||||
|
||||
▸ What's new ctrl+o to expand
|
||||
Approve for me, cloud sessions, memory, local sandbox and specs.
|
||||
|
||||
────────────────────────────────────────────────────────────────────────────────────────────
|
||||
Default · auto · ◔ 1% <dir> · (main)
|
||||
|
||||
› ask a question or describe a task ↵
|
||||
@ -2659,6 +2659,13 @@ Também verificamos running command e compiling no buffer.
|
||||
'? for shortcuts auto · 1 subagent(s)'
|
||||
].join('\n'));
|
||||
assert.strictEqual(activeSubagentAgy.isThinking, true, 'Subagente ativo no Antigravity deve manter isThinking: true mesmo com > acima');
|
||||
|
||||
// Kilo CLI (fixtures reais do kilo 7.8.32): rodapé "esc interrupt" = executando; rodapé ocioso = pronto
|
||||
const kiloFixture = (name) => fs.readFileSync(path.join(process.cwd(), 'test', 'fixtures', 'kilo', name + '.txt'), 'utf8');
|
||||
assert.strictEqual(window.detectAgentThinking(kiloFixture('thinking')).isThinking, true, 'Kilo com esc interrupt deve estar pensando');
|
||||
assert.strictEqual(window.detectAgentThinking(kiloFixture('tool-exec')).isThinking, true, 'Kilo executando ferramenta deve estar pensando');
|
||||
assert.strictEqual(window.detectAgentThinking(kiloFixture('answered')).isThinking, false, 'Kilo ocioso após resposta deve estar pronto');
|
||||
assert.strictEqual(window.detectAgentThinking(kiloFixture('idle')).isThinking, false, 'Kilo ocioso na tela inicial deve estar pronto');
|
||||
});
|
||||
|
||||
test('28. renderTuiPanel oculta .chat-tui-keypad quando há ações detectadas, alterna via ⌨️ e sanitiza borda ┃ legado', async () => {
|
||||
|
||||
@ -127,7 +127,8 @@ test('GatewayDaemon deve salvar anexo de vídeo (.mp4 e .webm) com extensão san
|
||||
assert.ok(match, 'Deve ter injetado o path do vídeo');
|
||||
savedFile = match[1];
|
||||
assert.ok(savedFile.endsWith('.mp4'), 'Deve terminar com extensão .mp4');
|
||||
assert.ok(!savedFile.includes(':') && !savedFile.includes('?'), 'Caracteres perigosos devem estar sanitizados');
|
||||
// Confere só o nome do arquivo: no Windows o caminho completo traz o ':' da unidade (D:\\...)
|
||||
assert.ok(!path.basename(savedFile).includes(':') && !path.basename(savedFile).includes('?'), 'Caracteres perigosos devem estar sanitizados');
|
||||
assert.ok(fs.existsSync(savedFile), 'Arquivo de vídeo deve existir no diretório de uploads');
|
||||
assert.deepEqual(fs.readFileSync(savedFile), videoBinary);
|
||||
|
||||
@ -775,12 +776,13 @@ test('resolveTerminalLaunchSpec deve mapear perfis de IA e shell puro corretamen
|
||||
{ preset: 'Claude Code', command: 'claude', exitSequence: '/exit\\n' }
|
||||
);
|
||||
assert.deepEqual(
|
||||
resolveTerminalLaunchSpec('△ Permission required\nctrl+f fullscreen', { aiType: 'kiro', hasAiActivity: true }),
|
||||
resolveTerminalLaunchSpec('△ Permission required\nctrl+f fullscreen', { aiType: 'kilo', hasAiActivity: true }),
|
||||
{ preset: null, command: 'kilo', exitSequence: '/exit\\n' }
|
||||
);
|
||||
// Kiro não vira kilo nem opencode por texto de tela (são ferramentas diferentes)
|
||||
assert.deepEqual(
|
||||
resolveTerminalLaunchSpec('Running opencode agent', { aiType: 'kiro', hasAiActivity: true }),
|
||||
{ preset: null, command: 'opencode', exitSequence: '/exit\\n' }
|
||||
resolveTerminalLaunchSpec('△ Permission required\nctrl+f fullscreen opencode kilo', { aiType: 'kiro', hasAiActivity: true }),
|
||||
{ preset: null, command: 'kiro-cli', exitSequence: '/exit\\n' }
|
||||
);
|
||||
assert.deepEqual(
|
||||
resolveTerminalLaunchSpec('Kiro CLI session', { aiType: 'kiro', hasAiActivity: true }),
|
||||
@ -1141,7 +1143,7 @@ test('GatewayDaemon intercepta comandos /modelo, /model e /models no CHAT_SEND e
|
||||
checkAgent: async () => menuOpen
|
||||
? 'Switch Model\n\n Search: \n> Gemini 3.8 Flash (current)\n\nKeyboard: ↑/↓ Navigate enter Select esc Go Back'
|
||||
: 'Antigravity CLI\n> \n? for shortcuts',
|
||||
listAgents: async () => [{ name: 'AgyAgent', aiType: 'agy' }, { name: 'KiloAgent', aiType: 'kiro' }]
|
||||
listAgents: async () => [{ name: 'AgyAgent', aiType: 'agy' }, { name: 'KiloAgent', aiType: 'kilo' }]
|
||||
};
|
||||
|
||||
const daemon = new GatewayDaemon({ adapter: mockAdapter });
|
||||
@ -1188,7 +1190,8 @@ test('GatewayDaemon intercepta comandos /modelo, /model e /models no CHAT_SEND e
|
||||
});
|
||||
|
||||
assert.deepEqual(rawCalls, [
|
||||
{ agentName: 'KiloAgent', seq: '\\x15/model\\n' }
|
||||
{ agentName: 'KiloAgent', seq: '\\x15/model' },
|
||||
{ agentName: 'KiloAgent', seq: '\\n' }
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
189
test/kilo-homologation.test.js
Normal file
189
test/kilo-homologation.test.js
Normal file
@ -0,0 +1,189 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import os from 'node:os';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { detectTerminalActivity, detectInteractiveMenu } from '../src/utils/activity-detector.js';
|
||||
import { GatewayDaemon } from '../src/gateway/daemon.js';
|
||||
import { MaestriAdapter, resolveTerminalLaunchSpec } from '../src/gateway/maestri-adapter.js';
|
||||
|
||||
// Fixtures reais colhidas do kilo 7.8.32 e do kiro-cli 3.5.0 em terminais Maestri (change maestri-remote-kilo-code-homologation).
|
||||
const FIXTURES = path.join(path.dirname(fileURLToPath(import.meta.url)), 'fixtures');
|
||||
const kilo = (name) => fs.readFileSync(path.join(FIXTURES, 'kilo', `${name}.txt`), 'utf8');
|
||||
const kiro = (name) => fs.readFileSync(path.join(FIXTURES, 'kiro', `${name}.txt`), 'utf8');
|
||||
|
||||
test('Kilo CLI - detector reconhece o TUI ocioso como aiType kilo (não agy, apesar do modelo Gemini)', () => {
|
||||
for (const name of ['idle', 'answered', 'ask-result']) {
|
||||
const act = detectTerminalActivity(kilo(name));
|
||||
assert.equal(act.hasAiActivity, true, name);
|
||||
assert.equal(act.aiType, 'kilo', name);
|
||||
assert.equal(act.isThinking, false, name);
|
||||
assert.equal(act.isPaused, false, name);
|
||||
assert.equal(act.hasInteractiveMenu, false, name);
|
||||
assert.equal(act.details, 'Kilo CLI pronto', name);
|
||||
}
|
||||
});
|
||||
|
||||
test('Kilo CLI - detector marca pensando e execução de ferramenta pelo "esc interrupt" no rodapé', () => {
|
||||
for (const name of ['thinking', 'tool-exec']) {
|
||||
const act = detectTerminalActivity(kilo(name));
|
||||
assert.equal(act.aiType, 'kilo', name);
|
||||
assert.equal(act.isThinking, true, name);
|
||||
assert.equal(act.details, 'Kilo CLI ativo', name);
|
||||
}
|
||||
});
|
||||
|
||||
test('Kilo CLI - popup de comandos digitado (/models, /effort) segue como Kilo pronto, sem menu', () => {
|
||||
for (const name of ['models-popup', 'effort-absent']) {
|
||||
const act = detectTerminalActivity(kilo(name));
|
||||
assert.equal(act.aiType, 'kilo', name);
|
||||
assert.equal(act.isThinking, false, name);
|
||||
assert.equal(act.hasInteractiveMenu, false, name);
|
||||
}
|
||||
});
|
||||
|
||||
test('Kilo CLI - Permission required (shell e diretório externo) vira menu horizontal aiType kilo', () => {
|
||||
for (const name of ['permission-bash', 'permission-external']) {
|
||||
const act = detectTerminalActivity(kilo(name));
|
||||
assert.equal(act.aiType, 'kilo', name);
|
||||
assert.equal(act.hasInteractiveMenu, true, name);
|
||||
assert.equal(act.isThinking, false, name);
|
||||
assert.equal(act.interactiveMenu.axis, 'horizontal', name);
|
||||
assert.deepEqual(act.interactiveMenu.options.map(o => o.label), ['Allow once', 'Allow always', 'Reject'], name);
|
||||
assert.match(act.interactiveMenu.menuTitle, /Permission required/, name);
|
||||
}
|
||||
});
|
||||
|
||||
test('Kilo CLI - confirmação "Always allow" tem Confirm e Cancel', () => {
|
||||
const act = detectTerminalActivity(kilo('permission-always-confirm'));
|
||||
assert.equal(act.aiType, 'kilo');
|
||||
assert.equal(act.hasInteractiveMenu, true);
|
||||
assert.deepEqual(act.interactiveMenu.options.map(o => o.label), ['Confirm', 'Cancel']);
|
||||
});
|
||||
|
||||
test('Kilo CLI - seletor /models (Select model) vira menu vertical aiType kilo', () => {
|
||||
const text = kilo('models');
|
||||
const act = detectTerminalActivity(text);
|
||||
assert.equal(act.aiType, 'kilo');
|
||||
assert.equal(act.hasInteractiveMenu, true);
|
||||
const menu = detectInteractiveMenu(text);
|
||||
assert.equal(menu.axis, 'vertical');
|
||||
assert.equal(menu.menuTitle, 'Select model');
|
||||
const labels = menu.options.map(o => o.label);
|
||||
assert.ok(labels.includes('Anthropic: Claude Opus 5.5 Kilo Gateway'));
|
||||
assert.ok(labels.includes('OpenAI: GPT-6.2 Sol (new)'));
|
||||
});
|
||||
|
||||
test('Kilo CLI - saída por /exit devolve o prompt do shell (não é agente de IA)', () => {
|
||||
const act = detectTerminalActivity(kilo('exit-after'));
|
||||
assert.equal(act.hasAiActivity, false);
|
||||
assert.equal(act.aiType, null);
|
||||
assert.equal(act.shellType, 'powershell');
|
||||
});
|
||||
|
||||
test('Kilo CLI - pausa por limite usa o texto compartilhado de cota (texto próprio do Kilo não reproduzido: A DEFINIR)', () => {
|
||||
const act = detectTerminalActivity(kilo('idle') + '\nrate limit reached\n ctrl+p commands');
|
||||
assert.equal(act.aiType, 'kilo');
|
||||
assert.equal(act.isPaused, true);
|
||||
assert.equal(act.isThinking, false);
|
||||
assert.equal(act.details, 'Kilo CLI pausado por limite de uso');
|
||||
});
|
||||
|
||||
test('Kiro CLI - regressão: tela real do kiro-cli segue aiType kiro e não vira kilo', () => {
|
||||
const act = detectTerminalActivity(kiro('idle'));
|
||||
assert.equal(act.hasAiActivity, true);
|
||||
assert.equal(act.aiType, 'kiro');
|
||||
assert.equal(act.isThinking, false);
|
||||
assert.equal(act.details, 'Kiro CLI pronto');
|
||||
assert.doesNotMatch(kiro('idle'), /Kilo Gateway|ctrl\+x m|at top for controls/i, 'assinaturas do Kilo não aparecem no Kiro CLI');
|
||||
});
|
||||
|
||||
test('resolveTerminalLaunchSpec - kilo e kiro-cli têm comando próprio e saída por /exit', () => {
|
||||
assert.deepEqual(
|
||||
resolveTerminalLaunchSpec(kilo('idle'), { aiType: 'kilo', hasAiActivity: true }),
|
||||
{ preset: null, command: 'kilo', exitSequence: '/exit\\n' }
|
||||
);
|
||||
// Kiro nunca vira kilo/opencode por texto de tela
|
||||
assert.deepEqual(
|
||||
resolveTerminalLaunchSpec('Permission required\nctrl+f fullscreen opencode kilo', { aiType: 'kiro', hasAiActivity: true }),
|
||||
{ preset: null, command: 'kiro-cli', exitSequence: '/exit\\n' }
|
||||
);
|
||||
});
|
||||
|
||||
test('MaestriAdapter.listAgents - metadados do canvas mapeiam kilo, kilo <arg> e kiro-cli', async () => {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'maestri-kilo-ws-'));
|
||||
const workspacePath = path.join(tmpDir, 'workspace.json');
|
||||
const term = (name, command) => ({ id: name, content: { terminal: { _0: { name, command, agentType: 'custom' } } } });
|
||||
fs.writeFileSync(workspacePath, JSON.stringify({ payload: { nodes: [
|
||||
term('k1', 'kilo'), term('k2', 'kilo --continue'), term('r1', 'kiro-cli'), term('s1', 'node app.js')
|
||||
] } }), 'utf8');
|
||||
|
||||
const adapter = new MaestriAdapter({ workspaceFilePath: workspacePath, syncCanvasTerminals: true });
|
||||
adapter.runMaestri = async (args) => {
|
||||
if (args[0] === 'list') return { ok: true, output: 'You:\n - name: "maestri-remote"\n\nConnected agents:\n' };
|
||||
return { ok: false, output: '', error: 'No connection' };
|
||||
};
|
||||
const agents = await adapter.listAgents();
|
||||
const byName = Object.fromEntries(agents.map(a => [a.name, a]));
|
||||
assert.equal(byName.k1.aiType, 'kilo');
|
||||
assert.equal(byName.k2.aiType, 'kilo');
|
||||
assert.equal(byName.r1.aiType, 'kiro');
|
||||
assert.equal(byName.s1.hasAiActivity, false);
|
||||
fs.rmSync(tmpDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function makeDaemon(agentList) {
|
||||
const sent = [];
|
||||
const rawCalls = [];
|
||||
let askCalled = false;
|
||||
const adapter = {
|
||||
wait: async () => {},
|
||||
sendRawInput: async (agentName, seq) => { rawCalls.push({ agentName, seq }); return { ok: true, output: 'raw_ok' }; },
|
||||
askAgent: async () => { askCalled = true; return { ok: true, output: 'x' }; },
|
||||
checkAgent: async () => kilo('idle'),
|
||||
listAgents: async () => agentList
|
||||
};
|
||||
const daemon = new GatewayDaemon({ adapter });
|
||||
daemon.ws = { send: (s) => sent.push(JSON.parse(s)) };
|
||||
daemon.connected = true;
|
||||
return { daemon, sent, rawCalls, asked: () => askCalled };
|
||||
}
|
||||
|
||||
test('GatewayDaemon - /effort no Kilo não envia nada ao terminal e informa que o comando não existe', async () => {
|
||||
const { daemon, sent, rawCalls, asked } = makeDaemon([{ name: 'KiloAgent', aiType: 'kilo' }]);
|
||||
await daemon.syncAgents();
|
||||
sent.length = 0;
|
||||
await daemon.handleRelayMessage({ type: 'CHAT_SEND', chatId: 'c1', agentName: 'KiloAgent', message: '/effort high' });
|
||||
assert.deepEqual(rawCalls, []);
|
||||
assert.equal(asked(), false);
|
||||
const resp = sent.find(m => m.type === 'CHAT_RESPONSE');
|
||||
assert.ok(resp);
|
||||
assert.equal(resp.ok, false);
|
||||
assert.match(resp.reply, /Kilo CLI não tem o comando \/effort/);
|
||||
});
|
||||
|
||||
test('GatewayDaemon - /models no Kilo envia o texto e o Enter em escritas separadas, com filtro opcional', async () => {
|
||||
const { daemon, rawCalls } = makeDaemon([{ name: 'KiloAgent', aiType: 'kilo' }]);
|
||||
await daemon.syncAgents();
|
||||
await daemon.handleRelayMessage({ type: 'CHAT_SEND', chatId: 'c2', agentName: 'KiloAgent', message: '/models' });
|
||||
assert.deepEqual(rawCalls, [
|
||||
{ agentName: 'KiloAgent', seq: '\\x15/model' },
|
||||
{ agentName: 'KiloAgent', seq: '\\n' }
|
||||
]);
|
||||
rawCalls.length = 0;
|
||||
await daemon.handleRelayMessage({ type: 'CHAT_SEND', chatId: 'c3', agentName: 'KiloAgent', message: '/models claude' });
|
||||
assert.deepEqual(rawCalls, [
|
||||
{ agentName: 'KiloAgent', seq: '\\x15/model' },
|
||||
{ agentName: 'KiloAgent', seq: '\\n' },
|
||||
{ agentName: 'KiloAgent', seq: 'claude' }
|
||||
]);
|
||||
});
|
||||
|
||||
test('GatewayDaemon - /effort no Kiro CLI segue enviando o comando (regressão)', async () => {
|
||||
const { daemon, rawCalls } = makeDaemon([{ name: 'KiroAgent', aiType: 'kiro' }]);
|
||||
daemon.adapter.checkAgent = async () => kiro('idle');
|
||||
await daemon.syncAgents();
|
||||
await daemon.handleRelayMessage({ type: 'CHAT_SEND', chatId: 'c4', agentName: 'KiroAgent', message: '/effort' });
|
||||
assert.deepEqual(rawCalls, [{ agentName: 'KiroAgent', seq: '\\x15/effort\\n' }]);
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user