# DSH Red Alert [简体中文](README.md) | [English](README.en.md) A real AI battlefield. Let DeepSeek build a base, command armies, fight, lose, review the match, and carry evidence-backed lessons into the next game of Red Alert 2. This is not screenshot interpretation, a Canvas tactical map, or a headless simulation hidden in the background. Native DSH Chat stays in the center, where the model's decisions, tool calls, and battle reports remain visible. A real Red Alert 2-compatible web client runs on the right in the same browser instance, on the same battlefield, and under the same AI seat. The user can enter a directive in Chat at any time and steer the next command cycle. If you want to see an agent do more than answer questions and instead act continuously under real rules, fog of war, and meaningful defeat, this is one of the most direct and playable demonstrations in DSH. ![DeepSeek commands a real Red Alert 2 battlefield beside DSH Chat](docs/readme-media/real-ai-battlefield.webp) The image shows the complete DSH page: sessions on the left, model decisions in the center, and the real game on the right. It comes from a live match using locally imported RA2 resources supplied by the user. The repository contains no game assets. ## Why it is fun - Watch the command logic: every tactical assessment, production plan, batch order, and tool receipt stays in Chat. - Intervene at any time: directives such as "hold the first wave," "keep two harvesters," or "stop expanding and build three tanks" enter the next command context. - Wins and losses are real: economy, power, build queues, pathfinding, combat, fog of war, and the result screen all come from the live client. - Command more than one unit at a time: a single tool call can issue a batch of unit orders and return a fresh battlefield summary, reducing redundant observation turns. - Turn defeats into rules: a natural match ending creates a structured episode; the model accepts or rejects candidate lessons and retrieves a short strategy matched to the next map, faction, and opponent. - Stay fair without becoming slow: the model sees its own forces, currently visible enemies, and frozen last-seen records, never hidden enemy state, while checking queues and coordinating parallel work more consistently than manual play. ![The model keeps deciding in Chat while the battlefield executes its commands](docs/readme-media/live-command.webp) ## Start in one minute You need Node.js 22.19 or later, pnpm 11, Bun, Git, and an existing DSH Web Profile that already starts successfully. The official DSH SDK currently uses restricted NPM packages, so your NPM account must be able to access `@deepseek-ai/*`. ```sh git clone https://github.com/vibeinging/dsh-red-alert.git cd dsh-red-alert pnpm run setup -- --profile web ``` `setup` checks dependencies, builds the plugin, prepares the locked compatible client, mounts the plugin into the selected DSH Profile, and verifies the final configuration. It does not modify a DSH source checkout or download Red Alert 2 art or sound assets. After setup, start the same configuration with: ```sh pnpm run dsh ``` When the battlefield opens for the first time, select an RA2 resource archive that you have the right to use. The verified minimum archive contains only: - `RA2.MIX` - `LANGUAGE.MIX` - `MULTI.MIX` Music, Taunts, movies, executables, and DLLs are not required. Import runs locally in the browser. The plugin does not write the assets into the DSH installation or distribute them through the repository or package. After updating the repository, run the same setup command to verify the build and mount again: ```sh git pull --ff-only pnpm run setup -- --profile web ``` ## Command it like this Use natural language in DSH Chat, for example: ```text Create a Soviet match against a normal AI at speed 2. Play it to completion and review the result. Hold the first wave, keep two harvesters, then transition into three Rhino Tanks. When enemies enter vision, focus the highest threat. Do not chase into fog of war. After a defeat, summarize the match, adopt only rules with clear evidence, and carry them into the next game. ``` The model loads lobby or learning tools when they become relevant, then adds observation, production, construction, and combat tools as the match advances. Unloaded tool schemas do not enter the model context. ## Post-match learning with evidence ![The real result screen appears beside the model review and adopted rules](docs/readme-media/post-match-learning.webp) Automatic learning does not train or modify model weights, and it does not store free-form prompts. The plugin derives a closed set of candidate rules only from fair battlefield data and accepted command results, records their evidence, and lets the model adopt or reject them. Later matches retrieve only a small set of rules matched to the current map and faction, preventing an unlimited history from filling the context window. A three-match series at speed 2 proves that lessons persist and can be retrieved by the next match. The first two matches ended in defeat; the third remained alive at tick 24090 with a more complete defense and armored production chain. This proves the learning path works, not that the current strategy has reached a stable win rate. See the [automatic improvement and match series report](docs/reports/2026-08-23_auto-learning-speed2-and-command-cycle.md) for the complete evidence. ## A real battlefield without cheating Chat, tools, the bridge, the engine, and the renderer remain bound to the same `sessionId`, `matchId`, AI seat, and tick. Enemy information reaches the model in only three forms: - `visibleEnemies`: enemies inside current real vision. - `lastSeenEnemies`: the final legal observation before an enemy leaves vision; position, health, and `observedAtTick` remain frozen while hidden. - `visibleNeutralObjects`: neutral objects inside current real vision. The model cannot access hidden enemy start positions, enemy economy, full-map objects, debug state, an observer view, Canvas pixels, or unfiltered engine objects. The renderer and model bridge use the same current-LOS rule. Construction placement searches only for legal foundations inside current vision. ## Game capabilities loaded by phase All 85 public engine declarations are classified in `METHOD_POLICY`. Twenty-one precise manifest entries cover allowed engine capabilities and plugin-owned learning operations; unsafe methods remain unavailable. A new session initially registers only two bootstrap tools: | Group | Main capabilities | | --- | --- | | `bootstrap/capability` | Discover capabilities and load precise tool groups | | `strategy/learning` | Retrieve short strategies, review matches, and adopt candidate rules | | `lobby/setup` | Select maps, configure players, create matches, and start games | | `observation` | Fair observation, state, maps, resources, and rules | | `units/combat` | Movement, attacks, deployment, and batch unit commands | | `production/economy` | Catalogs, queues, production, pause, and cancellation | | `construction` | Building catalogs, legal placement, repair, and selling | | `diplomacy/comms` | Diplomacy and communication | | `superweapon` | Superweapons | | `lifecycle/replay` | Stop and end a match | Every precise renderer tool returns a `commandView` containing the current tick, economy, power, owned units, visible enemies, and frozen last-seen records. The model can continue from the same receipt instead of reading the full state again before every action. `red_alert_start.gameSpeed` accepts values from 0 through 6. The default is speed 2, the original 15 ticks per second. Speed applies equally to both sides and the renderer and does not change model permissions. Profiles can override it with `defaultGameSpeed`. ## What the installer does and does not do ```text pnpm run setup -> check Git, pnpm, Bun, and dsh -> verify an existing DSH Web Profile -> install dependencies and build the plugin -> prepare the locked GPLv3-compatible client and adapter -> mount the external plugin with the official dsh plugin command -> verify the mount through the final Profile configuration -> save local launch state under the ignored .runtime/ directory ``` The installer stops at the real failure point. An `@deepseek-ai` 404 means the current NPM account cannot access a required official SDK package. Setup does not bypass that permission or report a missing package as success. If you do not yet have a working DSH Web Profile, create and verify one through the official DSH workflow first. To use a custom renderer directory: ```sh pnpm run setup -- --profile web --renderer-dir /absolute/new/red-alert-renderer ``` To print the exact command plan without changing files or Profile state: ```sh pnpm run setup -- --profile web --dry-run ``` See the [renderer adapter documentation](renderer-adapter/README.md) for the locked source, commit, patch contents, and GPLv3 boundary. ### Manual mount For complete manual control: ```sh pnpm install --frozen-lockfile pnpm run build pnpm prepare:renderer -- /absolute/new/red-alert-renderer RA_RENDERER_DIST_DIR=/absolute/new/red-alert-renderer/dist \ dsh plugin --profile web add -w file:/absolute/path/to/dsh-red-alert --save-exact --ignore-scripts RA_RENDERER_DIST_DIR=/absolute/new/red-alert-renderer/dist \ dsh --profile web --dump-config ``` Uninstalling removes only the external plugin and does not touch DSH source: ```sh dsh plugin --profile web remove -w @deepseek-ai/dsh-red-alert ``` ## Acceptance result ```text RA_READY = min(PROFILE, FOG, VISUAL, TOOL_COVERAGE, LAZY_LOAD, SAME_MATCH, DSH_CONTRACT, REGRESSION) = 1 ``` | Metric | Result | Evidence summary | | --- | --- | --- | | `PROFILE` | 1 | The external bundle mounts through a real DSH Profile with zero DSH checkout writes | | `FOG` | 1 | Offline audits show no leak; current LOS, last-seen freezing, and fail-closed boundaries pass in a real browser | | `VISUAL` | 1 | The DSH right panel shows the real map, HUD, minimap, fog, units, and buildings beside Chat | | `TOOL_COVERAGE` | 1 | All 85 public declarations are classified; allowed methods have precise wrappers and unsafe methods stay unavailable | | `LAZY_LOAD` | 1 | A session starts with bootstrap only and publishes group schemas after durable selection | | `SAME_MATCH` | 1 | Chat commands, bridge, engine, and iframe remain bound to the same match | | `DSH_CONTRACT` | 1 | Official SDK, Profile, client handoff, transport, and projection paths pass | | `REGRESSION` | 1 | Plugin checks, adapter tests, builds, package checks, and fair-observation audits pass | Detailed evidence is available in the [final acceptance report](docs/reports/2026-08-22_dsh-real-client-final-acceptance.md), [wide-panel defense rematch report](docs/reports/2026-08-23_dsh-wide-panel-defense-rematch.md), and [automatic improvement report](docs/reports/2026-08-23_auto-learning-speed2-and-command-cycle.md). These reports are currently written in Chinese. ## Verification ```sh pnpm run check pnpm run setup -- --profile web --dry-run ``` `pnpm run check` covers repository rules, method policy, the renderer adapter, lint, Host and client type checking, builds, plugin tests, game-host tests, fair-observation audits, and publint. ## Project boundaries - This is an independent external plugin built specifically for DeepSeek Harness. It mounts through the official NPM SDK, `cordis.patch.yml`, and Profile mechanisms without modifying DSH source. - Pending commands do not promise cross-process exactly-once behavior after a browser or Host crash. Recovery fails closed instead of guessing whether a command ran. - Without movie assets, the compatible client can report non-blocking video decoding warnings. Minimum resource import and real matches continue to work. - Open-source compatible client code does not place EA art, sound, or map assets in the public domain. Users must confirm their resource source and usage rights. - The repository is currently private and unpublished, with the top-level license set to `UNLICENSED`. A public release requires an explicit top-level license and release-scope decision. - NPM publishing and game-asset distribution require separate authorization.