feat(v2): screenView sees someone's Discord screen share in its popped-out window

The share target checks that the person asked about shares their screen in
Jarvis's voice channel, finds Discord's popped-out window (title not ending in
Discord, the voice channel's name first) and, when there is none, asks for it in
the channel and looks again every second for 30 s. Screen actions now wait as
long as PC actions in the worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-19 13:43:31 +09:00
parent 3af881935c
commit 844958d311
13 changed files with 287 additions and 28 deletions

View File

@@ -169,8 +169,9 @@ class VoiceWorker:
def action_timeout_s(self, kind: str) -> float:
"""How long an app action is waited for: a PC action (starting a program and reading its new
window, admin.spec.md "PC control") gets at least PC_ACTION_TIMEOUT_S."""
return max(self.chat_timeout_s, PC_ACTION_TIMEOUT_S) if kind == "pc" else self.chat_timeout_s
window, admin.spec.md "PC control") and a screen action (a screen share waited for while it
is popped out, "Screen viewing") get at least PC_ACTION_TIMEOUT_S."""
return max(self.chat_timeout_s, PC_ACTION_TIMEOUT_S) if kind in ("pc", "screen") else self.chat_timeout_s
async def start(self) -> None:
if self.history is not None:

View File

@@ -436,7 +436,8 @@ captures and decides who may see (`app/src/admin.spec.md`, "Screen viewing"):
```
<- {"type": "screen_action", "id": "s1", "action": "capture|list", "user": "<id>", "via": "voice|chat",
"channel": "...", "target": "screen|monitor|window", "monitor": 2, "window": "chrome", "detail": "fast|normal|detailed"}
"channel": "...", "target": "screen|monitor|window|share", "monitor": 2, "window": "chrome", "person": "철수",
"detail": "fast|normal|detailed"}
-> {"type": "screen_action_result", "id": "s1", "ok": true, "item": {...}, "images": ["<base64 JPEG>"]} // or ok false with "error"
```
@@ -444,6 +445,8 @@ captures and decides who may see (`app/src/admin.spec.md`, "Screen viewing"):
waiting are those of chat and schedule actions. `images` that are not a list of strings are
dropped. The pictures stay in that one reply (screen_view.spec.md).
- Messages may be up to 4 MiB (pictures), the WebSocket's limit.
- A screen action is waited for as long as a PC action (45 s): the app may wait up to 30 s for a
screen share to be popped out.
### PC control (M7)