/** * Statusline script section: compact line, multi-line dashboard, JSON output, * mode state file and main entry point. * Spliced verbatim into generateStatuslineScript() output. */ export declare const STATUSLINE_RENDER_SECTION = "// \u2500\u2500 Single-line statusline (compact) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nfunction generateStatusline() {\n const git = getGitInfo();\n const monoswarm = getMonoswarmStatus();\n const system = getSystemMetrics();\n const hooks = getHooksStatus();\n const knowledge = getKnowledgeStats();\n const triggers = getTriggerStats();\n const parts = [];\n\n // Brand + swarm dot\n const monoswarmDot = monoswarm.coordinationActive ? `${x.green}\u25CF${x.reset}` : `${x.slate}\u25CB${x.reset}`;\n parts.push(`${x.bold}${x.purple}\u258A Monomind${x.reset} ${monoswarmDot}`);\n\n // Git branch + changes (compact)\n if (git.gitBranch) {\n let b = `${x.sky}\u2387 ${x.bold}${git.gitBranch}${x.reset}`;\n if (git.staged > 0) b += ` ${x.green}+${git.staged}${x.reset}`;\n if (git.modified > 0) b += ` ${x.gold}~${git.modified}${x.reset}`;\n if (git.ahead > 0) b += ` ${x.green}\u2191${git.ahead}${x.reset}`;\n if (git.behind > 0) b += ` ${x.coral}\u2193${git.behind}${x.reset}`;\n parts.push(b);\n }\n\n // Model\n parts.push(`${x.violet}${getModelName()}${x.reset}`);\n\n // Active agent\n const activeAgent = getActiveAgent();\n if (activeAgent) {\n const col = activeAgent.activated ? x.green : x.sky;\n const icon = activeAgent.activated ? '\u25CF' : '\u2192';\n parts.push(`${col}${icon} ${x.bold}${activeAgent.name}${x.reset}`);\n }\n\n // Intelligence\n const ic = pctColor(system.intelligencePct);\n parts.push(`${ic}\uD83D\uDCA1 ${system.intelligencePct}%${x.reset}`);\n\n // Knowledge chunks (Task 28) \u2014 show when populated\n if (knowledge.chunks > 0) {\n parts.push(`${x.teal}\uD83D\uDCDA ${knowledge.chunks}k${x.reset}`);\n }\n\n // V4: graph staleness \u2014 visible warning when the monograph is behind HEAD.\n // Silent staleness is the most dangerous failure mode (the user trusts a\n // stale answer), so surface commits-behind on the statusline itself.\n const graph = getMonographStats();\n if (graph.exists && graph.nodes > 0) {\n const stale = getGraphStaleness();\n if (stale && stale.commitsBehind > 0) {\n // Color escalates with staleness: green <=3, gold <=10, coral >10.\n const staleCol = stale.commitsBehind <= 3 ? x.green\n : stale.commitsBehind <= 10 ? x.gold : x.coral;\n parts.push(`${staleCol}\u229B ${graph.nodes}n ${stale.commitsBehind}behind${x.reset}`);\n } else {\n parts.push(`${x.teal}\u229B ${graph.nodes}n${x.reset}`);\n }\n }\n\n // Triggers (Task 32) \u2014 show when populated\n if (triggers.triggers > 0) {\n parts.push(`${x.mint}\uD83C\uDFAF ${triggers.triggers}t${x.reset}`);\n }\n\n // Swarm agents (only when active)\n if (monoswarm.activeAgents > 0) {\n parts.push(`${x.gold}\uD83D\uDC1D ${monoswarm.activeAgents}/${monoswarm.maxAgents}${x.reset}`);\n }\n\n // Hooks\n if (hooks.enabled > 0) {\n parts.push(`${x.mint}\u26A1 ${hooks.enabled}h${x.reset}`);\n }\n\n // Daemon alerts \u2014 only show when there's something worth flagging\n const alerts = getDaemonAlerts();\n if (alerts.security && (alerts.security.riskLevel === 'high' || alerts.security.riskLevel === 'critical')) {\n parts.push(`${x.coral}\uD83D\uDEE1 ${alerts.security.findings}${x.reset}`);\n }\n if (alerts.testgaps && alerts.testgaps.uncovered > 0) {\n parts.push(`${x.gold}\uD83E\uDDEA ${alerts.testgaps.uncovered}${x.reset}`);\n }\n\n return parts.join(` ${DIV} `);\n}\n\n// Neural Control Room liveness. Port comes from .monomind/control.json, written\n// by control-start.cjs when it spawns src/ui/server.mjs. No control.json means\n// the dashboard was never started in this project \u2014 caller hides the row.\nfunction getDashboardHealth() {\n const ctl = readJSON(path.join(CWD, '.monomind', 'control.json'));\n const port = ctl && Number(ctl.port);\n if (!port) return { configured: false, port: 0, frontendUp: false, backendUp: false };\n // One curl, two transfers (curl re-applies -w after each URL/-o pair) \u2014 half the\n // process-spawn cost of two calls. The trailing space in '%{http_code} ' is what\n // separates the two codes; without it they'd concatenate into \"200401\".\n // curl's own --max-time fires before safeExec's outer timeout so a hung server\n // yields curl's clean empty-string failure instead of an execSync kill.\n const out = cached('dashProbe:' + port, TTL.git, () => safeExec(\n \"curl -s --max-time 0.4 --connect-timeout 0.2 -w '%{http_code} '\"\n + \" -o /dev/null http://127.0.0.1:\" + port + \"/\"\n + \" -o /dev/null http://127.0.0.1:\" + port + \"/api/status\",\n 900,\n ));\n const codes = out.split(' ');\n const back = Number(codes[1]);\n return {\n configured: true,\n port: port,\n // '/' is an open route (server.mjs _OPEN_ROUTES) \u2014 a real 200 proves the HTML\n // bundle serves. Must be GET: HEAD / 404s, the handler only matches GET.\n frontendUp: codes[0] === '200',\n // /api/status is auth-gated (401 without a token) \u2014 any HTTP status at all\n // proves the process is answering. Mirrors server.mjs's own unauthenticated\n // liveness probe in writeDashboardToken() (fetch + no status check).\n backendUp: back >= 100 && back <= 599,\n };\n}\n\n// \u2500\u2500 Multi-line dashboard (full mode) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nfunction generateDashboard() {\n const git = getGitInfo();\n const modelName = getModelName();\n const progress = getv1Progress();\n const security = getSecurityStatus();\n const monoswarm = getMonoswarmStatus();\n const system = getSystemMetrics();\n const adrs = getADRStatus();\n const hooks = getHooksStatus();\n const memoryStats = getMemoryStats();\n const tests = getTestStats();\n const session = getSessionStats();\n const integration = getIntegrationStatus();\n const knowledge = getKnowledgeStats();\n const triggers = getTriggerStats();\n const si = getSIBudget();\n const sec = secBadge(security.status);\n const activeAgent = getActiveAgent();\n const lines = [];\n\n // \u2500\u2500 Header: brand + git + model + session \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const monoswarmDot = monoswarm.coordinationActive ? `${x.green}\u25CF LIVE${x.reset}` : `${x.slate}\u25CB IDLE${x.reset}`;\n const projName = getProjectName();\n const cwdName = path.basename(CWD);\n let hdr = `${x.bold}${x.purple}\u258A Monomind ${VERSION}${x.reset} ${monoswarmDot} ${x.teal}${x.bold}${projName}${x.reset} ${DIV} ${x.dim}\u25CE ${cwdName}${x.reset} ${DIV} ${x.violet}\u2B21 ${git.name}${x.reset}`;\n\n if (git.gitBranch) {\n hdr += ` ${DIV} ${x.sky}\u2387 ${x.bold}${git.gitBranch}${x.reset}`;\n if (git.staged > 0) hdr += ` ${x.green}+${git.staged}${x.reset}`;\n if (git.modified > 0) hdr += ` ${x.gold}~${git.modified} mod${x.reset}`;\n if (git.untracked > 0) hdr += ` ${x.slate}?${git.untracked}${x.reset}`;\n if (git.ahead > 0) hdr += ` ${x.green}\u2191${git.ahead}${x.reset}`;\n if (git.behind > 0) hdr += ` ${x.coral}\u2193${git.behind}${x.reset}`;\n }\n\n hdr += ` ${DIV} \uD83E\uDD16 ${x.violet}${x.bold}${modelName}${x.reset}`;\n if (session.duration) hdr += ` ${x.dim}\u23F1 ${session.duration}${x.reset}`;\n\n lines.push(hdr);\n lines.push(SEP);\n\n // \u2500\u2500 Row 1: Active agent + Loop status \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n let agentStr;\n if (activeAgent) {\n const col = activeAgent.activated ? x.green : x.sky;\n const mark = activeAgent.activated ? `${col}${x.bold}\u25CF ACTIVE${x.reset} ` : '';\n const conf = activeAgent.activated ? '' : ` ${x.slate}${(activeAgent.confidence * 100).toFixed(0)}%${x.reset}`;\n agentStr = `${mark}${col}\uD83D\uDC64 ${x.bold}${activeAgent.name}${x.reset}${conf}`;\n } else {\n agentStr = `${x.slate}\uD83D\uDC64 no agent routed${x.reset}`;\n }\n\n const loopState = getLoopStatus();\n let loopStr;\n if (loopState.count > 0) {\n const parts = loopState.loops.slice(0, 2).map(l => {\n const status = l.status === 'hil:pending'\n ? `${x.coral}\u23F3 HIL${x.reset}`\n : `${x.green}\u27F3${x.reset}`;\n const tag = l.type === 'tillend'\n ? `${x.bold}${l.cmd}${x.reset}${x.slate} run ${l.rep}${x.reset}`\n : `${x.bold}${l.cmd}${x.reset}${x.slate} ${l.rep}/${l.max}${x.reset}`;\n return `${status} ${tag}`;\n });\n loopStr = `${x.gold}\uD83D\uDD04${x.reset} ${parts.join(`${x.slate} \u00B7 ${x.reset}`)}`;\n if (loopState.count > 2) loopStr += `${x.slate} +${loopState.count - 2} more${x.reset}`;\n } else {\n loopStr = `${x.slate}\uD83D\uDD04 no active loops${x.reset}`;\n }\n\n // Graph usage ratio + hook hint count \u2014 show only when there's data\n const usage = getGraphUsage();\n let usageStr = '';\n if (usage) {\n const col = usage.pct >= 40 ? x.green : usage.pct >= 15 ? x.gold : x.coral;\n const hintStr = ` ${x.slate}\uD83D\uDCA1 ${usage.hints} hints${x.reset}`;\n usageStr = ` ${DIV} ${col}\uD83D\uDCCA graph ${usage.pct}%${x.reset}${x.slate} \u00B7 grep ${100 - usage.pct}%${x.reset}${hintStr}`;\n }\n\n // Hook latency \u2014 surface when slow (>500ms per prompt)\n const lat = getHookLatency();\n let latStr = '';\n if (lat && lat.perPromptMs > 500) {\n latStr = ` ${DIV} ${x.coral}\u26A1 hooks ${lat.perPromptMs}ms${x.reset}`;\n } else if (lat && lat.perPromptMs > 0) {\n latStr = ` ${DIV} ${x.dim}\u26A1 ${lat.perPromptMs}ms${x.reset}`;\n }\n\n lines.push(`${x.purple}\uD83E\uDD16 AGENT${x.reset} ${agentStr} ${DIV} ${loopStr}${usageStr}${latStr}`);\n lines.push(SEP);\n\n // \u2500\u2500 Row 2: Graph freshness + Pending HIL \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const gf = getMonographStats();\n const freshness = getGraphFreshness();\n let graphStr;\n if (gf.exists) {\n const nodesFmt = gf.nodes >= 1000 ? `${(gf.nodes / 1000).toFixed(0)}k` : `${gf.nodes}`;\n const freshTag = freshness.fresh\n ? `${x.green}\u25CF fresh${x.reset}`\n : freshness.stale\n ? `${x.coral}\u25CF ${freshness.commitsBehind} commits stale${x.reset}`\n : `${x.gold}\u25CF ${freshness.commitsBehind} behind${x.reset}`;\n graphStr = `${x.sky}\uD83D\uDD17 ${x.bold}${nodesFmt}${x.reset}${x.slate} nodes${x.reset} ${freshTag}`;\n } else {\n graphStr = `${x.slate}\uD83D\uDD17 no graph${x.reset}`;\n }\n\n // Document / knowledge stats\n const docStats = getDocStats();\n let docStr = '';\n if (docStats.exists) {\n const parts = [];\n if (docStats.docs > 0) {\n const docFmt = docStats.docs >= 1000 ? `${(docStats.docs / 1000).toFixed(1)}k` : `${docStats.docs}`;\n parts.push(`${x.bold}${docFmt}${x.reset}${x.slate} docs${x.reset}`);\n }\n if (docStats.chunks > 0) parts.push(`${x.bold}${docStats.chunks}${x.reset}${x.slate} chunks${x.reset}`);\n if (docStats.memories > 0) parts.push(`${x.bold}${docStats.memories}${x.reset}${x.slate} memories${x.reset}`);\n if (parts.length) docStr = ` ${DIV} ${x.sky}\uD83D\uDCC4${x.reset} ${parts.join(' ')}`;\n }\n\n const hil = getHILPending();\n const hilStr = hil.pending > 0\n ? ` ${DIV} ${x.coral}\u2728 ${x.bold}${hil.pending}${x.reset}${x.coral} HIL pending${x.reset}`\n : ``;\n\n lines.push(`${x.teal}\uD83E\uDDE0 CONTEXT${x.reset} ${graphStr}${docStr}${hilStr}`);\n\n // \u2500\u2500 Row 3: Daemon worker alerts (security / testgaps / benchmark) \u2500\u2500\n const alerts = getDaemonAlerts();\n const alertParts = [];\n if (alerts.security) {\n const s = alerts.security;\n const col = s.riskLevel === 'critical' || s.riskLevel === 'high' ? x.coral : s.findings > 0 ? x.gold : x.green;\n alertParts.push(`${col}\uD83D\uDEE1 sec ${s.riskLevel}${s.findings > 0 ? ` (${s.findings})` : ''}${x.reset}`);\n }\n if (alerts.testgaps) {\n alertParts.push(`${x.gold}\uD83E\uDDEA gaps ${alerts.testgaps.uncovered}${x.reset}`);\n }\n if (alerts.benchmark && alerts.benchmark.heapMB !== null) {\n alertParts.push(`${x.slate}\u23F1 bench heap ${alerts.benchmark.heapMB}MB${alerts.benchmark.uptimeMin !== null ? ` up ${alerts.benchmark.uptimeMin}m` : ''}${x.reset}`);\n }\n if (alertParts.length > 0) {\n lines.push(SEP);\n lines.push(`${x.purple}\u2699\uFE0F WORKERS${x.reset} ${alertParts.join(` ${DIV} `)}`);\n }\n\n // \u2500\u2500 Row: Neural Control Room liveness \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const dash = getDashboardHealth();\n if (dash.configured) {\n lines.push(SEP);\n const fe = `${dot(dash.frontendUp ? 'good' : 'error')}${x.slate} ui${x.reset}`;\n const be = `${dot(dash.backendUp ? 'good' : 'error')}${x.slate} api${x.reset}`;\n const where = (dash.frontendUp || dash.backendUp)\n ? `${x.dim}:${dash.port}${x.reset}`\n : `${x.coral}down :${dash.port}${x.reset}`;\n lines.push(`${x.purple}\uD83D\uDDA5 DASH${x.reset} ${fe} ${be} ${DIV} ${where}`);\n }\n\n return lines.join('\\n');\n}\n\n// \u2500\u2500 JSON output \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nfunction generateJSON() {\n const git = getGitInfo();\n return {\n user: { name: git.name, gitBranch: git.gitBranch, modelName: getModelName() },\n domains: getv1Progress(),\n security: getSecurityStatus(),\n monoswarm: getMonoswarmStatus(),\n system: getSystemMetrics(),\n adrs: getADRStatus(),\n hooks: getHooksStatus(),\n memory: getMemoryStats(),\n tests: getTestStats(),\n git: { modified: git.modified, untracked: git.untracked, staged: git.staged, ahead: git.ahead, behind: git.behind },\n daemonAlerts: getDaemonAlerts(),\n lastUpdated: new Date().toISOString(),\n };\n}\n\n// \u2500\u2500\u2500 Mode state file \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst MODE_FILE = path.join(CWD, '.monomind', 'statusline-mode.txt');\n\nfunction readMode() {\n try {\n const modeStat = safeStat(MODE_FILE);\n if (modeStat && modeStat.size <= 1024) {\n return fs.readFileSync(MODE_FILE, 'utf-8').trim();\n }\n } catch (err) { if (process.env.MONOMIND_DEBUG) console.error('[statusline]', err); /* ignore */ }\n return 'full'; // default\n}\n\n// \u2500\u2500\u2500 Main \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nif (process.argv.includes('--json')) {\n console.log(JSON.stringify(generateJSON(), null, 2));\n} else if (process.argv.includes('--compact')) {\n console.log(JSON.stringify(generateJSON()));\n} else if (process.argv.includes('--single-line')) {\n console.log(generateStatusline());\n} else if (process.argv.includes('--toggle')) {\n // Toggle mode and print the new view\n const current = readMode();\n const next = current === 'compact' ? 'full' : 'compact';\n try {\n fs.mkdirSync(path.dirname(MODE_FILE), { recursive: true });\n fs.writeFileSync(MODE_FILE, next, 'utf-8');\n } catch (err) { if (process.env.MONOMIND_DEBUG) console.error('[statusline]', err); /* ignore */ }\n if (next === 'compact') {\n console.log(generateStatusline());\n } else {\n console.log(generateDashboard());\n }\n} else {\n // Default: respect mode state file. Spawning segments come from the\n // per-project segment cache (see cached()), so this stays cheap.\n const mode = readMode();\n console.log(mode === 'compact' ? generateStatusline() : generateDashboard());\n}\n"; //# sourceMappingURL=statusline-script-render.d.ts.map