#!/usr/bin/env bash
# Run in either installed checkout. HOME_DIR and DEMO are fresh, isolated paths supplied by the caller.
# GOOGLE_GEMINI_BASE_URL must already point at the available Antigravity API-key gateway.
set -eu
: "${HOME_DIR:?}" "${DEMO:?}" "${GOOGLE_GEMINI_BASE_URL:?}"
mkdir -p "$HOME_DIR/userdata" "$DEMO"
python3 - "$HOME_DIR/userdata/settings.json" <<'PY'
import json,sys
s={'providerInstances':{d:{'driver':d,'enabled':False} for d in ['codex','claudeAgent','cursor','grok','muse','pi','opencode']},'defaultModelSelection':{'instanceId':'antigravity','model':'gemini-4-neon'}}
s['providerInstances']['antigravity']={'driver':'antigravity','enabled':True,'config':{'authMethod':'gemini-api-key','apiKey':'test-key'}}
json.dump(s,open(sys.argv[1],'w'),indent=2)
PY
git -C "$DEMO" init -q --initial-branch=main
git -C "$DEMO" -c user.name=Evidence -c user.email=evidence@example.invalid commit --allow-empty -qm Initial
# Start in a retained terminal: T3CODE_DEV_SEED=0 vp run dev --home-dir "$HOME_DIR"
# Once the app listens, run the following from this checkout:
node apps/server/src/bin.ts project add "$DEMO" --title 'Delegation demo' --base-dir "$HOME_DIR"
node apps/server/src/bin.ts thread start "$DEMO" 'Reply only: Ready.' --title 'Suffix proof' --provider antigravity --model gemini-4-neon --base-dir "$HOME_DIR" --json
# Open the returned thread in the paired web client. Use dark appearance, 1440x1000 CSS pixels.
# Record while submitting this exact prompt in the composer:
cat <<'PROMPT'
Call orchestrator_capabilities once. Then call delegate_task exactly once with target.providerInstanceId="antigravity", target.model="gemini-4-neon-high", task="Reply only: Child started.", title="High thinking child", mode="wait". Do not supply options. Do not retry or use any other delegation. Report the exact outcome including resolved model and options, or the exact error.
PROMPT
# Control prompt, submitted afterwards on base:
cat <<'PROMPT'
Control: call delegate_task exactly once with target.providerInstanceId="antigravity", target.model="gemini-4-neon", target.options={thought_level:"high"}, task="Reply only: Child started.", title="Explicit high control", mode="wait". Do not retry. Report exact outcome, model and options. Do not change this parent model selection.
PROMPT
# Read-only state export: python3 export-evidence.py "$HOME_DIR/userdata/statev2.sqlite" THREAD_ID SIDE OUTPUT.json
