Files
Nexus/docs/reports/step-3-webssh/engineering-report.md
T
Your Name 3ecd3d75d4 docs: reports + research + team roster + tech-stack evaluation
Add implementation progress reports, review reports (CTO/quality/deploy),
session log, signoff table, team roster, collaboration charter,
tech-stack evaluation and inventory, research reports.
Remove obsolete multisync_server.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 22:12:29 +08:00

1.4 KiB

第三步:Web SSH终端 — 工程部工作报告

日期: 2026-05-21 部门: 工程部 负责人: CTO 任务编号: W1-W5


工作内容

W1: asyncssh 连接池模块(引用计数模式)

  • server/infrastructure/ssh/asyncssh_pool.py
  • AsyncSSHPool 类:引用计数 + 自动空闲清理 + 最大连接数限制
  • acquire(server) / release(server_id) / close_connection(server_id)
  • 全局实例 ssh_pool,在 main.py lifespan 中 start/stop
  • exec_ssh_command(server, command) 替换旧 paramiko exec_command

W2: 替换 paramiko 调用

  • asyncssh_pool 提供统一的 exec_ssh_command() 接口
  • server/infrastructure/ssh/pool.py 保留(paramiko),Sync引擎逐步迁移

W3: /ws/terminal/{token} 端点

  • server/api/webssh.py — WebSocket终端端点
  • JWT认证(查询参数)
  • 会话追踪(SshSession 记录)
  • 命令日志(CommandLog 按行记录)

W4: xterm.js 前端页面

  • web/app/terminal.html — Tailwind + xterm.js + WebSocket
  • 自适应窗口、断开连接、全屏切换

W5: Koko 消息协议

  • TERMINAL_INIT / DATA / RESIZE / CLOSE / ERROR 消息类型
  • 终端尺寸变更同步

交付物

  • server/infrastructure/ssh/asyncssh_pool.py — asyncssh连接池
  • server/api/webssh.py — WebSSH端点+Koko协议
  • web/app/terminal.html — xterm.js终端页面

验收意见

待测试部压力测试 + ECC组安全审查