8000 [pull] main from can1357:main by pull[bot] · Pull Request #138 · 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
Show all changes
64 commits
Select commit Hold shift + click to select a range
29e54b8
fix(coding-agent): continued Cursor turns that end before turnEnded
eggpeat Sep 28, 2026
c0ff807
docs: added changelog entry with PR attribution
eggpeat Sep 29, 2026
d74778f
Merge branch 'main' into fix/cursor-premature-close-recovery
eggpeat Sep 29, 2026
76f7700
Merge branch 'main' into fix/cursor-premature-close-recovery
eggpeat Sep 29, 2026
8b11b0f
feat(tui): show subagent activity and current tool rows in the pinned…
DarkPhilosophy Sep 29, 2026
6ed1135
fix(tui): widen home-path token boundaries, follow current sloppy edi…
DarkPhilosophy Sep 29, 2026
6a65661
docs(tui): changelog for home-path boundary and sloppy preview fixes
DarkPhilosophy Sep 29, 2026
677eef7
feat(tui): opt-in live tool row with elapsed marker and repaint tick
DarkPhilosophy Sep 29, 2026
c823613
docs(changelog): attribute #11210 entries
DarkPhilosophy Sep 29, 2026
05c1146
fix(tui): budget HUD rows to the padded content width so previews nev…
DarkPhilosophy Sep 29, 2026
be69fbe
test(shell): isolate git worktree tests from the developer's git config
sjawhar Sep 29, 2026
781028d
Merge branch 'main' into fix/cursor-premature-close-recovery
eggpeat Sep 29, 2026
36b1236
fix(natives): mark only the key window focused in macOS window lists
will-bogusz Sep 28, 2026
483269f
docs(natives): qualify focused-window changelog entry by Accessibilit…
will-bogusz Sep 28, 2026
aa4ec99
docs: moved changelog entry back to Unreleased after the 18.4.4 release
eggpeat Sep 29, 2026
710865c
Merge remote-tracking branch 'upstream/main' into fix/cursor-prematur…
eggpeat Sep 30, 2026
7cc2d4b
Merge main into feat/subagent-hud-activity
DarkPhilosophy Sep 30, 2026
d1ae4c9
feat(coding-agent): add model presets for saving and switching role s…
abilliontokens Sep 30, 2026
373512c
fix(tui): label the task card and native agent row with each call's o…
DarkPhilosophy Sep 30, 2026
e618c66
fix(task): forward the running call's intent through background task …
DarkPhilosophy Sep 30, 2026
69fc234
fix(coding-agent): resolve alias defaults against the preset, report …
abilliontokens Sep 30, 2026
cf9ee62
fix(coding-agent): resolve presets whole per layer, refuse before wri…
abilliontokens Sep 30, 2026
cfa6581
fix(ai): confine auth-gateway bearer tokens to authorization
shawnkoh Sep 30, 2026
adeb8a9
docs(ai): attribute auth-gateway bearer confinement changelog entry
shawnkoh Sep 30, 2026
b2c2d30
fix(auth-gateway): gate bearer confinement behind authentication
shawnkoh Sep 30, 2026
6a50abc
test(coding-agent): isolate llama.cpp discovery tests from ambient LL…
andrebrait Sep 30, 2026
0b90cfd
docs(models): clarify thinking off on the generic openai dialect
alphastorm Sep 30, 2026
a3e47d3
docs(models): warn that an unset apiKey variable is sent literally
alphastorm Sep 30, 2026
0fd965e
docs(models): note that thinking off sends the first listed effort
alphastorm Sep 30, 2026
dd4a36e
docs(models): state the unset-or-empty rule once in the apiKey bullets
alphastorm Sep 30, 2026
7694c10
fix(ai): decode escape runs independently in auth-gateway bearer conf…
Sep 30, 2026
9532eb3
Merge PR #13827: fix(ai): confine auth-gateway bearer tokens to Autho…
H4vC Sep 30, 2026
fd27d96
fix(coding-agent): apply preset thinking level live, report its owner…
Sep 30, 2026
8f94deb
fix(tui): bound home paths by emphasis only as markdown and shorten k…
Sep 30, 2026
771dfaa
Merge PR #11210: fix(tui): keep concurrent subagent tool calls and se…
H4vC Sep 30, 2026
ea09526
refactor(coding-agent): rename /presets to /modelpreset
Sep 30, 2026
86bb39a
Merge remote-tracking branch 'origin/main' into review-5253
Sep 30, 2026
f517b90
Merge PR #5253: feat(coding-agent): add model presets for saving and …
H4vC Sep 30, 2026
2687b94
Merge PR #13853: test(coding-agent): isolate llama.cpp discovery test…
H4vC Sep 30, 2026
f419120
Merge PR #13796: test(shell): isolate git worktree tests from the dev…
H4vC Sep 30, 2026
863c90f
Merge PR #13867: docs(models): clarify thinking off on the generic op…
H4vC Sep 30, 2026
d903421
Merge PR #13684: fix(coding-agent): continued Cursor turns that end b…
H4vC Sep 30, 2026
6f377a0
Merge PR #13673: fix(natives): stop marking every window of the front…
H4vC Sep 30, 2026
6da14eb
Merge PR #13866: docs(models): warn that an unset apiKey variable is …
H4vC Sep 30, 2026
1218520
fix(task): release parked subagent sessions held by the lifecycle rev…
iliaal Sep 28, 2026
9e44100
docs(changelog): add PR attribution
iliaal Sep 28, 2026
c240614
refactor(task): wire subagent extensions through initializeExtensions
iliaal Sep 28, 2026
aa7c2ed
fix(pi-predict): keep prose scoring aligned across masked multi-byte …
Sep 29, 2026
cab514f
changelog: credit the fix
Sep 29, 2026
78416bf
test(coding-agent): isolate skills tests from the real home via an os…
andrebrait Sep 30, 2026
cd0b47c
test(coding-agent): skip WSL host skills test on Windows hosts
Sep 30, 2026
dfa923e
docs(changelog): place #13624 entry under Unreleased
Sep 30, 2026
cd229af
docs(changelog): place #13758 entry under Unreleased
Sep 30, 2026
913dddb
fix(tui): submit on Enter when slash-command argument is already full…
Sep 30, 2026
612f56c
docs(tui): credit #13885 in changelog
Sep 30, 2026
2b9febb
Merge PR #13624: fix(task): release parked subagent sessions held by …
H4vC Sep 30, 2026
74b282f
Merge PR #13872: test(coding-agent): isolate skills tests from the re…
H4vC Sep 30, 2026
969bd9f
Merge PR #13758: fix(pi-predict): keep prose scoring aligned across m…
H4vC Sep 30, 2026
341e9b7
fix(natives): keep content under unnamed accessibility containers
will-bogusz Sep 30, 2026
9b0d4cd
refactor(natives): let structural() alone decide which containers kee…
will-bogusz Sep 30, 2026
9b1a2f2
docs(changelog): note #13822 ax() fix applies on every platform
Sep 30, 2026
8d111ab
fix(tui): keep Enter accepting subcommands that still require an argu…
Sep 30, 2026
20e3f3b
Merge PR #13822: fix(natives): stop ax() dropping everything inside u…
H4vC Sep 30, 2026
9b98865
Merge PR #13885: fix(tui): submit on Enter when slash-command argumen…
H4vC Sep 30, 2026
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
53 changes: 43 additions & 10 deletions crates/pi-natives/src/desktop/ax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,13 @@ fn interactable(props: &AxProps) -> bool {
| "cell"
)
}
/// Containers that keep their own line even around a single survivor: the role
/// itself tells the model where the child sits (a list, a toolbar, a scroll
/// area).
fn structural(role: &str) -> bool {
matches!(
role,
"window"
| "group"
| "webarea"
| "list"
| "table"
Expand All @@ -236,23 +238,25 @@ fn structural(role: &str) -> bool {
)
}

/// Drops unnamed, inactionable nodes that carry nothing, while keeping every
/// survivor below them: a container with no survivors disappears, one wrapping
/// a single survivor (any role outside [`structural`], `group` included) gives
/// way to it, and one grouping several survivors stays. A container's role
/// never decides whether its content is shown; `AXSplitGroup`, which holds the
/// list and detail panes of Reminders, Contacts and Notes, is on no role list.
fn filter_node(mut node: WalkNode, all: bool) -> Option<WalkNode> {
node.children = node
.children
.into_iter()
.filter_map(|child| filter_node(child, all))
.collect();
if all {
if all || interactable(&node.props) || named(&node.props) {
return Some(node);
}
let keep_self = interactable(&node.props) || named(&node.props);
if !keep_self && node.props.role == "group" && node.children.len() == 1 {
return node.children.pop();
}
if keep_self || (structural(&node.props.role) && !node.children.is_empty()) {
Some(node)
} else {
None
match node.children.len() {
0 => None,
1 if !structural(&node.props.role) => node.children.pop(),
_ => Some(node),
}
}

Expand Down Expand Up @@ -651,6 +655,35 @@ mod tests {
assert_eq!(s.node_count, 2);
}
#[test]
fn unnamed_containers_keep_their_surviving_content() {
// A Reminders-shaped window: an unnamed split group holding a list pane and
// a detail pane, an unnamed splitter, and an empty wrapper.
let mut m = Mock {
props: [
(1, p("window", Some("Title"))),
(2, p("splitgroup", None)),
(3, p("scrollarea", None)),
(4, p("button", Some("Groceries"))),
(5, p("splitter", None)),
(6, p("layoutarea", None)),
(7, p("textfield", Some("Notes"))),
(8, p("group", None)),
]
.into(),
children: [(1, vec![2]), (2, vec![3, 5, 6, 8]), (3, vec![4]), (6, vec![7])].into(),
};
let s =
snapshot(&mut m, &mut AxRegistry::default(), &window(), &AxSnapshotOptions::default())
.unwrap();
assert_eq!(
s.text,
"- window \"Title\" [ref=e1] app=Safari (focused)\n - splitgroup [ref=e2]\n - \
scrollarea [ref=e3]\n - button \"Groceries\" [ref=e4]\n - textfield \"Notes\" \
[ref=e5]"
);
assert_eq!(s.node_count, 5);
}
#[test]
fn description_labels_unnamed_controls_without_changing_raw_title() {
let mut reload = p("button", None);
reload.description = Some("Reload".into());
Expand Down
64 changes: 58 additions & 6 deletions crates/pi-natives/src/desktop/macos/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ use std::{
use image::{DynamicImage, Rgba, RgbaImage, imageops::FilterType};
use xcap::{Monitor, Window};

use super::super::{
error::{CoreResult, DesktopError},
frame::{FrameGeometry, MAX_COMPOSITE_PIXELS},
types::{DesktopDisplay, DesktopWindow, DisplaySelector, Target},
use super::{
super::{
error::{CoreResult, DesktopError},
frame::{FrameGeometry, MAX_COMPOSITE_PIXELS},
types::{DesktopDisplay, DesktopWindow, DisplaySelector, Target},
},
ax,
};
const MAX_LISTED_WINDOWS: usize = 48;
const MIN_WINDOW_EDGE: u32 = 16;
Expand Down Expand Up @@ -109,6 +112,9 @@ impl MacCapture {
})?;
let mut result = Vec::new();
let mut seen = HashSet::new();
// The active application's listed windows, front to back.
let mut active = Vec::new();
let mut active_pid = None;
for window in windows {
if result.len() >= MAX_LISTED_WINDOWS {
break;
Expand All @@ -130,18 +136,32 @@ impl MacCapture {
if title.is_empty() && app.is_empty() {
continue;
}
let pid = window.pid().ok();
// xcap's `is_focused` only says the owner is the active application.
if window.is_focused().unwrap_or(false) {
active.push(id);
active_pid = active_pid.or(pid);
}
result.push(DesktopWindow {
id: id.to_string(),
title,
app,
pid: window.pid().ok(),
pid,
x,
y,
width,
height,
focused: window.is_focused().unwrap_or(false),
focused: false,
});
}
let ax_focused = active_pid
.and_then(|pid| libc::pid_t::try_from(pid).ok())
.and_then(ax::focused_window_id);
if let Some(key) = key_window(&active, ax_focused).map(|id| id.to_string())
&& let Some(window) = result.iter_mut().find(|window| window.id == key)
{
window.focused = true;
}
Ok(result)
}

Expand Down Expand Up @@ -278,6 +298,17 @@ fn scaled_edge(value: u32, scale: f64) -> u32 {
.clamp(0.0, f64::from(u32::MAX)) as u32
}

/// The window holding input focus among the active application's listed
/// windows (front to back): its `AXFocusedWindow`, or the frontmost when
/// accessibility cannot name one (for example without the Accessibility
/// permission). A focused window that was not listed marks nothing.
fn key_window(active: &[u32], ax_focused: Option<u32>) -> Option<u32> {
match ax_focused {
Some(id) => active.contains(&id).then_some(id),
None => active.first().copied(),
}
}

fn run_screencapture(args: &[String]) -> CoreResult<RgbaImage> {
let file = tempfile::Builder::new()
.prefix("omp-computer-")
Expand Down Expand Up @@ -335,3 +366,24 @@ fn run_screencapture(args: &[String]) -> CoreResult<RgbaImage> {
})
.map(DynamicImage::into_rgba8)
}

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

#[test]
fn key_window_is_the_accessibility_focused_window_not_the_frontmost() {
assert_eq!(key_window(&[41, 42, 43], Some(42)), Some(42));
}

#[test]
fn key_window_falls_back_to_the_frontmost_window_without_accessibility() {
assert_eq!(key_window(&[41, 42], None), Some(41));
assert_eq!(key_window(&[], None), None);
}

#[test]
fn key_window_marks_nothing_when_the_focused_window_is_not_listed() {
assert_eq!(key_window(&[41, 42], Some(99)), None);
}
}
2 changes: 1 addition & 1 deletion crates/pi-natives/src/desktop/macos/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ enum KeyboardConflict {
/// Candidates come from the process's accessibility windows, not
/// `WindowServer`'s list, which also holds the per-window compositor surfaces
/// of Chromium, Electron, and `WebKit` apps. `DesktopWindow::focused` cannot
/// disambiguate: it marks every window of the active application.
/// disambiguate: it names only the active application's key window.
fn ensure_sole_keyboard_destination(pid: libc::pid_t, wid: u32) -> CoreResult<()> {
let conflict = ax::window_records(pid)
.map_or(Some(KeyboardConflict::Unmapped), |records| keyboard_conflict(wid, &records));
Expand Down
21 changes: 19 additions & 2 deletions crates/pi-predict/src/prose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,23 @@ pub fn mask_non_prose(text: &str) -> Cow<'_, str> {
/// [`mask_non_prose`]; 0 for blank text.
pub fn prose_fraction(text: &str) -> f64 {
let masked = mask_non_prose(text);
// `mask_non_prose` substitutes masked bytes with spaces, so a masked
// multi-byte character fans out into several spaces and `masked.chars()` no
// longer aligns with `text.char_indices()`; compare per character over byte
// ranges instead.
let masked_bytes = masked.as_bytes();
let mut total = 0usize;
let mut prose = 0usize;
for ((_, c), m) in text.char_indices().zip(masked.chars()) {
for (offset, c) in text.char_indices() {
if is_js_space(c) {
continue;
}
let units = c.len_utf16();
total += units;
if m != ' ' {
let hidden = masked_bytes[offset..offset + c.len_utf8()]
.iter()
.all(|&byte| byte == b' ');
if !hidden {
prose += units;
}
}
Expand Down Expand Up @@ -475,6 +483,15 @@ mod tests {
assert_eq!(words(prompt), ["fix", "the", "call", "then", "it", "ok"]);
}

#[test]
fn prose_fraction_stays_aligned_after_masked_multibyte_spans() {
// A masked multi-byte character fans out into one space per byte, so
// pairing the original's chars with the masked text's chars by index
// misreads every later character; 5 of the 9 UTF-16 units are prose.
let text = "`代码`之后是正文";
assert!((prose_fraction(text) - 5.0 / 9.0).abs() < 1e-9);
}

#[test]
fn masking_preserves_byte_offsets() {
let text = "é `ü` <i>ß</i> done";
Expand Down
33 changes: 31 additions & 2 deletions crates/pi-shell/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,21 @@ mod tests {
}
}

/// Runs `git` reading the same config sources the builtin's gix does: the
/// real global/system files at their default paths (gix ignores
/// `GIT_CONFIG_GLOBAL`/`SYSTEM`/`NOSYSTEM`, ignoring these matches it),
/// and never `GIT_CONFIG_PARAMETERS` (gix does not read it at all).
/// `GIT_CONFIG_COUNT`/`KEY_n`/`VALUE_n` are left alone: gix reads those
/// from the process environment, so the helper must see them too.
#[cfg(unix)]
fn git(dir: &Path, args: &[&str]) -> String {
let output = std::process::Command::new("git")
.args(args)
.current_dir(dir)
.env_remove("GIT_CONFIG_GLOBAL")
.env_remove("GIT_CONFIG_SYSTEM")
.env_remove("GIT_CONFIG_NOSYSTEM")
.env_remove("GIT_CONFIG_PARAMETERS")
.output()
.expect("run git");
assert!(output.status.success(), "git {args:?}: {}", String::from_utf8_lossy(&output.stderr));
Expand All @@ -753,13 +763,27 @@ mod tests {
git(&repo, &["init", "-q", "-b", "main"]);
git(&repo, &["config", "user.name", "t"]);
git(&repo, &["config", "user.email", "t@t"]);
// Pin what a developer's global config would change, locally so the
// builtin's gix reads see it too: signing makes `git commit` and
// `git tag` need a key (and a tag a message), and a global
// `core.hooksPath` would skip the hook below. Absolute, because
// `hook_path` joins a relative one onto the linked worktree's root.
let hooks = repo.join(".git/hooks");
git(&repo, &["config", "commit.gpgSign", "false"]);
git(&repo, &["config", "tag.gpgSign", "false"]);
git(&repo, &["config", "core.hooksPath", &hooks.to_string_lossy()]);
// The builtin hands a form to git when these change worktree or branch
// behavior, so the parity cases below need git's defaults.
git(&repo, &["config", "worktree.useRelativePaths", "false"]);
git(&repo, &["config", "worktree.guessRemote", "false"]);
git(&repo, &["config", "branch.autoSetupMerge", "true"]);
std::fs::write(repo.join(".gitignore"), "cache/\n").expect("write gitignore");
std::fs::write(repo.join("tracked.txt"), "tracked\n").expect("write tracked");
git(&repo, &["add", "."]);
git(&repo, &["commit", "-q", "-m", "first commit"]);
std::fs::create_dir(repo.join("cache")).expect("create cache");
std::fs::write(repo.join("cache/blob"), "warm").expect("write cache");
let hook = repo.join(".git/hooks/post-checkout");
let hook = hooks.join("post-checkout");
std::fs::write(&hook, "#!/bin/sh\necho \"$* $PWD\" > ../hook.log\necho hook-out\n")
.expect("write hook");
std::fs::set_permissions(&hook, std::fs::Permissions::from_mode(0o755)).expect("chmod hook");
Expand All @@ -768,12 +792,17 @@ mod tests {

/// Runs `command` in a one-shot shell, with the builtin enabled through
/// `PI_SMART_GIT` when `smart`.
///
/// The shell exports the test process's environment, where any
/// `GIT_CONFIG*` variable would hand every `git` call to the binary and
/// leave the builtin untested, so the command unsets them first. Setting
/// the process environment instead would race the other tests' threads.
#[cfg(unix)]
async fn run_with(repo: &Path, command: &str, smart: bool) -> (Option<i32>, String) {
let (tx, rx) = flume::unbounded::<String>();
let flag = if smart { "1" } else { "0" };
let options = crate::ShellExecuteOptions {
command: command.to_owned(),
command: format!("unset -v \"${{!GIT_CONFIG@}}\"; {command}"),
cwd: Some(repo.to_string_lossy().into_owned()),
session_env: Some([("PI_SMART_GIT".to_owned(), flag.to_owned())].into()),
..Default::default()
Expand Down
3 changes: 2 additions & 1 deletion docs/auth-broker-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ Capability-dependent responses include `Vary: OMP-Auth-Broker-Capabilities` so i
### CLI

```
omp auth-gateway serve [--bind=host:port] [--no-auth]
omp auth-gateway serve [--bind=host:port] [--no-auth] [--trust-proxy-headers]
omp auth-gateway token [--regenerate] [--json]
omp auth-gateway status [--json]
omp auth-gateway check [--strict] [--json]
```

- `serve` requires `OMP_AUTH_BROKER_URL` (or `auth.broker.url` in `config.yml`) — the gateway is itself a broker client. It calls `AuthBrokerClient.fetchSnapshot()`, wraps it in `RemoteAuthCredentialStore`, and constructs an `AuthStorage` that resolves access tokens through the broker. Default bind is `127.0.0.1:4000`. The gateway token is stored at `<config-dir>/auth-gateway.token` (`0600`); `--no-auth` disables the bearer check entirely (loopback-only use).
- Logs attribute requests to the socket peer address. Behind a trusted reverse proxy, pass `--trust-proxy-headers` to use `X-Forwarded-For` / `X-Real-IP` for authenticated requests; unauthorized requests are always logged with the socket peer. An authenticated request that also carries the gateway token in its URL or in a forwarded, logged, or identity header is rejected with `400` before any credential lookup.
- `token` / `status` manage and inspect the gateway bearer token and upstream broker readiness.
- `check` probes broker-backed credentials through the gateway store. Without `--strict` it uses provider usage probes; `--strict` also exercises each credential against its chat-completion endpoint and can consume a small amount of quota.

Expand Down
Loading
Loading
0