Persistir output do terminal no servidor e corrigir cursor do flow editor
- Buffer server-side no executor para manter até 1000 linhas por execução ativa - Terminal restaura output do servidor ao recarregar a página (F5) - Fechar overlay do flow editor ao navegar para outra seção - Garantir SHELL e HOME no ambiente dos processos filhos
This commit is contained in:
@@ -90,6 +90,8 @@ const App = {
|
||||
history.pushState(null, '', `#${section}`);
|
||||
}
|
||||
|
||||
if (typeof FlowEditor !== 'undefined') FlowEditor._teardown();
|
||||
|
||||
document.querySelectorAll('.section').forEach((el) => {
|
||||
const isActive = el.id === section;
|
||||
el.classList.toggle('active', isActive);
|
||||
|
||||
@@ -737,8 +737,12 @@ const FlowEditor = {
|
||||
if (!leave) return;
|
||||
}
|
||||
|
||||
FlowEditor._teardown();
|
||||
},
|
||||
|
||||
_teardown() {
|
||||
const overlay = FlowEditor._overlay;
|
||||
if (!overlay) return;
|
||||
if (!overlay || overlay.hidden) return;
|
||||
|
||||
overlay.classList.remove('active');
|
||||
setTimeout(() => { overlay.hidden = true; }, 200);
|
||||
@@ -755,6 +759,7 @@ const FlowEditor = {
|
||||
FlowEditor._selectedNode = null;
|
||||
FlowEditor._dragState = null;
|
||||
FlowEditor._panStart = null;
|
||||
FlowEditor._dirty = false;
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -43,16 +43,35 @@ const Terminal = {
|
||||
try {
|
||||
const active = await API.system.activeExecutions();
|
||||
const hasActive = Array.isArray(active) && active.length > 0;
|
||||
if (hasActive && Terminal._restoreFromStorage()) {
|
||||
if (hasActive) {
|
||||
const exec = active[0];
|
||||
const serverBuffer = Array.isArray(exec.outputBuffer) ? exec.outputBuffer : [];
|
||||
|
||||
if (serverBuffer.length > 0) {
|
||||
Terminal.lines = serverBuffer.map((item) => {
|
||||
const time = new Date();
|
||||
return {
|
||||
content: item.content || '',
|
||||
type: item.type || 'default',
|
||||
timestamp: time.toTimeString().slice(0, 8),
|
||||
executionId: exec.executionId,
|
||||
};
|
||||
});
|
||||
Terminal._saveToStorage();
|
||||
} else {
|
||||
Terminal._restoreFromStorage();
|
||||
}
|
||||
|
||||
Terminal.render();
|
||||
const startedAt = exec.startedAt ? new Date(exec.startedAt).getTime() : null;
|
||||
const savedStart = sessionStorage.getItem(Terminal._timerStorageKey);
|
||||
Terminal._startTimer(savedStart ? Number(savedStart) : null);
|
||||
Terminal.startProcessing(active[0].agentConfig?.agent_name || 'Agente');
|
||||
Terminal._startTimer(savedStart ? Number(savedStart) : startedAt);
|
||||
Terminal.startProcessing(exec.agentConfig?.agent_name || 'Agente');
|
||||
try {
|
||||
const chatData = sessionStorage.getItem(Terminal._chatStorageKey);
|
||||
if (chatData) Terminal._chatSession = JSON.parse(chatData);
|
||||
} catch {}
|
||||
} else if (!hasActive) {
|
||||
} else {
|
||||
Terminal._clearStorage();
|
||||
Terminal._hideTimer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user