Viewer Manual
oasis7 Viewer User Manual
Covers startup modes, controls, auto-focus, automation steps, web closure debugging, and common issue diagnosis for `oasis7_viewer` workflows.
Quick Start
1) Start live server (recommended)
env -u RUSTC_WRAPPER cargo run -p oasis7 --bin oasis7_viewer_live -- llm_bootstrap --bind 127.0.0.1:5023 --web-bind 127.0.0.1:5011
`oasis7_viewer_live` now defaults to LLM mode; formal gameplay requires a configured, reachable LLM provider.
env -u RUSTC_WRAPPER cargo run -p oasis7 --bin oasis7_viewer_live -- llm_bootstrap --no-llm --bind 127.0.0.1:5023 --web-bind 127.0.0.1:5011
`--no-llm` is observer/debug only; `gameplay_action/prompt/chat` returns `llm_mode_required` or `llm_init_failed`, while `step/play` returns `ControlCompletionAck` with `Blocked + error_code/error_message`.
2) Start viewer
env -u RUSTC_WRAPPER cargo run -p oasis7_viewer -- 127.0.0.1:5023
3) Offline mode (no server connection)
OASIS7_VIEWER_OFFLINE=1 env -u RUSTC_WRAPPER cargo run -p oasis7_viewer
4) Browser mode (Bevy + wasm)
env -u NO_COLOR ./scripts/run-viewer-web.sh --address 127.0.0.1 --port 4173
Open: `http://127.0.0.1:4173/?ws=ws://127.0.0.1:5011`.
5) Release mode (P2P recommended)
`oasis7_viewer_live` is now a pure viewer live service and no longer accepts `--release-config`, `--runtime-world`, or `--node-*` control-plane flags.
For P2P release flows, lock chain parameters through `oasis7_chain_runtime` (typically managed by `oasis7_game_launcher` / `oasis7_web_launcher` / `oasis7_client_launcher`). Viewer keeps only `--bind`, `--web-bind`, and `--llm/--no-llm`; `--no-llm` remains observer/debug only.
Common Interaction
- Mouse drag: rotate/pan camera.
- Mouse wheel: zoom.
- `W/A/S/D`: move camera focus (works in 2D/3D when pointer is in viewport and no text field is active).
- `2D/3D`: switch view mode from the top controls.
- Controls (Observe mode): defaults to a single `Play/Pause` toggle; click `Advanced Debug` to expand `Step` and `Seek 0`.
- `F`: focus current selection.
- Main right panel: inspect controls, status, events, chunk overlays, and diagnostics modules.
- Rightmost Chat panel: dedicated Agent Chat surface, no longer mixed with the main right panel; shown only in Observe mode with expanded top area.
- Chat input: with focus in the input box, press `Enter` to send and `Shift+Enter` to insert a newline.
Auto Focus
Use environment variables to focus a target at startup:
- `OASIS7_VIEWER_AUTO_FOCUS=1`
- `OASIS7_VIEWER_AUTO_FOCUS_TARGET=<target>`
- `OASIS7_VIEWER_AUTO_FOCUS_FORCE_3D=1|0` (default `1`)
- `OASIS7_VIEWER_AUTO_FOCUS_RADIUS=<number>` (optional)
Supported syntax: `first_fragment`, `first_location`, `first_agent`, `location:<id>`, and `agent:<id>` (with shorthand aliases `fragment/location/agent`).
Auto focus targets are limited to Agent / Location / Fragment.
Auto Select / Automation Steps
- `--auto-select-target`: auto-select a target after startup (recommended `first_agent`, legacy `first:agent` remains supported).
- `--automation-steps`: execute a step sequence (for example `mode=3d;focus=first_agent;zoom=0.8;select=asset:asset-0`).
./scripts/capture-viewer-frame.sh \
--scenario llm_bootstrap \
--addr 127.0.0.1:5131 \
--auto-select-target first_agent \
--automation-steps "mode=3d;focus=first_agent;zoom=0.8;select=fragment:frag-0"
Web Closure Loop (default recommendation)
Prerequisites
- Node.js 20+ (`npx` available)
- `trunk` (`cargo install trunk`)
- `wasm32-unknown-unknown` (`rustup target add wasm32-unknown-unknown`)
Standard Flow
Terminal A: start live server.
env -u RUSTC_WRAPPER cargo run -p oasis7 --bin oasis7_viewer_live -- llm_bootstrap --bind 127.0.0.1:5023 --web-bind 127.0.0.1:5011
The default path assumes active LLM access; if you explicitly switch to `--no-llm`, this Web route is observer/debug only and does not count as formal gameplay evidence.
Terminal B: start web viewer.
env -u NO_COLOR ./scripts/run-viewer-web.sh --address 127.0.0.1 --port 4173
Terminal C: run the agent-browser capture loop.
command -v agent-browser >/dev/null || { echo "missing agent-browser" >&2; exit 1; }
mkdir -p output/playwright/viewer
agent-browser --headed open "http://127.0.0.1:4173/?ws=ws://127.0.0.1:5011&test_api=1"
agent-browser wait --load networkidle
agent-browser snapshot -i
agent-browser eval "JSON.stringify(window.__AW_TEST__?.getState?.() ?? null)"
agent-browser console | tee output/playwright/viewer/console.log
agent-browser screenshot output/playwright/viewer/viewer-web.png
agent-browser close
Note: the artifact directory currently keeps the legacy path output/playwright/viewer/ for compatibility. `render_mode` defaults to auto: use the standard Viewer when hardware WebGL is available, and automatically switch to software_safe when SwiftShader / software renderer / no WebGL is detected. Append &render_mode=software_safe to force the safe mode explicitly.
`sendControl(\"step\")` semantic check
Run the following in browser console or agent-browser evaluate to verify step-by-step control:
window.__AW_TEST__.sendControl("step");
window.__AW_TEST__.sendControl("step", { count: 3 });
window.__AW_TEST__.sendPromptControl("preview", { agentId: "agent-0", shortTermGoal: "software-safe preview" });
window.__AW_TEST__.sendPromptControl("apply", { agentId: "agent-0", shortTermGoal: "software-safe apply" });
window.__AW_TEST__.sendAgentChat("agent-0", "hello from software_safe");
window.__AW_TEST__.getState();
When the page is served by oasis7_game_launcher with viewer auth bootstrap injected, software_safe also exposes a minimal selected-agent prompt/chat surface. The matching automation methods are sendPromptControl(mode, payload) and sendAgentChat(agentId, message).
Prompt Overrides now lives behind the default-collapsed “Advanced Prompt Settings” item. The preview/apply/rollback form appears only after you select an agent and expand that setting. The toggle remembers its last browser-local state and does not affect __AW_TEST__.sendPromptControl(...).
Outputs and Minimum Acceptance
- Outputs: `output/playwright/viewer/*.png`, `output/playwright/viewer/console.log` (or equivalent redirected log).
- Acceptance: page loads successfully and `window.__AW_TEST__.getState().renderMode` is explicitly `standard` or `software_safe`; at least one screenshot artifact exists and `step` advances tick.
- When `rendererClass=software`, `software_safe` is an acceptable minimal-closure result; `canvas` is no longer required in that path.
Native fallback (only when web path cannot reproduce)
./scripts/capture-viewer-frame.sh --scenario asteroid_fragment_detail_bootstrap --addr 127.0.0.1:5131 --viewer-wait 12 --auto-focus-target first_fragment --auto-focus-radius 18
Common advanced flags: `--capture-max-wait`, `--no-prewarm`, `--keep-tmp`, `--auto-focus-keep-2d`.
Main Right Panel and Chat Panel
Module visibility and local persistence
- Each module can be toggled independently: Controls, Overview, Overlays, Diagnostics, Event Routing, Timeline, Status Details.
- The `Chat` toggle controls a dedicated rightmost Chat panel; when disabled, the chat panel is not rendered and takes no right-side width.
- Chat content is no longer rendered inside the main right panel.
- Toggle states are persisted and restored on restart.
- Default file: `$HOME/.oasis7_viewer/right_panel_modules.json`.
- Override path with: `OASIS7_VIEWER_MODULE_VISIBILITY_PATH`.
Selection details panel
- Supports: Agent, Location, Asset, PowerPlant, Chunk.
- In LLM scenarios, the latest decision I/O summary is available.
Quick locate agent
- Entry: `Locate Agent` button in `Event Routing` area.
- Priority: current selected agent first, otherwise the lexicographically first agent.
Overview Zoom Mode Switch (2D)
- 2D view auto-switches between detail mode and overview-map mode based on zoom tier.
- Default starts in detail mode; once crossing threshold, viewer enters overview-map mode with simplified layers.
Copyable Text Panel
- Open text panel to copy state, events, diagnostics, and selection detail text.
- Use OS shortcut to copy (macOS `Cmd+C` / Windows/Linux `Ctrl+C`).
UI Language Switch
- Viewer UI supports Chinese and English.
- Switch via top language control with immediate effect.
Recommended Debug Scenarios
- `asteroid_fragment_detail_bootstrap`: inspect fine-grained location rendering.
- `llm_bootstrap`: routine online integration.
- `twin_region_bootstrap`: compare two-region coordination behavior.
Fragment Depletion Visualization
- When a location has `fragment_budget`, visual size scales by remaining mass ratio.
- Lower remaining budget yields smaller rendered radius, with a minimum visibility clamp.
- Details panel shows: `Fragment Depletion: mined=<x>% remaining=<a>/<b>`.
Troubleshooting
- Blank web page: wait for first `trunk` build and verify port/URL consistency.
- `agent-browser` startup failure: check `agent-browser --version` and local browser dependencies.
- Wasm errors in console: fix runtime initialization errors before debugging visuals.
- Cannot see detail: switch to 3D, zoom and move camera, or use `F` focus.
- Auto focus not working: verify target existence, start from `first_fragment`.
- Connection failure: check `oasis7_viewer_live` process and endpoint port match.
References
- viewer-location-fine-grained-rendering.prd.md
- viewer-auto-focus-capture.prd.md
- viewer-web-closure-testing-policy.prd.md
- viewer-selection-details.prd.md
- viewer-right-panel-module-visibility.prd.md
- viewer-overview-map-zoom.prd.md
- viewer-agent-quick-locate.prd.md
- viewer-copyable-text.prd.md
- viewer-generic-focus-targets.prd.md
- viewer-web-test-api-step-control-2026-02-24.prd.md
- capture-viewer-frame.prd.md
Fragment Element Chunk Rendering (default enabled)
- Goal: render location fragment chunks by default, colorized by dominant element.
- Behavior: outer location geometry and labels are hidden; logical anchors remain while fragment chunks always render.
- Selection: clicking a fragment shows owning `location` ID/name in the details panel.
- Configuration: fragment visibility toggle and related env vars have been removed.