法院短信识别与文书下载 功能概述 处理法院短信的完整流程: 粘贴短信 → 解析内容 → 匹配案件 → 下载文书 → 归档保存 。 支持两种触发方式: 方式一:粘贴短信原文 方式二:直接发送送达链接 用户可能直接粘贴送达链接(非完整短信文本),此时跳过短信文本解析,直接从 URL 中提取 、 、 参数,进入第三步下载流程。 短信类型分类 | 类型 | 特征 | 含下载链接 | 处理方式 | | --- | --- | --- | --- | | 文书送达 | 含送达平台链接 + 案号 | 是 | 下载文书并归档到案件目录 | | 立案通知 | 含"已立案"等关键词 | 可能有 | 展示解析结果 | | 信息通知 | 无链接,纯信息 | 否 | 展示解析结果 | 支持的送达平台 : (全国)、 (广东)、 (集约送达)、 (湖北)、 (司法送达网)。同一平台可能使用不同域名(同构异域名),通过 URL 路径特征识别平台。详见 。 --- 工作流(四步) 第一步:输入解析 1. 读取 作为解析参考 2. 判断输入类型 : - 完整短信 :包含法院签名(如 )+ 正文 + 链接 → 完整解析流程 - 纯链接 :用户直接发送送达 URL(如 )→ 跳过短信文本解析,直接从 URL 提取参数,进入第三步下载。案号、当事人等信息在下载文书后从文书内容中提取。 3. 对用户粘贴的短信文本进行分析…

\\t' read -r name url; do\n curl -sL -o \"/tmp/court-sms-staging/${name}.pdf\" \"$url\"\ndone\n\n# 4. 验证下载结果\nls -lh /tmp/court-sms-staging/*.pdf\n```\n\n#### 方案二 — 无头浏览器(Playwright CLI)\n\n当方案一 API 不可用或链接过期时,用 Playwright CLI 无头模式打开页面,拦截网络请求获取下载链接。\n\n```bash\n# 需要先安装 playwright\nnpx playwright install chromium 2>/dev/null\n\n# 无头模式运行(脚本需自行编写,拦截 getWsListBySdbhNew API 响应)\nnode scripts/download_court_docs.mjs --url \"{短信链接}\" --output /tmp/court-sms-staging/\n```\n\n#### 方案三 — 交互式浏览器(Playwright MCP)\n\n当方案二不可用时(需要已配置 Playwright MCP):\n\n```text\n1. browser_navigate → 打开短信中的 zxfw URL\n2. 等待页面加载\n3. browser_evaluate → 直接调用 fetch API 获取文书列表\n4. browser_run_code → 下载 PDF 文件到 /tmp/court-sms-staging/\n```\n\n如 API 调用未成功,改用页面交互:\n\n```text\n1. browser_snapshot → 查看当前页面结构\n2. 找到文书列表或 PDF 预览区域\n3. 定位下载按钮(可能在 iframe 内)\n4. browser_click → 点击下载\n5. 等待下载完成,保存到临时目录\n```\n\n#### 湖北平台下载流程(`dzsd.hbfy.gov.cn`)\n\n湖北电子送达平台有两种链路,根据 URL 格式自动选择:\n\n**链路一:免账号模式**(URL 含 `/hb/msg=xxx`)\n\n1. 从 URL 提取 `msg` 参数值\n2. 尝试 HTTP API 直连:\n\n```bash\nmsg=\"从URL提取的msg值\"\nmkdir -p /tmp/court-sms-staging/\n\n# 查询文书信息\nresp=$(curl -s -X POST \"http://dzsd.hbfy.gov.cn/delimobile/tDeliSms/findSmsInfo?t=$(date +%s%3N)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Referer: http://dzsd.hbfy.gov.cn/deli-mobile-ui/\" \\\n -d \"{\\\"msg\\\":\\\"$msg\\\"}\")\n\n# 检查是否需要验证码(data.isNeedCaptcha == \"Y\")\n# 如需验证码或无可下载文书,降级到 Playwright MCP\n\n# 逐个下载文书\necho \"$resp\" | jq -r '.data.docList[] | \"\\(.docName)\\t\\(.downloadPath)\"' | while IFS=

法院短信识别与文书下载 功能概述 处理法院短信的完整流程: 粘贴短信 → 解析内容 → 匹配案件 → 下载文书 → 归档保存 。 支持两种触发方式: 方式一:粘贴短信原文 方式二:直接发送送达链接 用户可能直接粘贴送达链接(非完整短信文本),此时跳过短信文本解析,直接从 URL 中提取 、 、 参数,进入第三步下载流程。 短信类型分类 | 类型 | 特征 | 含下载链接 | 处理方式 | | --- | --- | --- | --- | | 文书送达 | 含送达平台链接 + 案号 | 是 | 下载文书并归档到案件目录 | | 立案通知 | 含"已立案"等关键词 | 可能有 | 展示解析结果 | | 信息通知 | 无链接,纯信息 | 否 | 展示解析结果 | 支持的送达平台 : (全国)、 (广东)、 (集约送达)、 (湖北)、 (司法送达网)。同一平台可能使用不同域名(同构异域名),通过 URL 路径特征识别平台。详见 。 --- 工作流(四步) 第一步:输入解析 1. 读取 作为解析参考 2. 判断输入类型 : - 完整短信 :包含法院签名(如 )+ 正文 + 链接 → 完整解析流程 - 纯链接 :用户直接发送送达 URL(如 )→ 跳过短信文本解析,直接从 URL 提取参数,进入第三步下载。案号、当事人等信息在下载文书后从文书内容中提取。 3. 对用户粘贴的短信文本进行分析…

