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
4 changes: 2 additions & 2 deletions assets/providers/NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Checked 2026-11-18 against each upstream; where the source says "official artwor
| grok.svg | Grok | The glyph (two paths) of the app icon https://grok.com/images/favicon.svg, cropped and rescaled to 24x24 without its tile, blur and shadow. Official artwork | No open licence found; xAI's trademark. Shown to identify the agent |
| antigravity.svg | Antigravity | The arch of the favicon https://antigravity.google/favicon.svg, rescaled to 24x24 with its gradient and glow dropped (one tint). Official artwork | No open licence found; Google's trademark. Shown to identify the agent |
| omp.svg | Oh My Pi | `assets/icon.svg` of https://github.com/can1357/oh-my-pi (a pi sign with a plug), redrawn as one path in one tint: the plug is a separate block under the right leg, where the original overlaps it in another colour | MIT (the repository, Copyright Mario Zechner and Can Bölük) |
| codex.svg | Codex | **Drawn for Backplane**: a terminal prompt (a chevron and an underscore) | Backplane's own. Not OpenAI's mark |
| codex.svg | Codex | OpenAI's blossom mark (`viewBox="0 0 256 260"`, single path) | OpenAI's trademark. Shown to identify the agent |

## What is not an official mark

- **Codex:** the `openai/codex` repository (Apache-2.0) ships no product mark: its only SVGs are skill icons (`openai-small.svg` is the OpenAI Docs skill's book), and OpenAI's blossom is not in simple-icons any more. Rather than borrow another OpenAI product's art, the row uses the prompt glyph above, which says "command-line agent". Swap in OpenAI's mark if OpenAI's brand terms are accepted for it.
- **Codex:** OpenAI's blossom mark is used as above (nominative identification of the Codex agent), as `openai/codex` ships no separate product mark.
- **Muse Code:** the Meta AI orbit, as above. There is no Muse Code mark to use.

## Terms
Expand Down
2 changes: 1 addition & 1 deletion assets/providers/codex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/PHONE-DATA.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ Thread = {id, project, title, state, updatedAt, pinned, pinOrder, settled, sett
pinOrder = where a pinned thread stands on its project's Pinned shelf (0 first: the order the pins were made, or a drag's), so a phone lists pins as the desktop does; 0 when not pinned
mark? = {name, short, away, label, runs}: the machine the thread runs on when it is another one (see One project across machines); absent for this hub's
state ∈ "idle" | "working" | "asking" | "failed"; preview ≤ 140 chars; waiting = open asks
Entry = {id, kind, text, at, clientId?, live?, agentOnly?, tool?, ask?, replyTo?}
Entry = {id, kind, text, at, clientId?, live?, agentOnly?, tool?, ask?, replyTo?, refs?}
kind ∈ "user" | "assistant" | "tool" | "ask" | "note" | "step"
replyTo: {id, quote} on the person's reply to a message (the desktop's Reply): `text` is what they wrote, `quote` the first line of the
message answered. Draw "↩ In reply to: <quote>" (`gpui.b.in.reply.to`) over the bubble; a tap goes to `id` (read older pages until held).
refs: [{word, kind, id, label}] optional resolved mentions in a user message (currently resolved `&provider/model` tokens with `kind: "model"`, `id: ""`, concise `label`).
agentOnly: true on a message only the agent reads (the hub's note about a quote it posted): a client does not show it; in a bot's conversation (the uberbot's chat) also
everything the hub hands the bot: launched-thread and task reports, watched work, mailroom/triage input, wake/routine/webhook
prompts, other threads' messages, `[Backplane]` notes and system notes (`present::thread::bot_private`). A launched thread that
Expand Down
53 changes: 45 additions & 8 deletions native/gpui/src/art.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,39 @@ pub(crate) fn parse_d(d: &str) -> Vec<Seg> {
out
}

/// A provider's mark as path segments in its 24x24 viewBox (assets/providers/<provider>.svg, sources in its NOTICE.md), None for a provider without one.
pub fn mark_path(provider: &str) -> Option<&'static [Seg]> {
/// A provider's vector mark: its path segments and SVG `viewBox` (`[min_x, min_y, width, height]`).
pub struct Mark { pub segs: Vec<Seg>, pub vb: [f32; 4] }

fn view_box(svg: &str) -> [f32; 4] {
let Some(v) = attr(svg, "<svg", "viewBox") else { return [0.0, 0.0, 24.0, 24.0] };
let ns: Vec<f32> = v.split(|c: char| c.is_whitespace() || c == ',').filter(|t| !t.is_empty()).filter_map(|t| t.parse().ok()).collect();
if ns.len() == 4 && ns[2] > 0.0 && ns[3] > 0.0 { [ns[0], ns[1], ns[2], ns[3]] } else { [0.0, 0.0, 24.0, 24.0] }
}

/// A provider's mark (segments + `viewBox`, from `assets/providers/<provider>.svg`, sources in its NOTICE.md), None for a provider without one.
pub fn mark_info(provider: &str) -> Option<&'static Mark> {
macro_rules! marks { ($($name:literal),*) => {{
static CELLS: [std::sync::OnceLock<Vec<Seg>>; marks!(@n $($name),*)] = [const { std::sync::OnceLock::new() }; marks!(@n $($name),*)];
static CELLS: [std::sync::OnceLock<Mark>; marks!(@n $($name),*)] = [const { std::sync::OnceLock::new() }; marks!(@n $($name),*)];
let svgs = [$(include_str!(concat!("../../../assets/providers/", $name, ".svg"))),*];
let names = [$($name),*];
let i = names.iter().position(|n| *n == provider)?;
Some(CELLS[i].get_or_init(|| parse_d(attr(svgs[i], "<path", "d").unwrap_or(""))).as_slice())
Some(CELLS[i].get_or_init(|| Mark { segs: parse_d(attr(svgs[i], "<path", "d").unwrap_or("")), vb: view_box(svgs[i]) }))
}}; (@n $($name:literal),*) => { [$($name),*].len() } }
marks!("claude", "codex", "grok", "muse", "antigravity", "opencode", "pi", "omp")
}

/// A provider's mark as path segments (`mark_info`), None for a provider without one.
pub fn mark_path(provider: &str) -> Option<&'static [Seg]> { mark_info(provider).map(|m| m.segs.as_slice()) }

/// The mark drawn plain in `color` in a `size` px box (one paint, no repaint loop).
pub fn mark(segs: &'static [Seg], size: f32, color: u32) -> impl IntoElement {
pub fn mark(m: &'static Mark, size: f32, color: u32) -> impl IntoElement {
canvas(|_, _, _| (), move |b: Bounds<Pixels>, _, window: &mut Window, _| {
let (o, s) = (b.origin, size / 24.0);
let mut pb = PathBuilder::fill();
trace(&mut pb, segs, 1.0, |x, y| point(o.x + px(x * s), o.y + px(y * s)));
let [vx, vy, vw, vh] = m.vb;
let s = size / vw.max(vh).max(1.0);
let (ox, oy) = ((size - vw * s) * 0.5 - vx * s, (size - vh * s) * 0.5 - vy * s);
let o = b.origin;
let mut pb = PathBuilder::fill().with_style(PathStyle::Fill(FillOptions::default().with_tolerance(0.02)));
trace(&mut pb, &m.segs, s, |x, y| point(o.x + px(ox + x * s), o.y + px(oy + y * s)));
if let Ok(path) = pb.build() { window.paint_path(path, rgb(color)); }
}).size(px(size)).flex_shrink_0()
}
Expand Down Expand Up @@ -478,3 +494,24 @@ mod cjk_font_tests {
#[cfg(target_os = "linux")] assert_eq!(super::CJK_FACES.len(), 2, "the Linux client compiles both faces in");
}
}

#[cfg(test)]
mod provider_mark_tests {
use super::*;
use core::prelude::v1::test;
#[test] fn codex_uses_openai_viewbox_and_all_provider_marks_build_paths() {
let codex = mark_info("codex").expect("codex mark");
assert_eq!(codex.vb, [0.0, 0.0, 256.0, 260.0]);
assert!(codex.segs.iter().any(|s| matches!(s, Seg::A(..))), "codex mark includes arc segments");
for p in ["claude", "codex", "grok", "muse", "antigravity", "opencode", "pi", "omp"] {
let m = mark_info(p).unwrap_or_else(|| panic!("missing mark {p}"));
assert!(!m.segs.is_empty(), "{p} has segments");
let [vx, vy, vw, vh] = m.vb;
let s = 16.0 / vw.max(vh).max(1.0);
let (ox, oy) = ((16.0 - vw * s) * 0.5 - vx * s, (16.0 - vh * s) * 0.5 - vy * s);
let mut pb = PathBuilder::fill().with_style(PathStyle::Fill(FillOptions::default().with_tolerance(0.02)));
trace(&mut pb, &m.segs, s, |x, y| point(px(ox + x * s), px(oy + y * s)));
assert!(pb.build().is_ok(), "{p} tessellates cleanly");
}
}
}
69 changes: 66 additions & 3 deletions native/gpui/src/screens/md.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,67 @@ fn design_word(rest: &str) -> bool {
}
/// Where the whole words of `words` sit in `s`, as byte ranges in order: a word starts after a space or an opening bracket or quote, and ends at the end, a space or punctuation.
pub fn word_ranges(s: &str, words: &[String]) -> Vec<(usize, usize)> {
let opens = |c: char| c.is_whitespace() || matches!(c, '(' | '[' | '"' | '\'');
let opens = |c: char| c.is_whitespace() || matches!(c, '(' | '[' | '"' | '\'' | '`');
let mut out: Vec<(usize, usize)> = vec![]; let mut at = 0;
while at < s.len() {
let hit = words.iter().filter(|w| !w.is_empty()).filter_map(|w| { let mut from = at;
while let Some(i) = s[from..].find(w.as_str()) { let i = from + i; let end = i + w.len();
let before = i == 0 || s[..i].ends_with(opens);
let after = s[end..].chars().next().map_or(true, |c| !(c.is_alphanumeric() || matches!(c, '-' | '_' | '/' | ':' | '+')) && !(c == '.' && s[end + 1..].chars().next().map_or(false, |d| d.is_alphanumeric())));
if before && after { return Some((i, end)) } from = i + 1; }
let after = s[end..].chars().next().map_or(true, |c| {
!(c.is_alphanumeric() || matches!(c, '-' | '_' | '/' | '+' | '['))
&& !(c == '.' && s[end + c.len_utf8()..].chars().next().map_or(false, |d| d.is_alphanumeric()))
&& !(c == ':' && s[end + c.len_utf8()..].chars().next().map_or(false, |d| d.is_alphanumeric() || matches!(d, '-' | '_' | '/')))
});
if before && after { return Some((i, end)) } from = i + s[i..].chars().next().map_or(1, char::len_utf8); }
None }).min_by_key(|(i, e)| (*i, std::cmp::Reverse(*e)));
match hit { Some((i, e)) => { out.push((i, e)); at = e; } None => break }
}
out
}

