Download tasks/data/reverse/001tmf__proteinview.9b9a079/environment/docs/panel-server.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 5.14 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/001tmf__proteinview.9b9a079/environment/docs/panel-server.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/001tmf__proteinview.9b9a079/environment/docs/panel-server.md
-
curl -L -o panel-server.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/001tmf__proteinview.9b9a079/environment/docs/panel-server.md
Headless Panel Server — Command Reference
The panel server (--panel-server) exposes a persistent, terminal-independent
render session for agent- or plugin-owned live views. It renders through
ProteinView's FullHD software framebuffer, atomically replaces one
caller-owned PNG, and acknowledges each state change over NDJSON on stdout.
Startup
proteinview <structure> --panel-server \
--output /tmp/proteinview-live.png \
--panel-width 960 --panel-height 540
--output is required and must point to a path whose parent directory exists.
--panel-server conflicts with --snapshot. After parsing the structure and
rendering the initial frame, the server writes a ready record to stdout and
then reads one NDJSON request per line from stdin.
--panel-width/--panel-heightset the initial framebuffer size in pixels.- Diagnostics go to stderr; stdout carries only NDJSON records and never terminal graphics escapes.
- Requests and responses are each capped at 64 KiB.
Protocol
Each request is a JSON object on one line. The id field is required and must
be an integer or a string no longer than 128 bytes. The command field selects
the operation; remaining fields are command-specific. Optional version must
equal 1 (the only supported version).
Each response is a JSON object:
- On success:
{"type":"response","protocol":"proteinview-panel","version":1, "id":<id>,"ok":true,"revision":<n>,"state":{...},"frame":{...}} - On error:
{"type":"response",...,"ok":false,"revision":<n>, "error":{"code":"<code>","message":"<msg>"}}
The initial ready record has type: "ready" and includes state, frame,
and limits (min/max dimension, max pixels, max request bytes). Successful
rendering commands increment revision; get_state and shutdown do not.
frame is {"path": "...", "mime_type": "image/png", "width": W, "height": H}.
state includes structure, camera, viewport, and presentation objects.
Commands
Rendering / camera
| Command | Parameters | Notes |
|---|---|---|
render |
— | Re-render the current frame (advances auto-rotate if enabled). |
rotate |
axis (x/y/z), delta (f64) |
Add delta (radians) to the given rotation. |
pan |
dx, dy (f64) |
Add to camera pan. |
zoom |
exactly one of factor (f64 > 0) or direction (in/out) |
in = ×1.1, out = ×0.9. |
reset |
— | Reset camera and re-fit the structure. |
fit |
— | Re-fit the structure to the current viewport. |
resize |
width, height (u32) |
Change framebuffer size and re-fit. |
Presentation
| Command | Parameters | Notes |
|---|---|---|
set_color |
color (structure/element/chain/bfactor/rainbow/plddt) |
|
cycle_color |
— | Cycle to the next available color scheme. |
set_viz |
mode (cartoon/backbone/wireframe) |
|
cycle_viz |
— | Cycle visualization mode. |
set_residue_colors |
residues: array of {"chain","residue_number","insertion_code"?,"color"} |
Atomically replaces all exact residue colors; empty array clears. |
set_interface |
enabled (bool) |
|
toggle_interface |
— | |
set_interactions |
enabled (bool) |
Requires interface mode. |
toggle_interactions |
— | Requires interface mode. |
set_ligands |
enabled (bool) |
|
toggle_ligands |
— | |
set_auto_rotate |
enabled (bool) |
|
toggle_auto_rotate |
— | |
select_chain |
direction (prev/next) |
|
set_chain |
chain (string) |
Errors if the chain ID is not found. |
Session
| Command | Parameters | Notes |
|---|---|---|
get_state |
— | Return current state without rendering or incrementing revision. |
shutdown |
— | Acknowledge and exit after responding. |
Error codes
| Code | Meaning |
|---|---|
request_too_large |
Request exceeded 64 KiB. |
invalid_json |
The line was not valid JSON. |
invalid_request |
Bad id, missing/non-string command, or unsupported version. |
unknown_command |
The command string is not recognized. |
invalid_params |
A parameter failed validation (e.g. non-finite value, bad chain, too many residue colors). |
invalid_state |
The command requires a different state (e.g. interactions without interface mode). |
render_failed |
Frame rendering failed; previous state is restored. |
response_too_large |
The response would exceed 64 KiB; previous state is restored. |
Examples
# Start the server (writes one "ready" record, then waits on stdin)
printf '%s\n' \
'{"id":1,"command":"rotate","axis":"y","delta":0.2}' \
'{"id":2,"command":"resize","width":320,"height":180}' \
'{"id":3,"command":"set_color","color":"chain"}' \
'{"id":4,"command":"set_residue_colors","residues":[{"chain":"A","residue_number":42,"color":"FF0000"}]}' \
'{"id":5,"command":"get_state"}' \
'{"id":6,"command":"shutdown"}' \
| proteinview examples/1UBQ.pdb --panel-server \
--output /tmp/proteinview-live.png \
--panel-width 960 --panel-height 540