\\t' read -r name path; do\n if [ -n \"$path\" ]; then\n curl -sL -o \"/tmp/court-sms-staging/${name}.pdf\" \"http://dzsd.hbfy.gov.cn/delimobile${path}\"\n fi\ndone\n```\n\n3. 如需验证码或 HTTP 失败,降级到 Playwright MCP(方案三)\n\n**链路二:账号模式**(URL 含 `/sfsddz`)\n\n1. 从短信正文提取凭证:\n - 账号:匹配 `账号\\s*(\\d{15,20})`\n - 默认密码:匹配 `默认密码[::]\\s*([0-9A-Za-z]+)`\n2. 需要浏览器自动化(Playwright MCP),登录页包含验证码\n3. 登录后遍历待签收/已签收/已过期文书列表,逐个下载\n\n> **提示**:湖北平台两种模式都可能遇到验证码。免账号模式优先尝试 HTTP API,账号模式建议引导用户手动打开链接或使用 Playwright MCP。\n\n#### 司法送达网下载流程(SFDW - `sfpt.cdfy12368.gov.cn`)\n\n司法送达网所有 POST 请求使用 TDHCryptoUtil 加密,无法通过 HTTP API 下载,只能使用纯 Playwright 流程。\n\n**广西实例**:`171.106.48.55:28083` 域名下的链接路由到同一 SFDW 平台,下载流程相同。\n\n**验证码获取**(两种方式,按优先级尝试):\n\n1. **手机尾号后6位**(优先):从案件分配信息中获取律师手机号,取后6位作为验证码输入\n2. **短信验证码**:从短信正文中提取,匹配 `验证码[::]\\s*(\\w{4,6})`\n\n**Playwright MCP 流程**:\n\n```text\n1. browser_navigate → 打开短信中的 SFDW 链接\n2. 等待页面自动重定向到 pc.html?tdhParams=xxx\n3. browser_snapshot → 查看验证码输入页面(input#checkCode)\n4. 输入验证码(优先手机尾号后6位,其次短信验证码)\n5. browser_evaluate → 调用 Vue app.checkYzm() 触发验证\n6. 验证通过后 browser_evaluate → 获取 app.$data.wsList(文书列表)\n7. 遍历 wsList,逐个调用 downloadFile(app, ws) 下载文书\n8. 保存到 /tmp/court-sms-staging/\n```\n\n> **提示**:如手机尾号验证失败,提示用户查看短信中的验证码并手动输入。wsList 每项包含 wjmc(文件名)、wjgs(格式)。\n\n#### 失败兜底\n\n当三级均失败时:\n\n```text\n⚠️ 自动下载失败,请手动访问以下链接下载:\n{原始链接}\n\n下载后请将文件放到对应案件目录中。\n\n我将为您创建待处理记录。\n```\n\n### 第四步:归档保存\n\n1. **确定目标目录**:根据当前项目环境自动判断,不询问用户\n - 扫描当前项目目录,匹配与案号或当事人相关的案件目录\n - 如找到匹配案件目录,优先查找法院文书子目录(如 `08*`、`法院送达`、`court` 等);如无子目录则直接归档到案件根目录\n - **如未找到匹配案件,自动在当前项目下新建**:`{案号} {当事人与案由}/`\n - 如目标目录不存在,自动创建\n2. **获取当前日期**:`date \"+%Y%m%d\"`\n3. **确定文书标题**:\n - 优先使用 API 返回的标题\n - 否则根据 `sms-patterns.json` 中的 `document_titles` 映射推断\n - 最后回退到原始文件名(去除扩展名),如仍无法确定则使用 `未知文书`\n4. **构建文件名**:`{title}({case_name})_{YYYYMMDD}收.pdf`\n - 示例:`受理通知书(张三与李四合同纠纷)_20260404收.pdf`\n - 清理非法字符:`\u003c > : \" | ? * \\ /`\n - 如同名文件已存在,追加 `_2` 后缀\n5. **移入目标目录**\n6. **写入内部记录**:保存本次处理的完整信息到 **skill 内部的 `archive/` 目录**(即 `.claude/skills/court-sms/archive/`),不是案件文件夹。格式详见 [`references/archive-format.md`](references/archive-format.md)\n7. **基础文书解析**:法院 PDF 通常带文字层,提取首页文本,快速识别文书类型和关键信息\n - **传票**:提取开庭时间、地点、法庭、案号,向用户高亮提醒\n - **通知书/告知书**:提取缴费期限、举证期限等关键日期\n - **起诉状/答辩状**:提取案由、当事人、诉讼请求概要\n - **判决书**:识别为一审判决书,记录文书类型,触发上诉期限计算(P1)\n - **其他文书**:展示文书标题和法院名称\n - 如一次下载多份文书,逐一解析,汇总为一份报告\n\n > 深度分析(如判决书解读、合同审查)不在此技能范围内,请使用专用分析技能处理。\n\n8. **上诉期限计算(P1)**:当识别到判决书/裁定书时自动计算\n - **适用条件**:文书类型为判决书/裁定书(包括一审判决书、民事判决书、裁定书等)\n - **不同案件类型的上诉期限**(详见 `sms-patterns.json` → `appeal_calculation`):\n | 案件类型 | 上诉期限 |\n |---------|---------|\n | 民事一审判决 | 送达后15天 |\n | 民事裁定 | 送达后10天 |\n | 行政判决 | 送达后15天 |\n | 刑事判决 | 送达后10天 |\n | 刑事裁定 | 送达后5天 |\n - **计算公式**:`上诉截止日期 = 送达日期 + 上诉期限天数`\n - **送达日期来源**:\n - 优先使用 zxfw API 响应的 `dt_cjsj` 字段(送达记录创建时间)\n - 次选使用短信接收时间 `received_at`\n - 无法确定时,展示\"送达时间待确认\"\n - **归档 JSON 字段**:写入 `document.appeal_deadline` 和 `document.appeal_days_remaining`\n\n9. **向用户汇报**:按 [`references/report-format.md`](references/report-format.md) 输出结构化报告\n - 先确认归档完成(案号、法院、当事人、案由、文件数、位置)\n - 列出所有已归档的文书清单\n - 如含传票,⚠️ 高亮提醒开庭时间、地点、审理程序\n - 如含判决书,⏰ 展示上诉期限信息\n - 如部分失败,列出失败文书和原始链接\n\n### 第五步:PDF 后处理(可选)\n\n> **不默认启用**。仅在检测到文件拆分时主动提示用户。\n\n归档完成后,扫描目标目录中的 PDF 文件,检测是否有同一文书被拆分为多个文件的情况。\n\n#### 读取用户偏好\n\n读取 `config/user-preferences.json` 获取用户的合并和重命名偏好。如文件不存在,使用默认值(参考 `config/user-preferences.example.json`)。\n\n关键偏好项:\n\n| 偏好 | 默认值 | 说明 |\n|------|--------|------|\n| `merge_strategy` | `per_evidence` | 合并策略:`per_evidence`(按编号分别合并)或 `unified`(统一合并) |\n| `merge_options.unified.bookmarks.enabled` | `true` | 统一合并时是否添加 PDF 书签 |\n| `rename.enabled` | `true` | 是否精简文件名 |\n\n#### 触发检测\n\n读取 `references/sms-patterns.json` → `post_processing.trigger` 配置,按以下规则分组:\n\n```text\n分组规则:\n1. 证据类:文件名以\"证据\"开头 → 按编号分组(证据1、证据2、证据3…)\n2. 其他文书:按文书类型分组(传票、起诉状、应诉通知书…)\n3. 如任一组内文件数 > 3(threshold),触发提示\n```\n\n**示例**:证据3 下有 10 个 PDF → 触发。\n\n#### 用户确认\n\n使用 AskUserQuestion 提示用户,列出检测到的拆分情况:\n\n```text\n检测到以下文书被拆分为多个 PDF:\n- 证据3:10 个文件\n- 证据5:4 个文件\n\n是否执行 PDF 后处理(合并 + 重命名)?\n → 是,合并所有\n → 让我选择(逐个确认)\n → 跳过\n```\n\n#### 执行后处理\n\n用户确认后,根据 `user-preferences.json` 中的 `merge_strategy` 执行:\n\n**策略一:per_evidence(默认)**\n\n按单个证据编号分别合并,每个证据独立保留:\n\n```text\n- 证据3 有 10 个拆分文件 → 合并为「证据3:打印截图.pdf」\n- 证据5 有 4 个拆分文件 → 合并为「证据5:电脑截图.pdf」\n- 未被拆分的证据(如证据1 只有 1 个文件)保持不动\n```\n\n**策略二:unified**\n\n将证据目录 + 所有证据合并为一个「原告证据.pdf」,并添加 PDF 书签:\n\n```text\n合并顺序:证据目录 → 证据1 → 证据2 → … → 证据N\n书签格式:\n 📑 证据目录\n 📑 证据1:仲裁申请书、不予受理通知书\n 📑 证据2:劳动合同、保密协议\n 📑 证据3:被告工资表\n 📑 证据4:泄露账号密码的电脑截图\n 📑 证据5:打印及拷贝资料的电脑截图\n 📑 证据6:删除电脑操作痕迹的截图\n```\n\n书签名称使用简洁版:证据编号 + 冒号 + 证据标题(去除当事人和日期后缀)。使用 pypdf 的 `add_outline_item` 添加书签。\n\n> 用户可随时修改 `user-preferences.json` 切换策略,无需改动 skill 本身。\n\n#### 页面尺寸标准化\n\n合并过程中同时标准化页面尺寸为 A4(210×297mm)。使用 pypdf 逐页处理:\n\n```python\nfrom pypdf import PdfReader, PdfWriter, Transformation\n\nA4_W = 595.27 # 210mm in points\nA4_H = 841.89 # 297mm in points\n\nfor page in reader.pages:\n pw, ph = float(page.mediabox.width), float(page.mediabox.height)\n is_landscape = pw > ph\n\n # 保持原始方向:纵向→A4纵向,横向→A4横向\n target_w = A4_H if is_landscape else A4_W\n target_h = A4_W if is_landscape else A4_H\n\n # 等比缩放并居中\n scale = min(target_w / pw, target_h / ph)\n offset_x = (target_w - pw * scale) / 2\n offset_y = (target_h - ph * scale) / 2\n\n new_page = writer.add_blank_page(width=target_w, height=target_h)\n page.add_transformation(Transformation().scale(scale).translate(offset_x, offset_y))\n new_page.merge_page(page)\n```\n\n**规则**:\n- 纵向页面 → A4 纵向(210×297mm)\n- 横向页面 → A4 横向(297×210mm),不强制旋转为纵向\n- 等比缩放、居中放置,不裁剪、不拉伸\n\n#### 精简文件名\n\n根据 `user-preferences.json` → `rename` 配置对所有文件统一重命名:\n\n```text\n去除规则(strip_patterns):\n- 去掉括号内的当事人信息:(张三与李四合同纠纷)\n- 去掉日期后缀:_20260405收\n- 去掉平台标记:(合并)、(自贸法庭)、(素)-\n\n特殊映射(special_mappings):\n- 起诉状(素)… → 起诉状(要素式).pdf\n- 开庭传票 → 传票.pdf\n```\n\n**重命名示例**:\n\n| 原始 | 重命名后 |\n|------|----------|\n| `传票(张三与李四合同纠纷)_20260405收.pdf` | `传票.pdf` |\n| `起诉状(合并).pdf` | `起诉状.pdf` |\n| `起诉状(素)-要素式起诉状(合并).pdf` | `起诉状(要素式).pdf` |\n| `应诉通知书(自贸法庭).pdf` | `应诉通知书.pdf` |\n| `E法桥平台使用告知书(xxx)_20260405收.pdf` | `E法桥平台使用告知书.pdf` |\n\n---\n\n## 内部归档格式\n\n每次处理完成后在 `archive/` 下创建 JSON 记录,格式详见 [`references/archive-format.md`](references/archive-format.md)。\n\n---\n\n## 常见法院短信格式参考\n\n### 文书送达短信\n\n```text\n【xx市人民法院】张三,您好!您有(2025)苏0981民初1234号案件文书送达,\n请点击链接查收:\nhttps://zxfw.court.gov.cn/zxfw/#/pagesAjkj/app/wssd/index?qdbh=DEMO1&sdbh=DEMO2&sdsin=DEMO3\n如非本人操作请联系法院。\n```\n\n### 立案通知短信\n\n```text\n【xx市xx区人民法院】您好,您提交的立案材料已审核通过。\n案号:(2025)京0105民初54321号\n请及时缴纳诉讼费用。\n```\n\n### 开庭提醒短信\n\n```text\n【xx市xx区人民法院】提醒:您有(2025)苏0508民初567号案件,\n定于2025年3月15日上午9:30在第3法庭开庭,请准时到庭。\n```\n\n### 湖北电子送达短信(免账号)\n\n```text\n【xx人民法院】您有案件文书待查收,请点击链接查收:\nhttp://dzsd.hbfy.gov.cn/hb/msg=XXXXXXX\n如有疑问请联系法院。\n```\n\n### 湖北电子送达短信(账号模式)\n\n```text\n【xx人民法院】您有(2025)鄂xxxx民初xxxx号案件文书送达。\n账号 420xxxxxxxxxxxxx\n默认密码:xxxxxx\n请登录 http://dzsd.hbfy.gov.cn/sfsddz 查收。\n```\n\n### 司法送达网短信\n\n```text\n【xx人民法院】您有(2025)川xxxx民初xxxx号案件文书送达。\n验证码:A1B2C3\n请点击链接查收:https://sfpt.cdfy12368.gov.cn/sfsdw//r/xxxxxxxxxxxx\n```\n\n---\n\n## 故障排除\n\n| 问题 | 解决方案 |\n| --- | --- |\n| 短信无法识别类型 | 展示原文,请用户确认类型后继续 |\n| 案号提取失败 | 手动输入案号 |\n| 当事人识别不准 | 提示用户确认/修正当事人列表 |\n| 无匹配案件 | 提供三个选项:选已有/新建/暂存 |\n| Playwright 下载超时 | 检查网络连接,尝试刷新页面重试 |\n| 页面需要验证码 | 通知用户,暂停等待手动处理 |\n| 下载文件损坏 | 清理临时目录,重新尝试下载 |\n| 目标目录不存在 | 自动创建对应目录 |\n| SFDW 验证码验证失败 | 尝试手机尾号后6位和短信验证码两种方式,均失败时提示用户联系法院 |\n\n---\n\n## 配置\n\n无额外配置需求。解析规则参考 `references/sms-patterns.json`。\n\n如需修改解析规则(添加新文书标题、调整正则等),编辑该 JSON 文件即可。\n\n---\n\n## 🔄 变更历史\n\n完整变更日志见 [CHANGELOG.md](CHANGELOG.md)。归属声明见 [references/ATTRIBUTION.md](references/ATTRIBUTION.md)。\n---","attachment_filenames":["CHANGELOG.md","config/user-preferences.example.json","references/archive-format.md","references/ATTRIBUTION.md","references/report-format.md","references/sms-patterns.json"],"attachments":[{"filename":"CHANGELOG.md","content":"# 变更日志\n\n本项目的所有重要变更都将记录在此文件。\n\n## [1.5.0] - 2026-04-15\n\n### 新增\n\n- **司法送达网平台支持**:新增 `sfpt.cdfy12368.gov.cn`(司法送达网)的链接识别和文书下载\n - 纯 Playwright 下载流程:所有 POST 请求使用 TDHCryptoUtil 加密,无法通过 HTTP API 下载\n - 验证码双模式:优先手机尾号后6位(从案件分配中获取律师手机号),其次从短信正文提取验证码(`验证码[::]\\s*(\\w{4,6})`)\n - 广西实例支持:`171.106.48.55:28083` 域名路由到同一 SFDW 平台\n - `sms-patterns.json` 新增 sfdw 平台配置段(含 verification、browser_flow 字段)\n- **同构异域名支持**:所有平台链接正则从硬编码域名改为通用主机匹配(`[^\\s/]+`),通过 URL 路径特征识别平台而非域名\n - zxfw: `https?://[^\\s/]+/zxfw/#/pagesAjkj/app/wssd/index?...`\n - gdems: `https?://[^\\s/]+/v3/dzsd/[a-zA-Z0-9]+`\n - jysd: `https?://[^\\s/]+/sd?key=[a-zA-Z0-9_\\-]+`\n - hbfy: `https?://[^\\s/]+/(?:hb/msg=[a-zA-Z0-9]+|sfsddz\\b)`\n - 新增 `canonical_domain` 字段保留已知主域名用于 API 调用\n- **平台支持扩展至 5 个**:全国法院统一送达(zxfw)、广东电子送达(gdems)、集约送达(jysd)、湖北电子送达(hbfy)、司法送达网(sfdw)\n- SKILL.md 新增 SFDW 下载流程说明(纯 Playwright + 验证码双模式 + 广西实例)\n- SKILL.md 新增 SFDW 短信格式示例\n\n### 改进\n\n- **文书重命名回退**:当文书标题无法识别时,优先使用原始文件名(去除扩展名),而非直接默认为\"未知文书\"\n- `sms-patterns.json` 新增 `rename_fallback` 顶层配置段\n\n### 引用\n\n- 上游参考:[FachuanHybridSystem][fachuan-repo] → `sfdw_scraper.py`(司法送达网纯 Playwright 下载逻辑)、`sms_parser_service.py`(同构异域名正则更新)、`jysd_scraper.py`(手机号验证策略参考)\n\n## [1.4.0] - 2026-04-10\n\n### 新增\n\n- **湖北电子送达平台支持**:新增 `dzsd.hbfy.gov.cn`(湖北法院)的链接识别和文书下载\n - 免账号模式:识别 `/hb/msg=xxx` 链接,支持 HTTP API 直连下载(`POST /delimobile/tDeliSms/findSmsInfo`),需验证码时降级到浏览器\n - 账号模式:识别 `/sfsddz` 入口链接,从短信正文提取账号(`账号\\s*(\\d{15,20})`)和默认密码(`默认密码[::]\\s*([0-9A-Za-z]+)`)\n - 新增 `sms-patterns.json` 中的 hbfy 平台配置段(含免账号/账号两种模式的 API 信息和凭证提取正则)\n- **平台支持扩展至 4 个**:全国法院统一送达(zxfw)、广东电子送达(gdems)、集约送达(jysd)、湖北电子送达(hbfy)\n- SKILL.md 新增湖北平台下载流程说明(免账号 HTTP API + 账号模式浏览器自动化)\n- SKILL.md 新增湖北短信格式示例(免账号模式和账号模式两种)\n\n### 引用\n\n- 上游参考:[FachuanHybridSystem][fachuan-repo] → `sms_parser_service.py`(短信解析新增 hbfy 正则)、`hbfy_scraper.py`(湖北平台完整下载逻辑)\n\n[fachuan-repo]: https://github.com/Lawyer-ray/FachuanHybridSystem\n\n### 新增\n\n- **送达时间检测(P0)**:从 zxfw API 响应的 `dt_cjsj` 字段提取送达记录创建时间,作为 sent_at 使用,无需从 PDF 解析\n- **上诉期限自动计算(P1)**:识别判决书/裁定书时,根据送达时间自动计算上诉截止日期\n - 民事一审判决:送达后15天\n - 民事裁定:送达后10天\n - 行政判决:送达后15天\n - 刑事判决:送达后10日\n - 刑事裁定:送达后5日\n- **归档 JSON 新增字段**:`document.type`、`document.sent_at`、`document.appeal_deadline`、`document.appeal_days_remaining`\n- **归档 JSON 完整保存 API 响应**:将 zxfw API 的完整响应(c_fymc、c_fybh、dt_cjsj、documents 数组)存入 `download.api_response`\n- **汇报格式新增**:上诉期限展示区块(第四部分),格式为 `⏰ 上诉期限提醒`\n- **sms-patterns.json 新增**:`sent_time_extraction`(送达时间提取规则)、`appeal_calculation`(上诉期限计算规则)\n\n### 引用\n\n对应 GitHub Issue:https://github.com/cat-xierluo/legal-skills/issues/10\n\n## [1.2.1] - 2026-04-05\n\n### 新增\n\n- 两种合并策略可切换:`per_evidence`(按编号分别合并,默认)和 `unified`(统一合并为原告证据.pdf + PDF 书签)\n- 页面尺寸标准化:合并 PDF 时自动将所有页面统一为 A4,保持原始方向(纵向→A4 纵向,横向→A4 横向),等比缩放居中放置\n- PDF 书签:unified 策略下自动添加书签,格式为「证据N:标题」,支持点击跳转\n- 重命名规则:精简文件名,去除括号内当事人信息、日期后缀、平台标记等冗余内容\n\n## [1.2.0] - 2026-04-05\n\n### 新增\n\n- PDF 后处理功能(第五步,可选):归档完成后自动检测拆分文件,提示用户是否合并 + 重命名\n- 触发条件:扫描归档目录,按文书类型分组,任一组文件数 > 3 时弹出提示\n- 用户偏好系统:新增 `config/user-preferences.json`(含 `config/user-preferences.example.json` 模板),支持自定义合并策略和重命名规则\n- 偏好文件按项目约定放入 `config/` 目录(`.example` 入 git,实际配置被 gitignore 忽略),与 `clawhub-sync` 等 skill 保持一致\n- `references/sms-patterns.json` 新增 `post_processing` 配置段(触发阈值、偏好文件路径指向 `config/`)\n- 用户确认交互:AskUserQuestion 三选一(合并所有 / 逐个选择 / 跳过)\n\n## [1.1.2] - 2026-04-05\n\n### 新增\n\n- 归档汇报格式拆分到 `references/report-format.md`:三段式结构(归档确认 → 文书清单 → 传票特别提醒),SKILL.md 只保留引用\n- 当事人提取优先级明确:文书内容(起诉状/传票)> API 返回 > 短信文本;短信中的称呼仅为接收人,不作为当事人\n\n### 改进\n\n- 归档目录策略改为自动创建:未找到匹配案件时直接在当前项目下新建 `{案号} {当事人与案由}/08 - 🏛️ 法院送达/`,不再询问用户\n- 传票提醒在汇报末尾以 ⚠️ 高亮,包含开庭时间(追加星期几)、地点、审理程序\n\n## [1.1.1] - 2026-04-05\n\n### 改进\n\n- 基础文书解析:下载后提取 PDF 首页文本,快速识别传票(开庭时间/地点)、通知书(缴费期限)、起诉状(案由/当事人)等关键信息并告知用户\n- 归档格式拆分到 `references/archive-format.md`,SKILL.md 只保留引用\n- 收紧功能描述至实际范围:移除案件信息更新、复杂案件匹配、日程提醒等未实现功能\n- frontmatter description 去除 Playwright 硆名实现细节\n- CHANGELOG 措辞修正:去除\"Claude NLP\"和\"替代正则解析\"的说法,正则规则仍在 `sms-patterns.json` 中配合使用\n- 新增 Playwright 安装指引(CLI 和 MCP 两种方式)\n- 短信类型分类表简化,仅保留展示解析结果\n\n## [1.1.0] - 2026-04-04\n\n### 改进\n\n- 下载策略改为三层回退:curl API 直连(优先)→ Playwright CLI → Playwright MCP\n- 实测确认 zxfw 后端 API(`getWsListBySdbhNew`)可无头调用,无需浏览器即可下载全部文书\n- 将 API 端点、请求格式、响应字段写入 `references/sms-patterns.json`,后续同类型短信直接走 curl\n- 去除 SKILL.md 中\"执行者\"写法,保持 agent 无关性\n- frontmatter 规范化:description 改为第三人称,新增 license 字段(MIT),去除关键词堆砌\n- 触发方式从独立章节合并到功能概述,用示例替代关键词列表\n- 归档机制从 Markdown 改为结构化 JSON(`archive/YYYYMMDD_HHMMSS_{案号后4位}.json`),记录短信原文、解析结果、下载参数、归档路径\n- 目录结构规范化:`config/sms-patterns.json` 移入 `references/`,新增 `archive/.gitkeep`\n- 补充 CHANGELOG 1.0.0 的设计缘由和思路演进\n- 新增 LICENSE.txt(MIT)\n\n### 新增\n\n- 多平台送达链接支持:除 zxfw 外,新增 `sd.gdems.com`(广东电子送达)和 `jysd.10102368.com`(集约送达)的链接识别\n- 平台分级下载策略:zxfw 走 curl API 直连,gdems/jysd 无公开 API,直接回退到浏览器自动化\n- `sms-patterns.json` 新增 `download_strategy` 字段,区分 `api_first`(有 API)和 `browser_only`(需浏览器)\n- 基础文书解析:下载后提取 PDF 首页文本,快速识别传票(开庭时间/地点)、通知书(缴费期限)、起诉状(案由/当事人)等关键信息\n- 归档格式拆分到 `references/archive-format.md`,SKILL.md 只保留引用\n- 收紧功能描述至实际范围:移除案件信息更新、复杂案件匹配等未实现功能\n\n## [1.0.0] - 2026-04-04\n\n### 设计缘由\n\n- 律师日常频繁收到法院送达短信(传票、通知书等),需要手动从全国法院送达平台下载文书并归档到案件目录\n- 手动操作流程繁琐:复制链接 → 打开网页 → 下载 PDF → 重命名 → 移入目录 → 更新案件记录\n- 参考 FachuanHybridSystem 的短信解析设计思路,将其核心逻辑转化为 Skill 格式,结合 agent 的自然语言理解能力与结构化正则规则(`references/sms-patterns.json`)进行短信解析\n\n### 思路演进\n\n1. 调研阶段:发现 FachuanHybridSystem 已实现短信解析 → 下载 → 归档的完整流水线\n2. 适配阶段:将 Python/Django 服务架构映射为 Skill 工作流(agent 自然语言理解 + 结构化规则),无需部署额外服务\n3. 当前阶段:以 JSON 配置参考文件替代硬编码规则,保持技能的可维护性和可扩展性\n\n### 新增\n\n- 法院短信智能分类(文书送达 / 信息通知 / 立案通知)\n- 案号自动提取,支持多种标准格式(圆括号、方括号、六角括号)\n- 当事人名称提取(公司名、诉讼对峙模式、角色前缀)\n- 从 zxfw.court.gov.cn 链接中提取下载参数(qdbh、sdbh、sdsin)\n- 三级案件匹配策略(案号精确 → 当事人双向 → 特征筛选)\n- Playwright 两级回退下载(API 拦截 → 页面点击)\n- 文书自动重命名并归档到案件目录\n- 短信原文归档到 archive/\n- 解析规则可配置化(`references/sms-patterns.json`)\n\n### 致谢\n\n本技能参考了 [FachuanHybridSystem(法穿)](https://github.com/Lawyer-ray/FachuanHybridSystem) 中短信解析模块的设计思路和解析规则(非直接复制代码)。详见 [`references/ATTRIBUTION.md`](references/ATTRIBUTION.md)。\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":10607,"content_sha256":"b8e653e4afe108a45ca394af6a4a0f17eee92755183c3d8bb3e93e5159e6433e"},{"filename":"config/user-preferences.example.json","content":"{\n \"_doc\": \"用户偏好配置示例。复制为 user-preferences.json 后根据个人习惯修改。\",\n \"_usage\": \"court-sms skill 在第五步 PDF 后处理时读取此文件,获取用户的合并和重命名偏好。\",\n\n \"merge_strategy\": \"per_evidence\",\n\n \"merge_options\": {\n \"per_evidence\": {\n \"description\": \"按单个证据编号分别合并。证据3 有 10 个拆分 → 合并为一个证据3.pdf,其他证据不动\",\n \"naming\": \"保留原始证据文件名中的标题部分,如「证据3:打印截图.pdf」\"\n },\n \"unified\": {\n \"description\": \"将证据目录 + 所有证据合并为一个原告证据.pdf,并添加 PDF 书签方便跳转\",\n \"output_name\": \"原告证据.pdf\",\n \"bookmarks\": {\n \"enabled\": true,\n \"format\": \"简洁版:证据目录、证据1:仲裁申请书、证据2:劳动合同、…\",\n \"naming_rule\": \"书签名 = 证据编号 + 冒号 + 证据标题(去除当事人和日期后缀)\"\n }\n }\n },\n\n \"rename\": {\n \"enabled\": true,\n \"description\": \"精简文件名:去掉括号内当事人信息、日期后缀等冗余内容\",\n \"strip_patterns\": [\n \"([^)]+)\",\n \"_\\\\d{8}收\",\n \"(合并)\",\n \"(素)-\",\n \"(自贸法庭)\",\n \"(自贸)\"\n ],\n \"special_mappings\": {\n \"起诉状(素)\": \"起诉状(要素式)\",\n \"开庭传票\": \"传票\"\n }\n }\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":1439,"content_sha256":"f071bcd9dc8c5802c411726e6ca9a529158665192a517ba692da3026cec8127e"},{"filename":"references/archive-format.md","content":"# 内部归档格式\n\n每次处理一条短信后,在 `archive/` 下创建一条 JSON 记录,不保存文书本身(文书归档到案件目录)。\n\n## 文件路径\n\n`archive/YYYYMMDD_HHMMSS_{案号后4位}.json`\n\n## JSON 结构\n\n```json\n{\n \"id\": \"20260404_143025_1234\",\n \"timestamp\": \"2026-04-04T14:30:25+08:00\",\n \"sms_raw\": \"【xx市人民法院】张三,您好!您有(2025)苏0981民初1234号案件文书送达,请点击链接查收:https://zxfw.court.gov.cn/...\",\n \"parsed\": {\n \"type\": \"document_delivery\",\n \"case_number\": \"(2025)苏0981民初1234号\",\n \"parties\": [\"张三\", \"xx有限公司\"],\n \"court\": \"xx市人民法院\"\n },\n \"download\": {\n \"source_url\": \"https://zxfw.court.gov.cn/zxfw/#/pagesAjkj/app/wssd/index?qdbh=XX&sdbh=XX&sdsin=XX\",\n \"params\": { \"qdbh\": \"XX\", \"sdbh\": \"XX\", \"sdsin\": \"XX\" },\n \"method\": \"curl\",\n \"status\": \"success\",\n \"document_title\": \"受理通知书\",\n \"api_response\": {\n \"c_fymc\": \"苏州工业园区人民法院\",\n \"c_fybh\": \"1275\",\n \"dt_cjsj\": \"2026-03-18T07:44:00.000+00:00\",\n \"documents\": [\n {\n \"c_wsmc\": \"传票(东沙湖法庭)\",\n \"c_wsbh\": \"ecb8fe64e4834804b50ea0f9257327e0\",\n \"dt_cjsj\": \"2026-03-18T07:44:00.000+00:00\"\n }\n ]\n }\n },\n \"document\": {\n \"type\": \"一审判决书\",\n \"sent_at\": \"2026-04-08T10:00:00+08:00\",\n \"received_at\": \"2026-04-08T14:30:00+08:00\",\n \"appeal_deadline\": \"2026-04-23T23:59:59+08:00\",\n \"appeal_days_remaining\": 15\n },\n \"archive\": {\n \"matched_case\": \"260101 张三与李四合同纠纷\",\n \"target_path\": \"260101 张三与李四合同纠纷/受理通知书(张三与李四合同纠纷)_20260404收.pdf\",\n \"summary\": \"传票:2025年4月15日 14:30 第3法庭开庭\"\n }\n}\n```\n\n## 字段说明\n\n| 字段 | 必需 | 说明 |\n|------|------|------|\n| `id` | 是 | 归档唯一标识,即文件名(不含扩展名) |\n| `timestamp` | 是 | ISO 8601 格式的处理时间 |\n| `sms_raw` | 是 | 短信原文,完整保留 |\n| `parsed.type` | 是 | 短信类型:`document_delivery` / `filing_notification` / `info_notification` |\n| `parsed.case_number` | 否 | 提取到的案号,未提取到时为 `null` |\n| `parsed.parties` | 否 | 提取到的当事人列表 |\n| `parsed.court` | 否 | 提取到的法院名称 |\n| `parsed.sent_at` | 否 | 法院发送时间,从短信或送达平台提取 |\n| `parsed.received_at` | 否 | 用户收到时间(如有) |\n| `download.source_url` | 否 | 原始下载链接 |\n| `download.params` | 否 | 从 URL 提取的参数(如 qdbh/sdbh/sdsin) |\n| `download.method` | 否 | 实际使用的下载方式:`curl` / `cli` / `mcp` / `manual` / `null`(无下载链接) |\n| `download.status` | 是 | 下载状态:`success` / `failed` / `manual` / `skipped` |\n| `download.api_response` | 否 | API 完整响应,包含 c_fymc(法院名称)、c_fybh(法院编号)、dt_cjsj(送达时间)、documents 数组(每份文书详情) |\n| `download.api_response.c_fymc` | 否 | 法院名称(来自 API) |\n| `download.api_response.c_fybh` | 否 | 法院编号 |\n| `download.api_response.dt_cjsj` | 否 | 送达记录创建时间(ISO 8601),作为 sent_at 来源 |\n| `download.api_response.documents[].c_wsmc` | 否 | 文书名称 |\n| `download.api_response.documents[].c_wsbh` | 否 | 文书编号(UUID) |\n| `download.api_response.documents[].dt_cjsj` | 否 | 单份文书的送达时间 |\n| `document.type` | 否 | 文书类型:判决书/裁定书/调解书等(从 PDF 解析) |\n| `document.sent_at` | 否 | 法院发送时间(送达平台记录) |\n| `document.received_at` | 否 | 用户收到时间(手机短信网关时间) |\n| `document.appeal_deadline` | 否 | 上诉截止日期(根据案件类型计算) |\n| `document.appeal_days_remaining` | 否 | 剩余上诉天数 |\n| `archive.matched_case` | 否 | 匹配到的案件目录名 |\n| `archive.target_path` | 否 | 文书最终归档的相对路径 |\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":4028,"content_sha256":"ec5c4bdb764f452592a84f319c42545886719ae8126bdb7df95f9bf481d10607"},{"filename":"references/ATTRIBUTION.md","content":"# 归属声明与致谢\n\n## 参考项目\n\n本技能(court-sms)在开发过程中,使用 AI 参考了以下开源项目的思路和规则:\n\n### FachuanHybridSystem(法穿AI案件管理系统)\n\n- **项目地址**:https://github.com/Lawyer-ray/FachuanHybridSystem\n- **许可证**:PolyForm Noncommercial License 1.0.0 (附特别许可)\n- **版权所有**:(C) 2025-2099 法穿\n\n### 具体参考内容\n\n本技能参考了 FachuanHybridSystem 中以下模块的**设计思路和解析规则**(非直接复制代码):\n\n1. **短信解析服务** (`backend/apps/automation/services/sms/sms_parser_service.py`)\n - 短信类型分类逻辑(文书送达 / 信息通知 / 立案通知)\n - zxfw.court.gov.cn 下载链接正则匹配规则\n - 同构异域名正则更新(从硬编码域名改为通用主机匹配,通过 URL 路径特征识别平台)\n - 案号提取正则模式\n - 当事人名称提取策略(公司名模式、对峙模式、角色前缀模式)\n - 当事人排除关键词列表\n - 司法送达网(SFDW)链接正则和验证码提取规则\n\n2. **案件匹配算法** (`backend/apps/automation/services/sms/case_matcher.py`)\n - 三级匹配策略的设计思路(案号精确 → 当事人双向 → 特征筛选)\n\n3. **文书重命名逻辑** (`backend/apps/automation/services/sms/document_renamer.py`)\n - 已知文书标题映射表\n - 文件命名格式:`{title}({case_name})_{YYYYMMDD}收.pdf`\n\n4. **zxfw 下载策略** (`backend/apps/automation/services/scraper/scrapers/court_document/zxfw_scraper.py`)\n - 多级下载回退策略的架构设计\n - API 拦截与页面操作结合的思路\n\n5. **司法送达网下载策略** (`backend/apps/automation/services/scraper/scrapers/court_document/sfdw_scraper.py`)\n - 纯 Playwright 下载流程(TDHCryptoUtil 加密导致无法使用 HTTP API)\n - 验证码双模式策略:手机尾号后6位优先 + 短信验证码回退\n - Vue app.checkYzm() → wsList → downloadFile() 页面交互流程\n\n### 实现差异\n\n本技能并未直接复制 FachuanHybridSystem 的代码,而是将其核心逻辑重新实现为 Claude Code Skill 格式:\n\n- **原项目**:Python / Django 服务,使用 Ollama LLM + ddddocr + Playwright\n- **本技能**:Claude Code Skill,利用 Claude NLP 能力 + Playwright MCP\n- **无代码复用**:所有解析逻辑由 Claude 自然语言理解完成,配置规则以 JSON 参考\n\n### 致谢\n\n感谢法穿团队开源的法律科技实践成果,为社区提供了宝贵的设计参考。\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":2565,"content_sha256":"3a6bad28977cc3a6f8883ec8de3947c2291595e63d6c8fd8a6b402e8a35ac50f"},{"filename":"references/report-format.md","content":"# 归档汇报格式\n\n## 汇报结构\n\n汇报分四部分,按顺序输出:\n\n1. **归档完成** — 确认信息\n2. **文书清单** — 所有已归档文件\n3. **特别注意** — 仅当包含传票时显示开庭信息\n4. **上诉期限** — 仅当文书类型为一审判决书且能计算上诉期限时显示\n\n---\n\n## 模板\n\n```text\n✅ 文书归档完成:\n- 案号:(2025)苏0981民初1234号\n- 法院:xx市人民法院\n- 当事人:原告 xx有限公司 / 被告 张三\n- 案由:合同纠纷\n- 文件数:N 份\n- 归档位置:{案件目录}/\n\n文书清单:\n 1. 传票(东沙湖法庭) 传票\n 2. 应诉通知书 通知书\n 3. 起诉状 起诉状\n 4. 证据1:xxx 证据\n ...\n\n⚠️ 已收到传票,请注意:\n - 开庭时间:2025年4月15日(周二)14:30\n - 开庭地点:xx市人民法院 第3法庭\n - 审理程序:简易程序\n\n⏰ 上诉期限提醒:\n - 文书类型:一审判决书\n - 送达时间:2026年4月8日\n - 上诉截止:2026年4月23日(剩余15天)\n```\n\n---\n\n## 各部分规则\n\n### 1. 归档完成\n\n必填字段:\n\n| 字段 | 来源 |\n|------|------|\n| 案号 | 短信解析 或 文书提取 |\n| 法院 | 短信解析 或 API 返回 `c_fymc` |\n| 当事人 | 文书提取(起诉状/传票),非短信接收人 |\n| 案由 | 文书提取(起诉状/传票) |\n| 文件数 | 实际归档数量 |\n| 归档位置 | 相对路径 |\n\n> **当事人提取优先级**:文书内容 > API 返回 > 短信文本。短信中的姓名(如\"xx,您好\")仅为接收人,不作为案件当事人。\n\n### 2. 文书清单\n\n列出所有已归档文件,每行格式:\n\n```text\n{序号}. {文书名} {类型标签}\n```\n\n类型标签来自 `sms-patterns.json` → `document_titles` 映射,未匹配的标注为\"其他\"。\n\n### 3. 特别注意(仅传票)\n\n触发条件:文书清单中包含标题含\"传票\"的文件。\n\n从传票 PDF 首页文本提取以下字段(正则匹配):\n\n| 字段 | 提取方式 |\n|------|----------|\n| 开庭时间 | 匹配 `应到时间` 附近的日期时间 |\n| 开庭地点 | 匹配 `应到处所` 附近的文本 |\n| 审理程序 | 从应诉通知书中匹配\"小额诉讼/简易程序/普通程序\" |\n\n**日期格式化**:原始日期(如 `2026年05月07日 09:30`)应追加星期几,方便用户快速判断是否为工作日。\n\n**提醒语气**:使用 ⚠️ 标记,加粗关键日期时间,确保用户不会遗漏。\n\n### 4. 上诉期限(仅判决书/裁定书)\n\n触发条件:文书清单中包含\"判决书\"或\"裁定书\"且能提取到送达时间。\n\n**上诉期限计算规则**:\n\n| 案件类型 | 上诉期限 |\n|---------|---------|\n| 民事一审判决 | 送达后15天 |\n| 民事裁定 | 送达后10天 |\n| 行政判决 | 送达后15天 |\n| 刑事判决 | 送达后10天 |\n| 刑事裁定 | 送达后5天 |\n\n**日期格式化**:展示为 `X月X日` 格式,追加星期几。\n\n**剩余天数计算**:`截止日期 - 当前日期`\n\n---\n\n## 归档失败时的汇报\n\n```text\n⚠️ 文书归档部分完成:\n- 案号:(2025)苏0981民初1234号\n- 法院:xx市人民法院\n- 成功:N 份\n- 失败:N 份\n\n失败的文书:\n - xxx.pdf(原因:下载超时)\n\n请手动访问以下链接下载失败文书:\n{原始链接}\n```\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":3439,"content_sha256":"349ec67ac7c5faea4e0167215447cb6cf2741391022476a5d9e3b10342d1b2d6"},{"filename":"references/sms-patterns.json","content":"{\n \"download_link_patterns\": [\n {\n \"domain\": \"zxfw.court.gov.cn\",\n \"canonical_domain\": \"zxfw.court.gov.cn\",\n \"description\": \"全国法院统一送达平台(最常见)\",\n \"pattern\": \"https?://[^\\\\s/]+/zxfw/#/pagesAjkj/app/wssd/index\\\\?[^\\\\s]*\",\n \"required_params\": [\"qdbh\", \"sdbh\", \"sdsin\"],\n \"param_extract\": \"从 URL query string 中提取 qdbh、sdbh、sdsin 三个参数值\",\n \"download_strategy\": \"api_first\",\n \"api\": {\n \"endpoint\": \"https://zxfw.court.gov.cn/yzw/yzw-zxfw-sdfw/api/v1/sdfw/getWsListBySdbhNew\",\n \"method\": \"POST\",\n \"content_type\": \"application/json\",\n \"request_body\": { \"qdbh\": \"{全局编号}\", \"sdbh\": \"{送达编号}\", \"sdsin\": \"{送达签名}\" },\n \"response_fields\": {\n \"court_name\": \"data[].c_fymc\",\n \"court_id\": \"data[].c_fybh\",\n \"document_name\": \"data[].c_wsmc\",\n \"document_id\": \"data[].c_wsbh\",\n \"download_url\": \"data[].wjlj\",\n \"file_format\": \"data[].c_wjgs\",\n \"create_time\": \"data[].dt_cjsj\"\n },\n \"download_method\": \"curl -sL -o \\\"{filename}\\\" \\\"{wjlj}\\\"\",\n \"notes\": \"OSS 签名 URL 有过期时间(约1小时),获取后应尽快下载。无需浏览器,直接 curl 即可。dt_cjsj 为送达记录创建时间,可作为 sent_at 使用。\"\n }\n },\n {\n \"domain\": \"sd.gdems.com\",\n \"canonical_domain\": \"sd.gdems.com\",\n \"description\": \"广东法院电子送达平台(限广东地区)\",\n \"pattern\": \"https?://[^\\\\s/]+/v3/dzsd/[a-zA-Z0-9]+\",\n \"required_params\": [],\n \"param_extract\": \"从 URL 路径末尾提取送达标识码\",\n \"download_strategy\": \"browser_only\",\n \"api\": null,\n \"notes\": \"无公开 API,需通过浏览器打开页面后手动或 Playwright 自动化下载。页面可能需要输入验证码或手机号验证。\"\n },\n {\n \"domain\": \"jysd.10102368.com\",\n \"canonical_domain\": \"jysd.10102368.com\",\n \"description\": \"集约送达平台(邮政集约送达服务)\",\n \"pattern\": \"https?://[^\\\\s/]+/sd\\\\?key=[a-zA-Z0-9_\\\\-]+\",\n \"required_params\": [\"key\"],\n \"param_extract\": \"从 URL query string 中提取 key 参数值\",\n \"download_strategy\": \"browser_only\",\n \"api\": null,\n \"notes\": \"无公开 API,需通过浏览器打开页面后下载。部分链接可能需要短信验证码验证身份。\"\n },\n {\n \"domain\": \"dzsd.hbfy.gov.cn\",\n \"canonical_domain\": \"dzsd.hbfy.gov.cn\",\n \"description\": \"湖北电子送达平台(限湖北地区法院)\",\n \"pattern\": \"https?://[^\\\\s/]+/(?:hb/msg=[a-zA-Z0-9]+|sfsddz\\\\b)\",\n \"required_params\": [],\n \"param_extract\": \"免账号模式:从 URL 路径提取 msg 参数值;账号模式:从短信正文提取账号和默认密码\",\n \"download_strategy\": \"browser_only\",\n \"api\": {\n \"public_mode\": {\n \"endpoint\": \"http://dzsd.hbfy.gov.cn/delimobile/tDeliSms/findSmsInfo\",\n \"method\": \"POST\",\n \"content_type\": \"application/json\",\n \"request_body\": { \"msg\": \"{msg参数值}\", \"code\": \"{验证码(如需)}\", \"uuid\": \"{验证码UUID(如需)}\" },\n \"response_fields\": {\n \"need_captcha\": \"data.isNeedCaptcha\",\n \"doc_list\": \"data.docList\",\n \"doc_name\": \"data.docList[].docName\",\n \"download_path\": \"data.docList[].downloadPath\",\n \"pdf_path\": \"data.docList[].pdfPath\"\n },\n \"captcha_endpoint\": \"http://dzsd.hbfy.gov.cn/delimobile/loginCaptcha\",\n \"notes\": \"免账号模式有 HTTP API,但可能需要验证码(OCR)。验证码获取:POST loginCaptcha,返回 data.uuid + data.img(base64)。\"\n },\n \"account_mode\": {\n \"credential_patterns\": {\n \"account\": \"账号\\\\s*([0-9]{15,20})\",\n \"password\": \"默认密码[::]\\\\s*([0-9A-Za-z]+)\"\n },\n \"notes\": \"账号模式需从短信正文提取账号和默认密码,登录需要验证码 OCR,建议使用 Playwright MCP 浏览器自动化。\"\n }\n },\n \"notes\": \"湖北电子送达平台支持两种模式:1)免账号模式(短信含 /hb/msg= 链接)可直接通过 HTTP API 查询文书;2)账号模式(短信含 /sfsddz 入口)需登录后下载。两种模式都可能需要验证码。建议优先尝试免账号 HTTP API,失败后降级到 Playwright MCP。\"\n },\n {\n \"domain\": \"sfpt.cdfy12368.gov.cn\",\n \"alias_domains\": [\"171.106.48.55:28083\"],\n \"description\": \"司法送达网(全国法院司法送达平台)\",\n \"pattern\": \"https?://[^\\\\s/]+/sfsdw//r/[a-zA-Z0-9]+\",\n \"required_params\": [],\n \"param_extract\": \"从短信正文提取验证码(验证码[::]\\\\s*(\\\\w{4,6})),或使用案件关联律师手机号后6位作为验证码。无 URL 参数。\",\n \"download_strategy\": \"browser_only\",\n \"api\": null,\n \"verification\": {\n \"modes\": [\n {\n \"type\": \"phone_tail\",\n \"description\": \"手机尾号后6位验证(优先)\",\n \"source\": \"从案件分配信息中获取律师手机号,取后6位\"\n },\n {\n \"type\": \"sms_code\",\n \"pattern\": \"验证码[::]\\\\s*(\\\\w{4,6})\",\n \"description\": \"从短信正文中提取验证码\"\n }\n ]\n },\n \"browser_flow\": {\n \"description\": \"纯 Playwright 流程(无 API 可用,所有 POST 请求经 TDHCryptoUtil 加密)\",\n \"steps\": [\n \"browser_navigate → 打开短信中的 SFDW 链接\",\n \"页面自动重定向到 pc.html?tdhParams=xxx\",\n \"browser_snapshot → 查看验证码输入页面(input#checkCode)\",\n \"输入验证码(优先手机尾号后6位,其次短信验证码)\",\n \"browser_evaluate → 调用 Vue app.checkYzm() 触发验证\",\n \"验证通过后 browser_evaluate → 获取 app.$data.wsList(文书列表)\",\n \"遍历 wsList,逐个调用 downloadFile(app, ws) 下载文书\",\n \"保存到 /tmp/court-sms-staging/\"\n ]\n },\n \"notes\": \"司法送达网所有 POST 请求使用 TDHCryptoUtil 加密,无法通过 HTTP API 下载,只能使用纯 Playwright 流程。广西实例(171.106.48.55:28083)路由到同一平台,下载流程相同。wsList 每项包含 wjmc(文件名)、wjgs(格式)、sdjzwjid(文件ID)。\"\n }\n ],\n \"case_number_pattern\": \"[((〔\\\\[]\\\\d{4}[))\\\\]〕]\\\\s*[\\\\u4e00-\\\\u9fa5]{1,10}\\\\d+[\\\\u4e00-\\\\u9fa5]{1,5}\\\\d+号?\",\n \"case_number_examples\": [\n \"(2025)苏0981民初1234号\",\n \"(2024)粤0604执保5678号\",\n \"〔2025〕京0105民初901号\"\n ],\n \"sms_type_keywords\": {\n \"document_delivery\": [\"文书送达\", \"请查收\", \"查收文书\", \"下载文书\", \"送达文书\", \"案件文书\", \"受理通知书\", \"缴费通知书\", \"告知书\", \"廉政监督卡\"],\n \"filing_notification\": [\"已立案\", \"立案通知\", \"受理案件\", \"案件受理\"],\n \"info_notification\": [\"开庭时间\", \"延期\", \"取消\", \"变更\", \"提醒\"]\n },\n \"document_titles\": {\n \"受理案件通知书\": \"受理案件通知书\",\n \"应诉通知书\": \"应诉通知书\",\n \"传票\": \"传票\",\n \"开庭传票\": \"传票\",\n \"举证通知书\": \"举证通知书\",\n \"判决书\": \"判决书\",\n \"民事判决书\": \"一审判决书\",\n \"裁定书\": \"裁定书\",\n \"调解书\": \"调解书\",\n \"执行通知书\": \"执行通知书\",\n \"诉讼权利义务告知书\": \"诉讼权利义务告知书\",\n \"诉讼费用交费通知书\": \"诉讼费用交费通知书\",\n \"廉政监督卡\": \"廉政监督卡\",\n \"诉讼材料提交告知书\": \"诉讼材料提交告知书\",\n \"出庭通知书\": \"出庭通知书\",\n \"合议庭组成人员通知书\": \"合议庭组成人员通知书\",\n \"举证期限通知书\": \"举证期限通知书\",\n \"转换程序通知书\": \"转换程序通知书\",\n \"参加诉讼通知书\": \"参加诉讼通知书\"\n },\n \"sent_time_extraction\": {\n \"_doc\": \"送达时间提取规则,用于计算上诉期限等关键日期\",\n \"api_field\": \"dt_cjsj\",\n \"api_field_description\": \"送达平台 API 响应中的创建时间字段,即送达记录创建时间(北京时间)\",\n \"patterns\": [\n {\n \"type\": \"sms_gateway\",\n \"description\": \"短信网关时间(部分手机短信显示)\",\n \"regex\": \"(?:发送|时间)[::]?\\\\s*(\\\\d{4}[-/年]\\\\d{1,2}[-/月]\\\\d{1,2}[日]?\\\\s+\\\\d{1,2}[时:]?\\\\d{0,2})\",\n \"format\": \"yyyy-MM-dd HH:mm\"\n }\n ]\n },\n \"appeal_calculation\": {\n \"_doc\": \"上诉期限计算规则,不同案件类型上诉期限不同\",\n \"first_instance_civil_judgment\": {\n \"deadline_days\": 15,\n \"description\": \"民事一审判决:送达后15天\",\n \"document_types\": [\"一审判决书\", \"民事判决书\", \"判决书\"]\n },\n \"first_instance_civil_ruling\": {\n \"deadline_days\": 10,\n \"description\": \"民事裁定:送达后10天\",\n \"document_types\": [\"裁定书\"]\n },\n \"first_instance_administrative\": {\n \"deadline_days\": 15,\n \"description\": \"行政判决:送达后15天\",\n \"document_types\": [\"行政判决书\"]\n },\n \"first_instance_criminal_judgment\": {\n \"deadline_days\": 10,\n \"description\": \"刑事判决:送达后10天\",\n \"document_types\": [\"刑事判决书\"]\n },\n \"first_instance_criminal_ruling\": {\n \"deadline_days\": 5,\n \"description\": \"刑事裁定:送达后5天\",\n \"document_types\": [\"刑事裁定书\"]\n }\n },\n \"party_extraction\": {\n \"company_patterns\": [\n \"[\\\\u4e00-\\\\u9fa5]{2,30}(?:有限责任公司|股份有限公司)\",\n \"[\\\\u4e00-\\\\u9fa5]{2,20}有限公司\",\n \"[\\\\u4e00-\\\\u9fa5]{2,20}(?:集团|企业)\"\n ],\n \"versus_patterns\": [\n \"{company}与{company}\",\n \"{company}与{person}\",\n \"{person}与{company}\",\n \"{person}与{person}\",\n \"{person}诉{person}\",\n \"{person}诉{company}\"\n ],\n \"role_prefixes\": [\"原告\", \"被告\", \"申请人\", \"被申请人\", \"上诉人\", \"被上诉人\", \"申请执行人\", \"被执行人\", \"第三人\"],\n \"exclude_keywords\": [\n \"法院\", \"人民法院\", \"书记员\", \"法官\", \"审判员\", \"执行员\",\n \"系统\", \"平台\", \"服务\", \"通知\", \"短信\", \"案件\", \"纠纷\", \"争议\",\n \"你好\", \"收到\", \"查收\", \"下载\", \"链接\", \"请于\", \"联系\"\n ]\n },\n \"rename_fallback\": {\n \"_doc\": \"当文书标题无法识别时的回退策略\",\n \"strategy\": \"use_original_filename\",\n \"description\": \"优先使用下载时的原始文件名(去除扩展名),而非默认为'未知文书'\",\n \"fallback_title\": \"未知文书\"\n },\n \"file_naming\": {\n \"format\": \"{title}({case_name})_{YYYYMMDD}收.pdf\",\n \"example\": \"受理通知书(张三与李四合同纠纷)_20260404收.pdf\",\n \"target_directory\": null,\n \"conflict_suffix\": \"_2\"\n },\n \"post_processing\": {\n \"_doc\": \"PDF 后处理:检测拆分文件并合并 + 精简文件名。不默认启用,仅在检测到拆分时提示用户。合并偏好见 user-preferences.json。\",\n \"trigger\": {\n \"description\": \"扫描归档目录中的 PDF 文件名,按文书类型分组。任一组文件数 > 3 时触发提示。\",\n \"group_rules\": [\n \"证据类:文件名以'证据'开头,按编号分组(证据1、证据2、证据3…)\",\n \"其他文书:按文书类型分组(传票、起诉状、应诉通知书…)\"\n ],\n \"threshold\": 3\n },\n \"preferences_file\": \"config/user-preferences.json\",\n \"preferences_example\": \"config/user-preferences.example.json\",\n \"default_merge_strategy\": \"per_evidence\",\n \"user_prompt\": {\n \"description\": \"检测到拆分文件时,使用 AskUserQuestion 提示用户\",\n \"options\": [\n \"是,合并所有 — 按偏好设置合并并重命名\",\n \"让我选择 — 逐个确认哪些需要合并\",\n \"跳过 — 不处理\"\n ]\n }\n }\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":12068,"content_sha256":"39cc23c79db7ee3fe51807a20c9047fb3b05860a914644ab43525cca0f8668ba"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"法院短信识别与文书下载","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"功能概述","type":"text"}]},{"type":"paragraph","content":[{"text":"处理法院短信的完整流程:","type":"text"},{"text":"粘贴短信 → 解析内容 → 匹配案件 → 下载文书 → 归档保存","type":"text","marks":[{"type":"strong"}]},{"text":"。","type":"text"}]},{"type":"paragraph","content":[{"text":"支持两种触发方式:","type":"text"}]},{"type":"paragraph","content":[{"text":"方式一:粘贴短信原文","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"收到法院短信,内容如下:\n【xx市人民法院】张三,您好!您有(2025)苏0981民初1234号案件文书送达,请点击链接查收:https://zxfw.court.gov.cn/zxfw/#/pagesAjkj/app/wssd/index?qdbh=DEMO1&sdbh=DEMO2&sdsin=DEMO3","type":"text"}]},{"type":"paragraph","content":[{"text":"方式二:直接发送送达链接","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"用户可能直接粘贴送达链接(非完整短信文本),此时跳过短信文本解析,直接从 URL 中提取 ","type":"text"},{"text":"qdbh","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"sdbh","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"sdsin","type":"text","marks":[{"type":"code_inline"}]},{"text":" 参数,进入第三步下载流程。","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"https://zxfw.court.gov.cn/zxfw/#/pagesAjkj/app/wssd/index?qdbh=xxx&sdbh=xxx&sdsin=xxx","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"短信类型分类","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"类型","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"特征","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"含下载链接","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"处理方式","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"文书送达","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"含送达平台链接 + 案号","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"是","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"下载文书并归档到案件目录","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"立案通知","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"含\"已立案\"等关键词","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"可能有","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"展示解析结果","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"信息通知","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"无链接,纯信息","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"否","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"展示解析结果","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"支持的送达平台","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"zxfw.court.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":"(全国)、","type":"text"},{"text":"sd.gdems.com","type":"text","marks":[{"type":"code_inline"}]},{"text":"(广东)、","type":"text"},{"text":"jysd.10102368.com","type":"text","marks":[{"type":"code_inline"}]},{"text":"(集约送达)、","type":"text"},{"text":"dzsd.hbfy.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":"(湖北)、","type":"text"},{"text":"sfpt.cdfy12368.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":"(司法送达网)。同一平台可能使用不同域名(同构异域名),通过 URL 路径特征识别平台。详见 ","type":"text"},{"text":"references/sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":"。","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"工作流(四步)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第一步:输入解析","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"读取 ","type":"text"},{"text":"references/sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" 作为解析参考","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"判断输入类型","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"完整短信","type":"text","marks":[{"type":"strong"}]},{"text":":包含法院签名(如 ","type":"text"},{"text":"【xx法院】","type":"text","marks":[{"type":"code_inline"}]},{"text":")+ 正文 + 链接 → 完整解析流程","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"纯链接","type":"text","marks":[{"type":"strong"}]},{"text":":用户直接发送送达 URL(如 ","type":"text"},{"text":"https://zxfw.court.gov.cn/...?qdbh=xxx&sdbh=xxx&sdsin=xxx","type":"text","marks":[{"type":"code_inline"}]},{"text":")→ 跳过短信文本解析,直接从 URL 提取参数,进入第三步下载。案号、当事人等信息在下载文书后从文书内容中提取。","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"对用户粘贴的短信文本进行分析(纯链接输入跳过此步):","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"a) 短信分类","type":"text","marks":[{"type":"strong"}]},{"text":":根据关键词判断类型","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"文书送达:包含 zxfw.court.gov.cn 链接","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"立案通知:包含\"已立案\"、\"立案通知\"等","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"信息通知:其他","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"b) 案号提取","type":"text","marks":[{"type":"strong"}]},{"text":":使用正则 ","type":"text"},{"text":"[((〔[]\\d{4}[))〕]]","type":"text","marks":[{"type":"code_inline"}]},{"text":" 匹配标准案号格式","type":"text"}]},{"type":"paragraph","content":[{"text":"标准案号格式示例:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"(2025)苏0981民初1234号","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"(2024)粤0604执保5678号","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"〔2025〕京0105民初901号","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"paragraph","content":[{"text":"c) 当事人提取","type":"text","marks":[{"type":"strong"}]},{"text":":从短信文本初步识别,最终以文书内容为准","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"注意","type":"text","marks":[{"type":"strong"}]},{"text":":短信中的称呼(如\"张三,您好\")仅为短信接收人,不作为案件当事人","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"公司名称:","type":"text"},{"text":"xx有限责任公司","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"xx有限公司","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"xx股份有限公司","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"诉讼对峙:","type":"text"},{"text":"A与B","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"A诉B","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"原告A 被告B","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"角色前缀:","type":"text"},{"text":"原告:xxx","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"被告:xxx","type":"text","marks":[{"type":"code_inline"}]},{"text":" 等","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"下载文书后,以起诉状、传票中的当事人信息为准,覆盖短信阶段的初步判断","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"d) 下载链接提取","type":"text","marks":[{"type":"strong"}]},{"text":":识别短信中的送达平台链接并提取参数","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"平台","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"域名","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"下载方式","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"提取参数","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"全国法院统一送达平台","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"zxfw.court.gov.cn","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"curl API 直连","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"qdbh, sdbh, sdsin","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"广东法院电子送达","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sd.gdems.com","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"浏览器自动化","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"路径中的送达标识码","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"集约送达平台","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"jysd.10102368.com","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"浏览器自动化","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"key","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"湖北电子送达","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"dzsd.hbfy.gov.cn","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"HTTP API(免账号)/ 浏览器自动化(账号模式)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"免账号:msg;账号模式:账号+密码从正文提取","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"司法送达网","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"sfpt.cdfy12368.gov.cn","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"纯 Playwright(无 API)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"验证码(手机尾号后6位 / 短信验证码)","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"e) 发送时间提取(P0)","type":"text","marks":[{"type":"strong"}]},{"text":":从送达平台 API 响应中提取发送时间,用于后续上诉期限计算","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"优先来源","type":"text","marks":[{"type":"strong"}]},{"text":":zxfw API 响应中的 ","type":"text"},{"text":"dt_cjsj","type":"text","marks":[{"type":"code_inline"}]},{"text":" 字段(送达记录创建时间,ISO 8601 格式)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"短信网关时间:部分手机短信会显示发送时间,匹配 ","type":"text"},{"text":"发送:YYYY-MM-DD HH:mm","type":"text","marks":[{"type":"code_inline"}]},{"text":" 格式","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如果无法提取送达时间,展示\"送达时间待确认\",不阻塞后续流程","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"记录到归档 JSON 的 ","type":"text"},{"text":"document.sent_at","type":"text","marks":[{"type":"code_inline"}]},{"text":" 字段","type":"text"}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"排除列表","type":"text","marks":[{"type":"strong"}]},{"text":":法院名称、法官姓名、地名、法律术语等不应作为当事人提取。详见 ","type":"text"},{"text":"sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" → ","type":"text"},{"text":"party_extraction.exclude_keywords","type":"text","marks":[{"type":"code_inline"}]},{"text":"。","type":"text"}]}]},{"type":"paragraph","content":[{"text":"输出格式","type":"text","marks":[{"type":"strong"}]},{"text":"(向用户展示):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"📋 短信解析结果:\n- 类型:文书送达\n- 案号:(2025)苏0981民初1234号\n- 当事人:张三、xx有限公司\n- 下载链接:已提取(zxfw.court.gov.cn)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第二步:确定归档目录","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"扫描当前工作目录","type":"text","marks":[{"type":"strong"}]},{"text":":识别目录结构,找到与短信案号或当事人匹配的案件目录","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"查找归档子目录","type":"text","marks":[{"type":"strong"}]},{"text":":在匹配到的案件目录下,查找法院文书相关的子目录(如 ","type":"text"},{"text":"08*","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"法院送达","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"court","type":"text","marks":[{"type":"code_inline"}]},{"text":" 等)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如未找到匹配案件,","type":"text"},{"text":"自动在当前工作目录(项目根目录)下新建","type":"text","marks":[{"type":"strong"}]},{"text":" ","type":"text"},{"text":"{案号} {当事人与案由}/","type":"text","marks":[{"type":"code_inline"}]},{"text":",不询问用户","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第三步:文书下载","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"平台判断","type":"text","marks":[{"type":"strong"}]},{"text":":根据第一步识别的链接域名,选择下载策略。","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"zxfw.court.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":" → 方案一(API 直连)→ 方案二 → 方案三","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"sd.gdems.com","type":"text","marks":[{"type":"code_inline"}]},{"text":" 或 ","type":"text"},{"text":"jysd.10102368.com","type":"text","marks":[{"type":"code_inline"}]},{"text":" → 跳过方案一,直接方案二 → 方案三","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"dzsd.hbfy.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":" → 湖北专属流程(见下方)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"sfpt.cdfy12368.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":"(含广西实例 ","type":"text"},{"text":"171.106.48.55:28083","type":"text","marks":[{"type":"code_inline"}]},{"text":")→ SFDW 专属流程(见下方)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"未知域名但 URL 路径匹配已知平台特征 → 按路径识别平台(同构异域名支持)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"完全无法识别 → 提示用户提供链接信息","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"⛔ 降级铁律","type":"text","marks":[{"type":"strong"}]},{"text":":严格串行,禁止并行。当前方案成功即停止,绝不降级。禁止\"双保险\"并行尝试多个方案。","type":"text"}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"依赖","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"依赖","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"用途","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"适用方案","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"安装方式","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"curl","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"API 下载","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"方案一","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"macOS/Linux 预装","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"jq","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"JSON 解析(可选)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"方案一","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"brew install jq","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Playwright","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"浏览器自动化","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"方案二/三","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"见下方","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"Playwright 安装指引","type":"text","marks":[{"type":"strong"}]},{"text":"(仅方案二/三需要):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 方案二: Playwright CLI\nnpm install -g playwright\nnpx playwright install chromium\n\n# 方案三: Playwright MCP(需在 Claude Code 设置中配置)\n# 在 settings.json 的 mcpServers 中添加:\n# \"playwright\": { \"command\": \"npx\", \"args\": [\"@anthropic-ai/mcp-playwright\"] }","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"⛔ 大多数情况下不需要 Playwright","type":"text","marks":[{"type":"strong"}]},{"text":":zxfw 平台方案一直接 curl 调用 API,无需浏览器。仅 gdems/jysd 平台或","type":"text"},{"text":"方案一失败后","type":"text","marks":[{"type":"strong"}]},{"text":"才需要方案二/三。禁止在方案一执行期间同时打开浏览器。","type":"text"}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"方案一 — API 直连(优先)","type":"text"}]},{"type":"paragraph","content":[{"text":"完全无头,无需浏览器。直接调用 zxfw 后端 API 获取文书下载链接,再用 curl 下载 PDF。","type":"text"}]},{"type":"paragraph","content":[{"text":"API 信息","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"端点:","type":"text"},{"text":"POST https://zxfw.court.gov.cn/yzw/yzw-zxfw-sdfw/api/v1/sdfw/getWsListBySdbhNew","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Content-Type:","type":"text"},{"text":"application/json","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"请求体:","type":"text"},{"text":"{ \"qdbh\": \"xxx\", \"sdbh\": \"xxx\", \"sdsin\": \"xxx\" }","type":"text","marks":[{"type":"code_inline"}]},{"text":"(从短信 URL 提取)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"响应字段:","type":"text"},{"text":"data[].c_wsmc","type":"text","marks":[{"type":"code_inline"}]},{"text":"(文书名称)、","type":"text"},{"text":"data[].wjlj","type":"text","marks":[{"type":"code_inline"}]},{"text":"(OSS 签名下载链接)、","type":"text"},{"text":"data[].c_fymc","type":"text","marks":[{"type":"code_inline"}]},{"text":"(法院名称)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"无需认证、无需浏览器","type":"text"}]}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 1. 从短信 URL 提取参数(示例)\nqdbh=\"DEMO_qdbh_value\"\nsdbh=\"DEMO_sdbh_value\"\nsdsin=\"DEMO_sdsin_value\"\n\n# 2. 调用 API 获取文书列表\nmkdir -p /tmp/court-sms-staging/\nresp=$(curl -s -X POST \"https://zxfw.court.gov.cn/yzw/yzw-zxfw-sdfw/api/v1/sdfw/getWsListBySdbhNew\" \\\n -H \"Content-Type: application/json\" \\\n -d \"{\\\"qdbh\\\":\\\"$qdbh\\\",\\\"sdbh\\\":\\\"$sdbh\\\",\\\"sdsin\\\":\\\"$sdsin\\\"}\")\n\n# 3. 解析文书列表,逐个下载 PDF\necho \"$resp\" | jq -r '.data[] | \"\\(.c_wsmc)\\t\\(.wjlj)\"' | while IFS=