#[derive(Clone, Debug, PartialEq)]
pub struct ModelChip { pub word: String, pub label: String }

#[derive(Clone, Debug, PartialEq)]
pub enum UserSeg { Span(Span), Model(ModelChip) }

/// A person's message cut into styled text runs (`linkify` + `chips` for non-model references) and inline `ModelChip`s for resolved `&provider/model` mentions.
/// Preserves every character of `text` in order (`Span.text` and `ModelChip.word` concatenate to `text`).
pub fn user_segments(text: &str, other_refs: &[String], models: &[ModelChip]) -> Vec<UserSeg> {
let linked = linkify(text);
if models.is_empty() {
return chips(linked, other_refs).into_iter().map(UserSeg::Span).collect();
}
let model_words: Vec<String> = models.iter().map(|m| m.word.clone()).collect();
let mut out = Vec::new();
for s in linked {
if s.style != Style::default() {
out.push(UserSeg::Span(s));
continue;
}
let mut at = 0;
for (i, e) in word_ranges(&s.text, &model_words) {
if i > at {
let pre = vec![Span { text: s.text[at..i].to_string(), style: Style::default() }];
out.extend(chips(pre, other_refs).into_iter().map(UserSeg::Span));
}
let matched = &s.text[i..e];
if let Some(m) = models.iter().find(|m| m.word == matched) {
out.push(UserSeg::Model(m.clone()));
} else {
let fallback = vec![Span { text: matched.to_string(), style: Style::default() }];
out.extend(chips(fallback, other_refs).into_iter().map(UserSeg::Span));
}
at = e;
}
if at < s.text.len() {
let tail = vec![Span { text: s.text[at..].to_string(), style: Style::default() }];
out.extend(chips(tail, other_refs).into_iter().map(UserSeg::Span));
}
}
out
}

