@ivoryheart/herdr-world 0.1.0-rc.5
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 +22 -0
- package/README.md +25 -0
- package/THIRD_PARTY_NOTICES.md +52 -0
- package/UPSTREAM.md +33 -0
- package/bin/herdr-world +128 -0
- package/docs/world-assets.md +51 -0
- package/lib/bridges/linux-x64/herdr-world-bridge +0 -0
- package/lib/bridges/macos-arm64/herdr-world-bridge +0 -0
- package/lib/bridges/macos-x64/herdr-world-bridge +0 -0
- package/lib/herdr-world-launcher.sh +518 -0
- package/package.json +36 -0
- package/share/herdr-world/web/assets/BufferResource-TmONtVkO.js +311 -0
- package/share/herdr-world/web/assets/CanvasPool-C4EP4giG.js +1 -0
- package/share/herdr-world/web/assets/FederatedEventTarget-CkoT1sfc.js +1 -0
- package/share/herdr-world/web/assets/FilterSystem-Cc8XEqAi.js +173 -0
- package/share/herdr-world/web/assets/NoteMarkdownPreview-DSlfOjOc.js +29 -0
- package/share/herdr-world/web/assets/SpacesSurface-KQpjWcgW.js +1 -0
- package/share/herdr-world/web/assets/WebGLRenderer-COAVtjkI.js +1 -0
- package/share/herdr-world/web/assets/WebGPURenderer-DgfOPeWV.js +1 -0
- package/share/herdr-world/web/assets/WorldSurface-DvbdAI-_.js +197 -0
- package/share/herdr-world/web/assets/__vite-browser-external-2447137e-BvRk9kiK.js +0 -0
- package/share/herdr-world/web/assets/browserAll-B8-kqmYE.js +1 -0
- package/share/herdr-world/web/assets/chunk-QTnfLwEv.js +1 -0
- package/share/herdr-world/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/share/herdr-world/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/share/herdr-world/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/share/herdr-world/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/share/herdr-world/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/share/herdr-world/web/assets/getBatchSamplersUniformGroup-D-hqfegN.js +1 -0
- package/share/herdr-world/web/assets/ghostty-web-8_X1K5z2.js +13 -0
- package/share/herdr-world/web/assets/index-B1fwFDFH.css +1 -0
- package/share/herdr-world/web/assets/index-BAVYPHsj.js +17 -0
- package/share/herdr-world/web/assets/init-DeL9YIMj.js +1 -0
- package/share/herdr-world/web/assets/localUniformBit-BnogyqF-.js +264 -0
- package/share/herdr-world/web/assets/web-CkXGA1Hr.js +1 -0
- package/share/herdr-world/web/assets/web-DXrm_vsa.js +1 -0
- package/share/herdr-world/web/assets/webworkerAll-BFZtmp1G.js +1 -0
- package/share/herdr-world/web/herdr-logo-180.png +0 -0
- package/share/herdr-world/web/herdr-logo-192.png +0 -0
- package/share/herdr-world/web/herdr-logo-512.png +0 -0
- package/share/herdr-world/web/herdr-logo-maskable-192.png +0 -0
- package/share/herdr-world/web/herdr-logo-maskable-512.png +0 -0
- package/share/herdr-world/web/herdr-logo.svg +6 -0
- package/share/herdr-world/web/index.html +24 -0
- package/share/herdr-world/web/legal/Apache-2.0.txt +190 -0
- package/share/herdr-world/web/legal/LICENSE.txt +22 -0
- package/share/herdr-world/web/legal/PixiJS-MIT.txt +21 -0
- package/share/herdr-world/web/legal/THIRD_PARTY_NOTICES.md +52 -0
- package/share/herdr-world/web/legal/UPSTREAM.md +33 -0
- package/share/herdr-world/web/legal/manifest.json +33 -0
- package/share/herdr-world/web/legal/npm-licenses.txt +1381 -0
- package/share/herdr-world/web/legal/world-assets.md +51 -0
- package/share/herdr-world/web/manifest.json +42 -0
- package/share/herdr-world/web/world/LICENSE-PixiJS.txt +21 -0
- package/share/herdr-world/web/world/characters/1-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/10-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/11-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/12-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/2-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/3-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/4-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/5-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/6-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/7-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/8-D-1.png +0 -0
- package/share/herdr-world/web/world/characters/9-D-1.png +0 -0
- package/third_party/dependencies/README.md +22 -0
- package/third_party/dependencies/cargo-licenses.html +7696 -0
- package/third_party/dependencies/npm-licenses.txt +1381 -0
- package/third_party/licenses/Apache-2.0.txt +190 -0
- package/third_party/licenses/PixiJS-MIT.txt +21 -0
- package/vendor/herdr-compat/VENDOR-MANIFEST.toml +186 -0
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
herdr_world_resolve_script() {
|
|
5
|
+
local source="$1"
|
|
6
|
+
local link_dir=""
|
|
7
|
+
local link_target=""
|
|
8
|
+
|
|
9
|
+
while [[ -L "$source" ]]; do
|
|
10
|
+
link_dir="$(cd -P "$(dirname "$source")" && pwd)"
|
|
11
|
+
link_target="$(readlink "$source")"
|
|
12
|
+
case "$link_target" in
|
|
13
|
+
/*) source="$link_target" ;;
|
|
14
|
+
*) source="$link_dir/$link_target" ;;
|
|
15
|
+
esac
|
|
16
|
+
done
|
|
17
|
+
|
|
18
|
+
printf '%s\n' "$source"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
LAUNCHER_PATH="$(herdr_world_resolve_script "${BASH_SOURCE[0]}")"
|
|
22
|
+
BIN_DIR="$(cd "$(dirname "$LAUNCHER_PATH")" && pwd)"
|
|
23
|
+
BUNDLE_ROOT="$(cd "$BIN_DIR/.." && pwd)"
|
|
24
|
+
BRIDGE_BIN="${HERDR_WORLD_BRIDGE_BIN:-$BIN_DIR/herdr-world-bridge}"
|
|
25
|
+
STATIC_DIR="${HERDR_WORLD_STATIC_DIR:-$BUNDLE_ROOT/share/herdr-world/web}"
|
|
26
|
+
|
|
27
|
+
HERDR_INSTALLER_URL="https://herdr.dev/install.sh"
|
|
28
|
+
HERDR_INSTALL_DOCS_URL="https://herdr.dev/docs/install/"
|
|
29
|
+
HERDR_MINIMUM_VERSION="v0.8.2"
|
|
30
|
+
HERDR_TERMINAL_PROTOCOL="20"
|
|
31
|
+
|
|
32
|
+
herdr_world_default_socket() {
|
|
33
|
+
local config_home="${XDG_CONFIG_HOME:-}"
|
|
34
|
+
if [[ -z "$config_home" ]]; then
|
|
35
|
+
[[ -n "${HOME:-}" ]] || return 1
|
|
36
|
+
config_home="$HOME/.config"
|
|
37
|
+
fi
|
|
38
|
+
printf '%s/herdr/herdr.sock\n' "$config_home"
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
herdr_world_socket_ready() {
|
|
42
|
+
[[ -S "$1" ]]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
herdr_world_find_binary() {
|
|
46
|
+
local found=""
|
|
47
|
+
if found="$(command -v herdr 2>/dev/null)" && [[ -n "$found" ]]; then
|
|
48
|
+
printf '%s\n' "$found"
|
|
49
|
+
return 0
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
if [[ -n "${HERDR_INSTALL_DIR:-}" && -x "$HERDR_INSTALL_DIR/herdr" ]]; then
|
|
53
|
+
printf '%s/herdr\n' "$HERDR_INSTALL_DIR"
|
|
54
|
+
return 0
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
if [[ -n "${HOME:-}" && -x "$HOME/.local/bin/herdr" ]]; then
|
|
58
|
+
printf '%s/.local/bin/herdr\n' "$HOME"
|
|
59
|
+
return 0
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
return 1
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
herdr_world_find_installer_binary() {
|
|
66
|
+
if [[ -n "${HERDR_INSTALL_DIR:-}" && -x "$HERDR_INSTALL_DIR/herdr" ]]; then
|
|
67
|
+
printf '%s/herdr\n' "$HERDR_INSTALL_DIR"
|
|
68
|
+
return 0
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
if [[ -n "${HOME:-}" && -x "$HOME/.local/bin/herdr" ]]; then
|
|
72
|
+
printf '%s/.local/bin/herdr\n' "$HOME"
|
|
73
|
+
return 0
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
herdr_world_find_binary
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
herdr_world_version_is_supported() {
|
|
80
|
+
local version="$1"
|
|
81
|
+
local major
|
|
82
|
+
local minor
|
|
83
|
+
local patch
|
|
84
|
+
|
|
85
|
+
version="${version#v}"
|
|
86
|
+
if [[ ! "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)([-+].*)?$ ]]; then
|
|
87
|
+
return 1
|
|
88
|
+
fi
|
|
89
|
+
major="${BASH_REMATCH[1]}"
|
|
90
|
+
minor="${BASH_REMATCH[2]}"
|
|
91
|
+
patch="${BASH_REMATCH[3]}"
|
|
92
|
+
|
|
93
|
+
(( major > 0 || minor > 8 || (minor == 8 && patch >= 2) ))
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
herdr_world_binary_is_supported() {
|
|
97
|
+
local herdr_bin="$1"
|
|
98
|
+
local version_output=""
|
|
99
|
+
local version=""
|
|
100
|
+
|
|
101
|
+
version_output="$("$herdr_bin" -V 2>/dev/null)" || return 1
|
|
102
|
+
version="${version_output##* }"
|
|
103
|
+
herdr_world_version_is_supported "$version"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
herdr_world_server_is_supported() {
|
|
107
|
+
local herdr_bin="$1"
|
|
108
|
+
local status_output=""
|
|
109
|
+
local server_fields=""
|
|
110
|
+
local server_version=""
|
|
111
|
+
local server_protocol=""
|
|
112
|
+
local server_compatible=""
|
|
113
|
+
|
|
114
|
+
status_output="$("$herdr_bin" status 2>/dev/null)" || return 1
|
|
115
|
+
server_fields="$(printf '%s\n' "$status_output" | awk '
|
|
116
|
+
$0 == "server:" { in_server = 1; next }
|
|
117
|
+
in_server && $0 !~ /^ / { in_server = 0 }
|
|
118
|
+
in_server && $1 == "version:" { version = $2 }
|
|
119
|
+
in_server && $1 == "protocol:" { protocol = $2 }
|
|
120
|
+
in_server && $1 == "compatible:" { compatible = $2 }
|
|
121
|
+
END { printf "%s\t%s\t%s\n", version, protocol, compatible }
|
|
122
|
+
')"
|
|
123
|
+
IFS=$'\t' read -r server_version server_protocol server_compatible <<<"$server_fields"
|
|
124
|
+
|
|
125
|
+
herdr_world_version_is_supported "$server_version" \
|
|
126
|
+
&& [[ "$server_protocol" == "$HERDR_TERMINAL_PROTOCOL" ]] \
|
|
127
|
+
&& [[ "$server_compatible" == "yes" ]]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
herdr_world_server_is_reachable() {
|
|
131
|
+
local herdr_bin="$1"
|
|
132
|
+
local status_output=""
|
|
133
|
+
local server_state=""
|
|
134
|
+
|
|
135
|
+
status_output="$("$herdr_bin" status 2>/dev/null)" || return 1
|
|
136
|
+
server_state="$(printf '%s\n' "$status_output" | awk '
|
|
137
|
+
$0 == "server:" { in_server = 1; next }
|
|
138
|
+
in_server && $0 !~ /^ / { in_server = 0 }
|
|
139
|
+
in_server && $1 == "status:" { print $2; exit }
|
|
140
|
+
')"
|
|
141
|
+
[[ "$server_state" == "running" ]]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
herdr_world_is_interactive() {
|
|
145
|
+
[[ -t 0 && -t 2 ]]
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
herdr_world_confirm() {
|
|
149
|
+
local prompt="$1"
|
|
150
|
+
local answer=""
|
|
151
|
+
printf '%s [y/N] ' "$prompt" >&2
|
|
152
|
+
IFS= read -r answer || return 1
|
|
153
|
+
case "$answer" in
|
|
154
|
+
y | Y | yes | YES | Yes) return 0 ;;
|
|
155
|
+
*) return 1 ;;
|
|
156
|
+
esac
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
herdr_world_manual_instructions() {
|
|
160
|
+
cat >&2 <<EOF
|
|
161
|
+
Herdr World needs a running Herdr ${HERDR_MINIMUM_VERSION} or newer session using terminal protocol ${HERDR_TERMINAL_PROTOCOL}.
|
|
162
|
+
|
|
163
|
+
Install Herdr using the official instructions:
|
|
164
|
+
${HERDR_INSTALL_DOCS_URL}
|
|
165
|
+
|
|
166
|
+
Then start it from the directory containing the work you want Herdr to manage:
|
|
167
|
+
cd /path/to/your/project
|
|
168
|
+
herdr
|
|
169
|
+
|
|
170
|
+
Detach from Herdr with Ctrl+B, then Q, and run herdr-world again
|
|
171
|
+
(or bin/herdr-world from a portable bundle).
|
|
172
|
+
EOF
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
herdr_world_help() {
|
|
176
|
+
cat <<'EOF'
|
|
177
|
+
Usage: herdr-world [OPTIONS]
|
|
178
|
+
|
|
179
|
+
Starts the Herdr World browser bridge for the selected Herdr session.
|
|
180
|
+
|
|
181
|
+
Options are forwarded to the bridge:
|
|
182
|
+
--host HOST Bind address (loopback by default)
|
|
183
|
+
--port PORT HTTP port (8787 by default)
|
|
184
|
+
--session NAME Select a named Herdr session
|
|
185
|
+
--no-herdr-setup Disable interactive Herdr setup
|
|
186
|
+
-h, --help Show this help without starting Herdr or a bridge
|
|
187
|
+
|
|
188
|
+
The bridge requires Herdr 0.8.2 or newer with terminal protocol 20.
|
|
189
|
+
EOF
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
herdr_world_install() {
|
|
193
|
+
if ! command -v curl >/dev/null 2>&1; then
|
|
194
|
+
echo "Cannot install Herdr automatically because curl is not available." >&2
|
|
195
|
+
return 1
|
|
196
|
+
fi
|
|
197
|
+
|
|
198
|
+
local installer_dir=""
|
|
199
|
+
local installer_path=""
|
|
200
|
+
installer_dir="$(mktemp -d "${TMPDIR:-/tmp}/herdr-world-install.XXXXXX")"
|
|
201
|
+
installer_path="$installer_dir/install.sh"
|
|
202
|
+
|
|
203
|
+
if ! curl --proto '=https' --tlsv1.2 -fsSL "$HERDR_INSTALLER_URL" -o "$installer_path"; then
|
|
204
|
+
rm -rf -- "$installer_dir"
|
|
205
|
+
echo "Could not download the official Herdr installer." >&2
|
|
206
|
+
return 1
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
if ! sh "$installer_path"; then
|
|
210
|
+
rm -rf -- "$installer_dir"
|
|
211
|
+
echo "The Herdr installer did not complete successfully." >&2
|
|
212
|
+
return 1
|
|
213
|
+
fi
|
|
214
|
+
|
|
215
|
+
rm -rf -- "$installer_dir"
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
herdr_world_ensure_supported_binary() {
|
|
219
|
+
local herdr_bin=""
|
|
220
|
+
|
|
221
|
+
if herdr_bin="$(herdr_world_find_binary)" && herdr_world_binary_is_supported "$herdr_bin"; then
|
|
222
|
+
printf '%s\n' "$herdr_bin"
|
|
223
|
+
return 0
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
if [[ -n "$herdr_bin" ]]; then
|
|
227
|
+
cat >&2 <<EOF
|
|
228
|
+
The installed Herdr executable is older than ${HERDR_MINIMUM_VERSION}:
|
|
229
|
+
$herdr_bin
|
|
230
|
+
|
|
231
|
+
Herdr World can download ${HERDR_INSTALLER_URL} over HTTPS and run it locally
|
|
232
|
+
to install the latest stable Herdr.
|
|
233
|
+
EOF
|
|
234
|
+
else
|
|
235
|
+
cat >&2 <<EOF
|
|
236
|
+
Herdr is not installed or is not available on PATH.
|
|
237
|
+
|
|
238
|
+
Herdr World can download ${HERDR_INSTALLER_URL} over HTTPS and run it locally.
|
|
239
|
+
The official installer installs the latest stable Herdr (normally under ~/.local/bin)
|
|
240
|
+
and verifies the downloaded Herdr binary checksum. Herdr and Herdr World remain
|
|
241
|
+
separate commands and installations.
|
|
242
|
+
EOF
|
|
243
|
+
fi
|
|
244
|
+
|
|
245
|
+
if ! herdr_world_confirm "Download and run the official Herdr installer now?"; then
|
|
246
|
+
herdr_world_manual_instructions
|
|
247
|
+
return 1
|
|
248
|
+
fi
|
|
249
|
+
# This function's stdout is its resolved-binary return value. The official
|
|
250
|
+
# installer is intentionally chatty on stdout, so display that output on the
|
|
251
|
+
# launcher diagnostic stream instead of capturing it as part of the path.
|
|
252
|
+
if ! herdr_world_install >&2; then
|
|
253
|
+
herdr_world_manual_instructions
|
|
254
|
+
return 1
|
|
255
|
+
fi
|
|
256
|
+
if ! herdr_bin="$(herdr_world_find_installer_binary)"; then
|
|
257
|
+
echo "Herdr was installed, but its executable could not be found." >&2
|
|
258
|
+
herdr_world_manual_instructions
|
|
259
|
+
return 1
|
|
260
|
+
fi
|
|
261
|
+
if ! herdr_world_binary_is_supported "$herdr_bin"; then
|
|
262
|
+
echo "The installed Herdr executable is still older than ${HERDR_MINIMUM_VERSION}." >&2
|
|
263
|
+
herdr_world_manual_instructions
|
|
264
|
+
return 1
|
|
265
|
+
fi
|
|
266
|
+
|
|
267
|
+
printf '%s\n' "$herdr_bin"
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
herdr_world_choose_workspace() {
|
|
271
|
+
local default_dir="$PWD"
|
|
272
|
+
local answer=""
|
|
273
|
+
local resolved=""
|
|
274
|
+
|
|
275
|
+
case "$PWD/" in
|
|
276
|
+
"$BUNDLE_ROOT/"*)
|
|
277
|
+
default_dir=""
|
|
278
|
+
echo "Choose a project directory; the unpacked Herdr World bundle should not become your Herdr workspace." >&2
|
|
279
|
+
;;
|
|
280
|
+
esac
|
|
281
|
+
|
|
282
|
+
while true; do
|
|
283
|
+
if [[ -n "$default_dir" ]]; then
|
|
284
|
+
printf 'Directory containing the work Herdr should manage [%s]: ' "$default_dir" >&2
|
|
285
|
+
else
|
|
286
|
+
printf 'Directory containing the work Herdr should manage: ' >&2
|
|
287
|
+
fi
|
|
288
|
+
IFS= read -r answer || return 1
|
|
289
|
+
answer="${answer:-$default_dir}"
|
|
290
|
+
|
|
291
|
+
if [[ "$answer" == "~/"* && -n "${HOME:-}" ]]; then
|
|
292
|
+
answer="$HOME/${answer#\~/}"
|
|
293
|
+
fi
|
|
294
|
+
if [[ -z "$answer" || ! -d "$answer" ]]; then
|
|
295
|
+
echo "Enter an existing directory." >&2
|
|
296
|
+
continue
|
|
297
|
+
fi
|
|
298
|
+
|
|
299
|
+
resolved="$(cd "$answer" && pwd -P)"
|
|
300
|
+
printf '%s\n' "$resolved"
|
|
301
|
+
return 0
|
|
302
|
+
done
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
herdr_world_run_herdr() {
|
|
306
|
+
local herdr_bin="$1"
|
|
307
|
+
local workspace="$2"
|
|
308
|
+
(
|
|
309
|
+
cd "$workspace"
|
|
310
|
+
"$herdr_bin"
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
herdr_world_wait_for_server() {
|
|
315
|
+
local herdr_bin="$1"
|
|
316
|
+
local attempt
|
|
317
|
+
for attempt in {1..50}; do
|
|
318
|
+
if herdr_world_server_is_supported "$herdr_bin"; then
|
|
319
|
+
return 0
|
|
320
|
+
fi
|
|
321
|
+
sleep 0.1
|
|
322
|
+
done
|
|
323
|
+
return 1
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
herdr_world_wait_for_server_to_stop() {
|
|
327
|
+
local herdr_bin="$1"
|
|
328
|
+
local attempt
|
|
329
|
+
for attempt in {1..50}; do
|
|
330
|
+
if ! herdr_world_server_is_reachable "$herdr_bin"; then
|
|
331
|
+
return 0
|
|
332
|
+
fi
|
|
333
|
+
sleep 0.1
|
|
334
|
+
done
|
|
335
|
+
return 1
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
herdr_world_stop_herdr() {
|
|
339
|
+
local herdr_bin="$1"
|
|
340
|
+
"$herdr_bin" server stop
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
herdr_world_exec_bridge() {
|
|
344
|
+
exec "$BRIDGE_BIN" --static-dir "$STATIC_DIR" "$@"
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
herdr_world_start_bridge() {
|
|
348
|
+
local -a args=("$@")
|
|
349
|
+
local port="8787"
|
|
350
|
+
local index
|
|
351
|
+
|
|
352
|
+
for ((index = 0; index < ${#args[@]}; index += 1)); do
|
|
353
|
+
case "${args[$index]}" in
|
|
354
|
+
--port)
|
|
355
|
+
if ((index + 1 < ${#args[@]})); then
|
|
356
|
+
port="${args[$((index + 1))]}"
|
|
357
|
+
fi
|
|
358
|
+
;;
|
|
359
|
+
--port=*) port="${args[$index]#--port=}" ;;
|
|
360
|
+
esac
|
|
361
|
+
done
|
|
362
|
+
|
|
363
|
+
echo "Herdr is running; starting Herdr World at http://127.0.0.1:$port (press Ctrl+C to stop)." >&2
|
|
364
|
+
herdr_world_exec_bridge "${args[@]+"${args[@]}"}"
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
herdr_world_main() {
|
|
368
|
+
local -a bridge_args=()
|
|
369
|
+
local setup_enabled=true
|
|
370
|
+
local arg
|
|
371
|
+
local default_socket=""
|
|
372
|
+
local herdr_bin=""
|
|
373
|
+
local workspace=""
|
|
374
|
+
local socket_is_ready=false
|
|
375
|
+
|
|
376
|
+
for arg in "$@"; do
|
|
377
|
+
if [[ "$arg" == "--no-herdr-setup" ]]; then
|
|
378
|
+
setup_enabled=false
|
|
379
|
+
else
|
|
380
|
+
bridge_args+=("$arg")
|
|
381
|
+
fi
|
|
382
|
+
done
|
|
383
|
+
|
|
384
|
+
for arg in "${bridge_args[@]+"${bridge_args[@]}"}"; do
|
|
385
|
+
case "$arg" in
|
|
386
|
+
-h | --help)
|
|
387
|
+
herdr_world_help
|
|
388
|
+
return
|
|
389
|
+
;;
|
|
390
|
+
esac
|
|
391
|
+
done
|
|
392
|
+
|
|
393
|
+
# Explicit sessions and socket paths are operator-managed. The launcher must
|
|
394
|
+
# not create or start a different default session in response to their state.
|
|
395
|
+
for arg in "${bridge_args[@]+"${bridge_args[@]}"}"; do
|
|
396
|
+
case "$arg" in
|
|
397
|
+
--session | --session=*)
|
|
398
|
+
herdr_world_exec_bridge "${bridge_args[@]+"${bridge_args[@]}"}"
|
|
399
|
+
return
|
|
400
|
+
;;
|
|
401
|
+
esac
|
|
402
|
+
done
|
|
403
|
+
if [[ -n "${HERDR_SOCKET_PATH:-}" || -n "${HERDR_CLIENT_SOCKET_PATH:-}" || -n "${HERDR_SESSION:-}" ]]; then
|
|
404
|
+
herdr_world_exec_bridge "${bridge_args[@]+"${bridge_args[@]}"}"
|
|
405
|
+
return
|
|
406
|
+
fi
|
|
407
|
+
|
|
408
|
+
if ! default_socket="$(herdr_world_default_socket)"; then
|
|
409
|
+
echo "Herdr World could not determine the default Herdr socket because HOME and XDG_CONFIG_HOME are unset." >&2
|
|
410
|
+
herdr_world_manual_instructions
|
|
411
|
+
return 1
|
|
412
|
+
fi
|
|
413
|
+
|
|
414
|
+
case "${HERDR_WORLD_SETUP:-auto}" in
|
|
415
|
+
never | off | 0) setup_enabled=false ;;
|
|
416
|
+
esac
|
|
417
|
+
|
|
418
|
+
if herdr_world_socket_ready "$default_socket"; then
|
|
419
|
+
socket_is_ready=true
|
|
420
|
+
if herdr_bin="$(herdr_world_find_binary)" \
|
|
421
|
+
&& herdr_world_binary_is_supported "$herdr_bin" \
|
|
422
|
+
&& herdr_world_server_is_supported "$herdr_bin"; then
|
|
423
|
+
herdr_world_start_bridge "${bridge_args[@]+"${bridge_args[@]}"}"
|
|
424
|
+
return
|
|
425
|
+
fi
|
|
426
|
+
|
|
427
|
+
if [[ -n "$herdr_bin" ]] \
|
|
428
|
+
&& herdr_world_binary_is_supported "$herdr_bin" \
|
|
429
|
+
&& ! herdr_world_server_is_reachable "$herdr_bin"; then
|
|
430
|
+
socket_is_ready=false
|
|
431
|
+
fi
|
|
432
|
+
|
|
433
|
+
# Preserve non-interactive and explicitly disabled behavior. The bridge
|
|
434
|
+
# remains the authority for the detailed compatibility error in this path.
|
|
435
|
+
if [[ "$setup_enabled" != true ]] || ! herdr_world_is_interactive; then
|
|
436
|
+
herdr_world_exec_bridge "${bridge_args[@]+"${bridge_args[@]}"}"
|
|
437
|
+
return
|
|
438
|
+
fi
|
|
439
|
+
fi
|
|
440
|
+
|
|
441
|
+
if [[ "$setup_enabled" != true ]] || ! herdr_world_is_interactive; then
|
|
442
|
+
echo "No running default Herdr session was found at $default_socket." >&2
|
|
443
|
+
herdr_world_manual_instructions
|
|
444
|
+
return 1
|
|
445
|
+
fi
|
|
446
|
+
|
|
447
|
+
if ! herdr_bin="$(herdr_world_ensure_supported_binary)"; then
|
|
448
|
+
return 1
|
|
449
|
+
fi
|
|
450
|
+
|
|
451
|
+
if [[ "$socket_is_ready" == true ]]; then
|
|
452
|
+
if herdr_world_server_is_supported "$herdr_bin"; then
|
|
453
|
+
herdr_world_start_bridge "${bridge_args[@]+"${bridge_args[@]}"}"
|
|
454
|
+
return
|
|
455
|
+
fi
|
|
456
|
+
|
|
457
|
+
if ! herdr_world_server_is_reachable "$herdr_bin"; then
|
|
458
|
+
socket_is_ready=false
|
|
459
|
+
cat >&2 <<EOF
|
|
460
|
+
A stale Herdr socket was found at $default_socket, but no server is running.
|
|
461
|
+
Continuing with normal Herdr startup.
|
|
462
|
+
EOF
|
|
463
|
+
fi
|
|
464
|
+
fi
|
|
465
|
+
|
|
466
|
+
if [[ "$socket_is_ready" == true ]]; then
|
|
467
|
+
cat >&2 <<EOF
|
|
468
|
+
The running default Herdr server is incompatible with Herdr World.
|
|
469
|
+
|
|
470
|
+
It must be stopped before the current Herdr can start. Stopping it exits the
|
|
471
|
+
terminal panes and processes owned by that server.
|
|
472
|
+
EOF
|
|
473
|
+
if ! herdr_world_confirm "Stop the incompatible Herdr server now?"; then
|
|
474
|
+
herdr_world_manual_instructions
|
|
475
|
+
return 1
|
|
476
|
+
fi
|
|
477
|
+
if ! herdr_world_stop_herdr "$herdr_bin"; then
|
|
478
|
+
echo "The incompatible Herdr server could not be stopped." >&2
|
|
479
|
+
herdr_world_manual_instructions
|
|
480
|
+
return 1
|
|
481
|
+
fi
|
|
482
|
+
if ! herdr_world_wait_for_server_to_stop "$herdr_bin"; then
|
|
483
|
+
echo "The incompatible Herdr server did not stop." >&2
|
|
484
|
+
herdr_world_manual_instructions
|
|
485
|
+
return 1
|
|
486
|
+
fi
|
|
487
|
+
fi
|
|
488
|
+
|
|
489
|
+
cat >&2 <<EOF
|
|
490
|
+
|
|
491
|
+
Herdr is available at: $herdr_bin
|
|
492
|
+
Starting it opens the Herdr terminal UI. Detach with Ctrl+B, then Q; the Herdr
|
|
493
|
+
server remains active and this launcher will then continue with Herdr World.
|
|
494
|
+
EOF
|
|
495
|
+
if ! herdr_world_confirm "Start Herdr now?"; then
|
|
496
|
+
herdr_world_manual_instructions
|
|
497
|
+
return 1
|
|
498
|
+
fi
|
|
499
|
+
if ! workspace="$(herdr_world_choose_workspace)"; then
|
|
500
|
+
echo "Herdr was not started because no workspace directory was selected." >&2
|
|
501
|
+
return 1
|
|
502
|
+
fi
|
|
503
|
+
if ! herdr_world_run_herdr "$herdr_bin" "$workspace"; then
|
|
504
|
+
echo "Herdr exited with an error; Herdr World was not started." >&2
|
|
505
|
+
return 1
|
|
506
|
+
fi
|
|
507
|
+
if ! herdr_world_wait_for_server "$herdr_bin"; then
|
|
508
|
+
echo "Herdr returned, but no compatible running session appeared at $default_socket." >&2
|
|
509
|
+
herdr_world_manual_instructions
|
|
510
|
+
return 1
|
|
511
|
+
fi
|
|
512
|
+
|
|
513
|
+
herdr_world_start_bridge "${bridge_args[@]+"${bridge_args[@]}"}"
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
|
517
|
+
herdr_world_main "$@"
|
|
518
|
+
fi
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ivoryheart/herdr-world",
|
|
3
|
+
"version": "0.1.0-rc.5",
|
|
4
|
+
"description": "Browser and mobile client for monitoring and controlling Herdr agents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"herdr-world": "bin/herdr-world"
|
|
8
|
+
},
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=22.14.0"
|
|
11
|
+
},
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/IvoryHeart/herdr-world.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/IvoryHeart/herdr-world/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://ivoryheart.github.io/herdr-world/",
|
|
21
|
+
"files": [
|
|
22
|
+
"bin/herdr-world",
|
|
23
|
+
"lib/herdr-world-launcher.sh",
|
|
24
|
+
"lib/bridges",
|
|
25
|
+
"share/herdr-world/web",
|
|
26
|
+
"docs",
|
|
27
|
+
"vendor",
|
|
28
|
+
"third_party",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"THIRD_PARTY_NOTICES.md",
|
|
31
|
+
"UPSTREAM.md"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|