Metadata-Version: 2.4
Name: teambot-ai
Version: 1.56.17
Summary: 团队协作型AI助手 - Team Collaboration AI Assistant
Home-page: https://github.com/samaidev/teambot
Author: samaidev
Author-email: samaidev <samaidev@users.noreply.github.com>
License-Expression: MIT
Project-URL: Homepage, https://teambot.samai.cc
Project-URL: Repository, https://github.com/samaidev/teambot
Project-URL: Issues, https://github.com/samaidev/teambot/issues
Keywords: ai-assistant,agent,team,collaboration,desktop,open-interpreter,llm,chatbot,multi-agent,memory
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: openai>=1.12.0
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: requests>=2.31.0
Requires-Dist: duckduckgo-search>=6.0.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: lxml>=5.0.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: Pillow>=10.0.0
Requires-Dist: edge-tts>=6.1.0
Requires-Dist: pynput>=1.7.6
Requires-Dist: pynacl>=1.5.0
Provides-Extra: telegram
Requires-Dist: python-telegram-bot>=21.0; extra == "telegram"
Provides-Extra: discord
Requires-Dist: discord.py>=2.3.0; extra == "discord"
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.18.0; extra == "anthropic"
Provides-Extra: communication
Requires-Dist: cryptography>=41.0.0; extra == "communication"
Requires-Dist: websockets>=12.0; extra == "communication"
Provides-Extra: all
Requires-Dist: python-telegram-bot>=21.0; extra == "all"
Requires-Dist: discord.py>=2.3.0; extra == "all"
Requires-Dist: anthropic>=0.18.0; extra == "all"
Requires-Dist: cryptography>=41.0.0; extra == "all"
Requires-Dist: websockets>=12.0; extra == "all"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# TeamBot - 团队协作型AI助手

> 本地桌面端执行型 AI 助手，支持 Windows / macOS / Linux。

---

## 安装

### 一键安装（推荐）

**macOS / Linux**

```bash
curl -fsSL https://teambot.samai.cc/install.sh | bash
```

指定版本：

```bash
curl -fsSL https://teambot.samai.cc/install.sh | bash -s -- --version 1.52.0
```

**Windows（PowerShell）**

```powershell
irm https://teambot.samai.cc/install.ps1 | iex
```

指定版本：

```powershell
irm https://teambot.samai.cc/install.ps1 | iex -Version 1.52.0
```

首次运行若提示执行策略限制，先执行：
```powershell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
```

### 系统要求

| 项目 | 要求 |
|------|------|
| 操作系统 | Windows 10+ / macOS 12+ / Ubuntu 20.04+ |
| Python | 3.10+ |
| 内存 | ≥ 512 MB |

一键安装脚本会自动下载独立可执行文件，无需 Python 或 Node.js。

### 启动命令

```bash
teambot              # 默认启动（Web 管理后台）
teambot update       # 更新到最新版
teambot web          # Web 管理后台
teambot cli          # CLI 交互模式
teambot tray         # 系统托盘后台运行
teambot server       # API 服务模式
teambot install      # 安装/更新依赖
teambot uninstall    # 卸载
```

### 配置 LLM

**环境变量方式（推荐）**

```bash
export TEAMBOT_LLM_API_KEY="sk-your-key"
export TEAMBOT_LLM_MODEL="gpt-4"
```

**配置文件方式**

首次运行自动创建 `~/.teambot/config.json`，编辑即可：

```json
{
  "llm": {
    "provider": "openai",
    "api_key": "sk-...",
    "model": "gpt-4"
  }
}
```

**Ollama 本地模型（免费）**

```bash
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull llama3
export TEAMBOT_LLM_PROVIDER="ollama"
export TEAMBOT_OLLAMA_MODEL="llama3"
```

---

## 发布客户端

> ⚠️ TeamBot 使用 Cython 编译发布，源码以 .so 二进制形式分发，不提供 sdist。

### 1. CI/CD 自动构建（推荐）

推送到 main 分支后，CI 自动执行 wf1 → wf2 → wf3 链式流程：
- **wf1**: Cython 编译 + 发布到 PyPI
- **wf2**: PyInstaller 打包 exe + 创建 runner 脚本（无 pip/npm）
- **wf3**: 上传二进制和安装脚本到 teambot.samai.cc/downloads/

### 2. 本地构建（当前平台）

```bash
python3 build_cython.py
```

