# sjtu

Adopt this skill: https://proskills.md/skills/other/xhh678876-openclaw-sjtu

Page: https://proskills.md/skills/other/xhh678876-openclaw-sjtu
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 25702
sha: f9f18cb02d70872c2224c5c7f22266bac08513e1
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/SKILL.md

````text
---
name: sjtu
version: 2.1.0
license: MIT
description: |
  上海交通大学全能校园助手 —— 一组平台无关的命令行脚本，任何能执行 shell 的 AI agent 都可接入
  (Claude Code / Codex / Cursor / Gemini CLI / LangChain / 自建 agent 皆可)，不依赖任何特定网关、
  浏览器代理或私有运行时。覆盖 Canvas 作业/成绩、选课社区课评、传承交大资料、交大邮箱、校园生活、
  学术工具、水源社区等 20+ 项功能。
  触发场景:
  (1) 查看/追踪作业 DDL、提交状态、成绩 (Canvas)
  (2) 同步 DDL 到 Apple 日历 / 导出 .ics
  (3) 查询课程评价、对比老师评分 (选课社区 jCourse)
  (4) 搜往年试卷 / 课程资料 (传承交大)
  (5) 查交大邮箱未读 / 搜索 / 发信
  (6) 食堂推荐、图书馆、空教室、校园巴士、教学周、校历
  (7) 教务通知、交大新闻、正版软件、生存手册、在线工具
  (8) 生成交大 PPT、手写 PDF、校园官方图库
  (9) 搜索 / 浏览水源社区帖子
  触发词: Canvas, 课程, 作业, DDL, 截止, 成绩, 课件, PPT, 总结, 复习, 提交作业, 批改,
  食堂, 吃什么, 图书馆, 教室, 空教室, 巴士, 校车, 教学周, 第几周, 校历, 放假, 邮箱, 邮件,
  选课, 评价, 老师怎么样, 软件, MATLAB, Office, 新闻, 教务, 通知, 传承, 往年, 试卷,
  生存手册, 保研, 转专业, GPA, PPT模板, 手写, 校园地图, 视觉交大, 水源, 水源社区, 论坛, 帖子
---

# 上海交通大学全能校园助手 (sjtu)

> **平台无关。** 本 skill 是 `scripts/` 下的一组独立 CLI 脚本（Python3 / Node.js）。任何能运行
> shell 命令、读文件的 agent 都能调用——不依赖任何特定网关、浏览器代理或私有运行时。
> 凭证集中在仓库根 `config.json`（已被 `.gitignore` 忽略，不会进版本库）。

---

## 一、给 Agent 的调用约定（必读）

1. **执行前先 `cd ~/openclaw-sjtu`**。脚本按仓库根定位 `config.json` / `templates/` / `fonts/`，
   不在此目录会找不到配置或资源。
2. **调用形式**：Python 脚本用 `python3 scripts/<名>.py <子命令> [参数]`；
   `.mjs` 脚本用 `node scripts/<名>.mjs <子命令>`（**水源用 node，不是 python3**）。
   不带参数一般打印用法。
3. **凭证**：统一放仓库根 `config.json`（从 `config.example.json` 复制）。**按需填**——只填要用的
   功能对应字段即可。部分脚本也支持等价环境变量（见 §2）。
4. **写操作必须先确认**：会改服务器/外部状态的命令（发邮件、传承下载消耗积分等），执行前必须向
   用户复述对象并取得确认。本文档用 ⚠️ 标出。注：Canvas **提交作业当前未暴露为 CLI 子命令**
   （仅库函数 `submit_assignment`），不会被误触发。
5. **缺凭证 = 明确报错**：脚本不会假装成功。缺 key/token 会打印「缺什么、怎么配」，多数带 `selftest`。
6. **状态语义**：✅实时=真实抓线上数据；📌静态=内置离线数据（稳定但非实时，跨学期可能过期）；
   🔑需登录=缺凭证会明确报错；⚙️本地=纯本地生成；⚠️注意=有依赖缺失或接口变更，见说明。
7. **环境提示**：macOS **无 `timeout` 命令**，文档示例都不用 timeout，脚本自带超时，直接运行即可。

---

## 二、配置 (config.json)

从 `config.example.json` 复制为 `config.json`，按需填写：

| 配置字段 | 用于功能 | 怎么获取 |
|----------|----------|----------|
| `canvas_token` | Canvas 全套（DDL/课程/成绩/课件/作业/日历） | oc.sjtu.edu.cn → 头像 → 设置 → 「+ 新建访问许可证」 |
| `canvas_profiles` + `canvas_default_profile` | Canvas 学生/教师双身份 | 各生成一个 token，分别填到 `canvas_profiles.student.token` / `.teacher.token`，默认身份填 `canvas_default_profile` |
| `base_url` | Canvas 站点 | 默认 `https://oc.sjtu.edu.cn`，一般不用改 |
| `save_dir` | 课件下载目录 | 默认 `~/Downloads/Canvas课件` |
| `jcourse_api_key` | 选课社区课评 | course.sjtu.plus → 个人中心 → API 密钥 |
| `dyweb_token` | 传承交大资料 | jAccount 登录后抓 token（见 §3.5） |
| `sjtu_username` / `sjtu_password` | 交大邮箱 IMAP/SMTP | 邮箱账号 + 密码（或授权码） |
| `shuiyuan_user_api_key` + `shuiyuan_user_api_client_id` | 水源社区 | 脚本内 `auth init` 链接授权（见 §3.7） |

**等价环境变量**（优先级高于 config.json）：`JCOURSE_API_KEY`、`DYWEB_TOKEN`、`OPENCLAW_SJTU_CANVAS_PROFILE`。

> 🔒 `config.json` 已在 `.gitignore`，含真实凭证，**切勿 `git add`**。只提交 `config.example.json`（占位符）。

---

## 三、功能 × 入口 × 认证 × 状态 总表

| 功能 | 入口脚本 | 认证 | 状态 |
|------|----------|------|------|
| Canvas 课程 / DDL / 成绩 / 身份 | `canvas_api.py` | canvas_token | ✅ 实时 |
| 自动作业扫描 / 作答上下文 / 新作业监测 | `auto_homework.py` | canvas_token | ✅ 实时 |
| DDL+课程 → .ics 日历文件 | `sjtu_timetable_ics.py` | canvas_token | ✅ 实时 |
| DDL → macOS 日历同步 | `calendar_sync.py` | canvas_token | ⚙️ 本地(仅 macOS) |
| 课程评价 / 老师对比 (jCourse) | `sjtu_course_review.py` | jcourse_api_key | ✅ 实时 |
| 传承交大 往年资料 / 试卷 | `sjtu_legacy.py` | dyweb_token | 🔑 需登录 |
| 交大邮箱 未读 / 搜索 / 发信 | `sjtu_mail.py` | 邮箱账密 | 🔑 需登录 |
| 教务通知 / 交大新闻 | `sjtu_news.py` | 无 | ✅ 实时 |
| 正版软件查询 | `sjtu_software.py` | 无 | ✅ 实时 |
| 生存手册 | `sjtu_survive.py` | 无 | ✅ 实时 |
| 视觉交大 官方图库 | `sjtu_visual.py` | 无 | ✅ 实时 |
| 水源社区 (只读) | `shuiyuan_discourse.mjs` | shuiyuan_user_api_key | ✅ 实时 |
| 课件文本提取（配合 Canvas） | `file_extractor.py` | 无 | ✅ 本地 |
| 教学周 / 校历 / 校园巴士 | `sjtu_info.py` | 无 | 📌 静态 |
| 食堂推荐 / 菜单 | `sjtu_canteen.py` | 无 | 📌 静态 |
| 图书馆 信息 / 座位说明 | `sjtu_library.py` | 无 | 📌 静态 |
| 空教室 / 教学楼清单 | `sjtu_classroom.py` | 无 | 📌 静态 |
| 在线工具目录 | `sjtu_tools.py` | 无 | 📌 静态 |
| 交大 PPT 生成 | `generate_ppt.py` | 无 | ⚙️ 本地(需 python-pptx) |
| 手写 PDF 生成 | `handwrite_pdf.py` | 无 | ⚠️ 需装 handright |
| 镜像换源指引 | `sjtu_mirror.py` | 无 | ⚙️ 本地(list 接口已变) |

---

## 四、功能详解

> 每条都标注了**真实子命令**（已逐行核对源码 + 实跑）。脚本帮助里写 `python3 sjtu_xxx.py`，从仓库根
> 调用时实际路径是 `scripts/sjtu_xxx.py`。

### 4.1 Canvas 课程 / DDL / 成绩 ✅ — `canvas_api.py`

需 `canvas_token`。**CLI 仅 5 个只读子命令**，全局 `--profile <name>` 可放命令前后任意位置切换
学生/教师身份（缺省用 `canvas_default_profile`）。无参数时默认执行 `courses`。

```bash
python3 scripts/canvas_api.py me                       # 验证 token + 显示当前身份(学生/教师)
python3 scripts/canvas_api.py courses                  # 列出所有课程: [课程ID] 课程名 [角色]
python3 scripts/canvas_api.py ddls                     # 未来未提交作业, 按截止排序(🔴<24h/🟡<72h/🟢)
python3 scripts/canvas_api.py ddls-all                 # 本学期DDL全景: 统计+待交+老师反馈
python3 scripts/canvas_api.py grades                   # 各课已评分作业的得分
python3 scripts/canvas_api.py --profile teacher courses # 教师端: 管理课程/全班提交/成绩册
```
- 课程 ID 从 `courses` 输出取，用于其它需要 course_id 的脚本。
- DDL 走 Canvas Planner API 一次性拉取（含 submitted/graded/late/missing/feedback）；时区固定 UTC+8。
- ⚠️ 课件下载、作业提交、讨论区、日历事件等是**库函数，未做成 CLI 子命令**；提交作业需另调
  `canvas_api.submit_assignment(...)` 并确认，普通调用不会触发写操作。
- `ddls-all` 的学期起始日在源码里硬编码（`2026-02-17`），跨学期需改源码。
- 依赖 `requests`；需能访问 oc.sjtu.edu.cn（校园网或可达网络）。

### 4.2 自动作业流水线 ✅ — `auto_homework.py`

需 `canvas_token`。5 个子命令（无参默认 `scan`）：

```bash
python3 scripts/auto_homework.py scan                  # 扫所有未提交作业, 按剩余时间升序(只读)
python3 scripts/auto_homework.py urgent 24             # 只看 N 小时内截止(默认48)(只读)
python3 scripts/auto_homework.py context <course_id> <assignment_id>  # 拉题面+下载图片/课件, 生成 ai_prompt.md
python3 scripts/auto_homework.py full <course_id> <assignment_id>     # 同 context + 提示后续提交步骤
python3 scripts/auto_homework.py watch                 # 对比上次状态, 报新增作业(写 .homework_state.json, 适配 cron)
```
- `context`/`full` 会向 `~/Downloads/Canvas作业上下文/` 与 `~/Downloads/Canvas课件/` **下载文件**；
  生成的 `ai_prompt.md` 可喂 LLM 辅助作答。**本身不提交作业**。
- `context`/`full` 提取课件正文需 `python-pptx` / `pdfplumber` / `python-docx`（缺失则该文件标注「需安装」，不崩）。

### 4.3 DDL → 日历 ✅ / ⚙️ — `sjtu_timetable_ics.py` + `calendar_sync.py`

需 `canvas_token`。`sjtu_timetable_ics.py` 3 个子命令，可选第二参为输出路径：

```bash
python3 scripts/sjtu_timetable_ics.py ddls [输出.ics]     # 未来DDL→ICS, 每个含截止前1h/24h两个提醒(默认 ~/Downloads/sjtu_ddls.ics)
python3 scripts/sjtu_timetable_ics.py calendar [输出.ics] # 课程日历事件→ICS(默认 ~/Downloads/sjtu_calendar.ics)
python3 scripts/sjtu_timetable_ics.py all [输出.ics]      # DDL+日历合并(默认 ~/Downloads/sjtu_timetable.ics)
python3 scripts/calendar_sync.py                         # ⚙️ 仅macOS: 直接同步未来DDL进"日历"app的"Canvas作业"日历
```
- ICS 双击即可导入 Apple/Google 日历。`calendar` / `all` 的学期区间硬编码 `2026-02-17→2026-07-15`。
- `calendar_sync.py` 无参数、无 flag，运行即写本机日历（按事件标题去重）；首次需在 macOS
  「系统设置→隐私与安全性→自动化」授予终端/Python 控制「日历」权限。

### 4.4 课程评价 / 老师对比（选课社区 jCourse）✅ — `sjtu_course_review.py`

走 jCourse 开放 API（Bearer key），无需 cookie / 浏览器。需 `jcourse_api_key`。

```bash
python3 scripts/sjtu_course_review.py search 传热学      # 搜课(名称/课号/老师)
python3 scripts/sjtu_course_review.py detail 6807       # 课程详情 + 同课号其他老师评分对比
python3 scripts/sjtu_course_review.py reviews 6807 5    # 看某门课的评价(前5条)
python3 scripts/sjtu_course_review.py compare 传热学     # 同名课不同老师评分横向对比
python3 scripts/sjtu_course_review.py selftest         # 自检 API Key 与连通性
```
搜索结果与详情里的 `#数字` 是课程 ID，传给 `detail` / `reviews`。

### 4.5 传承交大 往年资料 / 试卷 🔑 — `sjtu_legacy.py`

传承新站（beta.share.dyweb.sjtu.cn）**强制 jAccount 登录，无免登录接口**。先拿 token：

```bash
# 方式A(推荐): 浏览器登一次自动抓 token
python3 scripts/save_sjtu_cookies.py legacy
# 方式B: config.json 填 dyweb_token (F12 → Application → Local Storage 的 token)
# 方式C: export DYWEB_TOKEN=...
```
拿到 token 后：
```bash
python3 scripts/sjtu_legacy.py search 传热学      # 搜课程
python3 scripts/sjtu_legacy.py course <课程ID>    # 课程详情
python3 scripts/sjtu_legacy.py materials <课程ID> # 某课程的资料列表
python3 scripts/sjtu_legacy.py selftest          # 检查 token 与连通性
```
⚠️ 下载资料会消耗站内积分，本工具只列清单**不自动下载**。

### 4.6 交大邮箱 🔑 — `sjtu_mail.py`

需 `sjtu_username` / `sjtu_password`（IMAP 993 / SMTP 465，走 mail.sjtu.edu.cn，**需校园网/VPN**）。
凭证也可用 `-u/-p` 临时传（优先于 config.json）。

```bash
python3 scripts/sjtu_mail.py unread --limit 10            # 未读邮件(不标记已读)
python3 scripts/sjtu_mail.py search --keyword 作业        # 按主题+发件人搜(可缩写 -k)
python3 scripts/sjtu_mail.py summary                      # 邮箱概况(总数/未读/最近5封)
python3 scripts/sjtu_mail.py send --to x@sjtu.edu.cn --subject "标题" --body "正文" [--html]  # ⚠️ 发信
```
⚠️ `send` 会真发邮件（From=登录账号），执行前**必须**向用户确认收件人/主题/正文。

### 4.7 水源社区（只读）✅ — `shuiyuan_discourse.mjs`（用 node）

需 `shuiyuan_user_api_key`（首次走链接授权）。Node.js ≥18，**严格只读**（代码层只允许 GET + 路径白名单，
不能发帖/回复/点赞）。访问 shuiyuan.sjtu.edu.cn 通常需校园网/VPN。

```bash
# 首次授权(链接授权)
node scripts/shuiyuan_discourse.mjs auth init                       # 生成授权链接
node scripts/shuiyuan_discourse.mjs auth finish --payload "<payload>"  # 浏览器授权后粘回 payload
node scripts/shuiyuan_discourse.mjs auth status                     # 查看凭证状态
# 日常只读
node scripts/shuiyuan_discourse.mjs search "选课" --max-results 10  # 全文搜索(支持 #分类 @用户 order:likes topic:<id> 等算子)
node scripts/shuiyuan_discourse.mjs latest --max-results 30        # 最新话题
node scripts/shuiyuan_discourse.mjs categories                     # 全部版块(id/名称/帖数)
node scripts/shuiyuan_discourse.mjs topic <topic_id> --post-limit 5  # 看某话题及楼层正文
node scripts/shuiyuan_discourse.mjs post <post_id>                # 看单楼正文
node scripts/shuiyuan_discourse.mjs filter "category:xx tags:yy"  # Discourse 过滤式
node scripts/shuiyuan_discourse.mjs image <图片URL> --output meta # 安全取帖内图片(meta/data-url/media-path)
node scripts/shuiyuan_discourse.mjs vision-check                  # 检查模型是否支持图片输入
```
- 凭证存 `~/.openclaw/skills-data/shuiyuan-discourse/auth.json`（0600）。
- 限流（429）会被规整为 `rate_limited:true` 并给重试间隔，等几十秒重试同一命令即可。
- 全局选项：`--site` / `--runtime auto|node|curl` / `--timeout` / `--auth-file` 等。

---

## 五、信息查询与校园生活

### 教务通知 / 交大新闻 ✅（实时）— `sjtu_news.py`

```bash
python3 scripts/sjtu_news.py jwc 10              # 教务处通知(标题/日期/摘要/链接)
python3 scripts/sjtu_news.py news 10            # 交大要闻
python3 scripts/sjtu_news.py news 5 --column mtjj # 媒体聚焦(jdyw=要闻 / mtjj=媒体聚焦)
python3 scripts/sjtu_news.py news 5 --json      # 结构化 JSON, 便于 agent 解析
python3 scripts/sjtu_news.py all 10             # 新闻+教务一起抓
```

### 正版软件 ✅（实时）— `sjtu_software.py`

```bash
python3 scripts/sjtu_software.py list                 # 列校内正版软件(系统/办公/科学计算/网络安全)
python3 scripts/sjtu_software.py list --category 办公  # 按类别筛选(仅 list)
python3 scripts/sjtu_software.py list --json          # JSON 输出
python3 scripts/sjtu_software.py search MATLAB        # 关键词搜
```
> 抓 software.sjtu.edu.cn；断网/解析失败会静默回退到内置 13 条数据（可能过时）。

### 生存手册 ✅（实时，GitBook）— `sjtu_survive.py`

```bash
python3 scripts/sjtu_survive.py toc              # 全书目录(来自 sitemap, 约110页)
python3 scripts/sjtu_survive.py toc gpa          # 目录按关键词过滤
python3 scripts/sjtu_survive.py search bao-yan   # 搜章节
python3 scripts/sjtu_survive.py read bao-yan     # 读章节正文
```
> GitBook 章节 slug 为**拼音**，搜索用拼音片段（`gpa` / `bao-yan` / `zhuan-zhuan-ye`）比中文更准。

### 视觉交大 官方图库 ✅（实时）— `sjtu_visual.py`

```bash
python3 scripts/sjtu_visual.py themes            # 主题相册(南洋筑韵/SJTU SCENE/航拍/运动交大…)
python3 scripts/sjtu_visual.py images 42 6       # 某主题前6张(含原图直链/尺寸/下载数)
python3 scripts/sjtu_visual.py search 图书馆      # 全站搜图
python3 scripts/sjtu_visual.py download <图片直链> [输出路径]  # 下载高清原图(常数MB)
```

### 课件文本提取 ✅（本地）— `file_extractor.py`

```bash
python3 scripts/file_extractor.py <文件>          # 单文件提取文本到 stdout(前2000字, 支持 pptx/ppt/pdf/docx/txt/md)
python3 scripts/file_extractor.py <目录>          # 批量提取目录内 pptx/pdf/docx, 打印字符数
python3 scripts/file_extractor.py <目录> <输出目录> # 批量转 Markdown 落盘(每文件一个 .md)
```
> 位置参数 CLI，无子命令。PPTX/PDF 提取需 `pip install python-pptx pdfplumber`。配合 Canvas 课件做 AI 总结。

### 教学周 / 校历 / 巴士 / 食堂 / 图书馆 / 空教室 / 在线工具 📌（静态）

