@capyclaw/rsp-suite 0.0.0-stage → 0.1.1
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 +91 -0
- package/node_modules/@capyclaw/foundation/README.md +51 -0
- package/node_modules/@capyclaw/foundation/abi/assets.mjs +26 -0
- package/node_modules/@capyclaw/foundation/abi/bridge.mjs +88 -0
- package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
- package/node_modules/@capyclaw/foundation/abi/index.mjs +50 -0
- package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
- package/node_modules/@capyclaw/foundation/abi/loader.mjs +352 -0
- package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
- package/node_modules/@capyclaw/foundation/abi/spec.mjs +258 -0
- package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
- package/node_modules/@capyclaw/foundation/abi/version.mjs +140 -0
- package/node_modules/@capyclaw/foundation/abi/visibility.mjs +90 -0
- package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
- package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +72 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +69 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +120 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
- package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
- package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
- package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +38 -0
- package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +88 -0
- package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +54 -0
- package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +187 -0
- package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
- package/node_modules/@capyclaw/foundation/lib/kernel.mjs +195 -0
- package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +115 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
- package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +198 -0
- package/node_modules/@capyclaw/foundation/package.json +53 -0
- package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
- package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
- package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
- package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
- package/node_modules/@capyclaw/plugin-kit/package.json +72 -0
- package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
- package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat.mjs +26 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +60 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
- package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
- package/node_modules/@capyclaw/plugin-kit/src/ledger.mjs +151 -0
- package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
- package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
- package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
- package/node_modules/@capyclaw/plugin-kit/src/service/static.mjs +79 -0
- package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
- package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +57 -0
- package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
- package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
- package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
- package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +664 -0
- package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
- package/node_modules/@capyclaw/rsp-skill-remote-screen/README.md +7 -0
- package/node_modules/@capyclaw/rsp-skill-remote-screen/contract/rsp-contract.json +478 -0
- package/node_modules/@capyclaw/rsp-skill-remote-screen/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/rsp-skill-remote-screen/package.json +33 -0
- package/node_modules/@capyclaw/rsp-skill-remote-screen/plugin.mjs +15 -0
- package/node_modules/@capyclaw/rsp-skill-remote-screen/skills/remote-screen/SKILL.md +131 -0
- package/node_modules/@capyclaw/rsp-workbench/contract/capabilities.json +203 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/client.mjs +681 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/descriptors.mjs +28 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/host.mjs +51 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/manager.mjs +333 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/session-mode.mjs +68 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/tools.mjs +485 -0
- package/node_modules/@capyclaw/rsp-workbench/lib/workbench.mjs +184 -0
- package/node_modules/@capyclaw/rsp-workbench/package.json +47 -0
- package/node_modules/@capyclaw/rsp-workbench/plugin.mjs +17 -0
- package/node_modules/@capyclaw/rsp-workbench/ui/index.html +578 -0
- package/node_modules/@capyclaw/service-host/README.md +86 -0
- package/node_modules/@capyclaw/service-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/service-host/dsh-suite.json +29 -0
- package/node_modules/@capyclaw/service-host/lib/host.mjs +22 -0
- package/node_modules/@capyclaw/service-host/package.json +60 -0
- package/node_modules/@capyclaw/service-host/src/index.mjs +597 -0
- package/node_modules/@capyclaw/service-host/src/tuning.mjs +63 -0
- package/node_modules/@capyclaw/suite-kit/README.md +289 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-domain.mjs +98 -0
- package/node_modules/@capyclaw/suite-kit/bin/dsh-suite.mjs +174 -0
- package/node_modules/@capyclaw/suite-kit/client/embed.js +35 -0
- package/node_modules/@capyclaw/suite-kit/domain.schema.json +129 -0
- package/node_modules/@capyclaw/suite-kit/package.json +58 -0
- package/node_modules/@capyclaw/suite-kit/src/activation-registry.mjs +184 -0
- package/node_modules/@capyclaw/suite-kit/src/artifacts.mjs +131 -0
- package/node_modules/@capyclaw/suite-kit/src/capability.mjs +181 -0
- package/node_modules/@capyclaw/suite-kit/src/compose.mjs +201 -0
- package/node_modules/@capyclaw/suite-kit/src/domain.mjs +138 -0
- package/node_modules/@capyclaw/suite-kit/src/embed.mjs +81 -0
- package/node_modules/@capyclaw/suite-kit/src/host.mjs +251 -0
- package/node_modules/@capyclaw/suite-kit/src/index.mjs +24 -0
- package/node_modules/@capyclaw/suite-kit/src/manifest.mjs +263 -0
- package/node_modules/@capyclaw/suite-kit/src/orchestration.mjs +100 -0
- package/node_modules/@capyclaw/suite-kit/src/profile.mjs +584 -0
- package/node_modules/@capyclaw/suite-kit/src/surface.mjs +28 -0
- package/node_modules/@capyclaw/suite-kit/suite.schema.json +128 -0
- package/node_modules/@capyclaw/tool-host/README.md +56 -0
- package/node_modules/@capyclaw/tool-host/cordis.patch.yml +4 -0
- package/node_modules/@capyclaw/tool-host/dsh-suite.json +30 -0
- package/node_modules/@capyclaw/tool-host/lib/host.mjs +46 -0
- package/node_modules/@capyclaw/tool-host/package.json +59 -0
- package/node_modules/@capyclaw/tool-host/src/admit-images.mjs +80 -0
- package/node_modules/@capyclaw/tool-host/src/caller-session.mjs +25 -0
- package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +166 -0
- package/node_modules/@capyclaw/tool-host/src/index.mjs +461 -0
- package/node_modules/@capyclaw/tool-host/src/mode-gate.mjs +272 -0
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +539 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +142 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +751 -0
- package/node_modules/ws/lib/sender.js +610 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1440 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +53 -4
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 极简跨平台 ZIP 读写(store + deflate 读,store 写;无外部依赖)——全仓单一真源。
|
|
3
|
+
*
|
|
4
|
+
* 之前三处实现各持一份(plugin-development 写 / tools-plugin-release 读 /
|
|
5
|
+
* @capyclaw/suite-kit zip-read 读),本模块合并之。旧位置保留兼容 shim。
|
|
6
|
+
*
|
|
7
|
+
* 写入:store 模式(内容不压缩,跨平台稳定,产物可被任何标准读取器读)。
|
|
8
|
+
* 读取:支持 store(0) 与 deflate(8);接受 Buffer 或文件路径——本地文件与
|
|
9
|
+
* 远端下载源共用同一条校验/解包路径。
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'node:fs'
|
|
12
|
+
import path from 'node:path'
|
|
13
|
+
import zlib from 'node:zlib'
|
|
14
|
+
|
|
15
|
+
/* ------------------------------------------------------------------ 写入 */
|
|
16
|
+
|
|
17
|
+
const CRC_TABLE = (() => {
|
|
18
|
+
const table = new Uint32Array(256)
|
|
19
|
+
for (let n = 0; n < 256; n++) {
|
|
20
|
+
let c = n
|
|
21
|
+
for (let k = 0; k < 8; k++) c = (c & 1) ? (0xedb88320 ^ (c >>> 1)) : (c >>> 1)
|
|
22
|
+
table[n] = c >>> 0
|
|
23
|
+
}
|
|
24
|
+
return table
|
|
25
|
+
})()
|
|
26
|
+
|
|
27
|
+
function crc32(buffer) {
|
|
28
|
+
let crc = 0xffffffff
|
|
29
|
+
for (let i = 0; i < buffer.length; i++) crc = CRC_TABLE[(crc ^ buffer[i]) & 0xff] ^ (crc >>> 8)
|
|
30
|
+
return (crc ^ 0xffffffff) >>> 0
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function dosDateTime(date = new Date()) {
|
|
34
|
+
const year = Math.max(1980, date.getFullYear())
|
|
35
|
+
const time = ((date.getHours() & 0x1f) << 11) | ((date.getMinutes() & 0x3f) << 5) | (Math.floor(date.getSeconds() / 2) & 0x1f)
|
|
36
|
+
const day = (((year - 1980) & 0x7f) << 9) | (((date.getMonth() + 1) & 0x0f) << 5) | (date.getDate() & 0x1f)
|
|
37
|
+
return { time, day }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function walkFiles(dir, base = dir) {
|
|
41
|
+
const out = []
|
|
42
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
43
|
+
const full = path.join(dir, entry.name)
|
|
44
|
+
if (entry.isDirectory()) out.push(...walkFiles(full, base))
|
|
45
|
+
else if (entry.isFile()) out.push(path.relative(base, full).replace(/\\/g, '/'))
|
|
46
|
+
}
|
|
47
|
+
return out.sort()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 把目录写成 store 模式 ZIP。返回打包的相对路径列表。 */
|
|
51
|
+
export function writeZipFromDir(sourceDir, outFile) {
|
|
52
|
+
const files = walkFiles(sourceDir)
|
|
53
|
+
const now = dosDateTime()
|
|
54
|
+
const localParts = []
|
|
55
|
+
const centralParts = []
|
|
56
|
+
let offset = 0
|
|
57
|
+
|
|
58
|
+
for (const name of files) {
|
|
59
|
+
const data = fs.readFileSync(path.join(sourceDir, name))
|
|
60
|
+
const nameBytes = Buffer.from(name, 'utf8')
|
|
61
|
+
const crc = crc32(data)
|
|
62
|
+
|
|
63
|
+
const local = Buffer.alloc(30)
|
|
64
|
+
local.writeUInt32LE(0x04034b50, 0)
|
|
65
|
+
local.writeUInt16LE(20, 4)
|
|
66
|
+
local.writeUInt16LE(0x0800, 6)
|
|
67
|
+
local.writeUInt16LE(0, 8)
|
|
68
|
+
local.writeUInt16LE(now.time, 10)
|
|
69
|
+
local.writeUInt16LE(now.day, 12)
|
|
70
|
+
local.writeUInt32LE(crc, 14)
|
|
71
|
+
local.writeUInt32LE(data.length, 18)
|
|
72
|
+
local.writeUInt32LE(data.length, 22)
|
|
73
|
+
local.writeUInt16LE(nameBytes.length, 26)
|
|
74
|
+
local.writeUInt16LE(0, 28)
|
|
75
|
+
localParts.push(local, nameBytes, data)
|
|
76
|
+
|
|
77
|
+
const central = Buffer.alloc(46)
|
|
78
|
+
central.writeUInt32LE(0x02014b50, 0)
|
|
79
|
+
central.writeUInt16LE(20, 4)
|
|
80
|
+
central.writeUInt16LE(20, 6)
|
|
81
|
+
central.writeUInt16LE(0x0800, 8)
|
|
82
|
+
central.writeUInt16LE(0, 10)
|
|
83
|
+
central.writeUInt16LE(now.time, 12)
|
|
84
|
+
central.writeUInt16LE(now.day, 14)
|
|
85
|
+
central.writeUInt32LE(crc, 16)
|
|
86
|
+
central.writeUInt32LE(data.length, 20)
|
|
87
|
+
central.writeUInt32LE(data.length, 24)
|
|
88
|
+
central.writeUInt16LE(nameBytes.length, 28)
|
|
89
|
+
central.writeUInt16LE(0, 30)
|
|
90
|
+
central.writeUInt16LE(0, 32)
|
|
91
|
+
central.writeUInt16LE(0, 34)
|
|
92
|
+
central.writeUInt16LE(0, 36)
|
|
93
|
+
central.writeUInt32LE(0, 38)
|
|
94
|
+
central.writeUInt32LE(offset, 42)
|
|
95
|
+
centralParts.push(central, nameBytes)
|
|
96
|
+
|
|
97
|
+
offset += local.length + nameBytes.length + data.length
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const centralBuffer = Buffer.concat(centralParts)
|
|
101
|
+
const eocd = Buffer.alloc(22)
|
|
102
|
+
eocd.writeUInt32LE(0x06054b50, 0)
|
|
103
|
+
eocd.writeUInt16LE(0, 4)
|
|
104
|
+
eocd.writeUInt16LE(0, 6)
|
|
105
|
+
eocd.writeUInt16LE(files.length, 8)
|
|
106
|
+
eocd.writeUInt16LE(files.length, 10)
|
|
107
|
+
eocd.writeUInt32LE(centralBuffer.length, 12)
|
|
108
|
+
eocd.writeUInt32LE(offset, 16)
|
|
109
|
+
eocd.writeUInt16LE(0, 20)
|
|
110
|
+
|
|
111
|
+
fs.mkdirSync(path.dirname(outFile), { recursive: true })
|
|
112
|
+
fs.writeFileSync(outFile, Buffer.concat([...localParts, centralBuffer, eocd]))
|
|
113
|
+
return files
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* ------------------------------------------------------------------ 读取 */
|
|
117
|
+
|
|
118
|
+
function locateEocd(data, label) {
|
|
119
|
+
for (let i = data.length - 22; i >= 0; i--) {
|
|
120
|
+
if (data.readUInt32LE(i) === 0x06054b50) return i
|
|
121
|
+
}
|
|
122
|
+
throw new Error(`不是有效的 ZIP: ${label}`)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 列出 ZIP 全部条目名。
|
|
127
|
+
* @param {Buffer|string} input - ZIP 字节或文件路径
|
|
128
|
+
*/
|
|
129
|
+
export function listZipEntryNames(input, label = 'zip') {
|
|
130
|
+
const data = Buffer.isBuffer(input) ? input : fs.readFileSync(input)
|
|
131
|
+
const eocd = locateEocd(data, label)
|
|
132
|
+
const count = data.readUInt16LE(eocd + 10)
|
|
133
|
+
let offset = data.readUInt32LE(eocd + 16)
|
|
134
|
+
const names = []
|
|
135
|
+
for (let i = 0; i < count; i++) {
|
|
136
|
+
if (data.readUInt32LE(offset) !== 0x02014b50) throw new Error(`ZIP 中央目录损坏: ${label}`)
|
|
137
|
+
const nameLength = data.readUInt16LE(offset + 28)
|
|
138
|
+
const extraLength = data.readUInt16LE(offset + 30)
|
|
139
|
+
const commentLength = data.readUInt16LE(offset + 32)
|
|
140
|
+
names.push(data.subarray(offset + 46, offset + 46 + nameLength).toString('utf8'))
|
|
141
|
+
offset += 46 + nameLength + extraLength + commentLength
|
|
142
|
+
}
|
|
143
|
+
return names
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 从 ZIP 读单个条目的原始字节;不存在返回 undefined。
|
|
148
|
+
* @param {Buffer|string} input - ZIP 字节或文件路径
|
|
149
|
+
*/
|
|
150
|
+
export function readZipEntryBuffer(input, entryName, label = 'zip') {
|
|
151
|
+
const data = Buffer.isBuffer(input) ? input : fs.readFileSync(input)
|
|
152
|
+
const eocd = locateEocd(data, label)
|
|
153
|
+
const count = data.readUInt16LE(eocd + 10)
|
|
154
|
+
let offset = data.readUInt32LE(eocd + 16)
|
|
155
|
+
for (let i = 0; i < count; i++) {
|
|
156
|
+
if (data.readUInt32LE(offset) !== 0x02014b50) throw new Error(`ZIP 中央目录损坏: ${label}`)
|
|
157
|
+
const method = data.readUInt16LE(offset + 10)
|
|
158
|
+
const compSize = data.readUInt32LE(offset + 20)
|
|
159
|
+
const nameLength = data.readUInt16LE(offset + 28)
|
|
160
|
+
const extraLength = data.readUInt16LE(offset + 30)
|
|
161
|
+
const commentLength = data.readUInt16LE(offset + 32)
|
|
162
|
+
const localOffset = data.readUInt32LE(offset + 42)
|
|
163
|
+
const name = data.subarray(offset + 46, offset + 46 + nameLength).toString('utf8')
|
|
164
|
+
if (name === entryName) {
|
|
165
|
+
const localNameLength = data.readUInt16LE(localOffset + 26)
|
|
166
|
+
const localExtraLength = data.readUInt16LE(localOffset + 28)
|
|
167
|
+
const start = localOffset + 30 + localNameLength + localExtraLength
|
|
168
|
+
const body = data.subarray(start, start + compSize)
|
|
169
|
+
if (method === 0) return body
|
|
170
|
+
if (method === 8) return zlib.inflateRawSync(body)
|
|
171
|
+
throw new Error(`不支持的 ZIP 压缩方式 ${method}: ${label}`)
|
|
172
|
+
}
|
|
173
|
+
offset += 46 + nameLength + extraLength + commentLength
|
|
174
|
+
}
|
|
175
|
+
return undefined
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** 读取 ZIP 中央目录条目名(文件路径版;打包自检/测试用)。 */
|
|
179
|
+
export function listZipEntries(file) {
|
|
180
|
+
return listZipEntryNames(fs.readFileSync(file), file)
|
|
181
|
+
}
|
|
@@ -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,478 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contractVersion": "0.1.0",
|
|
3
|
+
"packageVersion": "0.1.0",
|
|
4
|
+
"editorUrl": "",
|
|
5
|
+
"editorPath": "",
|
|
6
|
+
"toolCount": 12,
|
|
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;或 name 选用已记住的目标别名。校验 rsp/1、打开画面流与操控通道,并把目标记入跨会话共享的目标库(同基址再连可省略 token)。无参数时重连本会话记住的目标。每个会话独立连接,互不抢画面。",
|
|
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": "目标别名:单独传=选用已记住目标;与 url/host 同传=给新目标起名"
|
|
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 逻辑尺寸、最近帧尺寸/时延、观众数、引擎权限诊断、当前按下的键/钮;并附 remembered(跨会话记住的目标库,令牌掩码)与 sessions 绑定。",
|
|
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(拖拽语义)。一次批量发送;默认 moveIntervalMs=16 提供约 60Hz 平滑轨迹。坐标默认最近帧像素(space=frame)。steps 默认 12,最大 60。",
|
|
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
|
+
"moveIntervalMs": {
|
|
272
|
+
"type": "integer",
|
|
273
|
+
"description": "每个中间 move 后的被控端等待,0–100ms;默认 16ms,最长累计等待 2s"
|
|
274
|
+
},
|
|
275
|
+
"space": {
|
|
276
|
+
"type": "string",
|
|
277
|
+
"enum": [
|
|
278
|
+
"frame",
|
|
279
|
+
"logical"
|
|
280
|
+
],
|
|
281
|
+
"description": "默认 frame"
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"required": [
|
|
285
|
+
"fromX",
|
|
286
|
+
"fromY",
|
|
287
|
+
"toX",
|
|
288
|
+
"toY"
|
|
289
|
+
],
|
|
290
|
+
"additionalProperties": false
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "rsp_batch",
|
|
295
|
+
"kind": "write",
|
|
296
|
+
"since": "0.1.0",
|
|
297
|
+
"capability": "rsp.control",
|
|
298
|
+
"description": "按序提交多个输入事件,通常一次控制确认。连续鼠标轨迹可设 moveIntervalMs(0–100ms)让被控端按节奏注入;最多 64 个事件、总节奏等待不超过 2s。gapMs>0 仍可选逐事件 ACK 间隔;screenshot=true 末尾抓帧。",
|
|
299
|
+
"inputSchema": {
|
|
300
|
+
"type": "object",
|
|
301
|
+
"properties": {
|
|
302
|
+
"events": {
|
|
303
|
+
"type": "array",
|
|
304
|
+
"description": "事件数组(mouse/key/text)",
|
|
305
|
+
"items": {
|
|
306
|
+
"type": "object"
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"moveIntervalMs": {
|
|
310
|
+
"type": "integer",
|
|
311
|
+
"description": "batch 内每个鼠标 move 后的等待,0–100ms;最多累计 2s。用于连续轨迹,默认 0"
|
|
312
|
+
},
|
|
313
|
+
"gapMs": {
|
|
314
|
+
"type": "integer",
|
|
315
|
+
"description": "兼容模式:逐事件发送时的间隔毫秒,默认 0"
|
|
316
|
+
},
|
|
317
|
+
"screenshot": {
|
|
318
|
+
"type": "boolean",
|
|
319
|
+
"description": "末尾抓一帧新画面,默认 false"
|
|
320
|
+
},
|
|
321
|
+
"space": {
|
|
322
|
+
"type": "string",
|
|
323
|
+
"enum": [
|
|
324
|
+
"frame",
|
|
325
|
+
"logical"
|
|
326
|
+
],
|
|
327
|
+
"description": "mouse 坐标空间默认值,默认 frame"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"required": [
|
|
331
|
+
"events"
|
|
332
|
+
],
|
|
333
|
+
"additionalProperties": false
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"name": "rsp_quality",
|
|
338
|
+
"kind": "control",
|
|
339
|
+
"since": "0.1.0",
|
|
340
|
+
"capability": "rsp.control",
|
|
341
|
+
"description": "运行时调节被控端画质(原子换档,画面不中断)。preset 选档(low/smooth/balanced/hd/uhd),或用显式 bitrateKbps/h264Fps/h264MaxWidth/jpegFps/jpegQuality/maxWidth 覆盖。auto=true 开启按操控 RTT 自动降档(持续高延迟降一档、持续健康升回、不超基线),auto=false 关闭。需被控端支持 features.quality(新版 agent)。返回生效画质快照 + 当前 RTT。",
|
|
342
|
+
"inputSchema": {
|
|
343
|
+
"type": "object",
|
|
344
|
+
"properties": {
|
|
345
|
+
"preset": {
|
|
346
|
+
"type": "string",
|
|
347
|
+
"enum": [
|
|
348
|
+
"low",
|
|
349
|
+
"smooth",
|
|
350
|
+
"balanced",
|
|
351
|
+
"hd",
|
|
352
|
+
"uhd"
|
|
353
|
+
],
|
|
354
|
+
"description": "画质档位"
|
|
355
|
+
},
|
|
356
|
+
"bitrateKbps": {
|
|
357
|
+
"type": "number",
|
|
358
|
+
"description": "h264 码率 100–50000 kbps"
|
|
359
|
+
},
|
|
360
|
+
"h264Fps": {
|
|
361
|
+
"type": "number",
|
|
362
|
+
"description": "h264 帧率 1–120"
|
|
363
|
+
},
|
|
364
|
+
"h264MaxWidth": {
|
|
365
|
+
"type": "number",
|
|
366
|
+
"description": "h264 最大宽 320–7680(gpuDirect 原生分辨率下忽略)"
|
|
367
|
+
},
|
|
368
|
+
"jpegFps": {
|
|
369
|
+
"type": "number",
|
|
370
|
+
"description": "JPEG 帧率 1–120"
|
|
371
|
+
},
|
|
372
|
+
"jpegQuality": {
|
|
373
|
+
"type": "number",
|
|
374
|
+
"description": "JPEG 质量 1–31(越小越好)"
|
|
375
|
+
},
|
|
376
|
+
"maxWidth": {
|
|
377
|
+
"type": "number",
|
|
378
|
+
"description": "JPEG 最大宽 320–7680"
|
|
379
|
+
},
|
|
380
|
+
"auto": {
|
|
381
|
+
"type": "boolean",
|
|
382
|
+
"description": "true=开启自动降档,false=关闭;省略则不变"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"additionalProperties": false
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "rsp_wake",
|
|
390
|
+
"kind": "control",
|
|
391
|
+
"since": "0.1.0",
|
|
392
|
+
"capability": "rsp.control",
|
|
393
|
+
"description": "强制唤醒被控端显示器:点亮已息屏/睡眠的屏幕(macOS caffeinate -u / Windows 一次性 SetThreadExecutionState),随后保持防熄屏。与「防熄屏」不同——它能唤不醒已经黑屏的设备。需被控端 features.wake(新版 agent),旧 agent 报 unsupported。holdMs=点亮后保持唤醒毫秒数(0–30000,默认 2000)。抓帧前若画面黑屏可先调它;新 agent 在观众接入黑屏时也会自动唤醒。screenshot=true 唤醒后抓帧验证。返回唤醒结果快照。",
|
|
394
|
+
"inputSchema": {
|
|
395
|
+
"type": "object",
|
|
396
|
+
"properties": {
|
|
397
|
+
"holdMs": {
|
|
398
|
+
"type": "integer",
|
|
399
|
+
"description": "点亮后保持唤醒的毫秒数 0–30000,默认 2000"
|
|
400
|
+
},
|
|
401
|
+
"screenshot": {
|
|
402
|
+
"type": "boolean",
|
|
403
|
+
"description": "唤醒后抓一帧新画面验证,默认 false"
|
|
404
|
+
},
|
|
405
|
+
"waitMs": {
|
|
406
|
+
"type": "integer",
|
|
407
|
+
"description": "screenshot 时等待新帧的上限毫秒,默认 3000"
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
"additionalProperties": false
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
"features": [
|
|
415
|
+
"connect",
|
|
416
|
+
"disconnect",
|
|
417
|
+
"status",
|
|
418
|
+
"capabilities",
|
|
419
|
+
"screen",
|
|
420
|
+
"mouse",
|
|
421
|
+
"key",
|
|
422
|
+
"text",
|
|
423
|
+
"drag",
|
|
424
|
+
"batch",
|
|
425
|
+
"quality",
|
|
426
|
+
"wake"
|
|
427
|
+
],
|
|
428
|
+
"capabilities": [
|
|
429
|
+
{
|
|
430
|
+
"id": "rsp.session",
|
|
431
|
+
"title": "RSP 会话",
|
|
432
|
+
"description": "连接/断开被控端、查看契约与状态。",
|
|
433
|
+
"tags": [
|
|
434
|
+
"rsp",
|
|
435
|
+
"remote-screen",
|
|
436
|
+
"session"
|
|
437
|
+
],
|
|
438
|
+
"tools": [
|
|
439
|
+
"rsp_capabilities",
|
|
440
|
+
"rsp_connect",
|
|
441
|
+
"rsp_disconnect",
|
|
442
|
+
"rsp_status"
|
|
443
|
+
]
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"id": "rsp.screen",
|
|
447
|
+
"title": "RSP 画面",
|
|
448
|
+
"description": "读取被控端实时屏幕帧(只读)。",
|
|
449
|
+
"tags": [
|
|
450
|
+
"rsp",
|
|
451
|
+
"remote-screen",
|
|
452
|
+
"screen"
|
|
453
|
+
],
|
|
454
|
+
"tools": [
|
|
455
|
+
"rsp_screen"
|
|
456
|
+
]
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"id": "rsp.control",
|
|
460
|
+
"title": "RSP 操控",
|
|
461
|
+
"description": "向被控端注入鼠标/键盘/文本/拖拽/批量输入(只写),运行时调节画质,并强制唤醒已息屏的显示器。",
|
|
462
|
+
"tags": [
|
|
463
|
+
"rsp",
|
|
464
|
+
"remote-screen",
|
|
465
|
+
"control"
|
|
466
|
+
],
|
|
467
|
+
"tools": [
|
|
468
|
+
"rsp_mouse",
|
|
469
|
+
"rsp_key",
|
|
470
|
+
"rsp_text",
|
|
471
|
+
"rsp_drag",
|
|
472
|
+
"rsp_batch",
|
|
473
|
+
"rsp_quality",
|
|
474
|
+
"rsp_wake"
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
]
|
|
478
|
+
}
|