#!/usr/bin/env bash
# Stub agent CLI for dispatch.test.sh (STORY-348 T-PB-348a): reports what it
# can see. Run directly on the host it reads the host home's canary; run by
# fixtures/sandbox/fake-runtime it must not.
prompt="$(cat)"
echo "agent-home=${HOME:-}"
echo "agent-pwd=$(pwd)"
echo "agent-image=${SANDBOX_IMAGE:-host}"
echo "agent-args=$*"
echo "agent-prompt=${prompt}"
echo "agent-canary=$(cat "${HOME:-/nonexistent}/.canary" 2>/dev/null || echo unreadable)"
echo "agent-secret=${CANARY_SECRET:-absent}"
echo "agent-runner-var=${RUNNER_TIMEOUT_SECONDS:-absent}"
echo "agent-git-dir=${GIT_DIR:-unset}"
[[ -f marker.txt ]] && echo "agent-sees-repo=yes"
# T-PB-348c: request each host in EGRESS_PROBE_HOSTS (forwarded by passthrough).
for h in ${EGRESS_PROBE_HOSTS:-}; do echo "agent-egress=$(egress-probe "$h")"; done
exit 0