```bash
python3 scripts/sjtu_info.py week                # 今天第几教学周 + 近期事件
python3 scripts/sjtu_info.py calendar            # 学期校历
python3 scripts/sjtu_info.py bus                 # 校园巴士时刻(按工作日/周末自动切换)
python3 scripts/sjtu_canteen.py list             # 列闵行 7 个食堂
python3 scripts/sjtu_canteen.py menu 二餐         # 某食堂菜单(简称: 一餐/二餐/三餐/四餐/五餐/哈乐/玉兰苑)
python3 scripts/sjtu_canteen.py recommend        # 按当前时段推荐
python3 scripts/sjtu_library.py info             # 5 个馆开放时间/位置/座位数
python3 scripts/sjtu_library.py seats            # 座位预约系统指引(非实时余量)
python3 scripts/sjtu_classroom.py empty          # 全部教学楼教室清单(77间)
python3 scripts/sjtu_classroom.py empty --building 东上院  # 按楼筛选
python3 scripts/sjtu_classroom.py info           # 教学楼概览; info --building 东上院 看单楼详情+课程时间表
python3 scripts/sjtu_tools.py list               # 12 项校内在线工具目录
python3 scripts/sjtu_tools.py latex              # 某工具详情+可达性(latex/notes/ocr/tts/ai/feedback)
```
> 📌 这几项为内置离线数据（学校无公开实时 API），每学期手工维护，跨学期可能过期。座位实时余量 /
> 真实空闲教室需 jAccount 登录教务系统，当前未实现。`sjtu_tools` 的详情命令会对 URL 做可达性探测
> （校外多显示「无法连接」属正常）。

---

## 六、生成工具 ⚙️

### 交大 PPT — `generate_ppt.py`（需 `pip install python-pptx`）

```bash
python3 scripts/generate_ppt.py --list-templates                  # 列 templates/ 下 9 个交大官方模板
python3 scripts/generate_ppt.py --title "标题" --markdown notes.md \
  --template "百廿红" --output out.pptx                            # 从 Markdown 生成多页 PPT
python3 scripts/generate_ppt.py --title "标题" --no-polish         # 关闭默认文字美化
```
- 单命令多 flag（无子命令）。`--markdown` 可传文件路径或内联文本；`##`→内容页、`#`→章节过渡页。
- `--template` 传模板名子串即可（如「百廿红」匹配 `1.百廿红-李一.pptx`）；缺省用交大通用模板。
- ⚠️ 未装 `python-pptx` 时脚本在导入阶段就退出（连 `--list-templates` 也跑不了），先装依赖。

### 手写 PDF — `handwrite_pdf.py` ⚠️（需 `pip install handright`）

```bash
python3 scripts/handwrite_pdf.py input.txt output.pdf --style casual   # 文件→手写PDF
python3 scripts/handwrite_pdf.py --text "要写的内容" out.pdf --ruled    # 直传文本, 带信纸横线
# 风格: neat(工整) / casual(随意,默认) / messy(潦草)
```
> ⚠️ 当前 `handright` 依赖**未安装**，运行会 `ModuleNotFoundError`；先 `pip install handright`
> （Pillow 已装）。字体已就绪（仓库 `fonts/` 及 workspace 下均有手写体）。

### 镜像换源指引 — `sjtu_mirror.py`

```bash
python3 scripts/sjtu_mirror.py pip               # pip 换源命令(临时/永久/配置文件)
python3 scripts/sjtu_mirror.py conda             # conda ~/.condarc
python3 scripts/sjtu_mirror.py brew              # Homebrew 环境变量
python3 scripts/sjtu_mirror.py docker            # Docker daemon.json
python3 scripts/sjtu_mirror.py npm               # npm registry
python3 scripts/sjtu_mirror.py list              # ⚠️ 列镜像(后端接口已变, 可能回退内置静态列表)
```
> `pip/conda/brew/docker/npm` 只打印换源**指引文本**，不修改任何配置文件，需用户自己执行。
> ⚠️ 仅 `list` 联网，其后端 API 已变更，结果可能不准。

---

## 七、子 Skill（独立模块，各有 SKILL.md）

主 `/sjtu` 覆盖日常功能；下列是独立成 skill 的进阶模块，多需 jAccount 登录或较重，按需委派：

| Skill | 用途 | 入口 |
|------|------|------|
| [sjtu-deadlines](skills/sjtu-deadlines/SKILL.md) | 跨平台聚合 DDL（Canvas+phycai物理实验+icourse163 MOOC+lcme实验预约） | `python3 -m scripts.unified_ddl` |
| [sjtu-oneshot](skills/sjtu-oneshot/SKILL.md) | 单次 jAccount 登录刷新所有 cookie + 拉全平台信息 | `python3 scripts/sjtu_oneshot.py` |
| [sjtu-crawler](skills/sjtu-crawler/SKILL.md) | 全站门户爬虫（50+ 站点通知）+ LLM 蒸馏成结构化 JSON | `python3 scripts/sjtu_crawler.py crawl` |
| [shuiyuan-rag-service](skills/shuiyuan-rag-service/SKILL.md) | 水源 RAG 常驻 FastAPI 服务（127.0.0.1:9111，BGE 预加载） | `uvicorn shuiyuan_rag_http:app` |
| [sjtu-cookie-saver](skills/sjtu-cookie-saver/SKILL.md) | 手动登录抓第三方站 cookie/token（主要给传承交大） | `python3 scripts/save_sjtu_cookies.py` |
| [sjtu-date](skills/sjtu-date/SKILL.md) | SJTU Date 匹配助手（填问卷/查匹配/破冰） | `node scripts/sjtudate.mjs` |
| [lobster-square](skills/lobster-square/SKILL.md) | clawsjtu.com 龙虾广场 API（独立项目，搭车存放） | `bash scripts/call.sh` |

**委派对照**（用户提到这些词时优先用对应子 skill）：
- “我有什么 DDL / 作业 / 实验”（跨平台聚合）→ **sjtu-deadlines**
- “登录所有 SJTU 平台 / 刷新所有 cookies” → **sjtu-oneshot**
- “爬交大网站 / 抓教务通知 / 蒸馏公告” → **sjtu-crawler**
- “刷新传承 / 第三方站 cookie / token” → **sjtu-cookie-saver**
- “填 SJTU Date 问卷 / 查匹配 / 脱单” → **sjtu-date**

**其他辅助脚本**（不单独成 skill）：
- `grading_assistant.py` — 助教批改助手（批量拉学生提交 + 生成评分上下文，需 Canvas 教师端 token）
- `sjtu_distill.py` — 用 Claude 把 crawler 爬下的文档蒸馏成结构化摘要

**共享工具层**：`scripts/auth/`（jAccount SSO + cookie store）、`scripts/platforms/`（各平台适配器）、
`scripts/scheduler/`（macOS launchd 服务）。

---

## 八、依赖安装

```bash
# 主功能
pip3 install requests beautifulsoup4 python-pptx pdfplumber python-docx handright Pillow reportlab
# 子 skill 额外
pip3 install -r scripts/requirements-platforms.txt    # sjtu-deadlines / sjtu-oneshot
playwright install chromium                            # sjtu-oneshot / cookie-saver(浏览器登录)
pip3 install fastapi uvicorn                           # shuiyuan-rag-service
```
- 水源、SJTU Date 等 `.mjs` 脚本需 **Node.js ≥18**（用内置 fetch，无需 npm 包）。
- 仓库自带 `.venv`，建议用它的 python 运行需第三方库的脚本（PPT/手写PDF/课件提取）。

---

## 九、故障排查

| 现象 | 原因 / 处理 |
|------|-------------|
| `未配置 ... key/token` / `Canvas token not configured` | 对应功能凭证没填，按 §2 配置表补 config.json 字段 |
| Canvas 401 / token 失效 | oc.sjtu.edu.cn 重新生成访问许可证，更新 `canvas_token` |
| jCourse 课评报错 | 先 `selftest`；key 失效则 course.sjtu.plus 重新生成 |
| 传承交大 `LoginRequired` | token 缺失/过期，重跑 `save_sjtu_cookies.py legacy` |
| 邮箱连接超时 | IMAP/SMTP 需校园网或 VPN（mail.sjtu.edu.cn） |
| 水源返回 429 | 站点限流，正常现象，等几十秒重试同一命令 |
| `ModuleNotFoundError: handright` | 手写PDF 缺依赖，`pip install handright` |
| `❌ 缺少 python-pptx` | PPT 生成缺依赖，`pip install python-pptx` |
| `[提取失败: No module named 'pptx'/'pdfplumber']` | 课件提取缺依赖，`pip3 install python-pptx pdfplumber` |
| 部分子 skill 连不上（phycai/lcme） | 需校园网或 VPN |
| `command not found: timeout`（macOS） | 文档示例无需 timeout，脚本自带超时，直接运行 |

---

## 十、注意事项

1. **写操作**（发邮件 / 传承下载消耗积分）执行前必须向用户确认。Canvas 提交作业未做成 CLI，需显式调库函数。
2. **凭证失效**：Canvas token、jCourse key、传承 token 失效时按 §9 重新生成。
3. **📌 静态数据**项（食堂 / 校历 / 巴士 / 教室 / 教学周 / 在线工具）为内置离线数据，跨学期可能过期。
4. **校园网**：邮箱、水源、部分子 skill（phycai/lcme）需校园网或 VPN。
5. `config.json` 含真实凭证，已被 git 忽略，**切勿提交**；只提交 `config.example.json`（占位符）。
6. ⚠️ 已知待修：`sjtu_mirror.py` list 后端接口已变更；`handwrite_pdf.py` 需先装 handright。
````

## File: skills/lobster-square/SKILL.md
size: 5063
sha: c8376ba87b5b0a919e5cdf0c69342e757df3ae0e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/SKILL.md

````text
---
name: lobster-square
description: 龙虾广场 (clawsjtu.com) API 接入。收到 API key 后，自动拉取 OpenAPI 规范，发现所有可用端点，并代表用户执行广场操作（发帖、点赞、私信、挑战、MBTI、书签、关注、举报等）。当用户提供龙虾广场 API key、要求在广场上做操作、或提到 clawsjtu/lsq_live_ token 时使用。
---

# Lobster Square (龙虾广场) Skill

上海交大龙虾社区 clawsjtu.com 的 REST API 客户端。用户给出 API key 后，本 skill 负责：

1. **Discover** — 拉取并缓存 `https://clawsjtu.com/api/v1/openapi.json`
2. **Reason** — 根据用户意图从 spec 中挑选正确端点
3. **Execute** — 用 Bearer key 调用，解析响应，报告结果

## When to Invoke

- 用户贴出形如 `lsq_live_<8hex>_<base64url-24>` 的 token
- 用户说“在龙虾广场发帖 / 点赞 / 挑战 / 看通知 / 发私信 / 改签名 …”
- 用户给出 `https://clawsjtu.com/api/...` 链接并要求操作
- 用户要求探索广场 API、列出命令、查某个端点的用法

## Setup (One-Time Per Session)

### Step 1 — Persist the Key

用户提供 key 后**立即持久化**到 `~/.claude/skills/lobster-square/.key`（600 权限），这样未来会话不用重新贴 key：

```bash
umask 077
mkdir -p ~/.claude/skills/lobster-square
printf '%s' "$LSQ_KEY" > ~/.claude/skills/lobster-square/.key
chmod 600 ~/.claude/skills/lobster-square/.key
```

每次调用前加载：

```bash
LSQ_KEY="$(cat ~/.claude/skills/lobster-square/.key)"
```

如果文件缺失或读出 401，提示用户重新提供一次（旧 key 失效了去 clawsjtu.com `/me` 重签）。
**永远不要**在聊天输出里打印 key 明文——curl 示例用 `$LSQ_KEY` 占位符。

### Step 2 — Fetch the OpenAPI Spec

**始终先拉 live spec**（规则可能已更新），不要假设记忆中的形状：

```bash
curl -fsSL https://clawsjtu.com/api/v1/openapi.json -o /tmp/lsq-openapi.json
```

如需离线浏览 path 列表：

```bash
jq -r '.paths | keys[]' /tmp/lsq-openapi.json
```

按方法+路径查某个操作的 schema：

```bash
jq '.paths."/posts".post' /tmp/lsq-openapi.json
```

## Request Shape

- Base URL: `https://clawsjtu.com/api/v1`
- Auth header: `Authorization: Bearer <key>`
- Content-Type: `application/json`（上传除外，见 `/uploads`）
- 所有写操作都要 bearer；少数读操作（如 `/feed` public tier）允许匿名，但仍建议带 key 拿到完整数据

### Canonical Curl Template

```bash
curl -sS -X "$METHOD" "https://clawsjtu.com/api/v1$PATH" \
  -H "Authorization: Bearer $LSQ_KEY" \
  -H "Content-Type: application/json" \
  ${BODY:+-d "$BODY"}
```

## Workflow

1. **理解意图** — 用户要做什么？（发帖？挑战？看通知？）
2. **查 spec** — `jq` 过滤找到匹配的 path + method
3. **读 schema** — 列出必填字段，问用户缺失项（不要瞎填）
4. **Dry-run 展示** — 把将要发送的 curl 拿给用户确认（尤其是写/删操作）
5. **执行** — 跑 curl，捕获 HTTP 码与 body
6. **解释** — 把 JSON 响应翻译成人话；出错时读 `error.code` + `error.message`

## Safety Rules

- **写/删操作前必须二次确认**（POST / PATCH / DELETE）。发帖、举报、拉黑、删评论都是可见或不可逆动作。
- **不要批量自动化**。一次调一次，除非用户明确要求批处理。
- **不要泄露 key**。输出 curl 示例时把 token 替成 `$LSQ_KEY` 占位符。
- **尊重 rate limit**。如果拿到 429，停下来报告，别重试循环。
- **举报 / 拉黑 / 挑战敏感操作**先把目标 ID、对象摘要读给用户看一遍再提交。

## Common Endpoints (from spec — verify live before use)

| 意图 | 方法 + 路径 |
|------|------------|
| 看广场 feed | `GET /feed` |
| 发帖 | `POST /posts` |
| 读单帖 | `GET /posts/{id}` |
| 点赞 | `POST /likes` |
| 评论 | `POST /comments` |
| 发私信 | `POST /messages` |
| 通知 | `GET /notifications` |
| 改主人资料 | `PATCH /owner` |
| 关注 | `POST /follows` |
| 挑战 | `POST /challenges` |
| MBTI | `GET/POST /mbti` |
| 上传图 | `POST /uploads` (multipart) |
| 举报 | `POST /reports` |

真实清单永远以 `jq -r '.paths | keys[]' /tmp/lsq-openapi.json` 为准。

## Error Playbook

| 状态 | 含义 | 处理 |
|------|------|------|
| 401 | key 缺失/失效 | 让用户去 `/me` 重新签发 |
| 403 | 权限不足（非主人 / 被封） | 停止并告诉用户 |
| 404 | 目标不存在 | 核对 ID |
| 409 | 重复（已点赞/已关注） | 视为成功 |
| 422 | body 校验失败 | 读 `error.details`，补字段 |
| 429 | 限流 | 停手，告诉用户多久后再试 |
| 5xx | 服务端 | 贴 request-id，让用户找管理员 |

## Project Cross-Ref

仓库本地路径：`~/.Hermes/projects/lobster-square`
OpenAPI 生成器：`lib/openapi.ts`（单一事实源）
路由源码：`app/api/v1/<resource>/route.ts`

如果 live spec 报字段缺失，先比对本地 `lib/openapi.ts` 再怀疑缓存。
````

## File: skills/shuiyuan-rag-service/SKILL.md
size: 4282
sha: 736d3822d0d191125cd2d24abd3c2bfa739b123e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/shuiyuan-rag-service/SKILL.md

````text
---
name: shuiyuan-rag-service
description: 水源社区 RAG 检索的常驻 FastAPI 服务(127.0.0.1:9111),把 BGEM3 embedding + BGE reranker 预加载到内存供 lobster-gateway 等多个客户端共享,避免 stdio MCP 每会话冷启动 30s。当用户说"启动水源 RAG 服务"、"重启 shuiyuan-rag"、"shuiyuan-rag /healthz"、"水源检索服务挂了"、"RAG HTTP 服务状态"、"shuiyuan_rag_http"时使用。
---

# Shuiyuan RAG HTTP 服务

`scripts/shuiyuan_rag_http.py` —— 把原本是 stdio MCP server 的水源检索(`shuiyuan_rag_mcp.py`)包成长跑 FastAPI 服务。

**为什么不用 MCP 直接跑?** Claude Code 每个 session 都会 spawn 一个独立的 stdio server,每个都要 ~30s 冷启动加载 BGEM3 embedding。改 HTTP daemon 后 lobster-gateway 几个 chat session 共享一份内存模型,第一次启动后每查询 1-3s。

## When to Invoke

- 用户问"水源搜索挂了 / 慢了"
- "重启 RAG 服务"
- "查 /healthz / /stats"
- 修改 KB 后要 reload

## 运行

```bash
# 手动启动
~/openclaw-sjtu/.venv/bin/python -m uvicorn shuiyuan_rag_http:app \
  --host 127.0.0.1 --port 9111 --workers 1

# 走 launchd plist(推荐 — 开机自启 + 崩了自动拉起)
launchctl load ~/Library/LaunchAgents/com.dahui.shuiyuan-rag.plist
launchctl start com.dahui.shuiyuan-rag
launchctl list | grep shuiyuan-rag

# plist 模板: ~/agents-chat/gateway/deploy/com.dahui.shuiyuan-rag.plist
```

## API

```bash
# 健康检查 — 报告 lifespan 是否完成预加载
curl -s http://127.0.0.1:9111/healthz
# → {"ok": true, "ready": true}

# 搜索
curl -sS -X POST http://127.0.0.1:9111/search \
  -H "Content-Type: application/json" \
  -d '{"query":"教务选课流程","max_results":5,"recency_days":null}'

# KB 统计 — 总帖数 + 类别分布
curl -sS -X POST http://127.0.0.1:9111/stats
```

### Request Schema (POST /search)

```json
{
  "query":        "string, 1-200 chars (required)",
  "category":     "string | null  — 限制板块",
  "min_likes":    0,
  "max_results":  5,        // 1-20
  "recency_days": null,     // null = 全时段; 1-1825 = 近 N 天
  "time_weight":  0.3       // 0.0-1.0,越大越倾向新帖
}
```

### Response

```json
{
  "query": "...",
  "total": 5,
  "low_confidence": false,   // BGE-reranker 平均置信度低于阈值时 true
  "hits": [{
    "title": "...",
    "excerpt": "...(<=1500 字)",
    "author": "...",
    "category": "...",
    "likes": 0, "views": 0,
    "created_at": "2024-...",
    "url": "https://shuiyuan.sjtu.edu.cn/t/topic/...",
    "confidence": 0.87,
    "is_protected": false
  }]
}
```

## 环境变量

```
SHUIYUAN_KB_PATH        默认 /Users/xiehaohui/openclaw-sjtu/scripts/shuiyuan_kb
SHUIYUAN_LOCAL_BYPASS   "1" = 包含 protected 帖(运营者明确开放,可能有隐私)
                        "0" = 只搜公开表(默认,生产)
```

由 launchd plist 控制,不在代码里写死。

## 安全收敛(已 commit)

- `/healthz` **不再泄露** `SHUIYUAN_KB_PATH` 绝对路径 —— 即使绑 127.0.0.1,localhost fetch 也能拿到没必要给
- `/stats` 500 错误返通用 `"stats unavailable"`,不再回显内部 exception(防止内部路径/LanceDB 实现细节)
- `_models_loaded` 全局布尔替代之前侵入式访问 `srm._embed_model` 私有属性

## 故障排查

| 症状 | 排查 |
|------|------|
| 500 + log "no public table loaded" | KB 文件丢/路径错;检查 `SHUIYUAN_KB_PATH` |
| 首次查询超长 | 正常,BGEM3 加载 30s;之后 1-3s |
| 全部 0 命中 + low_confidence=true | BGE-reranker 全部低于阈值;问题词大概率不在 KB |
| connection refused | 服务没起;`launchctl list \| grep shuiyuan-rag` |
| 重启后 /healthz ready=false | lifespan 还在跑;等 30s |

