#!/usr/bin/env bash
set -euo pipefail
source "${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}/hooks/relay-status.sh"
relay_install_hook_guard user-prompt-submit
payload="$(cat || true)"
# prompt_id (#1086): Claude's own native turn identifier for the prompt starting
# now — the same UUID the Stop hook reports and the transcript stamps on every
# entry of this turn. Passed as the busy report's `id` so the runner adopts it as
# currentTurnId instead of minting a random UUID (runner-core.ts setProviderStatus).
prompt_id="$(relay_json_string_field prompt_id "$payload")"
relay_post_status busy "" "$prompt_id"
# Mirror a terminal/TUI-typed prompt into the dashboard chat and start reasoning
# tailing for this turn. No-op for prompts the runner injected (chat box / relay).
relay_post_user_prompt "$payload"
# Re-surface the request-review reminder each turn while there is unmerged
# committed work — so a long session can't "forget" to land it. Silent otherwise.
relay_emit_additional_context UserPromptSubmit "$(relay_review_reminder_text || true)"
