release: Mantoz — population-scale evaluation with simulated personas

This commit is contained in:
public-repo-gate
2026-09-06 20:45:19 +03:00
parent 08d5437777
commit de9a1a3b63
138 changed files with 10855 additions and 1 deletions
@@ -0,0 +1,12 @@
FROM ubuntu:24.04
# computer-use runtime: Harbor computer-1 так же работает через Xvfb,
# xdotool и screenshots. Ubuntu уже содержит bash для обёртки Harbor.
# ponytail: XFCE/VNC не нужны для автопрогона; добавить для live-view.
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
fonts-dejavu-core python3 python3-tk scrot xauth xdotool xvfb \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY desktop_app.py run_scenario.py /app/
@@ -0,0 +1,52 @@
"""Минимальное desktop-приложение: диалог разрешения уведомлений."""
import tkinter as tk
class DecisionApp:
def __init__(self) -> None:
self.root = tk.Tk()
self.root.title("Mantoz — уведомления")
self.root.geometry("760x420+80+80")
self.root.configure(bg="#f4f1ea")
self.decision: str | None = None
tk.Label(
self.root,
text="Разрешить уведомления?",
font=("DejaVu Sans", 22, "bold"),
bg="#f4f1ea",
).pack(pady=(70, 20))
tk.Label(
self.root,
text="Приложение будет сообщать о важных событиях.",
font=("DejaVu Sans", 13),
bg="#f4f1ea",
).pack(pady=(0, 45))
row = tk.Frame(self.root, bg="#f4f1ea")
row.pack()
self.buttons: dict[str, tk.Button] = {}
for value, label in (
("deny", "Запретить"),
("later", "Позже"),
("allow", "Разрешить"),
):
button = tk.Button(
row,
text=label,
width=15,
font=("DejaVu Sans", 12),
command=lambda choice=value: self.choose(choice),
)
button.pack(side="left", padx=10)
self.buttons[value] = button
self.status = tk.Label(
self.root, text="", font=("DejaVu Sans", 13, "bold"), bg="#f4f1ea"
)
self.status.pack(pady=35)
def choose(self, decision: str) -> None:
self.decision = decision
self.status.configure(text=f"Решение: {decision}")
@@ -0,0 +1,74 @@
"""Проходит desktop-сценарий мышью и снимает виртуальный дисплей."""
import json
import os
import subprocess
import sys
from pathlib import Path
from desktop_app import DecisionApp
OPTIONS = ("allow", "later", "deny")
SCREENSHOTS = Path("/app/screenshots")
def command(*args: str) -> None:
subprocess.run(
args, check=True, env={**os.environ, "DISPLAY": os.environ["DISPLAY"]}
)
def main() -> int:
plan = json.loads(Path("/app/plan.json").read_text("utf-8"))
target = plan.get("choose")
if target not in OPTIONS:
print(f"неизвестное решение: {target!r}", file=sys.stderr)
return 1
SCREENSHOTS.mkdir(exist_ok=True)
app = DecisionApp()
actions = [{"type": "open", "target": "notification-dialog"}]
failure: list[Exception] = []
def automate() -> None:
try:
command("scrot", "-o", str(SCREENSHOTS / "before.png"))
actions.append({"type": "screenshot", "target": "before.png"})
button = app.buttons[target]
x = button.winfo_rootx() + button.winfo_width() // 2
y = button.winfo_rooty() + button.winfo_height() // 2
command("xdotool", "mousemove", "--sync", str(x), str(y), "click", "1")
actions.append({"type": "click", "target": target, "x": x, "y": y})
app.root.after(150, finish)
except Exception as exc:
failure.append(exc)
app.root.quit()
def finish() -> None:
try:
app.root.update_idletasks()
command("scrot", "-o", str(SCREENSHOTS / "after.png"))
actions.append({"type": "screenshot", "target": "after.png"})
except Exception as exc:
failure.append(exc)
finally:
app.root.quit()
app.root.after(350, automate)
app.root.mainloop()
app.root.destroy()
if failure:
raise failure[0]
if app.decision != target:
print("клик не изменил состояние приложения", file=sys.stderr)
return 1
Path("/app/result.json").write_text(
json.dumps({"actions": actions, "decision": app.decision}, ensure_ascii=False)
+ "\n",
encoding="utf-8",
)
return 0
if __name__ == "__main__":
sys.exit(main())