Edit: A different perspective, considering the common representation of wave packets mathematically
I've decided to add another part to this answer, instead of adding a new answer, because this will be similar to the ideas presented there but in a different way. I was reading Messiah's Quantum Mechanics and came across a way of converting a wave into a wave packet mathematically. In his case, it was for modelling matter waves, but as a general case it will work well.
Working from the definitions presented by honeste_vivere in another answer, we first consider a one-dimensional wave of the form
$$\psi (z, t) = \cos(kz - \omega t) $$
Which we already know is defined at all points, and has wave character at all points. We could also represent this cosine wave with a complex exponential or a phasor, but we will use the cosine representation for now.
The parameter $k$ is the wavenumber, which is like a density of waves, a number of wave peaks per unit distance. This is not independent of angular frequency $\omega$, and it can change with time and position.
Now we have this wave, but we want a wave packet. How can we achieve this?
First let's assume we have a wavenumber $k$ and an angular frequency $\omega$ for our wave of interest. Then we will use the terms $k'$ and $\omega'$ to represent any wavenumber and any angular frequency for a wave. We will then define a wave that is the infinite series (actually an integral) of waves of wavenumber $k'$ and angular frequency $\omega'$, with the case that $k' = k$ and $\omega' = \omega$ representing our actual wave of interest.
This may seem a bit strange at first. Wave packets are represented as local perturbations, but they are the sum of many wave forms.
We will define our wave packet as
$$\psi = \int _{-\infty}^{\infty} f(k') cos(k'z - \omega' t) dk' $$
Where $f(k')$ is an amplitude function which will actually help us shape the wave packet by giving an amplitude to each value of $k'$. This function should have a peak around the region where $k'=k$, so that our wave characteristics (frequency and wavenumber) are most pronounced.
Now we need to determine what $f(k')$ is. To do this, we select a value of the wave function $\psi$ at $t = 0$, for instance
$$\psi(z, 0) = e^{-z^2} \cos(kz)$$
Which is a simple wave packet. Now we use this initial value to determine the function $f$ by inverting our expression for $\psi$.
$$f(k') = \int_{-\infty}^{\infty} \psi(z, 0) cos(kz) dz$$
Note at this point: If it seems like this expression came out of thin air, it's because it is actually an inverse fourier transform, which technically also has an inverted imaginary sine component, but I've left this out for simplicity, at risk of leaving the reader puzzled by this equation. Another derivation of the wave packet can be found on Wikipedia which uses imaginary exponential form that might help to understand this part if you're familiar with Fourier transforms.
From this expression we evaluate $f(k')$, then use $f(k')$ to evaluate our original integral for any time $t$, giving us our final wave packet $\psi(z, t)$. For the example envelope above, we find our wave packet represented as
$$\psi(z, t) = e^{-(z - ct)^2} \cos \left(\frac{z - ct}{\lambda}\right)$$
Where $c$ is the speed of propagation of the wave in the medium, and $\lambda$ is the wavelength of the wave.
Now it should be understood that this wave packet is non-dispersive, meaning it will keep together in the same envelope as it travels. A dispersive wave packet, such as those found in the Schrodinger wave equation, would spread out, or disperse, over time as it travels.
Original Answer
I really like this question! This is something I was looking into not too long ago. The problem that you're having is that a one-dimensional wave is described by $A \cos(\omega t - kz)$ and this is defined for any value of $z$ despite the fact that the wave is supposed to be travelling. Note that I'm using $\cos$ and $z$ instead of $\sin$ and $x$; I'm more used to seeing it this way, I hope you don't mind.
To represent a one-dimensional wave that has a source (excitation) and limited energy density, we cannot use a simple trigonometric function alone such as $\sin$ or $\cos$. These functions are periodic, and exist at all points in 1-dimensional space. Being periodic, the only way to change the envelope is to multiply the function with an envelope function such as $e^{-z}$ which has the amplitude decrease exponentially as $z$ increases from $0$.
With the right envelope function, it might be feasible to model many time- and space-dynamic wave systems. But this is sort of cheating - one must know in advance the form of the wave, and that is not interesting.
So instead we will assume that we have:
- An initial condition
- An excitation source
- System of equations governing system parameters
For example, if we consider a taut string system, we want to apply a mechanical excitation to a point $z_0$, and model the response of the system to this excitation. If we have an electromagnetic field system, we might select the excitation source as a source current or potential difference, or electric or magnetic field values.
The excitation source is governed by some function of time, say $d(t)$. This gives us predictable values of our wave function, call it $\psi(t, z_0)$. From here, our challenge is evaluating the response of our system. In the case of real world systems, this will be a differential equation. For 1-dimensional systems, the differential equation is an ordinary differential equation, and for higher dimensional problems it will be a partial differential equation.
These may also be systems of equations.
Depending on your system, these could be Maxwell's equations, or an equation that models the string including things like damping. Problems such as this fall under the domain of dynamics. The methods of solving such problems fall under the topic of differential equations, and most realistic systems require discrete numerical methods to solve, such as the finite element method (FEM), finite difference method (FDM), finite volume method (FVM), finite difference time domain (FDTD) method (for EM), etc.
To model a physically traveling wave in a system, you must evaluate a dynamic system with an excitation source of some sort.
P.S. I would list sources, but this topic is so broad, and I'm not familiar with much of the literature on the field as a whole.