screen-relay 0.0.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/LICENSE +201 -0
- package/Makefile +165 -0
- package/README.md +112 -1
- package/THIRD-PARTY-NOTICES.md +75 -0
- package/dist/cli/client.d.ts +28 -0
- package/dist/cli/commands.d.ts +52 -0
- package/dist/cli/config.d.ts +32 -0
- package/dist/cli/format.d.ts +15 -0
- package/dist/cli/help.d.ts +5 -0
- package/dist/cli/host/common.d.ts +23 -0
- package/dist/cli/host/doctor.d.ts +2 -0
- package/dist/cli/host/packages.d.ts +13 -0
- package/dist/cli/host/session_commands.d.ts +8 -0
- package/dist/cli/host/setup.d.ts +22 -0
- package/dist/cli/host/state.d.ts +23 -0
- package/dist/cli/host/supervisor.d.ts +94 -0
- package/dist/cli/host/watcher.d.ts +4 -0
- package/dist/cli/host/windows.d.ts +82 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/mode.d.ts +14 -0
- package/dist/cli/output.d.ts +24 -0
- package/dist/cli/parser.d.ts +6 -0
- package/dist/cli/relay.mjs +12631 -0
- package/dist/cli/skills.d.ts +21 -0
- package/dist/cli/theme.d.ts +14 -0
- package/dist/protocol/errors.d.ts +155 -0
- package/dist/protocol/index.d.ts +119 -0
- package/dist/protocol/index.js +418 -0
- package/dist/sdk/index.d.ts +78 -0
- package/dist/sdk/index.js +834 -0
- package/dist/sdk/transport.d.ts +20 -0
- package/dist/viewer/index.html +96 -0
- package/dist/viewer/viewer.js +1079 -0
- package/package.json +47 -7
- package/packages.tsv +38 -0
- package/skills/core/SKILL.md +171 -0
- package/skills/core/references/cli.md +119 -0
- package/skills/core/references/config.md +48 -0
- package/skills/core/references/macos.md +50 -0
- package/skills/core/references/sdk.md +69 -0
- package/skills/core/references/troubleshooting.md +33 -0
- package/skills/core/references/wayland.md +47 -0
- package/skills/screen-relay/SKILL.md +24 -0
- package/skills/vercel-sandbox/SKILL.md +68 -0
- package/src/engine/backends/linux/keycodes.hpp +35 -0
- package/src/engine/backends/linux/wayland/capture.cpp +298 -0
- package/src/engine/backends/linux/wayland/input.cpp +559 -0
- package/src/engine/backends/linux/wayland/keymap.cpp +118 -0
- package/src/engine/backends/linux/wayland/keymap.hpp +54 -0
- package/src/engine/backends/linux/wayland/protocols/virtual-keyboard-unstable-v1.xml +112 -0
- package/src/engine/backends/linux/wayland/protocols/wlr-screencopy-unstable-v1.xml +234 -0
- package/src/engine/backends/linux/wayland/protocols/wlr-virtual-pointer-unstable-v1.xml +152 -0
- package/src/engine/backends/linux/wayland/wayland.cpp +166 -0
- package/src/engine/backends/linux/wayland/wayland.hpp +60 -0
- package/src/engine/backends/linux/x11/capture.cpp +206 -0
- package/src/engine/backends/linux/x11/input.cpp +266 -0
- package/src/engine/backends/macos/capture.mm +367 -0
- package/src/engine/backends/macos/display.hpp +20 -0
- package/src/engine/backends/macos/display.mm +84 -0
- package/src/engine/backends/macos/input.mm +287 -0
- package/src/engine/backends/macos/keys.hpp +34 -0
- package/src/engine/backends/windows/capture.cpp +393 -0
- package/src/engine/backends/windows/input.cpp +274 -0
- package/src/engine/backends/windows/output.cpp +65 -0
- package/src/engine/backends/windows/output.hpp +26 -0
- package/src/engine/core/capture-bucket.hpp +40 -0
- package/src/engine/core/capture-source.hpp +59 -0
- package/src/engine/core/capture.cpp +565 -0
- package/src/engine/core/capture.hpp +58 -0
- package/src/engine/core/color.cpp +176 -0
- package/src/engine/core/color.hpp +16 -0
- package/src/engine/core/cpu-budget.hpp +196 -0
- package/src/engine/core/flow.hpp +317 -0
- package/src/engine/core/input.cpp +98 -0
- package/src/engine/core/input.hpp +115 -0
- package/src/engine/core/wait.cpp +125 -0
- package/src/engine/core/wait.hpp +41 -0
- package/src/engine/server/backend.cpp +65 -0
- package/src/engine/server/backend.hpp +18 -0
- package/src/engine/server/config.cpp +257 -0
- package/src/engine/server/config.hpp +24 -0
- package/src/engine/server/main.cpp +82 -0
- package/src/engine/server/metrics.cpp +47 -0
- package/src/engine/server/metrics.hpp +10 -0
- package/src/engine/server/screenshot.cpp +108 -0
- package/src/engine/server/screenshot.hpp +31 -0
- package/src/engine/server/server.cpp +535 -0
- package/src/engine/server/server.hpp +89 -0
- package/src/engine/server/wire.cpp +70 -0
- package/src/engine/server/wire.hpp +29 -0
- package/index.js +0 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Vercel Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/Makefile
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
CXX ?= g++
|
|
2
|
+
ifeq ($(OS),Windows_NT)
|
|
3
|
+
BACKENDS ?= windows
|
|
4
|
+
endif
|
|
5
|
+
ifeq ($(shell uname -s),Darwin)
|
|
6
|
+
BACKENDS ?= macos
|
|
7
|
+
PLATFORM_PKGS = openssl
|
|
8
|
+
endif
|
|
9
|
+
BACKENDS ?= x11
|
|
10
|
+
HAS_WAYLAND = $(filter wayland,$(BACKENDS))
|
|
11
|
+
AVAILABLE_BACKENDS = x11 wayland windows macos
|
|
12
|
+
BACKEND_PKGS_x11 = x11 xext xdamage xfixes xtst
|
|
13
|
+
BACKEND_DIR_x11 = linux/x11
|
|
14
|
+
BACKEND_PKGS_wayland = wayland-client xkbcommon
|
|
15
|
+
BACKEND_DIR_wayland = linux/wayland
|
|
16
|
+
BACKEND_DIR_windows = windows
|
|
17
|
+
BACKEND_LIBS_windows = -ld3d11 -ldxgi
|
|
18
|
+
BACKEND_FLAGS_windows = -DNOMINMAX -D_WIN32_WINNT=0x0A00
|
|
19
|
+
BACKEND_DIR_macos = macos
|
|
20
|
+
BACKEND_FLAGS_macos = -mmacosx-version-min=12.3 -Werror=unguarded-availability-new
|
|
21
|
+
BACKEND_LIBS_macos = -framework ScreenCaptureKit -framework CoreMedia -framework CoreVideo -framework CoreGraphics -framework ApplicationServices -framework AppKit -framework Foundation
|
|
22
|
+
ifneq ($(filter-out $(AVAILABLE_BACKENDS),$(BACKENDS)),)
|
|
23
|
+
$(error Unknown BACKENDS '$(filter-out $(AVAILABLE_BACKENDS),$(BACKENDS))'; available: $(AVAILABLE_BACKENDS))
|
|
24
|
+
endif
|
|
25
|
+
ifeq ($(strip $(BACKENDS)),)
|
|
26
|
+
$(error BACKENDS must name at least one backend; available: $(AVAILABLE_BACKENDS))
|
|
27
|
+
endif
|
|
28
|
+
BACKEND_PKGS = $(sort $(foreach backend,$(BACKENDS),$(BACKEND_PKGS_$(backend))))
|
|
29
|
+
BACKEND_DIRS = $(sort $(foreach backend,$(BACKENDS),$(BACKEND_DIR_$(backend))))
|
|
30
|
+
BACKEND_CPPFLAGS = $(foreach backend,$(sort $(BACKENDS)),-DRELAY_BACKEND_$(backend) $(BACKEND_FLAGS_$(backend)))
|
|
31
|
+
CODEC_PKGS = x264
|
|
32
|
+
PKGS = $(sort $(BACKEND_PKGS) $(CODEC_PKGS) $(PLATFORM_PKGS) libwebsockets zlib)
|
|
33
|
+
CPPFLAGS += -Isrc/engine $(BACKEND_CPPFLAGS) $(shell pkg-config --cflags $(PKGS))
|
|
34
|
+
CXXFLAGS ?= -O2
|
|
35
|
+
CXXFLAGS += -std=c++17 -Wall -Wextra -Wpedantic -pthread
|
|
36
|
+
BACKEND_LIBS = $(foreach backend,$(BACKENDS),$(BACKEND_LIBS_$(backend)))
|
|
37
|
+
LDLIBS += $(shell pkg-config --libs $(PKGS)) $(BACKEND_LIBS) -pthread
|
|
38
|
+
|
|
39
|
+
CORE_SRCS = $(wildcard src/engine/core/*.cpp)
|
|
40
|
+
BACKEND_SRCS = $(foreach dir,$(BACKEND_DIRS),$(wildcard src/engine/backends/$(dir)/*.cpp src/engine/backends/$(dir)/*.mm))
|
|
41
|
+
BACKEND_OBJCXXFLAGS = $(if $(filter %.mm,$(BACKEND_SRCS)),-fobjc-arc)
|
|
42
|
+
ENGINE_SRCS = $(CORE_SRCS) $(wildcard src/engine/server/*.cpp) $(BACKEND_SRCS)
|
|
43
|
+
HEADERS = $(wildcard src/engine/*/*.hpp src/engine/backends/linux/*.hpp) $(foreach dir,$(BACKEND_DIRS),$(wildcard src/engine/backends/$(dir)/*.hpp))
|
|
44
|
+
|
|
45
|
+
WAYLAND_PROTOCOLS = wlr-screencopy-unstable-v1 wlr-virtual-pointer-unstable-v1 virtual-keyboard-unstable-v1
|
|
46
|
+
.PHONY: all deps install test test-color test-flow test-capture-bucket test-cpu-budget test-input test-backend test-server test-keymap test-macos-keys clean FORCE
|
|
47
|
+
all: relay-engine
|
|
48
|
+
|
|
49
|
+
ifeq ($(HAS_WAYLAND),wayland)
|
|
50
|
+
WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner)
|
|
51
|
+
WAYLAND_PROTOCOL_HEADERS = $(addprefix build/protocols/,$(addsuffix -client-protocol.h,$(WAYLAND_PROTOCOLS)))
|
|
52
|
+
WAYLAND_PROTOCOL_SOURCES = $(addprefix build/protocols/,$(addsuffix -protocol.c,$(WAYLAND_PROTOCOLS)))
|
|
53
|
+
WAYLAND_PROTOCOL_OBJECTS = $(addprefix build/protocols/,$(addsuffix -protocol.o,$(WAYLAND_PROTOCOLS)))
|
|
54
|
+
CPPFLAGS += -Ibuild/protocols
|
|
55
|
+
|
|
56
|
+
$(WAYLAND_PROTOCOL_HEADERS): build/protocols/%-client-protocol.h: src/engine/backends/linux/wayland/protocols/%.xml
|
|
57
|
+
mkdir -p $(@D)
|
|
58
|
+
$(WAYLAND_SCANNER) client-header $< $@
|
|
59
|
+
|
|
60
|
+
$(WAYLAND_PROTOCOL_SOURCES): build/protocols/%-protocol.c: src/engine/backends/linux/wayland/protocols/%.xml
|
|
61
|
+
mkdir -p $(@D)
|
|
62
|
+
$(WAYLAND_SCANNER) private-code $< $@
|
|
63
|
+
|
|
64
|
+
$(WAYLAND_PROTOCOL_OBJECTS): build/protocols/%-protocol.o: build/protocols/%-protocol.c build/protocols/%-client-protocol.h
|
|
65
|
+
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
|
66
|
+
|
|
67
|
+
$(ENGINE_SRCS): $(WAYLAND_PROTOCOL_HEADERS)
|
|
68
|
+
endif
|
|
69
|
+
|
|
70
|
+
deps:
|
|
71
|
+
@$(CXX) --version >/dev/null 2>&1
|
|
72
|
+
@pkg-config --exists --print-errors $(PKGS) $(if $(HAS_WAYLAND),wayland-scanner)
|
|
73
|
+
|
|
74
|
+
PREFIX ?= /usr/local
|
|
75
|
+
|
|
76
|
+
install: relay-engine
|
|
77
|
+
@test -f dist/viewer/viewer.js || { echo 'Run npm run build first (dist/viewer is missing).' >&2; exit 1; }
|
|
78
|
+
install -d "$(DESTDIR)$(PREFIX)/lib/relay/viewer" "$(DESTDIR)$(PREFIX)/bin"
|
|
79
|
+
install -m 0755 relay-engine "$(DESTDIR)$(PREFIX)/lib/relay/relay-engine"
|
|
80
|
+
install -m 0644 dist/viewer/index.html dist/viewer/viewer.js "$(DESTDIR)$(PREFIX)/lib/relay/viewer/"
|
|
81
|
+
ln -sfn ../lib/relay/relay-engine "$(DESTDIR)$(PREFIX)/bin/relay-engine"
|
|
82
|
+
|
|
83
|
+
build/backends: FORCE
|
|
84
|
+
mkdir -p build
|
|
85
|
+
@printf '%s\n' '$(strip $(BACKENDS))' | cmp -s - $@ || printf '%s\n' '$(strip $(BACKENDS))' > $@
|
|
86
|
+
|
|
87
|
+
FORCE:
|
|
88
|
+
|
|
89
|
+
relay-engine: $(ENGINE_SRCS) $(HEADERS) $(WAYLAND_PROTOCOL_OBJECTS) build/backends
|
|
90
|
+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(BACKEND_OBJCXXFLAGS) $(ENGINE_SRCS) $(WAYLAND_PROTOCOL_OBJECTS) -o $@ $(LDLIBS)
|
|
91
|
+
|
|
92
|
+
build/color-test: tests/unit/color-test.cpp src/engine/core/color.cpp src/engine/core/color.hpp
|
|
93
|
+
mkdir -p build
|
|
94
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/color-test.cpp src/engine/core/color.cpp -o $@
|
|
95
|
+
|
|
96
|
+
test-color: build/color-test
|
|
97
|
+
./build/color-test
|
|
98
|
+
|
|
99
|
+
build/flow-test: tests/unit/flow-test.cpp src/engine/core/flow.hpp
|
|
100
|
+
mkdir -p build
|
|
101
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/flow-test.cpp -o $@
|
|
102
|
+
|
|
103
|
+
test-flow: build/flow-test
|
|
104
|
+
./build/flow-test
|
|
105
|
+
|
|
106
|
+
build/capture-bucket-test: tests/unit/capture-bucket-test.cpp src/engine/core/capture-bucket.hpp
|
|
107
|
+
mkdir -p build
|
|
108
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/capture-bucket-test.cpp -o $@
|
|
109
|
+
|
|
110
|
+
test-capture-bucket: build/capture-bucket-test
|
|
111
|
+
./build/capture-bucket-test
|
|
112
|
+
|
|
113
|
+
build/cpu-budget-test: tests/unit/cpu-budget-test.cpp src/engine/core/cpu-budget.hpp
|
|
114
|
+
mkdir -p build
|
|
115
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/cpu-budget-test.cpp -o $@
|
|
116
|
+
|
|
117
|
+
test-cpu-budget: build/cpu-budget-test
|
|
118
|
+
./build/cpu-budget-test
|
|
119
|
+
|
|
120
|
+
build/input-test: tests/unit/input-test.cpp src/engine/core/input.cpp src/engine/core/input.hpp
|
|
121
|
+
mkdir -p build
|
|
122
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/input-test.cpp src/engine/core/input.cpp -o $@
|
|
123
|
+
|
|
124
|
+
test-input: build/input-test
|
|
125
|
+
./build/input-test
|
|
126
|
+
|
|
127
|
+
build/backend-source-test: tests/unit/backend-source-test.cpp $(CORE_SRCS) $(wildcard src/engine/core/*.hpp)
|
|
128
|
+
mkdir -p build
|
|
129
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/backend-source-test.cpp $(CORE_SRCS) -o $@ $(shell pkg-config --cflags --libs $(CODEC_PKGS) libavcodec libavutil libswscale)
|
|
130
|
+
|
|
131
|
+
test-backend: build/backend-source-test
|
|
132
|
+
./build/backend-source-test
|
|
133
|
+
|
|
134
|
+
SERVER_TEST_SRCS = src/engine/server/config.cpp src/engine/server/metrics.cpp src/engine/server/wire.cpp src/engine/server/backend.cpp src/engine/core/input.cpp src/engine/core/wait.cpp $(BACKEND_SRCS)
|
|
135
|
+
|
|
136
|
+
build/test-viewer/viewer.js:
|
|
137
|
+
mkdir -p build/test-viewer
|
|
138
|
+
: > build/test-viewer/index.html
|
|
139
|
+
: > build/test-viewer/viewer.js
|
|
140
|
+
|
|
141
|
+
build/server-test: tests/unit/server-test.cpp $(SERVER_TEST_SRCS) $(HEADERS) $(WAYLAND_PROTOCOL_HEADERS) $(WAYLAND_PROTOCOL_OBJECTS) build/test-viewer/viewer.js build/backends
|
|
142
|
+
mkdir -p build
|
|
143
|
+
$(CXX) -Isrc/engine $(BACKEND_CPPFLAGS) $(if $(HAS_WAYLAND),-Ibuild/protocols) $(shell pkg-config --cflags $(BACKEND_PKGS) $(PLATFORM_PKGS) libwebsockets) $(CXXFLAGS) $(BACKEND_OBJCXXFLAGS) tests/unit/server-test.cpp $(SERVER_TEST_SRCS) $(WAYLAND_PROTOCOL_OBJECTS) -o $@ $(shell pkg-config --libs $(BACKEND_PKGS) $(PLATFORM_PKGS) libwebsockets) $(BACKEND_LIBS)
|
|
144
|
+
|
|
145
|
+
test-server: build/server-test
|
|
146
|
+
./build/server-test
|
|
147
|
+
|
|
148
|
+
build/keymap-test: tests/unit/keymap-test.cpp src/engine/backends/linux/wayland/keymap.cpp
|
|
149
|
+
mkdir -p build
|
|
150
|
+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(shell pkg-config --cflags xkbcommon) $^ -o $@ $(shell pkg-config --libs xkbcommon)
|
|
151
|
+
|
|
152
|
+
test-keymap: build/keymap-test
|
|
153
|
+
./build/keymap-test
|
|
154
|
+
|
|
155
|
+
build/macos-keys-test: tests/unit/macos-keys-test.cpp src/engine/backends/macos/keys.hpp src/engine/backends/linux/keycodes.hpp
|
|
156
|
+
mkdir -p build
|
|
157
|
+
$(CXX) -Isrc/engine $(CXXFLAGS) tests/unit/macos-keys-test.cpp -o $@ -framework Carbon -framework CoreFoundation
|
|
158
|
+
|
|
159
|
+
test-macos-keys: build/macos-keys-test
|
|
160
|
+
./build/macos-keys-test
|
|
161
|
+
|
|
162
|
+
test: test-color test-flow test-capture-bucket test-cpu-budget test-input test-backend test-server $(if $(HAS_WAYLAND),test-keymap) $(if $(filter macos,$(BACKENDS)),test-macos-keys)
|
|
163
|
+
|
|
164
|
+
clean:
|
|
165
|
+
rm -rf build relay-engine
|
package/README.md
CHANGED
|
@@ -1,3 +1,114 @@
|
|
|
1
1
|
# screen-relay
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Desktop streaming and control for people and AI agents: watch a desktop in a browser, and click, type, and take screenshots from the shell.
|
|
4
|
+
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://vercel.com/labs#active-experiments"><img alt="Vercel Labs Experiment" src="https://img.shields.io/badge/LABS-EXPERIMENT-0a0a0a.svg?style=for-the-badge&logo=Vercel&labelColor=000000" height="28"></a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/screen-relay"><img alt="npm version: screen-relay" src="https://img.shields.io/npm/v/screen-relay.svg?style=for-the-badge&labelColor=000000" height="28"></a>
|
|
8
|
+
<a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/LICENSE-APACHE--2.0-97ca00.svg?style=for-the-badge&labelColor=000000" height="28"></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
screen-relay starts a desktop on a Linux VM, sandbox, or container, or attaches to the display of a Mac or the signed-in desktop of a Windows PC, and streams it to a browser as H.264. An agent controls the same desktop one command at a time: it takes a screenshot, clicks or types, and takes another screenshot to check the result. The `screen-relay` CLI, a Node SDK, and an HTTP and WebSocket API all reach the same session.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g screen-relay
|
|
17
|
+
screen-relay install # system packages and the engine build (first time only)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **Requirements:** Node 22 or newer. On Linux: Debian, Ubuntu, Fedora, Arch Linux, or Alpine. On macOS: Homebrew and the Xcode Command Line Tools. On Windows: Windows 10 or later on x64, with a user signed in at the PC's screen.
|
|
21
|
+
- **Scripts and agents:** `screen-relay install --yes` skips the confirmation. At a terminal, `install` asks before it installs packages.
|
|
22
|
+
- **Wayland:** `screen-relay install --backend wayland`. The default backend on Linux is X11.
|
|
23
|
+
- **Client only:** the npm install alone is enough to control a session on another machine.
|
|
24
|
+
|
|
25
|
+
Requirements, backends, and Windows are covered in [Getting started](https://screen-relay.dev/docs/getting-started).
|
|
26
|
+
|
|
27
|
+
## Quick start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
screen-relay up -d # start a display, a desktop, and the engine
|
|
31
|
+
screen-relay run -- xfce4-terminal # open an app on the desktop
|
|
32
|
+
screen-relay screenshot screen.png # see the screen
|
|
33
|
+
screen-relay click 0.5 0.5 # coordinates are fractions of the screen
|
|
34
|
+
screen-relay type "echo hello"
|
|
35
|
+
screen-relay key Enter
|
|
36
|
+
screen-relay down
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- `up` prints a viewer link. Open it in a browser with H.264 WebCodecs: current Chrome, Edge, or Safari.
|
|
40
|
+
- The engine listens on `127.0.0.1:8080`. From another machine, forward the port with `ssh -N -L 8080:127.0.0.1:8080 user@your-vm`, or see [Remote access](https://screen-relay.dev/docs/remote-access).
|
|
41
|
+
- On a machine that is not set up yet, `up` runs the same setup as `install` first.
|
|
42
|
+
- A successful input command means the engine applied the input, not that the app reacted. Take a screenshot to check.
|
|
43
|
+
|
|
44
|
+
The full walkthrough is in [Getting started](https://screen-relay.dev/docs/getting-started).
|
|
45
|
+
|
|
46
|
+
## How it works
|
|
47
|
+
|
|
48
|
+
`screen-relay up` starts a session: a virtual display, a desktop, and the engine. On Linux the display is X11 with XFCE or headless Wayland with sway. On a Mac the engine attaches to the display you are logged in to. On Windows it attaches to the desktop of the signed-in user. The engine captures the screen, encodes it as H.264, and serves the viewer, the stream, and the input API on one port. It lowers the bitrate on a slow link. See [How streaming works](https://screen-relay.dev/docs/how-streaming-works).
|
|
49
|
+
|
|
50
|
+
A session listens on loopback with no token by default. Starting it with `--public` or on another address creates a token that every remote request must send. Only one controller sends input at a time: a viewer that took control, an SDK control session, or the CLI. A viewer opens view-only, so it can watch while the CLI or SDK sends input. Screenshots still work while another controller holds input.
|
|
51
|
+
|
|
52
|
+
## For AI agents
|
|
53
|
+
|
|
54
|
+
The CLI ships skills that match its version:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
screen-relay skills get core # the control loop, coordinates, type versus key, and errors
|
|
58
|
+
screen-relay skills get core --full # adds every reference: CLI, config, SDK, macOS, Wayland, troubleshooting
|
|
59
|
+
screen-relay skills list # specialized skills, such as vercel-sandbox
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Or add this to your `AGENTS.md`:
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
Use `screen-relay` to see and control a desktop. Before the first use, run
|
|
66
|
+
`screen-relay skills get core` and follow it.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Every command prints JSON with `--json`. An error carries a `reason` and, when there is one, the next command to run.
|
|
70
|
+
|
|
71
|
+
## Commands
|
|
72
|
+
|
|
73
|
+
Run `screen-relay --help` for the full list, or `screen-relay <command> --help` for one command.
|
|
74
|
+
|
|
75
|
+
| Group | Commands | Docs |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| Session | `up`, `down`, `status`, `logs`, `run` | [CLI reference](https://screen-relay.dev/docs/cli) |
|
|
78
|
+
| Control | `screenshot`, `click`, `move`, `scroll`, `key`, `type`, `input` | [Client commands](https://screen-relay.dev/docs/cli#client-commands) |
|
|
79
|
+
| Setup | `install`, `doctor` | [Getting started](https://screen-relay.dev/docs/getting-started), [Troubleshooting](https://screen-relay.dev/docs/troubleshooting) |
|
|
80
|
+
| Agents | `skills`, `help` | [Agent skills](https://screen-relay.dev/docs/agent-skills) |
|
|
81
|
+
|
|
82
|
+
Flags, environment variables, and `config.yaml` are documented in [Configuration](https://screen-relay.dev/docs/configuration).
|
|
83
|
+
|
|
84
|
+
## Platforms
|
|
85
|
+
|
|
86
|
+
The engine runs on Linux (x64 and ARM64, X11 and Wayland), on macOS 12.3 or later (Apple silicon and Intel), and on Windows 10 or later (x64). `screen-relay install` builds it on your machine. See [Linux](https://screen-relay.dev/docs/linux), [macOS](https://screen-relay.dev/docs/macos), and [Windows](https://screen-relay.dev/docs/windows).
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
Building from source requires Node.js 22 or later, a C++17 compiler, `make`, and the libraries that `screen-relay install` installs:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm ci
|
|
94
|
+
npm run build # the CLI, the SDK, and the viewer
|
|
95
|
+
make # the engine, for the default backend
|
|
96
|
+
npm test
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Run the engine tests with `make test`, which also needs the FFmpeg development libraries.
|
|
100
|
+
|
|
101
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) covers the source layout, the engine, and the tests. [AGENTS.md](AGENTS.md) covers the writing rules and the release process.
|
|
102
|
+
|
|
103
|
+
## Documentation
|
|
104
|
+
|
|
105
|
+
- [screen-relay.dev](https://screen-relay.dev): introduction, guides, and reference
|
|
106
|
+
- [CLI reference](https://screen-relay.dev/docs/cli) and [Configuration](https://screen-relay.dev/docs/configuration)
|
|
107
|
+
- [Node SDK](https://screen-relay.dev/docs/sdk) and [HTTP API](https://screen-relay.dev/docs/protocol)
|
|
108
|
+
- [Remote access](https://screen-relay.dev/docs/remote-access): tokens, TLS, and tunnels
|
|
109
|
+
- [Docker](https://screen-relay.dev/docs/docker) and [Vercel Sandbox](https://screen-relay.dev/docs/vercel-sandbox)
|
|
110
|
+
- [Changelog](CHANGELOG.md)
|
|
111
|
+
|
|
112
|
+
## License
|
|
113
|
+
|
|
114
|
+
Apache-2.0. The engine links x264, which is licensed under GPL-2.0-or-later, from your system when `screen-relay install` builds it. See [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
screen-relay is licensed under the Apache License, Version 2.0. See `LICENSE`.
|
|
4
|
+
|
|
5
|
+
The published npm package contains the third-party software listed here.
|
|
6
|
+
|
|
7
|
+
## Bundled in the CLI
|
|
8
|
+
|
|
9
|
+
### yaml 2.9.1
|
|
10
|
+
|
|
11
|
+
ISC License.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Copyright Eemeli Aro <eemeli@gmail.com>
|
|
15
|
+
|
|
16
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
17
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
18
|
+
and this permission notice appear in all copies.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
22
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
24
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
25
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
26
|
+
THIS SOFTWARE.
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### @vercel/detect-agent 1.2.7
|
|
30
|
+
|
|
31
|
+
Copyright 2017 Vercel, Inc. Licensed under the Apache License, Version 2.0. The license text is in `LICENSE`.
|
|
32
|
+
|
|
33
|
+
### MIT-licensed packages
|
|
34
|
+
|
|
35
|
+
- @clack/prompts 1.9.0 and @clack/core 1.6.0: Copyright (c) 2025-Present Bombshell contributors (https://bomb.sh/team)
|
|
36
|
+
- sisteransi 2.0.0: Copyright (c) 2018 Terkel Gjervig Nielsen
|
|
37
|
+
- fast-string-width 3.0.2 and fast-string-truncated-width 3.0.3: Copyright (c) 2024-present Fabio Spampinato
|
|
38
|
+
- fast-wrap-ansi 0.2.2: Copyright (c) 2025 James Garbutt; Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
in the Software without restriction, including without limitation the rights
|
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
furnished to do so, subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
SOFTWARE.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Wayland protocol definitions in the engine source
|
|
61
|
+
|
|
62
|
+
The files in `src/engine/backends/linux/wayland/protocols/` are licensed under the MIT license. Each file carries its copyright and permission notice.
|
|
63
|
+
|
|
64
|
+
- `virtual-keyboard-unstable-v1.xml`: Copyright 2008-2011 Kristian Høgsberg; 2010-2013 Intel Corporation; 2012-2013 Collabora, Ltd.; 2018 Purism SPC
|
|
65
|
+
- `wlr-screencopy-unstable-v1.xml`: Copyright 2018 Simon Ser; 2019 Andri Yngvason
|
|
66
|
+
- `wlr-virtual-pointer-unstable-v1.xml`: Copyright 2019 Josef Gajdusek
|
|
67
|
+
|
|
68
|
+
## Libraries the engine links when it is built
|
|
69
|
+
|
|
70
|
+
screen-relay does not distribute these. `screen-relay install` builds the engine on your machine against the copies your system provides.
|
|
71
|
+
|
|
72
|
+
- x264: GPL-2.0-or-later. An engine binary that links x264 is covered by the GPL if you redistribute it.
|
|
73
|
+
- libwebsockets: MIT
|
|
74
|
+
- zlib: zlib license
|
|
75
|
+
- libX11, libXext, libXdamage, libXfixes, libXtst, libwayland-client, libxkbcommon: MIT and similar permissive licenses
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Failure } from './output.js';
|
|
2
|
+
type Args = Record<string, any> & {
|
|
3
|
+
command: string;
|
|
4
|
+
json: boolean;
|
|
5
|
+
name: string;
|
|
6
|
+
};
|
|
7
|
+
interface Target {
|
|
8
|
+
url: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
certificate?: string;
|
|
11
|
+
connect?: string;
|
|
12
|
+
timeout: number;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
explicit: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** Resolves the engine a client command talks to from flags, the environment, or the local session. */
|
|
17
|
+
export declare function resolveTarget(args: Args): Target;
|
|
18
|
+
/** Turns an SDK error into the CLI failure shape the documented commands and exit codes use. */
|
|
19
|
+
export declare function clientFailure(error: unknown, target: Target): Failure;
|
|
20
|
+
export declare function cmdScreenshot(args: Args): Promise<number>;
|
|
21
|
+
export declare function cmdClick(args: Args): Promise<number>;
|
|
22
|
+
export declare function cmdMove(args: Args): Promise<number>;
|
|
23
|
+
export declare function cmdScroll(args: Args): Promise<number>;
|
|
24
|
+
export declare function cmdKey(args: Args): Promise<number>;
|
|
25
|
+
export declare function cmdType(args: Args): Promise<number>;
|
|
26
|
+
export declare function cmdInput(args: Args): Promise<number>;
|
|
27
|
+
export declare function cmdRemoteStatus(args: Args): Promise<number>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Failure } from './output.js';
|
|
2
|
+
export type Args = Record<string, unknown> & {
|
|
3
|
+
command: string;
|
|
4
|
+
json: boolean;
|
|
5
|
+
name: string;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
};
|
|
8
|
+
export type Parameter = {
|
|
9
|
+
name: string;
|
|
10
|
+
summary: string;
|
|
11
|
+
type: 'string' | 'boolean' | 'number';
|
|
12
|
+
short?: string;
|
|
13
|
+
valueHint?: string;
|
|
14
|
+
default?: string | number | boolean;
|
|
15
|
+
acceptedValues?: readonly string[];
|
|
16
|
+
repeat?: 'last' | 'collect';
|
|
17
|
+
required?: boolean;
|
|
18
|
+
brackets?: boolean;
|
|
19
|
+
missingReason?: string;
|
|
20
|
+
environment?: string;
|
|
21
|
+
deferredDefault?: boolean;
|
|
22
|
+
validate?: (value: unknown) => boolean;
|
|
23
|
+
};
|
|
24
|
+
export type Subcommand = {
|
|
25
|
+
name: string;
|
|
26
|
+
summary: string;
|
|
27
|
+
examples: {
|
|
28
|
+
description: string;
|
|
29
|
+
command: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
export type RunsOn = 'vm' | 'client' | 'anywhere';
|
|
33
|
+
export type Command = {
|
|
34
|
+
summary: string;
|
|
35
|
+
group: 'Session' | 'Control' | 'Machine';
|
|
36
|
+
runsOn: RunsOn;
|
|
37
|
+
arguments: Parameter[];
|
|
38
|
+
options: Parameter[];
|
|
39
|
+
examples: {
|
|
40
|
+
description: string;
|
|
41
|
+
command: string;
|
|
42
|
+
}[];
|
|
43
|
+
notes: string[];
|
|
44
|
+
resultSchema: Record<string, unknown>;
|
|
45
|
+
separator?: string;
|
|
46
|
+
usageTail?: string;
|
|
47
|
+
subcommands?: Subcommand[];
|
|
48
|
+
validate?: (args: Args) => string | Failure | undefined;
|
|
49
|
+
run?: (args: Args) => number | Promise<number>;
|
|
50
|
+
};
|
|
51
|
+
export declare const globalOptions: Parameter[];
|
|
52
|
+
export declare const commands: Record<string, Command>;
|