8000 [pull] main from can1357:main by pull[bot] · Pull Request #124 · ericrihm/oh-my-pi · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
696 changes: 687 additions & 9 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"crates/pi-edit",
"crates/pi-iso",
"crates/pi-natives",
"crates/pi-predict",
"crates/pi-shell",
"crates/pi-vcs",
"crates/pi-vfs",
Expand Down Expand Up @@ -224,6 +225,7 @@ pi-diff = { path = "crates/pi-diff" }
pi-edit = { path = "crates/pi-edit" }
pi-iso = { path = "crates/pi-iso" }
pi-shell = { path = "crates/pi-shell" }
pi-predict = { path = "crates/pi-predict" }
pi-voice = { path = "crates/pi-voice" }
pi-walker = { path = "crates/pi-walker" }
pi-vcs = { path = "crates/pi-vcs" }
Expand Down Expand Up @@ -479,6 +481,15 @@ tree-sitter-xml = "0.7"
tree-sitter-yaml = "0.7"
tree-sitter-zig = "1.1"

# ──────────────────────────────────────────────────────────────────────────────
# Machine Learning (pi-predict SmolLM2 engine)
# ──────────────────────────────────────────────────────────────────────────────
# macOS-only (Metal decoder; other targets use pi-predict's own CPU decoder).
# 0.9.x, not 0.10+: later candle-core releases depend unconditionally on
# `tokenizers` with the `onig` C library.
candle-core = "0.9.2"
candle-nn = "0.9.2"

# ──────────────────────────────────────────────────────────────────────────────
# Unsorted (added by `cargo add` - move into a section above)
# ──────────────────────────────────────────────────────────────────────────────
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
CARGO_HOME=/data/cache/cargo \
CARGO_TARGET_DIR=/data/cache/cargo-target \
RUSTUP_HOME=/data/cache/rustup \
PATH=/opt/bun/bin:/usr/local/cargo/bin:/usr/local/bin:/usr/bin:/bin
PATH=/opt/bun/bin:/usr/local/cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/bun-node-fallback-bin

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
Expand All @@ -138,6 +138,14 @@ RUN apt-get update \
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v${BUN_VERSION}" \
&& /opt/bun/bin/bun --version

# `node` → bun, last on PATH (same layout as the oven/bun images) so
# `#!/usr/bin/env node` package bins (oxlint, oxfmt, …) run for every uid.
# Bun's own fallback is a /tmp/bun-node-<hash> dir created 0700 by the first
# user that needs it; the image build runs as root, so it would bake a dir
# no robomp slot user can enter.
RUN mkdir -p /usr/local/bun-node-fallback-bin \
&& ln -s /opt/bun/bin/bun /usr/local/bun-node-fallback-bin/node

