Bundle
dsh-2048
常驻 2048 小游戏:DeepSeek Harness Web 客户端插件(dsh.client + dsh.bundle 标准组合包)
- Source
- yasin0324
- stars
- 1 stars
- Updated
- Updated 7 days ago
Readme
# dsh-2048 🎮 一个在 [DeepSeek Harness](https://github.com/deepseek-ai/DeepSeek-Harness) 里玩的 2048 小游戏,等 AI 回复的时候打发时间。 两种存在形式: - **动态 Cordis 插件**(`plugin/client.js`):注入运行中的 DSH 进程,代码不落盘、进程重启后消失——适合快速迭代。 - **常驻组合包插件**(仓库根目录,标准 `dsh.bundle` 格式):用官方 `dsh plugin` 命令安装进 profile,每次启动 DSH 自动加载,跨会话常驻——推荐日常使用。 ## 项目结构 ``` dsh-2048/ # 仓库根目录即组合包根(dsh.bundle 标准格式) ├── package.json # dsh.client 声明 + dsh.bundle.patch 声明 ├── cordis.patch.yml # 本包的补丁层(插入 ui-2048 行) ├── index.js # 主机端 no-op ├── client.js # 浏览器端(工厂形式 bundle,含全部游戏逻辑) ├── plugin/ │ └── client.js # 动态插件源码(ttfe-1/pkg-5 的完整 Client 端代码) ├── scripts/ │ ├── install.sh # 无 pnpm 环境的手动安装(回退方案,幂等) │ └── uninstall.sh # 手动安装对应的卸载 ├── standalone/ │ └── 2048.html # 独立的纯 HTML 版本,双击即可在浏览器玩 └── README.md ``` ## 常驻版安装(推荐:官方 dsh plugin) DSH 的标准插件机制是「组合包 → profile」:插件包在 `package.json` 里声明 `dsh.bundle`, `dsh plugin` 一条命令完成依赖安装与补丁层接线。本仓库**已提交构建产物**(`client.js` 即 bundle), 安装时无需构建。 ```bash # 从 GitHub 安装(推荐) dsh plugin --profile web add github:yasin0324/dsh-2048 # 或从本地 checkout / 已解压目录安装 dsh plugin --profile web add . ``` 前提条件: - **dsh CLI** 在 PATH(与 harness 同版本) - **pnpm** 在 PATH:`corepack enable pnpm`(Node 22+ 自带 corepack)或自行安装 pnpm - 使用 **Web 界面**(游戏按钮在浏览器端) 安装后重启 `dsh web` 并刷新页面,输入框左侧出现「🎮 2048」。 卸载(官方): ```bash dsh plugin --profile web remove dsh-2048 ``` ### 方式二:无 pnpm 环境的手动安装(回退方案) ```bash git clone https://github.com/yasin0324/dsh-2048.git cd dsh-2048 && scripts/install.sh ``` `scripts/install.sh` 全自动、幂等:拷贝包文件到 `~/.dsh/plugins/dsh-2048/`、建 `~/node_modules/dsh-2048` 符号链接、把 `ui-2048` 行写入 `~/.dsh/profiles/web/cordis.patch.yml` (该补丁文件被热重载监听,无需重启)。卸载用 `scripts/uninstall.sh`(`--purge` 连文件一起删)。 ### 方式三:把仓库地址发给你的 DSH(最省事)✅ 直接在你的 DeepSeek Harness 会话里说: > 请安装这个仓库 https://github.com/yasin0324/dsh-2048 —— 优先用 `dsh plugin --profile web add github:yasin0324/dsh-2048`; > 如果 dsh/pnpm 命令不可用,就克隆后运行 `scripts/install.sh`。装完刷新页面。 对方的 agent(需要有 bash 工具,standard/code preset 默认都有)会按上面两条路装好。 Windows 请用 WSL 或方式二的手动步骤。 > 安全提示:让 DSH 执行网上脚本前请先审阅内容。本项目脚本只做——拷文件、建符号链接、 > 写补丁行,全部在用户目录内,不碰部署文件;仓库公开,可逐行检查。 ## 独立版怎么玩 直接用浏览器打开 `standalone/2048.html` 即可: - **方向键 / WASD** 移动方块,`R` 重开一局 - 在棋盘上**滑动**(鼠标拖拽或触屏)也可以 - 最高分存在 `localStorage` 里,下次打开还在 ## 动态版怎么装回 DSH(临时) `plugin/client.js` 导出的对象就是 `code.client` 需要的插件定义(`apply(ctx)` 函数体)。 在 DSH 会话中通过 `cordis_define` 动态插件工具创建: - 插件 `idPrefix`:`ttfe`(3–6 个小写字母,Host 会分配最终 ID) - `code.client`:`plugin/client.js` 的内容(去掉 `module.exports =` 包装、保留 `apply` 主体) > 动态插件是进程内临时扩展:会话重启后需要重新定义。这是 DSH 动态插件的设计特性,不是本项目的缺陷。 ## 功能(两种形态一致) - **入口**:输入框左侧工具行的「🎮 2048」按钮 - **面板**:右上角浮出的经典配色游戏浮窗,**按住黄色标题栏可拖动**,`×` 或 `Esc` 关闭 - **操作**:方向键 / WASD,或在棋盘上滑动 - **状态**:分数 / 最高分(会话内保留)、到达 2048 后可「继续挑战」、无路可走时提示结束 - **动画**:合并弹出 0.38s、新方块生成 0.45s - 关掉再打开,游戏进度不丢(面板隐藏而非卸载) ## 版本历史(动态包) | 包 | 说明 | | --- | --- | | `pkg-1` | 初版:面板 + 侧边栏底部入口 | | `pkg-2` | 入口移到输入框左侧工具行 | | `pkg-3` | 动画放慢(0.28s / 0.35s) | | `pkg-4` | 动画再放慢(0.38s / 0.45s) | | `pkg-5` | 移除屏幕方向键按钮 | ## 许可 仅供个人娱乐使用。
Install
dsh plugin --profile web add github:yasin0324/dsh-2048
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-2048 from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.