Skip to content

zhouyoukang/windsurf-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windsurf Assistant

水善, 利万物而有静, 居众之所恶, 故几于道矣。

道法自然 · 无为而无不为。

—— 帛书《老子》

Windsurf 三器: 切号 · 反代 · 部署. 各安其位, 不相干扰.

三器 (Triad)

Plugin Concern Edition Version
packages/wam/ 切号 · account rotation · message anchoring · token pool · Firebase + Devin full v17.42.20
packages/dao-proxy-min/ 反代 · Cascade Connect-RPC reverse proxy · <user_rules> 可信格式注入德道经 · 侧信道深度净化 minimal v9.1.2 🆕
wam-bundle/ 部署 · single-file Devin-only WAM · zero-config minimal v2.1.0 ✅

packages/wam-proxy/ (v17.51 wam-dao) 已并入 dao-proxy-min v5.0 道法自然 (损 250 行). 见下文沿革.


packages/dao-proxy-min · 反代 (v9.1.2 道法自然)

反代 Windsurf Cascade 之 Connect-RPC, 以 <user_rules> + <MEMORY> 可信格式 注入德道经八十章, 彻底替换官方 SP:

  • 道层<user_rules><MEMORY[dao-de-jing.md]> 格式包裹德道经 · 模型视为可信身份规则
  • 法层deepStripProtoSideChannels 递归剥净所有侧信道 (<skills>/<workflows>/<memories> 等)
  • 术层 — SP 字段结构性保护 (save/restore) · 防 deepStrip 误伤已注入内容
  • 净卸 — 透传→清锚→杀LS→停代理 · 逆序关停 · 零卡死
LLM 实收 = You are Cascade.\n<user_rules>\n<MEMORY[dao-de-jing.md]>\n德道经八十章\n</MEMORY>\n</user_rules>

演化 (v3 → v9.1)

版本 核心
v3.0 极简反代 · 固定端口
v5.0 道法自然 跳出剥/留二元 · 道魂在前 · 法骨完保
v9.0 反者道之动 彻底隔离 · 侧信道深度净化 · 实时编辑
v9.1 道法自然 <user_rules> 可信格式 · SP 结构性保护 · 逆序净卸

为学者日益, 闻道者日损. 损之又损, 以至于无为. —— 帛书《老子》德经

7 命令

命令 道义
道Agent: 启 (invert) 反者道之动 · 启代理 + 锚 settings + LS 重启
官方Agent: 启 (passthrough) 上善如水 · 透传观照 · SP 不改
道Agent: 切换模式 (道 ⇄ 官方) 二态热切 · 零代价翻转
道Agent: 浏览器观真 SP 打开 /origin/preview · 全貌解剖
全链路自检 (E2E) 致虚守静 · L1+L2 报告
闭环自检 (L1 + L2) 同上
了事拂衣去 · 净卸 停反代 · 清设置 · 卸插件 · 归本源

控制面 HTTP 端点

GET  /origin/ping           # 状态 (mode/uptime/req_total/dao_chars)
GET  /origin/mode           # 当前模式
POST /origin/mode           # 切模式 {"mode":"invert"|"passthrough"}
GET  /origin/preview        # 实时全貌 (before+after+结构解剖)
GET  /origin/last           # 最近一次 SP 注入
GET  /origin/realprompt     # 捕获轨实 SP
GET  /origin/selftest       # 三路径闭环自检
GET  /origin/stream         # SSE 推式 (sp/mode/hb)
GET/POST/DELETE /origin/custom_sp  # 自定义 SP CRUD

per-user 端口隔离

多账号同机时, 每用户自动分配唯一端口 (FNV-1a hash of username → 8889..8988). 无配置, 无协调, 自然隔离. 可通过 dao.origin.port 显式覆盖.

构建

cd packages/dao-proxy-min
.\_build_vsix.ps1                  # 打包
.\_build_vsix.ps1 -RunL1           # 打包前 L1 自检
.\_build_vsix.ps1 -RunL1 -RunL2Syn # +L2 合成测试 (须反代在跑)
.\_build_vsix.ps1 -InstallLocal    # 打包 + 装本机 Windsurf

自检

GET /origin/selftest → all_paths_pass: true
  ├─ plain_utf8           道=✓ · 用户问题=✓
  ├─ nested_chat_message  道=✓ · 用户问题=✓
  └─ raw_sp               道=✓ · 用户问题=✓

packages/wam · 切号 (full edition)

Full edition with all features:

  • Message anchoring — 5-probe detection → switch on chat send
  • Token pool — burst/cruise pre-warming cycle
  • Proxy scanning — port scan + relay gateway
  • Firebase + Devin — dual auth with multi-key failover
  • Auto-update — jsDelivr / SMB source
  • ExtHost sentinel — event-loop lag detection
  • Instance coordination — heartbeat + claims across windows

wam-bundle · 部署 (minimal)

Minimal single-file edition (~106KB):

  • Auto-rotate — quota-aware switching with predictive pre-warming
  • Time rotationrotatePeriodMs for stealth periodic switching
  • Drought mode — weekly exhaustion → daily-only fallback
  • Claude gate — detect Claude model availability per account
  • 3-path injection — IDE internal API → clipboard → hijack (failover)
  • Webview panel — sidebar + editor panel, live quota bars
  • Invisible mode — zero-UI stealth operation

Quick Start

  1. Put accounts in ~/.wam/accounts.md:
    user@example.com password123
    user2@shop.com----password456
    
  2. Copy wam-bundle/ to your extensions directory, or build VSIX
  3. Done — activates on startup, zero interaction

Testing

cd wam-bundle
node _test_harness.cjs           # offline tests (24 cases)

Configuration

WAM (wam.*)

Setting Default Description
wam.autoRotate true Enable auto-switching
wam.invisible false Stealth mode
wam.autoSwitchThreshold 5 Switch threshold (%)
wam.rotatePeriodMs 0 Time rotation (ms, 0=off)
wam.accountsFile "" Account file (auto-detect)

dao-proxy-min (dao.*)

Setting Default Description
dao.origin.port 0 (auto) 反代端口 · 0=per-user FNV-1a hash · 非0则覆盖
dao.origin.defaultMode invert 首激默模 · invert / passthrough
dao.origin.banner true 启动时显德道经横幅

Philosophy

邻邦相望, 鸡狗之声相闻, 民至老死不相往来.

夫大制无割.

朴散则为器, 圣人用则为官长.

—— 帛书《老子》

三器各安其位:

  • wam — 切号轮换 (account rotation)
  • dao-proxy-min — 德道经身份锚 (prompt injection)
  • wam-bundle — 单文件部署 (single-file deployment)

三关隔离, 互不干扰. 用户按需取舍.

License

  • packages/wam/ · wam-bundle/ — MIT
  • packages/dao-proxy-min/ — Apache 2.0

为学日益 · 为道日损 · 损之又损 · 以至于无为 · 无为而无不为