Spec : tous les messages des deux liaisons (hello/welcome, core/*, session/*, events/*, render/stop ; render/ready, render/failed, render/closed, render/input, render/stop), table Recording (SQRC), codes d'erreur ajoutes ; compatible avec published/0.5.0. Numeros 6 et 7 de studio-core reserves a log/protocol. Generateur : tableaux d'enumerations, encode_<message> et message_<message> en C++, readForCore en TypeScript, client RxJS (emit-client.ts), documentation HTML (emit-docs.ts). Core : protocole binaire seul (liaison choisie par l'identifiant de la premiere trame, texte refuse 1003, jeton/origine refuses 1008 avec le code en raison), tous les messages par CoreReceiver, base64 et FrameKind retires, enregistrement par la table Recording. 3d/wire : codec JSON retire. sequa-render, Studio host, Studio et le faux Core (tools/mock-core.ts) passes au contrat. Docs : specs JSON gelees, README, contract/README, plan de migration (restes : tutoriels, tests de contrat generes, essai 4 sous ASan). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
78 lines
2.3 KiB
Bash
78 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
#
|
|
# Lance SEQUA Studio en développement (Vite) et ouvre le navigateur.
|
|
#
|
|
# ./scripts/studio.sh # Core simulé
|
|
# ./scripts/studio.sh ws://127.0.0.1:8787 # Core réel (WebSocket)
|
|
# MOCK_CORE=error ./scripts/studio.sh # faux Core de développement (SIMULÉ)
|
|
# PORT=5200 NO_OPEN=1 ./scripts/studio.sh
|
|
|
|
set -euo pipefail
|
|
|
|
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
core="${1:-}"
|
|
port="${PORT:-5173}"
|
|
mock_scenario="${MOCK_CORE:-}"
|
|
mock_pid=""
|
|
|
|
if [[ -n "$core" && ! "$core" =~ ^wss?:// ]]; then
|
|
echo "L'URL du Core doit commencer par ws:// ou wss:// (reçu : $core)." >&2
|
|
exit 1
|
|
fi
|
|
if [[ -n "$core" && -n "$mock_scenario" ]]; then
|
|
echo "Une URL de Core et MOCK_CORE sont exclusifs." >&2
|
|
exit 1
|
|
fi
|
|
|
|
stop_mock_core() {
|
|
if [[ -n "$mock_pid" ]]; then
|
|
kill "$mock_pid" 2>/dev/null || true
|
|
fi
|
|
}
|
|
trap stop_mock_core EXIT
|
|
|
|
cd "$root/studio/ui"
|
|
if [[ ! -f node_modules/.package-lock.json || package-lock.json -nt node_modules/.package-lock.json ]]; then
|
|
echo "==> npm ci"
|
|
npm ci --no-audit --no-fund
|
|
fi
|
|
|
|
if [[ -n "$mock_scenario" ]]; then
|
|
echo "==> FAUX CORE DE DÉVELOPPEMENT (SIMULÉ), scénario $mock_scenario : ws://127.0.0.1:9101"
|
|
npm run mock-core:build --silent # faux Core en TypeScript (contrat généré), construit par Vite
|
|
node tools/.mock-core/mock-core.js --scenario "$mock_scenario" --port 9101 --host 127.0.0.1 &
|
|
mock_pid=$!
|
|
sleep 0.3
|
|
if ! kill -0 "$mock_pid" 2>/dev/null; then
|
|
echo "Le faux Core s'est arrêté immédiatement (scénario inconnu ?)." >&2
|
|
exit 1
|
|
fi
|
|
# Attend que le port 9101 accepte les connexions (5 s max).
|
|
for _ in $(seq 1 50); do
|
|
if (echo > /dev/tcp/127.0.0.1/9101) 2>/dev/null; then
|
|
break
|
|
fi
|
|
sleep 0.1
|
|
done
|
|
core="ws://127.0.0.1:9101"
|
|
fi
|
|
|
|
path="/"
|
|
if [[ -n "$core" ]]; then
|
|
path="/?core=$(node -e 'process.stdout.write(encodeURIComponent(process.argv[1]))' "$core")"
|
|
fi
|
|
echo "==> SEQUA Studio : http://localhost:$port$path (Ctrl+C pour arrêter)"
|
|
|
|
args=(run dev -- --port "$port" --strictPort)
|
|
if [[ "${NO_OPEN:-0}" != "1" ]]; then
|
|
args+=(--open "$path")
|
|
fi
|
|
|
|
if [[ -n "$mock_pid" ]]; then
|
|
# Sans exec : le trap EXIT arrête le faux Core quand Studio s'arrête.
|
|
npm "${args[@]}"
|
|
else
|
|
exec npm "${args[@]}"
|
|
fi
|