Skip to content
dsh.fish
Bundle

dsh-snake

DeepSeek Harness Web 贪吃鲸小游戏插件:蓝色鲸鱼在页面背景中游走、吃金色 Token,方向键转向、空格开始/暂停,失败后可重来或退出,不影响正常浏览

Source
Solicide
stars
1 stars
License
MIT
Updated
Updated 14 days ago

Readme

# dsh-snake 🐳

DeepSeek Harness Web 贪吃鲸小游戏插件:**蓝色鲸鱼直接游走在 DSH 页面背景中**
(全视口、完全点击穿透),吃金色 Token,右下角仅保留一个极简控制胶囊,
浏览 DSH 时随时可玩,不遮挡内容、不抢页面焦点。

## 玩法

| 按键 | 作用 |
| --- | --- |
| `↑ ↓ ← →` | 转向(运行中);开始 / 结束画面上在按钮间移动焦点 |
| `空格` | 开始 / 暂停 / 继续;确认当前聚焦的按钮(开始、重来、退出) |
| `回车` | 同空格(菜单态确认按钮) |

- 点击右下角胶囊(或其按钮)即接管键盘;焦点离开后鲸鱼作为背景继续游走,不再响应按键。
- **运行中只有一枚 🐳 分数徽章**,没有任何提示层遮挡背景棋盘;
  开始 / 暂停 / 结束画面才显示对应按钮与提示。
- 失败后:`🔄 重来` 与 `✕ 退出`,方向键切换、空格确认(失败时若面板已聚焦会自动聚焦"重来")。
- 退出后背景鲸鱼与透明效果一并移除,页面恢复原样;侧栏底部 🐳 入口可随时重新打开。
- 最高分与胶囊位置保存在浏览器 localStorage。

## 设计要点(不影响浏览 DSH)

- 背景舞台直接挂在 `body`(DSH `#root` 之下,z-index 0),`pointer-events:none`,
  页面所有点击完全不受影响。
- 开启背景时把 DSH 表面令牌(`--dsw-alias-bg-*`)覆盖为半透明值(与 beautiCode
  背景同类做法,明暗主题各一套),鲸鱼才得以透出;**退出游戏后自动还原为不透明**。
- **全屏棋盘自动适配分辨率**:格数与格子大小按窗口尺寸自动计算
  (短边约 16 格、正方形格铺满整个视口,8–64 格钳制),窗口大小变化时空闲状态自动重建棋盘;
  游戏区域以极淡网格 + 内缩边界线标示。
- 画布完全透明:只有极淡网格、金色 Token(带 "token" 字样与光晕)与蓝色鲸鱼
  (固定透明度的 DeepSeek 蓝圆角方块,蓝色背部约占 75% 面积、白色月牙肚皮约占 25%、
  单侧眼斑与尾鳍),叠加在它上面的 DSH 文字保持清晰。
- 键盘只在「胶囊已聚焦」时响应,并且永远不劫持 `input / textarea / contenteditable`
  —— 在聊天框打字时方向键、空格照常输入。

## 安装

```bash
# 从 GitHub 安装(推荐)
dsh plugin --profile web add github:Solicide/dsh-snake
# 本地开发 / 源码安装(自动把包加入 profile 的 bundles 层)
dsh plugin --profile web add "link:D:\dsh\dsh-snake"
```

安装后重启 dsh web 服务并刷新页面(bundle 树在启动时组合);
之后修改 `lib/client.js` 只需刷新页面即可生效(bundle 以 no-cache 下发)。

## English quick start

| Key | Action |
| --- | --- |
| `↑ ↓ ← →` | Steer the whale; move focus between buttons on menus |
| `Space` | Start / pause / resume; activate the focused button (start, retry, exit) |
| `Enter` | Same as Space on menus |

Click the control pill at the bottom-right to take the keyboard. The whale
keeps swimming in the page background while you browse DSH; key input never
interferes with text fields. Close with the ✕ on the game-over screen, and
reopen any time from the 🐳 entry at the sidebar footer.

## 结构

```
lib/index.js           宿主半面(纯客户端插件,空 apply)
lib/game.js            纯逻辑引擎(无 DOM/定时器,可单测)
lib/client.template.js 客户端 bundle 模板(背景舞台 + 控制胶囊 + 键盘交互)
scripts/build-client.mjs  把 game.js 内联进模板生成 lib/client.js
test/game.test.mjs     引擎单元测试
test/client.smoke.mjs  客户端 bundle 冒烟测试(桩 DOM 环境)
cordis.patch.yml       组合树补丁(insert: ui-snake / dsh-snake)
```

开发校验:

```bash
npm run check   # 重新生成 client.js + 语法检查 + 单元/冒烟测试
```

## License

MIT

Install

dsh plugin --profile web add github:Solicide/dsh-snake

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source