法院短信识别与文书下载 功能概述 处理法院短信的完整流程: 粘贴短信 → 解析内容 → 匹配案件 → 下载文书 → 归档保存 。 支持两种触发方式: 方式一:粘贴短信原文 方式二:直接发送送达链接 用户可能直接粘贴送达链接(非完整短信文本),此时跳过短信文本解析,直接从 URL 中提取 、 、 参数,进入第三步下载流程。 短信类型分类 | 类型 | 特征 | 含下载链接 | 处理方式 | | --- | --- | --- | --- | | 文书送达 | 含送达平台链接 + 案号 | 是 | 下载文书并归档到案件目录 | | 立案通知 | 含"已立案"等关键词 | 可能有 | 展示解析结果 | | 信息通知 | 无链接,纯信息 | 否 | 展示解析结果 | 支持的送达平台 : (全国)、 (广东)、 (集约送达)、 (湖北)、 (司法送达网)。同一平台可能使用不同域名(同构异域名),通过 URL 路径特征识别平台。详见 。 --- 工作流(四步) 第一步:输入解析 1. 读取 作为解析参考 2. 判断输入类型 : - 完整短信 :包含法院签名(如 )+ 正文 + 链接 → 完整解析流程 - 纯链接 :用户直接发送送达 URL(如 )→ 跳过短信文本解析,直接从 URL 提取参数,进入第三步下载。案号、当事人等信息在下载文书后从文书内容中提取。 3. 对用户粘贴的短信文本进行分析…