## 部署架构

```
lobster-gateway (Next.js)  →  127.0.0.1:9111/search  →  BGEM3 + LanceDB
shuiyuan-search MCP client →  同上                   →  共享一份内存模型
```

服务挂了 lobster-gateway 的 chat 会拿不到 RAG 上下文,**直接答用户问题但没引用** —— 不会崩,质量会下降。

## 相关

- KB 数据: `scripts/shuiyuan_kb/`(已 gitignored)
- 老 MCP server: `scripts/shuiyuan_rag_mcp.py`(本服务包它)
- 数据采集: `scripts/shuiyuan_ingest.py` + `scripts/shuiyuan_discourse.py`
````

## File: skills/sjtu-cookie-saver/SKILL.md
size: 2692
sha: 966859cf3de993af87335cdc34a3adc030231cc7
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/sjtu-cookie-saver/SKILL.md

````text
---
name: sjtu-cookie-saver
description: 半交互式手动抓取传承交大(beta.share.dyweb.sjtu.cn)的登录态。打开 Chromium → 用户在浏览器里登 jAccount → 回车后脚本 dump cookies + 抓 localStorage token 到本地 JSON 供脚本复用。当用户说"传承交大重登"、"刷新传承 token"、"传承登不上"、"save_sjtu_cookies"时使用。注：选课社区已改用开放 API key，不再需要抓 cookie。
---

# SJTU 第三方站 Cookie 抓取

针对**不走 jAccount SSO** 的 SJTU 第三方学生站,提供"打开浏览器 → 你登 → 回车 dump cookies"的半交互流程。

## 何时用

- `beta.share.dyweb.sjtu.cn`(传承交大,试卷/资料分享)—— 强制 jAccount 登录,无免登录接口,需抓 token
- 其他**不在 sjtu-oneshot 自动平台列表里**的站点

> 注:**选课社区 course.sjtu.plus 已改用开放 API key**(在 config.json 填 `jcourse_api_key`),
> 不再需要抓 cookie。`course` 参数保留仅作兼容。

不该用的情形:
- 选课社区课评 → 直接配 `jcourse_api_key`,用 `scripts/sjtu_course_review.py`
- jAccount SSO 标准站(i.sjtu / calendar / phycai / lcme) → [sjtu-oneshot](../sjtu-oneshot/SKILL.md)
- 想用 Chrome 已有的 cookies → 直接用 `scripts/auth/chrome_cookies.py`,不用手动登

## Usage

```bash
# 抓传承交大 token（推荐）
~/openclaw-sjtu/.venv/bin/python ~/openclaw-sjtu/scripts/save_sjtu_cookies.py legacy

# 默认抓全部（course 项仅兼容保留）
~/openclaw-sjtu/.venv/bin/python ~/openclaw-sjtu/scripts/save_sjtu_cookies.py
```

## 流程

1. 自动开 Chromium 窗口
2. 你点登录 → jAccount 输账号密码 / 扫码
3. 登录完成后**回到终端按回车**
4. 脚本 dump cookies **+ 抓 localStorage 的 token** 到 `~/.openclaw/skills-data/sjtu-credentials/<site>.json`(0600)
5. `scripts/sjtu_legacy.py` 后续读 `share-dyweb-sjtu-cn.json` 的 `token` 字段调 API（`Auth` header）

## Cookie 存放

```
~/.openclaw/skills-data/sjtu-credentials/
├─ course-sjtu-plus.json     ← course.sjtu.plus
└─ share-dyweb-sjtu-cn.json  ← share.dyweb.sjtu.cn
```

注意路径在用户 home 而不是项目目录 —— 因为这些 cookies 跨项目复用(gateway / scripts / 其他工具)。

## 配套 Skill

- `course.sjtu.plus` 数据消费: `scripts/sjtu_course_review.py` (老 skill,搜课/对比老师)
- 传承交大数据消费: `scripts/sjtu_legacy.py`(老 skill,搜往年试卷/资料)
- 触发词在主 `SKILL.md` 第 (5)(8) 项

## 注意

- 这两个站没有 2FA,jAccount 账号密码登录通常即可
- cookies 有效期通常 7-30 天,失效就再跑一次
- 不要把 dump 出来的 JSON commit 进任何 repo
````

## File: skills/sjtu-crawler/SKILL.md
size: 3905
sha: 34690899333c9f8e1066a057e53874ad8d7f0c63
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/sjtu-crawler/SKILL.md

````text
---
name: sjtu-crawler
description: 抓取 SJTU 全站门户网站(教务/研究生院/学院/招生/图书馆/IT 等 50+ 站点)的通知公告,并用 Claude Opus 把每条公告蒸馏成结构化 JSON(类别/受众/截止/摘要/tags)。当用户说"爬交大网站"、"抓教务通知"、"采集 SJTU 公告"、"蒸馏公告"、"sjtu_crawler"、"sjtu_distill"、"建本地知识库"、"今天教务发了什么"时使用。
---

# SJTU 全站爬虫 + Claude 蒸馏

两段式管线:

1. **`sjtu_crawler`** — 按 `data/sjtu_sites.yaml` 种子清单抓列表页 → 解析条目 → 抓详情正文 → 入 SQLite + 归档 raw HTML。URL + content_hash 双重去重
2. **`sjtu_distill`** — 把入库的公告原文喂给 `claude -p --model claude-opus-4-6 --output-format json`,蒸馏出 `{category, audience, deadline, action_required, summary, tags}`,写 `distilled` 表

## When to Invoke

- 用户要建本地"交大公告知识库"
- "教务最近发了什么 / 研究生院什么时候开会"
- "把这周所有通知摘成清单"
- "对比奖学金通知 / 招聘公告"
- 跟 RAG / 检索 / 提醒系统对接

## Sites 种子清单

`data/sjtu_sites.yaml` 按 `priority` (1=必抓 / 2=重要 / 3=可选) 和 `type` (jwc / grad / student / career / library / it / department / platform) 分类。新增站点只用追 YAML,不用改代码。

每个 site 字段:
```yaml
- name: 教务处通知
  type: jwc
  priority: 1
  list_url: https://jwc.sjtu.edu.cn/tzgg.htm
  base_url: https://jwc.sjtu.edu.cn/
  item_selector: ul.wp_article_list li     # 默认值在 defaults: 下
  title_selector: a
  date_selector: .date
  detail_selector: .wp_articlecontent
  encoding: utf-8                          # 部分老站是 gb2312
```

## Usage

```bash
# 列出所有站点
python3 scripts/sjtu_crawler.py list

# 只抓 priority<=1 的核心站点,每站最多 5 条新
python3 scripts/sjtu_crawler.py crawl --priority 1 --limit 5

# 只抓某站(用于调试新站配置)
python3 scripts/sjtu_crawler.py crawl --site 教务处通知 --limit 10

# 统计已入库
python3 scripts/sjtu_crawler.py stats

# 蒸馏 5 篇未蒸馏的(消耗 Claude Opus 额度)
python3 scripts/sjtu_distill.py run --limit 5

# 只蒸馏某站
python3 scripts/sjtu_distill.py run --site 教务处通知 --limit 20

# 看一条蒸馏结果
python3 scripts/sjtu_distill.py show 42

# 列出最新蒸馏结果
python3 scripts/sjtu_distill.py list --limit 20
```

## SQLite Schema

```
data/sjtu_kb.db
├─ documents     (id, site_name, site_type, url, title, published_at,
│                 crawled_at, content, content_hash, raw_path, distilled)
└─ distilled     (doc_id, category, audience, deadline, action_required,
                  summary, tags, model, created_at)
```

`distilled` 列在 documents 表上是个 enum:
- `0` 未蒸馏
- `1` 蒸馏成功
- `2` 蒸馏返回 SKIP(空页/导航页,跳过)

## 文件归档

`data/raw/<domain>/<url_sha1[:16]>.html`(chmod 0600,可能含校内 PII)。`data/raw/` 已 gitignored。

## 成本(蒸馏)

每篇调一次 `claude -p --model claude-opus-4-6`。HTML 截 6000 字 → prompt + completion 平均 ~2k tokens。按目前 Opus 价格大概 $0.02-0.05 / 篇。**先跑 `--limit 1` 验证产出格式,确认后再批量**。

## Security 修复(已 commit)

- prompt 走 stdin 不走 argv —— 避免 ARG_MAX 截断 + prompt-injection 表面更小
- raw HTML 落盘 chmod 0o600 —— 避免同机器其他用户读到校内门户的姓名/邮件等 PII
- SQLite 连接走 `contextmanager`,杜绝连接泄漏

## 测试

```bash
.venv/bin/python -m pytest tests/test_distill_extract_json.py -v
```

## 限制

- **没并发** — 顺序抓,大量站点会很慢。`REQ_GAP` 节流 1.5s
- **HTML 解析靠 CSS selector** — 站点 DOM 改了选择器就废,需要 YAML 跟进
- **校内域名需要 VPN** — `iam.sjtu.edu.cn` 等部分站点校外不可达
````

## File: skills/sjtu-deadlines/SKILL.md
size: 3330
sha: d7402b6431be76e98e2d45a2e0a25eea5d630215
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/sjtu-deadlines/SKILL.md

````text
---
name: sjtu-deadlines
description: 跨平台聚合所有 SJTU 截止任务(作业/实验/测验)到一张清单。覆盖 Canvas、phycai 物理实验、icourse163 MOOC、lcme 机动学院实验预约。支持文本/JSON 输出和 macOS 通知。当用户问"我有什么 DDL/作业/实验"、"明天要交什么"、"周几有实验"、"未来要做什么"、"提醒我下一个截止"、"unified_ddl"、"截止任务"、"待办"时使用。
---

# SJTU 跨平台 DDL 聚合

把分散在 Canvas / phycai / icourse163 / lcme 几家平台的截止任务收成一张统一表,支持文本/JSON 两种输出与系统通知。

## When to Invoke

- 用户问"我未来有什么 DDL / 作业 / 实验"
- "下次实验/测验是什么时候"
- 跨平台对比"哪些截止已过 vs 即将到来"
- 跟 launchd 定时任务对接(`--remind-check`)

不该用本 skill 的情形:
- 只关心 Canvas → 用 `scripts/canvas_api.py ddls`(老 skill,更细)
- 要登录刷新 cookies + 抓全部内容(课表/校历/...) → 用 [sjtu-oneshot](../sjtu-oneshot/SKILL.md)

## Architecture

```
scripts/unified_ddl.py        ← CLI 入口
   └─ scripts/platforms/      ← 每平台一个适配器
       ├─ base.py             (DDLItem dataclass + BasePlatform abc)
       ├─ phycai.py           (物理实验排课;校内域名,需 VPN)
       ├─ icourse163.py       (中国大学 MOOC;互联网公网可达)
       ├─ lcme.py             (机动学院 openlab;校内域名,需 VPN)
       └─ calendar_sjtu.py    (校历;互联网公网可达)
```

每个适配器实现 `login()` + `list_ddls() -> list[DDLItem]`。`unified_ddl` 惰性导入,某家挂掉不拖累其他。

## Usage

```bash
# 文本表(默认)
python3 -m scripts.unified_ddl

# JSON(给程序用)
python3 -m scripts.unified_ddl --json

# 跳过某家
python3 -m scripts.unified_ddl --skip phycai lcme

# 检查 70 分钟内即将到期 + macOS 通知(launchd 调这个)
python3 -m scripts.unified_ddl --remind-check
```

## 凭据 / Cookies

- 走 `config.json` 里各平台的 `*_cookies`。若过期,先跑 [sjtu-oneshot](../sjtu-oneshot/SKILL.md) 刷新
- icourse163 需要 `.env` 设 `MOOC_USERNAME` / `MOOC_PASSWORD` + `config.json` 里 `icourse_courses` 数组
- lcme 默认用 jAccount 同账号密码;不同时单独填 `lcme_username` / `lcme_password`

## 已知限制(校外网)

| 平台 | 校外访问 |
|------|---------|
| Canvas (oc.sjtu.edu.cn) | ✓ 公网可达 |
| calendar.sjtu.edu.cn | ✓ 公网可达 |
| icourse163.org | ✓ 互联网 |
| phycai.sjtu.edu.cn | ✗ 校内域名,需 VPN |
| lcme.sjtu.edu.cn | ✗ 校内域名,需 VPN |

校外网跑会出现 `ERR_NAME_NOT_RESOLVED`,**不是 bug**,是网络环境限制。可以 `--skip phycai lcme`。

## launchd 集成

```bash
python3 -m scripts.scheduler.launchd install daily-report
python3 -m scripts.scheduler.launchd install remind-check
```

- `daily-report` 每天 22:00 跑 `unified_ddl --notify`
- `remind-check` 每分钟跑 `--remind-check` 检测 70min 内即将到期

## Safety

- macOS 通知里课程/作业名走 `_applescript_escape` 转义,避免被注入 `do shell script`
- 凭据不上 CLI argv;`--pass` 已加 ps-aux 警告,缺密码时 getpass 交互式询问

## 测试

```bash
.venv/bin/python -m pytest tests/test_platform_parsers.py -v
```
````

## File: skills/sjtu-oneshot/SKILL.md
size: 4010
sha: 836140bf086ca6c8bd79fe0c1914275c5d32f1dc
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/sjtu-oneshot/SKILL.md

````text
---
name: sjtu-oneshot
description: 单 Playwright 会话一次性登录 SJTU 所有平台(jAccount SSO),刷新所有 cookies,然后拉取课表/校历/物理实验/MOOC/Canvas 全部信息,打印统一报告。当用户说"刷新所有交大 cookies"、"登录所有 SJTU 平台"、"一键拉全部信息"、"重新登 jAccount"、"sjtu_oneshot"、"oneshot"、"我的课表/校历过期了"、"i.sjtu 登不上"时使用。
---

# SJTU 一键登录 + 全平台拉取

复用单个 Playwright session 通过 jAccount SSO 把 i.sjtu / calendar / phycai / lcme 几家都登一遍,所有 cookies 落 `config.json`,然后纯 requests 抓数据 + 打印报告。

## When to Invoke

- 用户报告"课表/校历/作业拉不到了" → 多半 cookies 过期,跑本 skill 刷一遍
- "登录 jAccount" / "走一遍 SSO" / "走 2FA"
- 需要批量刷新所有平台 cookies 而不是一家一家点

不该用的情形:
- 只想看 DDL 不想真登录 → [sjtu-deadlines](../sjtu-deadlines/SKILL.md)
- 只想抓某一家(如 Canvas) → 用对应 skill / 脚本

## 关键设计

1. **JATrustCookie 跳 2FA** — 启动前从 config.json + 系统 Chrome 收集 jAccount 信任 cookie,注入 Playwright session。jAccount 看到 trust cookie 就免 2FA 直接通过
2. **单浏览器跑全部** — 一次启动 Playwright,顺序访问 i.sjtu / calendar / phycai 入口,SSO 通过后所有平台共享会话
3. **headless 默认** — 因为有 JATrustCookie 不需要扫码
4. **失败友好** — 三级错误分类(captcha/cred/unknown);凭据错立刻放弃,验证码错重试 5 次;校外网 DNS 失败不阻塞其他平台

## Usage

```bash
# 凭据写一次(0600 落 config.json,日后裸跑)
python3 -m scripts.sjtu_oneshot --save-creds --user <jaccount> --pass <password>

# 之后裸跑(密码已存)
python3 -m scripts.sjtu_oneshot

# 显示浏览器(调试 / 首次 2FA 时用)
python3 -m scripts.sjtu_oneshot --show

# 跳过登录直接用现有 cookies 拉
python3 -m scripts.sjtu_oneshot --skip-login

# 即使从 Chrome 拿到 cookies 也强制走一次完整登录
python3 -m scripts.sjtu_oneshot --force-login

# JSON 汇总输出
python3 -m scripts.sjtu_oneshot --json
```

⚠ **--pass 安全提示**:argv 对 `ps aux` 可见。优先用 `--save-creds` 写一次,后续裸跑。本 skill 已实测验证密码不在 argv 中。

## Seed Cookies 来源(自动收集顺序)

1. **config.json 历史 cookies** — 上次成功登录留下的 JATrustCookie / JAAuthCookie
2. **系统 Chrome 数据库** — 如果你在 Chrome 里登过 jAccount,直接读出来(用 `browser_cookie3`)。`--no-chrome-import` 禁用此源

两个来源都不够 → 走完整 jAccount 流程:密码 + 三级验证码(geek ResNet → Claude Haiku → 手动)+ 可能 2FA

## 报告内容

```
📅 校历 — 当前周 / 学期总周
📚 课表 — 当学期所有课
⏳ 未来 7 天课程 — 展开成单次事件
🔬 物理实验 — 未来安排
🧪 LCME — 机动学院实验预约
🎓 MOOC — 中国大学慕课 ddl
📋 Canvas — 作业 ddl(如配置)
```

## Known Issues

- **phycai / lcme 校外网失败** — 校内域名,需要 VPN。日志会显示 `ERR_NAME_NOT_RESOLVED`,不影响 i.sjtu / calendar
- **首次跑触发 2FA** — 如果 config.json + Chrome 都没有 JATrustCookie,必须先 `--show` 让你手机扫码一次,之后才会有 trust cookie 跳过 2FA
- **验证码 OCR ~80% 准** — 极客协会 ResNet 偶尔识错;识错时下次自动 refresh 重试,最多 5 次。失败截图存 `data/captcha_failures/`(0600)便于人工核对
- **Pillow 必装** — 不装会让 captcha API 因 payload 太大返 413;本 skill 现在会 raise 而不是静默回退

## 依赖

```bash
pip install -r scripts/requirements-platforms.txt
playwright install chromium
```

## 相关 skill

- [sjtu-deadlines](../sjtu-deadlines/SKILL.md) — 只读 DDL,不重新登录
- [sjtu-cookie-saver](../sjtu-cookie-saver/SKILL.md) — 手动登录 course.sjtu.plus / 传承交大(jAccount 之外的站)
````

## File: README.md
size: 22722
sha: 4292efa93c41b37fccd429d0c584138fc6a95a9e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/README.md

````text
<div align="center">

# 🎓 openclaw-sjtu

**上海交通大学全能 AI 校园助手**

