Back to home@BarrierFly

apx-watchdog

牛来写的东西

Stars
0
Language
JavaScript
Created
Aug 26, 2026
Updated
Aug 26, 2026

Introduction

apx-watchdog · 审批看门狗

DeepSeek Harness (DSH) 动态 Cordis 插件 —— 一个对竞态免疫的挂起审批/提问全局浮层面板。

License: WTFPL Version 2 — You just DO WHAT THE FUCK YOU WANT TO.


中文说明

这是什么

DSH 的 Web 端在浏览器重连时存在一个已知竞态:mux 流的即到即派发与 Session.resync() 的同步清空互相矛盾,导致审批/提问卡片被清除且不再恢复——模型永远停住,而你在其他会话/窗口里毫无提示。

本插件不修改原生链路,而是在旁边架一条可靠通道:

对应方案实现
A · 时序竞态免疫宿主半边在进程内打开自己的第二条 apiProxy.events.mux() 订阅(每条连接独立重放、rpcId 跨重放稳定),维护挂起项的权威表;浏览器端 resync() 的任何时序都与它无关。断流自动退避重连(≤5s)
B · 纵深防御面板只镜像宿主真相:resolved 帧到达即删条目,幽灵卡结构上不可能残留;卡片按等待时长分级(>5min 琥珀边框,>15min 红色高亮);另有 `approval/asked
C · 全局可见+可操作聚合所有会话的挂起项于一个浮层;每个打开的窗口独立渲染同一真相(各自 1.5s 轮询宿主快照);审批可一键「允许一次/拒绝」,提问支持选项/多选/自定义文本,走原生 /api/respond 同链路,能真正解除模型阻塞

安装(动态插件)

前提:一个挂载了 Cordis 工具的 DSH 会话(你的编码 agent 就是加载器)。对它说:

读取 apx-watchdog/dynamic/host.body.jsclient.body.js(纯函数体),用 cordis_define 以 idPrefix: apxwd 定义为新插件,然后 cordis_run 运行。

或在 GUI 中手动把两个文件内容粘贴进 cordis_definecode.host / code.client 字段。首次运行需在运行卡片上批准(勾双选可授权后续版本免批)。

使用

  • 有会话卡在审批/提问时,浮层在约 1.5 秒内出现在右上角
  • 按住标题栏拖动到任意位置,双击复位;单击折叠/展开;
  • 审批:「允许一次」/「拒绝」直接应答;提问:点选项即答(单问题单选时)、多选后提交、或填自定义文本提交;
  • 无挂起时浮层完全隐藏。

边界与说明

  • 动态插件是进程内临时物:DSH 重启后需重新定义运行(这正是它的交付形态;常驻需升级为 preset 级静态插件)。
  • 不做浏览器标签页标题角标(沙箱不暴露 document);跨窗口提醒依赖“任一打开窗口中的浮层”。
  • 位置记忆是组件级的,页面刷新后回到默认位置。
  • 它是旁路看门狗:上游 resync() 竞态本身仍在,根治需上游修复(欢迎拿本仓库当 repro 说明去提 issue)。

文件结构

apx-watchdog/
├── README.md            本文件(中英双语)
├── LICENSE              WTFPL v2 全文
├── package.json         元数据(含 cordisDynamic 字段描述动态插件入口)
└── dynamic/
    ├── host.body.js     宿主半边(纯函数体 → Cordis Plugin)
    └── client.body.js   客户端半边(纯函数体 → Cordis Plugin)

English

What is this

A dynamic Cordis plugin for DeepSeek Harness (DSH): a race-immune global overlay for pending approvals and user questions. The stock web client loses approval/question cards on reconnect due to a dispatch-vs-resync ordering race; conversations stall silently while you work in another session or window. This plugin does not touch the native pipeline — it adds a reliable side channel:

  • A · Race immunity — the Host half opens its own second in-process apiProxy.events.mux() subscription (per-connection independent replay, rpcIds stable across replays) and keeps the authoritative pending table browser-race-free. Auto-reconnect with capped backoff.
  • B · Defense in depth — the UI mirrors host truth only: entries vanish the moment their resolved frame arrives, so ghost cards are structurally impossible. Staleness marking (>5 min amber border, >15 min red highlight). Audit-event fallback channel (approval/asked|decided) keeps visibility when mux is down.
  • C · Global visibility & actionability — all sessions aggregate into one overlay; every open window renders the same truth (1.5 s polling each); approvals answerable in one click (“allow once” / “reject”), questions support options / multi-select / free text — answered over the native /api/respond chain, so the blocked model genuinely resumes.

Install (dynamic plugin)

Requires a DSH session with the Cordis toolset (your coding agent is the loader). Tell it:

Read apx-watchdog/dynamic/host.body.js and client.body.js (plain function bodies), define them as a new plugin via cordis_define with idPrefix: apxwd, then start it with cordis_run.

Or paste both files into cordis_define's code.host / code.client manually. First activation asks for approval in the Run card (double-check marks authorize future versions).

Usage

When any session blocks on an approval or question, the frame appears near the top-right within ~1.5 s. Drag by the header anywhere; double-click resets; single click collapses. Approvals answer inline; questions accept option clicks (instant for single-choice), multi-select + submit, or custom text. Hidden entirely while nothing is pending.

Limits

  • Dynamic plugins are process-local by design: after a DSH restart, redefine and rerun (permanent residency would require a preset-level static plugin).
  • No tab-title badge (the sandbox exposes no document); cross-window awareness relies on the overlay being visible in any open window.
  • Position memory is component-level and resets on page reload.
  • Side-channel watchdog: the upstream resync race itself remains until fixed upstream — feel free to use this repo as a reproduction appendix when filing an issue.

Layout

apx-watchdog/
├── README.md            this file (bilingual)
├── LICENSE              WTFPL v2, verbatim
├── package.json         metadata (incl. cordisDynamic entry points)
└── dynamic/
    ├── host.body.js     Host half (function body → Cordis Plugin)
    └── client.body.js   Client half (function body → Cordis Plugin)

Author & License / 作者与授权

Author: ox-alpha (git identity in this repo: ox-alpha <ox-alpha@undisclosed.org> — a placeholder identity, not a deliverable mailbox).

Licensed under the WTFPL Version 2: you just DO WHAT THE FUCK YOU WANT TO.