/// The reference words of a message (`&claude/opus`, `@bot`...) set apart as chips: each whole word of `words` in a plain span becomes a code-styled span of its own.
pub fn chips(spans: Vec<Span>, words: &[String]) -> Vec<Span> {
if words.is_empty() { return spans }
Expand Down Expand Up @@ -465,5 +512,21 @@ mod link_tests {
assert!(links("x.rs main.c version 1.2 .kicad_pcb").is_empty(), "{:?}", links("x.rs main.c version 1.2 .kicad_pcb"));
}
#[test] fn the_spans_keep_every_character() { let t = "a https://x.io/p, b /tmp/q é"; assert_eq!(linkify(t).iter().map(|s| s.text.as_str()).collect::<String>(), t); }
#[test] fn user_segments_embed_models_inline_and_keep_exact_text() {
let m1 = ModelChip { word: "&antigravity/gemini-4-neon".into(), label: "Gemini 4 Neon".into() };
let m2 = ModelChip { word: "&claude/claude-fable-5-2[1m]".into(), label: "Fable 5.2 (1M)".into() };
let m3 = ModelChip { word: "&claude/opus".into(), label: "Opus".into() };
let m4 = ModelChip { word: "&claude/opus[1m]".into(), label: "Opus (1M)".into() };
let txt = "swarm with &antigravity/gemini-4-neon, &claude/claude-fable-5-2[1m] and &antigravity/gemini-4-neon, plus @bot, &claude/opus[1m], Use &claude/opus: &provider/model, https://x.io?a=1&claude/opus";
let segs = user_segments(txt, &["@bot".into()], &[m1.clone(), m2.clone(), m3.clone(), m4.clone()]);
let reconstructed: String = segs.iter().map(|s| match s { UserSeg::Span(sp) => sp.text.as_str(), UserSeg::Model(m) => m.word.as_str() }).collect();
assert_eq!(reconstructed, txt);
let model_hits: Vec<&str> = segs.iter().filter_map(|s| match s { UserSeg::Model(m) => Some(m.label.as_str()), _ => None }).collect();
assert_eq!(model_hits, ["Gemini 4 Neon", "Fable 5.2 (1M)", "Gemini 4 Neon", "Opus (1M)", "Opus"]);
assert!(segs.iter().any(|s| matches!(s, UserSeg::Span(sp) if sp.text == "@bot" && sp.style.code)));
assert!(segs.iter().any(|s| matches!(s, UserSeg::Span(sp) if sp.text == "https://x.io?a=1&claude/opus" && sp.style.link.is_some())));
let tag_ref = ModelChip { word: "&opencode/llama3".into(), label: "Llama 3".into() };
assert!(!user_segments("try &opencode/llama3:8b", &[], &[tag_ref]).iter().any(|s| matches!(s, UserSeg::Model(_))));
}
}

2 changes: 1 addition & 1 deletion native/gpui/src/screens/picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub fn mark(provider: &str) -> (u32, &'static str) {
pub fn logo(provider: &str) -> AnyElement {
let provider = match bare(provider) { "agy" => "antigravity", p => p };
let (rgb_, letter) = mark(provider);
if let Some(segs) = crate::art::mark_path(provider) { return crate::art::mark(segs, 16., rgb_).into_any_element(); }
if let Some(m) = crate::art::mark_info(provider) { return crate::art::mark(m, 16., rgb_).into_any_element(); }
div().w(px(16.)).h(px(16.)).flex_shrink_0().flex().items_center().justify_center().bg(rgb(rgb_)).text_color(rgb(0xffffff)).text_size(crate::scale::tpx(10.)).font_weight(FontWeight::BOLD).child(letter).into_any_element()
}

Expand Down
Loading
Loading