\\t' read -r name url; do\n curl -sL -o \"/tmp/court-sms-staging/${name}.pdf\" \"$url\"\ndone\n\n# 4. 验证下载结果\nls -lh /tmp/court-sms-staging/*.pdf","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"方案二 — 无头浏览器(Playwright CLI)","type":"text"}]},{"type":"paragraph","content":[{"text":"当方案一 API 不可用或链接过期时,用 Playwright CLI 无头模式打开页面,拦截网络请求获取下载链接。","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# 需要先安装 playwright\nnpx playwright install chromium 2>/dev/null\n\n# 无头模式运行(脚本需自行编写,拦截 getWsListBySdbhNew API 响应)\nnode scripts/download_court_docs.mjs --url \"{短信链接}\" --output /tmp/court-sms-staging/","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"方案三 — 交互式浏览器(Playwright MCP)","type":"text"}]},{"type":"paragraph","content":[{"text":"当方案二不可用时(需要已配置 Playwright MCP):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"1. browser_navigate → 打开短信中的 zxfw URL\n2. 等待页面加载\n3. browser_evaluate → 直接调用 fetch API 获取文书列表\n4. browser_run_code → 下载 PDF 文件到 /tmp/court-sms-staging/","type":"text"}]},{"type":"paragraph","content":[{"text":"如 API 调用未成功,改用页面交互:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"1. browser_snapshot → 查看当前页面结构\n2. 找到文书列表或 PDF 预览区域\n3. 定位下载按钮(可能在 iframe 内)\n4. browser_click → 点击下载\n5. 等待下载完成,保存到临时目录","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"湖北平台下载流程(","type":"text"},{"text":"dzsd.hbfy.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]},{"type":"paragraph","content":[{"text":"湖北电子送达平台有两种链路,根据 URL 格式自动选择:","type":"text"}]},{"type":"paragraph","content":[{"text":"链路一:免账号模式","type":"text","marks":[{"type":"strong"}]},{"text":"(URL 含 ","type":"text"},{"text":"/hb/msg=xxx","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"从 URL 提取 ","type":"text"},{"text":"msg","type":"text","marks":[{"type":"code_inline"}]},{"text":" 参数值","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"尝试 HTTP API 直连:","type":"text"}]}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"msg=\"从URL提取的msg值\"\nmkdir -p /tmp/court-sms-staging/\n\n# 查询文书信息\nresp=$(curl -s -X POST \"http://dzsd.hbfy.gov.cn/delimobile/tDeliSms/findSmsInfo?t=$(date +%s%3N)\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Referer: http://dzsd.hbfy.gov.cn/deli-mobile-ui/\" \\\n -d \"{\\\"msg\\\":\\\"$msg\\\"}\")\n\n# 检查是否需要验证码(data.isNeedCaptcha == \"Y\")\n# 如需验证码或无可下载文书,降级到 Playwright MCP\n\n# 逐个下载文书\necho \"$resp\" | jq -r '.data.docList[] | \"\\(.docName)\\t\\(.downloadPath)\"' | while IFS=