# Rustup launcher only — the real toolchain is fetche 10BC8 d lazily into RUSTUP_HOME
# on first cargo invocation, driven by pi's `rust-toolchain.toml`. Keeps the
# image small while sharing the toolchain across reboots when /data is mounted.
Expand Down
1,112 changes: 866 additions & 246 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/pi-natives/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ rust_shared_library(
"//crates/pi-diff",
"//crates/pi-edit",
"//crates/pi-iso",
"//crates/pi-predict",
"//crates/pi-shell",
"//crates/pi-vcs",
"//crates/pi-vfs",
Expand Down
3 changes: 2 additions & 1 deletion crates/pi-natives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pi-ast.workspace = true
pi-diff.workspace = true
pi-edit.workspace = true
pi-iso.workspace = true
pi-predict.workspace = true
pi-shell.workspace = true
pi-vfs.workspace = true
pi-voice.workspace = true
Expand Down Expand Up @@ -105,7 +106,7 @@ objc2-core-foundation = "=0.3.2"
libc.workspace = true

[target.'cfg(windows)'.dependencies]
windows-sys = { workspace = true, features = ["Wdk_Storage_FileSystem", "Win32_Foundation", "Win32_Graphics_Gdi", "Win32_Security", "Win32_System_Power", "Win32_System_Registry", "Win32_System_Threading", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] }
windows-sys = { workspace = true, features = ["Wdk_Storage_FileSystem", "Win32_Foundation", "Win32_Graphics_Gdi", "Win32_Security", "Win32_System_Power", "Win32_System_Registry", "Win32_System_Threading", "Win32_UI_HiDpi", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] }
clipboard-win.workspace = true
enigo = { version = "=0.6.1", default-features = false }
uiautomation = "=0.25.1"
Expand Down
10BC8
4 changes: 4 additions & 0 deletions crates/pi-natives/src/desktop/ax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ mod tests {
Ok(AxHandle::Test(1))
}

fn window_id(&mut self, _: &AxHandle, _: &[DesktopWindow]) -> CoreResult<String> {
unreachable!("window ownership is not exercised by tree traversal tests")
}

fn props(&mut self, h: &AxHandle) -> CoreResult<AxProps> {
let AxHandle::Test(id) = h else {
unreachable!()
Expand Down
25 changes: 11 additions & 14 deletions crates/pi-natives/src/desktop/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ use super::{
types::{CaptureCaps, DesktopCapabilities, DesktopDisplay, DesktopWindow, Target},
};

/// How window-targeted input reaches its target.
///
/// `Background` never activates, raises, or moves the user's pointer and
/// refuses with `BackgroundUnavailable` when it cannot target the event
/// safely. `Foreground` is the explicit `takeover: true` escalation: it
/// activates the target, posts real input, then restores focus and pointer.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum DeliveryMode {
#[default]
Expand All @@ -16,8 +22,8 @@ pub enum DeliveryMode {
}

impl DeliveryMode {
pub(crate) fn parse(value: Option<&str>) -> Self {
if value.is_some_and(|value| value.trim().eq_ignore_ascii_case("foreground")) {
pub(crate) const fn from_takeover(takeover: Option<bool>) -> Self {
if matches!(takeover, Some(true)) {
Self::Foreground
} else {
Self::Background
Expand Down Expand Up @@ -104,6 +110,9 @@ pub trait Backend: Send {

pub trait AxBackend {
fn window_root(&mut self, win: &DesktopWindow) -> CoreResult<AxHandle>;
/// Resolves an element's owning top-level window for coordinate input.
/// Refuses missing or ambiguous ownership instead of hit-testing unrelated windows.
fn window_id(&mut self, h: &AxHandle, windows: &[DesktopWindow]) -> CoreResult<String>;
fn props(&mut self, h: &AxHandle) -> CoreResult<AxProps>;
fn children(&mut self, h: &AxHandle) -> CoreResult<Vec<AxHandle>>;
fn parent(&mut self, h: &AxHandle) -> CoreResult<Option<AxHandle>>;
Expand All @@ -114,15 +123,3 @@ pub trait AxBackend {
fn focused_element(&mut self) -> CoreResult<Option<AxHandle>>;
fn attributes(&mut self, h: &AxHandle) -> CoreResu C32A lt<Vec<(String, String)>>;
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn delivery_only_escalates_explicit_foreground() {
assert_eq!(DeliveryMode::parse(None), DeliveryMode::Background);
assert_eq!(DeliveryMode::parse(Some("garbage")), DeliveryMode::Background);
assert_eq!(DeliveryMode::parse(Some(" FoReGrOuNd ")), DeliveryMode::Foreground);
}
}
1 change: 0 additions & 1 deletion crates/pi-natives/src/desktop/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ impl DesktopError {
Self { code, message: message.into() }
}

#[cfg_attr(windows, allow(dead_code, reason = "used by unix desktop backends"))]
pub(crate) fn permission_denied(message: impl Into<String>) -> Self {
Self::new(ErrorCode::PermissionDenied, message)
}
Expand Down
Loading
Loading
0