构建产物在 `dist/` 目录，为当前平台的 .whl 文件。

### 2. CI/CD 自动构建

推送到 main 分支后，CI 自动执行：
- **wf1**: Cython 编译 + 发布编译后 wheel 到 PyPI
- **wf2**: 构建多平台二进制（PyInstaller exe + runner 脚本，无 pip/npm）
- **wf3**: 上传到 teambot.samai.cc/downloads/ 并部署 install.sh / install.ps1

### 3. 跨平台构建（GitHub Actions）

推送版本标签即可自动构建所有平台的 wheel 并发布到 PyPI：

```bash
# 1. 更新版本号
#    编辑 package.json 和 pyproject.toml 中的 version 字段

# 2. 提交并打标签
git add .
git commit -m "release v1.52.0"
git tag v1.52.0
git push origin main --tags
```

### 4. 配置 PyPI Token

在 GitHub 仓库 Settings → Secrets and variables → Actions 中添加：

- **Name**: `PYPI_API_TOKEN`
- **Value**: 你的 PyPI API Token（`pypi-` 开头）

### 5. 构建说明

- **不发布 sdist**：仅发布预编译 .whl 文件，避免 .py 源码泄露
- **Cython 编译**：大部分 .py 编译为 .so，仅入口文件和必要模块保留 .py
- **保留 .py 的模块**：`main.py`, `config.py`, `tray_manager.py`, `monitor_timer.py`, `core/version.py`, `web/api_server.py` 等大型或关键模块

---

## 更新代码

### 用户端更新

```bash
teambot update
```

或重新运行安装脚本：

```bash
# macOS / Linux
curl -fsSL https://teambot.samai.cc/install.sh | bash

# Windows
irm https://teambot.samai.cc/install.ps1 | iex
```

### 开发者更新流程

1. **修改代码**：在本地仓库开发并测试

2. **本地测试**：
   ```bash
   pip install -e .        # 开发模式安装
   teambot                 # 运行验证
   ```

3. **构建测试**：
   ```bash
   python3 build_cython.py --test    # 编译 + 导入测试
   ```

4. **发布新版本**：
   ```bash
   # 更新版本号 → 提交 → 打标签 → 推送
   git tag v1.53.0
   git push origin main --tags
   ```

### 清理构建产物

```bash
python3 build_cython.py --clean
```

---

## 链接

- **官网**: https://teambot.samai.cc
- **下载**: https://teambot.samai.cc/downloads/
- **GitHub**: https://github.com/samaidev/teambot
- **PyPI**: https://pypi.org/project/teambot-ai

## License

MIT

---

## CI 构建说明（给维护者）

### 2026-08-28 PyPI 发布失败事故复盘

**现象**：`build_publish_pypi` 从 18:13 起连续失败 8 轮（21:13/21:31/21:35/22:26/22:34/22:41...），每轮死在 `aiskills.browser_stealth` 附近。

**根因链**（三层叠加）：
1. `aiskills/browser_stealth.py`（195KB → Cython 生成 6.1MB C 文件）在 MSVC `/O2` 下编译需数分钟且完全静默；
2. CI dispatcher watchdog 主循环静默 >300s 强杀 + master_scheduler 400s 兜底 taskkill → 构建进程被杀/成孤儿；
3. 下一轮 wf1 的 `_kill_stale_build_processes()` 无条件杀掉所有 `cl.exe/link.exe`，把上一轮还在跑的构建也杀了 —— 构建时长 > 重试间隔，形成自杀式死循环。

**修复**（PR #72 / #73 + CI 侧加固）：
- `agents/base.py:623`：未定义变量 `idx` → `_idx`（Cython 编译期报错的主因）；
- `setup.py`：源文件 >120KB 的大模块用 `/O1` 编译（快一个数量级），小模块保持 `/O2`；
- CI wf1：stale-killer 只杀创建超过 20 分钟的编译进程 + 构建输出改为流式写日志（dispatcher 日志不再静默超时）。

**维护提示**：
- 新增大模块时注意生成 C 文件体积；若单模块编译可能超过 5 分钟，考虑拆分或降级优化级别；
- 改 CI 的 `wf1_build_publish_pypi.py` 后需重启对应 dispatcher 进程才会生效（WORKFLOWS 启动时加载）。


<!-- Security scan triggered at 2026-09-05 07:25:28 -->
