Update ashboard, dashboard, memory (+1 ~4)

This commit is contained in:
Echo
2026-02-15 23:17:09 +00:00
parent aa6875ed0c
commit 2eca94abaf
5 changed files with 653 additions and 4 deletions

View File

@@ -82,6 +82,8 @@ class TaskBoardHandler(SimpleHTTPRequestHandler):
self.handle_eco_stop()
elif self.path == '/api/eco/sessions/clear':
self.handle_eco_sessions_clear()
elif self.path == '/api/eco/git-commit':
self.handle_eco_git_commit()
else:
self.send_error(404)
@@ -311,6 +313,8 @@ class TaskBoardHandler(SimpleHTTPRequestHandler):
self.handle_eco_logs()
elif self.path == '/api/eco/doctor':
self.handle_eco_doctor()
elif self.path == '/api/eco/git' or self.path.startswith('/api/eco/git?'):
self.handle_eco_git_status()
elif self.path.startswith('/api/'):
self.send_error(404)
else:
@@ -2309,6 +2313,96 @@ class TaskBoardHandler(SimpleHTTPRequestHandler):
self.send_json({'checks': checks})
def handle_eco_git_status(self):
"""Get git status for echo-core repo."""
try:
workspace = ECHO_CORE_DIR
branch = subprocess.run(
['git', 'branch', '--show-current'],
cwd=workspace, capture_output=True, text=True, timeout=5
).stdout.strip()
last_commit = subprocess.run(
['git', 'log', '-1', '--format=%h|%s|%cr'],
cwd=workspace, capture_output=True, text=True, timeout=5
).stdout.strip()
commit_parts = last_commit.split('|') if last_commit else ['', '', '']
status_output = subprocess.run(
['git', 'status', '--short'],
cwd=workspace, capture_output=True, text=True, timeout=5
).stdout.strip()
uncommitted = [f for f in status_output.split('\n') if f.strip()] if status_output else []
uncommitted_parsed = []
for line in uncommitted:
if len(line) >= 2:
status = line[:2].strip()
filepath = line[2:].strip()
if filepath:
uncommitted_parsed.append({'status': status, 'path': filepath})
self.send_json({
'branch': branch,
'clean': len(uncommitted) == 0,
'uncommittedCount': len(uncommitted),
'uncommittedParsed': uncommitted_parsed,
'lastCommit': {
'hash': commit_parts[0] if len(commit_parts) > 0 else '',
'message': commit_parts[1] if len(commit_parts) > 1 else '',
'time': commit_parts[2] if len(commit_parts) > 2 else '',
},
})
except Exception as e:
self.send_json({'error': str(e)}, 500)
def handle_eco_git_commit(self):
"""Run git add, commit, and push for echo-core repo."""
try:
workspace = ECHO_CORE_DIR
# Stage all changes
subprocess.run(
['git', 'add', '-A'],
cwd=workspace, capture_output=True, text=True, timeout=10
)
# Check if there's anything to commit
status = subprocess.run(
['git', 'status', '--porcelain'],
cwd=workspace, capture_output=True, text=True, timeout=5
).stdout.strip()
if not status:
self.send_json({'success': True, 'files': 0, 'output': 'Nothing to commit'})
return
files_count = len([l for l in status.split('\n') if l.strip()])
# Commit
commit_result = subprocess.run(
['git', 'commit', '-m', 'chore: auto-commit from dashboard'],
cwd=workspace, capture_output=True, text=True, timeout=30
)
# Push
push_result = subprocess.run(
['git', 'push'],
cwd=workspace, capture_output=True, text=True, timeout=30
)
output = commit_result.stdout + commit_result.stderr + push_result.stdout + push_result.stderr
if commit_result.returncode == 0:
self.send_json({'success': True, 'files': files_count, 'output': output})
else:
self.send_json({'success': False, 'error': output or 'Commit failed'})
except Exception as e:
self.send_json({'success': False, 'error': str(e)}, 500)
def handle_eco_sessions_clear(self):
"""Clear active sessions (all or specific channel)."""
try: