@capyclaw/rsp-suite 0.1.0 → 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/dsh-suite.json +13 -3
- 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/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/contract/rsp-contract.json +102 -13
- package/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/skills/remote-screen/SKILL.md +13 -2
- package/{workbench → node_modules/@capyclaw/rsp-workbench}/contract/capabilities.json +32 -0
- package/{workbench → node_modules/@capyclaw/rsp-workbench}/lib/client.mjs +238 -11
- package/node_modules/@capyclaw/rsp-workbench/lib/host.mjs +51 -0
- package/{workbench → node_modules/@capyclaw/rsp-workbench}/lib/tools.mjs +116 -16
- package/{workbench → node_modules/@capyclaw/rsp-workbench}/lib/workbench.mjs +21 -2
- package/node_modules/@capyclaw/rsp-workbench/plugin.mjs +17 -0
- package/{workbench → node_modules/@capyclaw/rsp-workbench}/ui/index.html +113 -10
- 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 +22 -9
- package/workbench/lib/host.mjs +0 -111
- package/workbench/plugin.mjs +0 -2
- package/workbench/scripts/build-contract.mjs +0 -41
- package/workbench/scripts/drive.mjs +0 -66
- package/workbench/test/client.test.mjs +0 -218
- package/workbench/test/frames-prune.test.mjs +0 -49
- package/workbench/test/h264.test.mjs +0 -101
- package/workbench/test/live-persistent-smoke.mjs +0 -29
- package/workbench/test/live-smoke.mjs +0 -109
- package/workbench/test/mock-server.mjs +0 -194
- package/workbench/test/persistence.test.mjs +0 -177
- package/workbench/test/persistent.test.mjs +0 -160
- package/workbench/test/session-mode.test.mjs +0 -118
- package/workbench/test/workbench.test.mjs +0 -385
- package/workbench/verify-e2e.mjs +0 -44
- /package/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/README.md +0 -0
- /package/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/cordis.patch.yml +0 -0
- /package/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/package.json +0 -0
- /package/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/plugin.mjs +0 -0
- /package/{workbench → node_modules/@capyclaw/rsp-workbench}/lib/descriptors.mjs +0 -0
- /package/{workbench → node_modules/@capyclaw/rsp-workbench}/lib/manager.mjs +0 -0
- /package/{workbench → node_modules/@capyclaw/rsp-workbench}/lib/session-mode.mjs +0 -0
- /package/{workbench → node_modules/@capyclaw/rsp-workbench}/package.json +0 -0
|
@@ -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
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"packageVersion": "0.1.0",
|
|
4
4
|
"editorUrl": "",
|
|
5
5
|
"editorPath": "",
|
|
6
|
-
"toolCount":
|
|
6
|
+
"toolCount": 12,
|
|
7
7
|
"tools": [
|
|
8
8
|
{
|
|
9
9
|
"name": "rsp_capabilities",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"kind": "control",
|
|
23
23
|
"since": "0.1.0",
|
|
24
24
|
"capability": "rsp.session",
|
|
25
|
-
"description": "连接被控端:传 url(http://host:port)或 host+port,以及 token
|
|
25
|
+
"description": "连接被控端:传 url(http://host:port)或 host+port,以及 token;或 name 选用已记住的目标别名。校验 rsp/1、打开画面流与操控通道,并把目标记入跨会话共享的目标库(同基址再连可省略 token)。无参数时重连本会话记住的目标。每个会话独立连接,互不抢画面。",
|
|
26
26
|
"inputSchema": {
|
|
27
27
|
"type": "object",
|
|
28
28
|
"properties": {
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
},
|
|
41
41
|
"token": {
|
|
42
42
|
"type": "string",
|
|
43
|
-
"description": "访问令牌(bearer
|
|
43
|
+
"description": "访问令牌(bearer;新目标必填,已记住的同基址目标可省略)"
|
|
44
44
|
},
|
|
45
45
|
"name": {
|
|
46
46
|
"type": "string",
|
|
47
|
-
"description": "
|
|
47
|
+
"description": "目标别名:单独传=选用已记住目标;与 url/host 同传=给新目标起名"
|
|
48
48
|
},
|
|
49
49
|
"persist": {
|
|
50
50
|
"type": "boolean",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"kind": "control",
|
|
60
60
|
"since": "0.1.0",
|
|
61
61
|
"capability": "rsp.session",
|
|
62
|
-
"description": "
|
|
62
|
+
"description": "断开本会话的被控端连接(停止画面采集与操控,不影响其它会话)。forget=true 同时解除本会话与目标的记忆绑定(目标无其它引用时从库中删除)。",
|
|
63
63
|
"inputSchema": {
|
|
64
64
|
"type": "object",
|
|
65
65
|
"properties": {
|
|
66
66
|
"forget": {
|
|
67
67
|
"type": "boolean",
|
|
68
|
-
"description": "
|
|
68
|
+
"description": "是否清除本会话的目标记忆,默认 false"
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
"additionalProperties": false
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"kind": "read",
|
|
77
77
|
"since": "0.1.0",
|
|
78
78
|
"capability": "rsp.session",
|
|
79
|
-
"description": "
|
|
79
|
+
"description": "查看本会话连接状态:目标、画面/操控通道状态、hello 逻辑尺寸、最近帧尺寸/时延、观众数、引擎权限诊断、当前按下的键/钮;并附 remembered(跨会话记住的目标库,令牌掩码)与 sessions 绑定。",
|
|
80
80
|
"inputSchema": {
|
|
81
81
|
"type": "object",
|
|
82
82
|
"properties": {},
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
"kind": "write",
|
|
240
240
|
"since": "0.1.0",
|
|
241
241
|
"capability": "rsp.control",
|
|
242
|
-
"description": "拖拽:从 (fromX,fromY) 按住拖到 (toX,toY) 再抬起,中间插值 move
|
|
242
|
+
"description": "拖拽:从 (fromX,fromY) 按住拖到 (toX,toY) 再抬起,中间插值 move(拖拽语义)。一次批量发送;默认 moveIntervalMs=16 提供约 60Hz 平滑轨迹。坐标默认最近帧像素(space=frame)。steps 默认 12,最大 60。",
|
|
243
243
|
"inputSchema": {
|
|
244
244
|
"type": "object",
|
|
245
245
|
"properties": {
|
|
@@ -268,6 +268,10 @@
|
|
|
268
268
|
],
|
|
269
269
|
"description": "默认 left"
|
|
270
270
|
},
|
|
271
|
+
"moveIntervalMs": {
|
|
272
|
+
"type": "integer",
|
|
273
|
+
"description": "每个中间 move 后的被控端等待,0–100ms;默认 16ms,最长累计等待 2s"
|
|
274
|
+
},
|
|
271
275
|
"space": {
|
|
272
276
|
"type": "string",
|
|
273
277
|
"enum": [
|
|
@@ -291,7 +295,7 @@
|
|
|
291
295
|
"kind": "write",
|
|
292
296
|
"since": "0.1.0",
|
|
293
297
|
"capability": "rsp.control",
|
|
294
|
-
"description": "
|
|
298
|
+
"description": "按序提交多个输入事件,通常一次控制确认。连续鼠标轨迹可设 moveIntervalMs(0–100ms)让被控端按节奏注入;最多 64 个事件、总节奏等待不超过 2s。gapMs>0 仍可选逐事件 ACK 间隔;screenshot=true 末尾抓帧。",
|
|
295
299
|
"inputSchema": {
|
|
296
300
|
"type": "object",
|
|
297
301
|
"properties": {
|
|
@@ -302,9 +306,13 @@
|
|
|
302
306
|
"type": "object"
|
|
303
307
|
}
|
|
304
308
|
},
|
|
309
|
+
"moveIntervalMs": {
|
|
310
|
+
"type": "integer",
|
|
311
|
+
"description": "batch 内每个鼠标 move 后的等待,0–100ms;最多累计 2s。用于连续轨迹,默认 0"
|
|
312
|
+
},
|
|
305
313
|
"gapMs": {
|
|
306
314
|
"type": "integer",
|
|
307
|
-
"description": "
|
|
315
|
+
"description": "兼容模式:逐事件发送时的间隔毫秒,默认 0"
|
|
308
316
|
},
|
|
309
317
|
"screenshot": {
|
|
310
318
|
"type": "boolean",
|
|
@@ -324,6 +332,83 @@
|
|
|
324
332
|
],
|
|
325
333
|
"additionalProperties": false
|
|
326
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
|
+
}
|
|
327
412
|
}
|
|
328
413
|
],
|
|
329
414
|
"features": [
|
|
@@ -336,7 +421,9 @@
|
|
|
336
421
|
"key",
|
|
337
422
|
"text",
|
|
338
423
|
"drag",
|
|
339
|
-
"batch"
|
|
424
|
+
"batch",
|
|
425
|
+
"quality",
|
|
426
|
+
"wake"
|
|
340
427
|
],
|
|
341
428
|
"capabilities": [
|
|
342
429
|
{
|
|
@@ -371,7 +458,7 @@
|
|
|
371
458
|
{
|
|
372
459
|
"id": "rsp.control",
|
|
373
460
|
"title": "RSP 操控",
|
|
374
|
-
"description": "
|
|
461
|
+
"description": "向被控端注入鼠标/键盘/文本/拖拽/批量输入(只写),运行时调节画质,并强制唤醒已息屏的显示器。",
|
|
375
462
|
"tags": [
|
|
376
463
|
"rsp",
|
|
377
464
|
"remote-screen",
|
|
@@ -382,7 +469,9 @@
|
|
|
382
469
|
"rsp_key",
|
|
383
470
|
"rsp_text",
|
|
384
471
|
"rsp_drag",
|
|
385
|
-
"rsp_batch"
|
|
472
|
+
"rsp_batch",
|
|
473
|
+
"rsp_quality",
|
|
474
|
+
"rsp_wake"
|
|
386
475
|
]
|
|
387
476
|
}
|
|
388
477
|
]
|
package/{skill → node_modules/@capyclaw/rsp-skill-remote-screen}/skills/remote-screen/SKILL.md
RENAMED
|
@@ -27,7 +27,7 @@ whenToUse: 用户要求远程操控另一台设备、远程桌面、看/操作
|
|
|
27
27
|
|
|
28
28
|
## 操控本机(自控)
|
|
29
29
|
|
|
30
|
-
被控端就是**当前这台机器**时,不必向用户要令牌:本机 RSP agent 首启会把 url+token 写进它自己的 host 目录(默认 `~/.dsh-rsp-agent/agent.json`,见 rsp-agent-win `resolveToken()`:config.token > hostDir/agent.json > 随机)。读该文件取 `token`,`rsp_connect`
|
|
30
|
+
被控端就是**当前这台机器**时,不必向用户要令牌:本机 RSP agent 首启会把 url+token 写进它自己的 host 目录(默认 `~/.dsh-rsp-agent/agent.json`,见 rsp-agent-win `resolveToken()`:config.token > hostDir/agent.json > 随机)。读该文件取 `url` 与 `token`,`rsp_connect` 到该 `url`(本机自控默认监听 8765)。
|
|
31
31
|
- 记住的目标(remembered)里的旧 token 可能已失效(401)——**以 agent.json 当前值为准**,不要信 saved。
|
|
32
32
|
- 令牌仍须保密,不在回复明文回显。
|
|
33
33
|
|
|
@@ -76,6 +76,8 @@ whenToUse: 用户要求远程操控另一台设备、远程桌面、看/操作
|
|
|
76
76
|
| `rsp_text` | Unicode 文本注入(IME/粘贴) | text(自动按 4096 分片) |
|
|
77
77
|
| `rsp_drag` | 拖拽(down→moves→up) | fromX/fromY/toX/toY、steps、button、space |
|
|
78
78
|
| `rsp_batch` | 多事件打包,减少往返 | events、gapMs、screenshot、space |
|
|
79
|
+
| `rsp_quality` | 运行时调节被控端画质(需 features.quality) | preset、bitrateKbps、h264Fps、auto |
|
|
80
|
+
| `rsp_wake` | 强制唤醒已息屏/睡眠的显示器(需 features.wake) | holdMs、screenshot、waitMs |
|
|
79
81
|
|
|
80
82
|
### 鼠标 `rsp_mouse`
|
|
81
83
|
- `action`:`move`/`down`/`up`/`click`/`scroll`。点按用 `click`(= 同坐标原子 down+up)。
|
|
@@ -96,6 +98,13 @@ whenToUse: 用户要求远程操控另一台设备、远程桌面、看/操作
|
|
|
96
98
|
- 把多个事件放 `events` 数组一次提交(按序注入),减少模型往返。末尾 `screenshot:true` 自动抓帧验证。
|
|
97
99
|
- 适合「点一下→等一下→输入→回车」这类固定序列。事件可省 `cmd`:有 `code`→key,有 `text`→text,否则 mouse。
|
|
98
100
|
|
|
101
|
+
### 强制唤醒 `rsp_wake`
|
|
102
|
+
- **息屏 ≠ 锁屏**:被控端显示器睡眠/黑屏时抓不到帧(`frameCount=0`),但操控注入可能仍成功。`rsp_wake` 主动**点亮已黑屏的屏幕**(macOS `caffeinate -u` / Windows 一次性 `SetThreadExecutionState`),随后保持防熄屏。这与「防熄屏」(只阻止睡眠、唤不醒已黑屏)不同。
|
|
103
|
+
- 需被控端 `features.wake`(新版 agent);旧 agent 报 `unsupported`,只能请用户手动点亮/解锁。
|
|
104
|
+
- `holdMs`:点亮后保持唤醒的毫秒数(0–30000,默认 2000)。`screenshot:true` 唤醒后抓一帧验证(`waitMs` 默认 3000)。
|
|
105
|
+
- **多数情况无需手动调**:新 agent 在观众接入且黑屏时会自动唤醒;`rsp_screen` 抓不到帧且被控端支持唤醒时也会自愈唤醒再等一帧。手动 `rsp_wake` 用于确认/强制点亮或排查。
|
|
106
|
+
- 唤醒只点亮屏幕,**不解锁**:锁屏仍需用户解锁(见硬规则)。
|
|
107
|
+
|
|
99
108
|
## 硬规则
|
|
100
109
|
|
|
101
110
|
- **先确认工具可用性**:`rsp_*` 在工具面 → `rsp_capabilities` 确认契约与工具,缺失/major 不一致就停止并提示升级;不在工具面 → 走 conductor 桥接(见上),不要退回 shell/UIA/AHK。
|
|
@@ -105,6 +114,7 @@ whenToUse: 用户要求远程操控另一台设备、远程桌面、看/操作
|
|
|
105
114
|
- **坐标用最新截图**:默认 frame 空间照像素瞄准;分辨率变了重新抓帧。
|
|
106
115
|
- **每轮动作前抓帧看现状**,动作后抓帧验证;别假设状态只由你改变。
|
|
107
116
|
- **锁屏时注入无效**(系统限制),但画面仍显示锁屏——看到锁屏先告知用户解锁。
|
|
117
|
+
- **息屏抓不到帧**(`frameCount=0`/`no_frame`)→ 新 agent 会自动唤醒,`rsp_screen` 也会自愈;仍黑屏可手动 `rsp_wake`(需 features.wake)。唤醒只点亮不解锁,锁屏仍需用户解锁。
|
|
108
118
|
- 掉线/`4001` → 重新 `rsp_connect`(必要时向用户重新要令牌);`engine_unavailable` → 退避重试。
|
|
109
119
|
- 任务结束可 `rsp_disconnect` 归还连接(保留目标以便下次重连)。
|
|
110
120
|
|
|
@@ -117,4 +127,5 @@ whenToUse: 用户要求远程操控另一台设备、远程桌面、看/操作
|
|
|
117
127
|
| `forbidden` / 4003 | 操控被禁用 | 只读模式,告知用户 |
|
|
118
128
|
| `engine_unavailable` / 503 | 引擎未就绪 | 退避重试 |
|
|
119
129
|
| `bad_event` / 400 | 事件非法(如未知 code) | 修正参数 |
|
|
120
|
-
| `no_frame` / `no_dimensions` |
|
|
130
|
+
| `no_frame` / `no_dimensions` | 还没有帧/尺寸(可能息屏) | 先 `rsp_screen`;仍无帧且 features.wake → `rsp_wake` 后再抓帧 |
|
|
131
|
+
| `unsupported`(wake/quality) | 旧 agent 无该能力 | 请用户升级被控端 agent;唤醒可请用户手动点亮屏幕 |
|
|
@@ -166,6 +166,38 @@
|
|
|
166
166
|
"risk": "low",
|
|
167
167
|
"confirm": false,
|
|
168
168
|
"surface": { "standalone": true, "embeddable": true, "embedPath": "/capyclaw/rsp", "title": "RSP 远程屏幕工作台" }
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "rsp.control.quality",
|
|
172
|
+
"capability": "control.quality",
|
|
173
|
+
"suite": "rsp",
|
|
174
|
+
"controlMode": "interface",
|
|
175
|
+
"kind": "control",
|
|
176
|
+
"since": "0.1.0",
|
|
177
|
+
"description": "运行时调节被控端画质(原子换档不中断):preset 档位或显式码率/帧率/宽度;auto 按操控 RTT 自动降档。需被控端 features.quality。",
|
|
178
|
+
"tool": "rsp_quality",
|
|
179
|
+
"consumes": [],
|
|
180
|
+
"produces": ["result:status"],
|
|
181
|
+
"auth": null,
|
|
182
|
+
"risk": "low",
|
|
183
|
+
"confirm": false,
|
|
184
|
+
"surface": { "standalone": true, "embeddable": true, "embedPath": "/capyclaw/rsp", "title": "RSP 远程屏幕工作台" }
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "rsp.control.wake",
|
|
188
|
+
"capability": "control.wake",
|
|
189
|
+
"suite": "rsp",
|
|
190
|
+
"controlMode": "interface",
|
|
191
|
+
"kind": "control",
|
|
192
|
+
"since": "0.1.0",
|
|
193
|
+
"description": "强制唤醒被控端显示器:点亮已息屏/睡眠的屏幕(macOS caffeinate -u / Windows SetThreadExecutionState)并保持防熄屏。需被控端 features.wake;新 agent 观众接入黑屏时自动唤醒。",
|
|
194
|
+
"tool": "rsp_wake",
|
|
195
|
+
"consumes": [],
|
|
196
|
+
"produces": ["result:status"],
|
|
197
|
+
"auth": null,
|
|
198
|
+
"risk": "low",
|
|
199
|
+
"confirm": false,
|
|
200
|
+
"surface": { "standalone": true, "embeddable": true, "embedPath": "/capyclaw/rsp", "title": "RSP 远程屏幕工作台" }
|
|
169
201
|
}
|
|
170
202
|
]
|
|
171
203
|
}
|