法院短信识别与文书下载 功能概述 处理法院短信的完整流程: 粘贴短信 → 解析内容 → 匹配案件 → 下载文书 → 归档保存 。 支持两种触发方式: 方式一:粘贴短信原文 方式二:直接发送送达链接 用户可能直接粘贴送达链接(非完整短信文本),此时跳过短信文本解析,直接从 URL 中提取 、 、 参数,进入第三步下载流程。 短信类型分类 | 类型 | 特征 | 含下载链接 | 处理方式 | | --- | --- | --- | --- | | 文书送达 | 含送达平台链接 + 案号 | 是 | 下载文书并归档到案件目录 | | 立案通知 | 含"已立案"等关键词 | 可能有 | 展示解析结果 | | 信息通知 | 无链接,纯信息 | 否 | 展示解析结果 | 支持的送达平台 : (全国)、 (广东)、 (集约送达)、 (湖北)、 (司法送达网)。同一平台可能使用不同域名(同构异域名),通过 URL 路径特征识别平台。详见 。 --- 工作流(四步) 第一步:输入解析 1. 读取 作为解析参考 2. 判断输入类型 : - 完整短信 :包含法院签名(如 )+ 正文 + 链接 → 完整解析流程 - 纯链接 :用户直接发送送达 URL(如 )→ 跳过短信文本解析,直接从 URL 提取参数,进入第三步下载。案号、当事人等信息在下载文书后从文书内容中提取。 3. 对用户粘贴的短信文本进行分析…

