File size: 2,872 Bytes
fd11263
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
65
66
67
68
69
70
#!/usr/bin/env bash
if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then
  echo "Execute this script directly; do not source it." >&2
  return 2
fi
set -euo pipefail

# Ready-to-run interactive evaluation example.
# Edit this block, or override any value for one invocation, e.g.
# CASE_ID=V_AXIR_ALIGN OPENCODE_MODEL=opencode/big-pickle ./run-interactive-example
WORKTREE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
REPO_ROOT="${REPO_ROOT:-$(cd "$WORKTREE_ROOT/.." && pwd)}"
ENV_FILE="${ENV_FILE:-}"
SKILL="${SKILL:-$REPO_ROOT/data/veritas-ut-testplan-gen}"
DATASET="${DATASET:-$WORKTREE_ROOT/agent_evaluation/dataset_bundles/veritas-ut-testplan-gen/v1}"
EVALUATION_PROFILE="${EVALUATION_PROFILE:-$WORKTREE_ROOT/agent_evaluation/evaluation_profiles/veritas-ut-testplan-gen.yaml}"
CASE_ID="${CASE_ID:-V_PosSharpDet}"
OPENCODE_COMMAND="${OPENCODE_COMMAND:-$REPO_ROOT/package/opencode/opencode}"
OPENCODE_HOME="${OPENCODE_HOME:-$REPO_ROOT/package/real-opencode-home}"
OPENCODE_MODEL="${OPENCODE_MODEL:-opencode/mimo-v2.5-free}"
OPENCODE_PROJECT="${OPENCODE_PROJECT:-subject-opencode}"
BACKEND_ENDPOINT="${BACKEND_ENDPOINT:-http://127.0.0.1:6006}"
ARTIFACTS="${ARTIFACTS:-$WORKTREE_ROOT/agent_evaluation/workspace/artifacts}"
DATABASE="${DATABASE:-$WORKTREE_ROOT/agent_evaluation/workspace/native/evaluation.sqlite}"


if [[ ! -t 0 || ! -t 1 ]]; then
  echo "Interactive mode requires a real terminal (stdin/stdout must be a TTY)." >&2
  echo "Run this script directly from an interactive terminal, not via a pipe or background job." >&2
  exit 2
fi

# Path validation belongs to the CLI, after all overrides are parsed. Only
# resolve the endpoint here so this early connectivity check uses that value.
check_endpoint="$BACKEND_ENDPOINT"
previous_arg=""
for arg in "$@"; do
  if [[ "$previous_arg" == --backend-endpoint ]]; then
    check_endpoint="$arg"
  elif [[ "$arg" == --backend-endpoint=* ]]; then
    check_endpoint="${arg#*=}"
  fi
  previous_arg="$arg"
done
if ! curl --noproxy '*' --fail --silent --show-error "${check_endpoint%/}/api/health" >/dev/null 2>&1; then
  echo "Native collector is not reachable at $check_endpoint." >&2
  echo "Start it first with: $WORKTREE_ROOT/agent_evaluation/scripts/start-evaluation-server" >&2
  exit 2
fi

optional_args=(--no-evolve)
if [[ -n "$ENV_FILE" ]]; then
  optional_args+=(--env-file "$ENV_FILE")
fi

exec "$WORKTREE_ROOT/agent_evaluation/scripts/eval-cli" interactive \
  --skill "$SKILL" \
  --dataset "$DATASET" \
  --evaluation-profile "$EVALUATION_PROFILE" \
  --case-id "$CASE_ID" \
  --opencode-command "$OPENCODE_COMMAND" \
  --opencode-home "$OPENCODE_HOME" \
  --opencode-model "$OPENCODE_MODEL" \
  --opencode-project "$OPENCODE_PROJECT" \
  --agent-workdir "$REPO_ROOT" \
  --artifacts "$ARTIFACTS" \
  --backend-endpoint "$BACKEND_ENDPOINT" \
  --database "$DATABASE" \
  "${optional_args[@]}" "$@"