dsh-browser-cdp 0.0.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +27 -0
- package/README.md +279 -9
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/bin/cdp-cast-worker.mjs +6960 -0
- package/bin/cdp-chrome-wrapper.sh +53 -0
- package/bin/cdp-render-worker.mjs +610 -0
- package/bin/record-normalize.d.mts +32 -0
- package/bin/record-normalize.mjs +156 -0
- package/cordis.patch.yml +17 -0
- package/dsh-plugin.json +148 -0
- package/lib/client.js +3235 -0
- package/lib/index.js +8865 -0
- package/lib/launcher-CQyI8-By.js +3 -0
- package/lib/launcher-DBaxfIsF.js +269 -0
- package/package.json +89 -14
- package/runtime/PATCHES.md +30 -0
- package/runtime/ego-browser/dist/out/index.js +7206 -0
- package/runtime/ego-browser/screenshot-clip.d.mts +22 -0
- package/runtime/ego-browser/screenshot-clip.mjs +45 -0
- package/runtime/ego-linux/bin/ego-browser.mjs +399 -0
- package/runtime/ego-linux/src/agent-identity.mjs +65 -0
- package/runtime/ego-linux/src/chrome.mjs +867 -0
- package/runtime/ego-linux/src/cursor.mjs +1292 -0
- package/runtime/ego-linux/src/desktop.mjs +73 -0
- package/runtime/ego-linux/src/paths.mjs +35 -0
- package/runtime/ego-linux/src/session.mjs +37 -0
- package/runtime/ego-linux/src/shim.mjs +145 -0
- package/runtime/ego-linux/src/snapshot.mjs +424 -0
- package/runtime/ego-linux/src/spaces-server.mjs +355 -0
- package/runtime/ego-linux/src/spaces-ui.mjs +456 -0
- package/runtime/ego-linux/src/tabs.mjs +109 -0
- package/runtime/ego-linux/src/task-spaces.mjs +671 -0
- package/runtime/ego-linux/src/transport.mjs +321 -0
- package/runtime/ego-linux/src/window-fit.mjs +107 -0
- package/runtime/skills/ego-browser/SKILL.md +209 -0
- package/runtime/skills/ego-browser/agents/openai.yaml +7 -0
- package/runtime/skills/ego-browser/assets/composer-icon.png +0 -0
- package/runtime/skills/ego-browser/assets/logo.png +0 -0
- package/runtime/skills/ego-browser/learnings/google/browser-tools/autocomplete.js +11 -0
- package/runtime/skills/ego-browser/learnings/google/manifest.json +40 -0
- package/runtime/skills/ego-browser/learnings/google/notes/overview.md +23 -0
- package/runtime/skills/ego-browser/learnings/google/tools/search-extract.js +35 -0
- package/runtime/skills/ego-browser/learnings/x-com/browser-tools/extract-post.js +9 -0
- package/runtime/skills/ego-browser/learnings/x-com/manifest.json +51 -0
- package/runtime/skills/ego-browser/learnings/x-com/notes/overview.md +18 -0
- package/runtime/skills/ego-browser/learnings/x-com/notes/timeline.md +19 -0
- package/runtime/skills/ego-browser/learnings/x-com/tools/search-users.js +33 -0
- package/runtime/skills/ego-browser/learnings/x-com/tools/timeline.js +32 -0
- package/runtime/skills/ego-browser/references/install.md +131 -0
- package/runtime/skills/ego-browser/references/task-spaces.md +122 -0
- package/runtime/skills/ego-browser/references/video.md +17 -0
- package/runtime/skills/ego-browser/scripts/install.sh +309 -0
- package/index.js +0 -11
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#v1.5 2026.06.04 17:16
|
|
3
|
+
|
|
4
|
+
set -eu
|
|
5
|
+
|
|
6
|
+
# Default package URL and installation paths.
|
|
7
|
+
DMG_URL_ARM64="https://cdn.ego.app/channel/egobrowser_npx_referral/setup/macos/arm64/egolite.dmg"
|
|
8
|
+
DMG_URL_X64="https://cdn.ego.app/channel/egobrowser_npx_referral/setup/macos/x64/egolite.dmg"
|
|
9
|
+
APP_NAME="ego lite"
|
|
10
|
+
APP_BUNDLE_NAME="$APP_NAME.app"
|
|
11
|
+
APP_PATH="/Applications/$APP_BUNDLE_NAME"
|
|
12
|
+
USER_APP_PATH="$HOME/Applications/$APP_BUNDLE_NAME"
|
|
13
|
+
EGO_BROWSER_HELPER_NAME="ego-browser"
|
|
14
|
+
|
|
15
|
+
# Linux: there is no .dmg to mount, so the CLI is linked from this repo instead.
|
|
16
|
+
LINUX_BIN_DIR="${EGO_LINUX_BIN_DIR:-$HOME/.local/bin}"
|
|
17
|
+
# Keep in sync with CHROME_CANDIDATES in package/ego-linux/src/chrome.mjs.
|
|
18
|
+
LINUX_CHROME_CANDIDATES="google-chrome google-chrome-stable chromium chromium-browser brave-browser microsoft-edge"
|
|
19
|
+
LINUX_MIN_NODE_MAJOR=22
|
|
20
|
+
|
|
21
|
+
# Temporary directories created when mounting the DMG; cleaned up on exit.
|
|
22
|
+
TEMP_DIR=""
|
|
23
|
+
MOUNT_DIR=""
|
|
24
|
+
DMG_ATTACHED=""
|
|
25
|
+
|
|
26
|
+
log() {
|
|
27
|
+
printf '%s\n' "$*" >&2
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
die() {
|
|
31
|
+
log "error: $*"
|
|
32
|
+
exit 1
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
require_command() {
|
|
36
|
+
command -v "$1" >/dev/null 2>&1 || die "missing required command: $1"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
select_dmg_url() {
|
|
40
|
+
if [ "$(uname -m)" = "arm64" ]; then
|
|
41
|
+
printf '%s\n' "$DMG_URL_ARM64"
|
|
42
|
+
else
|
|
43
|
+
printf '%s\n' "$DMG_URL_X64"
|
|
44
|
+
fi
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
run_with_sudo_if_needed() {
|
|
48
|
+
# Try without elevated privileges first; fall back to sudo to avoid unnecessary prompts.
|
|
49
|
+
if "$@"; then
|
|
50
|
+
return 0
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
if [ "$(id -u)" -eq 0 ]; then
|
|
54
|
+
return 1
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
require_command sudo
|
|
58
|
+
sudo "$@"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
cleanup() {
|
|
62
|
+
# Detach the DMG and remove the temp directory on success, failure, or Ctrl+C.
|
|
63
|
+
if [ "$DMG_ATTACHED" = "1" ]; then
|
|
64
|
+
if ! hdiutil detach "$MOUNT_DIR" -quiet >/dev/null 2>&1; then
|
|
65
|
+
log "warning: failed to detach $MOUNT_DIR"
|
|
66
|
+
fi
|
|
67
|
+
DMG_ATTACHED=""
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
if [ -n "$TEMP_DIR" ] && [ -d "$TEMP_DIR" ]; then
|
|
71
|
+
rm -rf "$TEMP_DIR" >/dev/null 2>&1 ||
|
|
72
|
+
log "warning: failed to remove temporary directory: $TEMP_DIR"
|
|
73
|
+
fi
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
strip_quarantine_attributes() {
|
|
77
|
+
app_path="$1"
|
|
78
|
+
run_with_sudo_if_needed xattr -dr com.apple.quarantine "$app_path" \
|
|
79
|
+
>/dev/null 2>&1 || true
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
trap cleanup EXIT HUP INT TERM
|
|
83
|
+
|
|
84
|
+
find_ego_browser_in_app() {
|
|
85
|
+
app_path="$1"
|
|
86
|
+
|
|
87
|
+
[ -d "$app_path/Contents" ] || return 1
|
|
88
|
+
|
|
89
|
+
# A Chromium app bundle may contain multiple versions; prefer the one under Current.
|
|
90
|
+
for candidate in "$app_path"/Contents/Frameworks/*.framework/Versions/Current/Helpers/"$EGO_BROWSER_HELPER_NAME"; do
|
|
91
|
+
if [ -x "$candidate" ]; then
|
|
92
|
+
printf '%s\n' "$candidate"
|
|
93
|
+
return 0
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
# ego-browser may live in various locations inside the bundle; search under Contents.
|
|
98
|
+
browser_path=$(
|
|
99
|
+
find "$app_path/Contents" -type f -name "$EGO_BROWSER_HELPER_NAME" 2>/dev/null |
|
|
100
|
+
while IFS= read -r candidate; do
|
|
101
|
+
if [ -x "$candidate" ]; then
|
|
102
|
+
printf '%s\n' "$candidate"
|
|
103
|
+
break
|
|
104
|
+
fi
|
|
105
|
+
done
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
if [ -n "$browser_path" ]; then
|
|
109
|
+
printf '%s\n' "$browser_path"
|
|
110
|
+
return 0
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
return 1
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
is_ego_lite_app() {
|
|
117
|
+
app_path="$1"
|
|
118
|
+
|
|
119
|
+
# The directory exists and contains a working ego-browser — ego lite is considered installed.
|
|
120
|
+
[ -d "$app_path" ] || return 1
|
|
121
|
+
find_ego_browser_in_app "$app_path" >/dev/null
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
find_ego_lite_app() {
|
|
125
|
+
for app_path in "$APP_PATH" "$USER_APP_PATH"; do
|
|
126
|
+
if is_ego_lite_app "$app_path"; then
|
|
127
|
+
printf '%s\n' "$app_path"
|
|
128
|
+
return 0
|
|
129
|
+
fi
|
|
130
|
+
done
|
|
131
|
+
|
|
132
|
+
for apps_dir in "$(dirname "$APP_PATH")" "$(dirname "$USER_APP_PATH")"; do
|
|
133
|
+
[ -d "$apps_dir" ] || continue
|
|
134
|
+
|
|
135
|
+
app_path=$(
|
|
136
|
+
find "$apps_dir" -maxdepth 1 -type d -iname "$APP_BUNDLE_NAME" 2>/dev/null |
|
|
137
|
+
while IFS= read -r candidate; do
|
|
138
|
+
if is_ego_lite_app "$candidate"; then
|
|
139
|
+
printf '%s\n' "$candidate"
|
|
140
|
+
break
|
|
141
|
+
fi
|
|
142
|
+
done
|
|
143
|
+
)
|
|
144
|
+
if [ -n "$app_path" ]; then
|
|
145
|
+
printf '%s\n' "$app_path"
|
|
146
|
+
return 0
|
|
147
|
+
fi
|
|
148
|
+
done
|
|
149
|
+
|
|
150
|
+
return 1
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
install_ego_lite() {
|
|
154
|
+
require_command curl
|
|
155
|
+
require_command hdiutil
|
|
156
|
+
|
|
157
|
+
# Download and mount the DMG in an isolated temp directory to avoid polluting the CWD.
|
|
158
|
+
temp_base_dir=${TMPDIR:-/tmp}
|
|
159
|
+
temp_base_dir=${temp_base_dir%/}
|
|
160
|
+
TEMP_DIR=$(mktemp -d "$temp_base_dir/ego-lite-install.XXXXXX")
|
|
161
|
+
MOUNT_DIR="$TEMP_DIR/mount"
|
|
162
|
+
dmg_path="$TEMP_DIR/egolite.dmg"
|
|
163
|
+
dmg_url=$(select_dmg_url)
|
|
164
|
+
mkdir -p "$MOUNT_DIR"
|
|
165
|
+
|
|
166
|
+
log "$APP_NAME is not installed. Downloading $dmg_url ..."
|
|
167
|
+
curl -fL --retry 3 --output "$dmg_path" "$dmg_url" ||
|
|
168
|
+
die "failed to download $APP_NAME from $dmg_url"
|
|
169
|
+
|
|
170
|
+
log "Mounting installer ..."
|
|
171
|
+
hdiutil attach "$dmg_path" -nobrowse -readonly -mountpoint "$MOUNT_DIR" \
|
|
172
|
+
>/dev/null
|
|
173
|
+
DMG_ATTACHED="1"
|
|
174
|
+
|
|
175
|
+
# Handle DMGs that contain the app bundle directly.
|
|
176
|
+
app_in_dmg=$(
|
|
177
|
+
find "$MOUNT_DIR" -maxdepth 2 \
|
|
178
|
+
-type d -iname "$APP_BUNDLE_NAME" |
|
|
179
|
+
head -n 1
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
if [ -n "$app_in_dmg" ]; then
|
|
183
|
+
staged_app="$TEMP_DIR/$APP_BUNDLE_NAME"
|
|
184
|
+
|
|
185
|
+
log "Installing $APP_NAME to $APP_PATH ..."
|
|
186
|
+
ditto "$app_in_dmg" "$staged_app" ||
|
|
187
|
+
die "failed to stage $APP_NAME from installer"
|
|
188
|
+
find_ego_browser_in_app "$staged_app" >/dev/null ||
|
|
189
|
+
die "installed $APP_NAME does not contain $EGO_BROWSER_HELPER_NAME"
|
|
190
|
+
|
|
191
|
+
# Strip quarantine attributes to prevent Gatekeeper from blocking the first launch.
|
|
192
|
+
log "Removing quarantine attributes from $APP_NAME ..."
|
|
193
|
+
xattr -dr com.apple.quarantine "$staged_app" \
|
|
194
|
+
>/dev/null 2>&1 || true
|
|
195
|
+
|
|
196
|
+
if [ -d "$APP_PATH" ]; then
|
|
197
|
+
run_with_sudo_if_needed rm -rf "$APP_PATH" ||
|
|
198
|
+
die "failed to replace existing $APP_PATH"
|
|
199
|
+
fi
|
|
200
|
+
run_with_sudo_if_needed mv "$staged_app" "$APP_PATH" ||
|
|
201
|
+
die "failed to move $APP_NAME to $APP_PATH"
|
|
202
|
+
return 0
|
|
203
|
+
fi
|
|
204
|
+
|
|
205
|
+
# Fall back to pkg installer if the DMG contains a .pkg instead of an app bundle.
|
|
206
|
+
pkg_in_dmg=$(
|
|
207
|
+
find "$MOUNT_DIR" -maxdepth 2 -type f -name "*.pkg" |
|
|
208
|
+
head -n 1
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
if [ -n "$pkg_in_dmg" ]; then
|
|
212
|
+
log "Installing $APP_NAME package ..."
|
|
213
|
+
run_with_sudo_if_needed installer -pkg "$pkg_in_dmg" -target / ||
|
|
214
|
+
die "failed to install $APP_NAME package"
|
|
215
|
+
return 0
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
die "cannot find $APP_NAME app or pkg in mounted DMG"
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
main_macos() {
|
|
222
|
+
# Install first if not present; otherwise use the ego-browser bundled inside the app.
|
|
223
|
+
installed_app_path=$(find_ego_lite_app || true)
|
|
224
|
+
if [ -z "$installed_app_path" ]; then
|
|
225
|
+
install_ego_lite
|
|
226
|
+
installed_app_path=$(find_ego_lite_app || true)
|
|
227
|
+
[ -n "$installed_app_path" ] ||
|
|
228
|
+
die "$APP_NAME install completed, but app was not found"
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
strip_quarantine_attributes "$installed_app_path"
|
|
232
|
+
cleanup
|
|
233
|
+
|
|
234
|
+
log "Launching $APP_NAME ..."
|
|
235
|
+
exec open "$installed_app_path"
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
# Linux has no ego lite app bundle. The same harness under package/ego-browser
|
|
239
|
+
# drives a stock Chrome/Chromium over CDP through the shim in package/ego-linux,
|
|
240
|
+
# so the install is a build plus a symlink rather than a download.
|
|
241
|
+
main_linux() {
|
|
242
|
+
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
243
|
+
repo_root=$(CDPATH= cd -- "$script_dir/../../.." && pwd)
|
|
244
|
+
harness_dir="$repo_root/package/ego-browser"
|
|
245
|
+
shim_bin="$repo_root/package/ego-linux/bin/ego-browser.mjs"
|
|
246
|
+
link_path="$LINUX_BIN_DIR/$EGO_BROWSER_HELPER_NAME"
|
|
247
|
+
|
|
248
|
+
[ -f "$harness_dir/package.json" ] ||
|
|
249
|
+
die "cannot find the harness at $harness_dir — run this script from a checkout of this repository"
|
|
250
|
+
[ -f "$shim_bin" ] ||
|
|
251
|
+
die "cannot find the Linux shim at $shim_bin — this checkout predates Linux support"
|
|
252
|
+
|
|
253
|
+
require_command node
|
|
254
|
+
node_major=$(node -p 'process.versions.node.split(".")[0]')
|
|
255
|
+
[ "$node_major" -ge "$LINUX_MIN_NODE_MAJOR" ] ||
|
|
256
|
+
die "node >= $LINUX_MIN_NODE_MAJOR is required; found $(node -v)"
|
|
257
|
+
|
|
258
|
+
# The port drives a stock browser over CDP, so one of these must exist.
|
|
259
|
+
found_chrome=""
|
|
260
|
+
if [ -n "${EGO_LINUX_CHROME:-}" ] && [ -x "${EGO_LINUX_CHROME:-}" ]; then
|
|
261
|
+
found_chrome="$EGO_LINUX_CHROME"
|
|
262
|
+
else
|
|
263
|
+
for candidate in $LINUX_CHROME_CANDIDATES; do
|
|
264
|
+
if command -v "$candidate" >/dev/null 2>&1; then
|
|
265
|
+
found_chrome=$(command -v "$candidate")
|
|
266
|
+
break
|
|
267
|
+
fi
|
|
268
|
+
done
|
|
269
|
+
fi
|
|
270
|
+
[ -n "$found_chrome" ] ||
|
|
271
|
+
die "no Chrome/Chromium/Brave/Edge found on PATH (looked for: $LINUX_CHROME_CANDIDATES). Install one, or set EGO_LINUX_CHROME to an absolute path."
|
|
272
|
+
log "Using browser: $found_chrome"
|
|
273
|
+
|
|
274
|
+
# CI=true is required, not cosmetic: the harness's prepare script runs
|
|
275
|
+
# `lefthook install`, which fails on any machine with a global core.hooksPath.
|
|
276
|
+
log "Building the harness in $harness_dir ..."
|
|
277
|
+
(cd "$harness_dir" && CI=true npm ci && CI=true npm run build) ||
|
|
278
|
+
die "harness build failed"
|
|
279
|
+
|
|
280
|
+
mkdir -p "$LINUX_BIN_DIR"
|
|
281
|
+
ln -sf "$shim_bin" "$link_path"
|
|
282
|
+
log "Linked $link_path -> $shim_bin"
|
|
283
|
+
|
|
284
|
+
case ":$PATH:" in
|
|
285
|
+
*":$LINUX_BIN_DIR:"*) ;;
|
|
286
|
+
*) log "warning: $LINUX_BIN_DIR is not on PATH. Add it, or run: export PATH=\"$LINUX_BIN_DIR:\$PATH\"" ;;
|
|
287
|
+
esac
|
|
288
|
+
|
|
289
|
+
"$link_path" --help >/dev/null 2>&1 ||
|
|
290
|
+
die "installed $link_path but it failed to run"
|
|
291
|
+
|
|
292
|
+
log ""
|
|
293
|
+
log "ego-browser is installed. Optional next steps (both touch user data, so they are not automatic):"
|
|
294
|
+
log " ego-browser --import-chrome-profile inherit your real logins"
|
|
295
|
+
log " ego-browser --install-desktop-entry add an app launcher icon"
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
# Pick the flow by OS rather than refusing everything that is not macOS. The
|
|
299
|
+
# cleanup trap above is a no-op on Linux: nothing sets TEMP_DIR or DMG_ATTACHED
|
|
300
|
+
# on that path.
|
|
301
|
+
main() {
|
|
302
|
+
case "$(uname -s)" in
|
|
303
|
+
Darwin) main_macos ;;
|
|
304
|
+
Linux) main_linux ;;
|
|
305
|
+
*) die "unsupported platform: $(uname -s) (supported: macOS, Linux)" ;;
|
|
306
|
+
esac
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
main
|
package/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Name-reservation placeholder for `dsh-browser-cdp`.
|
|
3
|
-
*
|
|
4
|
-
* This version deliberately ships no functionality: 0.0.1 only claims the
|
|
5
|
-
* package name. The real DSH plugin (CDP attach + watch panel + element pick)
|
|
6
|
-
* is published from the dsh-browser-cdp repository under later versions.
|
|
7
|
-
*/
|
|
8
|
-
throw new Error(
|
|
9
|
-
'dsh-browser-cdp@0.0.1 is a name-reservation placeholder and has no implementation. ' +
|
|
10
|
-
'Install a version >= 0.8.5 to use the DSH browser plugin.',
|
|
11
|
-
)
|