\\t' read -r name path; do\n if [ -n \"$path\" ]; then\n curl -sL -o \"/tmp/court-sms-staging/${name}.pdf\" \"http://dzsd.hbfy.gov.cn/delimobile${path}\"\n fi\ndone","type":"text"}]},{"type":"ordered_list","attrs":{"order":3,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如需验证码或 HTTP 失败,降级到 Playwright MCP(方案三)","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"链路二:账号模式","type":"text","marks":[{"type":"strong"}]},{"text":"(URL 含 ","type":"text"},{"text":"/sfsddz","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"从短信正文提取凭证:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"账号:匹配 ","type":"text"},{"text":"账号\\s*(\\d{15,20})","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"默认密码:匹配 ","type":"text"},{"text":"默认密码[::]\\s*([0-9A-Za-z]+)","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"需要浏览器自动化(Playwright MCP),登录页包含验证码","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"登录后遍历待签收/已签收/已过期文书列表,逐个下载","type":"text"}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"提示","type":"text","marks":[{"type":"strong"}]},{"text":":湖北平台两种模式都可能遇到验证码。免账号模式优先尝试 HTTP API,账号模式建议引导用户手动打开链接或使用 Playwright MCP。","type":"text"}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"司法送达网下载流程(SFDW - ","type":"text"},{"text":"sfpt.cdfy12368.gov.cn","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]},{"type":"paragraph","content":[{"text":"司法送达网所有 POST 请求使用 TDHCryptoUtil 加密,无法通过 HTTP API 下载,只能使用纯 Playwright 流程。","type":"text"}]},{"type":"paragraph","content":[{"text":"广西实例","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"171.106.48.55:28083","type":"text","marks":[{"type":"code_inline"}]},{"text":" 域名下的链接路由到同一 SFDW 平台,下载流程相同。","type":"text"}]},{"type":"paragraph","content":[{"text":"验证码获取","type":"text","marks":[{"type":"strong"}]},{"text":"(两种方式,按优先级尝试):","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"手机尾号后6位","type":"text","marks":[{"type":"strong"}]},{"text":"(优先):从案件分配信息中获取律师手机号,取后6位作为验证码输入","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"短信验证码","type":"text","marks":[{"type":"strong"}]},{"text":":从短信正文中提取,匹配 ","type":"text"},{"text":"验证码[::]\\s*(\\w{4,6})","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"paragraph","content":[{"text":"Playwright MCP 流程","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"1. browser_navigate → 打开短信中的 SFDW 链接\n2. 等待页面自动重定向到 pc.html?tdhParams=xxx\n3. browser_snapshot → 查看验证码输入页面(input#checkCode)\n4. 输入验证码(优先手机尾号后6位,其次短信验证码)\n5. browser_evaluate → 调用 Vue app.checkYzm() 触发验证\n6. 验证通过后 browser_evaluate → 获取 app.$data.wsList(文书列表)\n7. 遍历 wsList,逐个调用 downloadFile(app, ws) 下载文书\n8. 保存到 /tmp/court-sms-staging/","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"提示","type":"text","marks":[{"type":"strong"}]},{"text":":如手机尾号验证失败,提示用户查看短信中的验证码并手动输入。wsList 每项包含 wjmc(文件名)、wjgs(格式)。","type":"text"}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"失败兜底","type":"text"}]},{"type":"paragraph","content":[{"text":"当三级均失败时:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"⚠️ 自动下载失败,请手动访问以下链接下载:\n{原始链接}\n\n下载后请将文件放到对应案件目录中。\n\n我将为您创建待处理记录。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第四步:归档保存","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"确定目标目录","type":"text","marks":[{"type":"strong"}]},{"text":":根据当前项目环境自动判断,不询问用户","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"扫描当前项目目录,匹配与案号或当事人相关的案件目录","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如找到匹配案件目录,优先查找法院文书子目录(如 ","type":"text"},{"text":"08*","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"法院送达","type":"text","marks":[{"type":"code_inline"}]},{"text":"、","type":"text"},{"text":"court","type":"text","marks":[{"type":"code_inline"}]},{"text":" 等);如无子目录则直接归档到案件根目录","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如未找到匹配案件,自动在当前项目下新建","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"{案号} {当事人与案由}/","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如目标目录不存在,自动创建","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"获取当前日期","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"date \"+%Y%m%d\"","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"确定文书标题","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"优先使用 API 返回的标题","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"否则根据 ","type":"text"},{"text":"sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" 中的 ","type":"text"},{"text":"document_titles","type":"text","marks":[{"type":"code_inline"}]},{"text":" 映射推断","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"最后回退到原始文件名(去除扩展名),如仍无法确定则使用 ","type":"text"},{"text":"未知文书","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"构建文件名","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"{title}({case_name})_{YYYYMMDD}收.pdf","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"示例:","type":"text"},{"text":"受理通知书(张三与李四合同纠纷)_20260404收.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"清理非法字符:","type":"text"},{"text":"\u003c > : \" | ? * \\ /","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如同名文件已存在,追加 ","type":"text"},{"text":"_2","type":"text","marks":[{"type":"code_inline"}]},{"text":" 后缀","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"移入目标目录","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"写入内部记录","type":"text","marks":[{"type":"strong"}]},{"text":":保存本次处理的完整信息到 ","type":"text"},{"text":"skill 内部的 ","type":"text","marks":[{"type":"strong"}]},{"text":"archive/","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":" 目录","type":"text","marks":[{"type":"strong"}]},{"text":"(即 ","type":"text"},{"text":".claude/skills/court-sms/archive/","type":"text","marks":[{"type":"code_inline"}]},{"text":"),不是案件文件夹。格式详见 ","type":"text"},{"text":"references/archive-format.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/archive-format.md","title":null}},{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"基础文书解析","type":"text","marks":[{"type":"strong"}]},{"text":":法院 PDF 通常带文字层,提取首页文本,快速识别文书类型和关键信息","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"传票","type":"text","marks":[{"type":"strong"}]},{"text":":提取开庭时间、地点、法庭、案号,向用户高亮提醒","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"通知书/告知书","type":"text","marks":[{"type":"strong"}]},{"text":":提取缴费期限、举证期限等关键日期","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"起诉状/答辩状","type":"text","marks":[{"type":"strong"}]},{"text":":提取案由、当事人、诉讼请求概要","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"判决书","type":"text","marks":[{"type":"strong"}]},{"text":":识别为一审判决书,记录文书类型,触发上诉期限计算(P1)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"其他文书","type":"text","marks":[{"type":"strong"}]},{"text":":展示文书标题和法院名称","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如一次下载多份文书,逐一解析,汇总为一份报告","type":"text"}]}]}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"深度分析(如判决书解读、合同审查)不在此技能范围内,请使用专用分析技能处理。","type":"text"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"上诉期限计算(P1)","type":"text","marks":[{"type":"strong"}]},{"text":":当识别到判决书/裁定书时自动计算","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"适用条件","type":"text","marks":[{"type":"strong"}]},{"text":":文书类型为判决书/裁定书(包括一审判决书、民事判决书、裁定书等)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"不同案件类型的上诉期限","type":"text","marks":[{"type":"strong"}]},{"text":"(详见 ","type":"text"},{"text":"sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" → ","type":"text"},{"text":"appeal_calculation","type":"text","marks":[{"type":"code_inline"}]},{"text":"):","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"案件类型","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"上诉期限","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"民事一审判决","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"送达后15天","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"民事裁定","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"送达后10天","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"行政判决","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"送达后15天","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"刑事判决","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"送达后10天","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"刑事裁定","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"送达后5天","type":"text"}]}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"计算公式","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"},{"text":"上诉截止日期 = 送达日期 + 上诉期限天数","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"送达日期来源","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"优先使用 zxfw API 响应的 ","type":"text"},{"text":"dt_cjsj","type":"text","marks":[{"type":"code_inline"}]},{"text":" 字段(送达记录创建时间)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"次选使用短信接收时间 ","type":"text"},{"text":"received_at","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"无法确定时,展示\"送达时间待确认\"","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"归档 JSON 字段","type":"text","marks":[{"type":"strong"}]},{"text":":写入 ","type":"text"},{"text":"document.appeal_deadline","type":"text","marks":[{"type":"code_inline"}]},{"text":" 和 ","type":"text"},{"text":"document.appeal_days_remaining","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"向用户汇报","type":"text","marks":[{"type":"strong"}]},{"text":":按 ","type":"text"},{"text":"references/report-format.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/report-format.md","title":null}},{"type":"code_inline"}]},{"text":" 输出结构化报告","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"先确认归档完成(案号、法院、当事人、案由、文件数、位置)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"列出所有已归档的文书清单","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如含传票,⚠️ 高亮提醒开庭时间、地点、审理程序","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如含判决书,⏰ 展示上诉期限信息","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"如部分失败,列出失败文书和原始链接","type":"text"}]}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"第五步:PDF 后处理(可选)","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"不默认启用","type":"text","marks":[{"type":"strong"}]},{"text":"。仅在检测到文件拆分时主动提示用户。","type":"text"}]}]},{"type":"paragraph","content":[{"text":"归档完成后,扫描目标目录中的 PDF 文件,检测是否有同一文书被拆分为多个文件的情况。","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"读取用户偏好","type":"text"}]},{"type":"paragraph","content":[{"text":"读取 ","type":"text"},{"text":"config/user-preferences.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" 获取用户的合并和重命名偏好。如文件不存在,使用默认值(参考 ","type":"text"},{"text":"config/user-preferences.example.json","type":"text","marks":[{"type":"code_inline"}]},{"text":")。","type":"text"}]},{"type":"paragraph","content":[{"text":"关键偏好项:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"偏好","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"默认值","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"说明","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"merge_strategy","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"per_evidence","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"合并策略:","type":"text"},{"text":"per_evidence","type":"text","marks":[{"type":"code_inline"}]},{"text":"(按编号分别合并)或 ","type":"text"},{"text":"unified","type":"text","marks":[{"type":"code_inline"}]},{"text":"(统一合并)","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"merge_options.unified.bookmarks.enabled","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"true","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"统一合并时是否添加 PDF 书签","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"rename.enabled","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"true","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"是否精简文件名","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"触发检测","type":"text"}]},{"type":"paragraph","content":[{"text":"读取 ","type":"text"},{"text":"references/sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" → ","type":"text"},{"text":"post_processing.trigger","type":"text","marks":[{"type":"code_inline"}]},{"text":" 配置,按以下规则分组:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"分组规则:\n1. 证据类:文件名以\"证据\"开头 → 按编号分组(证据1、证据2、证据3…)\n2. 其他文书:按文书类型分组(传票、起诉状、应诉通知书…)\n3. 如任一组内文件数 > 3(threshold),触发提示","type":"text"}]},{"type":"paragraph","content":[{"text":"示例","type":"text","marks":[{"type":"strong"}]},{"text":":证据3 下有 10 个 PDF → 触发。","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"用户确认","type":"text"}]},{"type":"paragraph","content":[{"text":"使用 AskUserQuestion 提示用户,列出检测到的拆分情况:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"检测到以下文书被拆分为多个 PDF:\n- 证据3:10 个文件\n- 证据5:4 个文件\n\n是否执行 PDF 后处理(合并 + 重命名)?\n → 是,合并所有\n → 让我选择(逐个确认)\n → 跳过","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"执行后处理","type":"text"}]},{"type":"paragraph","content":[{"text":"用户确认后,根据 ","type":"text"},{"text":"user-preferences.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" 中的 ","type":"text"},{"text":"merge_strategy","type":"text","marks":[{"type":"code_inline"}]},{"text":" 执行:","type":"text"}]},{"type":"paragraph","content":[{"text":"策略一:per_evidence(默认)","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"按单个证据编号分别合并,每个证据独立保留:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"- 证据3 有 10 个拆分文件 → 合并为「证据3:打印截图.pdf」\n- 证据5 有 4 个拆分文件 → 合并为「证据5:电脑截图.pdf」\n- 未被拆分的证据(如证据1 只有 1 个文件)保持不动","type":"text"}]},{"type":"paragraph","content":[{"text":"策略二:unified","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"将证据目录 + 所有证据合并为一个「原告证据.pdf」,并添加 PDF 书签:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"合并顺序:证据目录 → 证据1 → 证据2 → … → 证据N\n书签格式:\n 📑 证据目录\n 📑 证据1:仲裁申请书、不予受理通知书\n 📑 证据2:劳动合同、保密协议\n 📑 证据3:被告工资表\n 📑 证据4:泄露账号密码的电脑截图\n 📑 证据5:打印及拷贝资料的电脑截图\n 📑 证据6:删除电脑操作痕迹的截图","type":"text"}]},{"type":"paragraph","content":[{"text":"书签名称使用简洁版:证据编号 + 冒号 + 证据标题(去除当事人和日期后缀)。使用 pypdf 的 ","type":"text"},{"text":"add_outline_item","type":"text","marks":[{"type":"code_inline"}]},{"text":" 添加书签。","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"用户可随时修改 ","type":"text"},{"text":"user-preferences.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" 切换策略,无需改动 skill 本身。","type":"text"}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"页面尺寸标准化","type":"text"}]},{"type":"paragraph","content":[{"text":"合并过程中同时标准化页面尺寸为 A4(210×297mm)。使用 pypdf 逐页处理:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"python"},"content":[{"text":"from pypdf import PdfReader, PdfWriter, Transformation\n\nA4_W = 595.27 # 210mm in points\nA4_H = 841.89 # 297mm in points\n\nfor page in reader.pages:\n pw, ph = float(page.mediabox.width), float(page.mediabox.height)\n is_landscape = pw > ph\n\n # 保持原始方向:纵向→A4纵向,横向→A4横向\n target_w = A4_H if is_landscape else A4_W\n target_h = A4_W if is_landscape else A4_H\n\n # 等比缩放并居中\n scale = min(target_w / pw, target_h / ph)\n offset_x = (target_w - pw * scale) / 2\n offset_y = (target_h - ph * scale) / 2\n\n new_page = writer.add_blank_page(width=target_w, height=target_h)\n page.add_transformation(Transformation().scale(scale).translate(offset_x, offset_y))\n new_page.merge_page(page)","type":"text"}]},{"type":"paragraph","content":[{"text":"规则","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"纵向页面 → A4 纵向(210×297mm)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"横向页面 → A4 横向(297×210mm),不强制旋转为纵向","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"等比缩放、居中放置,不裁剪、不拉伸","type":"text"}]}]}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"精简文件名","type":"text"}]},{"type":"paragraph","content":[{"text":"根据 ","type":"text"},{"text":"user-preferences.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" → ","type":"text"},{"text":"rename","type":"text","marks":[{"type":"code_inline"}]},{"text":" 配置对所有文件统一重命名:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"去除规则(strip_patterns):\n- 去掉括号内的当事人信息:(张三与李四合同纠纷)\n- 去掉日期后缀:_20260405收\n- 去掉平台标记:(合并)、(自贸法庭)、(素)-\n\n特殊映射(special_mappings):\n- 起诉状(素)… → 起诉状(要素式).pdf\n- 开庭传票 → 传票.pdf","type":"text"}]},{"type":"paragraph","content":[{"text":"重命名示例","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"原始","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"重命名后","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"传票(张三与李四合同纠纷)_20260405收.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"传票.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"起诉状(合并).pdf","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"起诉状.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"起诉状(素)-要素式起诉状(合并).pdf","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"起诉状(要素式).pdf","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"应诉通知书(自贸法庭).pdf","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"应诉通知书.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"E法桥平台使用告知书(xxx)_20260405收.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"E法桥平台使用告知书.pdf","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"内部归档格式","type":"text"}]},{"type":"paragraph","content":[{"text":"每次处理完成后在 ","type":"text"},{"text":"archive/","type":"text","marks":[{"type":"code_inline"}]},{"text":" 下创建 JSON 记录,格式详见 ","type":"text"},{"text":"references/archive-format.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/archive-format.md","title":null}},{"type":"code_inline"}]},{"text":"。","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"常见法院短信格式参考","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"文书送达短信","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"【xx市人民法院】张三,您好!您有(2025)苏0981民初1234号案件文书送达,\n请点击链接查收:\nhttps://zxfw.court.gov.cn/zxfw/#/pagesAjkj/app/wssd/index?qdbh=DEMO1&sdbh=DEMO2&sdsin=DEMO3\n如非本人操作请联系法院。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"立案通知短信","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"【xx市xx区人民法院】您好,您提交的立案材料已审核通过。\n案号:(2025)京0105民初54321号\n请及时缴纳诉讼费用。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"开庭提醒短信","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"【xx市xx区人民法院】提醒:您有(2025)苏0508民初567号案件,\n定于2025年3月15日上午9:30在第3法庭开庭,请准时到庭。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"湖北电子送达短信(免账号)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"【xx人民法院】您有案件文书待查收,请点击链接查收:\nhttp://dzsd.hbfy.gov.cn/hb/msg=XXXXXXX\n如有疑问请联系法院。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"湖北电子送达短信(账号模式)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"【xx人民法院】您有(2025)鄂xxxx民初xxxx号案件文书送达。\n账号 420xxxxxxxxxxxxx\n默认密码:xxxxxx\n请登录 http://dzsd.hbfy.gov.cn/sfsddz 查收。","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"司法送达网短信","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"text"},"content":[{"text":"【xx人民法院】您有(2025)川xxxx民初xxxx号案件文书送达。\n验证码:A1B2C3\n请点击链接查收:https://sfpt.cdfy12368.gov.cn/sfsdw//r/xxxxxxxxxxxx","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"故障排除","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"问题","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"解决方案","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"短信无法识别类型","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"展示原文,请用户确认类型后继续","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"案号提取失败","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"手动输入案号","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"当事人识别不准","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"提示用户确认/修正当事人列表","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"无匹配案件","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"提供三个选项:选已有/新建/暂存","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Playwright 下载超时","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"检查网络连接,尝试刷新页面重试","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"页面需要验证码","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"通知用户,暂停等待手动处理","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"下载文件损坏","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"清理临时目录,重新尝试下载","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"目标目录不存在","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"自动创建对应目录","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"SFDW 验证码验证失败","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"尝试手机尾号后6位和短信验证码两种方式,均失败时提示用户联系法院","type":"text"}]}]}]}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"配置","type":"text"}]},{"type":"paragraph","content":[{"text":"无额外配置需求。解析规则参考 ","type":"text"},{"text":"references/sms-patterns.json","type":"text","marks":[{"type":"code_inline"}]},{"text":"。","type":"text"}]},{"type":"paragraph","content":[{"text":"如需修改解析规则(添加新文书标题、调整正则等),编辑该 JSON 文件即可。","type":"text"}]},{"type":"hr","attrs":{"markup":"---"}},{"type":"heading","attrs":{"level":2},"content":[{"text":"🔄 变更历史","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"完整变更日志见 ","type":"text"},{"text":"CHANGELOG.md","type":"text","marks":[{"type":"link","attrs":{"href":"CHANGELOG.md","title":null}}]},{"text":"。归属声明见 ","type":"text"},{"text":"references/ATTRIBUTION.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/ATTRIBUTION.md","title":null}}]},{"text":"。","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"court-sms","author":"@skillopedia","source":{"stars":281,"repo_name":"legal-skills","origin_url":"https://github.com/cat-xierluo/legal-skills/blob/HEAD/skills/court-sms/SKILL.md","repo_owner":"cat-xierluo","body_sha256":"00b61b46ef2dddc1a9939357bc0d4c5ea52f68646f57f743882d8fbca916f18a","cluster_key":"d1579519116b09e6f3f05d72feb3ba83b807f74c009a99a936e1efde9f547e12","clean_bundle":{"format":"clean-skill-bundle-v1","source":"cat-xierluo/legal-skills/skills/court-sms/SKILL.md","attachments":[{"id":"4618d567-0d45-5891-95ee-ea740c77c67e","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/4618d567-0d45-5891-95ee-ea740c77c67e/attachment.md","path":"CHANGELOG.md","size":10607,"sha256":"b8e653e4afe108a45ca394af6a4a0f17eee92755183c3d8bb3e93e5159e6433e","contentType":"text/markdown; charset=utf-8"},{"id":"26268cea-89bb-5ca1-b779-8d83ceb3f4c6","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/26268cea-89bb-5ca1-b779-8d83ceb3f4c6/attachment","path":"archive/.gitkeep","size":0,"sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","contentType":"text/plain; charset=utf-8"},{"id":"9b7b0ffe-eb5d-522c-9def-d8762eb7f30e","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/9b7b0ffe-eb5d-522c-9def-d8762eb7f30e/attachment.json","path":"config/user-preferences.example.json","size":1439,"sha256":"f071bcd9dc8c5802c411726e6ca9a529158665192a517ba692da3026cec8127e","contentType":"application/json; charset=utf-8"},{"id":"f65e5a4d-3808-5ae0-bef7-f399e26aadac","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/f65e5a4d-3808-5ae0-bef7-f399e26aadac/attachment.md","path":"references/ATTRIBUTION.md","size":2565,"sha256":"3a6bad28977cc3a6f8883ec8de3947c2291595e63d6c8fd8a6b402e8a35ac50f","contentType":"text/markdown; charset=utf-8"},{"id":"85269780-b812-5629-92f9-24d7b1d06795","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/85269780-b812-5629-92f9-24d7b1d06795/attachment.md","path":"references/archive-format.md","size":4028,"sha256":"ec5c4bdb764f452592a84f319c42545886719ae8126bdb7df95f9bf481d10607","contentType":"text/markdown; charset=utf-8"},{"id":"fd293c39-d7ee-52ec-a499-b17a373b5657","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/fd293c39-d7ee-52ec-a499-b17a373b5657/attachment.md","path":"references/report-format.md","size":3439,"sha256":"349ec67ac7c5faea4e0167215447cb6cf2741391022476a5d9e3b10342d1b2d6","contentType":"text/markdown; charset=utf-8"},{"id":"7e1697b1-8057-59a0-bd0b-8d045b0ba728","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/7e1697b1-8057-59a0-bd0b-8d045b0ba728/attachment.json","path":"references/sms-patterns.json","size":12068,"sha256":"39cc23c79db7ee3fe51807a20c9047fb3b05860a914644ab43525cca0f8668ba","contentType":"application/json; charset=utf-8"}],"bundle_sha256":"7599b1a4456caa9a043b6da45f7bfb3ed7f06922b221697efd5c3df258833e7b","attachment_count":7,"text_attachments":7,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/court-sms/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"general","category_label":"General"},"exact_dupes_collapsed_into_this":0},"license":"MIT","version":"v1","category":"general","homepage":"https://github.com/cat-xierluo/legal-skills","import_tag":"clean-skills-v1","description":"本技能应在用户收到法院短信(文书送达、立案通知、开庭提醒等)时使用,自动提取案号、当事人、下载链接,下载文书并归档到对应案件目录。"}},"renderedAt":1782981759334}

