- Update README.md to English version with language navigation - Add README.zh-CN.md for Simplified Chinese - Add language switcher links in both files
139 lines
3.0 KiB
Markdown
139 lines
3.0 KiB
Markdown
<div align="center">
|
||
|
||
[English](README.md) | [简体中文](README.zh-CN.md)
|
||
|
||
</div>
|
||
|
||
# PaddedCell
|
||
|
||
OpenClaw 插件:安全密码管理 + 安全执行 + 安全重启
|
||
|
||
## 功能模块
|
||
|
||
### 1. pass_mgr - 密码管理二进制 (Go)
|
||
|
||
使用 AES-256-GCM 加密,每个 agent 基于公私钥进行加/解密。
|
||
|
||
```bash
|
||
# 初始化
|
||
pass_mgr admin init [--key-path <path>]
|
||
|
||
# 获取密码
|
||
pass_mgr get <key> [--username]
|
||
|
||
# 生成密码 (agent 可用)
|
||
pass_mgr generate <key> [--username <user>]
|
||
|
||
# 设置密码 (仅人类)
|
||
pass_mgr set <key> <password> [--username <user>]
|
||
|
||
# 删除密码
|
||
pass_mgr unset <key>
|
||
|
||
# 轮换密码
|
||
pass_mgr rotate <key>
|
||
```
|
||
|
||
**安全特性:**
|
||
- Agent 无法执行 `set` 操作(通过环境变量检测)
|
||
- 未初始化前所有操作报错
|
||
- Admin 密码泄露检测(监控 message/tool calling)
|
||
|
||
### 2. pcexec - 安全执行工具 (TypeScript)
|
||
|
||
与 OpenClaw 原生 exec 接口一致,自动处理 pass_mgr get 并脱敏输出。
|
||
|
||
```typescript
|
||
import { pcexec } from 'pcexec';
|
||
|
||
const result = await pcexec('echo $(pass_mgr get mypassword)', {
|
||
cwd: '/workspace',
|
||
timeout: 30000,
|
||
});
|
||
// result.stdout 中密码会被替换为 ######
|
||
```
|
||
|
||
### 3. safe-restart - 安全重启模块 (TypeScript)
|
||
|
||
提供 agent 状态管理和协调重启。
|
||
|
||
**Agent 状态:**
|
||
- `idle` - 空闲
|
||
- `busy` - 处理消息中
|
||
- `focus` - 专注模式(工作流)
|
||
- `freeze` - 冻结(不接受新消息)
|
||
- `pre-freeze` - 准备冻结
|
||
- `pre-freeze-focus` - 准备冻结(专注模式)
|
||
|
||
**API:**
|
||
- `POST /query-restart` - 查询重启就绪状态
|
||
- `POST /restart-result` - 报告重启结果
|
||
- `GET /status` - 获取所有状态
|
||
|
||
**Slash 命令:**
|
||
```
|
||
/padded-cell-ctrl status
|
||
/padded-cell-ctrl enable pass-mgr|safe-restart
|
||
/padded-cell-ctrl disable pass-mgr|safe-restart
|
||
```
|
||
|
||
## 项目结构
|
||
|
||
```
|
||
PaddedCell/
|
||
├── pass_mgr/ # Go 密码管理二进制
|
||
│ ├── src/
|
||
│ │ └── main.go
|
||
│ └── go.mod
|
||
├── pcexec/ # TypeScript 安全执行工具
|
||
│ ├── src/
|
||
│ │ └── index.ts
|
||
│ ├── package.json
|
||
│ └── tsconfig.json
|
||
├── safe-restart/ # TypeScript 安全重启模块
|
||
│ ├── src/
|
||
│ │ ├── index.ts
|
||
│ │ ├── status-manager.ts
|
||
│ │ ├── api.ts
|
||
│ │ ├── safe-restart.ts
|
||
│ │ └── slash-commands.ts
|
||
│ ├── package.json
|
||
│ └── tsconfig.json
|
||
├── docs/ # 文档
|
||
├── PROJECT_PLAN.md # 项目计划
|
||
├── AGENT_TASKS.md # 任务清单
|
||
├── README.md # 英文版本
|
||
└── README.zh-CN.md # 本文档 (简体中文)
|
||
```
|
||
|
||
## 开发
|
||
|
||
```bash
|
||
# Clone
|
||
git clone https://git.hangman-lab.top/nav/PaddedCell.git
|
||
cd PaddedCell
|
||
|
||
# Build pass_mgr (需要 Go)
|
||
cd pass_mgr
|
||
go build -o pass_mgr src/main.go
|
||
|
||
# Build pcexec (需要 Node.js)
|
||
cd ../pcexec
|
||
npm install
|
||
npm run build
|
||
|
||
# Build safe-restart (需要 Node.js)
|
||
cd ../safe-restart
|
||
npm install
|
||
npm run build
|
||
```
|
||
|
||
## 分支
|
||
|
||
- `main` - 主分支
|
||
- `dev/zhi` - 开发分支
|
||
|
||
## 许可证
|
||
|
||
MIT
|