@capyclaw/rsp-suite 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/README.md +84 -2
- package/cordis.patch.yml +8 -0
- package/dsh-suite.json +81 -0
- package/package.json +39 -3
- package/skill/README.md +7 -0
- package/skill/contract/rsp-contract.json +389 -0
- package/skill/cordis.patch.yml +4 -0
- package/skill/package.json +33 -0
- package/skill/plugin.mjs +15 -0
- package/skill/skills/remote-screen/SKILL.md +120 -0
- package/workbench/contract/capabilities.json +171 -0
- package/workbench/lib/client.mjs +454 -0
- package/workbench/lib/descriptors.mjs +28 -0
- package/workbench/lib/host.mjs +111 -0
- package/workbench/lib/manager.mjs +333 -0
- package/workbench/lib/session-mode.mjs +68 -0
- package/workbench/lib/tools.mjs +385 -0
- package/workbench/lib/workbench.mjs +165 -0
- package/workbench/package.json +47 -0
- package/workbench/plugin.mjs +2 -0
- package/workbench/scripts/build-contract.mjs +41 -0
- package/workbench/scripts/drive.mjs +66 -0
- package/workbench/test/client.test.mjs +218 -0
- package/workbench/test/frames-prune.test.mjs +49 -0
- package/workbench/test/h264.test.mjs +101 -0
- package/workbench/test/live-persistent-smoke.mjs +29 -0
- package/workbench/test/live-smoke.mjs +109 -0
- package/workbench/test/mock-server.mjs +194 -0
- package/workbench/test/persistence.test.mjs +177 -0
- package/workbench/test/persistent.test.mjs +160 -0
- package/workbench/test/session-mode.test.mjs +118 -0
- package/workbench/test/workbench.test.mjs +385 -0
- package/workbench/ui/index.html +475 -0
- package/workbench/verify-e2e.mjs +44 -0
package/README.md
CHANGED
|
@@ -1,3 +1,85 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @capyclaw/rsp-suite — RSP/1 远程屏幕控制端套件
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把 **RSP/1(Remote Screen Protocol)** 的控制端接进 DSH 套件基建:AI 通过 `rsp_*` 工具
|
|
4
|
+
连接被控端设备 → 观察实时屏幕帧 → 注入鼠标/键盘/文本 → 抓帧验证,完成对远程设备的 AI 操控。
|
|
5
|
+
与 ppt-suite / browser-suite 同一套基建(toolHost / serviceHost / suite-kit / 描述符面 / skill)。
|
|
6
|
+
|
|
7
|
+
## 组成
|
|
8
|
+
|
|
9
|
+
| 包 | 角色 | 说明 |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `@capyclaw/rsp-workbench` | runtime | 控制端核心 + 10 个 `rsp_*` 工具 + HTTP/MCP 能力面 + 查看器(挂 `/capyclaw/rsp`) |
|
|
12
|
+
| `@capyclaw/rsp-skill-remote-screen` | skills | `remote-screen` 技能:观察→操控→验证 工作流与硬规则 |
|
|
13
|
+
|
|
14
|
+
## 工具面(rsp_*)
|
|
15
|
+
|
|
16
|
+
- `rsp_capabilities` / `rsp_status` — 契约与连接状态(先调它们)
|
|
17
|
+
- `rsp_connect` / `rsp_disconnect` — 连接/断开被控端(url 或 host+port,token;目标持久化)
|
|
18
|
+
- `rsp_screen` — 抓当前屏幕帧:JPEG 内联回模型 + 落盘路径 + 帧/逻辑尺寸
|
|
19
|
+
- `rsp_mouse` — move/down/up/click/scroll(clicks=2 双击;dy>0 向上滚)
|
|
20
|
+
- `rsp_key` — 物理键 down/up(DOM `KeyboardEvent.code` + modifiers,成对发送)
|
|
21
|
+
- `rsp_text` — Unicode 文本注入(绕过布局/IME;>4096 码元自动分片)
|
|
22
|
+
- `rsp_drag` — down→插值 move→up 拖拽
|
|
23
|
+
- `rsp_batch` — 多事件一次提交顺序注入,可末尾抓帧验证(减少模型往返)
|
|
24
|
+
|
|
25
|
+
**坐标人体工学**:鼠标/拖拽默认接受「最近一帧截图的像素坐标」(`space:"frame"`),
|
|
26
|
+
控制端自动按 帧尺寸→hello 逻辑尺寸 换算成逻辑点上线(协议合规);`space:"logical"` 直传。
|
|
27
|
+
|
|
28
|
+
## 人机同看(GUI 主区实时画面)
|
|
29
|
+
|
|
30
|
+
查看器 `/capyclaw/rsp/` 是双层结构:底层 `api/frame` 快照(保证静止时也有图),
|
|
31
|
+
上层 `api/screen.mjpg` 实时流(有变化时覆盖)。左下角显示「更新于 N 秒前」——
|
|
32
|
+
被控端是**变化驱动**的,屏幕静止时本来就不推新帧,这是正常现象。
|
|
33
|
+
|
|
34
|
+
主区显示走 portal-hud 的会话模式(与 ppt/browser 同语义):
|
|
35
|
+
|
|
36
|
+
- `workbench/lib/session-mode.mjs`:非 read 工具执行前把**调用者会话**钉到 `rsp`
|
|
37
|
+
(`workStore.claimSessionMode(sid,'rsp','rsp-workbench')`;会话 id 取自
|
|
38
|
+
`exec.agent.session.id`,MCP/HTTP 形态没有 exec 就不认领,绝不误锁);
|
|
39
|
+
- 认领成功后 portal-hud 把 `slug=rsp` 的 surface 摆到主区,用户随时人工介入;
|
|
40
|
+
- 会话已钉给别的工作台 → 工具报 `SESSION_MODE_LOCKED`(带 `lockedTo`),提示新开会话。
|
|
41
|
+
|
|
42
|
+
## 协议符合性(RSP/1)
|
|
43
|
+
|
|
44
|
+
- `/info` 校验 `protocol=="rsp/1"`、`format=="jpeg"`;未知字段忽略。
|
|
45
|
+
- 画面:`/screen.ws` 常驻(TEXT hello + BINARY JPEG),断线退避 1s→5s 重连;4001→鉴权失败。
|
|
46
|
+
查看器走 `/api/screen.mjpg` 服务端代理(MJPEG),**令牌不下发页面**。
|
|
47
|
+
- 操控:`/control.ws` seq/ack 优先,失败降级 `POST /control`;move 限速 ≤60/s;
|
|
48
|
+
断开时主动补发按下态的 up(配合被控端 §5.5 防卡键)。
|
|
49
|
+
- 错误模型:401/403/400/413/503 与 WS 4001/4003/4004 全映射为工具错误码 + 提示。
|
|
50
|
+
|
|
51
|
+
## 安装(suite-kit)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
node C/packages/capyclaw-suite-kit/bin/dsh-suite.mjs validate A/projects/rsp
|
|
55
|
+
# 连同已有本地 suite 一起安装(installSuites 会重写 dshSuiteKit.suites,必须全量传入)
|
|
56
|
+
node C/packages/capyclaw-suite-kit/bin/dsh-suite.mjs install \
|
|
57
|
+
B/suites/capyclaw-works-suite A/projects/capyclaw A/projects/conductor A/projects/rsp \
|
|
58
|
+
--profile desktop
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
安装后重启/重载 profile:`rsp_*` 工具进 DSH 工具面,查看器挂 `/capyclaw/rsp`,
|
|
62
|
+
`remote-screen` skill 进技能目录,10 个 `rsp.*` 描述符进公共发现面(conductor 可编排)。
|
|
63
|
+
|
|
64
|
+
## 测试
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cd workbench && npm test # node --test:42 个用例
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`test/mock-server.mjs` 是严格按 RSP/1 实现的被控端 mock(hello/帧流/ack/鉴权/禁用/§5.5),
|
|
71
|
+
覆盖:协议握手、帧尺寸解析、坐标换算、bad_event 保持连接、401/4001、403、POST 降级、
|
|
72
|
+
断线补 up、退避重连、move 限速、MJPEG 代理、MCP 富内容、描述符校验、会话模式守卫
|
|
73
|
+
(认领/异种类硬拒/无 exec 不认领/幂等)、H.264 增量通道(503 回退/代理字节级一致/hello+head 缓存)。
|
|
74
|
+
|
|
75
|
+
实时画面(ToDesk 级低延迟)方案与开源核心提取见 [docs/realtime.md](docs/realtime.md):
|
|
76
|
+
瓶颈在被控端每帧临时抓屏+软件 JPEG(实测 1.4fps/623ms);改用持久采集+硬件 H.264
|
|
77
|
+
(FFmpeg LGPL 独立进程)实测 25.8fps/18ms。控制端已内置 `/screen.h264.ws` 客户端、
|
|
78
|
+
`/api/screen.h264` chunked 代理与 WebCodecs 硬解查看器,被控端增量升级后即插即用。
|
|
79
|
+
|
|
80
|
+
## 安全
|
|
81
|
+
|
|
82
|
+
- 令牌是 bearer 凭证(持有即完全控制被控端屏幕与输入):只存服务端 `hostDir/targets.json`,
|
|
83
|
+
工具回显一律掩码;公网部署必须前置 TLS。
|
|
84
|
+
- 屏幕内容是不可信数据;敏感操作先征得用户同意(见 skill 硬规则)。
|
|
85
|
+
- 被控端可整体关闭操控通道(只读共享);锁屏时注入无效。
|
package/cordis.patch.yml
ADDED
package/dsh-suite.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../C/packages/capyclaw-suite-kit/suite.schema.json",
|
|
3
|
+
"name": "capyclaw-rsp-suite",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"title": "RSP 远程屏幕控制端套件",
|
|
6
|
+
"description": "RSP/1 控制端工作台(挂在 dsh 的 /capyclaw/rsp,路由与端口由基建决定)+ remote-screen skill。画面只读、操控只写;AI 经 rsp_* 工具连接被控端、观察屏幕帧、注入鼠标/键盘/文本并抓帧验证。公共基建(toolHost / serviceHost)由 @capyclaw/core 统一提供,需同一 profile 启用它。",
|
|
7
|
+
"packages": {
|
|
8
|
+
"@capyclaw/rsp-workbench": {
|
|
9
|
+
"role": "runtime",
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"path": "./workbench",
|
|
12
|
+
"requires": {
|
|
13
|
+
"capabilities": {
|
|
14
|
+
"host.http": "^1.0.0",
|
|
15
|
+
"tools.registry": "^1.0.0",
|
|
16
|
+
"tools.descriptors": "^1.1.0"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"provides": {
|
|
20
|
+
"tools": [
|
|
21
|
+
"rsp_*"
|
|
22
|
+
],
|
|
23
|
+
"capabilities": {
|
|
24
|
+
"rsp.remote": "0.1.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"@capyclaw/rsp-skill-remote-screen": {
|
|
29
|
+
"role": "skills",
|
|
30
|
+
"version": "0.1.0",
|
|
31
|
+
"path": "./skill",
|
|
32
|
+
"requires": {
|
|
33
|
+
"@capyclaw/rsp-workbench": "^0.1.0",
|
|
34
|
+
"capabilities": {
|
|
35
|
+
"rsp.remote": "^0.1.0"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"provides": {
|
|
39
|
+
"skills": [
|
|
40
|
+
"remote-screen"
|
|
41
|
+
],
|
|
42
|
+
"capabilities": {
|
|
43
|
+
"rsp.workflows": "0.1.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"@capyclaw/tool-host": {
|
|
48
|
+
"role": "provider",
|
|
49
|
+
"version": "^0.3.0",
|
|
50
|
+
"provides": {
|
|
51
|
+
"capabilities": {
|
|
52
|
+
"tools.registry": "1.1.0",
|
|
53
|
+
"tools.descriptors": "1.1.0"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"@capyclaw/service-host": {
|
|
58
|
+
"role": "provider",
|
|
59
|
+
"version": "^0.1.5",
|
|
60
|
+
"provides": {
|
|
61
|
+
"capabilities": {
|
|
62
|
+
"host.http": "1.0.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"rows": [
|
|
68
|
+
{
|
|
69
|
+
"id": "rsp-workbench",
|
|
70
|
+
"name": "@capyclaw/rsp-workbench",
|
|
71
|
+
"config": {
|
|
72
|
+
"mountPath": "/capyclaw/rsp"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "rsp-skill-remote-screen",
|
|
77
|
+
"name": "@capyclaw/rsp-skill-remote-screen"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"checks": []
|
|
81
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capyclaw/rsp-suite",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RSP/1 远程屏幕控制端套件:workbench(画面只读 + 操控只写,rsp_* 工具)+ remote-screen skill。接入 DSH 套件基建,AI 经接口操控被控端设备。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": { "node": ">=20" },
|
|
7
|
+
"dsh": {
|
|
8
|
+
"bundle": { "patch": "./cordis.patch.yml" },
|
|
9
|
+
"suite": "./dsh-suite.json",
|
|
10
|
+
"category": "service",
|
|
11
|
+
"platform": "both"
|
|
12
|
+
},
|
|
13
|
+
"meta": {
|
|
14
|
+
"title": "RSP 远程屏幕控制端套件",
|
|
15
|
+
"description": "RSP/1 控制端:连接被控端 → 观察屏幕帧 → 注入鼠标/键盘/文本 → 抓帧验证。"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"suite:validate": "node ../../../C/packages/capyclaw-suite-kit/bin/dsh-suite.mjs validate .",
|
|
19
|
+
"suite:compose": "node ../../../C/packages/capyclaw-suite-kit/bin/dsh-suite.mjs compose . --out .",
|
|
20
|
+
"test": "npm --prefix workbench test"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dsh-suite.json",
|
|
24
|
+
"cordis.patch.yml",
|
|
25
|
+
"workbench/",
|
|
26
|
+
"skill/",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@capyclaw/rsp-workbench": "file:./workbench",
|
|
31
|
+
"@capyclaw/rsp-skill-remote-screen": "file:./skill",
|
|
32
|
+
"@capyclaw/foundation": "^0.1.9",
|
|
33
|
+
"@capyclaw/plugin-kit": "^0.2.6",
|
|
34
|
+
"@capyclaw/service-host": "^0.1.5",
|
|
35
|
+
"@capyclaw/suite-kit": "^0.2.0",
|
|
36
|
+
"@capyclaw/tool-host": "^0.3.0"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
}
|
|
6
42
|
}
|
package/skill/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# @capyclaw/rsp-skill-remote-screen
|
|
2
|
+
|
|
3
|
+
RSP/1 远程屏幕操控技能(`remote-screen`)。配合 `@capyclaw/rsp-workbench` 的 `rsp_*` 工具:
|
|
4
|
+
连接被控端 → `rsp_screen` 观察 → 按帧像素坐标操控 → 抓帧验证。
|
|
5
|
+
|
|
6
|
+
契约真源:`contract/rsp-contract.json`(由 `workbench/scripts/build-contract.mjs` 从工具注册表生成)。
|
|
7
|
+
工作流与硬规则见 `skills/remote-screen/SKILL.md`。
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contractVersion": "0.1.0",
|
|
3
|
+
"packageVersion": "0.1.0",
|
|
4
|
+
"editorUrl": "",
|
|
5
|
+
"editorPath": "",
|
|
6
|
+
"toolCount": 10,
|
|
7
|
+
"tools": [
|
|
8
|
+
{
|
|
9
|
+
"name": "rsp_capabilities",
|
|
10
|
+
"kind": "read",
|
|
11
|
+
"since": "0.1.0",
|
|
12
|
+
"capability": "rsp.session",
|
|
13
|
+
"description": "返回 RSP 控制端契约(协议 rsp/1、工具清单、能力)与当前连接状态。动作前先调用它确认工具可用、被控端已连接。",
|
|
14
|
+
"inputSchema": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"properties": {},
|
|
17
|
+
"additionalProperties": false
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "rsp_connect",
|
|
22
|
+
"kind": "control",
|
|
23
|
+
"since": "0.1.0",
|
|
24
|
+
"capability": "rsp.session",
|
|
25
|
+
"description": "连接被控端:传 url(http://host:port)或 host+port,以及 token。校验 rsp/1、打开画面流与操控通道并持久化目标。无参数时重连上次目标。",
|
|
26
|
+
"inputSchema": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"url": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "被控端基址,如 http://192.168.1.5:8765"
|
|
32
|
+
},
|
|
33
|
+
"host": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "主机名/IP(与 url 二选一)"
|
|
36
|
+
},
|
|
37
|
+
"port": {
|
|
38
|
+
"type": "integer",
|
|
39
|
+
"description": "端口,默认 8765"
|
|
40
|
+
},
|
|
41
|
+
"token": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "访问令牌(bearer,必填于新目标)"
|
|
44
|
+
},
|
|
45
|
+
"name": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"description": "目标别名(可选)"
|
|
48
|
+
},
|
|
49
|
+
"persist": {
|
|
50
|
+
"type": "boolean",
|
|
51
|
+
"description": "是否持久化目标,默认 true"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"additionalProperties": false
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "rsp_disconnect",
|
|
59
|
+
"kind": "control",
|
|
60
|
+
"since": "0.1.0",
|
|
61
|
+
"capability": "rsp.session",
|
|
62
|
+
"description": "断开被控端连接(停止画面采集与操控)。forget=true 同时清除已保存目标。",
|
|
63
|
+
"inputSchema": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"properties": {
|
|
66
|
+
"forget": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"description": "是否清除保存的目标,默认 false"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "rsp_status",
|
|
76
|
+
"kind": "read",
|
|
77
|
+
"since": "0.1.0",
|
|
78
|
+
"capability": "rsp.session",
|
|
79
|
+
"description": "查看连接状态:目标、画面/操控通道状态、hello 逻辑尺寸、最近帧尺寸/时延、观众数、引擎权限诊断、当前按下的键/钮。",
|
|
80
|
+
"inputSchema": {
|
|
81
|
+
"type": "object",
|
|
82
|
+
"properties": {},
|
|
83
|
+
"additionalProperties": false
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "rsp_screen",
|
|
88
|
+
"kind": "read",
|
|
89
|
+
"since": "0.1.0",
|
|
90
|
+
"capability": "rsp.screen",
|
|
91
|
+
"description": "获取被控端当前屏幕帧(JPEG 内联回模型 + 落盘路径 + 帧/逻辑尺寸)。fresh=true 等待一帧新画面(动作后验证用)。返回的帧像素坐标可直接用于 rsp_mouse/rsp_drag(默认 space=frame)。",
|
|
92
|
+
"inputSchema": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"fresh": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"description": "等待比调用时刻更新的一帧,默认 false(取最近帧)"
|
|
98
|
+
},
|
|
99
|
+
"waitMs": {
|
|
100
|
+
"type": "integer",
|
|
101
|
+
"description": "fresh 等待上限毫秒,默认 2000"
|
|
102
|
+
},
|
|
103
|
+
"save": {
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"description": "是否落盘 JPEG,默认 true"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"additionalProperties": false
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "rsp_mouse",
|
|
113
|
+
"kind": "write",
|
|
114
|
+
"since": "0.1.0",
|
|
115
|
+
"capability": "rsp.control",
|
|
116
|
+
"description": "注入单个鼠标事件。action=move/down/up/click/scroll。x/y 默认按最近帧像素坐标(space=frame),自动换算逻辑点;space=logical 直传。click=原子按下+抬起(clicks=2 双击);scroll 用 dx/dy(dy>0 向上滚)。拖拽请用 rsp_drag 或 down→move→up。",
|
|
117
|
+
"inputSchema": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"properties": {
|
|
120
|
+
"action": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"enum": [
|
|
123
|
+
"move",
|
|
124
|
+
"down",
|
|
125
|
+
"up",
|
|
126
|
+
"click",
|
|
127
|
+
"scroll"
|
|
128
|
+
],
|
|
129
|
+
"description": "鼠标动作"
|
|
130
|
+
},
|
|
131
|
+
"x": {
|
|
132
|
+
"type": "number",
|
|
133
|
+
"description": "横坐标(move/down/up/click 必填)"
|
|
134
|
+
},
|
|
135
|
+
"y": {
|
|
136
|
+
"type": "number",
|
|
137
|
+
"description": "纵坐标(move/down/up/click 必填)"
|
|
138
|
+
},
|
|
139
|
+
"button": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"enum": [
|
|
142
|
+
"left",
|
|
143
|
+
"right",
|
|
144
|
+
"middle"
|
|
145
|
+
],
|
|
146
|
+
"description": "按键,默认 left"
|
|
147
|
+
},
|
|
148
|
+
"clicks": {
|
|
149
|
+
"type": "integer",
|
|
150
|
+
"description": "点击计数 1…3,默认 1(双击=2)"
|
|
151
|
+
},
|
|
152
|
+
"dx": {
|
|
153
|
+
"type": "integer",
|
|
154
|
+
"description": "scroll 横向增量(>0 向右)"
|
|
155
|
+
},
|
|
156
|
+
"dy": {
|
|
157
|
+
"type": "integer",
|
|
158
|
+
"description": "scroll 纵向增量(>0 向上)"
|
|
159
|
+
},
|
|
160
|
+
"space": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"enum": [
|
|
163
|
+
"frame",
|
|
164
|
+
"logical"
|
|
165
|
+
],
|
|
166
|
+
"description": "坐标空间,默认 frame(最近帧像素)"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"action"
|
|
171
|
+
],
|
|
172
|
+
"additionalProperties": false
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "rsp_key",
|
|
177
|
+
"kind": "write",
|
|
178
|
+
"since": "0.1.0",
|
|
179
|
+
"capability": "rsp.control",
|
|
180
|
+
"description": "注入物理键事件(DOM KeyboardEvent.code)。action=down/up,必须成对。快捷键用 modifiers(cmd/ctrl/alt/shift),如 Cmd+C:down KeyA modifiers=[\"cmd\"] 再 up。IME/粘贴文本请用 rsp_text。",
|
|
181
|
+
"inputSchema": {
|
|
182
|
+
"type": "object",
|
|
183
|
+
"properties": {
|
|
184
|
+
"action": {
|
|
185
|
+
"type": "string",
|
|
186
|
+
"enum": [
|
|
187
|
+
"down",
|
|
188
|
+
"up"
|
|
189
|
+
],
|
|
190
|
+
"description": "按下/抬起"
|
|
191
|
+
},
|
|
192
|
+
"code": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "物理键位,如 KeyA/Enter/ArrowLeft/MetaLeft/F5"
|
|
195
|
+
},
|
|
196
|
+
"modifiers": {
|
|
197
|
+
"type": "array",
|
|
198
|
+
"items": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"enum": [
|
|
201
|
+
"cmd",
|
|
202
|
+
"ctrl",
|
|
203
|
+
"alt",
|
|
204
|
+
"shift"
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
"description": "同时按住的修饰键"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"required": [
|
|
211
|
+
"action",
|
|
212
|
+
"code"
|
|
213
|
+
],
|
|
214
|
+
"additionalProperties": false
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": "rsp_text",
|
|
219
|
+
"kind": "write",
|
|
220
|
+
"since": "0.1.0",
|
|
221
|
+
"capability": "rsp.control",
|
|
222
|
+
"description": "以 Unicode 注入通道输入文本(绕过键位布局与输入法),适合 IME 合成结果/粘贴/软键盘。超过 4096 UTF-16 码元自动分片。物理按键/快捷键请用 rsp_key。",
|
|
223
|
+
"inputSchema": {
|
|
224
|
+
"type": "object",
|
|
225
|
+
"properties": {
|
|
226
|
+
"text": {
|
|
227
|
+
"type": "string",
|
|
228
|
+
"description": "要输入的文本"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"required": [
|
|
232
|
+
"text"
|
|
233
|
+
],
|
|
234
|
+
"additionalProperties": false
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": "rsp_drag",
|
|
239
|
+
"kind": "write",
|
|
240
|
+
"since": "0.1.0",
|
|
241
|
+
"capability": "rsp.control",
|
|
242
|
+
"description": "拖拽:从 (fromX,fromY) 按住拖到 (toX,toY) 再抬起,中间插值 move(拖拽语义)。坐标默认最近帧像素(space=frame)。steps 控制中间步数(默认 12)。",
|
|
243
|
+
"inputSchema": {
|
|
244
|
+
"type": "object",
|
|
245
|
+
"properties": {
|
|
246
|
+
"fromX": {
|
|
247
|
+
"type": "number"
|
|
248
|
+
},
|
|
249
|
+
"fromY": {
|
|
250
|
+
"type": "number"
|
|
251
|
+
},
|
|
252
|
+
"toX": {
|
|
253
|
+
"type": "number"
|
|
254
|
+
},
|
|
255
|
+
"toY": {
|
|
256
|
+
"type": "number"
|
|
257
|
+
},
|
|
258
|
+
"steps": {
|
|
259
|
+
"type": "integer",
|
|
260
|
+
"description": "中间 move 步数 2…60,默认 12"
|
|
261
|
+
},
|
|
262
|
+
"button": {
|
|
263
|
+
"type": "string",
|
|
264
|
+
"enum": [
|
|
265
|
+
"left",
|
|
266
|
+
"right",
|
|
267
|
+
"middle"
|
|
268
|
+
],
|
|
269
|
+
"description": "默认 left"
|
|
270
|
+
},
|
|
271
|
+
"space": {
|
|
272
|
+
"type": "string",
|
|
273
|
+
"enum": [
|
|
274
|
+
"frame",
|
|
275
|
+
"logical"
|
|
276
|
+
],
|
|
277
|
+
"description": "默认 frame"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"required": [
|
|
281
|
+
"fromX",
|
|
282
|
+
"fromY",
|
|
283
|
+
"toX",
|
|
284
|
+
"toY"
|
|
285
|
+
],
|
|
286
|
+
"additionalProperties": false
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"name": "rsp_batch",
|
|
291
|
+
"kind": "write",
|
|
292
|
+
"since": "0.1.0",
|
|
293
|
+
"capability": "rsp.control",
|
|
294
|
+
"description": "一次提交多个输入事件顺序注入(减少往返)。events 每项是 mouse/key/text 对象(cmd 可省略按字段推断);mouse 坐标默认 space=frame。可选 gapMs 事件间隔、screenshot=true 末尾抓一帧新画面回模型。典型:填账号+填密码+勾选+点登录。",
|
|
295
|
+
"inputSchema": {
|
|
296
|
+
"type": "object",
|
|
297
|
+
"properties": {
|
|
298
|
+
"events": {
|
|
299
|
+
"type": "array",
|
|
300
|
+
"description": "事件数组(mouse/key/text)",
|
|
301
|
+
"items": {
|
|
302
|
+
"type": "object"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"gapMs": {
|
|
306
|
+
"type": "integer",
|
|
307
|
+
"description": "事件间隔毫秒,默认 0"
|
|
308
|
+
},
|
|
309
|
+
"screenshot": {
|
|
310
|
+
"type": "boolean",
|
|
311
|
+
"description": "末尾抓一帧新画面,默认 false"
|
|
312
|
+
},
|
|
313
|
+
"space": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"enum": [
|
|
316
|
+
"frame",
|
|
317
|
+
"logical"
|
|
318
|
+
],
|
|
319
|
+
"description": "mouse 坐标空间默认值,默认 frame"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"required": [
|
|
323
|
+
"events"
|
|
324
|
+
],
|
|
325
|
+
"additionalProperties": false
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
],
|
|
329
|
+
"features": [
|
|
330
|
+
"connect",
|
|
331
|
+
"disconnect",
|
|
332
|
+
"status",
|
|
333
|
+
"capabilities",
|
|
334
|
+
"screen",
|
|
335
|
+
"mouse",
|
|
336
|
+
"key",
|
|
337
|
+
"text",
|
|
338
|
+
"drag",
|
|
339
|
+
"batch"
|
|
340
|
+
],
|
|
341
|
+
"capabilities": [
|
|
342
|
+
{
|
|
343
|
+
"id": "rsp.session",
|
|
344
|
+
"title": "RSP 会话",
|
|
345
|
+
"description": "连接/断开被控端、查看契约与状态。",
|
|
346
|
+
"tags": [
|
|
347
|
+
"rsp",
|
|
348
|
+
"remote-screen",
|
|
349
|
+
"session"
|
|
350
|
+
],
|
|
351
|
+
"tools": [
|
|
352
|
+
"rsp_capabilities",
|
|
353
|
+
"rsp_connect",
|
|
354
|
+
"rsp_disconnect",
|
|
355
|
+
"rsp_status"
|
|
356
|
+
]
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"id": "rsp.screen",
|
|
360
|
+
"title": "RSP 画面",
|
|
361
|
+
"description": "读取被控端实时屏幕帧(只读)。",
|
|
362
|
+
"tags": [
|
|
363
|
+
"rsp",
|
|
364
|
+
"remote-screen",
|
|
365
|
+
"screen"
|
|
366
|
+
],
|
|
367
|
+
"tools": [
|
|
368
|
+
"rsp_screen"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"id": "rsp.control",
|
|
373
|
+
"title": "RSP 操控",
|
|
374
|
+
"description": "向被控端注入鼠标/键盘/文本/拖拽/批量输入(只写)。",
|
|
375
|
+
"tags": [
|
|
376
|
+
"rsp",
|
|
377
|
+
"remote-screen",
|
|
378
|
+
"control"
|
|
379
|
+
],
|
|
380
|
+
"tools": [
|
|
381
|
+
"rsp_mouse",
|
|
382
|
+
"rsp_key",
|
|
383
|
+
"rsp_text",
|
|
384
|
+
"rsp_drag",
|
|
385
|
+
"rsp_batch"
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
]
|
|
389
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@capyclaw/rsp-skill-remote-screen",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "RSP/1 远程屏幕操控技能:教 AI 用 rsp_* 工具连接被控端、观察屏幕帧、注入鼠标/键盘/文本并抓帧验证。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "plugin.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./plugin.mjs",
|
|
9
|
+
"./package.json": "./package.json"
|
|
10
|
+
},
|
|
11
|
+
"engines": { "node": ">=20" },
|
|
12
|
+
"dsh": {
|
|
13
|
+
"bundle": { "patch": "./cordis.patch.yml" },
|
|
14
|
+
"category": "skills",
|
|
15
|
+
"platform": "both"
|
|
16
|
+
},
|
|
17
|
+
"meta": {
|
|
18
|
+
"title": "RSP 远程屏幕操控技能",
|
|
19
|
+
"description": "remote-screen:RSP/1 控制端工作流(连接 → 观察 → 操控 → 验证)。"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"plugin.mjs",
|
|
23
|
+
"skills/",
|
|
24
|
+
"contract/",
|
|
25
|
+
"cordis.patch.yml",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@capyclaw/foundation": "^0.1.9"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"private": true
|
|
33
|
+
}
|
package/skill/plugin.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @capyclaw/rsp-skill-remote-screen:单 skill provider(foundation ABI),注册 remote-screen 技能。 */
|
|
2
|
+
import { createPlugin, skillProvider } from '@capyclaw/foundation/abi'
|
|
3
|
+
|
|
4
|
+
export const { name, inject, apply } = createPlugin({
|
|
5
|
+
name: 'rsp-skill-remote-screen',
|
|
6
|
+
requires: ['os.skills@^1'],
|
|
7
|
+
implements: [skillProvider({
|
|
8
|
+
name: 'dsh-rsp-remote-screen',
|
|
9
|
+
skill: './skills/remote-screen',
|
|
10
|
+
contract: './contract/rsp-contract.json',
|
|
11
|
+
note: (version, skillName) => (skillName === 'remote-screen'
|
|
12
|
+
? ''
|
|
13
|
+
: '契约:RSP Workbench ' + version + '。动作前先调用 rsp_capabilities;工具缺失或 major 不一致时停止,并提示用户安装/升级 @capyclaw/rsp-suite。'),
|
|
14
|
+
})],
|
|
15
|
+
}, import.meta.url)
|