forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify-desktop-local-launch.sh
More file actions
executable file
·64 lines (56 loc) · 2.02 KB
/
Copy pathverify-desktop-local-launch.sh
File metadata and controls
executable file
·64 lines (56 loc) · 2.02 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -euo pipefail
# shellcheck source=_source_local_dev_env.sh
source "$(dirname "$0")/_source_local_dev_env.sh"
cd "$(dirname "$0")/../.."
DESKTOP_BACKEND_URL="${OMI_DESKTOP_API_URL:-http://127.0.0.1:10201}"
STATE_ROOT="${OMI_LOCAL_STATE_ROOT:-.local/dev-harness/default}"
BACKEND_LOG="${STATE_ROOT}/logs/backend.log"
OMI_CTL="./desktop/macos/scripts/omi-ctl"
failures=0
echo "Omi local dev harness verification"
if [ -x "$OMI_CTL" ]; then
deadline=$((SECONDS + 30))
signed_in=false
while [ "$SECONDS" -lt "$deadline" ]; do
if state_json="$("$OMI_CTL" state 2>/dev/null)"; then
if echo "$state_json" | grep -q '"isSignedIn"[[:space:]]*:[[:space:]]*true'; then
signed_in=true
echo "omi-ctl state: isSignedIn=true"
break
fi
fi
sleep 2
done
if [ "$signed_in" != true ]; then
echo "omi-ctl state: isSignedIn not true within 30s (is Omi Dev running?)" >&2
failures=$((failures + 1))
fi
else
echo "warning: $OMI_CTL not found; skipping omi-ctl state check"
fi
chat_status="$(curl -s -o /dev/null -w '%{http_code}' -X POST "${DESKTOP_BACKEND_URL}/v2/chat/completions" \
-H 'Content-Type: application/json' \
-d '{"model":"claude-3-5-sonnet-20241022","messages":[{"role":"user","content":"ping"}],"max_tokens":1}' || true)"
if [ "$chat_status" = "404" ]; then
echo "chat smoke: POST /v2/chat/completions returned 404" >&2
failures=$((failures + 1))
else
echo "chat smoke: POST /v2/chat/completions returned HTTP ${chat_status:-unknown} (non-404)"
fi
if [ -f "$BACKEND_LOG" ]; then
aud_count="$(grep -c 'incorrect "aud"' "$BACKEND_LOG" 2>/dev/null || true)"
if [ "${aud_count:-0}" -gt 0 ]; then
echo "backend log: found ${aud_count} incorrect \"aud\" errors in $BACKEND_LOG" >&2
failures=$((failures + 1))
else
echo "backend log: no incorrect \"aud\" errors"
fi
else
echo "warning: backend log not found at $BACKEND_LOG"
fi
if [ "$failures" -gt 0 ]; then
echo "dev-verify failed ($failures check(s))" >&2
exit 1
fi
echo "dev-verify passed"