feat: maximize sorter demo realism and add safe agent MVP

Wire live classifyItem into continuous playback, add jam/E-stop cases,
presenter controls (seek/speed/hotkeys), quality modes, demo scripts,
audit docs, and a verify-only autonomous agent CLI with hard safety limits.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Даня Архипов
2026-07-15 16:53:35 +00:00
parent e89c728dd2
commit 985f7c327d
40 changed files with 3358 additions and 453 deletions

5
scripts/agent-dry-run.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
exec node agent/cli.mjs dry-run

5
scripts/agent-run-once.sh Executable file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
exec node agent/cli.mjs run-once

35
scripts/demo-health.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
ok=0
fail=0
check() {
local name="$1"
local url="$2"
if curl -sf -o /dev/null -w "%{http_code}" "$url" | grep -qE '200|304'; then
echo "[ok] $name ($url)"
ok=$((ok + 1))
else
echo "[fail] $name ($url)"
fail=$((fail + 1))
fi
}
echo "[demo-health] checking endpoints..."
check "prod-loopback" "http://127.0.0.1:3100/" || true
check "preview" "http://127.0.0.1:3101/" || true
check "public" "https://arhipovdan.ru/" || true
echo "[demo-health] running unit tests..."
if npm test >/tmp/demo-health-tests.log 2>&1; then
echo "[ok] vitest"
ok=$((ok + 1))
else
echo "[fail] vitest — see /tmp/demo-health-tests.log"
fail=$((fail + 1))
fi
echo "[demo-health] summary: ok=$ok fail=$fail"
[[ "$fail" -eq 0 ]]

9
scripts/demo-reset.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
echo "[demo-reset] stopping preview..."
"${ROOT}/scripts/demo-stop.sh" || true
echo "[demo-reset] clearing agent kill switch / temp preview logs..."
rm -f "${ROOT}/.demo-preview.log" "${ROOT}/agent/state/KILL" || true
echo "[demo-reset] done — open app and press R (or Stop) to reset demo state in browser"

27
scripts/demo-start.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
echo "[demo-start] installing deps if needed..."
if [[ ! -d node_modules ]]; then
npm ci
fi
echo "[demo-start] building production bundle..."
npm run build
PID_FILE="${ROOT}/.demo-preview.pid"
if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
echo "[demo-start] preview already running (pid $(cat "$PID_FILE"))"
exit 0
fi
echo "[demo-start] starting vite preview on 127.0.0.1:3101 (dev preview; prod may already be on :3100)..."
nohup npm run preview -- --host 127.0.0.1 --port 3101 > "${ROOT}/.demo-preview.log" 2>&1 &
echo $! > "$PID_FILE"
sleep 2
curl -sf "http://127.0.0.1:3101/" >/dev/null && echo "[demo-start] OK http://127.0.0.1:3101/" || {
echo "[demo-start] preview not ready yet — check .demo-preview.log"
exit 1
}

15
scripts/demo-stop.sh Executable file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
PID_FILE="${ROOT}/.demo-preview.pid"
if [[ -f "$PID_FILE" ]]; then
pid="$(cat "$PID_FILE")"
if kill -0 "$pid" 2>/dev/null; then
kill "$pid" || true
echo "[demo-stop] stopped pid $pid"
fi
rm -f "$PID_FILE"
else
echo "[demo-stop] no preview pid file"
fi
pkill -f "vite preview --host 127.0.0.1 --port 3101" 2>/dev/null || true