#!/usr/bin/env bash
# Run from each evidence checkout. Start fresh T3 data with T3CODE_DEV_SEED=0.
# Start real OpenCode 2.4.5 on loopback port 17362 and proxy.cjs on 17363.
# Put index.ts at PROJECT/.opencode/plugins/noop/index.ts (OpenCode's native plugin API).
# Configure T3's OpenCode instance to use the proxy, with the real server's password.
# PROJECT is a fresh synthetic git repository; never use a real user's data.
set -euo pipefail
: "${PROJECT:?Set the synthetic project directory}"
node apps/server/src/bin.ts project add --base-dir .t3 --title 'Command status proof' "$PROJECT"
curl -fsS http://127.0.0.1:17363/__arm/active
node apps/server/src/bin.ts thread start --base-dir .t3 --provider opencode --model openai/gpt-6-luna --title 'Command status proof' "$PROJECT" /noop --json
# Open the returned thread in the real web app and begin recording.
# Observe the active-check outcome. Send "Reply with exactly: HELLO" in the composer.
# Base delivers it as Steer; head starts a new turn. Wait for HELLO and idle.
read -r -p 'Thread id: ' proof_thread
curl -fsS http://127.0.0.1:17363/__arm/history
node apps/server/src/bin.ts thread send --base-dir .t3 "$proof_thread" /noop --json
# Wait for proxy trace to confirm command -> 204, active -> 200, history -> injected 503.
# Observe the history-check outcome. If Stop is present, press it.
# Send "Reply with exactly: HELLO" in the composer.
# Base stays Stopping with one queued message; head completes HELLO.
