Adicionar campo diretório de trabalho no modal de execução

- Campo execute-workdir no modal com valor pré-preenchido do agente
- Frontend envia workingDirectory na API de execução
- Backend aceita e aplica override de workingDirectory via metadata
- Pré-preenche com config do agente selecionado ao abrir modal
- Adiciona stopAll ao scheduler e limpa README
This commit is contained in:
Frederico Castro
2026-02-28 02:20:09 -03:00
parent 7a4ab2279d
commit fa47538a8f
8 changed files with 38 additions and 17 deletions

View File

@@ -38,8 +38,9 @@ const API = {
create(data) { return API.request('POST', '/agents', data); },
update(id, data) { return API.request('PUT', `/agents/${id}`, data); },
delete(id) { return API.request('DELETE', `/agents/${id}`); },
execute(id, task, instructions, contextFiles) {
execute(id, task, instructions, contextFiles, workingDirectory) {
const body = { task, instructions };
if (workingDirectory) body.workingDirectory = workingDirectory;
if (contextFiles && contextFiles.length > 0) body.contextFiles = contextFiles;
return API.request('POST', `/agents/${id}/execute`, body);
},

View File

@@ -874,6 +874,7 @@ const App = {
}
const instructions = document.getElementById('execute-instructions')?.value.trim() || '';
const workingDirectory = document.getElementById('execute-workdir')?.value.trim() || '';
try {
const selectEl = document.getElementById('execute-agent-select');
@@ -890,7 +891,7 @@ const App = {
Terminal.disableChat();
App._lastAgentName = agentName;
await API.agents.execute(agentId, task, instructions, contextFiles);
await API.agents.execute(agentId, task, instructions, contextFiles, workingDirectory);
if (dropzone) dropzone.reset();
Modal.close('execute-modal-overlay');

View File

@@ -366,6 +366,12 @@ const AgentsUI = {
if (App._executeDropzone) App._executeDropzone.reset();
const selectedAgent = allAgents.find(a => a.id === agentId);
const workdirEl = document.getElementById('execute-workdir');
if (workdirEl) {
workdirEl.value = (selectedAgent?.config?.workingDirectory) || '/home/projetos/';
}
AgentsUI._loadSavedTasks();
Modal.open('execute-modal-overlay');