[9.0](backport #7601) [packaging] proxy binary to be for the root dir of windows archive #7639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


What does this PR do?
This PR introduces a Windows-specific proxy binary (elastic-agent-archive-root.exe) that is placed at the root of the Elastic Agent .zip archive. The proxy acts as a thin wrapper that forwards execution to the actual agent binary located under the data/elastic-agent-{commit-sha} directory.
The proxy is built during the packaging step using a new Mage target (WindowsArchiveRootBinary), and replaces the duplicated agent binary that previously resided in the archive root due to lack of symlink support in .zip archives. This approach mimics the behavior seen on other platforms like Linux/macOS, where the root-level agent is a symlink into the versioned binary path.
This change avoids the need to duplicate the agent binary in the archive, reducing both the archive size and post-extraction disk footprint.
Why is it important?
The Windows .zip archive currently includes a full copy of the elastic-agent.exe binary at the root of the archive due to the lack of symlink support in the zip format. This duplication, increases the download size and disk footprint unnecessarily
Checklist
./changelog/fragmentsusing the changelog toolDisruptive User Impact
There should be no disruptive user impact. The proxy binary is fully backward-compatible with existing workflows that invoke the elastic-agent.exe binary from the root of the archive on Windows. Users should not notice any difference in behavior.
How to test this PR locally
Package the windows archive
Unzip the resulting .zip file and verify that:
Related issues
Manual Testing
This is an automatic backport of pull request #7601 done by [Mergify](https://mergify.com).