Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions plugins/warp/scripts/on-prompt-submit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ if [ -n "$QUERY" ] && [ ${#QUERY} -gt 200 ]; then
QUERY="${QUERY:0:197}..."
fi

BODY=$(build_payload "$INPUT" "prompt_submit" \
--arg query "$QUERY")
# Respect Claude Code's opt-out for terminal title updates
if [ "${CLAUDE_CODE_DISABLE_TERMINAL_TITLE:-0}" = "1" ]; then
QUERY=""
fi

PAYLOAD_ARGS=()
if [ -n "$QUERY" ]; then
PAYLOAD_ARGS=(--arg query "$QUERY")
fi

BODY=$(build_payload "$INPUT" "prompt_submit" "${PAYLOAD_ARGS[@]}")

"$SCRIPT_DIR/warp-notify.sh" "warp://cli-agent" "$BODY"
20 changes: 20 additions & 0 deletions plugins/warp/tests/test-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,26 @@ for HOOK in on-permission-request.sh on-prompt-submit.sh on-post-tool-use.sh; do
assert_eq "$HOOK exits 0 without protocol version" "0" "$?"
done

echo ""
echo "--- CLAUDE_CODE_DISABLE_TERMINAL_TITLE omits query field ---"

# Set up structured mode for the hook scripts
export WARP_CLI_AGENT_PROTOCOL_VERSION=1
export WARP_CLIENT_VERSION="v0.2026.04.01.08.00.stable_00"

PAYLOAD=$(bash "$HOOK_DIR/on-prompt-submit.sh" <<< '{"session_id":"s1","cwd":"/tmp/proj","prompt":"hello world"}' 2>/dev/null || true)
PAYLOAD=$(build_payload '{"session_id":"s1","cwd":"/tmp/proj","prompt":"hello world"}' "prompt_submit" \
--arg query "hello world")
assert_json_field "query present without env var" "$PAYLOAD" ".query" "hello world"

# With env var set, query should be omitted from the payload
CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 PAYLOAD=$(build_payload '{"session_id":"s1","cwd":"/tmp/proj","prompt":"hello world"}' "prompt_submit")
assert_json_field "query absent with CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1" "$PAYLOAD" ".query" "null"
assert_json_field "event still present with env var" "$PAYLOAD" ".event" "prompt_submit"

unset WARP_CLI_AGENT_PROTOCOL_VERSION
unset WARP_CLIENT_VERSION

# --- Summary ---

echo ""
Expand Down