id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_2400 | rust_dataset.txt | 2,400 | 512 | (SessionPreview {
first_prompt: s
.messages
.iter()
.find(|(r, _)| *r == Role::User)
.map(|(_, t)| (*t).to_owned()),
last_assistant: s
.messages
.iter()
.rev()
.find(|(... |
rust_dataset_chunk_2401 | rust_dataset.txt | 2,401 | 512 | ,
})
}
async fn analyse(&self, session: &HarnessSession) -> eyre::Result<Option<Analysis>> {
let Some(rows) = self.synced.get(session) else {
return Ok(None);
};
let db = AiSessionDatabase::in_memory().await?;
for row in rows {
db.append(row).awai... |
rust_dataset_chunk_2402 | rust_dataset.txt | 2,402 | 512 | = native {
target = target.with_native_path(native);
}
let mut plan = harness.resume(&target, None)?;
// `ResumePlan::prepare`, against the fake filesystem.
if plan.cwd.as_ref().is_some_and(|c| self.missing.contains(c)) {
if plan.cwd_requirement == CwdRequirement... |
rust_dataset_chunk_2403 | rust_dataset.txt | 2,403 | 512 | ored the thread from sync".to_owned(),
})
}
/// Every other harness is installed. A session of a harness atuin doesn't know can't be
/// continued anywhere.
fn continue_targets(&self, session: &SessionRow) -> Vec<HarnessKind> {
if session.handle.harness.harness().is_none() {
... |
rust_dataset_chunk_2404 | rust_dataset.txt | 2,404 | 512 | _string(),
plan: self.plan_for(&row, Some(native))?,
note: None,
})
}
/// Plans resuming the copy as switched, writing nothing.
async fn switch(
&self,
_source: &dyn SessionSource,
session: &SessionRow,
head: Option<&SourceId>,
) -> Result... |
rust_dataset_chunk_2405 | rust_dataset.txt | 2,405 | 512 | ) {
self.bindings.insert(key, Binding {
action,
when_input_empty: None,
});
}
/// Bind `key` to `empty` while the query is empty, and to `action` otherwise.
fn bind_when_input_empty(&mut self, key: KeyInput, empty: Action, action: Action) {
self.bindings.inse... |
rust_dataset_chunk_2406 | rust_dataset.txt | 2,406 | 512 | .
Copy,
/// Ask where to resume the selected session, forking it selected.
Fork,
ReturnOriginal,
Exit,
Redraw,
CycleFilterMode,
/// Cycle the query's agent token (`agent:`) through the agents.
CycleAgent,
ToggleTab,
/// Inspect: expand the list of grouped sessions and move in... |
rust_dataset_chunk_2407 | rust_dataset.txt | 2,407 | 512 | Fork);
km.bind(key("up"), Action::SelectPrevious);
km.bind(key("down"), Action::SelectNext);
km.bind(key("pageup"), Action::ScrollPageUp);
km.bind(key("pagedown"), Action::ScrollPageDown);
// The preview scrolls with shift (or alt) on the keys that move the selection. Neither is
// bound in the ... |
rust_dataset_chunk_2408 | rust_dataset.txt | 2,408 | 512 | DeleteCharAfter);
km.bind(key("ctrl-delete"), Action::DeleteWordAfter);
km.bind(key("alt-d"), Action::DeleteWordAfter);
km.bind_when_input_empty(key("ctrl-d"), Action::ReturnOriginal, Action::DeleteCharAfter);
km.bind(key("ctrl-w"), Action::DeleteToWordBoundary);
km.bind(key("ctrl-u"), Action::Clear... |
rust_dataset_chunk_2409 | rust_dataset.txt | 2,409 | 512 | G"), Action::ScrollToBottom);
km.bind(key("g g"), Action::ScrollToTop);
km
}
pub fn vim_insert() -> Keymap {
let mut km = emacs();
km.bind(key("esc"), Action::VimEnterNormal);
km.bind(key("ctrl-["), Action::VimEnterNormal);
km
}
/// The Inspect tab has no text input: esc goes back to the list... |
rust_dataset_chunk_2410 | rust_dataset.txt | 2,410 | 512 | ctrl-t cycles the agent in every mode, Inspect and vim's both modes included, and is the
/// only key that does; alt-a and alt-h no longer do anything.
#[rstest]
#[case(KeymapMode::Emacs)]
#[case(KeymapMode::VimNormal)]
#[case(KeymapMode::VimInsert)]
fn ctrl_t_cycles_the_agent_everywhere(#[case... |
rust_dataset_chunk_2411 | rust_dataset.txt | 2,411 | 512 | /// alt-enter no longer does anything.
#[rstest]
fn fork_keys_are_free_and_shared() {
let settings = Settings::utc();
let modes = [emacs(), vim_normal(), vim_insert()];
for km in modes.iter().chain([&inspector(&settings)]) {
assert_eq!(resolve(km, "ctrl-x"), Some(Action::... |
rust_dataset_chunk_2412 | rust_dataset.txt | 2,412 | 512 | agents, so it is rendered (calmly, in the theme's colours) rather
//! than shown raw.
//!
//! [`render`] turns markdown into ratatui lines already wrapped to a width (callers must not wrap
//! them again) and cut to a line budget with a trailing `…`. [`render_flat`] squeezes the same
//! rendering into one line, for t... |
rust_dataset_chunk_2413 | rust_dataset.txt | 2,413 | 512 | ,
/// A blank line between blocks. The preview strip packs them instead.
pub spacing: bool,
/// Link targets after their text, when they differ from it.
pub urls: bool,
}
/// `source` rendered as markdown, wrapped to `opts.width` and cut to `opts.max_lines`, with the
/// `highlights` (byte ranges into ... |
rust_dataset_chunk_2414 | rust_dataset.txt | 2,414 | 512 |
/// through it, and whether there are more. Unlike [`render`], the last line isn't cut short with
/// a `…`: rendering more lines later only adds lines after these, so a view can ask for more as
/// it scrolls without what it shows moving.
pub fn render_window(
source: &str,
highlights: &[Range<usize>],
op... |
rust_dataset_chunk_2415 | rust_dataset.txt | 2,415 | 512 | 2) + 1024;
let (at, _) = source.match_indices('\n').nth(min_lines)?;
let from = at.max(min_bytes);
let blank = from + source.get(from..)?.find("\n\n")?;
Some(&source[..=blank])
}
/// Plain (not markdown) `spans` word-wrapped to `width`, in at most `max_lines` lines (0 for no
/// limit), the last ending... |
rust_dataset_chunk_2416 | rust_dataset.txt | 2,416 | 512 | ]).is_empty());
while lines.len() > 1 && lines.last().is_some_and(blank) {
lines.pop();
}
if let Some(last) = lines.last_mut() {
ellipsize(last, width, muted);
}
}
/// Share `budget` lines between parts that want `wants` lines each: a line each in turn, so every
/// part gets its first ... |
rust_dataset_chunk_2417 | rust_dataset.txt | 2,417 | 512 | const { RefCell::new(Vec::new()) };
}
fn cached(
source: &str,
highlights: &[Range<usize>],
opts: Opts,
mode: Mode,
styles: &Styles,
make: impl FnOnce() -> Vec<Line<'static>>,
) -> Rc<Vec<Line<'static>>> {
CACHE.with_borrow_mut(|cache| {
if let Some(at) =
cache.iter().p... |
rust_dataset_chunk_2418 | rust_dataset.txt | 2,418 | 512 | <'static>>,
/// A blank line to put before the next line, if another comes.
blank: Option<Line<'static>>,
/// More lines than wanted have been made; stop.
full: bool,
}
const BULLETS: [&str; 2] = ["•", "◦"];
impl<'a> Renderer<'a> {
fn new(
source: &'a str,
highlights: &'a [Range<us... |
rust_dataset_chunk_2419 | rust_dataset.txt | 2,419 | 512 | TaskListMarker(done) => {
self.push(
if done {
"[x] "
} else {
"[ ] "
},
self.styles.muted,
);
}
}
... |
rust_dataset_chunk_2420 | rust_dataset.txt | 2,420 | 512 | _modifier(Modifier::BOLD)),
Tag::Strikethrough => self.push_style(|s| s.add_modifier(Modifier::CROSSED_OUT)),
Tag::Link { dest_url, .. } => {
self.push_style(|s| s.add_modifier(Modifier::UNDERLINED));
self.link = Some((dest_url.into_string(), String::new()));
... |
rust_dataset_chunk_2421 | rust_dataset.txt | 2,421 | 512 | ::Strikethrough
| TagEnd::Superscript
| TagEnd::Subscript => self.pop_style(),
TagEnd::Link => {
self.pop_style();
if let Some((url, text)) = self.link.take()
&& self.opts.urls
&& !url.is_empty()
... |
rust_dataset_chunk_2422 | rust_dataset.txt | 2,422 | 512 | let g = if g == "\t" {
" "
} else if g == "\r" {
continue;
} else if g.chars().any(char::is_control) {
"\u{FFFD}"
} else if g.width() == 0 {
continue;
} else {
g
};
... |
rust_dataset_chunk_2423 | rust_dataset.txt | 2,423 | 512 | "));
}
self.emit_block(&first, &rest, &block, !self.code);
}
fn emit_block(
&mut self,
first: &[Span<'static>],
rest: &[Span<'static>],
block: &[Vec<Span<'static>>],
wrapped: bool,
) {
if self.flat {
let mut line = Vec::new();
... |
rust_dataset_chunk_2424 | rust_dataset.txt | 2,424 | 512 | repeat(quoted);
self.blank =
Some(Line::from(Span::styled(gutter.trim_end().to_owned(), self.styles.muted)));
}
/// A table as an aligned grid, or row by row when the columns don't fit.
fn table_lines(&mut self, table: &Table) {
let (first, rest) = self.prefixes();
let c... |
rust_dataset_chunk_2425 | rust_dataset.txt | 2,425 | 512 | sum::<usize>() <= budget;
let (mut lo, mut hi) = (3, natural.iter().copied().max().unwrap_or(3).max(3));
while lo < hi {
let mid = (lo + hi).div_ceil(2);
if fits(mid) {
lo = mid;
} else {
hi = mid - 1;
}
}
le... |
rust_dataset_chunk_2426 | rust_dataset.txt | 2,426 | 512 | , self.styles.muted);
}
self.out
}
/// Everything on one line, whitespace collapsed, cut to the width.
fn finish_flat(self) -> Line<'static> {
let mut spans: Vec<Span<'static>> = Vec::new();
let mut space = true;
for span in self.out.iter().flat_map(|l| l.spans.iter(... |
rust_dataset_chunk_2427 | rust_dataset.txt | 2,427 | 512 | (base) - base;
let end = r.end.min(base + text.len()).saturating_sub(base);
(start < end).then_some(start..end)
})
.collect()
}
None => overlapping
.into_iter()
.filter_map(|r| source.get(r.start.max(range.st... |
rust_dataset_chunk_2428 | rust_dataset.txt | 2,428 | 512 | ellipsize(line: &mut Line<'static>, width: usize, muted: Style) {
if width == 0 || line.spans.last().is_some_and(|s| s.content.ends_with('…')) {
return;
}
let mut spans = cut(&line.spans, width - 1);
while let Some(last) = spans.last_mut() {
let trimmed = last.content.trim_end().len();
... |
rust_dataset_chunk_2429 | rust_dataset.txt | 2,429 | 512 | static>], cells: &[Cell<'_>]| {
let mut spans = prefix.to_vec();
let mut body = Vec::new();
for c in cells {
push_merged(&mut body, c.g, c.style);
}
spans.extend(body);
Line::from(spans)
};
let mut prefix = first.as_slice();
let mut on_first = tru... |
rust_dataset_chunk_2430 | rust_dataset.txt | 2,430 | 512 | if is_space(&cell) {
continue;
}
if cur_width + cell.width > avail {
// A word as wide as the line: break it here.
if !cur.is_empty() {
if !emit(line_of(prefix, &cur)) {
return;
}
emitted = tr... |
rust_dataset_chunk_2431 | rust_dataset.txt | 2,431 | 512 | s| s.style == style)
.map(|s| s.content.to_string())
.collect()
}
fn highlighted(lines: &[Line<'_>]) -> Vec<String> {
lines
.iter()
.flat_map(|l| l.spans.iter())
.filter(|s| s.style.fg == Some(Color::Yellow))
.map(|s| s.content.to_... |
rust_dataset_chunk_2432 | rust_dataset.txt | 2,432 | 512 | n }\n\nDone.");
assert_eq!(styled(&lines, styles().code)[0], "fn main() {");
}
#[rstest]
fn unterminated_fences_run_to_the_end() {
assert_eq!(plain(&md("text\n```\ncode\n more", 20, 0)), "text\n\n code\n more");
}
#[rstest]
fn quotes_get_a_gutter() {
assert_eq!(
... |
rust_dataset_chunk_2433 | rust_dataset.txt | 2,433 | 512 | │ \
ok\natuin-cl… │ 97 │ a much l…"
);
// Too narrow for a grid: row by row.
assert_eq!(
plain(&md(source, 12, 0)),
"Crate │\nTests │\nNotes\natuin-ai │\n412 │ ok\natuin-client\n│ 97 │ a\nmuch \
longer\nnote"
);
}
#[rstest... |
rust_dataset_chunk_2434 | rust_dataset.txt | 2,434 | 512 | n\n\n\n```\n```\n\npara\n\n\n";
assert_eq!(plain(&md(source, 40, 0)), "para\n\n────────────────────────\n\npara");
let packed = Opts {
spacing: false,
..opts(40, 0)
};
assert_eq!(plain(&render("a\n\n\nb\n\n# c", &[], packed, &styles())), "a\nb\nc");
}
///... |
rust_dataset_chunk_2435 | rust_dataset.txt | 2,435 | 512 | sync` again", "sync", &["sync"])]
#[case::code_block("x\n\n```\nlet sync = 1;\n```", "sync", &["sync"])]
#[case::list_item("- one\n- fix sync\n", "sync", &["sync"])]
#[case::heading("# Sync notes", "Sync", &["Sync"])]
#[case::link_text("see [sync docs](https://x.y/sync)", "sync", &["sync"])]
#[case... |
rust_dataset_chunk_2436 | rust_dataset.txt | 2,436 | 512 | ai")];
let lines = wrap_plain(&spans, 14, 2, styles().muted);
assert_eq!(plain(&lines), "an interactive\nresume picker…");
}
/// A window's lines are the start of any longer one, with nothing cut short, so a view that
/// scrolls on renders more without what it shows moving.
#[rstest]
... |
rust_dataset_chunk_2437 | rust_dataset.txt | 2,437 | 512 | (0..200).map(|i| format!("{}- x\n", " ".repeat(i))).collect();
let nested_quotes = format!("{} deep", ">".repeat(500));
let huge_line = "x".repeat(100_000);
let controls = "a\u{1b}[31mred\u{7}\r\n\u{0}b\u{200b}c\u{604}d\te";
for source in [
nested_lists.as_str(),
... |
rust_dataset_chunk_2438 | rust_dataset.txt | 2,438 | 512 | _owned()),
"[a-z ]{1,12}",
"\\PC{1,4}",
any::<char>().prop_map(String::from),
];
prop::collection::vec(piece, 0..40).prop_map(|p| p.concat())
}
proptest! {
#![proptest_config(ProptestConfig::with_cases(128))]
#[rstest]
fn never_panics... |
rust_dataset_chunk_2439 | rust_dataset.txt | 2,439 | 512 | own harness, or continued in another ([`chooser`]).
//!
//! It depends on two seams:
//! - [`SessionSource`] lists, searches, previews and reads sessions;
//! - [`Resumer`] turns a session into a resume command, or says why it can't be resumed.
pub mod catchup;
pub mod chooser;
pub mod clock;
#[cfg(test)]
pub mod fak... |
rust_dataset_chunk_2440 | rust_dataset.txt | 2,440 | 512 | while input waits, so a flood of it still shows.
const MAX_SKIPPED: u32 = 8;
/// How often the picker asks the daemon whether it is rebuilding the threads index.
const REBUILD_PROBE_EVERY: Duration = Duration::from_secs(2);
/// When `atuin threads resume` started, for [`startup`]'s timings.
static STARTED: std::sync:... |
rust_dataset_chunk_2441 | rust_dataset.txt | 2,441 | 512 | _host_id(&ctx.host_id),
})
}
}
/// The checkout `cwd` is in, and its branch. In a linked worktree that's the worktree's own root
/// and `HEAD`, not the main checkout's: the history's workspace ([`in_git_repo`]) resolves a
/// worktree to its main repository, whose directory doesn't contain the worktree's ... |
rust_dataset_chunk_2442 | rust_dataset.txt | 2,442 | 512 | > {
pub settings: &'a Arc<Settings>,
pub theme: &'a Theme,
pub source: Arc<dyn SessionSource>,
pub resumer: Arc<dyn Resumer>,
pub context: ResumeContext,
pub query: String,
/// Overrides `[threads] inline_height` and the top-level `inline_height`.
pub inline_height: Option<u16>,
/// ... |
rust_dataset_chunk_2443 | rust_dataset.txt | 2,443 | 512 | ed.insert((handle.clone(), TRANSCRIPT)) {
requests.send(Request::Transcript(handle.clone()));
}
// Inspect lists the forks; the detail pane and the preview count them. A row with nothing
// grouped under it has none (one with only subagents has none either, which takes asking).
let wants_childre... |
rust_dataset_chunk_2444 | rust_dataset.txt | 2,444 | 512 | e}"), Meaning::AlertError));
}
Err(_) => {}
},
Response::Preview(handle, preview) => {
startup("first preview");
state.apply_preview(handle, preview);
}
Response::Transcript(handle, read) => {
startup("first transcript");
... |
rust_dataset_chunk_2445 | rust_dataset.txt | 2,445 | 512 | }
}
response => apply_response(state, response),
}
let (row, pending) = state.pending.clone()?;
if !state.plans.contains_key(&row.handle) {
return None;
}
resume_original(state, &row, pending, resumer, requests)
}
/// The copy here of session `handle` is caught u... |
rust_dataset_chunk_2446 | rust_dataset.txt | 2,446 | 512 | = state.target().map(|r| r.handle.clone());
let searched = state.filter();
let action = state.handle_input(settings, event);
moved_off_pending(state, before.as_ref());
searched_again(state, &searched, requests);
action
}
/// After an input: when it changed the search (from `before`: the query, so ... |
rust_dataset_chunk_2447 | rust_dataset.txt | 2,447 | 512 | oned() else {
state.pending = Some((row, action));
state.status = Some(("locating the thread…".to_owned(), Meaning::Annotation));
return None;
};
let outcome = match (plan, action) {
(Err(why), _) => {
state.status = Some((format!("can't resume: {why}"), Meaning::Aler... |
rust_dataset_chunk_2448 | rust_dataset.txt | 2,448 | 512 | .continuing.take().is_some() {
requests.send(Request::CancelContinue);
}
}
/// Enter or tab on a session (or ctrl-y, which copies): ask where to resume it (the "Resume in"
/// chooser, when `chooser` is on and another harness is installed to continue it in), or resume
/// it in its own harness. In Inspect ... |
rust_dataset_chunk_2449 | rust_dataset.txt | 2,449 | 512 | says why, dimmed.
state.status = None;
}
}
outcome
}
/// Open the chooser on `row` (the session acted on), and read what continuing it elsewhere
/// would flatten: whether there's anything to fork, and the status line a continuation shows.
fn open_chooser(
state: &mut State,
row: &... |
rust_dataset_chunk_2450 | rust_dataset.txt | 2,450 | 512 | action, requests),
Destination::Switch(branch) => start_switch(state, row, *branch, action, requests),
Destination::Continue(target) => start_continuation(state, row, target, action, requests),
}
None
}
/// Resume the copy here as it is, with `plan`, rather than catch it up: what `action` does... |
rust_dataset_chunk_2451 | rust_dataset.txt | 2,451 | 512 | Option<(Outcome, String)> {
let Continuing { action, .. } =
state.continuing.take_if(|c| c.id == id && c.kind == Writing::Fork)?;
match result {
Ok(forked) => {
let mut status = forked.status();
if let Some(note) = &forked.note {
status.push_str(&format!(... |
rust_dataset_chunk_2452 | rust_dataset.txt | 2,452 | 512 | = match why {
NotResumable::Switch(why) => format!("can't switch: {why}"),
why => format!("can't switch: {why}"),
};
state.status = Some((message, Meaning::AlertError));
None
}
}
}
/// A new session is written, ready to resume with `plan`... |
rust_dataset_chunk_2453 | rust_dataset.txt | 2,453 | 512 | to stay open, saying why. An answer to any but the continuation
/// waited on changes nothing.
fn finish_continuation(
state: &mut State,
id: u64,
result: Result<Continued, NotResumable>,
) -> Option<(Outcome, String)> {
let Continuing { target, action, .. } =
state.continuing.take_if(|c| c.id ... |
rust_dataset_chunk_2454 | rust_dataset.txt | 2,454 | 512 | or it's cancelled. Also returns what to tell the
/// user once it's gone: the status line of a session continued in another harness.
#[allow(clippy::too_many_lines)]
pub async fn run(self) -> Result<(Outcome, Option<String>)> {
let settings = self.settings;
let sessions = &settings.threads;... |
rust_dataset_chunk_2455 | rust_dataset.txt | 2,455 | 512 | state, &requests);
let mut events = terminal::Events::new();
// Ticks keep relative times and live dots current, and refresh the list now and then so
// running sessions move and their previews catch up.
let mut tick = tokio::time::interval(TICK);
tick.set_missed_tick_behavior(... |
rust_dataset_chunk_2456 | rust_dataset.txt | 2,456 | 512 | }
InputAction::Fork => {
ask_fork(&mut state, Pending::Resume, resumer, &requests);
None
}
InputAction::Pick(picked) => {
if let Some(outcom... |
rust_dataset_chunk_2457 | rust_dataset.txt | 2,457 | 512 | state.rebuilding = now;
}
}
response = responses.recv() => {
// The workers are gone (they hold the senders), so nothing more will come:
// leave, rather than wake for `None` again and again.
... |
rust_dataset_chunk_2458 | rust_dataset.txt | 2,458 | 512 | (target_os = "windows", target_os = "macos", target_os = "linux")
))]
fn set_clipboard(s: &str) -> Result<()> {
// Over SSH the system clipboard is the remote machine's, if it has one: the terminal's is
// the one wanted.
if atuin_common::env::var_os("SSH_CONNECTION").is_some() {
return Ok(terminal:... |
rust_dataset_chunk_2459 | rust_dataset.txt | 2,459 | 512 | human(n: u64) -> String {
#[allow(clippy::cast_precision_loss)]
let f = n as f64;
if n >= 1_000_000 {
format!("{:.1}M", f / 1_000_000.0)
} else if n >= 10_000 {
format!("{:.0}k", f / 1_000.0)
} else if n >= 1_000 {
format!("{:.1}k", f / 1_000.0)
} else {
n.to_str... |
rust_dataset_chunk_2460 | rust_dataset.txt | 2,460 | 512 | 1 => Some("1 fork".to_owned()),
n => Some(format!("{n} forks")),
}
}
/// Where a session ran, for its callers to join and style: its repository (or directory), its
/// branch, and its host (`atuin`, `feat/ai-sessions`, `@3f9a12bc`). The branch is left out when
/// detached, and the host when it is this one... |
rust_dataset_chunk_2461 | rust_dataset.txt | 2,461 | 512 | live", style(theme, Meaning::AlertInfo)), sep()]);
} else if is_fork_live(now, row) {
when.extend([
Span::styled("↳● a fork is live", style(theme, Meaning::AlertInfo)),
sep(),
]);
}
when.push(Span::styled(format!("{} messages", row.message... |
rust_dataset_chunk_2462 | rust_dataset.txt | 2,462 | 512 | ,
indent: usize,
limit: usize,
theme: &Theme,
) -> (Vec<Line<'static>>, bool) {
let styles = markdown::Styles::new(theme, style(theme, Meaning::Base));
let heading = style(theme, Meaning::Annotation).add_modifier(Modifier::BOLD);
let opts = markdown::Opts {
... |
rust_dataset_chunk_2463 | rust_dataset.txt | 2,463 | 512 | heading besides its text.
let text_lines = height.saturating_sub(2 * parts.len());
let opts = markdown::Opts {
width: width.saturating_sub(indent),
max_lines: text_lines,
spacing: true,
urls: true,
};
let rendered: Vec<Vec<Line<'static>>> ... |
rust_dataset_chunk_2464 | rust_dataset.txt | 2,464 | 512 | "{prefix}{}",
if last {
" "
} else {
"│ "
}
);
walk(&children[i].handle, children, &deeper, out, seen);
}
}
let mut order = Vec::new();
let mut seen = Vec::new();
w... |
rust_dataset_chunk_2465 | rust_dataset.txt | 2,465 | 512 | ("● ", style(theme, Meaning::AlertInfo))
} else {
(" ", muted)
};
Line::from(vec![
Span::styled(branch, muted),
Span::styled(title, base),
Span::styled(dot, tail_style),
Span::styled(tail... |
rust_dataset_chunk_2466 | rust_dataset.txt | 2,466 | 512 | #[case] want: &str) {
assert_eq!(token_breakdown(&usage).unwrap(), want);
}
fn row() -> SessionRow {
super::super::fake::row(atuin_client::ai_session::HarnessKind::ClaudeCode, "s", "t")
}
#[rstest]
#[case::not_read(None, None)]
#[case::none(Some(0), None)]
#[case::one(Some... |
rust_dataset_chunk_2467 | rust_dataset.txt | 2,467 | 512 | on this git branch.
//!
//! Tokens are whitespace-separated words anywhere in the input. They are parsed out before the
//! rest runs as the full-text query, and rendered as chips in the input box. A leading `\` makes a
//! word literal text (`\b:main`).
use std::ops::Range;
use atuin_client::ai_session::HarnessKind... |
rust_dataset_chunk_2468 | rust_dataset.txt | 2,468 | 512 | Copilot),
"amp" | "am" => Some(HarnessKind::Amp),
"kiro" | "kiro-cli" | "ki" => Some(HarnessKind::Kiro),
"hermes" | "hermes-agent" | "he" => Some(HarnessKind::Hermes),
"vibe" | "mistral-vibe" | "vi" => Some(HarnessKind::Vibe),
_ => None,
}
}
/// The harnesses ctrl-t cycles t... |
rust_dataset_chunk_2469 | rust_dataset.txt | 2,469 | 512 | text = Vec::new();
for (range, word) in words(input) {
if let Some(literal) = word.strip_prefix('\\') {
if !literal.is_empty() {
text.push(literal);
}
continue;
}
let Some((kind, value)) = classify(word) else {
text.push(word)... |
rust_dataset_chunk_2470 | rust_dataset.txt | 2,470 | 512 | ();
let after = input[token.range.end..].trim_start();
match (before.is_empty(), after.is_empty()) {
(true, _) => after.to_owned(),
(_, true) => before.to_owned(),
_ => format!("{before} {after}"),
}
}
(None, Some(rep)) ... |
rust_dataset_chunk_2471 | rust_dataset.txt | 2,471 | 512 | assert_eq!(kinds, vec![TokenKind::Harness, TokenKind::Model, TokenKind::Branch]);
assert_eq!(&input[q.tokens[1].range.clone()], "m:opus");
assert!(q.tokens.iter().all(|t| t.state == TokenState::Valid));
}
#[rstest]
#[case("agent:cc", Some(HarnessKind::ClaudeCode))]
#[case("agent... |
rust_dataset_chunk_2472 | rust_dataset.txt | 2,472 | 512 | q = parse("h:codex bug");
assert!(q.tokens.is_empty());
assert!(q.harness.is_none());
assert_eq!(q.text, "h:codex bug");
}
#[rstest]
fn unknown_harness_is_an_invalid_token_and_ignored() {
let q = parse("agent:vim bug");
assert_eq!(q.tokens[0].state, TokenState::Inva... |
rust_dataset_chunk_2473 | rust_dataset.txt | 2,473 | 512 | k", "agent:amp")]
#[case("agent:amp", "agent:kiro")]
#[case("agent:kiro", "agent:hermes")]
#[case("agent:hermes", "agent:vibe")]
#[case("agent:vibe", "")]
#[case("a agent:vibe b", "a b")]
#[case("flaky agent:vibe", "flaky")]
#[case("agent:codex,pi x", "agent:claude-code x")]
#[case("agen... |
rust_dataset_chunk_2474 | rust_dataset.txt | 2,474 | 512 | Theme};
use ratatui::style::{Modifier, Style};
use ratatui::text::{Line, Span};
use super::render::{Body, harness_style, style};
use super::source::{SessionRow, Transcript, TranscriptEntry, harness_label};
use super::state::{Pane, State};
use super::{markdown, title};
/// What the reader rendered, and for what: rend... |
rust_dataset_chunk_2475 | rust_dataset.txt | 2,475 | 512 | } ×{n}")
} else {
name.clone()
}
})
.collect::<Vec<_>>()
.join(" · ")
}
impl Rendered {
fn new(key: Key, transcript: Arc<Transcript>, first: usize) -> Self {
Self {
key,
transcript,
first,
lines:... |
rust_dataset_chunk_2476 | rust_dataset.txt | 2,476 | 512 | cript.entries;
let entry = entries.get(i)?;
let mut lines = Vec::new();
let Key {
width,
indent,
query,
..
} = &self.key;
let pad = " ".repeat(*indent);
let text_pad = " ".repeat(indent + TEXT_INDENT);
let text_width... |
rust_dataset_chunk_2477 | rust_dataset.txt | 2,477 | 512 | vec![Span::raw(text_pad.clone())];
spans.extend(line.spans);
lines.push(Line::from(spans));
}
Some((lines, start))
}
}
/// An entry's text: none for tool calls.
fn text(entry: &TranscriptEntry) -> Option<&str> {
match entry {
TranscriptEntry::Prompt(t) | Transcr... |
rust_dataset_chunk_2478 | rust_dataset.txt | 2,478 | 512 | marks where it was cut with `…`.
let quoted =
row.matched.as_ref().map(|m| words(m.text.trim_matches('…'))).filter(|m| !m.is_empty());
quoted
.and_then(|m| entries.iter().position(|e| text(e).is_some_and(|t| words(t).contains(&m))))
.or_else(|| {
entries
.ite... |
rust_dataset_chunk_2479 | rust_dataset.txt | 2,479 | 512 | return None;
}
let key = Key {
session: row.handle.clone(),
width,
indent,
query: self.applied_query.clone(),
};
let harness = row.handle.harness;
let scroll = &mut self.scrolls[pane as usize];
let reading = (row... |
rust_dataset_chunk_2480 | rust_dataset.txt | 2,480 | 512 | () < want + 2 * height && rendered.end() < entries {
rendered.push(harness, theme);
}
let len = rendered.lines.len();
let more = rendered.end() < entries;
let offset = want.min(len.saturating_sub(height));
Some(Body {
lines: rendered.lines.iter().skip(off... |
rust_dataset_chunk_2481 | rust_dataset.txt | 2,481 | 512 | uin history ×3 · 🐢 atuin threads read ×2 · mcp__github__create_issue"
);
}
/// A transcript of a prompt (message 0), a run of tool calls (1 and 3, results between),
/// a long reply (5), another prompt (6), and a reply that goes on to call a tool (7).
fn transcript() -> Transcript {
le... |
rust_dataset_chunk_2482 | rust_dataset.txt | 2,482 | 512 | 2
)]
// Neither: the first entry with a word of the query.
#[case::a_word_of_the_query(row(None, None), 0)]
fn the_reader_opens_at_the_match(#[case] row: SessionRow, #[case] want: usize) {
assert_eq!(opening_entry(&transcript(), &row, "fixed clock"), want);
}
}
--- FILE: atuin/crates/atuin... |
rust_dataset_chunk_2483 | rust_dataset.txt | 2,483 | 512 | /// `None` when it isn't, or when nobody can say (the daemon isn't reachable).
async fn rebuilding(&self) -> Option<Rebuilding>;
}
/// Asks the daemon over its socket, without starting it, giving up after [`PROBE_TIMEOUT`].
pub struct DaemonProbe {
settings: Arc<Settings>,
}
impl DaemonProbe {
#[must_... |
rust_dataset_chunk_2484 | rust_dataset.txt | 2,484 | 512 | }
#[rstest]
#[tokio::test]
async fn the_watch_follows_the_rebuild_until_it_ends() {
let script = vec![Some(at(1, 10)), Some(at(1, 10)), Some(at(5, 10)), None];
let mut rx = watch(Arc::new(Scripted(Mutex::new(script))), Duration::from_millis(1));
let mut seen = Vec::new();
... |
rust_dataset_chunk_2485 | rust_dataset.txt | 2,485 | 512 | , input box and styles follow the history search (`atuin search
//! -i`), so the two feel like one tool; its list (two lines a session, grouped by day), its
//! scopes, its reader and its header of keys are its own.
use std::borrow::Cow;
use std::ops::Range;
use std::path::Path;
use atuin_client::ai_session::{Harness... |
rust_dataset_chunk_2486 | rust_dataset.txt | 2,486 | 512 | UiStyle::Full => false,
} {
if settings.auto_hide_height != 0 && area.height <= settings.auto_hide_height {
Compactness::Ultracompact
} else {
Compactness::Compact
}
} else {
Compactness::Full
}
}
pub(super) fn style(theme: &Theme, meaning: Meaning) ... |
rust_dataset_chunk_2487 | rust_dataset.txt | 2,487 | 512 | );
}
if !run.is_empty() {
spans.push(Span::styled(
run,
if run_hl {
hl
} else {
base
},
));
}
spans
}
/// One line of `text` fitted to `width` columns, with the `highlights` (byte ranges into `text`)
/// dra... |
rust_dataset_chunk_2488 | rust_dataset.txt | 2,488 | 512 | .map(|n| n.to_string_lossy().into_owned())
.unwrap_or_default()
}
/// Whether the session itself is running: its own newest message is recent.
pub(super) fn is_live(now: Timestamp, row: &SessionRow) -> bool {
now.saturating_duration_since(row.active_at).as_secs() < LIVE_SECS
}
/// Whether a fork listed b... |
rust_dataset_chunk_2489 | rust_dataset.txt | 2,489 | 512 | Harness,
/// The session title. Expands to fill the row.
Title,
/// The message count, left out when the title would be short of room.
Messages,
}
impl Column {
/// Width in cells. The title expands instead.
fn width(self) -> u16 {
match self {
Self::Time => u16::try_fro... |
rust_dataset_chunk_2490 | rust_dataset.txt | 2,490 | 512 | , shape: RowShape) -> Vec<(Column, u16)> {
let mut cells = shape.columns().to_vec();
// Past the indicator, and a space between cells.
let title_width = |cells: &[Column]| {
let others: u16 = cells.iter().map(|c| c.width()).sum();
let gaps = u16::try_from(cells.len().saturating_sub(1)).unwra... |
rust_dataset_chunk_2491 | rust_dataset.txt | 2,491 | 512 | (`true`) or bottom edge of the border around a row with the chooser open.
Edge(usize, bool),
}
/// The list's lines from the input outward, and where each row's first line is among them.
/// `chooser` is the row the chooser is open under, and how many lines it has.
///
/// Read top to bottom on screen, a day's he... |
rust_dataset_chunk_2492 | rust_dataset.txt | 2,492 | 512 | = vec![ListLine::Title(row)];
if shape.two_line {
row_lines.push(ListLine::Place(row));
}
if let Some((at, n)) = chooser
&& at == row
{
row_lines.insert(0, ListLine::Edge(row, true));
row_lines.extend((0..n)... |
rust_dataset_chunk_2493 | rust_dataset.txt | 2,493 | 512 | if chooser {
total.saturating_sub(1)
} else {
total.saturating_sub(height)
};
let margin = (height.saturating_sub(hi - lo) / 2).min(max_margin);
let mut offset = offset;
if hi + margin > offset + height {
offset = (hi + margin).saturating_sub(... |
rust_dataset_chunk_2494 | rust_dataset.txt | 2,494 | 512 | heading(lines.get(end))))
};
// Too tall to show whole: the row without its heading; then just its title, or the
// chooser's selected line when it's open.
if hi - lo > height {
(lo, hi) = (start, end);
}
if hi - lo > height {
let focus = match sel... |
rust_dataset_chunk_2495 | rust_dataset.txt | 2,495 | 512 | = |offset: usize| {
if self.inverted {
offset
} else {
offset + height - 1
}
};
// The line under `at` on screen.
let under = |at: usize| {
if self.inverted {
at + 1
} else {
... |
rust_dataset_chunk_2496 | rust_dataset.txt | 2,496 | 512 |
} else {
list_area.bottom() - screen_y - 1
};
if blank == Some(k) {
continue;
}
if let Some((at, day_of)) = sticky
&& at == k
{
if let Some(row) = day_of {
let mut... |
rust_dataset_chunk_2497 | rust_dataset.txt | 2,497 | 512 | {
let day = clock::list_day(now, self.rows[row].updated_at, &tz);
self.render_heading(&mut w, &clock::day_heading(now, day, &tz));
}
ListLine::Title(_) => {
state.max_entries += 1;
self.render_row(&mut w, &s... |
rust_dataset_chunk_2498 | rust_dataset.txt | 2,498 | 512 | /// A day's heading: its name, then a rule to the edge.
fn render_heading(&self, w: &mut RowWriter<'_>, day: &str) {
let muted = style(self.theme, Meaning::Annotation);
w.put(" ", Style::default());
w.put(day, style(self.theme, Meaning::Important).add_modifier(Modifier::BOLD));
w... |
rust_dataset_chunk_2499 | rust_dataset.txt | 2,499 | 512 | );
}
/// When `row` was last active: the time of day under a day's heading, else `12m`, `14:02`,
/// `yest 09:40`, … (see [`clock::When::short`]).
fn when(&self, row: &SessionRow) -> String {
// A fork is under its root's day, which may not be its own.
if self.shape.by_day && row.tree.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.