function addTaskNode(title, description, meta) { var stepsContainer = document.getElementById("vibeSteps"); if (!stepsContainer) return; stepsContainer.style.display = "flex"; var emptyState = document.getElementById("vibeCanvasEmpty"); if (emptyState) emptyState.style.display = "none"; nodeIdCounter++; meta = meta || {}; var fileCount = meta.estimated_files || meta.files || Math.floor(Math.random() * 15 + 3); var time = meta.estimated_time || meta.time || Math.floor(Math.random() * 20 + 5) + "m"; var tokens = meta.estimated_tokens || meta.tokens || "~" + Math.floor(Math.random() * 30 + 10) + "k tokens"; var status = meta.status || "Planning"; var fileList = meta.fileList || []; var isFirst = stepsContainer.children.length === 0; var nodeId = "vibe-node-" + nodeIdCounter; var statusBg = status === "Done" ? "var(--accent)" : status === "Planning" ? "var(--success-light, #eef8eb)" : "var(--warning-light, var(--bg)3cd)"; var statusColor = status === "Done" ? "var(--bg)" : status === "Planning" ? "var(--accent)" : "var(--warning, #856404)"; var subTasksHtml = ""; if (fileList.length > 0) { subTasksHtml = '"; } var node = document.createElement("div"); node.className = "vibe-task-node"; node.style.cssText = "background: var(--bg);border:" + (isFirst ? "2px solid var(--accent)" : "1px solid var(--border)") + ";border-radius:8px;width:280px;box-shadow:0 " + (isFirst ? "4" : "2") + "px 12px rgba(" + (isFirst ? "132,214,105,0.15" : "0,0,0,0.05") + ");position:relative;flex-shrink:0;animation:nodeIn 0.4s ease;"; node.innerHTML = '
' + '
' + "" + fileCount + " files" + time + "" + tokens + "" + "
" + '

' + esc(title) + "

" + '

' + esc(description) + "

" + "
" + '
' + '
' + 'Status' + '' + esc(status) + "" + "
" + '
' + 'Mantis Manager' + ' Mantis #1' + "
" + "
" + '
' + '
// SUB-TASKS â–¶
" + '
// LOGS â–¶
' + "
" + subTasksHtml; if (isFirst || stepsContainer.children.length > 0) { var line = document.createElement("div"); line.style.cssText = "position:absolute;right:-60px;top:50%;width:60px;height:2px;background:var(--accent);z-index:10;"; node.appendChild(line); if (!isFirst) { var dot = document.createElement("div"); dot.style.cssText = "position:absolute;left:-5px;top:50%;transform:translateY(-50%);width:10px;height:10px;border-radius:50%;background:var(--accent);z-index:20;"; node.appendChild(dot); } } stepsContainer.appendChild(node); stepsContainer.scrollLeft = stepsContainer.scrollWidth; taskNodes.push({ title: title, description: description, meta: meta, }); return node; }