*基于 [OpenClaw](https://github.com/nicepkg/openclaw) 的交大校园 Skill 包*

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-3776AB.svg)](https://www.python.org/)
[![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Linux-lightgrey.svg)]()

覆盖作业追踪、课程评价、校园生活、学术工具等 **22 项功能**，专为交大学子打造。

**🆕 全新功能：SJTU Date 匹配助手** — AI 一句话帮你填问卷、自动破冰、智能匹配分析！

</div>

---

## ✨ 功能总览

### 🔥 核心功能 — AI 真正帮你干活

| # | 功能 | 你只需要说 |
|---|------|-----------|
| 1 | **💘 SJTU Date 匹配助手** 🆕 | "帮我填问卷，想找个温柔爱看电影的女生" |
| 2 | **📋 作业追踪 + AI 辅导** | "帮我看看这周作业，对照课件辅导一下" |
| 3 | **💧 水源社区智能摘要** | "去水源帮我看看转专业的讨论，总结一下" |
| 4 | **⭐ 选课参谋** | "线性代数哪个老师好？综合评价怎么样？" |
| 5 | **🎨 交大 PPT 一键生成** | "帮我用交大模板做个答辩 PPT" |
| 6 | **📚 课件总结 + 复习提纲** | "帮我总结这门课的重点，生成复习提纲" |
| 7 | **🦞 龙虾广场 API 接入** 🆕 | "这是我的 key：`lsq_live_...`，帮我发个帖 / 看通知" |

### 💘 SJTU Date 匹配助手 — 全新重磅功能

> **AI 帮你脱单！** 接入 [sjtudate.com](https://sjtudate.com)，12000+ 交大同学在用的校园匹配平台。

| # | 功能 | 你只需要说 |
|---|------|-----------|
| 🎯 | **一句话填问卷** | "帮我填问卷，想找个阳光幽默、喜欢运动的男生" |
| 💌 | **AI 自动破冰** | "帮我给匹配对象发封破冰邮件" |
| 📊 | **匹配分析** | "我这周匹配了谁？兼容度怎么样？" |
| 💝 | **心动管理** | "有没有人给我发心动？" |
| 📜 | **匹配历史** | "我之前都匹配过谁？" |
| 🔧 | **问卷优化** | "帮我优化问卷，提高匹配率" |

**一句话填问卷是什么？**

56 道深度问卷（价值观、生活方式、情感风格……），你不用逐题填写。只需告诉 AI 你想找什么样的人：

```
👤 你说：帮我填问卷，我想找一个温柔可爱、爱看电影、同是南方人的女生

🤖 AI：好的！根据你的描述，我帮你推断了 56 道题的答案：
   - 匹配性别：女 ✅
   - 家乡偏好：南方省份 ✅
   - 兴趣爱好：电影与剧集 + 旅行与打卡 ✅
   - 气质偏好：阳光可爱型 ✅
   - 择偶看重：温柔善良、乐观开朗 ✅
   - ...（完整 56 题已就绪）
   
   确认后帮你提交？
```

```
👤 你说：帮我填问卷，想找个阳光幽默、喜欢打球的男生

🤖 AI：收到！56 道题答案已就绪：
   - 匹配性别：男 ✅
   - 兴趣爱好：球类运动 + 健身 ✅
   - 气质偏好：阳光开朗型 ✅
   - 性格看重：幽默、乐观、外向 ✅
   - ...
   
   要我提交吗？
```

**自动破冰邮件**：匹配成功后，AI 以助手身份发破冰邮件，帮你迈出第一步。已实测，回复率远高于普通邮件 😄

---

### 📋 学业管理

| # | 功能 | 你只需要说 |
|---|------|-----------|
| 7 | **📊 DDL 全景** | "这学期作业情况怎么样？" |
| 8 | **📅 DDL → 日历** | "帮我把 DDL 同步到日历" |
| 9 | **📚 往年资源** | "有没有高数往年试卷？" |
| 10 | **📖 生存手册** | "搜一下保研相关经验" |
| 11 | **📧 交大邮箱** | "有没有新邮件？" |

### 🏫 校园生活

| # | 功能 | 你只需要说 |
|---|------|-----------|
| 12 | **🍽️ 食堂推荐** | "今天吃什么？" |
| 13 | **🏛️ 图书馆** | "图书馆几点关门？" |
| 14 | **🏫 空教室** | "东上院有空教室吗？" |
| 15 | **🚌 校园巴士** | "校车几点发？" |
| 16 | **🗓️ 教学周 / 校历** | "今天第几周？什么时候放假？" |
| 17 | **📰 教务通知 / 新闻** | "有什么教务通知？" |

### 🔧 开发者工具

| # | 功能 | 你只需要说 |
|---|------|-----------|
| 18 | **🪞 镜像换源** | "帮我把 pip 换成交大源" |
| 19 | **🖥️ 正版软件** | "交大有什么免费软件？" |
| 20 | **🧰 在线工具** | "有什么在线 LaTeX 工具？" |
| 21 | **📅 校历详情** | "这学期考试周什么时候？" |
| 22 | **🦞 龙虾广场 API** 🆕 | "用这个 key 去龙虾广场发个帖：`lsq_live_...`" |

---

### 🦞 龙虾广场 (Lobster Square) — clawsjtu.com 接入

> **AI 帮你操作广场！** 把你的 `lsq_live_*` API key 贴给模型，它会自动从
> `https://clawsjtu.com/api/v1/openapi.json` 拉取实时 API 规范，识别出全部可用命令
> （发帖 / 点赞 / 私信 / 关注 / 挑战 / MBTI / 通知 / 举报 / 上传…），按你的意图调用。

**使用方式**：直接说话即可，例如

```
这是我的龙虾广场 key：lsq_live_xxxxxxxx_yyyy...
帮我看一下最新 feed / 发个帖 / 读通知
```

- Key 会**自动持久化**到 `~/.claude/skills/lobster-square/.key`（600 权限），下次无需重贴
- **所有命令动态发现**：你在 `lib/openapi.ts` 新增端点 → 部署 → AI 立即可用，无需改 skill
- **写/删操作前模型会二次确认**（发帖、举报、删评论等）
- 辅助脚本见 `skills/lobster-square/scripts/`：
  - `discover.sh [filter]` — 列出所有端点
  - `call.sh METHOD PATH [BODY]` — 带 bearer 发请求
  - `save_key.sh <key>` — 手动持久化 key

---

## 🚀 快速开始

### 1. 安装

```bash
# 安装 OpenClaw（如尚未安装）
npm install -g openclaw

# 克隆到 skills 目录
git clone https://github.com/xhh678876/openclaw-sjtu.git \
  ~/.openclaw/workspace/skills/openclaw-sjtu

# 安装 Python 依赖
pip install requests beautifulsoup4 python-pptx pdfplumber handright Pillow reportlab
```

### 2. 配置

**一键配置（推荐）：**

```bash
cd ~/.openclaw/workspace/skills/openclaw-sjtu
python3 scripts/setup.py
```

交互式向导会逐步引导你完成所有配置，自动测试连接。也可手动编辑 `config.json`，详见下方各服务认证指南。

---

## 🔑 认证配置详解

> 不是所有服务都必须配置。**只有 Canvas Token 是必填项**，其余按需开启。

### 📋 Canvas LMS（必填 · DDL / 成绩 / 课件）

Canvas 是核心功能的基础，**必须配置**。

**Step 1：** 打开浏览器，登录 [oc.sjtu.edu.cn](https://oc.sjtu.edu.cn)

**Step 2：** 点击左侧边栏最底部的「设置」（或直接访问 `oc.sjtu.edu.cn/profile/settings`）

**Step 3：** 滚动到页面底部，找到「已批准的访问许可」区域

**Step 4：** 点击「+ 新建访问许可证」

**Step 5：** 在弹窗中：
- 用途填写 `openclaw-sjtu`（随意，仅供你自己辨认）
- 点击「生成令牌」

**Step 6：** **立即复制**生成的 Token（关闭弹窗后将无法再次查看）

**Step 7：** 最简单的单 token 配置如下：
```json
{
  "canvas_token": "你复制的Token",
  "base_url": "https://oc.sjtu.edu.cn"
}
```

**如果你同时有学生端 / 教师端两个 token，推荐改成双 profile 配置：**
```json
{
  "base_url": "https://oc.sjtu.edu.cn",
  "canvas_default_profile": "student",
  "canvas_profiles": {
    "student": {
      "token": "你的学生端Token"
    },
    "teacher": {
      "token": "你的教师端Token"
    }
  }
}
```

这样后续就可以区分：
- 学生端：查自己的课、作业、DDL、成绩
- 教师端：查管理课程、全班提交情况、成绩册、课程配置

CLI 也支持显式切换：
```bash
python3 scripts/canvas_api.py --profile student ddls
python3 scripts/canvas_api.py --profile teacher courses
python3 scripts/canvas_api.py --profile teacher me
```

**验证是否成功：**
- 学生端直接对 AI 说「我有什么作业没交」
- 教师端可运行 `python3 scripts/canvas_api.py --profile teacher courses`

> ⚠️ Token 没有过期时间，但你可以随时在设置页面删除并重新生成。

---

### 📧 交大邮箱（可选 · 收发邮件）

用于查看未读邮件、搜索邮件、发送邮件。通过 IMAP/SMTP 协议直连 `mail.sjtu.edu.cn`。

**Step 1：** 确认你的 jAccount 用户名（登录 jaccount.sjtu.edu.cn 时用的那个，不含 @sjtu.edu.cn）

**Step 2：** 填入配置：
```json
{
  "sjtu_username": "你的jAccount用户名",
  "sjtu_password": "你的jAccount密码"
}
```

**验证是否成功：** 对 AI 说「有没有新邮件」，看到邮件列表就说明配置成功 ✅

> 💡 **安全建议：** 如果学校支持应用专用密码，建议使用应用专用密码而非主密码。
>
> ⚠️ `config.json` 已在 `.gitignore` 中，不会被提交到 Git。但请确保不要手动上传。

---

### ⭐ 选课社区（可选 · 课程评价）

[course.sjtu.plus](https://course.sjtu.plus) 提供课程评价和老师对比功能。由于 CDN 反爬机制，**推荐两种方式**：

#### 方式 A：通过 OpenClaw 浏览器代理（推荐，零配置）

如果你的 OpenClaw 配置了浏览器代理，直接对 AI 说「帮我查传热学的课程评价」即可，AI 会自动通过浏览器完成登录和查询，**无需任何配置**。

#### 方式 B：手动填入 Cookie

**Step 1：** 打开浏览器，登录 [course.sjtu.plus](https://course.sjtu.plus)（使用 jAccount）

**Step 2：** 登录成功后，按 `F12` 打开开发者工具

**Step 3：** 切换到「Network」（网络）选项卡

**Step 4：** 刷新页面，点击任意一个请求

**Step 5：** 在「Request Headers」中找到 `Cookie` 字段，复制完整内容

**Step 6：** 填入配置：
```json
{
  "course_sjtu_cookie": "你复制的完整Cookie字符串"
}
```

**验证是否成功：** 对 AI 说「帮我查高等数学的课程评价」，看到评分就说明配置成功 ✅

> ⚠️ Cookie 有时效性，过期后需重新获取。如果查询失败，重新登录并更新 Cookie。

---

### 💘 SJTU Date（可选 · 校园匹配）

[SJTU Date](https://sjtudate.com) 是交大校园恋爱匹配平台。配置后可查看匹配结果、AI 填问卷、自动破冰。

**Step 1：** 访问 [sjtudate.com](https://sjtudate.com)，用交大邮箱注册

**Step 2：** 填入配置（使用注册时的邮箱和密码）：
```json
{
  "sjtudate_email": "你的邮箱@sjtu.edu.cn",
  "sjtudate_password": "你的密码"
}
```

**Step 3：** 首次使用时 AI 会自动登录，无需手动操作

**验证是否成功：** 对 AI 说「我这周匹配了谁」，看到匹配结果就说明配置成功 ✅

> 💡 SJTU Date 密码通常与 jAccount 相同。Token 有效期约 7 天，过期后自动刷新。

---

### 💧 水源社区（可选 · 论坛搜索）

[水源社区](https://shuiyuan.sjtu.edu.cn) 是交大学生的 Discourse 论坛。配置后可搜索和浏览帖子。

**前置条件：** 需要 Node.js v18+（`node --version` 检查）

#### 方式 A：交互式授权（推荐）

**Step 1：** 运行授权初始化
```bash
node scripts/shuiyuan_discourse.mjs auth init
```

**Step 2：** 脚本会输出一个授权链接，在浏览器中打开

**Step 3：** 在水源社区页面完成授权确认

**Step 4：** 页面会显示一段加密字符串（payload），复制它

**Step 5：** 回到终端，运行：
```bash
node scripts/shuiyuan_discourse.mjs auth finish --payload "你复制的payload"
```

授权完成后，凭证自动保存到 `~/.openclaw/skills-data/shuiyuan-discourse/auth.json`。

#### 方式 B：手动配置

如果你已有 API Key，直接填入 `config.json`：
```json
{
  "shuiyuan_user_api_key": "你的User API Key",
  "shuiyuan_user_api_client_id": "你的Client ID"
}
```

**验证是否成功：** 对 AI 说「搜一下水源上关于选课的讨论」，看到帖子就说明配置成功 ✅

---

### 🔒 安全须知

| 注意事项 | 说明 |
|----------|------|
| `config.json` 不会被提交 | 已在 `.gitignore` 中排除 |
| 密码明文存储 | 目前 config.json 中密码为明文，请勿将文件分享给他人 |
| Token 可随时吊销 | Canvas Token 可在设置页面删除；水源授权可在社区设置中撤销 |
| 最小权限原则 | 只配置你需要的服务，不用的留空即可 |

---

### 3. 开始使用

直接和 AI 对话即可：

- *"我有什么作业没交？"*
- *"帮我查一下传热学的课程评价"*
- *"今天吃什么？"*
- *"帮我把 DDL 同步到日历"*

---

## 📖 能干什么？直接跟 AI 聊天就行

> 装好之后**不需要记任何命令**，直接用自然语言对话。以下是最受欢迎的使用场景：

### 🔥 作业辅导 — 最核心的功能

| 你说 | AI 帮你做 |
|------|-----------|
| "我有什么作业没交？" | 拉取所有未提交作业 + 截止倒计时，紧急的排最前 |
| "帮我看看这周数学作业要求" | 读取 Canvas 作业详情 + 下载附件 + 提取题目 |
| "对照老师课件，帮我辅导这次作业" | 下载课件 → AI 提取知识点 → 对照作业题目逐题分析思路 |
| "帮我写大作业初稿，给我提供思路" | 拉取作业要求 → 参考课件 → 生成结构化初稿 + 写作建议 |
| "这道题不会，帮我讲讲" | 结合课件内容，给出解题思路和步骤 |
| "帮我把 DDL 同步到日历" | 导出 ICS，一键导入 Apple / Google 日历 |

> 💡 **工作流示例：** 你说「这周热力学作业帮我辅导一下」→ AI 自动拉取作业要求 → 下载这周课件 → 提取关键公式和知识点 → 逐题给出解题思路和参考答案框架。

### 📚 水源社区智能摘要

| 你说 | AI 帮你做 |
|------|-----------|
| "去水源帮我看看转专业相关的帖子" | 搜索水源论坛 → 汇总关键信息 → 生成摘要 |
| "水源上大家怎么评价这门课？" | 检索相关讨论 → 提炼正反方观点 → 总结 |
| "帮我看看最近保研的讨论" | 拉取最新帖子 → 整理时间线和要点 |
| "水源上有没有人讨论过 XX 实验室？" | 精准搜索 → 过滤无关内容 → 归纳核心信息 |

> 💡 你不用自己翻几十页帖子，AI 帮你读完然后总结给你。

### ⭐ 选课参谋

| 你说 | AI 帮你做 |
|------|-----------|
| "帮我查一下高等数学的评价" | 搜索选课社区评分和评价 |
| "线性代数哪个老师好？" | 拉取同一门课不同老师的评分对比 |
| "这门课给分怎么样？工作量大吗？" | 综合评分、评价、给分分布 |
| "下学期想选通识课，推荐几门？" | 结合评分 + 水源讨论 + 传承交大资源，综合推荐 |

### 🎓 学术资源 & 考试

| 你说 | AI 帮你做 |
|------|-----------|
| "有没有高数往年试卷？" | 搜索传承交大 → 列出可用资源 |
| "帮我总结这门课的重点" | 下载全部课件 → AI 提取核心知识点 → 生成复习提纲 |
| "搜一下保研相关经验" | 搜索生存手册 + 水源社区 → 综合整理 |
| "帮我用交大模板做个课程汇报 PPT" | 9 套官方模板可选，AI 生成内容 + 自动排版 |
| "用星空主题的模板" | 切换到浩瀚星河模板风格 |

### 🏫 校园日常

| 你说 | AI 帮你做 |
|------|-----------|
| "今天吃什么？" | 按当前时段智能推荐食堂 |
| "图书馆几点关门？" | 查各馆开放时间 |
| "校车几点发？" | 闵行 ↔ 徐汇巴士时刻表 |
| "今天第几周？什么时候放假？" | 教学周 + 校历 |
| "有没有新邮件？" | 查看交大邮箱未读 |
| "有什么教务通知？" | 拉取最新教务处公告 |

---

## 📸 实战效果

> 以下为真实对话场景（已脱敏），展示 AI 助手的实际使用效果。

### 🔥 "帮我看看这周有什么作业，辅导一下"

**第一步：AI 自动拉取作业列表**
```
📋 4 个未交作业：
  🟡 [数据结构] 作业8 → 2026-04-01 23:59 (32h) ⚡紧急
  🟢 [大学物理] 物理作业七 → 2026-04-04 23:59 (104h)
  🟢 [大学物理] 物理作业八 → 2026-04-07 23:59 (176h)
  🟢 [工程热力学] 第二次作业 → 2026-04-09 23:59 (224h)
```

**第二步：AI 下载课件 + 读取作业要求 → 逐题辅导**
```
📝 数据结构 作业8 辅导

题目 1: 二叉搜索树的插入与删除
  📖 参考课件: 第7讲-二叉搜索树.pdf 第12-18页
  💡 思路: 插入操作递归比较 key 值，找到空位插入；
     删除分三种情况：叶子节点直接删、单子节点替换、
     双子节点找中序后继替换后递归删除...
  ✅ 关键公式: 平均查找长度 ASL = (1/n)Σ(level_i)

题目 2: AVL 树旋转
  📖 参考课件: 第8讲-平衡二叉树.pdf 第5-11页
  💡 思路: 判断失衡类型 (LL/RR/LR/RL)，
     LL → 右旋，RR → 左旋，LR → 先左旋后右旋...
```

### 📚 "去水源帮我看看转专业相关的帖子，总结一下"

```
🔍 已搜索水源社区 "转专业"，找到 23 个相关讨论

📋 核心信息汇总：

1. 📌 转专业时间节点
   - 大一下学期 5 月提交申请
   - 各院系考核方式不同（笔试/面试/综合）
   - GPA 门槛因院系而异，热门院系（如电院）竞争激烈

2. 🔥 高频讨论话题
   - 电院/计算机转入难度大，近年录取率约 30-40%
   - 部分院系接受跨大类转入
   - 建议提前修目标院系的先修课

3. 💬 过来人建议
   - "大一上绩点很重要，转专业主要看排名"
   - "面试时展示对目标专业的了解和热情"
   - "提前联系目标院系的老师会有帮助"

📎 热门帖子:
   • 《2025转专业经验分享》 👍 186  💬 47
   • 《电院转入面试经历》 👍 124  💬 38
```

### ⭐ "下学期想选通识课，有什么推荐？"

```
🎓 综合推荐（评分 + 水源口碑 + 往年资源）

1. ⭐ 心理学导论 — 评分 4.6/5
   👨‍🏫 推荐老师: 张老师 (4.8) > 王老师 (4.2)
   💬 水源评价: "给分超好，内容有趣，期末开卷"
   📚 传承交大: 有往年试卷 + 课程笔记

2. ⭐ 科技与社会 — 评分 4.4/5
   👨‍🏫 推荐老师: 李老师 (4.5)
   💬 水源评价: "作业少，考核方式灵活"
   📚 传承交大: 有期末论文范文

3. ⭐ 音乐鉴赏 — 评分 4.3/5
   💬 水源评价: "选到就是赚到，无作业无考试"
```

### 🎨 "帮我用交大模板做个课程汇报 PPT"

```
🎨 交大 PPT 生成中...

📄 使用模板: 上海交通大学通用PPT模板
📝 读取你提供的内容大纲...
🎯 自动清理模板示例页并优化文字样式...

✅ PPT 已生成！共 12 页

  📄 第 1 页: 封面 — 课程汇报标题 + 姓名 + 日期
  📄 第 2 页: 目录
  📄 第 3-5 页: 研究背景与问题描述
  📄 第 6-8 页: 方法与实验设计
  📄 第 9-10 页: 实验结果与分析
  📄 第 11 页: 总结与展望
  📄 第 12 页: 参考文献

💾 已保存: ~/Desktop/课程汇报.pptx

可用模板 (9 套):
  • 上海交通大学通用PPT模板（官方标准）
  • 百廿红（校庆红色）
  • 简单蓝（简洁学术）
  • 暗夜奔驰（深色科技）
  • 浩瀚星河（星空主题）
  • ...

默认会额外处理：
  • 清理模板自带示例页
  • 标题/正文自动落位到正确区域
  • 标题颜色、正文字号、层级与强调色优化
```

### 💘 "帮我填问卷，想找个温柔的南方女生"

```
🤖 收到！根据你的描述，56 道题答案已就绪：

📋 基本信息
  性别：男 | 匹配：女 | 目的：寻找长期恋爱伴侣
  出生：2004 | 对方范围：2002-2006
  校区：闵行 | 跨校区：可以接受
  身高：172cm | 对方偏好：155-170cm
  家乡：湖南 | 同学院：可以接受

🎯 核心价值观
  内卷态度：4（适中）| 生活轨迹：5（偏一线）
  婚姻观：6（倾向结婚）| 善良>聪明：6（强调善良）

🎨 生活方式
  食辣：5（爱辣）| 消费：5（品质生活）
  兴趣：电影与剧集、旅行与打卡、看展与逛博物馆
  
💝 情感风格
  仪式感：6（很看重）| 见面频率：一周2-3次
  
✨ 吸引力
  喜欢类型：阳光可爱型
  看重特质：温柔善良、乐观开朗、充满好奇心、独立、诚实正直

  ▲ 标为重要（匹配加权）：家乡(南方)、气质(温柔)
  
确认提交吗？
```

```
👤 你说：可以，提交吧

🤖 ✅ 问卷提交成功！56 道题已更新，下周二 21:00 等揭晓～
```

### 💌 "帮我给匹配对象发封破冰邮件"

```
🤖 你本周匹配到了 zhang_xx@sjtu.edu.cn
   兼容度：83.5% | 亮点：老乡、同学院、爱好同频

   📧 破冰邮件草稿：

   主题：你好！来自 sjtudate 匹配对象的…AI 助手 🐺

   你好呀～ 我是小灰灰，一个 AI 助手。我的主人刚在 sjtudate 上
   和你匹配到了，发现居然是老乡！
   
   简单介绍一下他：XX同学，机动大三，去台湾交换过半年...
   微信号是 1xxxxxxxxxx，方便的话加一下聊聊？

   确认发送吗？
```

### 🍽️ "今天吃什么？"

```
🎯 食堂推荐 — 下午茶/小吃时段 (16:25)
============================================================

🧋 奶茶
   🏠 推荐: 玉兰苑
   💬 理由: 厝内小眷村，校内奶茶天花板

☕ 咖啡
   🏠 推荐: 瑞幸(三餐旁) / Timo(一餐旁) / 交佼(四餐旁)

🍞 面包糕点
   🏠 推荐: 思源面包(一餐旁)
   💬 理由: 新鲜出炉，下午茶好搭档
```

---

## ⚠️ 注意事项

1. **Canvas Token** 请妥善保管，切勿提交到公开仓库
2. **邮箱密码** 建议使用应用专用密码
3. **选课社区** 受 CDN 反爬限制，推荐通过浏览器代理调用
4. 部分数据为硬编码（食堂、教室等），如有变动请提 Issue
5. 校园巴士时刻表以学校最新通知为准

---

## 🤝 贡献

欢迎交大同学参与贡献！详见 [CONTRIBUTING.md](CONTRIBUTING.md)。

---

## 📜 License

[MIT License](LICENSE) © SJTU Students

## 🙏 致谢

- [OpenClaw](https://github.com/openclaw/openclaw) — AI 助手框架
- [SJTUG](https://mirror.sjtu.edu.cn) — 镜像服务
- [传承交大](https://share.dyweb.sjtu.cn) — 课程资源共享
- [SurviveSJTU](https://survivesjtu.gitbook.io) — 生存手册
- [SJTU 选课社区](https://course.sjtu.plus) — 课程评价平台
- 水源社区 — 灵感与信息来源

---

<div align="center">

**Made with ❤️ by 交大学子，for 交大学子**

</div>
````

## File: scripts/auth/__init__.py
size: 499
sha: 8f3218dfb46e285e2555af6a910d306de45893a5
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/auth/__init__.py

```text
"""统一认证 / cookie 持久化层。

模块：
  cookie_store  — 跨平台 cookie 加载/保存 (~/openclaw-sjtu/config.json)
  jaccount      — jAccount SSO 登录（Playwright + 三级验证码）

来源：参考 kuan-er/sjtu-agent 的 login.py 实现，适配本项目 config.json 结构。
"""

from .cookie_store import CookieStore  # noqa: F401
from .jaccount import JAccountLogin    # noqa: F401
from .chrome_cookies import import_from_browser as import_chrome_cookies  # noqa: F401
```

## File: scripts/auth/chrome_cookies.py
size: 6478
sha: d5a3008c27e1e37105b4e579b8941483f164ec4d
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/auth/chrome_cookies.py

```text
"""从系统 Chrome 本地数据库直接读取 SJTU 各平台 cookies。

加速路径：如果你已经在 Chrome 里完成过 jAccount 2FA 登录，
本模块可一次性把所有相关 cookies 读出来，跳过 Playwright 扫码流程。

来源参考：kuan-er/sjtu-agent setup_config.py 的 browser_cookie3 路径。

支持的浏览器：
  - Chrome（默认）
  - Edge
  - Brave
  - Chromium
  - Firefox / Safari（如果用户用这些）

依赖：pip install browser-cookie3

注意：读取需要 Chrome 处于运行或后台状态（不要完全退出，否则数据库锁文件可能阻塞）。
      Sequoia/macOS 14+ 可能要求 Chrome 至少打开一次再关闭。
"""

from __future__ import annotations

from typing import Iterable

try:
    import browser_cookie3 as bc3
    HAS_BC3 = True
except ImportError:
    HAS_BC3 = False

from .cookie_store import CookieStore

# 各平台 cookie 域名 + 关键 key（与 sjtu-agent 对齐 + 我们扩展的平台）
PLATFORMS: dict[str, dict] = {
    "jaccount": {
        "domain": "jaccount.sjtu.edu.cn",
        "keys": ["JATrustCookie", "JAAuthCookie", "JSESSIONID"],
        "cfg_key": "jaccount_cookies",
    },
    "i_sjtu": {
        "domain": "i.sjtu.edu.cn",
        "keys": ["JSESSIONID", "route"],
        "cfg_key": "i_sjtu_cookies",
    },
    "calendar": {
        "domain": "calendar.sjtu.edu.cn",
        "keys": ["JSESSIONID"],
        "cfg_key": "calendar_cookies",
    },
    "phycai": {
        "domain": "www.phycai.sjtu.edu.cn",
        "keys": ["ASP.NET_SessionId", ".PhyEwsProj",
                 "PhyEws_StuName", "PhyEws_StuType", ".ASPXAUTH"],
        "cfg_key": "phycai_cookies",
    },
    "lcme": {
        "domain": "lcme.sjtu.edu.cn",
        "keys": ["JSESSIONID", "keepalive"],
        "cfg_key": "lcme_cookies",
    },
    "icourse163": {
        "domain": "icourse163.org",
        "keys": ["NTESSTUDYSI", "STUDY_LIVE_LOGIN_INFO",
                 "ux", "p_h5_u", "videoStudyUrl"],
        "cfg_key": "icourse_cookies",
    },
}

# 浏览器加载器优先级（找到一个能用的就停）
_BROWSERS = [
    ("chrome",   lambda d: bc3.chrome(domain_name=d)),
    ("edge",     lambda d: bc3.edge(domain_name=d)),
    ("brave",    lambda d: bc3.brave(domain_name=d)),
    ("chromium", lambda d: bc3.chromium(domain_name=d)),
    ("firefox",  lambda d: bc3.firefox(domain_name=d)),
    ("safari",   lambda d: bc3.safari(domain_name=d)),
]

def _read_one(domain: str, browser: str | None = None) -> tuple[str | None, dict[str, str]]:
    """从浏览器读 cookies，返回 (使用的浏览器, cookies dict)。"""
    if not HAS_BC3:
        return None, {}
    candidates = _BROWSERS if not browser else [b for b in _BROWSERS if b[0] == browser]
    for name, loader in candidates:
        try:
            jar = loader(domain)
            cookies = {c.name: c.value for c in jar if c.value}
            if cookies:
                return name, cookies
        except Exception:
            continue
    return None, {}

def _filter(all_cookies: dict, wanted: list[str]) -> dict[str, str]:
    """优先返回 wanted 里指定的 key；如果都没有，退回全部（避免遗漏）。"""
    out = {k: all_cookies[k] for k in wanted if k in all_cookies and all_cookies[k]}
    return out if out else all_cookies

def import_from_browser(store: CookieStore | None = None,
                         browser: str | None = None,
                         platforms: Iterable[str] | None = None) -> dict[str, dict]:
    """一键从浏览器导入指定平台 cookies 到 config.json。

    Args:
        store     CookieStore 实例（默认全局）
        browser   指定浏览器（chrome/edge/brave/...）。None = 自动尝试
        platforms 要导入的平台 keys（None = 全部）

    Returns:
        {platform_name: cookies_dict} —— 实际成功导入的内容
    """
    if not HAS_BC3:
        print("[Chrome] 缺少 browser_cookie3。请安装：pip install browser-cookie3")
        return {}

    store = store or CookieStore()
    targets = list(platforms) if platforms else list(PLATFORMS.keys())
    cfg = store.load()
    imported: dict[str, dict] = {}

    for plat in targets:
        info = PLATFORMS.get(plat)
        if not info:
            continue
        used_browser, raw = _read_one(info["domain"], browser=browser)
        if not raw:
            print(f"  [Chrome] {info['domain']:<28} ✗ 未找到 cookie（请先在浏览器里登过）")
            continue
        filtered = _filter(raw, info["keys"])
        cfg[info["cfg_key"]] = filtered
        imported[plat] = filtered
        print(f"  [Chrome] {info['domain']:<28} ✓ {used_browser} → "
              f"{len(filtered)} 个 cookie：{list(filtered.keys())}")

    if imported:
        store.save(cfg)
        print(f"\n✅ 已写入 {store.path}")
    else:
        print("\n⚠ 未导入任何 cookie。可能原因：")
        print("  - 还没在浏览器里登过那些站点")
        print("  - 浏览器完全退出导致数据库锁不可读（启动一次再 Cmd+H 隐藏即可）")
        print("  - 系统未安装 Chrome/Edge/Firefox")

    return imported

# ── CLI ──────────────────────────────────────────────────────────────────────

def main():
    import argparse, json
    ap = argparse.ArgumentParser(
        description="从系统浏览器读取 SJTU 平台 cookies → config.json"
    )
    ap.add_argument("--browser", choices=["chrome", "edge", "brave", "chromium",
                                          "firefox", "safari"],
                    help="指定浏览器（默认按优先级自动尝试）")
    ap.add_argument("--only", nargs="*",
                    choices=list(PLATFORMS.keys()),
                    help="只导入指定平台")
    ap.add_argument("--list", action="store_true",
                    help="列出受支持的平台/域名")
    args = ap.parse_args()

    if args.list:
        print(json.dumps(
            {k: {"domain": v["domain"], "keys": v["keys"]}
             for k, v in PLATFORMS.items()},
            ensure_ascii=False, indent=2,
        ))
        return

    print("正在从浏览器本地数据库读取 cookies …\n")
    import_from_browser(browser=args.browser, platforms=args.only)

if __name__ == "__main__":
    main()
```

## File: scripts/auth/cookie_store.py
size: 6227
sha: f8ffc1b55bb7f00c5a441c9b2fe87eff1cf2bd41
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/auth/cookie_store.py

```text
"""统一 cookie 持久化（写入 ~/openclaw-sjtu/config.json）。

config.json 顶层 key 约定：
  jaccount_cookies     — *.sjtu.edu.cn 通用（OAuth 跳转后取得）
  phycai_cookies       — phycai.sjtu.edu.cn
  i_sjtu_cookies       — i.sjtu.edu.cn (新教务)
  calendar_cookies     — calendar.sjtu.edu.cn (校历)
  icourse_cookies      — icourse163.org (中国大学MOOC)
  canvas_token         — Canvas LMS Bearer Token（已存在）
  jaccount_username    — jAccount 用户名（用于自动登录）
  jaccount_password    — jAccount 密码（明文，仅本地 600 权限）
"""

from __future__ import annotations

import json
import os
import stat
from pathlib import Path
from typing import Iterable

CONFIG_PATH = Path.home() / "openclaw-sjtu" / "config.json"

# 域名 → config.json 中 cookie key 的映射
DOMAIN_TO_KEY: dict[str, str] = {
    "jaccount.sjtu.edu.cn":    "jaccount_cookies",
    "www.phycai.sjtu.edu.cn":  "phycai_cookies",
    "phycai.sjtu.edu.cn":      "phycai_cookies",
    "i.sjtu.edu.cn":           "i_sjtu_cookies",
    "calendar.sjtu.edu.cn":    "calendar_cookies",
    "lcme.sjtu.edu.cn":        "lcme_cookies",
    "www.icourse163.org":      "icourse_cookies",
    "icourse163.org":          "icourse_cookies",
}

class CookieStore:
    def __init__(self, path: Path = CONFIG_PATH):
        self.path = Path(path)

    # ── 读 ──────────────────────────────────────────────────────────────────
    def load(self) -> dict:
        if not self.path.exists():
            return {}
        try:
            return json.loads(self.path.read_text(encoding="utf-8"))
        except json.JSONDecodeError:
            return {}

    def get_cookies(self, key: str) -> dict[str, str]:
        cfg = self.load()
        cookies = cfg.get(key) or {}
        # 过滤掉占位值
        return {k: v for k, v in cookies.items() if not str(v).startswith("YOUR_")}

    # ── 写 ──────────────────────────────────────────────────────────────────
    def save(self, cfg: dict) -> None:
        """原子写入 config.json。

        含明文密码/cookies,所以:
          1) 写到同目录 .tmp(O_CREAT|O_WRONLY|O_TRUNC mode=0o600),保证从一开始
             就是 600 权限,杜绝 write→chmod 之间的 0644 窗口
          2) os.replace() 原子替换 —— 并发写不会损坏文件,中途崩溃也不会留下
             半写状态的 config.json
        """
        self.path.parent.mkdir(parents=True, exist_ok=True)
        tmp = self.path.with_suffix(self.path.suffix + ".tmp")
        fd = os.open(str(tmp), os.O_CREAT | os.O_WRONLY | os.O_TRUNC, 0o600)
        try:
            with os.fdopen(fd, "w", encoding="utf-8") as f:
                json.dump(cfg, f, ensure_ascii=False, indent=2)
        except Exception:
            try:
                tmp.unlink()
            except OSError:
                pass
            raise
        os.replace(tmp, self.path)
        # 防御性:某些文件系统 os.replace 不保留 source mode
        try:
            os.chmod(self.path, stat.S_IRUSR | stat.S_IWUSR)
        except OSError:
            pass

    def set_cookies(self, key: str, cookies: dict[str, str]) -> None:
        cfg = self.load()
        cfg[key] = cookies
        self.save(cfg)

    # ── 从 Playwright BrowserContext 收集 ───────────────────────────────────
    def collect_from_playwright(
        self, ctx, domains: Iterable[str] | None = None,
        *, merge: bool = True,
    ) -> list[str]:
        """从 Playwright 的 BrowserContext.cookies() 中按域名归集并写入 config.json。

        merge=True (默认) — 与已有 cookies 合并,新值覆盖旧同名,**不会**删除
                            已存在但 Playwright 本次没有的 cookies。
                            这是默认值的关键原因:一次失败的 Playwright 会话
                            可能只拿到 JSESSIONID,如果直接替换会把上一次
                            完整登录得到的 JATrustCookie / JAAuthCookie 丢掉,
                            害得下次必须重新走 2FA。
        merge=False — 整组替换(老行为)。仅在调用方确定本次 cookies 完整时用。

        Returns: 成功更新的 config key 列表。
        """
        targets = set(domains) if domains else set(DOMAIN_TO_KEY.keys())
        bucket: dict[str, dict[str, str]] = {}
        for c in ctx.cookies():
            domain = c["domain"].lstrip(".")
            for d, key in DOMAIN_TO_KEY.items():
                if d not in targets:
                    continue
                if domain == d or domain.endswith("." + d):
                    bucket.setdefault(key, {})[c["name"]] = c["value"]
                    break

        if not bucket:
            return []

        cfg = self.load()
        updated = []
        for key, cookies in bucket.items():
            if merge:
                existing = cfg.get(key) or {}
                cfg[key] = {**existing, **cookies}
            else:
                cfg[key] = cookies
            updated.append(key)
        self.save(cfg)
        return updated

    # ── jAccount 凭据 ───────────────────────────────────────────────────────
    def get_credentials(self) -> tuple[str | None, str | None]:
        cfg = self.load()
        u = cfg.get("jaccount_username") or os.environ.get("JACCOUNT_USERNAME") or None
        p = cfg.get("jaccount_password") or os.environ.get("JACCOUNT_PASSWORD") or None
        return (u.strip() if u else None, p.strip() if p else None)

    def set_credentials(self, username: str, password: str) -> None:
        cfg = self.load()
        cfg["jaccount_username"] = username
        cfg["jaccount_password"] = password
        self.save(cfg)
```

## File: scripts/auth/jaccount.py
size: 11828
sha: 29db47e5e99633413e7d4428756dd945790b8e6f
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/auth/jaccount.py

```text
"""jAccount SSO 登录（Playwright + 三级验证码识别）。

来源参考：kuan-er/sjtu-agent/login.py。改造为面向对象 + 任意 entry_url。

用法：
  from scripts.auth import JAccountLogin, CookieStore
  login = JAccountLogin()
  with login.session() as ctx:
      ok = login.sso(ctx, entry_url="http://www.phycai.sjtu.edu.cn/pe/Jlogin.aspx",
                     success_url="**/phycai.sjtu.edu.cn/**")
      if ok:
          CookieStore().collect_from_playwright(ctx)

验证码识别优先级：
  1. 思源极客协会 ResNet API (geek.sjtu.edu.cn)
  2. Claude Haiku Vision API (需 ANTHROPIC_API_KEY)
  3. 手动打开图片输入
"""

from __future__ import annotations

import base64
import io
import os
import platform
import subprocess
import sys
import tempfile
from contextlib import contextmanager
from pathlib import Path
from typing import Iterator

import requests

try:
    from dotenv import load_dotenv
    load_dotenv()
except ImportError:
    pass

try:
    from playwright.sync_api import BrowserContext, Page, sync_playwright
    HAS_PLAYWRIGHT = True
except ImportError:
    HAS_PLAYWRIGHT = False

from .cookie_store import CookieStore

GEEK_CAPTCHA_API = "https://geek.sjtu.edu.cn/captcha-solver/"

# ── 验证码识别 ───────────────────────────────────────────────────────────────

def _png_to_jpeg(png_bytes: bytes) -> bytes:
    """缩到 110x40 JPEG —— 极客协会 captcha API 体积上限很紧。

    PIL 缺失时直接 raise:之前静默 fallback 到原 PNG(几十 KB)会让 API
    返回 413 PAYLOAD TOO LARGE,所有 jAccount 登录都失败,极难定位。
    """
    try:
        from PIL import Image  # type: ignore
    except ImportError as e:
        raise RuntimeError(
            "Pillow 未安装。验证码识别需要把截图缩成 ~700B JPEG。"
            "安装:pip install Pillow"
        ) from e
    img = Image.open(io.BytesIO(png_bytes)).convert("RGB").resize((110, 40))
    buf = io.BytesIO()
    img.save(buf, format="JPEG", quality=90)
    return buf.getvalue()

def solve_captcha_geek(img_bytes: bytes) -> str | None:
    try:
        jpeg = _png_to_jpeg(img_bytes)
    except RuntimeError as e:
        # PIL 缺失 —— 让用户看见,不要静默降级到肯定会 413 的路径
        print(f"  [CAPTCHA] {e}")
        return None
    try:
        r = requests.post(
            GEEK_CAPTCHA_API,
            files={"image": ("captcha.jpg", jpeg, "image/jpeg")},
            timeout=10,
        )
        r.raise_for_status()
        result = r.json().get("result", "").strip()
        return result if result else None
    except Exception as e:
        print(f"  [CAPTCHA] 极客协会 API 失败：{e}")
        return None

def solve_captcha_claude(img_bytes: bytes) -> str | None:
    try:
        import anthropic  # type: ignore
    except ImportError:
        return None
    if not os.environ.get("ANTHROPIC_API_KEY"):
        return None
    try:
        client = anthropic.Anthropic()
        b64 = base64.standard_b64encode(img_bytes).decode()
        msg = client.messages.create(
            model="claude-haiku-4-5-20251001",
            max_tokens=16,
            messages=[{"role": "user", "content": [
                {"type": "image",
                 "source": {"type": "base64", "media_type": "image/png", "data": b64}},
                {"type": "text",
                 "text": "这是一个登录验证码图片。请只输出图中的字符（通常是4个字母或数字），不要有任何其他文字。"},
            ]}],
        )
        return msg.content[0].text.strip()
    except Exception as e:
        print(f"  [CAPTCHA] Claude 识别失败：{e}")
        return None

def solve_captcha(img_bytes: bytes) -> str:
    code = solve_captcha_geek(img_bytes)
    if code:
        print(f"  [CAPTCHA] 极客协会识别：{code}")
        return code
    code = solve_captcha_claude(img_bytes)
    if code:
        print(f"  [CAPTCHA] Claude 识别：{code}")
        return code
    # 手动兜底 —— 仅 tty 下生效;非交互环境(launchd / 后台)直接返回空,
    # 让上层把"验证码错误"算作登录失败,而不是 EOFError 崩溃整个流程
    if not sys.stdin.isatty():
        print("  [CAPTCHA] 自动识别全失败 + 非 tty 环境,跳过手动输入",
              file=sys.stderr)
        return ""
    with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as f:
        f.write(img_bytes)
        tmp = f.name
    try:
        if platform.system() == "Darwin":
            subprocess.Popen(["open", tmp])
        elif platform.system() == "Windows":
            os.startfile(tmp)  # type: ignore
        else:
            subprocess.Popen(["xdg-open", tmp])
    except Exception:
        pass
    try:
        code = input(f"  [CAPTCHA] 自动识别失败，请手动输入（图片：{tmp}）：").strip()
    except EOFError:
        code = ""
    try:
        os.unlink(tmp)
    except Exception:
        pass
    return code

# ── jAccount 登录 ────────────────────────────────────────────────────────────

class JAccountLogin:
    """jAccount SSO 登录器。"""

    def __init__(self, store: CookieStore | None = None, headless: bool = True):
        self.store = store or CookieStore()
        self.headless = headless
        if not HAS_PLAYWRIGHT:
            raise RuntimeError(
                "Playwright 未安装。请：pip install playwright && playwright install chromium"
            )

    @contextmanager
    def session(self) -> Iterator["BrowserContext"]:
        """启动 Playwright，yield BrowserContext。退出时自动关闭。"""
        with sync_playwright() as pw:
            browser = pw.chromium.launch(headless=self.headless)
            ctx = browser.new_context(device_scale_factor=1)
            try:
                yield ctx
            finally:
                browser.close()

    def fill_form(self, page: "Page", username: str, password: str) -> bool:
        """在已跳转到 jAccount 登录页的 page 上填表单，最多 3 次验证码重试。

        成功（URL 离开 jaccount.sjtu.edu.cn）→ True
        """
        page.evaluate("if (typeof switchLoginType === 'function') switchLoginType('password')")
        page.wait_for_timeout(400)
        page.fill("#input-login-user", username)
        page.fill("#input-login-pass", password)

        for attempt in range(3):
            cap = page.locator("#captcha-img")
            if cap.count() and cap.is_visible():
                code = solve_captcha(cap.screenshot())
                page.fill("#input-login-captcha", code)
            page.click("#submit-password-button")
            try:
                page.wait_for_function(
                    "() => !location.href.includes('jaccount.sjtu.edu.cn') || "
                    "!!document.querySelector('.alert-danger, [class*=errorMsg]')",
                    timeout=12_000,
                )
            except Exception:
                pass
            if "jaccount.sjtu.edu.cn" not in page.url:
                return True
            print(f"  [jAccount] 第 {attempt + 1} 次验证码错误，刷新重试…")
            page.evaluate("if (typeof refreshCaptcha === 'function') refreshCaptcha()")
            page.wait_for_timeout(700)

        print("  [jAccount] 验证码 3 次失败，请检查账号密码")
        return False

    def sso(self, ctx: "BrowserContext", entry_url: str,
            success_url: str | None = None,
            username: str | None = None,
            password: str | None = None) -> bool:
        """通用 jAccount SSO 流程。

        entry_url     — 触发跳转到 jaccount 的入口 URL
        success_url   — 期望最终落地的 URL pattern (Playwright glob)
                        None = 只要离开 jaccount 即视为成功
        """
        if not username or not password:
            username, password = self.store.get_credentials()
        if not username or not password:
            print("[jAccount] 未配置凭据。请通过 CookieStore.set_credentials() 或 .env 提供。")
            return False

        page = ctx.new_page()
        try:
            page.goto(entry_url, wait_until="networkidle", timeout=25_000)
            if "jaccount.sjtu.edu.cn" not in page.url:
                # 已有有效 session
                if success_url:
                    try:
                        page.wait_for_url(success_url, timeout=8_000)
                    except Exception:
                        pass
                return True
            if not self.fill_form(page, username, password):
                return False
            if success_url:
                try:
                    page.wait_for_url(success_url, timeout=20_000)
                except Exception:
                    print(f"  [jAccount] 等待 {success_url} 超时，但 jaccount 已通过")
            page.wait_for_load_state("networkidle", timeout=10_000)
            return True
        except Exception as e:
            print(f"  [jAccount] SSO 失败：{e}")
            return False
        finally:
            page.close()

# ── CLI ──────────────────────────────────────────────────────────────────────

def main():
    import argparse
    p = argparse.ArgumentParser(description="刷新指定 SJTU 平台的 cookies")
    p.add_argument("--phycai", action="store_true", help="刷新 phycai cookies")
    p.add_argument("--i-sjtu", action="store_true", help="刷新 i.sjtu (教务) cookies")
    p.add_argument("--calendar", action="store_true", help="刷新 calendar (校历) cookies")
    p.add_argument("--all", action="store_true", help="刷新所有")
    p.add_argument("--save-creds", action="store_true",
                   help="把 .env 里的 JACCOUNT_USERNAME/PASSWORD 写入 config.json")
    args = p.parse_args()

    store = CookieStore()
    if args.save_creds:
        u = os.environ.get("JACCOUNT_USERNAME", "").strip()
        pw = os.environ.get("JACCOUNT_PASSWORD", "").strip()
        if not u or not pw:
            print("[错误] 请先设置 .env 中的 JACCOUNT_USERNAME / JACCOUNT_PASSWORD")
            sys.exit(1)
        store.set_credentials(u, pw)
        print(f"✓ 凭据已写入 {store.path}")
        return

    targets = []
    if args.all or args.phycai:
        targets.append(("phycai", "http://www.phycai.sjtu.edu.cn/pe/Jlogin.aspx",
                        "**/phycai.sjtu.edu.cn/**"))
    if args.all or args.i_sjtu:
        targets.append(("i.sjtu", "https://i.sjtu.edu.cn/xtgl/index_initMenu.html?jsdm=xs",
                        "**/i.sjtu.edu.cn/xtgl/**"))
    if args.all or args.calendar:
        targets.append(("calendar", "https://calendar.sjtu.edu.cn/",
                        "**/calendar.sjtu.edu.cn/**"))
    if not targets:
        p.print_help()
        return

    login = JAccountLogin(store=store, headless=True)
    with login.session() as ctx:
        for name, entry, success in targets:
            print(f"\n[*] 登录 {name}…")
            ok = login.sso(ctx, entry_url=entry, success_url=success)
            print(f"  {'✓' if ok else '✗'} {name}")
        print("\n[*] 收集 cookies…")
        updated = store.collect_from_playwright(ctx)
        for k in updated:
            print(f"  ✓ {k}")
        if not updated:
            print("  （未收集到任何 cookies）")

if __name__ == "__main__":
    main()
```

## File: scripts/auto_homework.py
size: 17965
sha: 742e76b072c83c61854dc86f8dc22cf6216ab93a
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/auto_homework.py

```text
#!/usr/bin/env python3
"""
全自动作业流水线 - Auto Homework Pipeline

功能：
1. 巡检所有课程的未提交作业
2. 下载相关课件，提取内容构建知识库
3. 提取作业要求（含题目图片识别）
4. 生成作业上下文（供 AI Agent 生成答案）
5. 支持提交作业

用法：
  python3 auto_homework.py scan                    # 扫描未提交作业
  python3 auto_homework.py context <course_id> <assignment_id>  # 生成作业上下文
  python3 auto_homework.py full <course_id> <assignment_id>     # 完整流水线
  python3 auto_homework.py watch                   # 持续监控模式（配合 cron）
"""

import os
import sys
import json
import re
import requests
from datetime import datetime, timezone, timedelta
from pathlib import Path
from html.parser import HTMLParser

# 添加当前目录到 path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from canvas_api import (
    list_courses, list_assignments, get_assignment, get_my_submission,
    list_course_files, download_file, headers, BASE_URL, get_token
)
from file_extractor import extract_file

TZ_SHANGHAI = timezone(timedelta(hours=8))
WORK_DIR = os.path.expanduser("~/Downloads/Canvas课件")
CONTEXT_DIR = os.path.expanduser("~/Downloads/Canvas作业上下文")

class HTMLTextExtractor(HTMLParser):
    """从 HTML 中提取纯文本和图片 URL"""
    def __init__(self):
        super().__init__()
        self.text_parts = []
        self.image_urls = []
        self._in_tag = None

    def handle_starttag(self, tag, attrs):
        attrs_dict = dict(attrs)
        if tag == 'img' and 'src' in attrs_dict:
            self.image_urls.append(attrs_dict['src'])
            alt = attrs_dict.get('alt', '')
            if alt:
                self.text_parts.append(f"[图片: {alt}]")
            else:
                self.text_parts.append(f"[图片: {attrs_dict['src']}]")
        elif tag == 'br':
            self.text_parts.append('\n')
        elif tag in ('p', 'div', 'li', 'h1', 'h2', 'h3', 'h4'):
            self.text_parts.append('\n')
        elif tag == 'a' and 'href' in attrs_dict:
            self._in_tag = ('a', attrs_dict['href'])

    def handle_endtag(self, tag):
        if tag in ('p', 'div', 'li', 'h1', 'h2', 'h3', 'h4'):
            self.text_parts.append('\n')
        if tag == 'a' and self._in_tag and self._in_tag[0] == 'a':
            self.text_parts.append(f" ({self._in_tag[1]})")
            self._in_tag = None

    def handle_data(self, data):
        self.text_parts.append(data)

    def get_text(self):
        return re.sub(r'\n{3,}', '\n\n', ''.join(self.text_parts).strip())

def parse_html_content(html_str):
    """解析作业描述 HTML，返回纯文本和图片列表"""
    if not html_str:
        return "", []
    parser = HTMLTextExtractor()
    parser.feed(html_str)
    return parser.get_text(), parser.image_urls

def download_image(url, save_dir, index=0):
    """下载作业描述中的图片"""
    try:
        # Canvas 内部链接需要认证
        h = headers() if 'canvas' in url.lower() or BASE_URL in url else {}
        r = requests.get(url, headers=h, stream=True, timeout=30)
        r.raise_for_status()

        # 推断扩展名
        content_type = r.headers.get('content-type', '')
        ext_map = {'image/png': '.png', 'image/jpeg': '.jpg', 'image/gif': '.gif', 'image/webp': '.webp'}
        ext = ext_map.get(content_type.split(';')[0].strip(), '.png')

        save_path = os.path.join(save_dir, f"题目图片_{index+1}{ext}")
        os.makedirs(save_dir, exist_ok=True)
        with open(save_path, 'wb') as f:
            for chunk in r.iter_content(8192):
                f.write(chunk)
        return save_path
    except Exception as e:
        return f"[下载失败: {e}]"

def scan_unsubmitted():
    """扫描所有课程的未提交作业"""
    now = datetime.now(TZ_SHANGHAI)
    courses = list_courses()
    unsubmitted = []

    for c in courses:
        course_name = c.get("name", "未知课程")
        course_id = c["id"]
        try:
            assignments = list_assignments(course_id)
        except Exception:
            continue

        for a in assignments:
            due = a.get("due_at")
            if not due:
                continue

            due_dt = datetime.fromisoformat(due.replace("Z", "+00:00")).astimezone(TZ_SHANGHAI)

            # 只看未来的作业
            if due_dt <= now:
                continue

            # 检查提交状态
            sub = a.get("submission", {})
            workflow = sub.get("workflow_state", "") if sub else ""
            if workflow in ["submitted", "graded"]:
                continue

            # 计算剩余时间
            remaining = due_dt - now
            hours_left = remaining.total_seconds() / 3600

            unsubmitted.append({
                "course": course_name,
                "course_id": course_id,
                "assignment": a["name"],
                "assignment_id": a["id"],
                "due_at": due,
                "due_local": due_dt.strftime("%Y-%m-%d %H:%M"),
                "hours_left": round(hours_left, 1),
                "points": a.get("points_possible"),
                "submission_types": a.get("submission_types", []),
                "has_description": bool(a.get("description")),
            })

    unsubmitted.sort(key=lambda x: x["hours_left"])
    return unsubmitted

def get_assignment_detail(course_id, assignment_id):
    """获取作业的完整详情，包括描述解析和图片"""
    a = get_assignment(course_id, assignment_id)
    desc_html = a.get("description", "") or ""
    desc_text, image_urls = parse_html_content(desc_html)

    return {
        "name": a["name"],
        "description_text": desc_text,
        "description_html": desc_html,
        "image_urls": image_urls,
        "due_at": a.get("due_at"),
        "points_possible": a.get("points_possible"),
        "submission_types": a.get("submission_types", []),
        "allowed_extensions": a.get("allowed_extensions", []),
        "lock_at": a.get("lock_at"),
        "unlock_at": a.get("unlock_at"),
    }

def find_relevant_files(course_id, assignment_name, max_files=10):
    """根据作业名称在课程文件中查找相关课件"""
    all_files = list_course_files(course_id)

    # 提取作业中的关键词
    keywords = re.findall(r'[一-鿿]+|[a-zA-Z]+', assignment_name.lower())

    scored_files = []
    for f in all_files:
        name = f.get("display_name", "").lower()
        ext = os.path.splitext(name)[1]
        if ext not in [".pptx", ".ppt", ".pdf", ".docx", ".doc"]:
            continue

        score = 0
        for kw in keywords:
            if kw in name:
                score += 2
        # PPT/PDF 优先
        if ext in [".pptx", ".ppt", ".pdf"]:
            score += 1
        # 较新的文件优先
        scored_files.append((score, f))

    scored_files.sort(key=lambda x: -x[0])
    return [f for _, f in scored_files[:max_files]]

def build_homework_context(course_id, assignment_id, download_courseware=True):
    """
    构建作业上下文 — 核心功能

    返回一个包含所有 AI 需要的信息的字典：
    - 作业要求（文本 + 图片路径）
    - 相关课件内容
    - 提交要求
    """
    # 1. 获取课程信息
    courses = list_courses()
    course = next((c for c in courses if c["id"] == course_id), None)
    course_name = course.get("name", "未知") if course else "未知"

    # 2. 获取作业详情
    detail = get_assignment_detail(course_id, assignment_id)

    # 3. 下载作业描述中的图片
    context_dir = os.path.join(CONTEXT_DIR, f"{course_name}_{detail['name']}")
    os.makedirs(context_dir, exist_ok=True)

    downloaded_images = []
    for i, img_url in enumerate(detail["image_urls"]):
        result = download_image(img_url, context_dir, i)
        downloaded_images.append(result)

    # 4. 查找并下载相关课件
    courseware_contents = []
    if download_courseware:
        relevant = find_relevant_files(course_id, detail["name"])
        courseware_dir = os.path.join(WORK_DIR, course_name)
        os.makedirs(courseware_dir, exist_ok=True)

        for f in relevant:
            fname = f.get("display_name", "")
            save_path = os.path.join(courseware_dir, fname)

            # 下载（如不存在）
            if not os.path.exists(save_path):
                try:
                    download_file(f["url"], save_path)
                except Exception as e:
                    courseware_contents.append({
                        "file": fname,
                        "content": f"[下载失败: {e}]",
                        "chars": 0,
                    })
                    continue

            # 提取内容
            try:
                content = extract_file(save_path)
                courseware_contents.append({
                    "file": fname,
                    "content": content[:20000],  # 截断过长的内容
                    "chars": len(content),
                    "path": save_path,
                })
            except Exception as e:
                courseware_contents.append({
                    "file": fname,
                    "content": f"[提取失败: {e}]",
                    "chars": 0,
                })

    # 5. 组装上下文
    context = {
        "course": course_name,
        "course_id": course_id,
        "assignment": detail["name"],
        "assignment_id": assignment_id,
        "due_at": detail["due_at"],
        "points": detail["points_possible"],
        "submission_types": detail["submission_types"],
        "allowed_extensions": detail["allowed_extensions"],
        "description": detail["description_text"],
        "description_images": downloaded_images,
        "courseware": courseware_contents,
        "context_dir": context_dir,
    }

    # 6. 保存上下文摘要
    summary_path = os.path.join(context_dir, "context_summary.json")
    summary = {k: v for k, v in context.items() if k != "courseware"}
    summary["courseware_files"] = [
        {"file": cw["file"], "chars": cw["chars"]} for cw in courseware_contents
    ]
    with open(summary_path, "w", encoding="utf-8") as f:
        json.dump(summary, f, ensure_ascii=False, indent=2)

    # 7. 生成 AI Prompt 文件
    prompt = generate_ai_prompt(context)
    prompt_path = os.path.join(context_dir, "ai_prompt.md")
    with open(prompt_path, "w", encoding="utf-8") as f:
        f.write(prompt)

    context["summary_path"] = summary_path
    context["prompt_path"] = prompt_path
    return context

def generate_ai_prompt(context):
    """生成给 AI 的作业解答提示"""
    lines = [
        f"# 作业解答请求",
        f"",
        f"## 基本信息",
        f"- **课程**: {context['course']}",
        f"- **作业**: {context['assignment']}",
        f"- **截止时间**: {context.get('due_at', '未知')}",
        f"- **满分**: {context.get('points', '未知')}",
        f"- **提交类型**: {', '.join(context.get('submission_types', []))}",
        f"- **允许格式**: {', '.join(context.get('allowed_extensions', [])) or '未限制'}",
        f"",
        f"## 作业要求",
        f"",
        context.get("description", "(无文字描述)"),
        f"",
    ]

    # 图片提示
    if context.get("description_images"):
        lines.append("### 题目图片")
        for img_path in context["description_images"]:
            if os.path.exists(str(img_path)):
                lines.append(f"- 📷 `{img_path}`（请用视觉模型识别题目内容）")
            else:
                lines.append(f"- ⚠️ {img_path}")
        lines.append("")

    # 课件参考
    if context.get("courseware"):
        lines.append("## 相关课件内容")
        lines.append("")
        for cw in context["courseware"]:
            lines.append(f"### 📄 {cw['file']}（{cw['chars']} 字符）")
            lines.append("")
            # 只放前 5000 字符到 prompt 中
            content = cw.get("content", "")
            if len(content) > 5000:
                lines.append(content[:5000])
                lines.append(f"\n... (已截断，完整内容 {cw['chars']} 字符)")
            else:
                lines.append(content)
            lines.append("")

    lines.extend([
        "## 解答要求",
        "",
        "1. 仔细分析题目要求，识别每一道小题",
        "2. 结合上方课件内容，找到对应的知识点和公式",
        "3. 给出完整的解题步骤和最终答案",
        "4. 如果有计算题，列出详细的计算过程",
        "5. 如果有简答题，给出结构化、有条理的回答",
        "6. 最终输出格式应适合直接提交（PDF 或 Word 格式）",
    ])

    return "\n".join(lines)

def check_new_assignments(state_file=None):
    """
    检查是否有新作业（与上次巡检对比）
    用于 cron / watch 模式
    """
    if state_file is None:
        state_file = os.path.join(
            os.path.dirname(os.path.abspath(__file__)),
            ".homework_state.json"
        )

    # 读取上次状态
    last_known = set()
    if os.path.exists(state_file):
        with open(state_file) as f:
            state = json.load(f)
            last_known = set(state.get("known_assignment_ids", []))

    # 扫描当前未提交
    current = scan_unsubmitted()
    current_ids = {f"{a['course_id']}_{a['assignment_id']}" for a in current}

    # 找出新增的
    new_ids = current_ids - last_known
    new_assignments = [a for a in current if f"{a['course_id']}_{a['assignment_id']}" in new_ids]

    # 保存状态
    with open(state_file, "w") as f:
        json.dump({
            "known_assignment_ids": list(current_ids),
            "last_check": datetime.now(TZ_SHANGHAI).isoformat(),
            "total_unsubmitted": len(current),
        }, f, indent=2)

    return {
        "new": new_assignments,
        "all_unsubmitted": current,
        "total_new": len(new_assignments),
        "total_unsubmitted": len(current),
    }

def get_urgent_assignments(hours=48):
    """获取紧急作业（指定小时内到期且未提交的）"""
    all_unsubmitted = scan_unsubmitted()
    return [a for a in all_unsubmitted if a["hours_left"] <= hours]

# ===== CLI =====
if __name__ == "__main__":
    cmd = sys.argv[1] if len(sys.argv) > 1 else "scan"

    if cmd == "scan":
        print("🔍 扫描未提交作业...\n")
        unsubmitted = scan_unsubmitted()
        if not unsubmitted:
            print("✅ 没有未提交的作业！")
        else:
            print(f"📋 共 {len(unsubmitted)} 项未提交:\n")
            for a in unsubmitted:
                urgency = "🔴" if a["hours_left"] < 24 else "🟡" if a["hours_left"] < 72 else "🟢"
                print(f"  {urgency} [{a['course']}] {a['assignment']}")
                print(f"     截止: {a['due_local']} (剩余 {a['hours_left']}h)")
                print(f"     分值: {a['points']} | 类型: {', '.join(a['submission_types'])}")
                print()

    elif cmd == "context":
        if len(sys.argv) < 4:
            print("用法: auto_homework.py context <course_id> <assignment_id>")
            sys.exit(1)
        cid = int(sys.argv[2])
        aid = int(sys.argv[3])
        print(f"📝 构建作业上下文 (course={cid}, assignment={aid})...\n")
        ctx = build_homework_context(cid, aid)
        print(f"✅ 上下文已生成:")
        print(f"   📄 AI Prompt: {ctx['prompt_path']}")
        print(f"   📊 摘要: {ctx['summary_path']}")
        print(f"   📷 图片: {len(ctx['description_images'])} 张")
        print(f"   📚 课件: {len(ctx['courseware'])} 份")

    elif cmd == "watch":
        print("👀 检查新作业...\n")
        result = check_new_assignments()
        if result["new"]:
            print(f"🆕 发现 {result['total_new']} 项新作业:")
            for a in result["new"]:
                print(f"  📌 [{a['course']}] {a['assignment']} → {a['due_local']}")
        else:
            print("没有新作业。")
        print(f"\n📊 当前共 {result['total_unsubmitted']} 项未提交")

    elif cmd == "urgent":
        hours = int(sys.argv[2]) if len(sys.argv) > 2 else 48
        print(f"🚨 {hours} 小时内到期的紧急作业:\n")
        urgent = get_urgent_assignments(hours)
        if not urgent:
            print("✅ 没有紧急作业！")
        else:
            for a in urgent:
                print(f"  🔴 [{a['course']}] {a['assignment']}")
                print(f"     剩余 {a['hours_left']} 小时 → {a['due_local']}")
                print()

    elif cmd == "full":
        if len(sys.argv) < 4:
            print("用法: auto_homework.py full <course_id> <assignment_id>")
            sys.exit(1)
        cid = int(sys.argv[2])
        aid = int(sys.argv[3])
        print(f"🚀 完整作业流水线 (course={cid}, assignment={aid})...\n")
        ctx = build_homework_context(cid, aid)
        print(f"\n✅ 作业上下文已准备完毕！")
        print(f"   📄 AI Prompt: {ctx['prompt_path']}")
        print(f"   📊 作业: {ctx['assignment']}")
        print(f"   📚 关联课件: {len(ctx['courseware'])} 份")
        print(f"\n💡 下一步: AI Agent 读取 prompt 文件生成解答，确认后调用 submit 提交。")

    else:
        print("用法:")
        print("  auto_homework.py scan                          # 扫描未提交作业")
        print("  auto_homework.py context <cid> <aid>           # 生成作业上下文")
        print("  auto_homework.py full <cid> <aid>              # 完整流水线")
        print("  auto_homework.py watch                         # 新作业检测")
        print("  auto_homework.py urgent [hours]                # 紧急作业")
```

## File: scripts/calendar_sync.py
size: 3561
sha: ccdbf42fa5ce1df871235726f879d9df1dc081fd
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/calendar_sync.py

```text
#!/usr/bin/env python3
"""DDL → Apple Calendar 同步工具"""

import subprocess
import sys
import json
from datetime import datetime, timezone, timedelta

TZ_SHANGHAI = timezone(timedelta(hours=8))
CALENDAR_NAME = "Canvas作业"

def ensure_calendar():
    """确保 Canvas作业 日历存在"""
    script = f'''
tell application "Calendar"
    set calNames to name of every calendar
    if calNames does not contain "{CALENDAR_NAME}" then
        make new calendar with properties {{name:"{CALENDAR_NAME}"}}
    end if
end tell
'''
    r = subprocess.run(["osascript", "-e", script], capture_output=True, text=True, timeout=30)
    return r.returncode == 0

def create_event(summary, due_dt, description=""):
    """在 Apple Calendar 创建事件"""
    script = f'''
tell application "Calendar"
    tell calendar "{CALENDAR_NAME}"
        set startDate to current date
        set year of startDate to {due_dt.year}
        set month of startDate to {due_dt.month}
        set day of startDate to {due_dt.day}
        set hours of startDate to {max(0, due_dt.hour - 1)}
        set minutes of startDate to 0
        set seconds of startDate to 0
        
        set endDate to current date
        set year of endDate to {due_dt.year}
        set month of endDate to {due_dt.month}
        set day of endDate to {due_dt.day}
        set hours of endDate to {due_dt.hour}
        set minutes of endDate to {due_dt.minute}
        set seconds of endDate to 0
        
        make new event with properties {{summary:"{summary}", start date:startDate, end date:endDate, description:"{description}"}}
    end tell
end tell
'''
    r = subprocess.run(["osascript", "-e", script], capture_output=True, text=True, timeout=30)
    return r.returncode == 0

def list_existing_events():
    """列出 Canvas作业 日历中的现有事件"""
    script = f'''
tell application "Calendar"
    tell calendar "{CALENDAR_NAME}"
        set eventList to {{}}
        repeat with e in events
            set end of eventList to summary of e
        end repeat
        return eventList
    end tell
end tell
'''
    r = subprocess.run(["osascript", "-e", script], capture_output=True, text=True, timeout=30)
    if r.returncode == 0:
        return [s.strip() for s in r.stdout.strip().split(",")]
    return []

def sync_ddls(ddls):
    """同步 DDL 列表到 Apple Calendar（跳过已存在的）"""
    # 启动日历
    subprocess.run(["open", "-a", "Calendar"], capture_output=True)
    import time; time.sleep(2)
    
    ensure_calendar()
    existing = list_existing_events()
    
    synced = 0
    skipped = 0
    for d in ddls:
        summary = f"📝 [{d['course']}] {d['assignment']}"
        if summary in existing:
            skipped += 1
            continue
        
        due_str = d["due_at"]
        due_dt = datetime.fromisoformat(due_str.replace("Z", "+00:00")).astimezone(TZ_SHANGHAI)
        desc = f"课程: {d['course']}\\n作业: {d['assignment']}\\nDDL: {d['due_local']}\\n满分: {d.get('points', '?')}"
        
        if create_event(summary, due_dt, desc):
            print(f"✅ {summary} → {d['due_local']}")
            synced += 1
        else:
            print(f"❌ {summary}")
    
    print(f"\n同步完成: {synced} 新增, {skipped} 已存在")
    return synced

if __name__ == "__main__":
    from canvas_api import get_all_upcoming_ddls
    ddls = get_all_upcoming_ddls()
    if not ddls:
        print("没有未来的DDL")
    else:
        print(f"找到 {len(ddls)} 个未来DDL:")
        sync_ddls(ddls)
```

## File: scripts/canvas_api.py
size: 15134
sha: 575a004d9af5f977b9ec904352f3212e36adab65
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/canvas_api.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/canvas_api.py

## File: scripts/compare_rerank.py
size: 1352
sha: aa5bc78f59825ecd0811de8da3ef33b3a1f36d99
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/compare_rerank.py

```text
#!/usr/bin/env python3
"""Compare retrieval quality with vs without BGE-Reranker-v2-m3 on the
hand-picked smoke queries that previously failed.
"""
import warnings, sys
warnings.filterwarnings("ignore")
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from run_eval import load_db, load_model, load_reranker, search

QUERIES = [
    "选课系统什么时候开放",
    "宿舍空调坏了找谁修",
    "夏天上海哪里好玩",
    "推荐一门简单好过的通识课",
    "实习面试紧张怎么办",
]

def show(label, hits):
    print(f"\n  [{label}]")
    for i, h in enumerate(hits, 1):
        rerank = f"  rerank={h['_rerank']:.3f}" if h['_rerank'] is not None else ""
        print(f"    [{i}] [{h['category']}] {h['topic_title'][:50]}  (dist={h['_distance']:.3f}{rerank})")
        print(f"        {h['text'][:120].replace(chr(10),' ')}...")

def main():
    table = load_db()
    print(f"Table rows: {table.count_rows():,}")
    embed = load_model()
    rer = load_reranker()
    for q in QUERIES:
        print("\n" + "=" * 70)
        print(f"Q: {q}")
        print("=" * 70)
        before = search(table, embed, q, k=3)
        after = search(table, embed, q, k=3, reranker=rer, oversample=30)
        show("VECTOR-ONLY", before)
        show("WITH RERANK", after)

if __name__ == "__main__":
    main()
```

## File: scripts/file_extractor.py
size: 4131
sha: 22b9ee1b5ebdb0b95a3536569395cfbcd14c0b7a
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/file_extractor.py

```text
#!/usr/bin/env python3
"""课件内容提取器 - PPT/PDF/DOCX → 纯文本/Markdown"""

import os
import sys
from pathlib import Path

def extract_pptx(file_path):
    """从 PPTX 提取文本内容"""
    from pptx import Presentation
    prs = Presentation(file_path)
    slides = []
    for i, slide in enumerate(prs.slides, 1):
        texts = []
        for shape in slide.shapes:
            if shape.has_text_frame:
                for para in shape.text_frame.paragraphs:
                    text = para.text.strip()
                    if text:
                        texts.append(text)
            if shape.has_table:
                table = shape.table
                for row in table.rows:
                    row_text = " | ".join(cell.text.strip() for cell in row.cells)
                    if row_text.strip(" |"):
                        texts.append(row_text)
        if texts:
            slides.append(f"## Slide {i}\n\n" + "\n".join(f"- {t}" for t in texts))
    return "\n\n".join(slides)

def extract_pdf(file_path):
    """从 PDF 提取文本内容"""
    import pdfplumber
    texts = []
    with pdfplumber.open(file_path) as pdf:
        for i, page in enumerate(pdf.pages, 1):
            text = page.extract_text()
            if text and text.strip():
                texts.append(f"## Page {i}\n\n{text.strip()}")
    return "\n\n".join(texts)

def extract_docx(file_path):
    """从 DOCX 提取文本内容"""
    try:
        from docx import Document
        doc = Document(file_path)
        texts = []
        for para in doc.paragraphs:
            if para.text.strip():
                texts.append(para.text.strip())
        return "\n\n".join(texts)
    except ImportError:
        return "[需要安装 python-docx: pip3 install python-docx]"

def extract_file(file_path):
    """根据文件类型自动提取文本"""
    ext = Path(file_path).suffix.lower()
    extractors = {
        ".pptx": extract_pptx,
        ".ppt": extract_pptx,
        ".pdf": extract_pdf,
        ".docx": extract_docx,
        ".txt": lambda f: open(f).read(),
        ".md": lambda f: open(f).read(),
    }
    extractor = extractors.get(ext)
    if not extractor:
        return f"[不支持的文件类型: {ext}]"
    try:
        return extractor(file_path)
    except Exception as e:
        return f"[提取失败: {e}]"

def extract_to_markdown(file_path, output_path=None):
    """提取文件内容并保存为 Markdown"""
    content = extract_file(file_path)
    fname = Path(file_path).stem
    md = f"# {fname}\n\n{content}"
    if output_path:
        os.makedirs(os.path.dirname(output_path), exist_ok=True)
        with open(output_path, "w", encoding="utf-8") as f:
            f.write(md)
    return md

def batch_extract(directory, output_dir=None, extensions=None):
    """批量提取目录下的所有课件"""
    if extensions is None:
        extensions = {".pptx", ".pdf", ".docx"}
    results = []
    for root, dirs, files in os.walk(directory):
        for fname in sorted(files):
            ext = Path(fname).suffix.lower()
            if ext not in extensions:
                continue
            fpath = os.path.join(root, fname)
            if output_dir:
                rel = os.path.relpath(fpath, directory)
                out_path = os.path.join(output_dir, Path(rel).with_suffix(".md"))
                md = extract_to_markdown(fpath, out_path)
                print(f"✅ {fname} → {out_path}")
            else:
                md = extract_file(fpath)
                print(f"✅ {fname} ({len(md)} chars)")
            results.append({"file": fname, "content": md})
    return results

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: file_extractor.py <file_or_dir> [output_dir]")
        sys.exit(1)
    
    target = sys.argv[1]
    output = sys.argv[2] if len(sys.argv) > 2 else None
    
    if os.path.isdir(target):
        batch_extract(target, output)
    else:
        content = extract_file(target)
        print(content[:2000])
        if len(content) > 2000:
            print(f"\n... (共 {len(content)} 字符)")
```

## File: scripts/generate_ppt.py
size: 19608
sha: aa342d1665c4ee2a0cfc83a4813df0846c39373f
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/generate_ppt.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/generate_ppt.py

## File: scripts/grading_assistant.py
size: 13237
sha: 4ff0680da8e56988aaa5c84707bff8dc4340a392
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/grading_assistant.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/grading_assistant.py

## File: scripts/handwrite_pdf.py
size: 7011
sha: 56fbb70072d6c320f083cc30b5e0132bc12f72e7
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/handwrite_pdf.py

```text
#!/usr/bin/env python3
"""
手写风格 PDF 生成器

将文本内容渲染为逼真的手写 PDF，支持：
- 中文手写字体渲染
- 随机字间距、行间距抖动
- 随机字体大小微调
- 随机倾斜角度
- 墨水深浅变化
- 支持数学公式（纯文本格式）
- 信纸/白纸背景

用法:
  python3 handwrite_pdf.py <input.txt> <output.pdf> [--style casual|neat|messy]
  python3 handwrite_pdf.py --text "要写的内容" <output.pdf>
"""

import os
import sys
import random
import math
from pathlib import Path

from PIL import Image, ImageDraw, ImageFont
from handright import Template, handwrite

# 字体路径（优先级: 自定义手写体 > 楷体 > 宋体）
FONT_CANDIDATES = [
    os.path.expanduser("~/.openclaw/workspace/skills/sjtu-canvas/fonts/MaokenYingBiKaiShu.ttf"),  # 猫啃硬笔楷书（最逼真）
    os.path.expanduser("~/.openclaw/workspace/skills/sjtu-canvas/fonts/ZCOOLKuaiLe-Regular.ttf"),  # 站酷快乐体（备选）
    "/System/Library/Fonts/Supplemental/Songti.ttc",
    "/System/Library/Fonts/STHeiti Medium.ttc",
]

def find_font():
    """找到可用的中文字体"""
    for path in FONT_CANDIDATES:
        if os.path.exists(path):
            try:
                ImageFont.truetype(path, 30, index=0)
                return path
            except:
                continue
    raise FileNotFoundError("找不到可用的中文字体")

def generate_handwrite_images(text, style="casual"):
    """
    使用 handright 生成手写风格图片

    style: casual(随意), neat(工整), messy(潦草)
    """
    font_path = find_font()

    # 不同风格的参数
    styles = {
        "neat": {
            "font_size": 40,
            "word_spacing": 3,
            "line_spacing": 72,
            "word_spacing_sigma": 1,
            "line_spacing_sigma": 2,
            "font_size_sigma": 0.5,
            "perturb_x_sigma": 1,
            "perturb_y_sigma": 1,
            "perturb_theta_sigma": 0.01,
        },
        "casual": {
            "font_size": 38,
            "word_spacing": 4,
            "line_spacing": 70,
            "word_spacing_sigma": 3,
            "line_spacing_sigma": 4,
            "font_size_sigma": 1,
            "perturb_x_sigma": 3,
            "perturb_y_sigma": 3,
            "perturb_theta_sigma": 0.03,
        },
        "messy": {
            "font_size": 36,
            "word_spacing": 5,
            "line_spacing": 68,
            "word_spacing_sigma": 5,
            "line_spacing_sigma": 6,
            "font_size_sigma": 2,
            "perturb_x_sigma": 5,
            "perturb_y_sigma": 5,
            "perturb_theta_sigma": 0.05,
        },
    }

    s = styles.get(style, styles["casual"])

    template = Template(
        background=Image.new("RGB", (2480, 3508), "white"),  # A4 300dpi
        font=ImageFont.truetype(font_path, size=s["font_size"], index=0),
        line_spacing=s["line_spacing"],
        word_spacing=s["word_spacing"],
        left_margin=200,
        top_margin=230,
        right_margin=200,
        bottom_margin=200,
        word_spacing_sigma=s["word_spacing_sigma"],
        line_spacing_sigma=s["line_spacing_sigma"],
        font_size_sigma=s["font_size_sigma"],
        perturb_x_sigma=s["perturb_x_sigma"],
        perturb_y_sigma=s["perturb_y_sigma"],
        perturb_theta_sigma=s["perturb_theta_sigma"],
    )

    images = handwrite(text, template)
    return list(images)

def add_paper_texture(image):
    """添加轻微的纸张纹理"""
    draw = ImageDraw.Draw(image)
    width, height = image.size

    # 随机添加几条淡淡的水平线（模拟横线纸）
    # 不加线 = 白纸效果
    return image

def add_ruled_lines(image, line_spacing=58, top_margin=230, left_margin=150, right_margin=150):
    """添加信纸横线"""
    draw = ImageDraw.Draw(image)
    width, height = image.size

    y = top_margin + line_spacing
    while y < height - 200:
        # 淡蓝色横线
        draw.line(
            [(left_margin, y), (width - right_margin, y)],
            fill=(200, 220, 240),
            width=1
        )
        y += line_spacing

    return image

def images_to_pdf(images, output_path, add_ruled=False):
    """将图片列表保存为 PDF"""
    if not images:
        raise ValueError("没有图片可保存")

    processed = []
    for img in images:
        if add_ruled:
            img = add_ruled_lines(img.copy())
        # 转为 RGB（确保兼容）
        if img.mode != "RGB":
            img = img.convert("RGB")
        processed.append(img)

    # 保存为 PDF
    os.makedirs(os.path.dirname(os.path.abspath(output_path)), exist_ok=True)
    if len(processed) == 1:
        processed[0].save(output_path, "PDF", resolution=300)
    else:
        processed[0].save(
            output_path, "PDF", resolution=300,
            save_all=True, append_images=processed[1:]
        )

    return output_path

def text_to_handwrite_pdf(text, output_path, style="casual", ruled=False):
    """
    一步到位：文本 → 手写风格 PDF

    参数:
        text: 要写的文本内容
        output_path: PDF 保存路径
        style: casual/neat/messy
        ruled: 是否添加信纸横线
    """
    print(f"📝 生成手写 PDF (风格: {style})...")

    # 预处理文本
    # 确保每行不太长（模拟手写换行）
    processed_lines = []
    for line in text.split("\n"):
        if not line.strip():
            processed_lines.append("")
            continue
        # 长行自动折行（约 28 个中文字符一行）
        while len(line) > 30:
            processed_lines.append(line[:30])
            line = line[30:]
        processed_lines.append(line)

    processed_text = "\n".join(processed_lines)

    images = generate_handwrite_images(processed_text, style)
    pdf_path = images_to_pdf(images, os.path.abspath(output_path), add_ruled=ruled)

    file_size = os.path.getsize(pdf_path)
    print(f"✅ 已生成: {pdf_path} ({len(images)} 页, {file_size/1024:.1f} KB)")
    return pdf_path

# ===== CLI =====
if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description="手写风格 PDF 生成器")
    parser.add_argument("input", nargs="?", help="输入文本文件路径")
    parser.add_argument("output", nargs="?", default="output.pdf", help="输出 PDF 路径")
    parser.add_argument("--text", "-t", help="直接传入文本内容")
    parser.add_argument("--style", "-s", choices=["casual", "neat", "messy"], default="casual", help="手写风格")
    parser.add_argument("--ruled", "-r", action="store_true", help="添加信纸横线")

    args = parser.parse_args()

    if args.text:
        text = args.text
    elif args.input:
        with open(args.input, "r", encoding="utf-8") as f:
            text = f.read()
    else:
        print("请提供输入文件或 --text 参数")
        sys.exit(1)

    text_to_handwrite_pdf(text, args.output, style=args.style, ruled=args.ruled)
```

## File: scripts/platforms/__init__.py
size: 483
sha: e0653de16128ac877752913d5e31912696db8055
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/__init__.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/__init__.py

## File: scripts/platforms/base.py
size: 1440
sha: 4b1e4e0462489d3d346db1590da115c50b371760
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/base.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/base.py

## File: scripts/platforms/calendar_sjtu.py
size: 8048
sha: ff243b133a78b14bcc2d264325e75f861d39f6bd
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/calendar_sjtu.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/calendar_sjtu.py

## File: scripts/platforms/i_sjtu.py
size: 8896
sha: 4c48a56bd199530743d8adbddcdfc227a01fa77c
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/i_sjtu.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/i_sjtu.py

## File: scripts/platforms/icourse163.py
size: 8676
sha: bf9e3751d5a206959283f1601931cc6c33801d5f
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/icourse163.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/icourse163.py

## File: scripts/platforms/lcme.py
size: 12800
sha: b2379e9c1a9697dd7c6cf6f261188c4c16fb460d
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/lcme.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/lcme.py

## File: scripts/platforms/phycai.py
size: 6215
sha: 5eb887753278f0f0c7ad767622f7e6b6e5bc08ce
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/phycai.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/platforms/phycai.py

## File: scripts/rag_eval.py
size: 13418
sha: f0a2ccc07d1341a5a84d7913a39ceac032907c2a
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/rag_eval.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/rag_eval.py

## File: scripts/regression_eval.py
size: 16076
sha: b34d2d594868435cf72a00dbd1139136c4b731a5
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/regression_eval.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/regression_eval.py

## File: scripts/requirements-dev.txt
size: 87
sha: 866bd210b0f89765089f129a02c664a7f7ea4db3
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/requirements-dev.txt

```text
# 开发/测试依赖。安装:pip install -r scripts/requirements-dev.txt
pytest>=8.0
```

## File: scripts/requirements-platforms.txt
size: 429
sha: 807489ddf04879b4b1bb139fba934967f02f9f30
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/requirements-platforms.txt

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/requirements-platforms.txt

## File: scripts/requirements-rag.txt
size: 340
sha: c9b42b7d27fe36c61964ce477ea2c167ae309cce
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/requirements-rag.txt

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/requirements-rag.txt

## File: scripts/run_eval.py
size: 10444
sha: 14219d850cd5521104ad9cfd6ebe39929b197b78
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/run_eval.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/run_eval.py

## File: scripts/save_sjtu_cookies.py
size: 5699
sha: 4ba773a523b5d6f96dd9698673d6bedf55512f02
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/save_sjtu_cookies.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/save_sjtu_cookies.py

## File: scripts/scheduler/__init__.py
size: 776
sha: 0785b044728455bab30adc1d39272931f7c3dbf8
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/scheduler/__init__.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/scheduler/__init__.py

## File: scripts/scheduler/launchd.py
size: 7200
sha: c8e12b089c01452b32d532dff8849583565bc918
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/scheduler/launchd.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/scheduler/launchd.py

## File: scripts/setup.py
size: 7957
sha: c2f1564dcb1df31ddfcbe6ecfaf0bc3f6be1c341
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/setup.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/setup.py

## File: scripts/shuiyuan_discourse.mjs
size: 79108
sha: 0cbf09b0d0b346352293d30eeff3c67580e1fbdf
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_discourse.mjs

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_discourse.mjs

## File: scripts/shuiyuan_discourse.py
size: 31697
sha: de99dba2291ea00ccf2cf181a440364544171ca3
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_discourse.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_discourse.py

## File: scripts/shuiyuan_ingest.py
size: 17173
sha: e41c7359e1ba83a3f028f687a3e5cdfb6fde37d6
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_ingest.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_ingest.py

## File: scripts/shuiyuan_public_whitelist.json
size: 268
sha: 69113b7c0cefeff2afab65a823e304d6db2fe73f
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_public_whitelist.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_public_whitelist.json

## File: scripts/shuiyuan_rag_http.py
size: 5898
sha: 0d0c382b3e10cce38d499750c6136d1234327dbd
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_rag_http.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_rag_http.py

## File: scripts/shuiyuan_rag_mcp.py
size: 17699
sha: 2eec30d5d994a6d0e0e0f00a32bbbbf2aad4cb10
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_rag_mcp.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_rag_mcp.py

## File: scripts/shuiyuan_scraper.py
size: 18641
sha: ba96f19c0a022e43303ff3437627425cd4a89b06
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_scraper.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/shuiyuan_scraper.py

## File: scripts/sjtu_canteen.py
size: 17076
sha: 83aee73aeb6f3613e5a17f37093d5491b0acd259
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_canteen.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_canteen.py

## File: scripts/sjtu_classroom.py
size: 12792
sha: 85d22226f6c9f3ff29939d31ea8cd2704bd2dd4e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_classroom.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_classroom.py

## File: scripts/sjtu_course_review.py
size: 13388
sha: e77043a80f4089f129271381c3677b3328954b09
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_course_review.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_course_review.py

## File: scripts/sjtu_crawler.py
size: 12359
sha: b9dfa1b06fdb73d8ab1cf51de2ecac50f14fd3aa
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_crawler.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_crawler.py

## File: scripts/sjtu_distill.py
size: 7731
sha: e13e6dbed133548863f95720b6f41940398ed0c9
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_distill.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_distill.py

## File: scripts/sjtu_info.py
size: 11312
sha: 414aefa8522fee459f74b12a4f63b97c4478db5b
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_info.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_info.py

## File: scripts/sjtu_legacy.py
size: 11446
sha: 3d9bfbae3889e4134992d5d14bba7a9d8d0cad6d
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_legacy.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_legacy.py

## File: scripts/sjtu_library.py
size: 10510
sha: 9e787d5011894bd46d097505b83d10e53e285059
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_library.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_library.py

## File: scripts/sjtu_mail.py
size: 10408
sha: 18e32e8abac39cc5d89cea4bb76efd9d0fa433d0
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_mail.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_mail.py

## File: scripts/sjtu_mirror.py
size: 10299
sha: 96d8ec2ffa0dbfec56d0577aae5325eec88df97e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_mirror.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_mirror.py

## File: scripts/sjtu_news.py
size: 7162
sha: 19da53a76a98d076763f86e29dc4778b741d0e90
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_news.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_news.py

## File: scripts/sjtu_oneshot.py
size: 25996
sha: 19b11c5b3e098f8cde6e4dc73cf42f0f44027227
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_oneshot.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_oneshot.py

## File: scripts/sjtu_software.py
size: 11609
sha: ccaafd8cc2efdf1feba1fd89953ec3e43e42992a
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_software.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_software.py

## File: scripts/sjtu_survive.py
size: 6083
sha: 9dff2f725c5ea41dd9abdb3ba197d6f57a5c02b0
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_survive.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_survive.py

## File: scripts/sjtu_timetable_ics.py
size: 14745
sha: fd19bff649c8998bbecc9b5d083b4318a93870c8
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_timetable_ics.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_timetable_ics.py

## File: scripts/sjtu_tools.py
size: 11642
sha: a93cb00bb2eda9f60ef44c1185819c038ec8e5eb
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_tools.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_tools.py

## File: scripts/sjtu_visual.py
size: 9697
sha: e2ce0766d2ba9ed8bec5c2d2239be9684673e171
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_visual.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtu_visual.py

## File: scripts/sjtudate.mjs
size: 8763
sha: 081bd16055deea38d21ce4d2081c2906c7c34944
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtudate.mjs

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/sjtudate.mjs

## File: scripts/survey_questions.json
size: 9476
sha: 400f4900686aad56e41770442d5deabaa6e34a72
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/survey_questions.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/survey_questions.json

## File: scripts/test_mcp_search.py
size: 1058
sha: a59ebffbcf62cbb6728ce7fa761a538b8fb85c9d
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/test_mcp_search.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/test_mcp_search.py

## File: scripts/unified_ddl.py
size: 7499
sha: 7ae5de74035318d8f7fd1d94b5db3d848ddebfb3
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/unified_ddl.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/scripts/unified_ddl.py

## File: .gitattributes
size: 85
sha: ad114b24ff9cadf6fdd9edc88b122e24aba3f7fb
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/.gitattributes

```text
*.pptx filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
```

## File: .gitignore
size: 956
sha: 6b3ce3c5fc3fd1042e5bb14b75c48633adc9931b
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/.gitignore

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/.gitignore

## File: config.example.json
size: 1719
sha: b28dffb09c3f852e5bb1e0881783a983d4b8d6f7
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/config.example.json

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/config.example.json

## File: CONTRIBUTING.md
size: 1314
sha: c7e30681eae1dc02df7e3c07920d5b15b982c080
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/CONTRIBUTING.md

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/CONTRIBUTING.md

## File: data/sjtu_sites.yaml
size: 7637
sha: d666a857b60a64b4923142481d54d660759f768e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/data/sjtu_sites.yaml

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/data/sjtu_sites.yaml

## File: fonts/handwrite.ttf
size: 131
sha: 5279a6b5ad6480c5081a813a35dd1020ce3253fd
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/handwrite.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/handwrite.ttf

## File: fonts/handwrite_cn.ttf
size: 131
sha: 5279a6b5ad6480c5081a813a35dd1020ce3253fd
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/handwrite_cn.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/handwrite_cn.ttf

## File: fonts/JasonHandwriting1.ttf
size: 131
sha: 96cc0eaff553bd6706ec22ed7bd4a5d7a8d59bc7
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/JasonHandwriting1.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/JasonHandwriting1.ttf

## File: fonts/LiuJianMaoCao-Regular.ttf
size: 127
sha: b84e1cb5c1b270ccf3a6ca8e6e816fa179f8d370
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LiuJianMaoCao-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LiuJianMaoCao-Regular.ttf

## File: fonts/LiuJianMaoCao.ttf
size: 132
sha: db32fc32796dfa6ed1e38d96f23b17ce3a84b477
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LiuJianMaoCao.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LiuJianMaoCao.ttf

## File: fonts/LongCang-Regular.ttf
size: 127
sha: b84e1cb5c1b270ccf3a6ca8e6e816fa179f8d370
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LongCang-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LongCang-Regular.ttf

## File: fonts/LongCang.ttf
size: 132
sha: 78b8c57a3c7e961b665e39b757c39fe6a6045be6
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LongCang.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/LongCang.ttf

## File: fonts/MaokenYingBiKaiShu.ttf
size: 132
sha: 243c6e28db8debc8e23ba29d6a4563cba0a66f1c
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/MaokenYingBiKaiShu.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/MaokenYingBiKaiShu.ttf

## File: fonts/MaShanZheng.ttf
size: 132
sha: e850e039c2beb2f8de490b433feeb085cc397315
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/MaShanZheng.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/MaShanZheng.ttf

## File: fonts/MuYaoSoftbrush.ttf
size: 131
sha: 76cd87ad76cdcf61542ecc289844b741e0a4c6cc
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/MuYaoSoftbrush.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/MuYaoSoftbrush.ttf

## File: fonts/ZCOOLKuaiLe-Regular.ttf
size: 132
sha: 1ae9a5df8627d47bc7f1c91a4026d7b8617b449e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/ZCOOLKuaiLe-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/ZCOOLKuaiLe-Regular.ttf

## File: fonts/ZhiMangXing-Regular.ttf
size: 127
sha: b84e1cb5c1b270ccf3a6ca8e6e816fa179f8d370
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/ZhiMangXing-Regular.ttf

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/fonts/ZhiMangXing-Regular.ttf

## File: LICENSE
size: 1070
sha: ab5691bf16e49aac96b8b26f8a0f87c7313c66fd
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/LICENSE

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/LICENSE

## File: skills/lobster-square/scripts/call.sh
size: 1165
sha: a476223a5f54886c66727a43c4d8416abe983a98
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/scripts/call.sh

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/scripts/call.sh

## File: skills/lobster-square/scripts/discover.sh
size: 942
sha: 430c458646e09862ee2984c159b8281f9bc7bba3
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/scripts/discover.sh

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/scripts/discover.sh

## File: skills/lobster-square/scripts/save_key.sh
size: 369
sha: 46e7b6758008ec8c107159f7ab66655cc6c83c2c
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/scripts/save_key.sh

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/lobster-square/scripts/save_key.sh

## File: skills/sjtu-date/scripts/sjtudate.mjs
size: 10483
sha: 380fa980b0dfad7e36a621d3e6e949fe381cfe84
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/sjtu-date/scripts/sjtudate.mjs

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/skills/sjtu-date/scripts/sjtudate.mjs

## File: templates/0.上海交通大学通用PPT模板.pptx
size: 133
sha: bdcb232a2c7e4252828bab48dfebc3adbe5703f5
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/0.%E4%B8%8A%E6%B5%B7%E4%BA%A4%E9%80%9A%E5%A4%A7%E5%AD%A6%E9%80%9A%E7%94%A8PPT%E6%A8%A1%E6%9D%BF.pptx

```text
version https://git-lfs.github.com/spec/v1
oid sha256:05f22a1d1a8b4886423a70b7a5cb3b934177b5abc295362f380617b0d5dc3c4f
size 25113956
```

## File: templates/1.百廿红-李一.pptx
size: 133
sha: 7fa19ae8aebf63214151061b4752d4863d3273e8
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/1.%E7%99%BE%E5%BB%BF%E7%BA%A2-%E6%9D%8E%E4%B8%80.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/1.%E7%99%BE%E5%BB%BF%E7%BA%A2-%E6%9D%8E%E4%B8%80.pptx

## File: templates/2.简单蓝（16：9）-沈小丹.pptx
size: 132
sha: d232a022add1ca3599d809b333006cfc1a331154
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2.%E7%AE%80%E5%8D%95%E8%93%9D%EF%BC%8816%EF%BC%9A9%EF%BC%89-%E6%B2%88%E5%B0%8F%E4%B8%B9.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2.%E7%AE%80%E5%8D%95%E8%93%9D%EF%BC%8816%EF%BC%9A9%EF%BC%89-%E6%B2%88%E5%B0%8F%E4%B8%B9.pptx

## File: templates/2.简单蓝（4：3）-沈小丹.pptx
size: 132
sha: 6c7078ab64d26dee6b9252b8b2deebb27a943afc
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2.%E7%AE%80%E5%8D%95%E8%93%9D%EF%BC%884%EF%BC%9A3%EF%BC%89-%E6%B2%88%E5%B0%8F%E4%B8%B9.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2.%E7%AE%80%E5%8D%95%E8%93%9D%EF%BC%884%EF%BC%9A3%EF%BC%89-%E6%B2%88%E5%B0%8F%E4%B8%B9.pptx

## File: templates/2023（暗夜奔驰，极速版）徐臻.pptx
size: 133
sha: 4bf843803a3d4514148c92310fa04266a02cad6e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2023%EF%BC%88%E6%9A%97%E5%A4%9C%E5%A5%94%E9%A9%B0%EF%BC%8C%E6%9E%81%E9%80%9F%E7%89%88%EF%BC%89%E5%BE%90%E8%87%BB.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2023%EF%BC%88%E6%9A%97%E5%A4%9C%E5%A5%94%E9%A9%B0%EF%BC%8C%E6%9E%81%E9%80%9F%E7%89%88%EF%BC%89%E5%BE%90%E8%87%BB.pptx

## File: templates/2023（赤霞银珠，极速版）徐臻.pptx
size: 132
sha: 99e889c1a41e8dd9eb1ce2377c8cb8e3c1c35e97
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2023%EF%BC%88%E8%B5%A4%E9%9C%9E%E9%93%B6%E7%8F%A0%EF%BC%8C%E6%9E%81%E9%80%9F%E7%89%88%EF%BC%89%E5%BE%90%E8%87%BB.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2023%EF%BC%88%E8%B5%A4%E9%9C%9E%E9%93%B6%E7%8F%A0%EF%BC%8C%E6%9E%81%E9%80%9F%E7%89%88%EF%BC%89%E5%BE%90%E8%87%BB.pptx

## File: templates/2023（酒红醉人，极速版）徐臻.pptx
size: 133
sha: 2fe1b720abd100a0f5a9910e7a2f263ad5b4cfe8
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2023%EF%BC%88%E9%85%92%E7%BA%A2%E9%86%89%E4%BA%BA%EF%BC%8C%E6%9E%81%E9%80%9F%E7%89%88%EF%BC%89%E5%BE%90%E8%87%BB.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/2023%EF%BC%88%E9%85%92%E7%BA%A2%E9%86%89%E4%BA%BA%EF%BC%8C%E6%9E%81%E9%80%9F%E7%89%88%EF%BC%89%E5%BE%90%E8%87%BB.pptx

## File: templates/4.深海金芒-许歆瑶.pptx
size: 132
sha: 7c1083317de4ef22163aa6c560c7c5827591d298
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/4.%E6%B7%B1%E6%B5%B7%E9%87%91%E8%8A%92-%E8%AE%B8%E6%AD%86%E7%91%B6.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/4.%E6%B7%B1%E6%B5%B7%E9%87%91%E8%8A%92-%E8%AE%B8%E6%AD%86%E7%91%B6.pptx

## File: templates/5.浩瀚星河-迮佳.pptx
size: 133
sha: 5ee8eef99454b3b1513d918db1e637a7a1621e2e
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/5.%E6%B5%A9%E7%80%9A%E6%98%9F%E6%B2%B3-%E8%BF%AE%E4%BD%B3.pptx

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/templates/5.%E6%B5%A9%E7%80%9A%E6%98%9F%E6%B2%B3-%E8%BF%AE%E4%BD%B3.pptx

## File: tests/__init__.py
size: 0
sha: e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/__init__.py

```text

```

## File: tests/conftest.py
size: 425
sha: 2b9701cf6ce995798ece78c05bc4bf0c4847b7cb
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/conftest.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/conftest.py

## File: tests/test_cookie_store.py
size: 6524
sha: 82742644fb02ce1acca3f382089782a7abf66aa2
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/test_cookie_store.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/test_cookie_store.py

## File: tests/test_distill_extract_json.py
size: 2235
sha: 0f9ce5d1e4d46ca482edf30f4cf644b02e3661c5
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/test_distill_extract_json.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/test_distill_extract_json.py

## File: tests/test_platform_parsers.py
size: 5231
sha: 6480dbfdc6a28e2dd7efce5a2166b24095dd86b7
upstream: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/test_platform_parsers.py

Content is not inlined in the catalog. Read the upstream file: https://github.com/xhh678876/openclaw-sjtu/blob/HEAD/tests/test_platform_parsers.py
