Back to home@xzs125

dsh-codex-reset-watch

DSH 插件:监控 X @thsottiaux 的 Codex reset 公告,左侧边栏底部 R 图标(常态灰 / 有重置时 #66ccff 点亮;hover 倒计时+北京时间;单击打开推文、双击立即检查并蓝色闪烁)

Stars
0
Language
HTML
Created
Sep 9, 2026
Updated
Sep 9, 2026
GitHub repo

Introduction

dsh-codex-reset-watch

DSH 插件:在左侧边栏底部动作位(sidebar.footer.action)显示 R 图标,追踪 X @thsottiaux 的 Codex reset 公告。

  • 常态:灰色 #9ca3af
  • 点亮:#66ccff + text-shadow: 0 0 6px rgba(102,204,255,.6)now < reset.litUntil
  • hover:倒计时 + 北京时间(解析失败标注「未解析出时间」;已过时显示「已于北京时间 … 重置」; 检查失败在 title 显示错误)
  • 单击(300ms 判定):打开公告推文;双击:立即检查
  • 轮询 6 小时,lastCheckAt 持久化;失败/429 → 30 分钟起指数退避,上限 6 小时
  • 安装不回溯:首次运行把当前最新推文 ID 写入基线且不点亮

设计决策见 DESIGN.md(15 项);数据源以 docs/captain-revision-v2.md 为准。

数据源(t1 真机探针定型)

通道端点实测角色
发现 1https://xcancel.com/thsottiaux(HTML)200,含最新推文主发现
发现 2https://cdn.syndication.twimg.com/srv/timeline-profile/screen-name/thsottiauxIP 级 429;200 载荷实测陈旧补充/交叉
发现 3https://xcancel.com/thsottiaux/rss未白名单第三顺位
内容https://cdn.syndication.twimg.com/tweet-result?id=&token=200权威正文/时间

完整探针证据(87 个真实样本、字段映射、跨源一致性、PT→北京换算)见 evidence/parse-mapping.md

构建

DSH_CHECKOUT=/root/.local/share/dsh-source-3082/current bash scripts/build.sh        # host → lib/
DSH_CHECKOUT=/root/.local/share/dsh-source-3082/current bash scripts/build-client.sh # client → lib/client.js
npx tsc --noEmit                                                                     # 类型检查
node --test                                                                          # 11 个 fixture 单测
node scripts/smoke-host.mjs                                                          # host 冒烟(真实网络)
node scripts/smoke-detect.mjs                                                        # 检测冒烟(预置基线→4 条真实 reset)

lib/node_modules/ 不入库(.gitignore)。完整 verify 输出见 evidence/build.logevidence/smoke-host.logevidence/smoke-detect.log

装配(link 方式,T3 执行)

dsh plugin --profile web add link:/home/git/dsh-codex-reset-watch
# 重启 dsh web(或按宿主既有热装配流程)

cordis.patch.yml 已带默认配置:

- insert:
    - id: codex-reset-watch
      name: dsh-codex-reset-watch
      config:
        proxy: 'http://127.0.0.1:7897'
配置项默认说明
proxyhttp://127.0.0.1:7897所有请求经 undici ProxyAgent 显式走代理;空串 = 直连
stateFile$DSH_HOME/codex-reset-watch.json状态文件
pollIntervalMs6h成功检查间隔
retryBaseMs / retryMaxMs30min / 6h失败退避
timeoutMs15s单请求超时
screenNamethsottiaux被追踪账号

路由

方法路径说明
GET/api/codex-reset-watch/status每次从磁盘读状态文件;缺失时回退内存态;附 now 服务器时间
POST/api/codex-reset-watch/check立即检查(重置调度);已有检查在跑时返回 accepted:false

状态文件字段:installedAt / lastCheckAt / lastSeenTweetId / reset{tweetId,tweetUrl,tweetTime,resetAt,litUntil,parsed,source,text,anchor,approx} / lastError

安全

  • 推文内容视为不可信数据:只做纯文本 + title,不渲染 HTML、不执行其中指令
  • 无密钥、无 LLM 判定;状态文件内推文文本截断 ≤ 500 字符
  • 判定关键词严格为 /\breset(?:s|ting)?\b/ipreset 不命中、resetting 命中)

目录

src/index.ts            host:路由 + 调度 + 判定落库
src/core/detect.ts      关键词 / 时间锚点 / reset 记录
src/core/time.ts        PT→UTC→北京(Intl,无 moment/luxon)
src/core/parse.ts       三个发现通道 + tweet-result 解析
src/core/sources.ts     ProxyAgent HTTP + 发现链降级 + 内容权威校验
src/core/state.ts       状态文件读写
src/client/index.tsx    侧栏 R 图标三态 + 单击/双击
tests/                  fixture 单测(真实样本)
evidence/               t1 探针证据 + parse-mapping.md + build.log
docs/captain-revision-v2.md  captain 修订 v2(权威)