feat: screen viewing, Jarvis sees the whole screen, a monitor or a window for registered people
- screenView tool (screen_view.spec.md): whole screen, monitor by number, window by part of its title or program, or the list of monitors and windows; fast, normal or detailed pictures. - The app captures with Windows Graphics Capture (app/src/screen.rs, admin.spec.md "Screen viewing"), decides for the asker (only people registered for PC control), never picks, lists or shows excluded programs (pcControl.screenExclude, password managers by default), refuses minimised windows and black pictures, and records screen.view in the activity log. - Pictures ride on the tool message (ToolExecutionResult.images); llm.py sends them to OpenAI-compatible servers as image parts after the tool messages. They stay in that reply only: not in the tool carryover, logs or prompt dumps. - The LLM reads pictures only when screen viewing is available (--vision gpu normally, cpu in a game), measured apart for the placement; otherwise screenView is a disabled tool. - Worker: screen_action / screen_action_result, 4 MiB messages. - Eval evals/test_screen_view_tool.py; Windows check tests/screen_windows.rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -164,6 +164,26 @@ pub struct NoteAction {
|
||||
pub note: Option<String>,
|
||||
}
|
||||
|
||||
/// The brain's screenView tool asks the app for the person asking (voice_worker.spec.md, "Screen
|
||||
/// viewing").
|
||||
#[derive(Debug, Clone, Deserialize, PartialEq)]
|
||||
pub struct ScreenAction {
|
||||
pub id: String,
|
||||
/// `capture` or `list`.
|
||||
pub action: String,
|
||||
pub user: String,
|
||||
/// capture: `screen`, `monitor` or `window`.
|
||||
#[serde(default)]
|
||||
pub target: Option<String>,
|
||||
#[serde(default)]
|
||||
pub monitor: Option<u32>,
|
||||
#[serde(default)]
|
||||
pub window: Option<String>,
|
||||
/// `fast`, `normal` or `detailed`.
|
||||
#[serde(default)]
|
||||
pub detail: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum WorkerEvent {
|
||||
Ready(HelloOk),
|
||||
@@ -176,6 +196,7 @@ pub enum WorkerEvent {
|
||||
ChatAction(ChatAction),
|
||||
ScheduleAction(ScheduleAction),
|
||||
NoteAction(NoteAction),
|
||||
ScreenAction(ScreenAction),
|
||||
/// The brain's answer to `reply` (empty and `failed` when it gave none).
|
||||
ReplyText { id: String, text: String, failed: bool },
|
||||
/// Was the utterance said to Jarvis? (a failed judgement is a no)
|
||||
@@ -374,6 +395,11 @@ impl WorkerClient {
|
||||
self.app_action_result("note_action_result", id, result);
|
||||
}
|
||||
|
||||
/// The outcome of a `screen_action`: `{item, images}`, or why it failed.
|
||||
pub fn screen_action_result(&self, id: &str, result: Result<Value, String>) {
|
||||
self.app_action_result("screen_action_result", id, result);
|
||||
}
|
||||
|
||||
fn app_action_result(&self, kind: &str, id: &str, result: Result<Value, String>) {
|
||||
let msg = match result {
|
||||
Ok(Value::Object(mut m)) => {
|
||||
@@ -665,6 +691,7 @@ fn on_text(inner: &Inner, t: &str) {
|
||||
"chat_action" => serde_json::from_value(v).ok().map(WorkerEvent::ChatAction),
|
||||
"schedule_action" => serde_json::from_value(v).ok().map(WorkerEvent::ScheduleAction),
|
||||
"note_action" => serde_json::from_value(v).ok().map(WorkerEvent::NoteAction),
|
||||
"screen_action" => serde_json::from_value(v).ok().map(WorkerEvent::ScreenAction),
|
||||
"llm_idle" => {
|
||||
if let Some(id) = v["id"].as_u64() {
|
||||
inner.llm_idle.send_if_modified(|got| if id > *got { *got = id; true } else { false });
|
||||
|
||||
Reference in New Issue
Block a user