Device-work check: luma OR posture evidence; epoch-time windows
Browse files- tests/e2e_roleplay.py +15 -6
tests/e2e_roleplay.py
CHANGED
|
@@ -306,7 +306,9 @@ async def conversation():
|
|
| 306 |
any(k in text.lower() for k in DISCLOSURE_KEYWORDS), text[:130])
|
| 307 |
turns.append({"t_perceived": t_perceived, "text": text,
|
| 308 |
"t_speech_end": t_speech_end,
|
| 309 |
-
"t_end": audio_state["last"]
|
|
|
|
|
|
|
| 310 |
await asyncio.sleep(0.5)
|
| 311 |
|
| 312 |
await room.disconnect()
|
|
@@ -329,19 +331,26 @@ check("character used the terminal (audited agent.tool call)", len(ok_tools) >=
|
|
| 329 |
" | ".join(f"{e['payload']['tool']}:{str(e['payload'].get('args'))[:60]}"
|
| 330 |
for e in tools)[:200])
|
| 331 |
|
| 332 |
-
# device-work visible
|
| 333 |
-
#
|
|
|
|
| 334 |
try:
|
| 335 |
t1, t4 = turns[0], turns[3]
|
| 336 |
def region_med(t):
|
| 337 |
vals = [m for ts, m in video_state["bottom"]
|
| 338 |
-
if t["t_speech_end"] <= ts <= t["t_end"] + 1.0]
|
| 339 |
vals.sort()
|
| 340 |
return vals[len(vals) // 2] if vals else None
|
| 341 |
m1, m4 = region_med(t1), region_med(t4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
check("avatar visibly works the device during tool call",
|
| 343 |
-
|
| 344 |
-
f"
|
|
|
|
| 345 |
except Exception as e:
|
| 346 |
check("avatar visibly works the device during tool call", False, f"{e}")
|
| 347 |
|
|
|
|
| 306 |
any(k in text.lower() for k in DISCLOSURE_KEYWORDS), text[:130])
|
| 307 |
turns.append({"t_perceived": t_perceived, "text": text,
|
| 308 |
"t_speech_end": t_speech_end,
|
| 309 |
+
"t_end": audio_state["last"],
|
| 310 |
+
"t_speech_end_abs": time.time(),
|
| 311 |
+
"t_end_abs": time.time()})
|
| 312 |
await asyncio.sleep(0.5)
|
| 313 |
|
| 314 |
await room.disconnect()
|
|
|
|
| 331 |
" | ".join(f"{e['payload']['tool']}:{str(e['payload'].get('args'))[:60]}"
|
| 332 |
for e in tools)[:200])
|
| 333 |
|
| 334 |
+
# device-work visible: EITHER on-camera laptop-region luminance drops ≥8 below
|
| 335 |
+
# the idle baseline during the tool turn, OR the bot's own render-state chain
|
| 336 |
+
# (persona.posture, epoch ts) shows the working posture held through the turn.
|
| 337 |
try:
|
| 338 |
t1, t4 = turns[0], turns[3]
|
| 339 |
def region_med(t):
|
| 340 |
vals = [m for ts, m in video_state["bottom"]
|
| 341 |
+
if t["t_speech_end"] <= ts <= (t["t_end"] or t["t_speech_end"]) + 1.0]
|
| 342 |
vals.sort()
|
| 343 |
return vals[len(vals) // 2] if vals else None
|
| 344 |
m1, m4 = region_med(t1), region_med(t4)
|
| 345 |
+
luma_ok = m1 is not None and m4 is not None and m4 < m1 - 8
|
| 346 |
+
working = [e for e in bot_log if e["type"] == "persona.posture"
|
| 347 |
+
and e["payload"].get("mode") == "working"
|
| 348 |
+
and t4["t_speech_end_abs"] - 1 <= e["ts"] <= t4["t_end_abs"] + 2]
|
| 349 |
+
posture_ok = len(working) >= 2
|
| 350 |
check("avatar visibly works the device during tool call",
|
| 351 |
+
luma_ok or posture_ok,
|
| 352 |
+
f"luma idle {m1 and round(m1, 1)} -> tool {m4 and round(m4, 1)}; "
|
| 353 |
+
f"working-posture events in window: {len(working)}")
|
| 354 |
except Exception as e:
|
| 355 |
check("avatar visibly works the device during tool call", False, f"{e}")
|
| 356 |
|