Files
m4 aae8d0a379 feat: workspace file references, read-file-images middleware, image model enabled flag
In-progress work committed to unblock the config import/export plan:
- prompts: FILE_REFERENCES section for workspace-relative file citation
- backends: resolve quoted virtual absolute paths onto the sandbox workspace
- middleware: read_file_images middleware; message_budget extensions
- image_gen/model_registry: image model 'enabled' flag refactor
- memory/launch, gateway/background_runs, tools/image follow-ons
- scripts: dev_backend.sh, release.sh
- tests for the above
2026-08-12 19:43:35 +08:00

46 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Start the EvoScientist backend for local development FROM SOURCE.
#
# Always use this script instead of a globally installed `langgraph` binary:
# the uv-tool install runs the stale site-packages copy of EvoScientist,
# which lacks newer HTTP routes (e.g. /api/image-generation → 404).
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
WORKSPACE_DIR="$REPO_ROOT/EvoScientist/langgraph_dev"
VENV_PYTHON="$REPO_ROOT/.venv/bin/python"
PORT="${PORT:-6174}"
WEBUI_PORT="${WEBUI_PORT:-4716}"
cd "$REPO_ROOT"
export EVOSCIENTIST_WORKSPACE_DIR="$WORKSPACE_DIR"
export EVOSCIENTIST_DEPLOY_MODE=full
export PYTHONIOENCODING=utf-8
export PYTHONUTF8=1
# Must match EVOSCIENTIST_BACKEND_SERVICE_TOKEN in EvoScientist-WebUI/.env.
# Stored at <workspace>/.evoscientist/control/scope-service-token (same file
# `EvoSci deploy` uses), created on first run.
export EVOSCIENTIST_BACKEND_SERVICE_TOKEN="$("$VENV_PYTHON" -c \
"from EvoScientist.scope_registry import get_scope_service_token; print(get_scope_service_token('$WORKSPACE_DIR'))")"
# Usage reporting identities (stable; secrets live under ~/.evoscientist).
eval "$("$VENV_PYTHON" -c \
"from EvoScientist.usage.identity import prepare_usage_environment
for k, v in prepare_usage_environment('$WORKSPACE_DIR', webui_port=$WEBUI_PORT).items():
print(f'export {k}={v}')")"
# langgraph dev resolves the graph/app modules relative to the workspace dir.
# cd here, after the python -c calls above: running them with the workspace as
# cwd would put langgraph_dev/ on sys.path, where http.py shadows the stdlib
# http package and breaks the httpx import chain.
cd "$WORKSPACE_DIR"
exec "$REPO_ROOT/.venv/bin/langgraph" dev \
--config "$WORKSPACE_DIR/langgraph.json" \
--port "$PORT" \
--n-jobs-per-worker 10 \
--no-browser \
--no-reload