-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsimplicio-engine
More file actions
executable file
Β·30 lines (27 loc) Β· 1.17 KB
/
Copy pathsimplicio-engine
File metadata and controls
executable file
Β·30 lines (27 loc) Β· 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# simplicio-engine β Simplicio capture engine entrypoint (native-first).
#
# Prefers the self-contained native engine (engine/simplicio_engine.py β proxy + doctor +
# memory stats, no external dependency). Falls back to an installed upstream engine binary
# only if the native module is missing. This is the single place that resolves the engine.
set -euo pipefail
_here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
_native="$_here/../engine/simplicio_engine.py"
_py="${SIMPLICIO_PYTHON:-python3}"
if [ -f "$_native" ]; then
exec "$_py" "$_native" "$@"
fi
# Fallback only if the native engine module isn't present (it ships with the repo, so this
# rarely runs). Honor an explicit override or a compatible binary on PATH.
_engine="${SIMPLICIO_ENGINE_BIN:-}"
[ -z "${_engine}" ] && _engine="$(command -v headroom 2>/dev/null || true)"
if [ -z "${_engine}" ]; then
for _p in "${HOME}"/.local/bin/headroom /usr/local/bin/headroom /opt/homebrew/bin/headroom; do
[ -x "${_p}" ] && { _engine="${_p}"; break; }
done
fi
if [ -z "${_engine}" ]; then
echo "simplicio-engine: native engine missing and no fallback found" >&2
exit 127
fi
exec "${_engine}" "$@"