Metadata-Version: 2.4
Name: Nano-SD
Version: 0.3.7
Summary: Nano-SD 关机小助手 - 基于 nanobot 二次开发，企业微信加班记录与自动关机
Project-URL: Homepage, https://github.com/yourname/nano-sd
Author: Xubin Ren, the nanobot contributors
Maintainer-email: 你的名称 <your@email.com>
License: MIT
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Keywords: assistant,overtime,shutdown,wecom
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: anthropic<1.0.0,>=0.45.0
Requires-Dist: croniter<7.0.0,>=6.0.0
Requires-Dist: dulwich<1.0.0,>=0.22.0
Requires-Dist: filelock>=3.25.2
Requires-Dist: httpx<1.0.0,>=0.28.0
Requires-Dist: jinja2<4.0.0,>=3.1.0
Requires-Dist: loguru<1.0.0,>=0.7.3
Requires-Dist: mcp<2.0.0,>=1.26.0
Requires-Dist: openai>=2.8.0
Requires-Dist: prompt-toolkit<4.0.0,>=3.0.50
Requires-Dist: pydantic-settings<3.0.0,>=2.12.0
Requires-Dist: pydantic<3.0.0,>=2.12.0
Requires-Dist: pyyaml<7.0.0,>=6.0
Requires-Dist: rich<15.0.0,>=14.0.0
Requires-Dist: typer<1.0.0,>=0.20.0
Requires-Dist: websocket-client<2.0.0,>=1.9.0
Requires-Dist: websockets<17.0,>=14.0
Provides-Extra: api
Requires-Dist: aiohttp<4.0.0,>=3.9.0; extra == 'api'
Provides-Extra: wecom
Requires-Dist: wecom-aibot-sdk-python>=0.1.5; extra == 'wecom'
Provides-Extra: weixin
Requires-Dist: pycryptodome>=3.20.0; extra == 'weixin'
Requires-Dist: qrcode[pil]>=8.0; extra == 'weixin'
Description-Content-Type: text/markdown

# Nano-SD 🐱‍💻

> 基于 [nanobot](https://github.com/HKUDS/nanobot) 二次开发的下班关机小助手

通过企业微信交互，识别下班意图后自动记录加班时间、更新金山文档加班表，并执行关机确认流程。

## 核心功能

- 🤖 **意图识别**：通过 LLM 识别"我下班了"/"关机"等下班意图
- ⏰ **时间取整**：按规则取整下班时间（<15→:00, 15-44→:30, >=45→next hour）
- 📝 **加班记录**：自动追加到金山文档加班表
- 💻 **关机确认**：60 秒倒计时，支持取消
- 🔧 **交互式配置**：首次运行自动提示填配置，无需手动编辑 JSON
- 🚀 **开机自启**：一键设置后台静默运行

## 安装

```bash
pip install Nano-SD
```

## 快速开始

### 1. 首次运行（自动配置）

```bash
nanosd gateway
```

首次运行会自动提示输入：
- LLM API Key（支持第三方中转站）
- 企业微信 Bot ID / Secret
- KDocs 文档 ID（加班表）

配置完成后会保存到 `~/.nanobot/config.json`。

### 2. 启动网关

```bash
nanosd gateway
```

### 3. 设置开机自启（可选）

```bash
nanosd autostart enable
```

Windows 下使用 `pythonw.exe` 无窗口静默运行。

## 命令列表

| 命令 | 说明 |
|------|------|
| `nanosd gateway` | 启动网关（首次运行会自动配置） |
| `nanosd autostart enable` | 设置开机自启 |
| `nanosd autostart disable` | 取消开机自启 |
| `nanosd autostart status` | 查看自启状态 |
| `nanosd onboard` | 初始化 workspace |

## 触发词

在企业微信中发送以下任意消息即可触发关机助手：

- `我下班了`
- `下班`
- `走了`
- `关机`
- `今天到此为止`

## 配置说明

配置文件位于 `~/.nanobot/config.json`，主要字段：

```json
{
  "agents": {
    "defaults": {
      "model": "deepseek-v4-flash",
      "provider": "auto"
    }
  },
  "providers": {
    "custom": {
      "apiKey": "your-api-key",
      "apiBase": "https://tokendance.space/gateway/v1"
    }
  },
  "channels": {
    "wecom": {
      "enabled": true,
      "botId": "your-bot-id",
      "secret": "your-secret",
      "allowFrom": ["*"]
    }
  }
}
```

### 环境变量

| 变量名 | 说明 | 必填 |
|--------|------|------|
| `KDOCS_DOCUMENT_ID` | 加班表文档 ID | 是 |

## 技术说明

- **基于**：nanobot v0.2.1（MIT 协议）
- **原作者**：Xubin Ren 和 nanobot contributors
- **二次开发**：关机小助手功能

## 开源协议

[MIT License](./LICENSE)

Copyright (c) 2025-present Xubin Ren and the nanobot contributors

Nano-SD 基于 nanobot 二次开发，保留原作者版权声明。
