Face unlock window: live camera preview, Snap, thumbnails, one password on Apply
CI / test (push) Failing after 12m30s

Settings > Session "Add or remove faces…" (and "Remove…" on a face) opens a
compositor-drawn Face unlock window instead of running root steps one by one:

- chandra-face camera runs as the user (no password): it streams a small live
  picture with the face box and a cropped thumbnail per snap; the snaps'
  embeddings stay in that process, nothing is written to disk.
- Click a snap to drop it; mark saved faces Remove/Keep.
- Apply saves the snaps as one face and removes the marked ones in one root
  `chandra-face apply` (JSON on stdin, validated) through run0/pkexec: one
  password prompt.
- New raster host function image-pixels (host-wasm, wasmhost, native) for the
  window's pictures.

Tests: camera session and apply in face/test_face.py; the window end to end
against a fake tool in compositor/host/face_test.mbt. Docs explain why the
change itself still needs root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhiJfJNAYqWzQiuKMf
This commit is contained in:
Claude committed 2026-11-26 02:36:29 +00:00
1 parent 0a9787ae36
commit 9f7489cfea
74 files changed
+2617 -89

No files matched your search

+46
View File
@@ -12,22 +12,60 @@ pub let binary_config : ClockConfig
pub fn binary_info() -> (String, String, Int32, Int32, Int32)
pub fn days_in_month(Int32, Int32) -> Int32
pub let digital_config : ClockConfig
pub fn digital_info() -> (String, String, Int32, Int32, Int32)
pub fn is_leap(Int32) -> Bool
pub fn iso_week(Int32, Int32, Int32) -> Int32
pub fn long_date(@types.Datetime) -> String
pub fn month_grid(Int32, Int32, Bool) -> Array[DayCell]
pub fn render_binary(@types.Size, @theme.Tokens, @types.Datetime, seconds? : Bool) -> Array[@types.DrawOp]
pub fn render_digital(@types.Size, @theme.Tokens, @types.Datetime, hour12? : Bool, show_date? : Bool, ampm? : Bool) -> Array[@types.DrawOp]
pub fn weekday_of(Int32, Int32, Int32) -> Int32
// Errors
// Types and methods
pub(all) struct Calendar {
mut open : Bool
mut year : Int32
mut month : Int32
mut monday_first : Bool
mut week_numbers : Bool
mut hover : CalendarHit
}
pub fn Calendar::go_today(Self, @types.Datetime) -> Unit
pub fn Calendar::handle(Self, Bool, @types.InputEvent, @types.Datetime) -> Bool
pub fn Calendar::hit(Self, Int32, Int32) -> CalendarHit
pub fn Calendar::new() -> Self
pub fn Calendar::render(Self, @theme.Tokens, @types.Datetime, hour12? : Bool, ampm? : Bool) -> Array[@types.DrawOp]
pub fn Calendar::shift(Self, Int32) -> Unit
pub fn Calendar::size(Self) -> (Int32, Int32)
pub fn Calendar::toggle(Self, @types.Datetime) -> Unit
#derive(Eq, @debug.Debug)
pub(all) enum CalendarHit {
Prev
Next
Today
Nothing
}
pub(all) struct ClockConfig {
mut hour12 : Bool
mut show_date : Bool
mut seconds : Bool
mut ampm : Bool
cal : Calendar
}
pub fn ClockConfig::binary_items(Self) -> Array[ConfigEntry]
pub fn ClockConfig::digital_items(Self) -> Array[ConfigEntry]
@@ -42,6 +80,14 @@ pub(all) struct ConfigEntry {
value : String
}
#derive(Eq, @debug.Debug)
pub(all) struct DayCell {
year : Int32
month : Int32
day : Int32
in_month : Bool
}
// Type aliases
// Traits
+2
View File
@@ -58,6 +58,8 @@ pub let size_choices : Array[String]
pub fn tile_color(String) -> @types.Color
pub fn titled_at(Array[DockItem], DockConfig, Int32, Int32, Int32) -> Bool
pub fn toggle_pin(Array[String], String) -> Array[String]
// Errors
+68
View File
@@ -0,0 +1,68 @@
// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/lib/icondesk"
import {
"chandra/desktop/interface/chandra/desktop/theme",
"chandra/desktop/interface/chandra/desktop/types",
"moonbitlang/core/debug",
}
// Values
pub let count_choices : Array[String]
pub let size_choices : Array[String]
pub let state : Desk
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) enum Action {
NoAction
Launch(String)
}
#derive(Eq, @debug.Debug)
pub(all) struct ConfigEntry {
key : String
label : String
choices : Array[String]
value : String
}
pub(all) struct Desk {
mut count : String
mut size : String
places : Map[String, (Int32, Int32)]
mut w : Int32
mut h : Int32
mut bottom : Int32
mut hover : String
mut selected : String
mut focused : Bool
mut press_id : String
mut press_x : Int32
mut press_y : Int32
mut dragging : Bool
mut ptr_x : Int32
mut ptr_y : Int32
}
pub fn Desk::app_at(Self, Array[@types.AppEntry], Int32, Int32) -> String
pub fn Desk::cell(Self) -> (Int32, Int32, Int32)
pub fn Desk::cell_at(Self, Int32, Int32) -> (Int32, Int32)
pub fn Desk::cell_origin(Self, Int32, Int32) -> (Int32, Int32)
pub fn Desk::config_items(Self) -> Array[ConfigEntry]
pub fn Desk::decode_places(Self, String) -> Unit
pub fn Desk::encode_places(Self) -> String
pub fn Desk::grid(Self) -> (Int32, Int32)
pub fn Desk::handle(Self, Array[@types.AppEntry], @types.InputEvent) -> (Bool, Action)
pub fn Desk::layout(Self, Array[@types.AppEntry]) -> Array[(Int32, Int32)]
pub fn Desk::new() -> Self
pub fn Desk::render(Self, Array[@types.AppEntry], @types.Size, @theme.Tokens, (String) -> UInt32) -> Array[@types.DrawOp]
pub fn Desk::set_config(Self, String, String) -> Bool
pub fn Desk::shown(Self, Array[@types.AppEntry]) -> Array[@types.AppEntry]
// Type aliases
// Traits
+20 -2
View File
@@ -7,11 +7,25 @@ import {
}
// Values
pub fn action_at(Array[@types.AppEntry], State, @types.Point) -> Int32
pub let action_logout : Int32
pub let action_power_off : Int32
pub let action_reload : Int32
pub let action_restart : Int32
pub let action_suspend : Int32
pub fn close(State) -> Unit
pub fn filter(Array[@types.AppEntry], String) -> Array[@types.AppEntry]
pub fn handle_event(Array[@types.AppEntry], State, Target, @types.InputEvent, (String) -> Result[Unit, String]) -> Bool
pub fn handle_event(Array[@types.AppEntry], State, Target, @types.InputEvent, (String) -> Result[Unit, String], session? : (Int32) -> Unit) -> Bool
pub fn needs_confirm(Int32) -> Bool
pub fn popup_size(Array[@types.AppEntry], State) -> @types.Size
@@ -19,10 +33,12 @@ pub let popup_w : Int32
pub fn render_button(@types.Size, @theme.Tokens, State) -> Array[@types.DrawOp]
pub fn render_popup(Array[@types.AppEntry], @theme.Tokens, State, icon? : (String) -> UInt) -> Array[@types.DrawOp]
pub fn render_popup(Array[@types.AppEntry], @theme.Tokens, State, icon? : (String) -> UInt32) -> Array[@types.DrawOp]
pub fn row_at(Array[@types.AppEntry], State, @types.Point) -> Int32
pub let session_actions : Array[String]
pub fn shown_rows(Array[@types.AppEntry], State) -> Array[@types.AppEntry]
// Errors
@@ -33,6 +49,8 @@ pub struct State {
mut query : String
mut hover : Int32
mut error : String
mut hover_action : Int32
mut armed : Int32
}
pub fn State::new() -> Self
+63
View File
@@ -0,0 +1,63 @@
// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/lib/starfield"
import {
"chandra/desktop/interface/chandra/desktop/theme",
"chandra/desktop/interface/chandra/desktop/types",
"moonbitlang/core/debug",
}
// Values
pub let density_choices : Array[String]
pub let frame_ms : UInt32
pub let motion_choices : Array[String]
pub let speed_choices : Array[String]
pub let state : Field
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) struct ConfigEntry {
key : String
label : String
choices : Array[String]
value : String
}
pub(all) struct Field {
stars : Array[Star]
mut seed : UInt32
mut speed : String
mut density : String
mut motion : String
mut boost : Double
mut pulse : Double
mut cx : Double
mut cy : Double
mut tx : Double
mut ty : Double
mut w : Int32
mut h : Int32
mut last : Int32
mut frames : Int32
}
pub fn Field::animating(Self) -> Bool
pub fn Field::config_items(Self) -> Array[ConfigEntry]
pub fn Field::handle(Self, @types.InputEvent) -> Bool
pub fn Field::new() -> Self
pub fn Field::render(Self, @types.Size, @theme.Tokens) -> Array[@types.DrawOp]
pub fn Field::scroll(Self, Int32) -> Bool
pub fn Field::set_config(Self, String, String) -> Bool
pub fn Field::step(Self, Double) -> Unit
pub fn Field::tick(Self, UInt32) -> UInt32
type Star
// Type aliases
// Traits