法院短信识别与文书下载 功能概述 处理法院短信的完整流程: 粘贴短信 → 解析内容 → 匹配案件 → 下载文书 → 归档保存 。 支持两种触发方式: 方式一:粘贴短信原文 方式二:直接发送送达链接 用户可能直接粘贴送达链接(非完整短信文本),此时跳过短信文本解析,直接从 URL 中提取 、 、 参数,进入第三步下载流程。 短信类型分类 | 类型 | 特征 | 含下载链接 | 处理方式 | | --- | --- | --- | --- | | 文书送达 | 含送达平台链接 + 案号 | 是 | 下载文书并归档到案件目录 | | 立案通知 | 含"已立案"等关键词 | 可能有 | 展示解析结果 | | 信息通知 | 无链接,纯信息 | 否 | 展示解析结果 | 支持的送达平台 : (全国)、 (广东)、 (集约送达)、 (湖北)、 (司法送达网)。同一平台可能使用不同域名(同构异域名),通过 URL 路径特征识别平台。详见 。 --- 工作流(四步) 第一步:输入解析 1. 读取 作为解析参考 2. 判断输入类型 : - 完整短信 :包含法院签名(如 )+ 正文 + 链接 → 完整解析流程 - 纯链接 :用户直接发送送达 URL(如 )→ 跳过短信文本解析,直接从 URL 提取参数,进入第三步下载。案号、当事人等信息在下载文书后从文书内容中提取。 3. 对用户粘贴的短信文本进行分析…