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_2500
rust_dataset.txt
2,500
512
{ w.put( harness_badge(row.handle.harness), harness_style(theme, row.handle.harness), ); } Column::Title => { let (base, hl) = if boxed { let base = style(...
rust_dataset_chunk_2501
rust_dataset.txt
2,501
512
: Option<&'a str>, matched: &mut Option<&Snippet>, ) -> Option<(&'a str, Vec<Range<usize>>)> { let text = text?; let highlights = match *matched { Some(m) if !m.text.is_empty() => text.find(m.text.as_str()).map(|at| { *matched = None; shift(&m.highlights, at) }), ...
rust_dataset_chunk_2502
rust_dataset.txt
2,502
512
(height)); let lines = if offset == 0 { overview() } else { doc.into_iter().skip(offset).take(height).collect() }; Body { lines, offset, len, more, fixed: 0, } } /// A scrollbar in `track` (a border, or a column kept for it) for `body` shown `...
rust_dataset_chunk_2503
rust_dataset.txt
2,503
512
eref()), &mut matched); let last = locate(preview.and_then(|p| p.last_assistant.as_deref()), &mut matched); Some(PreviewParts { loaded: preview.is_some(), first, matched, last, }) } /// The selected session's preview parts as markdown sour...
rust_dataset_chunk_2504
rust_dataset.txt
2,504
512
None` when nothing did, or /// there's no room beside the text (`height` under 2). fn preview_meta(&self, height: usize, theme: &Theme) -> Option<Line<'static>> { if height < 2 { return None; } let row = self.preview_row()?; let forks = panel::forks(self.children.get(...
rust_dataset_chunk_2505
rust_dataset.txt
2,505
512
part, stopping at the first with more (`true`). fn preview_document( sources: &[PreviewSource<'_>], width: usize, limit: usize, theme: &Theme, ) -> (Vec<Line<'static>>, bool) { let opts = markdown::Opts { width: width.saturating_sub(PREVIEW_LABEL_WIDTH), ...
rust_dataset_chunk_2506
rust_dataset.txt
2,506
512
lines.extend(body.lines.iter().cloned()); if !loaded && lines.len() == top { lines.push(Line::from(Span::styled("…", style(theme, Meaning::Annotation)))); } (lines, Some((row.handle.clone(), top, body))) } /// Note how `pane` was drawn: for `session`, in `area` (what...
rust_dataset_chunk_2507
rust_dataset.txt
2,507
512
} } pub fn draw(&mut self, f: &mut Frame, settings: &Settings, theme: &Theme) { self.spinning = false; self.draw_main(f, settings, theme); // A popup only where the list didn't draw it under its row. if self.chooser.is_some() && !(self.tab_index == 0 && self.list.chooser...
rust_dataset_chunk_2508
rust_dataset.txt
2,508
512
let show_help = settings.show_help && (compactness == Compactness::Full || area.height > 1); // No tab row: the header names Inspect while it shows, and lists ctrl-o. let status = self.status_line(); let status_height = u16::from(status.is_some()); let help_h = u16::from(show_help); ...
rust_dataset_chunk_2509
rust_dataset.txt
2,509
512
, header_chunks[1].width.into(), theme); f.render_widget(help, header_chunks[1]); f.render_widget(self.build_stats(theme), header_chunks[2]); if let Some((message, meaning)) = &status { f.render_widget( Paragraph::new(Span::styled( message.clone()...
rust_dataset_chunk_2510
rust_dataset.txt
2,510
512
, divider, pane) = if split { let [list_area, divider, pane] = Layout::horizontal([ Constraint::Fill(3), Constraint::Length(1), Constraint::Fill(2), ]) .areas(inner); (list_area, Some(divider), Some(pane)) } else { ...
rust_dataset_chunk_2511
rust_dataset.txt
2,511
512
(2) / 2, height: list_area.height.min(2), ..list_area }; f.render_widget(self.no_results(theme), middle); } // A scrollbar on the right border (or the divider) once the list overflows. let visible = usize::from(list_area.height); l...
rust_dataset_chunk_2512
rust_dataset.txt
2,512
512
* border_size), }; // Beside the pane (or with no room), the strip is only the box's bottom border. let (lines, scrolled) = if split || strip.height == 0 { (Vec::new(), None) } else { self.strip_lines(usize::from(strip.width), usize::from(strip.height), theme) ...
rust_dataset_chunk_2513
rust_dataset.txt
2,513
512
_or(before_cursor, |cut| before_cursor.min(cut)); let cursor_offset = border_size; f.set_cursor_position(( input_chunk .x .saturating_add(u16::try_from(before_cursor).unwrap_or(u16::MAX)) .saturating_add(cursor_offset), input_chunk....
rust_dataset_chunk_2514
rust_dataset.txt
2,514
512
collapse".to_owned(), 0)); } else { actions.push(("enter", "resume".to_owned(), 0)); edit(&mut actions); actions.push(("ctrl-y", "copy".to_owned(), 3)); let forks = self.target().and_then(|r| self.children.get(&r.handle)); if fo...
rust_dataset_chunk_2515
rust_dataset.txt
2,515
512
_by_key(|(i, (_, _, need))| (*need, *i)) .map(|(i, _)| i) { actions.remove(at); } let actions: Vec<(&str, String)> = actions.into_iter().map(|(k, l, _)| (k, l)).collect(); let mut spans = Vec::new(); for (i, (key, label)) in actions.into_iter().enumera...
rust_dataset_chunk_2516
rust_dataset.txt
2,516
512
= self.parsed_query(); let mut at = 0; for token in &parsed.tokens { if token.range.start > at { spans.push(Span::raw(input[at..token.range.start].to_owned())); } let chip = match (token.state, token.kind) { (TokenState::Invalid, _) =>...
rust_dataset_chunk_2517
rust_dataset.txt
2,517
512
g, all, true)) .or_else(|| gap(with_placeholder, &current).map(|g| (g, current.clone(), true))) .or_else(|| gap(typed, &current).map(|g| (g, current, false))) .or_else(|| { let g = room.checked_sub(typed + width(&bare)).filter(|g| *g >= 1)?; Some((g, b...
rust_dataset_chunk_2518
rust_dataset.txt
2,518
512
place}"), (true, true) => format!("No threads match the filters{place}"), (false, false) => format!("No threads match \"{query}\"{place}"), (false, true) => format!("No threads match \"{query}\" and the filters{place}"), }; let mut hints = Vec::new(); // ctrl-...
rust_dataset_chunk_2519
rust_dataset.txt
2,519
512
.compactness { Compactness::Full if st.invert => Block::default() .borders(Borders::LEFT | Borders::RIGHT) .border_type(BorderType::Rounded) .title(format!("{:─>width$}", "", width = st.inner_width.saturating_sub(2))), Compactness::Full => Block::d...
rust_dataset_chunk_2520
rust_dataset.txt
2,520
512
p.display().to_string()).unwrap_or_default()), ), field("Branch", text(row.branch.clone().unwrap_or_default())), field("Model", text(row.model.clone().unwrap_or_default())), field("Started", text(when(row.started_at))), field("Updated", { let ...
rust_dataset_chunk_2521
rust_dataset.txt
2,521
512
(inner.height); let left = usize::from(inner.height.saturating_sub(top)); let border = u16::from(st.compactness == Compactness::Full); let width = usize::from((inner.width + border).saturating_sub(1)); let body = self.pane_body(Pane::Inspect, &row, width, 1, left, theme); lines.e...
rust_dataset_chunk_2522
rust_dataset.txt
2,522
512
} scroll_body( self.scrolls[pane as usize].offset_for(&row.handle), height, || self.conversation(row, width, height, indent, theme), |limit| self.conversation_document(row, width, indent, limit, theme), ) } /// A conversation's place in a pane wh...
rust_dataset_chunk_2523
rust_dataset.txt
2,523
512
(text.width); let mut lines = self.detail_header(&row, width, tz, theme); lines.push(Line::default()); let top = u16::try_from(lines.len()).unwrap_or(u16::MAX).min(text.height); let left = usize::from(text.height.saturating_sub(top)); // Without its transcript, the conversation i...
rust_dataset_chunk_2524
rust_dataset.txt
2,524
512
::from(width), theme); let room = room.saturating_sub(2); let expanded = self.expanded_children().is_some(); let mut heading = vec![Span::styled(format!(" {heading}"), key.add_modifier(Modifier::BOLD))]; let shown: Vec<Line<'static>> = if let Some(view) = self.ch...
rust_dataset_chunk_2525
rust_dataset.txt
2,525
512
.push(Line::from(heading)); lines.extend(shown); lines } } /// How many children Inspect shows before `… and N more`. const CHILDREN_COLLAPSED: usize = 3; /// The lines Inspect keeps for the conversation while the children list is expanded. const INSPECT_CONVERSATION_MIN: usize = 4; /// A scope's ...
rust_dataset_chunk_2526
rust_dataset.txt
2,526
512
: true, by_day: true, }; /// A quiet root is marked for a running fork beneath it, not for a running subagent (grouped, /// so newest in `updated_at`, but not listed). #[rstest] #[case::subagent(None, false)] #[case::fork(Some(0), true)] #[case::old_fork(Some(1), false)] fn only_...
rust_dataset_chunk_2527
rust_dataset.txt
2,527
512
{ for width in 30..=200u16 { let layout = row_layout(width, shape); let used: u16 = layout.iter().map(|(_, w)| w).sum::<u16>() + u16::try_from(layout.len() - 1).unwrap() + 3; let (_, title) = layout.iter().find(|(c, _)| *c == Title).copied().u...
rust_dataset_chunk_2528
rust_dataset.txt
2,528
512
, None, day); assert_eq!(up, [Place(0), T(0), Place(1), T(1), Heading(0), Place(2), T(2), Heading(2)]); assert_eq!(starts, [0, 2, 5]); // Ungrouped, one line a row. let (lines, _) = list_lines(&rows, ONE_LINE, false, None, day); assert_eq!(lines, [T(0), T(1), T(2)]); } /...
rust_dataset_chunk_2529
rust_dataset.txt
2,529
512
{ d } else { d.yesterday().unwrap() } }; let (lines, _) = list_lines(&rows, BY_DAY, inverted, None, day); assert_eq!(lines, want); } #[rstest] #[case(9_999, "9999")] #[case(12_345, "12k")] fn message_counts_fit_their_c...
rust_dataset_chunk_2530
rust_dataset.txt
2,530
512
, Flattened}; use atuin_common::harnesstools::rehydrate::{ ForkOf, RehydrateError, RehydrateMessage, RehydrateSession, Rehydrated, }; pub use atuin_common::harnesstools::resume::{ResumeError, ResumePlan, ResumeTarget, quote}; use atuin_common::harnesstools::sync::{ AppendOptions, AppendOutcome, Liveness, LocalT...
rust_dataset_chunk_2531
rust_dataset.txt
2,531
512
]), and `plan` resumes it as it is. pub catch_up: bool, /// Whether an agent here has the session open, or may have. pub live: bool, /// What restoring or catching the session up said, to tell the user once it resumes. pub note: Option<String>, } impl Resume { /// A session ready to resume with...
rust_dataset_chunk_2532
rust_dataset.txt
2,532
512
in Codex: 42 tool calls become notes`, and whose branch it /// carries (`; along @3f9a12bc's branch`) when it carries one of several. pub fn status(&self) -> String { let status = continuing(self.target, Some(&self.flattened)); match &self.along { Some(host) => format!("{status}; al...
rust_dataset_chunk_2533
rust_dataset.txt
2,533
512
Switched { /// The branch's host, as [`catchup::host_label`] names it. pub host: String, /// The messages the copy holds now, as [`catchup::message_count`] counts them. pub messages: usize, /// Where the copy as it was before the switch is kept. pub backup: PathBuf, /// What went wrong once...
rust_dataset_chunk_2534
rust_dataset.txt
2,534
512
&SessionRow, _head: Option<&SourceId>, ) -> Result<CatchUp, NotResumable> { let resume = self.plan(session).await?; let (plan, status) = match &resume.restore { Some(restore) => { let restored = self.restore(source, session, restore).await?; (rest...
rust_dataset_chunk_2535
rust_dataset.txt
2,535
512
(session.handle.harness))) } /// Whether `session` can be forked here: its harness forks, and is installed. fn can_fork(&self, _session: &SessionRow) -> bool { false } /// Write `session` out as a new session of its own harness, linked to it as its fork /// ([`fork`]), from `from` (by ...
rust_dataset_chunk_2536
rust_dataset.txt
2,536
512
_harness: AnyHarness, _id: &str, ) -> Result<Option<LocalTip>, SyncError> { Ok(None) } /// Whether a `harness` process here may be writing session `id` /// ([`SessionSync::is_live`]). /// /// [`SessionSync::is_live`]: atuin_common::harnesstools::sync::SessionSync::is_live a...
rust_dataset_chunk_2537
rust_dataset.txt
2,537
512
fn restored(restore: &Restore, written: Option<&str>) -> String { let mut status = "restored the thread from sync".to_owned(); for note in [restore.note.as_deref(), written].into_iter().flatten() { status.push_str("; "); status.push_str(note); } status } /// `notes` that say anything, j...
rust_dataset_chunk_2538
rust_dataset.txt
2,538
512
str, base: &LocalTip, lines: &[RehydrateMessage], options: &AppendOptions<'_>, ) -> Result<AppendOutcome, SyncError> { let started = Instant::now(); let appended = harness.append(id, base, lines, options).await; if appended.as_ref().is_ok_and(|outcome| !outcome.append...
rust_dataset_chunk_2539
rust_dataset.txt
2,539
512
Whether `kind` could resume a session here, in the directory `session` would: it is /// installed (or the user's template's program is). fn runs_here(&self, kind: HarnessKind, session: &SessionRow) -> bool { let target = ResumeTarget::new("atuin") .with_cwd(resolve_cwd(session.cwd.as_deref(...
rust_dataset_chunk_2540
rust_dataset.txt
2,540
512
arness, data).await { Ok(written) => written, Err(RehydrateError::AlreadyExists(path)) => Rehydrated::at(path), Err(e) => return Err(failed(e.to_string())), }; let target = ResumeTarget::new(&data.id).with_cwd(&data.cwd).with_native_path(written.path); let pla...
rust_dataset_chunk_2541
rust_dataset.txt
2,541
512
ork).then(|| ForkOf { id: parent.session.to_string(), atuin_id: None, path: None, }) } /// `session` as `source` holds it, to be written out and resumed in `cwd`, along one branch when /// [`catchup::branch_rows`] picks one, so no other branch's messages come with it. That branch is /// `he...
rust_dataset_chunk_2542
rust_dataset.txt
2,542
512
.with_cwd(cwd); } // The harness decides first (a subagent is never resumable, whatever is on disk). harness.resume_plan(&target)?; // Amp keeps its threads on its servers: there is no copy here to catch up or restore. if let AnyHarness::Amp(_) = harness { target.cwd ...
rust_dataset_chunk_2543
rust_dataset.txt
2,543
512
restore: Some(restore), ..Resume::ready(self.unwritten_plan(harness, kind, &target)?) }; (resume, None) } }; self.check_installed(&resume.0.plan)?; Ok(resume) } } #[async_trait] impl Resumer for HarnessResumer { async fn p...
rust_dataset_chunk_2544
rust_dataset.txt
2,544
512
let Some(analysis) = analysis.map_err(|e| NotResumable::CatchUp(format!("{e:#}")))? else { return ready(resume.plan, None); }; let heads = analysis.heads(); let chosen = match head { Some(named) => heads.iter().position(|h| h.source_id == *named).ok_or_else(|| { ...
rust_dataset_chunk_2545
rust_dataset.txt
2,545
512
flat_map(|h| analysis.path_to(&h.source_id)) .map(|m| m.source_id.to_string()) .collect(); for row in &rows { taken.remove(&row.source_id); } let options = AppendOptions { taken_ids: Some(&taken), cwd: dir.as_deref(), }; ...
rust_dataset_chunk_2546
rust_dataset.txt
2,546
512
copy of it here: resuming it restores it".to_owned())); } Err(e) => return Err(fail(e.to_string())), }; let analysis = source.analyse(&session.handle).await.map_err(|e| fail(format!("{e:#}")))?; let analysis = analysis.ok_or_else(|| { fail("its branches aren'...
rust_dataset_chunk_2547
rust_dataset.txt
2,547
512
which a `{path}` template names. let plan = if outcome.native_path == tip.native_path { resume.plan } else { let mut target = ResumeTarget::new(id).with_native_path(&outcome.native_path); target.cwd.clone_from(&resume.plan.cwd); harness.resume(&target, se...
rust_dataset_chunk_2548
rust_dataset.txt
2,548
512
a // continuation of it is: opencode's would have no prompt to carry its link. let rows = from.rows.as_deref().unwrap_or(&original.messages); let rows = match from.tip.as_deref() { Some(tip) => fork::up_to(rows, tip).ok_or_else(|| fail(NO_TIP.to_owned()))?, None => rows,...
rust_dataset_chunk_2549
rust_dataset.txt
2,549
512
target: HarnessKind, head: Option<&SourceId>, ) -> Result<Continued, NotResumable> { let from_kind = session.handle.harness; let from = from_kind.harness().ok_or(NotResumable::Unsupported(harness_label(from_kind)))?; let into = target.harness().ok_or(NotResumable::Unsupp...
rust_dataset_chunk_2550
rust_dataset.txt
2,550
512
})) } /// Where to resume a session that ran in `original` on this machine: there, when it exists; /// else, when the current directory is in a git repository named like one `original` was in, /// the same place in that repository (or its root); else the current directory. /// /// The same place is what follows a ...
rust_dataset_chunk_2551
rust_dataset.txt
2,551
512
, when /// `original` was in a repository named like it ([`resolve_cwd`]). fn in_checkout(original: &Path, context: &ResumeContext) -> Option<PathBuf> { context.git_root.as_deref().and_then(|root| { let name = root.file_name()?; let components: Vec<_> = original.components().collect(); let n...
rust_dataset_chunk_2552
rust_dataset.txt
2,552
512
::{HarnessKind, HarnessSession}; use atuin_common::harnesstools::resume::CwdRequirement; use jiff::Timestamp; use parking_lot::Mutex; use rstest::{fixture, rstest}; use tempfile::TempDir; use super::*; use crate::resume_tui::fake; use crate::resume_tui::source::{SessionFilter, SessionPreview}; /// A machine that touc...
rust_dataset_chunk_2553
rust_dataset.txt
2,553
512
{ self.found.get(id).cloned() } async fn rehydrate( &self, harness: AnyHarness, session: &RehydrateSession, ) -> Result<Rehydrated, RehydrateError> { let path = PathBuf::from(format!("/restored/{}.jsonl", session.id)); match (harness, session.id.as_str()) { ...
rust_dataset_chunk_2554
rust_dataset.txt
2,554
512
syncing its directory failed".to_owned()), Some(_) => return Err(SyncError::MaybeLive), None => {} } // The rows the copy shares with the branch are kept; the rest are appended. let ids: Vec<String> = branch.iter().map(|m| m.source_id.clone()).collect(); let appen...
rust_dataset_chunk_2555
rust_dataset.txt
2,555
512
Some("changed") => return Err(SyncError::Changed), Some("id taken") => return Err(SyncError::IdTaken("c".to_owned())), Some(_) => return Err(SyncError::MaybeLive), None => {} } let ids: Vec<String> = lines.iter().map(|m| m.source_id.clone()).collect(); ...
rust_dataset_chunk_2556
rust_dataset.txt
2,556
512
to the test binary: CI's temporary directory is mounted without exec, and some tests // write programs here that must count as runnable. let exe = std::env::current_exe().unwrap(); let tmp = tempfile::tempdir_in(exe.parent().unwrap()).unwrap(); let repo = tmp.path().join("checkouts").joined("atuin"); ...
rust_dataset_chunk_2557
rust_dataset.txt
2,557
512
_directly(dirs: Dirs) { let machine = FakeMachine { found: HashMap::from([("abc-123".to_owned(), PathBuf::from("/t/abc-123.jsonl"))]), ..FakeMachine::default() }; let local = row(HarnessKind::Pi, "abc-123", &dirs.elsewhere, false); let resume = resumer(&dirs, &machine).plan(&local).await...
rust_dataset_chunk_2558
rust_dataset.txt
2,558
512
new("/src/atuin/crates"), true); let resume = resumer(&dirs, &machine).plan(&remote).await.unwrap(); let restore = resume.restore.expect("restored from sync"); assert_eq!(restore.cwd, dirs.repo.join("crates")); assert!(restore.note.unwrap().contains("/src/atuin/crates isn't on this machine")); asse...
rust_dataset_chunk_2559
rust_dataset.txt
2,559
512
")] #[case::already_there("already-there")] #[tokio::test] async fn restoring_writes_the_transcript_and_plans_resuming_it(dirs: Dirs, #[case] id: &str) { let machine = FakeMachine::default(); let resumer = resumer(&dirs, &machine); let remote = row(HarnessKind::Pi, id, Path::new("/gone/proj"), true); le...
rust_dataset_chunk_2560
rust_dataset.txt
2,560
512
sync; {note}")); let forked = resumer.fork(&Worked, &remote, ForkFrom::default()).await.unwrap(); assert_eq!(forked.note.as_deref(), Some(note)); let claude = row(HarnessKind::ClaudeCode, "abc-123", &dirs.elsewhere, false); let continued = resumer.continue_in(&Worked, &claude, HarnessKind::Pi, None)....
rust_dataset_chunk_2561
rust_dataset.txt
2,561
512
remote).await.unwrap().restore.unwrap(); let err = resumer.restore(&Synced, &remote, &restore).await.unwrap_err(); assert_eq!( err.to_string(), "restoring it from sync failed: opencode sessions can't be rehydrated" ); } #[rstest] #[tokio::test] async fn a_harness_not_installed_here_says_so(...
rust_dataset_chunk_2562
rust_dataset.txt
2,562
512
atuin/gone"), Expect::RepoRoot, true)] #[case::same_repo_root(Some("/home/u/atuin"), Expect::RepoRoot, true)] #[case::same_repo_dir_named_like_it(Some("/home/u/atuin/crates/atuin"), Expect::RepoNamesake, true)] #[case::other_repo(Some("/home/u/zsh"), Expect::Here, true)] #[case::unknown(None, Expect::Here, true)] fn re...
rust_dataset_chunk_2563
rust_dataset.txt
2,563
512
(inner.join("deeper")).unwrap(); let context = ResumeContext { cwd: match cwd { Cwd::InOuter => outer.joined("deeper"), Cwd::InInner => inner.joined("deeper"), Cwd::Elsewhere => dirs.here.clone(), }, ..context(&dirs) }; let original = Path::new("/w...
rust_dataset_chunk_2564
rust_dataset.txt
2,564
512
, vec![ Content::ReasoningSummary { tokens: None }, Content::ToolUse(ToolUse { id: "t1".to_owned().into(), name: "Bash".to_owned(), input: serde_json::json!({"command": "cargo test"}), }), ]), ...
rust_dataset_chunk_2565
rust_dataset.txt
2,565
512
). #[rstest] #[tokio::test] async fn an_empty_session_is_not_continued( dirs: Dirs, #[values( HarnessKind::Codex, HarnessKind::Copilot, HarnessKind::Kiro, HarnessKind::Opencode, HarnessKind::Pi )] target: HarnessKind, ) { let machine = FakeMachine::default(); ...
rust_dataset_chunk_2566
rust_dataset.txt
2,566
512
_resumes_the_written_session(dirs: Dirs) { let machine = FakeMachine::default(); let templates = AiSessionResume { pi: Some("pi --session {path}".to_owned()), ..AiSessionResume::default() }; let resumer = HarnessResumer::on(context(&dirs), templates, machine.clone(), &dirs.switched); ...
rust_dataset_chunk_2567
rust_dataset.txt
2,567
512
programs are checked for real, with [`is_executable_with_path_search`]. #[derive(Clone)] struct RealPrograms(FakeMachine); #[async_trait] impl Machine for RealPrograms { async fn locate(&self, harness: AnyHarness, id: &str) -> Option<PathBuf> { self.0.locate(harness, id).await } async fn rehydrat...
rust_dataset_chunk_2568
rust_dataset.txt
2,568
512
let plan = resumer.plan(&session).await.unwrap().plan; assert_eq!(plan.program, "./bin/wrapper"); assert_eq!(plan.cwd.as_deref(), Some(dirs.elsewhere.as_path())); } #[rstest] fn the_program_to_check_is_relative_to_the_plans_directory() { let plan = |program: &str, cwd: Option<&str>| ResumePlan { p...
rust_dataset_chunk_2569
rust_dataset.txt
2,569
512
!(ids, ["r1", "r2", "r3"], "the rows as they were"); let of = new.fork_of.clone().unwrap(); assert_eq!((of.id, of.atuin_id), ("abc-123".to_owned(), Some(session.atuin_id.to_string()))); assert_eq!(forked.plan.program, "claude"); assert_eq!(forked.status(), "forked into a new Claude Code session"); ...
rust_dataset_chunk_2570
rust_dataset.txt
2,570
512
from("/restored/abc-123.jsonl") } Some(found) => { assert_eq!(written, [forked.id.as_str()]); PathBuf::from(found) } }; let fork = machine.written.lock().last().cloned().unwrap(); assert_eq!(fork.fork_of.unwrap().path, Some(parent)); } /// A Codex fork reads ...
rust_dataset_chunk_2571
rust_dataset.txt
2,571
512
machine.found.insert("s".to_owned(), PathBuf::from("/t/s.jsonl")); } let mut session = row(HarnessKind::ClaudeCode, "s", cwd, false); session.handle = fake::synced_handle(); let source = fake::FakeSource::from_rows(vec![session.clone()]) .with_synced(&session.handle, fake::synced_rows(diverged)...
rust_dataset_chunk_2572
rust_dataset.txt
2,572
512
_the_head( Some((&["a", "b", "c", "d"][..], "d")), Some(Liveness::Unknown), false, "/t/s.jsonl", &[] )] #[case::diverged( Some((&["a", "b", "c", "d"][..], "d")), None, true, "this copy went another way than this machine's [y d]", &[] )] #[case::diverged_at_the_newest( Some((&...
rust_dataset_chunk_2573
rust_dataset.txt
2,573
512
#[case::maybe_live("maybe live", "Claude Code is running this session here [d]")] #[tokio::test] async fn a_refused_append_leaves_the_choice( dirs: Dirs, #[case] refuse: &'static str, #[case] said: &str, ) { let machine = FakeMachine { tip: Some(fake::local_tip(&["a", "b"], Some("b"))), ...
rust_dataset_chunk_2574
rust_dataset.txt
2,574
512
.clone(), }; let machine = FakeMachine { tip: Some(fake::local_tip(&["a", "b"], Some("b"))), agent_in: Some(agent_in), ..FakeMachine::default() }; let cwds = machine.append_cwds.clone(); let caught = catch_up_in(&dirs, machine, false, Path::new(recorded)).await; let want ...
rust_dataset_chunk_2575
rust_dataset.txt
2,575
512
synced_rows(diverged); let mut title = fake::synced_row(&handle, ("syn-title", None, 2, 6, false)); title.role = atuin_common::harnesstools::session::Role::Other("ai-title".to_owned()); title.content = Vec::new(); rows.push(title); rows } /// A session with no copy here is restored along the head n...
rust_dataset_chunk_2576
rust_dataset.txt
2,576
512
session).await.unwrap().restore.unwrap(); resumer.restore(&source, &session, &restore).await.unwrap(); } else { let head = head.map(|h| SourceId::from(h.to_owned())); let caught = resumer.catch_up(&source, &session, head.as_ref()).await.unwrap(); assert!(matches!(caught, CatchUp::Rea...
rust_dataset_chunk_2577
rust_dataset.txt
2,577
512
, 0, false), ("b", Some("a"), 1, 1, true), ("u", Some("b"), 1, 2, false), ("v", Some("u"), 1, 3, true), ("w", Some("b"), 1, 4, false), ("z", Some("w"), 1, 5, true), ] .into_iter() .map(|spec| fake::synced_row(&session.handle, spec)) .collect(); let source = ...
rust_dataset_chunk_2578
rust_dataset.txt
2,578
512
case] want: Option<&str>, ) { let machine = FakeMachine::default(); let resumer = resumer(&dirs, &machine); let mut session = row(harness, "s", &dirs.elsewhere, true); session.handle.harness = harness; session.relation = relation; session.parent = Some(HarnessSession { harness, s...
rust_dataset_chunk_2579
rust_dataset.txt
2,579
512
ed(&session.handle, fake::synced_rows(diverged)); let head = head.map(|h| SourceId::from(h.to_owned())); let continued = resumer.continue_in(&source, &session, HarnessKind::Codex, head.as_ref()); let status = continued.await.unwrap().status(); // Which branch it carries, when it carries one of several, ...
rust_dataset_chunk_2580
rust_dataset.txt
2,580
512
machine, false).await; assert_eq!(caught.1, ["c,d@b"]); let want = if recorded && exists { copy_dir } else { dirs.elsewhere.clone() }; // The plan asks, then the append (the fake asks again as it appends). assert_eq!(*live.lock(), vec![Some(want.clone()); 2], "the plan's check")...
rust_dataset_chunk_2581
rust_dataset.txt
2,581
512
(), PathBuf::from("/t/s.jsonl")); let written = machine.written.clone(); let caught = catch_up(&dirs, machine, false).await; assert_eq!(caught, ("/restored/s.jsonl restored the thread from sync".to_owned(), vec![])); assert_eq!(written.lock().len(), 1); } /// A branch named that is no longer a head is ...
rust_dataset_chunk_2582
rust_dataset.txt
2,582
512
from_rows(vec![session.clone()]).with_synced(&session.handle, rows); (session, source) } /// Switch this machine's copy of [`diverged_session`] (read as `machine`'s tip) to `head`: what /// it says, and what it wrote. async fn switch( dirs: &Dirs, mut machine: FakeMachine, harness: HarnessKind, hea...
rust_dataset_chunk_2583
rust_dataset.txt
2,583
512
was read, its agent's /// store can't be written out whole (opencode's database, a Codex thread in several rollouts), /// or it is on that branch already. #[rstest] #[case::the_newest_it_can((&["a", "b", "x", "y"][..], "y"), None, None, HarnessKind::ClaudeCode, None, Ok(SWITCHED))] #[case::named((&["a", "b", "x", ...
rust_dataset_chunk_2584
rust_dataset.txt
2,584
512
"), Err("the session's transcript changed since it was read"))] #[case::codex_in_several_rollouts((&["a", "b", "x", "y"][..], "y"), None, Some("unsupported"), HarnessKind::Codex, Some("d"), Err("a thread kept in several rollouts"))] #[case::opencode((&["a", "b", "x", "y"][..], "y"), None, None, HarnessKind::Opencod...
rust_dataset_chunk_2585
rust_dataset.txt
2,585
512
[Some(dirs.elsewhere.clone())]); } Err(why) => { assert_eq!(said, Err(NotResumable::Switch(why.to_owned()))); assert!(replaced.is_empty(), "nothing written: {replaced:?}"); } } } /// A copy that isn't here has nothing to switch: resuming it restores it. #[rstest] #[...
rust_dataset_chunk_2586
rust_dataset.txt
2,586
512
HarnessKind::Codex, Some("y")).await; assert_eq!(said, Err(NotResumable::Switch(why.to_owned()))); assert!(replaced.is_empty()); } /// A switch writes the branch as a restore would: with the rows beside the tree that go with it /// (here a Pi extension's message, keyed on its content), not only those on the h...
rust_dataset_chunk_2587
rust_dataset.txt
2,587
512
replaced, ["c,d@d"]); } /// A choice for a copy on another line than the head's offers to switch it to each head it is /// not on; never while an agent here has it open, nor when sync hasn't got all of it, which the /// switch would lose, nor for opencode. #[rstest] #[case::diverged(&["a", "b", "c", "d"], "d", None, H...
rust_dataset_chunk_2588
rust_dataset.txt
2,588
512
: resumed /// along it as it is, and caught up (fast-forwarded) as that branch grows, rather than offered /// the choice again for the session having diverged. #[rstest] #[tokio::test] async fn a_switched_copy_fast_forwards_as_its_branch_grows(dirs: Dirs) { let mut machine = FakeMachine { tip: Some(fake::lo...
rust_dataset_chunk_2589
rust_dataset.txt
2,589
512
machine = FakeMachine { found: HashMap::from([("local-h1".to_owned(), PathBuf::from("/h/.hermes/state.db"))]), ..FakeMachine::default() }; let session = row(HarnessKind::Hermes, "local-h1", &dirs.elsewhere, false); let resume = resumer(&dirs, &machine).plan(&session).await.unwrap(); ass...
rust_dataset_chunk_2590
rust_dataset.txt
2,590
512
) -> Self { let at = clamp(area, at); Self { area, from: at, to: at, } } /// Drag to `at`, kept within the area. pub fn extend(&mut self, at: Position) { self.to = clamp(self.area, at); } /// Each row selected, with its first and ...
rust_dataset_chunk_2591
rust_dataset.txt
2,591
512
}; row.push_str(cell.symbol()); // A wide character's cell stands for the ones it covers. x += u16::try_from(cell.symbol().width().max(1)).unwrap_or(1); } row.trim_end().to_owned() }) .collect(); ...
rust_dataset_chunk_2592
rust_dataset.txt
2,592
512
\nthird"))] #[case::a_click((3, 0), (3, 0), None)] #[case::blanks((10, 0), (11, 0), None)] fn a_drag_selects_text( #[case] from: (u16, u16), #[case] to: (u16, u16), #[case] want: Option<&str>, ) { assert_eq!(drag(from, to).text(&screen()).as_deref(), want); } ///...
rust_dataset_chunk_2593
rust_dataset.txt
2,593
512
esstools::rehydrate::RehydrateSession; use atuin_common::harnesstools::session::{Content, ParentKind, Role}; use atuin_common::string::highlighted::HighlightedString; use atuin_common::utils::in_git_repo; use eyre::{Result, WrapErr}; use futures::TryStreamExt; use parking_lot::Mutex; use super::source::{ Relation,...
rust_dataset_chunk_2594
rust_dataset.txt
2,594
512
newer build's: taken for a subagent, as group sizes // take it. Some(ParentKind::Subagent) => Relation::Subagent, None if s.parent.is_some() => Relation::Subagent, Some(ParentKind::Fork) => Relation::Fork, Some(ParentKind::Continuation) => Relation::Continuat...
rust_dataset_chunk_2595
rust_dataset.txt
2,595
512
(), highlights: plain.ranges, } } fn conversation_text(c: &Content) -> Option<&str> { match c { Content::Text(t) | Content::Summary(t) if !t.trim().is_empty() => Some(t.as_str()), _ => None, } } /// The conversation text of a message: text and summaries, never tool calls or reasoni...
rust_dataset_chunk_2596
rust_dataset.txt
2,596
512
} async fn find_by_id(&self, id: &str) -> Result<Vec<SessionRow>> { let sessions = self.db.sessions_with_id_prefix(id).await?; Ok(sessions.into_iter().map(|s| self.row(s)).collect()) } async fn preview(&self, session: &HarnessSession) -> Result<SessionPreview> { let parts = sel...
rust_dataset_chunk_2597
rust_dataset.txt
2,597
512
let stamp = |path: &PathBuf| { let meta = std::fs::metadata(path).ok()?; Some((meta.modified().ok()?, meta.len())) }; (!self.files.is_empty()).then(|| self.files.iter().map(stamp).collect()) } } #[cfg(test)] mod tests { use atuin_client::ai_session::{HarnessKind,...
rust_dataset_chunk_2598
rust_dataset.txt
2,598
512
switched to a fixed clock", 1), message("agent-1", Some("root"), Role::User, "look for wall clock use", 2), message("fork-1", Some("root"), Role::User, "try a mocked clock instead", 3), ] { db.append(&m).await.unwrap(); } SidecarSource::new(db, &context()) ...
rust_dataset_chunk_2599
rust_dataset.txt
2,599
512
it. #[rstest] #[case::still_typing("fla", 1)] #[case::finished("fla ", 0)] #[case::finished_whole_word("flaky ", 1)] #[tokio::test] async fn a_trailing_space_finishes_the_typed_word( #[future] source: SidecarSource, #[case] input: &str, #[case] hits: usize, ) { ...