
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
基于 React + Ink 的终端 AI 对话客户端,连接 WebAgent 后端服务。
@file 引用本地文件注入对话上下文/help、/model、/session、/tools 等快捷命令ENABLE_FILE_TUNNEL=true 时,LLM 调用的文件操作在客户端本地执行| 层级 | 技术 |
|---|---|
| UI 框架 | React 19 + Ink 6 |
| Markdown | marked + marked-terminal |
| 代码分析 | tree-sitter(支持 10 种语言) |
| HTTP 客户端 | 内置 fetch(eventsource-parser 解析 SSE) |
| CLI 参数 | yargs |
| 图结构 | graphology(代码分析依赖图) |
MistAgentcli/
├── index.ts # 入口文件
├── src/
│ ├── main.tsx # React 渲染入口
│ ├── api/ # 后端 API 客户端
│ │ ├── client.ts # HTTP 客户端(baseURL + token)
│ │ ├── auth.ts # 登录/认证 API
│ │ ├── chat.ts # 对话 API(SSE 流式)
│ │ ├── sessions.ts # 会话管理 API
│ │ ├── models.ts # 模型列表/切换 API
│ │ ├── tools.ts # 工具列表 API
│ │ └── tunnel.ts # 文件穿透结果回传 API
│ ├── components/ # UI 组件
│ │ ├── App.tsx # 根组件
│ │ ├── AppLayout.tsx # 布局
│ │ ├── Composer.tsx # 输入编辑器
│ │ ├── MainContent.tsx # 主内容区
│ │ ├── Header.tsx # 顶栏
│ │ ├── Footer.tsx # 底栏
│ │ ├── LoginPrompt.tsx # 登录界面
│ │ ├── ModelPicker.tsx # 模型选择器
│ │ ├── SessionPicker.tsx # 会话选择器
│ │ ├── messages/ # 消息类型组件
│ │ └── shared/ # 通用组件
│ ├── contexts/ # React Context
│ │ ├── AppContext.tsx # 应用级状态
│ │ ├── ChatContext.tsx # 对话状态
│ │ ├── SessionContext.tsx # 会话状态
│ │ ├── ModelContext.tsx # 模型状态
│ │ ├── UIContext.tsx # UI 状态
│ │ └── KeypressContext.tsx # 键盘输入
│ ├── hooks/ # 自定义 Hooks
│ │ ├── useChat.ts # 核心:SSE 流解析 + 消息状态管理
│ │ ├── useSlashCommand.ts # 斜杠命令处理
│ │ ├── useTextBuffer.ts # 文本缓冲区
│ │ └── ...
│ ├── tools/ # 本地工具
│ │ └── code-analyzer/ # 代码结构分析(tree-sitter)
│ ├── types/ # TypeScript 类型定义
│ │ ├── api.ts # 后端 API 类型(含 SSEToolExecuteRequest)
│ │ └── history.ts # 消息历史类型
│ └── utils/ # 工具函数
│ ├── fileTunnel.ts # 文件穿透:本地文件操作执行器
│ ├── fileRef.ts # 文件引用处理
│ ├── config.ts # 配置管理
│ └── ...
├── vendor/ # 第三方依赖
├── package.json
└── tsconfig.json
npm install
需要 Node.js >= 20。
编辑 src/utils/config.ts 或通过环境变量设置后端 URL:
export MIST_API_URL=http://your-server:8000
npm run dev
npm run build
npm start
# 或直接
npx mist
当后端 WebAgent 设置 ENABLE_FILE_TUNNEL=true 时,LLM Agent 调用的文件操作工具(read_file、write_file 等)不在服务器执行,而是穿透到 CLI 客户端在用户 PC 上本地执行。
后端 LLM 调用 read_file
↓
ProxyFileTool 创建 PendingRequest,await asyncio.Event
↓
SSE 推送 tool_execute_request 事件到 CLI
↓
useChat.ts 收到事件 → 调用 fileTunnel.executeFileOperation()
↓
本地 Node.js fs 执行文件操作
↓
POST /api/v1/tunnel/result 回传结果
↓
后端 PendingRequest 被唤醒 → LangGraph 继续执行
| 文件 | 作用 |
|---|---|
src/utils/fileTunnel.ts | 本地文件操作执行器(read_file、write_file、list_directory、copy_file、move_file、file_delete、file_search) |
src/api/tunnel.ts | submitTunnelResult() — 将本地执行结果 POST 回服务端 |
src/hooks/useChat.ts | 处理 SSE tool_execute_request 事件,调度本地执行 + 回传 |
src/types/api.ts | SSEToolExecuteRequest 接口定义 |
{
"event": "tool_execute_request",
"data": {
"request_id": "uuid",
"tool_name": "read_file",
"args": { "file_path": "/path/to/file" },
"thread_id": "uuid"
}
}
POST /api/v1/tunnel/result
{
"request_id": "uuid",
"success": true,
"result": "文件内容或操作结果",
"error": ""
}
| 工具名 | 操作 |
|---|---|
read_file | 读取文件内容 |
write_file | 写入文件(自动创建目录) |
list_directory | 列出目录内容 |
copy_file | 复制文件 |
move_file | 移动/重命名文件 |
file_delete | 删除文件 |
file_search | 递归搜索匹配文件名的文件 |
客户端需在 120 秒 内完成操作并回传结果,否则后端 ProxyFileTool 返回超时错误。
MistAgent CLI 是 WebAgent 的终端客户端。WebAgent 提供 REST + SSE + WebSocket API,MistAgent CLI 通过这些接口与后端交互。
../WebAgent/FAQs
MistAgent - Terminal AI Assistant
The npm package mistagent receives a total of 4 weekly downloads. As such, mistagent popularity was classified as not popular.
We found that mistagent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.