cast-code 1.0.8 → 1.0.10

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/kanban/views/kanban-ui.ts"],"sourcesContent":["export function getKanbanHtml(): string {\n return `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>cast · kanban</title>\n<style>\n * { box-sizing: border-box; margin: 0; padding: 0; }\n\n :root {\n --bg: #0d1117;\n --surface: #161b22;\n --card: #21262d;\n --border: #30363d;\n --border-hover: #484f58;\n --text: #e6edf3;\n --muted: #7d8590;\n --cyan: #58a6ff;\n --green: #3fb950;\n --yellow: #d29922;\n --red: #f85149;\n --orange: #e3b341;\n --purple: #bc8cff;\n }\n\n body {\n background: var(--bg);\n color: var(--text);\n font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;\n font-size: 13px;\n height: 100vh;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 12px 20px;\n border-bottom: 1px solid var(--border);\n background: var(--surface);\n flex-shrink: 0;\n }\n\n .logo {\n font-weight: 700;\n font-size: 14px;\n color: var(--cyan);\n letter-spacing: 0.05em;\n }\n\n .logo span {\n color: var(--muted);\n font-weight: 400;\n }\n\n .live-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background: var(--green);\n box-shadow: 0 0 6px var(--green);\n animation: pulse 2s infinite;\n }\n\n .live-dot.disconnected {\n background: var(--red);\n box-shadow: 0 0 6px var(--red);\n animation: none;\n }\n\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.4; }\n }\n\n .header-right {\n margin-left: auto;\n display: flex;\n align-items: center;\n gap: 16px;\n }\n\n .btn-primary {\n background: var(--cyan);\n color: var(--bg);\n border: none;\n padding: 6px 12px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n transition: opacity 0.2s;\n }\n\n .btn-primary:hover {\n opacity: 0.9;\n }\n\n .btn-primary:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .task-count {\n color: var(--muted);\n font-size: 12px;\n }\n\n .plan-badge {\n background: rgba(88, 166, 255, 0.1);\n border: 1px solid rgba(88, 166, 255, 0.3);\n color: var(--cyan);\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 11px;\n }\n\n /* Modal */\n .modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.7);\n display: none;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n backdrop-filter: blur(2px);\n }\n\n .modal {\n background: var(--surface);\n border: 1px solid var(--border);\n border-radius: 8px;\n width: 100%;\n max-width: 450px;\n padding: 24px;\n box-shadow: 0 10px 25px rgba(0,0,0,0.5);\n }\n\n .modal-title {\n font-size: 16px;\n font-weight: 700;\n margin-bottom: 20px;\n color: var(--cyan);\n }\n\n .form-group {\n margin-bottom: 16px;\n }\n\n .form-group label {\n display: block;\n font-size: 11px;\n color: var(--muted);\n text-transform: uppercase;\n margin-bottom: 6px;\n font-weight: 600;\n }\n\n .form-group input, .form-group textarea {\n width: 100%;\n background: var(--bg);\n border: 1px solid var(--border);\n border-radius: 4px;\n color: var(--text);\n padding: 8px 12px;\n font-family: inherit;\n font-size: 13px;\n outline: none;\n }\n\n .form-group input:focus, .form-group textarea:focus {\n border-color: var(--cyan);\n }\n\n .modal-actions {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n margin-top: 24px;\n }\n\n .btn-ghost {\n background: transparent;\n color: var(--muted);\n border: 1px solid var(--border);\n padding: 6px 12px;\n border-radius: 4px;\n font-size: 12px;\n cursor: pointer;\n }\n\n .btn-ghost:hover {\n border-color: var(--border-hover);\n color: var(--text);\n }\n\n .board {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n gap: 12px;\n padding: 16px;\n flex: 1;\n overflow: hidden;\n min-height: 0;\n }\n\n .column {\n background: var(--surface);\n border: 1px solid var(--border);\n border-radius: 8px;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n transition: background 0.2s;\n }\n\n .column.drag-over {\n background: rgba(88, 166, 255, 0.05);\n border-color: var(--cyan);\n }\n\n .column-header {\n padding: 10px 14px;\n border-bottom: 1px solid var(--border);\n display: flex;\n align-items: center;\n gap: 8px;\n flex-shrink: 0;\n }\n\n .column-label {\n font-size: 11px;\n font-weight: 700;\n text-transform: uppercase;\n letter-spacing: 0.08em;\n }\n\n .col-pending .column-label { color: var(--muted); }\n .col-inprogress .column-label { color: var(--orange); }\n .col-done .column-label { color: var(--green); }\n .col-failed .column-label { color: var(--red); }\n\n .col-inprogress { border-top: 2px solid var(--orange); }\n .col-done { border-top: 2px solid var(--green); }\n .col-failed { border-top: 2px solid var(--red); }\n .col-pending { border-top: 2px solid var(--border); }\n\n .column-count {\n margin-left: auto;\n background: var(--card);\n border: 1px solid var(--border);\n border-radius: 10px;\n padding: 1px 7px;\n font-size: 11px;\n color: var(--muted);\n min-width: 22px;\n text-align: center;\n }\n\n .cards {\n flex: 1;\n overflow-y: auto;\n padding: 10px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n min-height: 50px;\n }\n\n .cards::-webkit-scrollbar { width: 4px; }\n .cards::-webkit-scrollbar-track { background: transparent; }\n .cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }\n\n .card {\n background: var(--card);\n border: 1px solid var(--border);\n border-radius: 6px;\n padding: 10px 12px;\n cursor: grab;\n transition: border-color 0.15s, transform 0.15s;\n animation: cardIn 0.2s ease-out;\n position: relative;\n }\n\n .card:active {\n cursor: grabbing;\n }\n\n .card.dragging {\n opacity: 0.4;\n transform: scale(0.95);\n }\n\n @keyframes cardIn {\n from { opacity: 0; transform: translateY(-4px); }\n to { opacity: 1; transform: translateY(0); }\n }\n\n .card:hover {\n border-color: var(--border-hover);\n }\n\n .card:hover .card-actions {\n opacity: 1;\n }\n\n .card-actions {\n position: absolute;\n top: 8px;\n right: 8px;\n opacity: 0;\n transition: opacity 0.2s;\n }\n\n .btn-mini {\n background: var(--bg);\n border: 1px solid var(--border);\n color: var(--cyan);\n border-radius: 3px;\n padding: 2px 6px;\n font-size: 9px;\n font-weight: 700;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .btn-mini:hover {\n border-color: var(--cyan);\n }\n\n .btn-mini:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .card.highlight {\n animation: highlight 0.6s ease-out;\n }\n\n @keyframes highlight {\n 0% { border-color: var(--cyan); box-shadow: 0 0 8px rgba(88, 166, 255, 0.3); }\n 100% { border-color: var(--border); box-shadow: none; }\n }\n\n .card-top {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n margin-bottom: 6px;\n padding-right: 40px;\n }\n\n .card-id {\n color: var(--muted);\n font-size: 10px;\n flex-shrink: 0;\n margin-top: 2px;\n }\n\n .card-subject {\n font-weight: 600;\n font-size: 12px;\n line-height: 1.4;\n flex: 1;\n word-break: break-word;\n }\n\n .card-description {\n color: var(--muted);\n font-size: 11px;\n line-height: 1.5;\n margin-bottom: 8px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n }\n\n .card-footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 5px;\n }\n\n .badge {\n padding: 2px 6px;\n border-radius: 3px;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n }\n\n .badge-pending { background: rgba(125, 133, 144, 0.15); color: var(--muted); }\n .badge-in_progress { background: rgba(227, 179, 65, 0.15); color: var(--orange); }\n .badge-completed { background: rgba(63, 185, 80, 0.15); color: var(--green); }\n .badge-failed { background: rgba(248, 81, 73, 0.15); color: var(--red); }\n .badge-blocked { background: rgba(210, 153, 34, 0.15); color: var(--yellow); }\n .badge-cancelled { background: rgba(125, 133, 144, 0.1); color: var(--muted); }\n\n .badge-agent {\n background: rgba(188, 140, 255, 0.12);\n color: var(--purple);\n border: 1px solid rgba(188, 140, 255, 0.2);\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n }\n\n .badge-dep {\n background: rgba(88, 166, 255, 0.08);\n color: rgba(88, 166, 255, 0.6);\n border: 1px solid rgba(88, 166, 255, 0.15);\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n }\n\n .spinner {\n display: inline-block;\n width: 10px;\n height: 10px;\n border: 1.5px solid rgba(227, 179, 65, 0.2);\n border-top-color: var(--orange);\n border-radius: 50%;\n animation: spin 0.8s linear infinite;\n flex-shrink: 0;\n }\n\n @keyframes spin {\n to { transform: rotate(360deg); }\n }\n\n .empty-state {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--border);\n font-size: 11px;\n padding: 20px;\n text-align: center;\n }\n\n .thinking-indicator {\n color: var(--purple);\n font-size: 11px;\n display: flex;\n align-items: center;\n gap: 6px;\n }\n</style>\n</head>\n<body>\n\n<header>\n <div class=\"logo\">cast <span>·</span> kanban</div>\n <div class=\"live-dot\" id=\"liveDot\"></div>\n <div id=\"header-right-container\" class=\"header-right\">\n <button class=\"btn-primary\" onclick=\"showModal()\">+ New Task</button>\n <span class=\"task-count\" id=\"taskCount\">0 tasks</span>\n <span class=\"plan-badge\" id=\"planBadge\" style=\"display:none\"></span>\n </div>\n</header>\n\n<div class=\"board\">\n <div class=\"column col-pending\" id=\"col-pending\" ondragover=\"handleDragOver(event)\" ondragleave=\"handleDragLeave(event)\" ondrop=\"handleDrop(event, 'pending')\">\n <div class=\"column-header\">\n <span class=\"column-label\">To-Do</span>\n <button id=\"btn-auto-planner\" class=\"btn-mini\" style=\"margin-left: 10px; border-color: var(--purple); color: var(--purple);\" onclick=\"runAutoPlanner()\">⚡ Run</button>\n <span class=\"column-count\" id=\"count-pending\">0</span>\n </div>\n <div class=\"cards\" id=\"cards-pending\"></div>\n </div>\n <div class=\"column col-inprogress\" id=\"col-inprogress\" ondragover=\"handleDragOver(event)\" ondragleave=\"handleDragLeave(event)\" ondrop=\"handleDrop(event, 'in_progress')\">\n <div class=\"column-header\">\n <span class=\"column-label\">In Progress</span>\n <span class=\"column-count\" id=\"count-inprogress\">0</span>\n </div>\n <div class=\"cards\" id=\"cards-inprogress\"></div>\n </div>\n <div class=\"column col-done\" id=\"col-done\" ondragover=\"handleDragOver(event)\" ondragleave=\"handleDragLeave(event)\" ondrop=\"handleDrop(event, 'completed')\">\n <div class=\"column-header\">\n <span class=\"column-label\">Done</span>\n <span class=\"column-count\" id=\"count-done\">0</span>\n </div>\n <div class=\"cards\" id=\"cards-done\"></div>\n </div>\n <div class=\"column col-failed\" id=\"col-failed\" ondragover=\"handleDragOver(event)\" ondragleave=\"handleDragLeave(event)\" ondrop=\"handleDrop(event, 'failed')\">\n <div class=\"column-header\">\n <span class=\"column-label\">Failed / Blocked</span>\n <span class=\"column-count\" id=\"count-failed\">0</span>\n </div>\n <div class=\"cards\" id=\"cards-failed\"></div>\n </div>\n</div>\n\n<div class=\"modal-overlay\" id=\"modalOverlay\">\n <div class=\"modal\">\n <div class=\"modal-title\">Create New Task</div>\n <div class=\"form-group\">\n <label>Subject</label>\n <input type=\"text\" id=\"taskSubject\" placeholder=\"What needs to be done?\">\n </div>\n <div class=\"form-group\">\n <label>Description (Optional)</label>\n <textarea id=\"taskDescription\" rows=\"3\" placeholder=\"Add more details...\"></textarea>\n </div>\n <div class=\"modal-actions\">\n <button class=\"btn-ghost\" onclick=\"hideModal()\">Cancel</button>\n <button class=\"btn-primary\" onclick=\"createTask()\">Create Task</button>\n </div>\n </div>\n</div>\n\n<script>\n const COL_MAP = {\n pending: 'pending',\n in_progress: 'inprogress',\n completed: 'done',\n failed: 'failed',\n blocked: 'failed',\n cancelled: 'failed',\n };\n\n let tasks = {};\n let sseRetryTimer = null;\n let isAutoPlanning = false;\n\n // Drag and Drop State\n let draggedTaskId = null;\n\n function handleDragStart(e, taskId) {\n draggedTaskId = taskId;\n e.target.classList.add('dragging');\n e.dataTransfer.setData('text/plain', taskId);\n e.dataTransfer.effectAllowed = 'move';\n }\n\n function handleDragEnd(e) {\n e.target.classList.remove('dragging');\n draggedTaskId = null;\n }\n\n function handleDragOver(e) {\n e.preventDefault();\n e.currentTarget.classList.add('drag-over');\n e.dataTransfer.dropEffect = 'move';\n }\n\n function handleDragLeave(e) {\n e.currentTarget.classList.remove('drag-over');\n }\n\n async function handleDrop(e, targetStatus) {\n e.preventDefault();\n e.currentTarget.classList.remove('drag-over');\n \n const taskId = e.dataTransfer.getData('text/plain');\n const task = tasks[taskId];\n \n if (!task || task.status === targetStatus) return;\n\n // Rules\n if (task.status === 'completed' && targetStatus === 'in_progress') {\n const reason = prompt(\\`Why are you redoing task \"\\${task.subject}\"?\\`);\n if (!reason) return;\n \n await updateTask(taskId, { \n status: targetStatus,\n metadata: { ...task.metadata, redoReason: reason, redoneAt: Date.now() }\n });\n } else {\n await updateTask(taskId, { status: targetStatus });\n }\n }\n\n async function runAutoPlanner() {\n if (isAutoPlanning) return;\n isAutoPlanning = true;\n renderHeaderRight();\n document.getElementById('btn-auto-planner').disabled = true;\n\n try {\n await fetch('/api/tasks/auto-execute', { method: 'POST' });\n } catch (err) {\n console.error('Failed to start auto-planner:', err);\n isAutoPlanning = false;\n renderHeaderRight();\n document.getElementById('btn-auto-planner').disabled = false;\n }\n }\n\n function renderHeaderRight() {\n const container = document.getElementById('header-right-container');\n const thinking = isAutoPlanning ? '<span class=\"thinking-indicator\"><div class=\"spinner\" style=\"border-top-color:var(--purple)\"></div> Auto-Planner thinking...</span>' : '';\n \n container.innerHTML = \\`\n \\${thinking}\n <button class=\"btn-primary\" onclick=\"showModal()\">+ New Task</button>\n <span class=\"task-count\" id=\"taskCount\">\\${Object.keys(tasks).length} tasks</span>\n <span class=\"plan-badge\" id=\"planBadge\" style=\"display:none\"></span>\n \\`;\n }\n\n function showModal() {\n document.getElementById('modalOverlay').style.display = 'flex';\n document.getElementById('taskSubject').focus();\n }\n\n function hideModal() {\n document.getElementById('modalOverlay').style.display = 'none';\n document.getElementById('taskSubject').value = '';\n document.getElementById('taskDescription').value = '';\n }\n\n async function createTask() {\n const subject = document.getElementById('taskSubject').value.trim();\n const description = document.getElementById('taskDescription').value.trim();\n\n if (!subject) return;\n\n try {\n const res = await fetch('/api/tasks', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ subject, description })\n });\n \n if (res.ok) {\n hideModal();\n }\n } catch (err) {\n console.error('Failed to create task:', err);\n }\n }\n\n async function updateTask(taskId, updates) {\n try {\n await fetch(\\`/api/tasks/\\${taskId}\\`, {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(updates)\n });\n } catch (err) {\n console.error('Failed to update task:', err);\n }\n }\n\n async function executeTask(taskId) {\n try {\n await fetch(\\`/api/tasks/\\${taskId}/execute\\`, { method: 'POST' });\n } catch (err) {\n console.error('Failed to execute task:', err);\n }\n }\n\n function col(status) {\n return COL_MAP[status] || 'pending';\n }\n\n function makeCard(task) {\n const colKey = col(task.status);\n const isInProgress = task.status === 'in_progress';\n const isPending = task.status === 'pending';\n\n const depBadges = task.dependencies.length > 0\n ? task.dependencies.map(d => '<span class=\"badge badge-dep\">↳ ' + d + '</span>').join('')\n : '';\n\n const agentBadge = task.assignedAgent\n ? '<span class=\"badge badge-agent\">⬡ ' + task.assignedAgent + '</span>'\n : '';\n\n const spinner = isInProgress ? '<div class=\"spinner\"></div>' : '';\n \n const actionBtn = isPending \n ? \\`<div class=\"card-actions\"><button class=\"btn-mini\" onclick=\"executeTask('\\${task.id}')\">Run</button></div>\\` \n : '';\n\n return \\`\n <div class=\"card\" \n id=\"card-\\${task.id}\" \n data-status=\"\\${task.status}\" \n draggable=\"true\" \n onsubmit=\"return false;\"\n ondragstart=\"handleDragStart(event, '\\${task.id}')\"\n ondragend=\"handleDragEnd(event)\">\n \\${actionBtn}\n <div class=\"card-top\">\n \\${spinner}\n <span class=\"card-id\">\\${task.id}</span>\n <span class=\"card-subject\">\\${escHtml(task.subject)}</span>\n </div>\n \\${task.description ? '<div class=\"card-description\">' + escHtml(task.description) + '</div>' : ''}\n <div class=\"card-footer\">\n <span class=\"badge badge-\\${task.status}\">\\${task.status.replace('_', ' ')}</span>\n \\${agentBadge}\n \\${depBadges}\n </div>\n </div>\n \\`;\n }\n\n function escHtml(str) {\n return str.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\"/g,'&quot;');\n }\n\n function renderAll() {\n const cols = { pending: [], inprogress: [], done: [], failed: [] };\n\n for (const task of Object.values(tasks)) {\n cols[col(task.status)].push(task);\n }\n\n for (const [key, list] of Object.entries(cols)) {\n const container = document.getElementById('cards-' + key);\n const count = document.getElementById('count-' + key);\n\n if (list.length === 0) {\n container.innerHTML = '<div class=\"empty-state\">—</div>';\n } else {\n container.innerHTML = list.map(makeCard).join('');\n }\n count.textContent = list.length;\n }\n\n renderHeaderRight();\n }\n\n function upsertTask(task) {\n const existed = !!tasks[task.id];\n tasks[task.id] = task;\n\n if (task.status === 'in_progress' || task.status === 'completed') {\n // If we get an update that is progress, stop showing auto-planner thinking\n if (isAutoPlanning) {\n isAutoPlanning = false;\n renderHeaderRight();\n document.getElementById('btn-auto-planner').disabled = false;\n }\n }\n\n if (existed) {\n const card = document.getElementById('card-' + task.id);\n const newColKey = col(task.status);\n\n if (card) {\n const currentContainer = card.parentElement;\n const targetContainer = document.getElementById('cards-' + newColKey);\n\n if (currentContainer !== targetContainer) {\n renderAll();\n } else {\n card.outerHTML = makeCard(task);\n const updated = document.getElementById('card-' + task.id);\n if (updated) {\n updated.classList.add('highlight');\n setTimeout(() => updated.classList.remove('highlight'), 700);\n }\n updateCounts();\n }\n } else {\n renderAll();\n }\n } else {\n renderAll();\n }\n }\n\n function updateCounts() {\n const cols = { pending: 0, inprogress: 0, done: 0, failed: 0 };\n for (const task of Object.values(tasks)) {\n cols[col(task.status)]++;\n }\n for (const [key, count] of Object.entries(cols)) {\n document.getElementById('count-' + key).textContent = count;\n }\n renderHeaderRight();\n }\n\n async function loadState() {\n try {\n const res = await fetch('/api/state');\n const data = await res.json();\n tasks = {};\n for (const t of data.tasks) tasks[t.id] = t;\n\n if (data.plans && data.plans.length > 0) {\n const plan = data.plans[data.plans.length - 1];\n const badge = document.getElementById('planBadge');\n badge.textContent = plan.title;\n badge.style.display = 'inline';\n }\n\n renderAll();\n } catch {}\n }\n\n function connectSSE() {\n const dot = document.getElementById('liveDot');\n const es = new EventSource('/api/events');\n\n es.onopen = () => {\n dot.classList.remove('disconnected');\n if (sseRetryTimer) { clearTimeout(sseRetryTimer); sseRetryTimer = null; }\n };\n\n es.addEventListener('task:created', e => {\n const task = JSON.parse(e.data);\n upsertTask(task);\n });\n\n es.addEventListener('task:updated', e => {\n const task = JSON.parse(e.data);\n upsertTask(task);\n });\n\n es.addEventListener('plan:created', e => {\n const plan = JSON.parse(e.data);\n const badge = document.getElementById('planBadge');\n badge.textContent = plan.title;\n badge.style.display = 'inline';\n });\n\n es.onerror = () => {\n dot.classList.add('disconnected');\n es.close();\n sseRetryTimer = setTimeout(connectSSE, 3000);\n };\n }\n\n loadState().then(connectSSE);\n</script>\n</body>\n</html>`;\n}\n"],"names":["getKanbanHtml"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA;IACd,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA20BH,CAAC;AACR"}
@@ -26,6 +26,7 @@ const _mcpmodule = require("../mcp/mcp.module");
26
26
  const _projectmodule = require("../project/project.module");
27
27
  const _memorymodule = require("../memory/memory.module");
28
28
  const _config = require("../config");
29
+ const _kanbanmodule = require("../kanban/kanban.module");
29
30
  function _ts_decorate(decorators, target, key, desc) {
30
31
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31
32
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -45,7 +46,8 @@ ReplModule = _ts_decorate([
45
46
  _skillsmodule.SkillsModule,
46
47
  _mcpmodule.McpModule,
47
48
  _projectmodule.ProjectModule,
48
- _memorymodule.MemoryModule
49
+ _memorymodule.MemoryModule,
50
+ _kanbanmodule.KanbanModule
49
51
  ],
50
52
  providers: [
51
53
  _replservice.ReplService,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/modules/repl/repl.module.ts"],"sourcesContent":["import { Module } from '@nestjs/common';\nimport { ReplService } from './services/repl.service';\nimport { WelcomeScreenService } from './services/welcome-screen.service';\nimport { ReplCommandsService } from './services/commands/repl-commands.service';\nimport { GitCommandsService } from './services/commands/git-commands.service';\nimport { AgentCommandsService } from './services/commands/agent-commands.service';\nimport { McpCommandsService } from './services/commands/mcp-commands.service';\nimport { ConfigCommandsService } from '../config/services/config-commands.service';\nimport { ProjectCommandsService } from './services/commands/project-commands.service';\nimport { CoreModule } from '../core/core.module';\nimport { ToolsModule } from '../tools/tools.module';\nimport { GitModule } from '../git/git.module';\nimport { AgentsModule } from '../agents/agents.module';\nimport { SkillsModule } from '../skills/skills.module';\nimport { McpModule } from '../mcp/mcp.module';\nimport { ProjectModule } from '../project/project.module';\nimport { MemoryModule } from '../memory/memory.module';\nimport { ConfigModule } from '../config';\n\n@Module({\n imports: [ConfigModule, CoreModule, ToolsModule, GitModule, AgentsModule, SkillsModule, McpModule, ProjectModule, MemoryModule],\n providers: [\n ReplService,\n WelcomeScreenService,\n ReplCommandsService,\n GitCommandsService,\n AgentCommandsService,\n McpCommandsService,\n ConfigCommandsService,\n ProjectCommandsService,\n ],\n exports: [ReplService],\n})\nexport class ReplModule {}\n"],"names":["ReplModule","imports","ConfigModule","CoreModule","ToolsModule","GitModule","AgentsModule","SkillsModule","McpModule","ProjectModule","MemoryModule","providers","ReplService","WelcomeScreenService","ReplCommandsService","GitCommandsService","AgentCommandsService","McpCommandsService","ConfigCommandsService","ProjectCommandsService","exports"],"mappings":";;;;+BAiCaA;;;eAAAA;;;wBAjCU;6BACK;sCACS;qCACD;oCACD;sCACE;oCACF;uCACG;wCACC;4BACZ;6BACC;2BACF;8BACG;8BACA;2BACH;+BACI;8BACD;wBACA;;;;;;;AAgBtB,IAAA,AAAMA,aAAN,MAAMA;AAAY;;;QAbvBC,SAAS;YAACC,oBAAY;YAAEC,sBAAU;YAAEC,wBAAW;YAAEC,oBAAS;YAAEC,0BAAY;YAAEC,0BAAY;YAAEC,oBAAS;YAAEC,4BAAa;YAAEC,0BAAY;SAAC;QAC/HC,WAAW;YACTC,wBAAW;YACXC,0CAAoB;YACpBC,wCAAmB;YACnBC,sCAAkB;YAClBC,0CAAoB;YACpBC,sCAAkB;YAClBC,4CAAqB;YACrBC,8CAAsB;SACvB;QACDC,SAAS;YAACR,wBAAW;SAAC"}
1
+ {"version":3,"sources":["../../../src/modules/repl/repl.module.ts"],"sourcesContent":["import { Module } from '@nestjs/common';\nimport { ReplService } from './services/repl.service';\nimport { WelcomeScreenService } from './services/welcome-screen.service';\nimport { ReplCommandsService } from './services/commands/repl-commands.service';\nimport { GitCommandsService } from './services/commands/git-commands.service';\nimport { AgentCommandsService } from './services/commands/agent-commands.service';\nimport { McpCommandsService } from './services/commands/mcp-commands.service';\nimport { ConfigCommandsService } from '../config/services/config-commands.service';\nimport { ProjectCommandsService } from './services/commands/project-commands.service';\nimport { CoreModule } from '../core/core.module';\nimport { ToolsModule } from '../tools/tools.module';\nimport { GitModule } from '../git/git.module';\nimport { AgentsModule } from '../agents/agents.module';\nimport { SkillsModule } from '../skills/skills.module';\nimport { McpModule } from '../mcp/mcp.module';\nimport { ProjectModule } from '../project/project.module';\nimport { MemoryModule } from '../memory/memory.module';\nimport { ConfigModule } from '../config';\nimport { KanbanModule } from '../kanban/kanban.module';\n\n@Module({\n imports: [ConfigModule, CoreModule, ToolsModule, GitModule, AgentsModule, SkillsModule, McpModule, ProjectModule, MemoryModule, KanbanModule],\n providers: [\n ReplService,\n WelcomeScreenService,\n ReplCommandsService,\n GitCommandsService,\n AgentCommandsService,\n McpCommandsService,\n ConfigCommandsService,\n ProjectCommandsService,\n ],\n exports: [ReplService],\n})\nexport class ReplModule {}\n"],"names":["ReplModule","imports","ConfigModule","CoreModule","ToolsModule","GitModule","AgentsModule","SkillsModule","McpModule","ProjectModule","MemoryModule","KanbanModule","providers","ReplService","WelcomeScreenService","ReplCommandsService","GitCommandsService","AgentCommandsService","McpCommandsService","ConfigCommandsService","ProjectCommandsService","exports"],"mappings":";;;;+BAkCaA;;;eAAAA;;;wBAlCU;6BACK;sCACS;qCACD;oCACD;sCACE;oCACF;uCACG;wCACC;4BACZ;6BACC;2BACF;8BACG;8BACA;2BACH;+BACI;8BACD;wBACA;8BACA;;;;;;;AAgBtB,IAAA,AAAMA,aAAN,MAAMA;AAAY;;;QAbvBC,SAAS;YAACC,oBAAY;YAAEC,sBAAU;YAAEC,wBAAW;YAAEC,oBAAS;YAAEC,0BAAY;YAAEC,0BAAY;YAAEC,oBAAS;YAAEC,4BAAa;YAAEC,0BAAY;YAAEC,0BAAY;SAAC;QAC7IC,WAAW;YACTC,wBAAW;YACXC,0CAAoB;YACpBC,wCAAmB;YACnBC,sCAAkB;YAClBC,0CAAoB;YACpBC,sCAAkB;YAClBC,4CAAqB;YACrBC,8CAAsB;SACvB;QACDC,SAAS;YAACR,wBAAW;SAAC"}
@@ -26,6 +26,7 @@ const _mcpcommandsservice = require("./commands/mcp-commands.service");
26
26
  const _configcommandsservice = require("../../config/services/config-commands.service");
27
27
  const _projectcommandsservice = require("./commands/project-commands.service");
28
28
  const _toolsregistryservice = require("../../tools/services/tools-registry.service");
29
+ const _kanbanserverservice = require("../../kanban/services/kanban-server.service");
29
30
  const _theme = require("../utils/theme");
30
31
  function _ts_decorate(decorators, target, key, desc) {
31
32
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -193,6 +194,11 @@ let ReplService = class ReplService {
193
194
  text: '/mcp',
194
195
  display: '/mcp',
195
196
  description: 'MCP servers'
197
+ },
198
+ {
199
+ text: '/kanban',
200
+ display: '/kanban',
201
+ description: 'Open kanban board'
196
202
  }
197
203
  ];
198
204
  return commands.filter((c)=>c.text.startsWith(input));
@@ -396,6 +402,9 @@ let ReplService = class ReplService {
396
402
  'deep'
397
403
  ], this.smartInput);
398
404
  break;
405
+ case 'kanban':
406
+ this.kanbanServer.start();
407
+ break;
399
408
  default:
400
409
  process.stdout.write(`${_theme.Colors.red} Unknown: /${cmd}${_theme.Colors.reset} ${_theme.Colors.dim}Try /help${_theme.Colors.reset}\r\n`);
401
410
  }
@@ -610,7 +619,7 @@ let ReplService = class ReplService {
610
619
  this.stopSpinner();
611
620
  this.smartInput?.destroy();
612
621
  }
613
- constructor(deepAgent, configService, configManager, mentionsService, mcpRegistry, agentRegistry, skillRegistry, welcomeScreen, planMode, replCommands, gitCommands, agentCommands, mcpCommands, configCommands, projectCommands, toolsRegistry){
622
+ constructor(deepAgent, configService, configManager, mentionsService, mcpRegistry, agentRegistry, skillRegistry, welcomeScreen, planMode, replCommands, gitCommands, agentCommands, mcpCommands, configCommands, projectCommands, toolsRegistry, kanbanServer){
614
623
  this.deepAgent = deepAgent;
615
624
  this.configService = configService;
616
625
  this.configManager = configManager;
@@ -627,6 +636,7 @@ let ReplService = class ReplService {
627
636
  this.configCommands = configCommands;
628
637
  this.projectCommands = projectCommands;
629
638
  this.toolsRegistry = toolsRegistry;
639
+ this.kanbanServer = kanbanServer;
630
640
  this.smartInput = null;
631
641
  this.abortController = null;
632
642
  this.isProcessing = false;
@@ -652,7 +662,8 @@ ReplService = _ts_decorate([
652
662
  typeof _mcpcommandsservice.McpCommandsService === "undefined" ? Object : _mcpcommandsservice.McpCommandsService,
653
663
  typeof _configcommandsservice.ConfigCommandsService === "undefined" ? Object : _configcommandsservice.ConfigCommandsService,
654
664
  typeof _projectcommandsservice.ProjectCommandsService === "undefined" ? Object : _projectcommandsservice.ProjectCommandsService,
655
- typeof _toolsregistryservice.ToolsRegistryService === "undefined" ? Object : _toolsregistryservice.ToolsRegistryService
665
+ typeof _toolsregistryservice.ToolsRegistryService === "undefined" ? Object : _toolsregistryservice.ToolsRegistryService,
666
+ typeof _kanbanserverservice.KanbanServerService === "undefined" ? Object : _kanbanserverservice.KanbanServerService
656
667
  ])
657
668
  ], ReplService);
658
669
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/repl/services/repl.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { DeepAgentService } from '../../core/services/deep-agent.service';\nimport { ConfigService } from '../../../common/services/config.service';\nimport { ConfigManagerService } from '../../config/services/config-manager.service';\nimport { MentionsService } from '../../mentions/services/mentions.service';\nimport { McpRegistryService } from '../../mcp/services/mcp-registry.service';\nimport { AgentRegistryService } from '../../agents/services/agent-registry.service';\nimport { SkillRegistryService } from '../../skills/services/skill-registry.service';\nimport { PlanModeService } from '../../core/services/plan-mode.service';\nimport { SmartInput } from './smart-input';\nimport { WelcomeScreenService } from './welcome-screen.service';\nimport { ReplCommandsService } from './commands/repl-commands.service';\nimport { GitCommandsService } from './commands/git-commands.service';\nimport { AgentCommandsService } from './commands/agent-commands.service';\nimport { McpCommandsService } from './commands/mcp-commands.service';\nimport { ConfigCommandsService } from '../../config/services/config-commands.service';\nimport { ProjectCommandsService } from './commands/project-commands.service';\nimport { ToolsRegistryService } from '../../tools/services/tools-registry.service';\nimport { Colors, Icons } from '../utils/theme';\n\n@Injectable()\nexport class ReplService {\n private smartInput: SmartInput | null = null;\n private abortController: AbortController | null = null;\n private isProcessing = false;\n private spinnerTimer: ReturnType<typeof setInterval> | null = null;\n\n constructor(\n private readonly deepAgent: DeepAgentService,\n private readonly configService: ConfigService,\n private readonly configManager: ConfigManagerService,\n private readonly mentionsService: MentionsService,\n private readonly mcpRegistry: McpRegistryService,\n private readonly agentRegistry: AgentRegistryService,\n private readonly skillRegistry: SkillRegistryService,\n private readonly welcomeScreen: WelcomeScreenService,\n private readonly planMode: PlanModeService,\n private readonly replCommands: ReplCommandsService,\n private readonly gitCommands: GitCommandsService,\n private readonly agentCommands: AgentCommandsService,\n private readonly mcpCommands: McpCommandsService,\n private readonly configCommands: ConfigCommandsService,\n private readonly projectCommands: ProjectCommandsService,\n private readonly toolsRegistry: ToolsRegistryService,\n ) {}\n\n async start(): Promise<void> {\n const initResult = await this.deepAgent.initialize();\n const agentCount = this.agentRegistry.resolveAllAgents().length;\n\n this.welcomeScreen.printWelcomeScreen({\n projectPath: initResult.projectPath || undefined,\n model: this.getModelDisplayName(),\n toolCount: initResult.toolCount,\n agentCount,\n });\n\n this.smartInput = new SmartInput({\n prompt: `${Colors.cyan}${Colors.bold}>${Colors.reset} `,\n promptVisibleLen: 2,\n getCommandSuggestions: (input) => this.getCommandSuggestions(input),\n getMentionSuggestions: (partial) => this.getMentionSuggestions(partial),\n onSubmit: (line) => this.handleLine(line),\n onCancel: () => this.handleCancel(),\n onExit: () => this.handleExit(),\n });\n\n this.smartInput.start();\n }\n\n private getCommandSuggestions(input: string): Array<{ text: string; display: string; description: string }> {\n const commands = [\n { text: '/help', display: '/help', description: 'Show help' },\n { text: '/clear', display: '/clear', description: 'Clear conversation' },\n { text: '/compact', display: '/compact', description: 'Compact history' },\n { text: '/exit', display: '/exit', description: 'Exit' },\n { text: '/status', display: '/status', description: 'Git status' },\n { text: '/diff', display: '/diff', description: 'Git diff' },\n { text: '/log', display: '/log', description: 'Git log' },\n { text: '/commit', display: '/commit', description: 'Commit changes' },\n { text: '/up', display: '/up', description: 'Smart commit & push' },\n { text: '/split-up', display: '/split-up', description: 'Split commits' },\n { text: '/pr', display: '/pr', description: 'Create Pull Request' },\n { text: '/unit-test', display: '/unit-test', description: 'Generate unit tests' },\n { text: '/review', display: '/review', description: 'Code review' },\n { text: '/fix', display: '/fix', description: 'Auto-fix code' },\n { text: '/ident', display: '/ident', description: 'Format code' },\n { text: '/release', display: '/release', description: 'Release notes' },\n { text: '/tools', display: '/tools', description: 'List tools' },\n { text: '/agents', display: '/agents', description: 'List agents' },\n { text: '/skills', display: '/skills', description: 'List skills' },\n { text: '/context', display: '/context', description: 'Session info' },\n { text: '/mentions', display: '/mentions', description: 'Mentions help' },\n { text: '/model', display: '/model', description: 'Show model' },\n { text: '/config', display: '/config', description: 'Configuration' },\n { text: '/project', display: '/project', description: 'Project context' },\n { text: '/project-deep', display: '/project-deep', description: 'Deep project analysis' },\n { text: '/init', display: '/init', description: 'Analyze project and generate context' },\n { text: '/mcp', display: '/mcp', description: 'MCP servers' },\n ];\n\n return commands.filter(c => c.text.startsWith(input));\n }\n\n private getMentionSuggestions(partial: string): Array<{ text: string; display: string; description: string }> {\n const fs = require('fs');\n const path = require('path');\n\n const gitOpts = [\n { text: '@git:status', display: '@git:status', description: 'Git status' },\n { text: '@git:diff', display: '@git:diff', description: 'Git diff' },\n { text: '@git:log', display: '@git:log', description: 'Git log' },\n { text: '@git:branch', display: '@git:branch', description: 'Branches' },\n ];\n\n if (partial === '') return [...gitOpts, ...this.getFileEntries('')];\n if (partial.startsWith('git:')) return gitOpts.filter(o => o.text.startsWith('@' + partial));\n\n return [...gitOpts.filter(o => o.text.startsWith('@' + partial)), ...this.getFileEntries(partial)].slice(0, 30);\n }\n\n private getFileEntries(partial: string): Array<{ text: string; display: string; description: string }> {\n const fs = require('fs');\n const path = require('path');\n\n try {\n let dir: string;\n let prefix: string;\n\n if (partial.endsWith('/')) {\n dir = partial.slice(0, -1) || '.';\n prefix = '';\n } else if (partial.includes('/')) {\n dir = path.dirname(partial);\n prefix = path.basename(partial);\n } else {\n dir = '.';\n prefix = partial;\n }\n\n const resolved = path.resolve(process.cwd(), dir);\n if (!fs.existsSync(resolved) || !fs.statSync(resolved).isDirectory()) return [];\n\n const entries = fs.readdirSync(resolved, { withFileTypes: true });\n const ignore = ['node_modules', '.git', 'dist', 'coverage', '.next', '__pycache__'];\n\n return entries\n .filter(e => !ignore.includes(e.name))\n .filter(e => !e.name.startsWith('.') || prefix.startsWith('.'))\n .filter(e => prefix === '' || e.name.toLowerCase().startsWith(prefix.toLowerCase()))\n .map(e => {\n const relDir = dir === '.' ? '' : dir + '/';\n const isDir = e.isDirectory();\n return {\n text: '@' + relDir + e.name + (isDir ? '/' : ''),\n display: '@' + relDir + e.name + (isDir ? '/' : ''),\n description: isDir ? 'dir' : '',\n };\n })\n .slice(0, 20);\n } catch {\n return [];\n }\n }\n\n private handleCancel(): void {\n if (this.isProcessing && this.abortController) {\n this.abortController.abort();\n this.stopSpinner();\n process.stdout.write(`\\r\\n${Colors.yellow} Cancelled${Colors.reset}\\r\\n\\r\\n`);\n this.isProcessing = false;\n } else {\n process.stdout.write(`${Colors.dim} (Use /exit to quit)${Colors.reset}\\r\\n`);\n this.smartInput?.showPrompt();\n }\n }\n\n private handleExit(): void {\n process.stdout.write(`${Colors.dim} Goodbye!${Colors.reset}\\r\\n`);\n this.stop();\n process.exit(0);\n }\n\n private async handleLine(input: string): Promise<void> {\n const trimmed = input.trim();\n\n if (!trimmed) {\n this.smartInput?.showPrompt();\n return;\n }\n\n if (trimmed.startsWith('/')) {\n await this.handleCommand(trimmed);\n } else {\n await this.handleMessage(trimmed);\n }\n\n this.smartInput?.showPrompt();\n }\n\n private async handleCommand(command: string): Promise<void> {\n const parts = command.slice(1).split(/\\s+/);\n const cmd = parts[0].toLowerCase();\n const args = parts.slice(1);\n\n switch (cmd) {\n case 'help': this.replCommands.printHelp(); break;\n case 'clear': this.replCommands.cmdClear(this.welcomeScreen); break;\n case 'exit':\n case 'quit': this.handleExit(); return;\n case 'compact': await this.handleCompact(); break;\n case 'context': this.replCommands.cmdContext(); break;\n case 'config':\n await this.configCommands.handleConfigCommand(args, this.smartInput!);\n await this.configManager.loadConfig();\n await this.deepAgent.reinitializeModel();\n break;\n case 'model': this.replCommands.cmdModel(args); break;\n case 'init':\n await this.projectCommands.cmdProject(['analyze'], this.smartInput!);\n break;\n case 'mentions': this.replCommands.cmdMentionsHelp(); break;\n case 'tools': this.cmdTools(); break;\n\n case 'status': this.gitCommands.runGit('git status'); break;\n case 'diff': this.gitCommands.runGit(args.length ? `git diff ${args.join(' ')}` : 'git diff'); break;\n case 'log': this.gitCommands.runGit('git log --oneline -15'); break;\n case 'commit': \n await this.gitCommands.cmdCommit(args, this.smartInput!); \n break;\n case 'up': \n await this.gitCommands.cmdUp(this.smartInput!); \n break;\n case 'split-up': \n await this.gitCommands.cmdSplitUp(this.smartInput!); \n break;\n case 'pr': \n await this.gitCommands.cmdPr(this.smartInput!); \n break;\n case 'unit-test':\n await this.gitCommands.cmdUnitTest(this.smartInput!);\n break;\n case 'review': await this.gitCommands.cmdReview(args); break;\n case 'fix': await this.gitCommands.cmdFix(args); break;\n case 'ident': await this.gitCommands.cmdIdent(); break;\n case 'release': await this.gitCommands.cmdRelease(args); break;\n\n case 'agents': \n await this.agentCommands.cmdAgents(args, this.smartInput!); \n break;\n case 'skills': \n await this.agentCommands.cmdSkills(args, this.smartInput!); \n break;\n\n case 'mcp': \n await this.mcpCommands.cmdMcp(args, this.smartInput!); \n break;\n\n case 'project':\n await this.projectCommands.cmdProject(args, this.smartInput!);\n break;\n case 'project-deep':\n await this.projectCommands.cmdProject(['deep'], this.smartInput!);\n break;\n\n default:\n process.stdout.write(`${Colors.red} Unknown: /${cmd}${Colors.reset} ${Colors.dim}Try /help${Colors.reset}\\r\\n`);\n }\n }\n\n private async handleCompact(): Promise<void> {\n const msgCount = this.deepAgent.getMessageCount();\n if (msgCount < 4) {\n process.stdout.write(`${Colors.dim} Nothing to compact (${msgCount} messages)${Colors.reset}\\r\\n`);\n return;\n }\n process.stdout.write(`${Colors.dim} Summarizing ${msgCount} messages...${Colors.reset}\\r\\n`);\n const result = await this.deepAgent.compactHistory();\n if (result.compacted) {\n process.stdout.write(`${Colors.green} Compacted: ${result.messagesBefore} → ${result.messagesAfter} messages${Colors.reset}\\r\\n`);\n } else {\n process.stdout.write(`${Colors.yellow} Could not compact (summarization failed)${Colors.reset}\\r\\n`);\n }\n }\n\n private async handleMessage(message: string): Promise<void> {\n this.isProcessing = true;\n this.abortController = new AbortController();\n this.smartInput?.enterPassiveMode();\n\n try {\n let messageToProcess = message;\n\n const planCheck = await this.planMode.shouldEnterPlanMode(message);\n if (planCheck.shouldPlan) {\n const usePlan = await this.smartInput!.askChoice(\n '📝 Complex task. Create a plan?',\n [\n { key: 'y', label: 'yes', description: 'Create structured plan' },\n { key: 'n', label: 'no', description: 'Proceed without plan' },\n ]\n );\n \n if (usePlan === 'y') {\n const plannedMessage = await this.runInteractivePlanMode(message);\n if (!plannedMessage) {\n this.isProcessing = false;\n this.smartInput?.exitPassiveMode();\n return;\n }\n messageToProcess = plannedMessage;\n }\n }\n\n const mentionResult = await this.mentionsService.processMessage(messageToProcess);\n if (mentionResult.mentions.length > 0) {\n const summary = this.mentionsService.getMentionsSummary(mentionResult.mentions);\n for (const line of summary) {\n process.stdout.write(`${Colors.dim}${line}${Colors.reset}\\r\\n`);\n }\n process.stdout.write('\\r\\n');\n }\n\n this.startSpinner('Thinking');\n\n let firstChunk = true;\n let fullResponse = '';\n\n for await (const chunk of this.deepAgent.chat(mentionResult.expandedMessage)) {\n if (this.abortController?.signal.aborted) break;\n\n const isToolOutput = chunk.includes('\\x1b[') && (\n chunk.includes('⏿') ||\n chunk.includes('tokens:') ||\n chunk.includes('conversation compacted')\n );\n\n if (firstChunk && !isToolOutput) {\n this.stopSpinner();\n process.stdout.write(`\\r\\n${Colors.magenta}${Colors.bold}${Icons.chestnut} Cast${Colors.reset}\\r\\n`);\n firstChunk = false;\n }\n\n if (!isToolOutput) {\n fullResponse += chunk;\n }\n process.stdout.write(chunk);\n }\n\n if (!firstChunk) {\n process.stdout.write('\\r\\n');\n } else {\n this.stopSpinner();\n }\n } catch (error) {\n this.stopSpinner();\n const msg = (error as Error).message;\n if (!msg.includes('abort')) {\n process.stdout.write(`\\r\\n${Colors.red} Error: ${msg}${Colors.reset}\\r\\n\\r\\n`);\n }\n } finally {\n this.isProcessing = false;\n this.abortController = null;\n this.smartInput?.exitPassiveMode();\n }\n }\n\n private async runInteractivePlanMode(userMessage: string): Promise<string | null> {\n process.stdout.write(`\\r\\n${Colors.cyan}${Colors.bold}📋 PLAN MODE${Colors.reset}\\r\\n`);\n process.stdout.write(`${Colors.dim}Build plan first, execute after approval${Colors.reset}\\r\\n\\r\\n`);\n\n const clarifyingQuestions = await this.planMode.generateClarifyingQuestions(userMessage);\n const answers: string[] = [];\n\n if (clarifyingQuestions.length > 0) {\n process.stdout.write(`${Colors.dim}I need a few quick clarifications:${Colors.reset}\\r\\n`);\n for (let i = 0; i < clarifyingQuestions.length; i++) {\n const q = clarifyingQuestions[i];\n const answer = await this.smartInput!.question(`${Colors.yellow}Q${i + 1}:${Colors.reset} ${q} `);\n if (answer.trim()) {\n answers.push(`- ${q} => ${answer.trim()}`);\n }\n }\n process.stdout.write('\\r\\n');\n }\n\n const context = answers.length > 0 ? `User clarifications:\\n${answers.join('\\n')}` : undefined;\n let plan = await this.planMode.generatePlan(userMessage, context);\n\n while (true) {\n process.stdout.write(this.planMode.formatPlanForDisplay(plan));\n\n const action = await this.smartInput!.askChoice('Plan options', [\n { key: 'a', label: 'accept', description: 'Use this plan and continue' },\n { key: 'r', label: 'refine', description: 'Refine plan with extra feedback' },\n { key: 'c', label: 'cancel', description: 'Cancel and return to prompt' },\n ]);\n\n if (action === 'c') {\n process.stdout.write(`${Colors.dim} Plan cancelled${Colors.reset}\\r\\n\\r\\n`);\n return null;\n }\n\n if (action === 'r') {\n const feedback = await this.smartInput!.question(`${Colors.cyan}Refinement feedback:${Colors.reset} `);\n if (!feedback.trim()) {\n process.stdout.write(`${Colors.dim} No feedback provided. Keeping current plan.${Colors.reset}\\r\\n\\r\\n`);\n continue;\n }\n plan = await this.planMode.refinePlan(plan, feedback.trim());\n continue;\n }\n\n return this.buildPlanExecutionPrompt(userMessage, plan, answers);\n }\n }\n\n private buildPlanExecutionPrompt(userMessage: string, plan: { title: string; overview: string; steps: Array<{ id: number; description: string; files: string[] }> }, clarifications: string[]): string {\n const lines: string[] = [];\n lines.push(userMessage);\n lines.push('');\n lines.push('Approved execution plan:');\n lines.push(`Title: ${plan.title}`);\n lines.push(`Overview: ${plan.overview}`);\n lines.push('Steps:');\n for (const step of plan.steps) {\n const files = step.files.length > 0 ? ` | files: ${step.files.join(', ')}` : '';\n lines.push(`${step.id}. ${step.description}${files}`);\n }\n if (clarifications.length > 0) {\n lines.push('');\n lines.push('User clarifications:');\n lines.push(...clarifications);\n }\n lines.push('');\n lines.push('Execute the task following this approved plan and report progress by step.');\n return lines.join('\\n');\n }\n\n private startSpinner(label: string): void {\n let i = 0;\n this.spinnerTimer = setInterval(() => {\n const spinner = Icons.spinner[i % Icons.spinner.length];\n i++;\n process.stdout.write(\n `\\r${Colors.cyan}${spinner}${Colors.reset} ${Colors.dim}${label}...${Colors.reset}`\n );\n }, 80);\n }\n\n private stopSpinner(): void {\n if (this.spinnerTimer) {\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n process.stdout.write('\\r\\x1b[K');\n }\n }\n\n private cmdTools(): void {\n const allTools = this.toolsRegistry.getAllTools();\n const tools: [string, string][] = allTools.map(t => [t.name, t.description.slice(0, 60)]);\n\n if (tools.length > 0) {\n const maxLen = Math.max(...tools.map(([n]) => n.length));\n\n process.stdout.write('\\r\\n');\n process.stdout.write(`${Colors.bold}Built-in Tools (${tools.length}):${Colors.reset}\\r\\n`);\n for (const [name, desc] of tools) {\n process.stdout.write(` ${Colors.cyan}${name.padEnd(maxLen)}${Colors.reset} ${Colors.dim}${desc}${Colors.reset}\\r\\n`);\n }\n }\n\n const mcpTools = this.mcpRegistry.getAllMcpTools();\n if (mcpTools.length > 0) {\n process.stdout.write(`\\r\\n${Colors.bold}MCP Tools (${mcpTools.length}):${Colors.reset}\\r\\n`);\n for (const t of mcpTools.slice(0, 10)) {\n process.stdout.write(` ${Colors.cyan}${t.name}${Colors.reset} ${Colors.dim}${t.description.slice(0, 50)}${Colors.reset}\\r\\n`);\n }\n }\n process.stdout.write('\\r\\n');\n }\n\n private getModelDisplayName(): string {\n try {\n const modelConfig = this.configManager.getModelConfig('default');\n if (modelConfig) {\n return `${modelConfig.provider}/${modelConfig.model}`;\n }\n } catch {\n }\n return `${this.configService.getProvider()}/${this.configService.getModel()}`;\n }\n\n stop(): void {\n this.stopSpinner();\n this.smartInput?.destroy();\n }\n}\n"],"names":["ReplService","start","initResult","deepAgent","initialize","agentCount","agentRegistry","resolveAllAgents","length","welcomeScreen","printWelcomeScreen","projectPath","undefined","model","getModelDisplayName","toolCount","smartInput","SmartInput","prompt","Colors","cyan","bold","reset","promptVisibleLen","getCommandSuggestions","input","getMentionSuggestions","partial","onSubmit","line","handleLine","onCancel","handleCancel","onExit","handleExit","commands","text","display","description","filter","c","startsWith","fs","require","path","gitOpts","getFileEntries","o","slice","dir","prefix","endsWith","includes","dirname","basename","resolved","resolve","process","cwd","existsSync","statSync","isDirectory","entries","readdirSync","withFileTypes","ignore","e","name","toLowerCase","map","relDir","isDir","isProcessing","abortController","abort","stopSpinner","stdout","write","yellow","dim","showPrompt","stop","exit","trimmed","trim","handleCommand","handleMessage","command","parts","split","cmd","args","replCommands","printHelp","cmdClear","handleCompact","cmdContext","configCommands","handleConfigCommand","configManager","loadConfig","reinitializeModel","cmdModel","projectCommands","cmdProject","cmdMentionsHelp","cmdTools","gitCommands","runGit","join","cmdCommit","cmdUp","cmdSplitUp","cmdPr","cmdUnitTest","cmdReview","cmdFix","cmdIdent","cmdRelease","agentCommands","cmdAgents","cmdSkills","mcpCommands","cmdMcp","red","msgCount","getMessageCount","result","compactHistory","compacted","green","messagesBefore","messagesAfter","message","AbortController","enterPassiveMode","messageToProcess","planCheck","planMode","shouldEnterPlanMode","shouldPlan","usePlan","askChoice","key","label","plannedMessage","runInteractivePlanMode","exitPassiveMode","mentionResult","mentionsService","processMessage","mentions","summary","getMentionsSummary","startSpinner","firstChunk","fullResponse","chunk","chat","expandedMessage","signal","aborted","isToolOutput","magenta","Icons","chestnut","error","msg","userMessage","clarifyingQuestions","generateClarifyingQuestions","answers","i","q","answer","question","push","context","plan","generatePlan","formatPlanForDisplay","action","feedback","refinePlan","buildPlanExecutionPrompt","clarifications","lines","title","overview","step","steps","files","id","spinnerTimer","setInterval","spinner","clearInterval","allTools","toolsRegistry","getAllTools","tools","t","maxLen","Math","max","n","desc","padEnd","mcpTools","mcpRegistry","getAllMcpTools","modelConfig","getModelConfig","provider","configService","getProvider","getModel","destroy","skillRegistry"],"mappings":";;;;+BAqBaA;;;eAAAA;;;wBArBc;kCACM;+BACH;sCACO;iCACL;oCACG;sCACE;sCACA;iCACL;4BACL;sCACU;qCACD;oCACD;sCACE;oCACF;uCACG;wCACC;sCACF;uBACP;;;;;;;;;;AAGvB,IAAA,AAAMA,cAAN,MAAMA;IAyBX,MAAMC,QAAuB;QAC3B,MAAMC,aAAa,MAAM,IAAI,CAACC,SAAS,CAACC,UAAU;QAClD,MAAMC,aAAa,IAAI,CAACC,aAAa,CAACC,gBAAgB,GAAGC,MAAM;QAE/D,IAAI,CAACC,aAAa,CAACC,kBAAkB,CAAC;YACpCC,aAAaT,WAAWS,WAAW,IAAIC;YACvCC,OAAO,IAAI,CAACC,mBAAmB;YAC/BC,WAAWb,WAAWa,SAAS;YAC/BV;QACF;QAEA,IAAI,CAACW,UAAU,GAAG,IAAIC,sBAAU,CAAC;YAC/BC,QAAQ,GAAGC,aAAM,CAACC,IAAI,GAAGD,aAAM,CAACE,IAAI,CAAC,CAAC,EAAEF,aAAM,CAACG,KAAK,CAAC,CAAC,CAAC;YACvDC,kBAAkB;YAClBC,uBAAuB,CAACC,QAAU,IAAI,CAACD,qBAAqB,CAACC;YAC7DC,uBAAuB,CAACC,UAAY,IAAI,CAACD,qBAAqB,CAACC;YAC/DC,UAAU,CAACC,OAAS,IAAI,CAACC,UAAU,CAACD;YACpCE,UAAU,IAAM,IAAI,CAACC,YAAY;YACjCC,QAAQ,IAAM,IAAI,CAACC,UAAU;QAC/B;QAEA,IAAI,CAAClB,UAAU,CAACf,KAAK;IACvB;IAEQuB,sBAAsBC,KAAa,EAAiE;QAC1G,MAAMU,WAAW;YACf;gBAAEC,MAAM;gBAASC,SAAS;gBAASC,aAAa;YAAY;YAC5D;gBAAEF,MAAM;gBAAUC,SAAS;gBAAUC,aAAa;YAAqB;YACvE;gBAAEF,MAAM;gBAAYC,SAA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AC/E;IAEAvI,OAAa;QACX,IAAI,CAACN,WAAW;QAChB,IAAI,CAAC3D,UAAU,EAAEyM;IACnB;IArdA,YACE,AAAiBtN,SAA2B,EAC5C,AAAiBmN,aAA4B,EAC7C,AAAiBnH,aAAmC,EACpD,AAAiBkD,eAAgC,EACjD,AAAiB4D,WAA+B,EAChD,AAAiB3M,aAAmC,EACpD,AAAiBoN,aAAmC,EACpD,AAAiBjN,aAAmC,EACpD,AAAiBiI,QAAyB,EAC1C,AAAiB9C,YAAiC,EAClD,AAAiBe,WAA+B,EAChD,AAAiBY,aAAmC,EACpD,AAAiBG,WAA+B,EAChD,AAAiBzB,cAAqC,EACtD,AAAiBM,eAAuC,EACxD,AAAiB+F,aAAmC,CACpD;aAhBiBnM,YAAAA;aACAmN,gBAAAA;aACAnH,gBAAAA;aACAkD,kBAAAA;aACA4D,cAAAA;aACA3M,gBAAAA;aACAoN,gBAAAA;aACAjN,gBAAAA;aACAiI,WAAAA;aACA9C,eAAAA;aACAe,cAAAA;aACAY,gBAAAA;aACAG,cAAAA;aACAzB,iBAAAA;aACAM,kBAAAA;aACA+F,gBAAAA;aArBXtL,aAAgC;aAChCyD,kBAA0C;aAC1CD,eAAe;aACfyH,eAAsD;IAmB3D;AAqcL"}
1
+ {"version":3,"sources":["../../../../src/modules/repl/services/repl.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { DeepAgentService } from '../../core/services/deep-agent.service';\nimport { ConfigService } from '../../../common/services/config.service';\nimport { ConfigManagerService } from '../../config/services/config-manager.service';\nimport { MentionsService } from '../../mentions/services/mentions.service';\nimport { McpRegistryService } from '../../mcp/services/mcp-registry.service';\nimport { AgentRegistryService } from '../../agents/services/agent-registry.service';\nimport { SkillRegistryService } from '../../skills/services/skill-registry.service';\nimport { PlanModeService } from '../../core/services/plan-mode.service';\nimport { SmartInput } from './smart-input';\nimport { WelcomeScreenService } from './welcome-screen.service';\nimport { ReplCommandsService } from './commands/repl-commands.service';\nimport { GitCommandsService } from './commands/git-commands.service';\nimport { AgentCommandsService } from './commands/agent-commands.service';\nimport { McpCommandsService } from './commands/mcp-commands.service';\nimport { ConfigCommandsService } from '../../config/services/config-commands.service';\nimport { ProjectCommandsService } from './commands/project-commands.service';\nimport { ToolsRegistryService } from '../../tools/services/tools-registry.service';\nimport { KanbanServerService } from '../../kanban/services/kanban-server.service';\nimport { Colors, Icons } from '../utils/theme';\n\n@Injectable()\nexport class ReplService {\n private smartInput: SmartInput | null = null;\n private abortController: AbortController | null = null;\n private isProcessing = false;\n private spinnerTimer: ReturnType<typeof setInterval> | null = null;\n\n constructor(\n private readonly deepAgent: DeepAgentService,\n private readonly configService: ConfigService,\n private readonly configManager: ConfigManagerService,\n private readonly mentionsService: MentionsService,\n private readonly mcpRegistry: McpRegistryService,\n private readonly agentRegistry: AgentRegistryService,\n private readonly skillRegistry: SkillRegistryService,\n private readonly welcomeScreen: WelcomeScreenService,\n private readonly planMode: PlanModeService,\n private readonly replCommands: ReplCommandsService,\n private readonly gitCommands: GitCommandsService,\n private readonly agentCommands: AgentCommandsService,\n private readonly mcpCommands: McpCommandsService,\n private readonly configCommands: ConfigCommandsService,\n private readonly projectCommands: ProjectCommandsService,\n private readonly toolsRegistry: ToolsRegistryService,\n private readonly kanbanServer: KanbanServerService,\n ) {}\n\n async start(): Promise<void> {\n const initResult = await this.deepAgent.initialize();\n const agentCount = this.agentRegistry.resolveAllAgents().length;\n\n this.welcomeScreen.printWelcomeScreen({\n projectPath: initResult.projectPath || undefined,\n model: this.getModelDisplayName(),\n toolCount: initResult.toolCount,\n agentCount,\n });\n\n this.smartInput = new SmartInput({\n prompt: `${Colors.cyan}${Colors.bold}>${Colors.reset} `,\n promptVisibleLen: 2,\n getCommandSuggestions: (input) => this.getCommandSuggestions(input),\n getMentionSuggestions: (partial) => this.getMentionSuggestions(partial),\n onSubmit: (line) => this.handleLine(line),\n onCancel: () => this.handleCancel(),\n onExit: () => this.handleExit(),\n });\n\n this.smartInput.start();\n }\n\n private getCommandSuggestions(input: string): Array<{ text: string; display: string; description: string }> {\n const commands = [\n { text: '/help', display: '/help', description: 'Show help' },\n { text: '/clear', display: '/clear', description: 'Clear conversation' },\n { text: '/compact', display: '/compact', description: 'Compact history' },\n { text: '/exit', display: '/exit', description: 'Exit' },\n { text: '/status', display: '/status', description: 'Git status' },\n { text: '/diff', display: '/diff', description: 'Git diff' },\n { text: '/log', display: '/log', description: 'Git log' },\n { text: '/commit', display: '/commit', description: 'Commit changes' },\n { text: '/up', display: '/up', description: 'Smart commit & push' },\n { text: '/split-up', display: '/split-up', description: 'Split commits' },\n { text: '/pr', display: '/pr', description: 'Create Pull Request' },\n { text: '/unit-test', display: '/unit-test', description: 'Generate unit tests' },\n { text: '/review', display: '/review', description: 'Code review' },\n { text: '/fix', display: '/fix', description: 'Auto-fix code' },\n { text: '/ident', display: '/ident', description: 'Format code' },\n { text: '/release', display: '/release', description: 'Release notes' },\n { text: '/tools', display: '/tools', description: 'List tools' },\n { text: '/agents', display: '/agents', description: 'List agents' },\n { text: '/skills', display: '/skills', description: 'List skills' },\n { text: '/context', display: '/context', description: 'Session info' },\n { text: '/mentions', display: '/mentions', description: 'Mentions help' },\n { text: '/model', display: '/model', description: 'Show model' },\n { text: '/config', display: '/config', description: 'Configuration' },\n { text: '/project', display: '/project', description: 'Project context' },\n { text: '/project-deep', display: '/project-deep', description: 'Deep project analysis' },\n { text: '/init', display: '/init', description: 'Analyze project and generate context' },\n { text: '/mcp', display: '/mcp', description: 'MCP servers' },\n { text: '/kanban', display: '/kanban', description: 'Open kanban board' },\n ];\n\n return commands.filter(c => c.text.startsWith(input));\n }\n\n private getMentionSuggestions(partial: string): Array<{ text: string; display: string; description: string }> {\n const fs = require('fs');\n const path = require('path');\n\n const gitOpts = [\n { text: '@git:status', display: '@git:status', description: 'Git status' },\n { text: '@git:diff', display: '@git:diff', description: 'Git diff' },\n { text: '@git:log', display: '@git:log', description: 'Git log' },\n { text: '@git:branch', display: '@git:branch', description: 'Branches' },\n ];\n\n if (partial === '') return [...gitOpts, ...this.getFileEntries('')];\n if (partial.startsWith('git:')) return gitOpts.filter(o => o.text.startsWith('@' + partial));\n\n return [...gitOpts.filter(o => o.text.startsWith('@' + partial)), ...this.getFileEntries(partial)].slice(0, 30);\n }\n\n private getFileEntries(partial: string): Array<{ text: string; display: string; description: string }> {\n const fs = require('fs');\n const path = require('path');\n\n try {\n let dir: string;\n let prefix: string;\n\n if (partial.endsWith('/')) {\n dir = partial.slice(0, -1) || '.';\n prefix = '';\n } else if (partial.includes('/')) {\n dir = path.dirname(partial);\n prefix = path.basename(partial);\n } else {\n dir = '.';\n prefix = partial;\n }\n\n const resolved = path.resolve(process.cwd(), dir);\n if (!fs.existsSync(resolved) || !fs.statSync(resolved).isDirectory()) return [];\n\n const entries = fs.readdirSync(resolved, { withFileTypes: true });\n const ignore = ['node_modules', '.git', 'dist', 'coverage', '.next', '__pycache__'];\n\n return entries\n .filter(e => !ignore.includes(e.name))\n .filter(e => !e.name.startsWith('.') || prefix.startsWith('.'))\n .filter(e => prefix === '' || e.name.toLowerCase().startsWith(prefix.toLowerCase()))\n .map(e => {\n const relDir = dir === '.' ? '' : dir + '/';\n const isDir = e.isDirectory();\n return {\n text: '@' + relDir + e.name + (isDir ? '/' : ''),\n display: '@' + relDir + e.name + (isDir ? '/' : ''),\n description: isDir ? 'dir' : '',\n };\n })\n .slice(0, 20);\n } catch {\n return [];\n }\n }\n\n private handleCancel(): void {\n if (this.isProcessing && this.abortController) {\n this.abortController.abort();\n this.stopSpinner();\n process.stdout.write(`\\r\\n${Colors.yellow} Cancelled${Colors.reset}\\r\\n\\r\\n`);\n this.isProcessing = false;\n } else {\n process.stdout.write(`${Colors.dim} (Use /exit to quit)${Colors.reset}\\r\\n`);\n this.smartInput?.showPrompt();\n }\n }\n\n private handleExit(): void {\n process.stdout.write(`${Colors.dim} Goodbye!${Colors.reset}\\r\\n`);\n this.stop();\n process.exit(0);\n }\n\n private async handleLine(input: string): Promise<void> {\n const trimmed = input.trim();\n\n if (!trimmed) {\n this.smartInput?.showPrompt();\n return;\n }\n\n if (trimmed.startsWith('/')) {\n await this.handleCommand(trimmed);\n } else {\n await this.handleMessage(trimmed);\n }\n\n this.smartInput?.showPrompt();\n }\n\n private async handleCommand(command: string): Promise<void> {\n const parts = command.slice(1).split(/\\s+/);\n const cmd = parts[0].toLowerCase();\n const args = parts.slice(1);\n\n switch (cmd) {\n case 'help': this.replCommands.printHelp(); break;\n case 'clear': this.replCommands.cmdClear(this.welcomeScreen); break;\n case 'exit':\n case 'quit': this.handleExit(); return;\n case 'compact': await this.handleCompact(); break;\n case 'context': this.replCommands.cmdContext(); break;\n case 'config':\n await this.configCommands.handleConfigCommand(args, this.smartInput!);\n await this.configManager.loadConfig();\n await this.deepAgent.reinitializeModel();\n break;\n case 'model': this.replCommands.cmdModel(args); break;\n case 'init':\n await this.projectCommands.cmdProject(['analyze'], this.smartInput!);\n break;\n case 'mentions': this.replCommands.cmdMentionsHelp(); break;\n case 'tools': this.cmdTools(); break;\n\n case 'status': this.gitCommands.runGit('git status'); break;\n case 'diff': this.gitCommands.runGit(args.length ? `git diff ${args.join(' ')}` : 'git diff'); break;\n case 'log': this.gitCommands.runGit('git log --oneline -15'); break;\n case 'commit': \n await this.gitCommands.cmdCommit(args, this.smartInput!); \n break;\n case 'up': \n await this.gitCommands.cmdUp(this.smartInput!); \n break;\n case 'split-up': \n await this.gitCommands.cmdSplitUp(this.smartInput!); \n break;\n case 'pr': \n await this.gitCommands.cmdPr(this.smartInput!); \n break;\n case 'unit-test':\n await this.gitCommands.cmdUnitTest(this.smartInput!);\n break;\n case 'review': await this.gitCommands.cmdReview(args); break;\n case 'fix': await this.gitCommands.cmdFix(args); break;\n case 'ident': await this.gitCommands.cmdIdent(); break;\n case 'release': await this.gitCommands.cmdRelease(args); break;\n\n case 'agents': \n await this.agentCommands.cmdAgents(args, this.smartInput!); \n break;\n case 'skills': \n await this.agentCommands.cmdSkills(args, this.smartInput!); \n break;\n\n case 'mcp': \n await this.mcpCommands.cmdMcp(args, this.smartInput!); \n break;\n\n case 'project':\n await this.projectCommands.cmdProject(args, this.smartInput!);\n break;\n case 'project-deep':\n await this.projectCommands.cmdProject(['deep'], this.smartInput!);\n break;\n\n case 'kanban':\n this.kanbanServer.start();\n break;\n\n default:\n process.stdout.write(`${Colors.red} Unknown: /${cmd}${Colors.reset} ${Colors.dim}Try /help${Colors.reset}\\r\\n`);\n }\n }\n\n private async handleCompact(): Promise<void> {\n const msgCount = this.deepAgent.getMessageCount();\n if (msgCount < 4) {\n process.stdout.write(`${Colors.dim} Nothing to compact (${msgCount} messages)${Colors.reset}\\r\\n`);\n return;\n }\n process.stdout.write(`${Colors.dim} Summarizing ${msgCount} messages...${Colors.reset}\\r\\n`);\n const result = await this.deepAgent.compactHistory();\n if (result.compacted) {\n process.stdout.write(`${Colors.green} Compacted: ${result.messagesBefore} → ${result.messagesAfter} messages${Colors.reset}\\r\\n`);\n } else {\n process.stdout.write(`${Colors.yellow} Could not compact (summarization failed)${Colors.reset}\\r\\n`);\n }\n }\n\n private async handleMessage(message: string): Promise<void> {\n this.isProcessing = true;\n this.abortController = new AbortController();\n this.smartInput?.enterPassiveMode();\n\n try {\n let messageToProcess = message;\n\n const planCheck = await this.planMode.shouldEnterPlanMode(message);\n if (planCheck.shouldPlan) {\n const usePlan = await this.smartInput!.askChoice(\n '📝 Complex task. Create a plan?',\n [\n { key: 'y', label: 'yes', description: 'Create structured plan' },\n { key: 'n', label: 'no', description: 'Proceed without plan' },\n ]\n );\n \n if (usePlan === 'y') {\n const plannedMessage = await this.runInteractivePlanMode(message);\n if (!plannedMessage) {\n this.isProcessing = false;\n this.smartInput?.exitPassiveMode();\n return;\n }\n messageToProcess = plannedMessage;\n }\n }\n\n const mentionResult = await this.mentionsService.processMessage(messageToProcess);\n if (mentionResult.mentions.length > 0) {\n const summary = this.mentionsService.getMentionsSummary(mentionResult.mentions);\n for (const line of summary) {\n process.stdout.write(`${Colors.dim}${line}${Colors.reset}\\r\\n`);\n }\n process.stdout.write('\\r\\n');\n }\n\n this.startSpinner('Thinking');\n\n let firstChunk = true;\n let fullResponse = '';\n\n for await (const chunk of this.deepAgent.chat(mentionResult.expandedMessage)) {\n if (this.abortController?.signal.aborted) break;\n\n const isToolOutput = chunk.includes('\\x1b[') && (\n chunk.includes('⏿') ||\n chunk.includes('tokens:') ||\n chunk.includes('conversation compacted')\n );\n\n if (firstChunk && !isToolOutput) {\n this.stopSpinner();\n process.stdout.write(`\\r\\n${Colors.magenta}${Colors.bold}${Icons.chestnut} Cast${Colors.reset}\\r\\n`);\n firstChunk = false;\n }\n\n if (!isToolOutput) {\n fullResponse += chunk;\n }\n process.stdout.write(chunk);\n }\n\n if (!firstChunk) {\n process.stdout.write('\\r\\n');\n } else {\n this.stopSpinner();\n }\n } catch (error) {\n this.stopSpinner();\n const msg = (error as Error).message;\n if (!msg.includes('abort')) {\n process.stdout.write(`\\r\\n${Colors.red} Error: ${msg}${Colors.reset}\\r\\n\\r\\n`);\n }\n } finally {\n this.isProcessing = false;\n this.abortController = null;\n this.smartInput?.exitPassiveMode();\n }\n }\n\n private async runInteractivePlanMode(userMessage: string): Promise<string | null> {\n process.stdout.write(`\\r\\n${Colors.cyan}${Colors.bold}📋 PLAN MODE${Colors.reset}\\r\\n`);\n process.stdout.write(`${Colors.dim}Build plan first, execute after approval${Colors.reset}\\r\\n\\r\\n`);\n\n const clarifyingQuestions = await this.planMode.generateClarifyingQuestions(userMessage);\n const answers: string[] = [];\n\n if (clarifyingQuestions.length > 0) {\n process.stdout.write(`${Colors.dim}I need a few quick clarifications:${Colors.reset}\\r\\n`);\n for (let i = 0; i < clarifyingQuestions.length; i++) {\n const q = clarifyingQuestions[i];\n const answer = await this.smartInput!.question(`${Colors.yellow}Q${i + 1}:${Colors.reset} ${q} `);\n if (answer.trim()) {\n answers.push(`- ${q} => ${answer.trim()}`);\n }\n }\n process.stdout.write('\\r\\n');\n }\n\n const context = answers.length > 0 ? `User clarifications:\\n${answers.join('\\n')}` : undefined;\n let plan = await this.planMode.generatePlan(userMessage, context);\n\n while (true) {\n process.stdout.write(this.planMode.formatPlanForDisplay(plan));\n\n const action = await this.smartInput!.askChoice('Plan options', [\n { key: 'a', label: 'accept', description: 'Use this plan and continue' },\n { key: 'r', label: 'refine', description: 'Refine plan with extra feedback' },\n { key: 'c', label: 'cancel', description: 'Cancel and return to prompt' },\n ]);\n\n if (action === 'c') {\n process.stdout.write(`${Colors.dim} Plan cancelled${Colors.reset}\\r\\n\\r\\n`);\n return null;\n }\n\n if (action === 'r') {\n const feedback = await this.smartInput!.question(`${Colors.cyan}Refinement feedback:${Colors.reset} `);\n if (!feedback.trim()) {\n process.stdout.write(`${Colors.dim} No feedback provided. Keeping current plan.${Colors.reset}\\r\\n\\r\\n`);\n continue;\n }\n plan = await this.planMode.refinePlan(plan, feedback.trim());\n continue;\n }\n\n return this.buildPlanExecutionPrompt(userMessage, plan, answers);\n }\n }\n\n private buildPlanExecutionPrompt(userMessage: string, plan: { title: string; overview: string; steps: Array<{ id: number; description: string; files: string[] }> }, clarifications: string[]): string {\n const lines: string[] = [];\n lines.push(userMessage);\n lines.push('');\n lines.push('Approved execution plan:');\n lines.push(`Title: ${plan.title}`);\n lines.push(`Overview: ${plan.overview}`);\n lines.push('Steps:');\n for (const step of plan.steps) {\n const files = step.files.length > 0 ? ` | files: ${step.files.join(', ')}` : '';\n lines.push(`${step.id}. ${step.description}${files}`);\n }\n if (clarifications.length > 0) {\n lines.push('');\n lines.push('User clarifications:');\n lines.push(...clarifications);\n }\n lines.push('');\n lines.push('Execute the task following this approved plan and report progress by step.');\n return lines.join('\\n');\n }\n\n private startSpinner(label: string): void {\n let i = 0;\n this.spinnerTimer = setInterval(() => {\n const spinner = Icons.spinner[i % Icons.spinner.length];\n i++;\n process.stdout.write(\n `\\r${Colors.cyan}${spinner}${Colors.reset} ${Colors.dim}${label}...${Colors.reset}`\n );\n }, 80);\n }\n\n private stopSpinner(): void {\n if (this.spinnerTimer) {\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n process.stdout.write('\\r\\x1b[K');\n }\n }\n\n private cmdTools(): void {\n const allTools = this.toolsRegistry.getAllTools();\n const tools: [string, string][] = allTools.map(t => [t.name, t.description.slice(0, 60)]);\n\n if (tools.length > 0) {\n const maxLen = Math.max(...tools.map(([n]) => n.length));\n\n process.stdout.write('\\r\\n');\n process.stdout.write(`${Colors.bold}Built-in Tools (${tools.length}):${Colors.reset}\\r\\n`);\n for (const [name, desc] of tools) {\n process.stdout.write(` ${Colors.cyan}${name.padEnd(maxLen)}${Colors.reset} ${Colors.dim}${desc}${Colors.reset}\\r\\n`);\n }\n }\n\n const mcpTools = this.mcpRegistry.getAllMcpTools();\n if (mcpTools.length > 0) {\n process.stdout.write(`\\r\\n${Colors.bold}MCP Tools (${mcpTools.length}):${Colors.reset}\\r\\n`);\n for (const t of mcpTools.slice(0, 10)) {\n process.stdout.write(` ${Colors.cyan}${t.name}${Colors.reset} ${Colors.dim}${t.description.slice(0, 50)}${Colors.reset}\\r\\n`);\n }\n }\n process.stdout.write('\\r\\n');\n }\n\n private getModelDisplayName(): string {\n try {\n const modelConfig = this.configManager.getModelConfig('default');\n if (modelConfig) {\n return `${modelConfig.provider}/${modelConfig.model}`;\n }\n } catch {\n }\n return `${this.configService.getProvider()}/${this.configService.getModel()}`;\n }\n\n stop(): void {\n this.stopSpinner();\n this.smartInput?.destroy();\n }\n}\n"],"names":["ReplService","start","initResult","deepAgent","initialize","agentCount","agentRegistry","resolveAllAgents","length","welcomeScreen","printWelcomeScreen","projectPath","undefined","model","getModelDisplayName","toolCount","smartInput","SmartInput","prompt","Colors","cyan","bold","reset","promptVisibleLen","getCommandSuggestions","input","getMentionSuggestions","partial","onSubmit","line","handleLine","onCancel","handleCancel","onExit","handleExit","commands","text","display","description","filter","c","startsWith","fs","require","path","gitOpts","getFileEntries","o","slice","dir","prefix","endsWith","includes","dirname","basename","resolved","resolve","process","cwd","existsSync","statSync","isDirectory","entries","readdirSync","withFileTypes","ignore","e","name","toLowerCase","map","relDir","isDir","isProcessing","abortController","abort","stopSpinner","stdout","write","yellow","dim","showPrompt","stop","exit","trimmed","trim","handleCommand","handleMessage","command","parts","split","cmd","args","replCommands","printHelp","cmdClear","handleCompact","cmdContext","configCommands","handleConfigCommand","configManager","loadConfig","reinitializeModel","cmdModel","projectCommands","cmdProject","cmdMentionsHelp","cmdTools","gitCommands","runGit","join","cmdCommit","cmdUp","cmdSplitUp","cmdPr","cmdUnitTest","cmdReview","cmdFix","cmdIdent","cmdRelease","agentCommands","cmdAgents","cmdSkills","mcpCommands","cmdMcp","kanbanServer","red","msgCount","getMessageCount","result","compactHistory","compacted","green","messagesBefore","messagesAfter","message","AbortController","enterPassiveMode","messageToProcess","planCheck","planMode","shouldEnterPlanMode","shouldPlan","usePlan","askChoice","key","label","plannedMessage","runInteractivePlanMode","exitPassiveMode","mentionResult","mentionsService","processMessage","mentions","summary","getMentionsSummary","startSpinner","firstChunk","fullResponse","chunk","chat","expandedMessage","signal","aborted","isToolOutput","magenta","Icons","chestnut","error","msg","userMessage","clarifyingQuestions","generateClarifyingQuestions","answers","i","q","answer","question","push","context","plan","generatePlan","formatPlanForDisplay","action","feedback","refinePlan","buildPlanExecutionPrompt","clarifications","lines","title","overview","step","steps","files","id","spinnerTimer","setInterval","spinner","clearInterval","allTools","toolsRegistry","getAllTools","tools","t","maxLen","Math","max","n","desc","padEnd","mcpTools","mcpRegistry","getAllMcpTools","modelConfig","getModelConfig","provider","configService","getProvider","getModel","destroy","skillRegistry"],"mappings":";;;;+BAsBaA;;;eAAAA;;;wBAtBc;kCACM;+BACH;sCACO;iCACL;oCACG;sCACE;sCACA;iCACL;4BACL;sCACU;qCACD;oCACD;sCACE;oCACF;uCACG;wCACC;sCACF;qCACD;uBACN;;;;;;;;;;AAGvB,IAAA,AAAMA,cAAN,MAAMA;IA0BX,MAAMC,QAAuB;QAC3B,MAAMC,aAAa,MAAM,IAAI,C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4D,WAA+B,EAChD,AAAiB5M,aAAmC,EACpD,AAAiBqN,aAAmC,EACpD,AAAiBlN,aAAmC,EACpD,AAAiBkI,QAAyB,EAC1C,AAAiB/C,YAAiC,EAClD,AAAiBe,WAA+B,EAChD,AAAiBY,aAAmC,EACpD,AAAiBG,WAA+B,EAChD,AAAiBzB,cAAqC,EACtD,AAAiBM,eAAuC,EACxD,AAAiBgG,aAAmC,EACpD,AAAiB3E,YAAiC,CAClD;aAjBiBzH,YAAAA;aACAoN,gBAAAA;aACApH,gBAAAA;aACAmD,kBAAAA;aACA4D,cAAAA;aACA5M,gBAAAA;aACAqN,gBAAAA;aACAlN,gBAAAA;aACAkI,WAAAA;aACA/C,eAAAA;aACAe,cAAAA;aACAY,gBAAAA;aACAG,cAAAA;aACAzB,iBAAAA;aACAM,kBAAAA;aACAgG,gBAAAA;aACA3E,eAAAA;aAtBX5G,aAAgC;aAChCyD,kBAA0C;aAC1CD,eAAe;aACf0H,eAAsD;IAoB3D;AA0cL"}
@@ -118,9 +118,9 @@ let PlanExecutorService = class PlanExecutorService {
118
118
  console.log(` ${_theme.Colors.dim}${task.description}${_theme.Colors.reset}`);
119
119
  console.log('');
120
120
  this.taskService.updateTask(task.id, {
121
- status: _tasktypes.TaskStatus.IN_PROGRESS
121
+ status: _tasktypes.TaskStatus.IN_PROGRESS,
122
+ assignedAgent: 'main'
122
123
  });
123
- // Executar task via DeepAgent
124
124
  const deepAgent = await this.getDeepAgent();
125
125
  const result = await deepAgent.executeTask(task);
126
126
  if (!result.success) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/tasks/services/plan-executor.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { ModuleRef } from '@nestjs/core';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanPersistenceService } from './plan-persistence.service';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { Colors } from '../../repl/utils/theme';\nimport { Task, TaskStatus } from '../types/task.types';\n\n@Injectable()\nexport class PlanExecutorService {\n private executing = false;\n private aborted = false;\n private currentPlanFile: string | null = null;\n private deepAgent: any = null;\n\n constructor(\n private taskService: TaskManagementService,\n private planPersistence: PlanPersistenceService,\n private promptService: PromptService,\n private moduleRef: ModuleRef,\n ) {}\n\n private async getDeepAgent() {\n if (!this.deepAgent) {\n const { DeepAgentService } = await import('../../core/services/deep-agent.service');\n this.deepAgent = this.moduleRef.get(DeepAgentService, { strict: false });\n }\n return this.deepAgent;\n }\n\n async executePlan(planId: string, autoApprove: boolean): Promise<void> {\n const plan = this.taskService.getPlans().get(planId);\n if (!plan) {\n throw new Error('Plan not found');\n }\n\n // Salvar plano\n this.currentPlanFile = await this.planPersistence.savePlan(plan, autoApprove);\n this.promptService.info(`📝 Plano salvo: ${this.currentPlanFile}`);\n console.log('');\n\n // Setup Ctrl+C handler\n const ctrlCHandler = () => {\n if (this.executing) {\n this.aborted = true;\n console.log(`\\n${Colors.warning}⚠ Interrupção solicitada. Finalizando tarefa atual...${Colors.reset}\\n`);\n }\n };\n process.on('SIGINT', ctrlCHandler);\n\n this.executing = true;\n plan.status = 'executing';\n\n const startTime = Date.now();\n const completedTasks: string[] = [];\n const errors: string[] = [];\n\n try {\n for (let i = 0; i < plan.tasks.length; i++) {\n if (this.aborted) {\n this.promptService.warning('Execução cancelada pelo usuário');\n break;\n }\n\n const task = plan.tasks[i];\n\n // Verificar dependências\n const depsSatisfied = task.dependencies.every(depId => {\n const dep = this.taskService.getTask(depId);\n return dep && dep.status === TaskStatus.COMPLETED;\n });\n\n if (!depsSatisfied) {\n errors.push(`Task ${task.id}: dependências não satisfeitas`);\n continue;\n }\n\n // Executar tarefa\n console.log(`${Colors.primary}►${Colors.reset} ${Colors.bold}Executando: ${task.subject}${Colors.reset}`);\n console.log(` ${Colors.dim}${task.description}${Colors.reset}`);\n console.log('');\n\n this.taskService.updateTask(task.id, { status: TaskStatus.IN_PROGRESS });\n\n // Executar task via DeepAgent\n const deepAgent = await this.getDeepAgent();\n const result = await deepAgent.executeTask(task);\n\n if (!result.success) {\n errors.push(`Task ${task.id}: ${result.error || 'Falha na execução'}`);\n this.taskService.updateTask(task.id, { status: TaskStatus.FAILED });\n } else {\n this.taskService.updateTask(task.id, { status: TaskStatus.COMPLETED });\n completedTasks.push(task.id);\n console.log(` ${Colors.success}✓ Concluído${Colors.reset}`);\n }\n\n // Atualizar progresso no arquivo\n await this.planPersistence.updatePlanProgress(this.currentPlanFile!, {\n currentTask: i + 1,\n completedTasks: completedTasks.length,\n status: 'executing',\n });\n\n console.log('');\n }\n\n // Marcar plano como completo\n plan.status = 'completed';\n const duration = Date.now() - startTime;\n\n await this.planPersistence.markPlanCompleted(this.currentPlanFile!, {\n success: errors.length === 0,\n duration,\n errors: errors.length > 0 ? errors : undefined,\n });\n\n console.log('');\n console.log('='.repeat(60));\n this.promptService.success(`✓ Plano concluído em ${(duration / 1000).toFixed(1)}s`);\n console.log(` ${Colors.dim}${completedTasks.length}/${plan.tasks.length} tarefas completadas${Colors.reset}`);\n if (errors.length > 0) {\n console.log(` ${Colors.warning}${errors.length} erros${Colors.reset}`);\n }\n console.log('='.repeat(60));\n console.log('');\n\n } finally {\n this.executing = false;\n this.aborted = false;\n this.currentPlanFile = null;\n this.taskService.clearExecutionContext();\n process.removeListener('SIGINT', ctrlCHandler);\n }\n }\n\n isExecuting(): boolean {\n return this.executing;\n }\n\n abort(): void {\n this.aborted = true;\n }\n}\n"],"names":["PlanExecutorService","getDeepAgent","deepAgent","DeepAgentService","moduleRef","get","strict","executePlan","planId","autoApprove","plan","taskService","getPlans","Error","currentPlanFile","planPersistence","savePlan","promptService","info","console","log","ctrlCHandler","executing","aborted","Colors","warning","reset","process","on","status","startTime","Date","now","completedTasks","errors","i","tasks","length","task","depsSatisfied","dependencies","every","depId","dep","getTask","TaskStatus","COMPLETED","push","id","primary","bold","subject","dim","description","updateTask","IN_PROGRESS","result","executeTask","success","error","FAILED","updatePlanProgress","currentTask","duration","markPlanCompleted","undefined","repeat","toFixed","cl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,GAAGnB,eAAeI,MAAM,CAAC,CAAC,EAAE3B,KAAK0B,KAAK,CAACC,MAAM,CAAC,oBAAoB,EAAEb,aAAM,CAACE,KAAK,EAAE;YAC7G,IAAIQ,OAAOG,MAAM,GAAG,GAAG;gBACrBlB,QAAQC,GAAG,CAAC,CAAC,EAAE,EAAEI,aAAM,CAACC,OAAO,GAAGS,OAAOG,MAAM,CAAC,MAAM,EAAEb,aAAM,CAACE,KAAK,EAAE;YACxE;YACAP,QAAQC,GAAG,CAAC,IAAI8C,MAAM,CAAC;YACvB/C,QAAQC,GAAG,CAAC;QAEd,SAAU;YACR,IAAI,CAACE,SAAS,GAAG;YACjB,IAAI,CAACC,OAAO,GAAG;YACf,IAAI,CAACT,eAAe,GAAG;YACvB,IAAI,CAACH,WAAW,CAACyD,qBAAqB;YACtCzC,QAAQ0C,cAAc,CAAC,UAAUhD;QACnC;IACF;IAEAiD,cAAuB;QACrB,OAAO,IAAI,CAAChD,SAAS;IACvB;IAEAiD,QAAc;QACZ,IAAI,CAAChD,OAAO,GAAG;IACjB;IA/HA,YACE,AAAQZ,WAAkC,EAC1C,AAAQI,eAAuC,EAC/C,AAAQE,aAA4B,EACpC,AAAQb,SAAoB,CAC5B;aAJQO,cAAAA;aACAI,kBAAAA;aACAE,gBAAAA;aACAb,YAAAA;aATFkB,YAAY;aACZC,UAAU;aACVT,kBAAiC;aACjCZ,YAAiB;IAOtB;AA2HL"}
1
+ {"version":3,"sources":["../../../../src/modules/tasks/services/plan-executor.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { ModuleRef } from '@nestjs/core';\nimport { TaskManagementService } from './task-management.service';\nimport { PlanPersistenceService } from './plan-persistence.service';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { Colors } from '../../repl/utils/theme';\nimport { Task, TaskStatus } from '../types/task.types';\n\n@Injectable()\nexport class PlanExecutorService {\n private executing = false;\n private aborted = false;\n private currentPlanFile: string | null = null;\n private deepAgent: any = null;\n\n constructor(\n private taskService: TaskManagementService,\n private planPersistence: PlanPersistenceService,\n private promptService: PromptService,\n private moduleRef: ModuleRef,\n ) {}\n\n private async getDeepAgent() {\n if (!this.deepAgent) {\n const { DeepAgentService } = await import('../../core/services/deep-agent.service');\n this.deepAgent = this.moduleRef.get(DeepAgentService, { strict: false });\n }\n return this.deepAgent;\n }\n\n async executePlan(planId: string, autoApprove: boolean): Promise<void> {\n const plan = this.taskService.getPlans().get(planId);\n if (!plan) {\n throw new Error('Plan not found');\n }\n\n // Salvar plano\n this.currentPlanFile = await this.planPersistence.savePlan(plan, autoApprove);\n this.promptService.info(`📝 Plano salvo: ${this.currentPlanFile}`);\n console.log('');\n\n // Setup Ctrl+C handler\n const ctrlCHandler = () => {\n if (this.executing) {\n this.aborted = true;\n console.log(`\\n${Colors.warning}⚠ Interrupção solicitada. Finalizando tarefa atual...${Colors.reset}\\n`);\n }\n };\n process.on('SIGINT', ctrlCHandler);\n\n this.executing = true;\n plan.status = 'executing';\n\n const startTime = Date.now();\n const completedTasks: string[] = [];\n const errors: string[] = [];\n\n try {\n for (let i = 0; i < plan.tasks.length; i++) {\n if (this.aborted) {\n this.promptService.warning('Execução cancelada pelo usuário');\n break;\n }\n\n const task = plan.tasks[i];\n\n // Verificar dependências\n const depsSatisfied = task.dependencies.every(depId => {\n const dep = this.taskService.getTask(depId);\n return dep && dep.status === TaskStatus.COMPLETED;\n });\n\n if (!depsSatisfied) {\n errors.push(`Task ${task.id}: dependências não satisfeitas`);\n continue;\n }\n\n // Executar tarefa\n console.log(`${Colors.primary}►${Colors.reset} ${Colors.bold}Executando: ${task.subject}${Colors.reset}`);\n console.log(` ${Colors.dim}${task.description}${Colors.reset}`);\n console.log('');\n\n this.taskService.updateTask(task.id, { status: TaskStatus.IN_PROGRESS, assignedAgent: 'main' });\n\n const deepAgent = await this.getDeepAgent();\n const result = await deepAgent.executeTask(task);\n\n if (!result.success) {\n errors.push(`Task ${task.id}: ${result.error || 'Falha na execução'}`);\n this.taskService.updateTask(task.id, { status: TaskStatus.FAILED });\n } else {\n this.taskService.updateTask(task.id, { status: TaskStatus.COMPLETED });\n completedTasks.push(task.id);\n console.log(` ${Colors.success}✓ Concluído${Colors.reset}`);\n }\n\n // Atualizar progresso no arquivo\n await this.planPersistence.updatePlanProgress(this.currentPlanFile!, {\n currentTask: i + 1,\n completedTasks: completedTasks.length,\n status: 'executing',\n });\n\n console.log('');\n }\n\n // Marcar plano como completo\n plan.status = 'completed';\n const duration = Date.now() - startTime;\n\n await this.planPersistence.markPlanCompleted(this.currentPlanFile!, {\n success: errors.length === 0,\n duration,\n errors: errors.length > 0 ? errors : undefined,\n });\n\n console.log('');\n console.log('='.repeat(60));\n this.promptService.success(`✓ Plano concluído em ${(duration / 1000).toFixed(1)}s`);\n console.log(` ${Colors.dim}${completedTasks.length}/${plan.tasks.length} tarefas completadas${Colors.reset}`);\n if (errors.length > 0) {\n console.log(` ${Colors.warning}${errors.length} erros${Colors.reset}`);\n }\n console.log('='.repeat(60));\n console.log('');\n\n } finally {\n this.executing = false;\n this.aborted = false;\n this.currentPlanFile = null;\n this.taskService.clearExecutionContext();\n process.removeListener('SIGINT', ctrlCHandler);\n }\n }\n\n isExecuting(): boolean {\n return this.executing;\n }\n\n abort(): void {\n this.aborted = true;\n }\n}\n"],"names":["PlanExecutorService","getDeepAgent","deepAgent","DeepAgentService","moduleRef","get","strict","executePlan","planId","autoApprove","plan","taskService","getPlans","Error","currentPlanFile","planPersistence","savePlan","promptService","info","console","log","ctrlCHandler","executing","aborted","Colors","warning","reset","process","on","status","startTime","Date","now","completedTasks","errors","i","tasks","length","task","depsSatisfied","dependencies","every","depId","dep","getTask","TaskStatus","COMPLETED","push","id","primary","bold","subject","dim","description","updateTask","IN_PROGRESS","assignedAgent","result","executeTask","success","error","FAILED","updatePlanProgress","currentTask","duration","markPlanCompleted","undefined","repeat","toFixed","clearExecutionContext","removeListener","isExecuting","abort"],"mappings":";;;;+BASaA;;;eAAAA;;;wBATc;sBACD;uC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oBAAoB,EAAEb,aAAM,CAACE,KAAK,EAAE;YAC7G,IAAIQ,OAAOG,MAAM,GAAG,GAAG;gBACrBlB,QAAQC,GAAG,CAAC,CAAC,EAAE,EAAEI,aAAM,CAACC,OAAO,GAAGS,OAAOG,MAAM,CAAC,MAAM,EAAEb,aAAM,CAACE,KAAK,EAAE;YACxE;YACAP,QAAQC,GAAG,CAAC,IAAI+C,MAAM,CAAC;YACvBhD,QAAQC,GAAG,CAAC;QAEd,SAAU;YACR,IAAI,CAACE,SAAS,GAAG;YACjB,IAAI,CAACC,OAAO,GAAG;YACf,IAAI,CAACT,eAAe,GAAG;YACvB,IAAI,CAACH,WAAW,CAAC0D,qBAAqB;YACtC1C,QAAQ2C,cAAc,CAAC,UAAUjD;QACnC;IACF;IAEAkD,cAAuB;QACrB,OAAO,IAAI,CAACjD,SAAS;IACvB;IAEAkD,QAAc;QACZ,IAAI,CAACjD,OAAO,GAAG;IACjB;IA9HA,YACE,AAAQZ,WAAkC,EAC1C,AAAQI,eAAuC,EAC/C,AAAQE,aAA4B,EACpC,AAAQb,SAAoB,CAC5B;aAJQO,cAAAA;aACAI,kBAAAA;aACAE,gBAAAA;aACAb,YAAAA;aATFkB,YAAY;aACZC,UAAU;aACVT,kBAAiC;aACjCZ,YAAiB;IAOtB;AA0HL"}
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "TaskManagementService", {
9
9
  }
10
10
  });
11
11
  const _common = require("@nestjs/common");
12
+ const _events = require("events");
12
13
  const _tasktypes = require("../types/task.types");
13
14
  const _promptservice = require("../../permissions/services/prompt.service");
14
15
  const _theme = require("../../repl/utils/theme");
@@ -43,6 +44,7 @@ let TaskManagementService = class TaskManagementService {
43
44
  dep.blocks.push(id);
44
45
  }
45
46
  }
47
+ this.events.emit('task:created', task);
46
48
  return task;
47
49
  }
48
50
  updateTask(taskId, options) {
@@ -58,6 +60,7 @@ let TaskManagementService = class TaskManagementService {
58
60
  if (options.removeDependencies) {
59
61
  task.dependencies = task.dependencies.filter((id)=>!options.removeDependencies?.includes(id));
60
62
  }
63
+ if (options.assignedAgent !== undefined) task.assignedAgent = options.assignedAgent;
61
64
  if (options.metadata) {
62
65
  task.metadata = {
63
66
  ...task.metadata,
@@ -65,6 +68,11 @@ let TaskManagementService = class TaskManagementService {
65
68
  };
66
69
  }
67
70
  task.updatedAt = Date.now();
71
+ this.events.emit('task:updated', task);
72
+ // Debug log for Kanban updates
73
+ if (options.status) {
74
+ process.stdout.write(`\r Task ${taskId} status updated to: ${options.status}\n`);
75
+ }
68
76
  return task;
69
77
  }
70
78
  getTask(taskId) {
@@ -94,6 +102,7 @@ let TaskManagementService = class TaskManagementService {
94
102
  createdAt: Date.now()
95
103
  };
96
104
  this.plans.set(id, plan);
105
+ this.events.emit('plan:created', plan);
97
106
  return plan;
98
107
  }
99
108
  async approvePlan(planId) {
@@ -198,6 +207,7 @@ let TaskManagementService = class TaskManagementService {
198
207
  const firstWord = subject.split(' ')[0].toLowerCase();
199
208
  const rest = subject.slice(firstWord.length);
200
209
  const gerundMap = {
210
+ // English
201
211
  create: 'Creating',
202
212
  add: 'Adding',
203
213
  implement: 'Implementing',
@@ -208,9 +218,31 @@ let TaskManagementService = class TaskManagementService {
208
218
  refactor: 'Refactoring',
209
219
  test: 'Testing',
210
220
  write: 'Writing',
211
- read: 'Reading'
221
+ read: 'Reading',
222
+ // Portuguese
223
+ criar: 'Criando',
224
+ adicionar: 'Adicionando',
225
+ implementar: 'Implementando',
226
+ corrigir: 'Corrigindo',
227
+ atualizar: 'Atualizando',
228
+ remover: 'Removendo',
229
+ deletar: 'Deletando',
230
+ refatorar: 'Refatorando',
231
+ testar: 'Testando',
232
+ escrever: 'Escrevendo',
233
+ ler: 'Lendo',
234
+ analisar: 'Analisando',
235
+ fazer: 'Fazendo',
236
+ crie: 'Criando',
237
+ adicione: 'Adicionando',
238
+ implemente: 'Implementando',
239
+ corrija: 'Corrigindo',
240
+ atualize: 'Atualizando',
241
+ remova: 'Removendo',
242
+ analise: 'Analisando',
243
+ faça: 'Fazendo'
212
244
  };
213
- const gerund = gerundMap[firstWord] || subject + 'ing';
245
+ const gerund = gerundMap[firstWord] || (subject.length > 20 ? subject.slice(0, 20) + '...' : subject);
214
246
  return gerund + rest;
215
247
  }
216
248
  clearCompletedTasks() {
@@ -237,6 +269,7 @@ let TaskManagementService = class TaskManagementService {
237
269
  }
238
270
  constructor(promptService){
239
271
  this.promptService = promptService;
272
+ this.events = new _events.EventEmitter();
240
273
  this.tasks = new Map();
241
274
  this.plans = new Map();
242
275
  this.taskCounter = 0;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/modules/tasks/services/task-management.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport {\n Task,\n TaskStatus,\n TaskPlan,\n CreateTaskOptions,\n UpdateTaskOptions,\n PlanApprovalOptions,\n PlanExecutionContext,\n} from '../types/task.types';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { Colors } from '../../repl/utils/theme';\n\n\n@Injectable()\nexport class TaskManagementService {\n private tasks: Map<string, Task> = new Map();\n private plans: Map<string, TaskPlan> = new Map();\n private taskCounter = 0;\n private planCounter = 0;\n private executionContext: PlanExecutionContext | null = null;\n\n constructor(private promptService: PromptService) {}\n\n createTask(options: CreateTaskOptions): Task {\n const id = `task-${++this.taskCounter}`;\n\n const task: Task = {\n id,\n subject: options.subject,\n description: options.description,\n activeForm: options.activeForm || this.generateActiveForm(options.subject),\n status: TaskStatus.PENDING,\n createdAt: Date.now(),\n updatedAt: Date.now(),\n dependencies: options.dependencies || [],\n blocks: [],\n metadata: options.metadata || {},\n };\n\n this.tasks.set(id, task);\n\n for (const depId of task.dependencies) {\n const dep = this.tasks.get(depId);\n if (dep) {\n dep.blocks.push(id);\n }\n }\n\n return task;\n }\n\n updateTask(taskId: string, options: UpdateTaskOptions): Task | null {\n const task = this.tasks.get(taskId);\n if (!task) return null;\n\n if (options.status) task.status = options.status;\n if (options.subject) task.subject = options.subject;\n if (options.description) task.description = options.description;\n if (options.activeForm) task.activeForm = options.activeForm;\n\n if (options.addDependencies) {\n task.dependencies.push(...options.addDependencies);\n }\n\n if (options.removeDependencies) {\n task.dependencies = task.dependencies.filter(\n (id) => !options.removeDependencies?.includes(id),\n );\n }\n\n if (options.metadata) {\n task.metadata = { ...task.metadata, ...options.metadata };\n }\n\n task.updatedAt = Date.now();\n return task;\n }\n\n getTask(taskId: string): Task | null {\n return this.tasks.get(taskId) || null;\n }\n\n listTasks(): Task[] {\n return Array.from(this.tasks.values());\n }\n\n listPendingTasks(): Task[] {\n return this.listTasks().filter((task) => {\n if (task.status !== TaskStatus.PENDING) return false;\n\n return task.dependencies.every((depId) => {\n const dep = this.tasks.get(depId);\n return dep && dep.status === TaskStatus.COMPLETED;\n });\n });\n }\n\n createPlan(title: string, description: string, tasks: CreateTaskOptions[]): TaskPlan {\n const id = `plan-${++this.planCounter}`;\n\n const createdTasks = tasks.map((taskOpt) => this.createTask(taskOpt));\n\n const plan: TaskPlan = {\n id,\n title,\n description,\n tasks: createdTasks,\n status: 'draft',\n createdAt: Date.now(),\n };\n\n this.plans.set(id, plan);\n return plan;\n }\n\n async approvePlan(planId: string): Promise<PlanApprovalOptions> {\n const plan = this.plans.get(planId);\n if (!plan) {\n this.promptService.error('Plan not found');\n return { approved: false, autoApprove: false };\n }\n\n // Renderizar plano\n console.log('\\n' + '='.repeat(60));\n this.promptService.info(`📋 PLANO: ${plan.title}`);\n console.log('='.repeat(60));\n console.log('');\n console.log(plan.description);\n console.log('');\n console.log(`${Colors.bold}Tarefas (${plan.tasks.length}):${Colors.reset}`);\n console.log('');\n\n plan.tasks.forEach((task, index) => {\n const depInfo =\n task.dependencies.length > 0\n ? ` ${Colors.muted}(depende de: ${task.dependencies.join(', ')})${Colors.reset}`\n : '';\n console.log(` ${Colors.primary}${index + 1}.${Colors.reset} ${Colors.bold}${task.subject}${Colors.reset}${depInfo}`);\n console.log(` ${Colors.dim}${task.description}${Colors.reset}`);\n console.log('');\n });\n\n console.log('='.repeat(60));\n console.log('');\n\n // Opções aprimoradas\n const choices = [\n {\n key: 'approve',\n label: '1 - Sim',\n description: 'Executar o plano'\n },\n {\n key: 'auto-approve',\n label: '2 - Sim com auto-approve',\n description: 'Executar sem pedir aprovação em cada etapa'\n },\n {\n key: 'modify',\n label: '4 - Digite algo',\n description: 'Modificar o plano antes de executar'\n },\n {\n key: 'cancel',\n label: '3 - Não',\n description: 'Cancelar e não executar'\n },\n ];\n\n const choice = await this.promptService.choice('O que você deseja fazer?', choices);\n\n switch (choice) {\n case 'approve':\n plan.status = 'approved';\n this.promptService.success('✓ Plano aprovado! Iniciando execução...');\n return { approved: true, autoApprove: false };\n\n case 'auto-approve':\n plan.status = 'approved';\n this.promptService.success('✓ Plano aprovado com auto-approve! Execução automática ativada.');\n return { approved: true, autoApprove: true };\n\n case 'modify':\n const modification = await this.promptService.question(\n `${Colors.accent}Como deseja modificar o plano?${Colors.reset}`\n );\n plan.status = 'draft';\n return {\n approved: false,\n autoApprove: false,\n modificationRequested: modification\n };\n\n case 'cancel':\n plan.status = 'cancelled';\n this.promptService.info('Plano cancelado');\n return { approved: false, autoApprove: false };\n\n default:\n return { approved: false, autoApprove: false };\n }\n }\n\n async executePlan(planId: string): Promise<void> {\n const plan = this.plans.get(planId);\n if (!plan) {\n throw new Error('Plan not found');\n }\n\n if (plan.status !== 'approved') {\n throw new Error('Plan must be approved before execution');\n }\n\n plan.status = 'executing';\n this.promptService.info('Starting plan execution...');\n }\n\n private generateActiveForm(subject: string): string {\n const firstWord = subject.split(' ')[0].toLowerCase();\n const rest = subject.slice(firstWord.length);\n\n const gerundMap: Record<string, string> = {\n create: 'Creating',\n add: 'Adding',\n implement: 'Implementing',\n fix: 'Fixing',\n update: 'Updating',\n remove: 'Removing',\n delete: 'Deleting',\n refactor: 'Refactoring',\n test: 'Testing',\n write: 'Writing',\n read: 'Reading',\n };\n\n const gerund = gerundMap[firstWord] || subject + 'ing';\n return gerund + rest;\n }\n\n clearCompletedTasks(): void {\n for (const [id, task] of this.tasks.entries()) {\n if (task.status === TaskStatus.COMPLETED || task.status === TaskStatus.CANCELLED) {\n this.tasks.delete(id);\n }\n }\n }\n\n setExecutionContext(context: PlanExecutionContext): void {\n this.executionContext = context;\n }\n\n getExecutionContext(): PlanExecutionContext | null {\n return this.executionContext;\n }\n\n clearExecutionContext(): void {\n this.executionContext = null;\n }\n\n isAutoApproveActive(): boolean {\n return this.executionContext?.autoApprove ?? false;\n }\n\n getPlans(): Map<string, TaskPlan> {\n return this.plans;\n }\n}\n"],"names":["TaskManagementService","createTask","options","id","taskCounter","task","subject","description","activeForm","generateActiveForm","status","TaskStatus","PENDING","createdAt","Date","now","updatedAt","dependencies","blocks","metadata","tasks","set","depId","dep","get","push","updateTask","taskId","addDependencies","removeDependencies","filter","includes","getTask","listTasks","Array","from","values","listPendingTasks","every","COMPLETED","createPlan","title","planCounter","createdTasks","map","taskOpt","plan","plans","approvePlan","planId","promptService","error","approved","autoApprove","console","log","repeat","info","Colors","bold","length","reset","forEach","index","depInfo","muted","join","primary","dim","choices","key","label","choice","success","modification","question","accent","modificationRequested","executePlan","Error","firstWord","split","toLowerCase","rest","slice","gerundMap","create","add","implement","fix","update","remove","delete","refactor","test","write","read","gerund","clearCompletedTasks","entries","CANCELLED","setExecutionContext","context","executionContext","getExecutionContext","clearExecutionContext","isAutoApproveActive","getPlans","Map"],"mappings":";;;;+BAeaA;;;eAAAA;;;wBAfc;2BASpB;+BACuB;uBACP;;;;;;;;;;AAIhB,IAAA,AAAMA,wBAAN,MAAMA;IASXC,WAAWC,OAA0B,EAAQ;QAC3C,MAAMC,KAAK,CAAC,KAAK,EAAE,EAAE,IAAI,CAACC,WAAW,EAAE;QAEvC,MAAMC,OAAa;YACjBF;YACAG,SAASJ,QAAQI,OAAO;YACxBC,aAAaL,QAAQK,WAAW;YAChCC,YAAYN,QAAQM,UAAU,IAAI,IAAI,CAACC,kBAAkB,CAACP,QAAQI,OAAO;YACzEI,QAAQC,qBA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AClD,MAAM0E,YAAY1E,QAAQ2E,KAAK,CAAC,IAAI,CAAC,EAAE,CAACC,WAAW;QACnD,MAAMC,OAAO7E,QAAQ8E,KAAK,CAACJ,UAAUpB,MAAM;QAE3C,MAAMyB,YAAoC;YACxCC,QAAQ;YACRC,KAAK;YACLC,WAAW;YACXC,KAAK;YACLC,QAAQ;YACRC,QAAQ;YACRC,QAAQ;YACRC,UAAU;YACVC,MAAM;YACNC,OAAO;YACPC,MAAM;QACR;QAEA,MAAMC,SAASZ,SAAS,CAACL,UAAU,IAAI1E,UAAU;QACjD,OAAO2F,SAASd;IAClB;IAEAe,sBAA4B;QAC1B,KAAK,MAAM,CAAC/F,IAAIE,KAAK,IAAI,IAAI,CAACe,KAAK,CAAC+E,OAAO,GAAI;YAC7C,IAAI9F,KAAKK,MAAM,KAAKC,qBAAU,CAAC4B,SAAS,IAAIlC,KAAKK,MAAM,KAAKC,qBAAU,CAACyF,SAAS,EAAE;gBAChF,IAAI,CAAChF,KAAK,CAACwE,MAAM,CAACzF;YACpB;QACF;IACF;IAEAkG,oBAAoBC,OAA6B,EAAQ;QACvD,IAAI,CAACC,gBAAgB,GAAGD;IAC1B;IAEAE,sBAAmD;QACjD,OAAO,IAAI,CAACD,gBAAgB;IAC9B;IAEAE,wBAA8B;QAC5B,IAAI,CAACF,gBAAgB,GAAG;IAC1B;IAEAG,sBAA+B;QAC7B,OAAO,IAAI,CAACH,gBAAgB,EAAElD,eAAe;IAC/C;IAEAsD,WAAkC;QAChC,OAAO,IAAI,CAAC5D,KAAK;IACnB;IApPA,YAAY,AAAQG,aAA4B,CAAE;aAA9BA,gBAAAA;aANZ9B,QAA2B,IAAIwF;aAC/B7D,QAA+B,IAAI6D;aACnCxG,cAAc;aACdsC,cAAc;aACd6D,mBAAgD;IAEL;AAqPrD"}
1
+ {"version":3,"sources":["../../../../src/modules/tasks/services/task-management.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport { EventEmitter } from 'events';\nimport {\n Task,\n TaskStatus,\n TaskPlan,\n CreateTaskOptions,\n UpdateTaskOptions,\n PlanApprovalOptions,\n PlanExecutionContext,\n} from '../types/task.types';\nimport { PromptService } from '../../permissions/services/prompt.service';\nimport { Colors } from '../../repl/utils/theme';\n\n@Injectable()\nexport class TaskManagementService {\n readonly events = new EventEmitter();\n private tasks: Map<string, Task> = new Map();\n private plans: Map<string, TaskPlan> = new Map();\n private taskCounter = 0;\n private planCounter = 0;\n private executionContext: PlanExecutionContext | null = null;\n\n constructor(private promptService: PromptService) {}\n\n createTask(options: CreateTaskOptions): Task {\n const id = `task-${++this.taskCounter}`;\n\n const task: Task = {\n id,\n subject: options.subject,\n description: options.description,\n activeForm: options.activeForm || this.generateActiveForm(options.subject),\n status: TaskStatus.PENDING,\n createdAt: Date.now(),\n updatedAt: Date.now(),\n dependencies: options.dependencies || [],\n blocks: [],\n metadata: options.metadata || {},\n };\n\n this.tasks.set(id, task);\n\n for (const depId of task.dependencies) {\n const dep = this.tasks.get(depId);\n if (dep) {\n dep.blocks.push(id);\n }\n }\n\n this.events.emit('task:created', task);\n return task;\n }\n\n updateTask(taskId: string, options: UpdateTaskOptions): Task | null {\n const task = this.tasks.get(taskId);\n if (!task) return null;\n\n if (options.status) task.status = options.status;\n if (options.subject) task.subject = options.subject;\n if (options.description) task.description = options.description;\n if (options.activeForm) task.activeForm = options.activeForm;\n\n if (options.addDependencies) {\n task.dependencies.push(...options.addDependencies);\n }\n\n if (options.removeDependencies) {\n task.dependencies = task.dependencies.filter(\n (id) => !options.removeDependencies?.includes(id),\n );\n }\n\n if (options.assignedAgent !== undefined) task.assignedAgent = options.assignedAgent;\n\n if (options.metadata) {\n task.metadata = { ...task.metadata, ...options.metadata };\n }\n\n task.updatedAt = Date.now();\n this.events.emit('task:updated', task);\n \n // Debug log for Kanban updates\n if (options.status) {\n process.stdout.write(`\\r Task ${taskId} status updated to: ${options.status}\\n`);\n }\n\n return task;\n }\n\n getTask(taskId: string): Task | null {\n return this.tasks.get(taskId) || null;\n }\n\n listTasks(): Task[] {\n return Array.from(this.tasks.values());\n }\n\n listPendingTasks(): Task[] {\n return this.listTasks().filter((task) => {\n if (task.status !== TaskStatus.PENDING) return false;\n\n return task.dependencies.every((depId) => {\n const dep = this.tasks.get(depId);\n return dep && dep.status === TaskStatus.COMPLETED;\n });\n });\n }\n\n createPlan(title: string, description: string, tasks: CreateTaskOptions[]): TaskPlan {\n const id = `plan-${++this.planCounter}`;\n\n const createdTasks = tasks.map((taskOpt) => this.createTask(taskOpt));\n\n const plan: TaskPlan = {\n id,\n title,\n description,\n tasks: createdTasks,\n status: 'draft',\n createdAt: Date.now(),\n };\n\n this.plans.set(id, plan);\n this.events.emit('plan:created', plan);\n return plan;\n }\n\n async approvePlan(planId: string): Promise<PlanApprovalOptions> {\n const plan = this.plans.get(planId);\n if (!plan) {\n this.promptService.error('Plan not found');\n return { approved: false, autoApprove: false };\n }\n\n // Renderizar plano\n console.log('\\n' + '='.repeat(60));\n this.promptService.info(`📋 PLANO: ${plan.title}`);\n console.log('='.repeat(60));\n console.log('');\n console.log(plan.description);\n console.log('');\n console.log(`${Colors.bold}Tarefas (${plan.tasks.length}):${Colors.reset}`);\n console.log('');\n\n plan.tasks.forEach((task, index) => {\n const depInfo =\n task.dependencies.length > 0\n ? ` ${Colors.muted}(depende de: ${task.dependencies.join(', ')})${Colors.reset}`\n : '';\n console.log(` ${Colors.primary}${index + 1}.${Colors.reset} ${Colors.bold}${task.subject}${Colors.reset}${depInfo}`);\n console.log(` ${Colors.dim}${task.description}${Colors.reset}`);\n console.log('');\n });\n\n console.log('='.repeat(60));\n console.log('');\n\n // Opções aprimoradas\n const choices = [\n {\n key: 'approve',\n label: '1 - Sim',\n description: 'Executar o plano'\n },\n {\n key: 'auto-approve',\n label: '2 - Sim com auto-approve',\n description: 'Executar sem pedir aprovação em cada etapa'\n },\n {\n key: 'modify',\n label: '4 - Digite algo',\n description: 'Modificar o plano antes de executar'\n },\n {\n key: 'cancel',\n label: '3 - Não',\n description: 'Cancelar e não executar'\n },\n ];\n\n const choice = await this.promptService.choice('O que você deseja fazer?', choices);\n\n switch (choice) {\n case 'approve':\n plan.status = 'approved';\n this.promptService.success('✓ Plano aprovado! Iniciando execução...');\n return { approved: true, autoApprove: false };\n\n case 'auto-approve':\n plan.status = 'approved';\n this.promptService.success('✓ Plano aprovado com auto-approve! Execução automática ativada.');\n return { approved: true, autoApprove: true };\n\n case 'modify':\n const modification = await this.promptService.question(\n `${Colors.accent}Como deseja modificar o plano?${Colors.reset}`\n );\n plan.status = 'draft';\n return {\n approved: false,\n autoApprove: false,\n modificationRequested: modification\n };\n\n case 'cancel':\n plan.status = 'cancelled';\n this.promptService.info('Plano cancelado');\n return { approved: false, autoApprove: false };\n\n default:\n return { approved: false, autoApprove: false };\n }\n }\n\n async executePlan(planId: string): Promise<void> {\n const plan = this.plans.get(planId);\n if (!plan) {\n throw new Error('Plan not found');\n }\n\n if (plan.status !== 'approved') {\n throw new Error('Plan must be approved before execution');\n }\n\n plan.status = 'executing';\n this.promptService.info('Starting plan execution...');\n }\n\n private generateActiveForm(subject: string): string {\n const firstWord = subject.split(' ')[0].toLowerCase();\n const rest = subject.slice(firstWord.length);\n\n const gerundMap: Record<string, string> = {\n // English\n create: 'Creating',\n add: 'Adding',\n implement: 'Implementing',\n fix: 'Fixing',\n update: 'Updating',\n remove: 'Removing',\n delete: 'Deleting',\n refactor: 'Refactoring',\n test: 'Testing',\n write: 'Writing',\n read: 'Reading',\n // Portuguese\n criar: 'Criando',\n adicionar: 'Adicionando',\n implementar: 'Implementando',\n corrigir: 'Corrigindo',\n atualizar: 'Atualizando',\n remover: 'Removendo',\n deletar: 'Deletando',\n refatorar: 'Refatorando',\n testar: 'Testando',\n escrever: 'Escrevendo',\n ler: 'Lendo',\n analisar: 'Analisando',\n fazer: 'Fazendo',\n crie: 'Criando',\n adicione: 'Adicionando',\n implemente: 'Implementando',\n corrija: 'Corrigindo',\n atualize: 'Atualizando',\n remova: 'Removendo',\n analise: 'Analisando',\n faça: 'Fazendo',\n };\n\n const gerund = gerundMap[firstWord] || (subject.length > 20 ? subject.slice(0, 20) + '...' : subject);\n return gerund + rest;\n }\n\n clearCompletedTasks(): void {\n for (const [id, task] of this.tasks.entries()) {\n if (task.status === TaskStatus.COMPLETED || task.status === TaskStatus.CANCELLED) {\n this.tasks.delete(id);\n }\n }\n }\n\n setExecutionContext(context: PlanExecutionContext): void {\n this.executionContext = context;\n }\n\n getExecutionContext(): PlanExecutionContext | null {\n return this.executionContext;\n }\n\n clearExecutionContext(): void {\n this.executionContext = null;\n }\n\n isAutoApproveActive(): boolean {\n return this.executionContext?.autoApprove ?? false;\n }\n\n getPlans(): Map<string, TaskPlan> {\n return this.plans;\n }\n}\n"],"names":["TaskManagementService","createTask","options","id","taskCounter","task","subject","description","activeForm","generateActiveForm","status","TaskStatus","PENDING","createdAt","Date","now","updatedAt","dependencies","blocks","metadata","tasks","set","depId","dep","get","push","events","emit","updateTask","taskId","addDependencies","removeDependencies","filter","includes","assignedAgent","undefined","process","stdout","write","getTask","listTasks","Array","from","values","listPendingTasks","every","COMPLETED","createPlan","title","planCounter","createdTasks","map","taskOpt","plan","plans","approvePlan","planId","promptService","error","approved","autoApprove","console","log","repeat","info","Colors","bold","length","reset","forEach","index","depInfo","muted","join","primary","dim","choices","key","label","choice","success","modification","question","accent","modificationRequested","executePlan","Error","firstWord","split","toLowerCase","rest","slice","gerundMap","create","add","implement","fix","update","remove","delete","refactor","test","read","criar","adicionar","implementar","corrigir","atualizar","remover","deletar","refatorar","testar","escrever","ler","analisar","fazer","crie","adicione","implemente","corrija","atualize","remova","analise","faça","gerund","clearCompletedTasks","entries","CANCELLED","setExecutionContext","context","executionContext","getExecutionContext","clearExecutionContext","isAutoApproveActive","getPlans","EventEmitter","Map"],"mappings":";;;;+BAeaA;;;eAAAA;;;wBAfc;wBACE;2BAStB;+BACuB;uBACP;;;;;;;;;;AAGhB,IAAA,AAAMA,wBAAN,MAAMA;IAUXC,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