dsh-plugin-tetris 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.en.md +63 -0
- package/README.md +59 -2
- package/cordis.patch.yml +12 -0
- package/docs/game.png +0 -0
- package/docs/menu.png +0 -0
- package/lib/client.js +2926 -0
- package/lib/index.js +6 -0
- package/package.json +51 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jayzhu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
The game engine in src/core/ is a TypeScript port of tetris-terminal
|
|
26
|
+
(https://github.com/zlh124/tetris-terminal), which is also MIT licensed.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# dsh-plugin-tetris
|
|
4
|
+
|
|
5
|
+
**Play a round of Tetris in the DSH Web GUI while the agent is working.**
|
|
6
|
+
|
|
7
|
+
[中文](README.md) | [English](README.en.md)
|
|
8
|
+
|
|
9
|
+
| Mode menu | Playing |
|
|
10
|
+
|:---:|:---:|
|
|
11
|
+
|  |  |
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
## Background
|
|
16
|
+
|
|
17
|
+
While coding with DSH, waiting for the agent to finish leaves you with a few dozen idle
|
|
18
|
+
seconds — so this became a plugin. The game panel lives in DSH's frame-level overlay and
|
|
19
|
+
appears on its own when the agent starts working. A circular T-tetrimino icon stays in the
|
|
20
|
+
bottom-right corner, and the panel opens right where that icon sits.
|
|
21
|
+
|
|
22
|
+
The engine is not a throwaway: it is a line-by-line TypeScript port of my other project
|
|
23
|
+
[**tetris-terminal**](https://github.com/zlh124/tetris-terminal) (a Python terminal Tetris).
|
|
24
|
+
7-bag, SRS wall kicks, Hold, Ghost, T-Spin, Back-to-Back and the line-clear animation all
|
|
25
|
+
match the terminal version, quirks included. The rules and feel came from there first.
|
|
26
|
+
|
|
27
|
+
> If you enjoy this, go give [**tetris-terminal**](https://github.com/zlh124/tetris-terminal) a ⭐.
|
|
28
|
+
|
|
29
|
+
## Controls
|
|
30
|
+
|
|
31
|
+
| Key | Action |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `←` `→` / `A` `D` | Move left / right |
|
|
34
|
+
| `↑` / `W` / `X` | Rotate clockwise |
|
|
35
|
+
| `Z` | Rotate counter-clockwise |
|
|
36
|
+
| `↓` / `S` | Soft drop |
|
|
37
|
+
| `Space` | Hard drop |
|
|
38
|
+
| `C` | Hold |
|
|
39
|
+
| `P` | Pause / resume |
|
|
40
|
+
|
|
41
|
+
Click the board once before using the keyboard; a green ring shows it has focus. The
|
|
42
|
+
"焦点联动" slider in the title bar toggles *pause on blur* and *focus returns when the
|
|
43
|
+
conversation ends*.
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
dsh plugin --profile web add dsh-plugin-tetris
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
No page refresh needed. Uninstall:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
dsh plugin --profile web remove dsh-plugin-tetris
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Working from source: `npm install && npm run build`, then
|
|
58
|
+
`dsh plugin --profile web add link:"$PWD"`.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT. The engine logic comes from [tetris-terminal](https://github.com/zlh124/tetris-terminal)
|
|
63
|
+
(MIT, jayzhu).
|
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# dsh-plugin-tetris
|
|
4
|
+
|
|
5
|
+
**趁 agent 干活的时候,在 DSH Web GUI 里来一局俄罗斯方块。**
|
|
6
|
+
|
|
7
|
+
[中文](README.md) | [English](README.en.md)
|
|
8
|
+
|
|
9
|
+
| 模式菜单 | 对局 |
|
|
10
|
+
|:---:|:---:|
|
|
11
|
+
|  |  |
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
## 背景
|
|
16
|
+
|
|
17
|
+
用 DSH 写代码的时候,等 agent 跑任务总有几十秒空档,于是把它做成了一个插件:
|
|
18
|
+
游戏面板挂在 DSH 的框架级浮动层上,agent 开始工作时自动出现;右下角常驻一个圆形
|
|
19
|
+
T 形方块图标,随时点开就能玩,面板会从图标的位置弹出。
|
|
20
|
+
|
|
21
|
+
引擎不是随手写的——它是我另一个项目
|
|
22
|
+
[**tetris-terminal**](https://github.com/zlh124/tetris-terminal)(Python 终端版俄罗斯方块)
|
|
23
|
+
的逐行 TypeScript 移植:7-bag、SRS 墙踢、Hold、Ghost、T-Spin、B2B、消行动画都和终端版一致,
|
|
24
|
+
连终端版的一些怪癖也一并保留了。规则和手感是它先做出来的。
|
|
25
|
+
|
|
26
|
+
> 觉得好玩的话,去给 [**tetris-terminal**](https://github.com/zlh124/tetris-terminal) 点个 ⭐ 吧。
|
|
27
|
+
|
|
28
|
+
## 操作
|
|
29
|
+
|
|
30
|
+
| 键 | 动作 |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `←` `→` / `A` `D` | 左右移动 |
|
|
33
|
+
| `↑` / `W` / `X` | 顺时针旋转 |
|
|
34
|
+
| `Z` | 逆时针旋转 |
|
|
35
|
+
| `↓` / `S` | 软降 |
|
|
36
|
+
| `空格` | 硬降 |
|
|
37
|
+
| `C` | Hold |
|
|
38
|
+
| `P` | 暂停 / 继续 |
|
|
39
|
+
|
|
40
|
+
先点一下棋盘再用键盘;聚焦后棋盘会有一圈绿色描边。标题栏的「焦点联动」滑块控制
|
|
41
|
+
"失焦自动暂停 + 对话结束把焦点交还游戏"。
|
|
42
|
+
|
|
43
|
+
## 安装
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
dsh plugin --profile web add dsh-plugin-tetris
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
装完不需要刷新页面。卸载:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
dsh plugin --profile web remove dsh-plugin-tetris
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
从源码开发:`npm install && npm run build`,然后
|
|
56
|
+
`dsh plugin --profile web add link:"$PWD"`。
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT。引擎逻辑来自 [tetris-terminal](https://github.com/zlh124/tetris-terminal)(MIT, jayzhu)。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Bundle patch layer for dsh-plugin-tetris.
|
|
2
|
+
#
|
|
3
|
+
# Applied when this package is listed in the profile's `dsh.profile.bundles`
|
|
4
|
+
# (`dsh plugin --profile web add link:<path>` appends it automatically), or when
|
|
5
|
+
# the same `insert` row is added to the profile's own cordis.patch.yml.
|
|
6
|
+
#
|
|
7
|
+
# A `dsh.client` row is what the client-modules node half scans into the
|
|
8
|
+
# browser roster, so this single row is all it takes to get the plugin into
|
|
9
|
+
# window.__DSH_BOOT__ and served from /plugins/dsh-plugin-tetris/client.js.
|
|
10
|
+
- insert:
|
|
11
|
+
- id: tetris
|
|
12
|
+
name: 'dsh-plugin-tetris'
|
package/docs/game.png
ADDED
|
Binary file
|
package/docs/menu.png
ADDED
|
Binary file
|