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_2300 | rust_dataset.txt | 2,300 | 512 | (p.harness()),
"session_id": p.session_id,
"imported": p.imported,
"skipped": p.skipped,
}),
import_sessions_event::Event::Summary(s) => serde_json::json!({
"kind": "summary",
"sessions": ... |
rust_dataset_chunk_2301 | rust_dataset.txt | 2,301 | 512 | summary": json_summary });
serde_json::to_writer(&mut *out, &doc)?;
writeln!(out)?;
}
Ok(())
}
// --- selector resolution ------------------------------------------------------------------------
/// Turn a `latest`/id selector into a full session handle by matching it against the session list... |
rust_dataset_chunk_2302 | rust_dataset.txt | 2,302 | 512 | {
// The daemon lists newest-first, so the first entry is the most recent.
return sessions.into_iter().next().map(|s| s.handle).ok_or(SelectError::NoSessions);
}
// Accept a unique prefix of either id, or the end of the atuin id, as well as a full one.
// An id given whole names its sessio... |
rust_dataset_chunk_2303 | rust_dataset.txt | 2,303 | 512 | ))?;
}
// Links by id, for the stored sessions they name.
if let Some(parent) = s.parent_atuin_id {
writeln!(out, "parent {parent}")?;
}
if let Some(root) = s.root_atuin_id {
writeln!(out, "root {root}")?;
}
if !s.child_atuin_ids.is_empty() {
let children:... |
rust_dataset_chunk_2304 | rust_dataset.txt | 2,304 | 512 | alone.
Content::ToolUse(tu) => {
write!(out, "[tool-call {}]", sanitize(&tu.name))?;
if !tu.input.is_null() {
write!(out, " {}", sanitize(&input_text(&tu.input)))?;
}
writeln!(out)?;
}
Content::ToolR... |
rust_dataset_chunk_2305 | rust_dataset.txt | 2,305 | 512 | is set.
fn render(&self, color: bool) -> String {
match self {
Self::Text(t) => t.clone(),
Self::Thinking(t) => format!("{} {t}", paint("»", Ansi::Dim, color)),
Self::ToolCall(name) => format!("{} {name}", paint("⚙", Ansi::Blue, color)),
Self::Error(body) => ... |
rust_dataset_chunk_2306 | rust_dataset.txt | 2,306 | 512 | => {
return Some(Summary::ToolResult {
is_error: tr.error,
body: tr
.output_text()
.map(|output| one_line(&output, SUMMARY_WIDTH))
.unwrap_or_default(),
});
}
... |
rust_dataset_chunk_2307 | rust_dataset.txt | 2,307 | 512 | }")
} else {
format!("{bullet} {id} · {harness_label} · {title}")
}
}
/// Local wall-clock `HH:MM:SS`, for live `tail` lines.
fn clock(ts: Timestamp) -> String {
TimeZone::system().to_datetime(ts).strftime("%H:%M:%S").to_string()
}
// --- color -----------------------------------------------------... |
rust_dataset_chunk_2308 | rust_dataset.txt | 2,308 | 512 | ; `role` is
user, assistant, system, tool, or the agent's own.
id, parent the message's id and the id of the one it follows. A message
without an id is keyed on its content, so give it a `time`
that stays the same each time it is pushed
time RFC 3339
cwd, br... |
rust_dataset_chunk_2309 | rust_dataset.txt | 2,309 | 512 | .
async fn push(client: &mut AiClient, harness: HarnessKind, session: String) -> Result<()> {
let mut lines = Vec::new();
for (n, line) in io::stdin().lines().enumerate() {
let line = line?;
if line.trim().is_empty() {
continue;
}
serde_json::from_str::<PushedMessage>... |
rust_dataset_chunk_2310 | rust_dataset.txt | 2,310 | 512 | ", collapsed.chars().take(max).collect::<String>())
} else {
collapsed
}
}
/// Replace terminal control characters in captured session content with spaces, so a recorded
/// session can never emit escape sequences (colour, cursor moves, a window-title change) when it is
/// printed to a TTY. `\n`/`\t` ... |
rust_dataset_chunk_2311 | rust_dataset.txt | 2,311 | 512 | role_name(role: &Role) -> &'static str {
match role {
Role::User => "user",
Role::Assistant => "assistant",
Role::System => "system",
Role::Tool => "tool",
Role::Other(_) => "unknown",
}
}
fn stop_reason_name(stop_reason: Option<&StopReason>) -> &'static str {
match... |
rust_dataset_chunk_2312 | rust_dataset.txt | 2,312 | 512 | : String,
updated_at: String,
message_count: u64,
tokens: Usage,
#[serde(skip_serializing_if = "Option::is_none")]
title: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
preview: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
last_reply: Option<St... |
rust_dataset_chunk_2313 | rust_dataset.txt | 2,313 | 512 | Json),
SessionUpdated(SessionJson),
Message(MessageJson),
Lagged {
dropped: u64,
},
}
#[derive(Serialize)]
struct HighlightJson {
text: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
matches: Vec<[usize; 2]>,
}
#[derive(Serialize)]
struct SearchMatchJson {
session: Ses... |
rust_dataset_chunk_2314 | rust_dataset.txt | 2,314 | 512 | : s.parent_kind.map(|kind| match kind {
ParentKind::Subagent => "subagent",
ParentKind::Fork => "fork",
ParentKind::Continuation => "continuation",
}),
parent_atuin_id: s.parent_atuin_id.map(|id| id.to_string()),
root_atuin_id: s.root_atuin_id.map(|id| id.to_s... |
rust_dataset_chunk_2315 | rust_dataset.txt | 2,315 | 512 | {
tool_use_id: patch.call.to_string(),
files: patch
.files
.iter()
.map(|file| FilePatchJson {
path: file.path.clone(),
change: file.change.as_str(),
moved_to: file.moved_to.clone(),
... |
rust_dataset_chunk_2316 | rust_dataset.txt | 2,316 | 512 | 3), line(1)]), [
vec![1],
vec![PUSH_BATCH * 3],
vec![1]
]);
}
fn handle(harness: HarnessKind, id: &str) -> HarnessSession {
HarnessSession {
harness,
session: NativeSessionId::from(id.to_owned()),
}
}
fn session(harnes... |
rust_dataset_chunk_2317 | rust_dataset.txt | 2,317 | 512 | latest_resolves_from_a_single_session() {
// `resolve` now hands `select_session` just the newest session for `latest`, so a
// one-element list must still resolve.
let selected =
select_session(vec![session(HarnessKind::ClaudeCode, "only")], "latest").unwrap();
assert_eq!(s... |
rust_dataset_chunk_2318 | rust_dataset.txt | 2,318 | 512 | () {
let sessions =
vec![session(HarnessKind::Codex, "abc111"), session(HarnessKind::ClaudeCode, "abc222")];
assert!(select_session(sessions, "abc").is_err());
}
#[rstest]
fn unknown_id_is_an_error() {
let sessions = vec![session(HarnessKind::Codex, "aaa")];
asse... |
rust_dataset_chunk_2319 | rust_dataset.txt | 2,319 | 512 | ::ClaudeCode),
..
}));
let cli =
<Cli as clap::Parser>::try_parse_from(["threads", "search", "--harness", name, "q"])
.unwrap();
assert!(matches!(cli.cmd, Cmd::Search {
harness: Some(HarnessArg::ClaudeCode),
..
}));
... |
rust_dataset_chunk_2320 | rust_dataset.txt | 2,320 | 512 | Some(1),
cache_write: Some(2),
reasoning: None,
};
s.title = Some("hello".to_owned());
let v = serde_json::to_value(session_json(&s)).unwrap();
assert_eq!(v["harness"], "claude-code");
assert_eq!(v["session_id"], "abcdef0123456789");
assert_eq!(v... |
rust_dataset_chunk_2321 | rust_dataset.txt | 2,321 | 512 | 0000000000003f9a12bc");
}
/// `show` names a session's links by atuin id, in text and JSON, leaving out those unknown.
#[rstest]
fn show_names_links_by_atuin_id() {
let id = |n: u128| AtuinSessionId::from(uuid::Uuid::from_u128(n));
let mut s = session(HarnessKind::Codex, "child");
... |
rust_dataset_chunk_2322 | rust_dataset.txt | 2,322 | 512 | ")]
fn harness_name_maps_known_and_unknown(#[case] harness: HarnessKind, #[case] expected: &str) {
assert_eq!(harness_name(harness), expected);
}
fn msg(role: Role, content: Vec<Content>) -> Message {
Message::builder()
.id(RecordId(atuin_common::utils::uuid_v7()))
.... |
rust_dataset_chunk_2323 | rust_dataset.txt | 2,323 | 512 | prints it"
);
let (role_text, _) = display_role(&m, &summary);
assert!(!role_text.chars().any(char::is_control), "the role label must be sanitized");
}
#[rstest]
#[case(false, "✓ ok")]
#[case(true, "✗ boom")]
fn summary_marks_a_tool_result(#[case] is_error: bool, #[case] ex... |
rust_dataset_chunk_2324 | rust_dataset.txt | 2,324 | 512 | away_summary · "));
}
/// A call's text input and a result's text blocks read as text, not as escaped JSON.
#[rstest]
fn show_prints_tool_text_as_text() {
let call = Content::ToolUse(ToolUse {
id: ToolCallId::from("c1".to_owned()),
name: "exec".to_owned(),
i... |
rust_dataset_chunk_2325 | rust_dataset.txt | 2,325 | 512 | header_includes_title_when_present() {
let mut s = session(HarnessKind::ClaudeCode, "abcdef0123456789");
s.title = Some("My Session".to_owned());
assert_eq!(
tail_header(&s.handle, Some(&s), false),
format!("● {} · claude-code · My Session", s.atuin_id.short())
)... |
rust_dataset_chunk_2326 | rust_dataset.txt | 2,326 | 512 | ");
}
#[rstest]
fn sanitize_keeps_newlines_and_tabs_for_multiline_bodies() {
assert_eq!(sanitize("a\n\tb"), "a\n\tb");
assert!(matches!(sanitize("plain"), Cow::Borrowed(_)), "clean text is not reallocated");
}
#[rstest]
fn one_line_drops_control_characters() {
assert!(!... |
rust_dataset_chunk_2327 | rust_dataset.txt | 2,327 | 512 | 5]]));
}
/// The match ranges in the JSON are those of what a real search matched.
#[rstest]
#[case::all(SearchTerms::All(vec!["build".into()]), json!([[8, 13]]), json!([[4, 9]]))]
#[case::any(
SearchTerms::Any(vec!["build".into(), "nothing".into()]),
json!([[8, 13]]),
json... |
rust_dataset_chunk_2328 | rust_dataset.txt | 2,328 | 512 | ) -> String {
format!(
"## #{}. (History ID: {}):\n`{}`\n{}\n",
ordinal,
history.id,
clip_command(&history.command),
format_history_metadata(history, tz)
)
}
fn clip_command(command: &str) -> std::borrow::Cow<'_, str> {
let head = command.truncate_chars(SEARCH_RESULT... |
rust_dataset_chunk_2329 | rust_dataset.txt | 2,329 | 512 | {
History {
id: "018f011c-9a0a-7000-8000-000000000001".parse().unwrap(),
timestamp: Timestamp::UNIX_EPOCH,
duration,
exit: 2,
command: "cargo test".to_string(),
cwd: "/repo".to_string(),
session: String::new(),
cmd_... |
rust_dataset_chunk_2330 | rust_dataset.txt | 2,330 | 512 | (0);
h.author = author.to_string();
h.intent = intent.map(String::from);
assert_eq!(format_attribution(&h), expected);
}
}
--- FILE: atuin/crates/atuin-ai/src/i18n.rs ---
//! The crate's message catalogue.
atuin_common::i18n::catalogue!();
--- FILE: atuin/crates/atuin-ai/src/lib.rs ---
... |
rust_dataset_chunk_2331 | rust_dataset.txt | 2,331 | 512 | use rmcp::{RoleClient, RoleServer, ServerHandler, ServiceExt};
use secrecy::{ExposeSecret as _, SecretString};
use serde_json::{Value, json};
use strum::IntoEnumIterator;
use tokio::sync::Mutex;
use crate::commands::session::harness_name;
use crate::tools::output::search::AtuinOutputSearchToolCall;
use crate::tools::s... |
rust_dataset_chunk_2332 | rust_dataset.txt | 2,332 | 512 | avo {
Some(octavo) => {
let local = TOOLS.iter().filter(|t| !t.name.starts_with("atuin_threads_"));
local.chain(octavo).cloned().collect()
}
None => TOOLS.clone(),
}
}
/// These are how long Octavo has to connect, and then to answer a tool call.
const CONNECT_TIMEOUT... |
rust_dataset_chunk_2333 | rust_dataset.txt | 2,333 | 512 | _config(config));
Ok(tokio::time::timeout(CONNECT_TIMEOUT, connect).await??)
}
async fn call(
&self,
request: CallToolRequestParams,
caller: Option<&HarnessSession>,
) -> CallToolResult {
let call = async { eyre::Ok(self.peer(caller).await?.call_tool(request).await?)... |
rust_dataset_chunk_2334 | rust_dataset.txt | 2,334 | 512 | t| t.elapsed().ok()).is_some_and(|age| age < CACHE_FRESH) {
return;
}
if let Err(e) = self.list().await {
tracing::warn!("Octavo failed: {e:#}");
let _ = fs_err::remove_file(&self.cache);
}
}
fn instructions(&self) -> String {
octavo_instructi... |
rust_dataset_chunk_2335 | rust_dataset.txt | 2,335 | 512 | re-running an expensive or side-effectful command just to see its output \
again.";
const LOCAL_THREADS_INSTRUCTIONS: &str =
"\
Atuin also records AI agent sessions as threads. Use atuin_threads_search or atuin_threads_list, \
then atuin_threads_read, whenever a task points at earlier work: 'last time',... |
rust_dataset_chunk_2336 | rust_dataset.txt | 2,336 | 512 | {
let tools = listed_tools(self.octavo.as_ref().map(|remote| &remote.tools[..]));
Ok(ListToolsResult::with_all_items(tools)
.with_ttl_ms(0)
.with_cache_scope(CacheScope::Private))
}
async fn call_tool(
&self,
request: CallToolRequestParams,
conte... |
rust_dataset_chunk_2337 | rust_dataset.txt | 2,337 | 512 | Err(e) => Err(e),
}
}
"atuin_threads_list" | "atuin_ai_session_list" => {
match parse::<AtuinThreadsListToolCall>("atuin_threads_list", arguments) {
Ok(call) => call.execute(&self.settings, &caller).await,
Err(e) => Err(e),... |
rust_dataset_chunk_2338 | rust_dataset.txt | 2,338 | 512 | defer MCP schemas until the model asks for them.
fn invalid_arguments(tool: &str, err: impl std::fmt::Display) -> String {
let schema =
TOOLS.iter().find(|t| t.name == tool).map(|t| Value::Object((*t.input_schema).clone()));
format!(
"Invalid arguments: {err}. Retry with arguments matching this... |
rust_dataset_chunk_2339 | rust_dataset.txt | 2,339 | 512 | The history and output schemas are written by hand and must
/// mirror what the `TryFrom<&serde_json::Value>` impls in [`crate::tools`]
/// accept; the output-search schema is derived from its call struct.
static TOOLS: LazyLock<Vec<Tool>> = LazyLock::new(tool_definitions);
fn tool_definitions() -> Vec<Tool> {
le... |
rust_dataset_chunk_2340 | rust_dataset.txt | 2,340 | 512 | by who ran the command: '{AUTHOR_FILTER_ALL_USER}' for \
human-run commands, '{AUTHOR_FILTER_ALL_AGENT}' for commands run \
by AI agents, or any literal author name (well-known agents: {}). \
Multiple entries are OR-ed. Omit for everything.",
... |
rust_dataset_chunk_2341 | rust_dataset.txt | 2,341 | 512 | exactly as the user saw it, or to re-read the output of an expensive or \
side-effectful command without re-running it. Output capture requires the Atuin \
daemon; output is only available for recent commands captured while the daemon was \
running.",
outp... |
rust_dataset_chunk_2342 | rust_dataset.txt | 2,342 | 512 | or active since a time (since: 'today'). Use it to pick up where the \
previous thread on this project left off ('continue', 'last time') or to see what \
agents worked on recently, when you have no specific words to search for. Each entry \
gives the thread id, harness, last-act... |
rust_dataset_chunk_2343 | rust_dataset.txt | 2,343 | 512 | in_threads_search",
"atuin_threads_list",
"atuin_threads_read",
]);
for tool in &tools {
assert_eq!(tool.annotations.as_ref().unwrap().read_only_hint, Some(true));
}
let always_loaded: Vec<&str> = tools
.iter()
.filter(|t| t.m... |
rust_dataset_chunk_2344 | rust_dataset.txt | 2,344 | 512 | terms"];
assert_eq!(terms["type"], "array");
assert_eq!(terms["minItems"], 1);
assert_eq!(terms["items"]["minLength"], 1);
assert!(terms["description"].as_str().unwrap().contains("AND-ed"));
let limit = &schema["properties"]["limit"];
assert_eq!(limit["type"], "integer");... |
rust_dataset_chunk_2345 | rust_dataset.txt | 2,345 | 512 | parse(json!({"terms": [" "]})).is_err(),
"the parser enforces the advertised minLength"
);
// Follow the property's `$ref` rather than naming the type, so a rename cannot hide it.
let reference = schema["properties"]["harness"]["anyOf"][0]["$ref"].as_str().unwrap();
let n... |
rust_dataset_chunk_2346 | rust_dataset.txt | 2,346 | 512 | _eq!(header.as_ref().map(|v| v.to_str().unwrap()), want);
}
#[rstest]
#[tokio::test]
async fn a_failed_call_ages_the_cache_and_a_failed_refresh_drops_it() {
let dir = tempfile::tempdir().unwrap();
let cache = dir.path().join("octavo_mcp_tools.json");
fs_err::write(&cache, "[]").... |
rust_dataset_chunk_2347 | rust_dataset.txt | 2,347 | 512 | "));
assert!(instructions.len() < MAX_INSTRUCTIONS_LEN, "instructions should stay concise");
}
}
--- FILE: atuin/crates/atuin-ai/src/resume_tui/catchup.rs ---
//! Catching this machine's copy of a session up with sync before resuming it in its own agent.
//!
//! A session keeps one id on every machine: ea... |
rust_dataset_chunk_2348 | rust_dataset.txt | 2,348 | 512 | back), no agent here has it open, and its
//! agent's store is a transcript that can be switched so (not opencode's database).
//!
//! [`Resumer::switch`]: super::resumer::Resumer::switch
//!
//! [`Resumer::restore`]: super::resumer::Resumer::restore
use atuin_client::ai_session::{
Analysis, FastForward, HarnessK... |
rust_dataset_chunk_2349 | rust_dataset.txt | 2,349 | 512 | `.
///
/// The copy is at the head, or ahead of it, only when the head is on the line its tip goes on
/// from: a copy holding the head that was rewound onto a line of its own is not. A tip sync
/// hasn't got may be either, which can't be told: that is a choice ([`Why::Unsynced`]).
///
/// The twig rule: a copy that s... |
rust_dataset_chunk_2350 | rust_dataset.txt | 2,350 | 512 | // The copy's rows past the shared line can be stepped over when the agent will not see them
// once it goes on from the shared row. One whose rows name the row before them follows that
// chain, so any twig without conversation drops out of its context; Kiro reads its log in
// order and would still see t... |
rust_dataset_chunk_2351 | rust_dataset.txt | 2,351 | 512 | assistant text, as a [`Head`] counts them.
pub fn message_count(rows: &[RehydrateMessage]) -> usize {
rows.iter().filter(|m| is_substantive(&m.role, &m.content)).count()
}
/// A head to fork from, as the chooser offers it.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Branch {
pub head: Head,
/// Its ... |
rust_dataset_chunk_2352 | rust_dataset.txt | 2,352 | 512 | t.known_source_ids.contains(m.source_id.as_ref())))
.count();
Branch {
head: head.clone(),
host: host_label(head, here),
selector: branch_selector(heads, head),
ahead,
switch: false,
}
})
... |
rust_dataset_chunk_2353 | rust_dataset.txt | 2,353 | 512 | harness == HarnessKind::Opencode {
return Err(OPENCODE_SWITCH.to_owned());
}
if let Some(why) = tip.unswitchable {
return Err(why.to_owned());
}
if !analysis.holds_all(tip) {
return Err(UNSYNCED_SWITCH.to_owned());
}
let heads = analysis.heads();
let head = match nam... |
rust_dataset_chunk_2354 | rust_dataset.txt | 2,354 | 512 | was written.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Held {
pub why: Why,
pub harness: HarnessKind,
/// Resumes this machine's copy as it is.
pub plan: ResumePlan,
/// The session's heads to fork from, newest first.
pub branches: Vec<Branch>,
/// The one catching up went to, in `b... |
rust_dataset_chunk_2355 | rust_dataset.txt | 2,355 | 512 | here: &str) -> String {
// Rows from before hosts were recorded are this host's.
head.host.map_or_else(
|| THIS_MACHINE.to_owned(),
|host| super::source::host_label(&host.0.as_simple().to_string(), here),
)
}
/// The fewest characters a [`branch_selector`] has, so it stays unique as a sess... |
rust_dataset_chunk_2356 | rust_dataset.txt | 2,356 | 512 | }
let selector = selector.trim();
let host = |h: &Head| host_label(h, here);
let found: Vec<&Head> = if selector == "this" {
heads.iter().filter(|h| host(h) == THIS_MACHINE).collect()
} else if let Some(id) = selector.strip_prefix('@') {
let short = format!("@{}", super::source::shor... |
rust_dataset_chunk_2357 | rust_dataset.txt | 2,357 | 512 | HarnessSession,
head: Option<&SourceId>,
) -> Result<ForkFrom, NotResumable> {
let rows = branch_rows(source, session, head, writes_one_branch(session.harness))
.await
.map_err(|e| NotResumable::Fork(format!("{e:#}")))?;
Ok(ForkFrom {
rows: rows.map(|(rows, _)| rows),
tip: No... |
rust_dataset_chunk_2358 | rust_dataset.txt | 2,358 | 512 | flatten();
let Some(head) = head.or(newest.map(|h| &h.source_id)) else {
return Ok(None);
};
let rows = if one_branch {
analysis.branch_rows(head)
} else {
analysis.rows_for(head)
};
let rows = rows.into_iter().map(|m| m.clone().into()).collect();
Ok(Some((rows, analy... |
rust_dataset_chunk_2359 | rust_dataset.txt | 2,359 | 512 | "c", "d", "z"], "z", "Unsynced")]
#[case::rewound_here_past_the_head(false, &["a", "b", "c", "d", "r"], "r", "Diverged")]
#[case::a_line_of_its_own_unsynced(false, &["a", "b", "z"], "z", "Unsynced")]
#[case::on_another_branch(true, &["a", "b", "x", "y"], "y", "Diverged")]
#[case::behind_on_the_other_branch(true, &["a"... |
rust_dataset_chunk_2360 | rust_dataset.txt | 2,360 | 512 | ex, Role::Tool, None, "Diverged")]
#[tokio::test]
async fn a_twig_off_the_heads_line_fast_forwards(
#[case] harness: HarnessKind,
#[case] role: Role,
#[case] summary_text: Option<&str>,
#[case] want: &str,
) {
let mut rows = rows(false);
let mut twig = synced_row(&handle(), ("t", Some("b"), 1, 1... |
rust_dataset_chunk_2361 | rust_dataset.txt | 2,361 | 512 | and
/// its result, left by a turn cut off before its reply) would stay in the model's context under
/// the other branch's rows: that is a divergence, not a fast-forward. An agent whose rows name the
/// row before them never sees the twig again.
#[rstest]
#[case::kiro(HarnessKind::Kiro, "Diverged")]
#[case::linked(H... |
rust_dataset_chunk_2362 | rust_dataset.txt | 2,362 | 512 | , Some(©), fake::THIS_HOST_ID);
let lines: Vec<String> = branches.iter().map(|b| b.line(fake::now())).collect();
assert_eq!(lines, [
"fork this machine's · 55m ago",
"fork @00000002's · +2 since they split · 57m ago",
]);
assert_eq!((branches[0].selector.as_str(), branches[1].selecto... |
rust_dataset_chunk_2363 | rust_dataset.txt | 2,363 | 512 | head),
Err(why) => assert!(to.unwrap_err().contains(why)),
}
let line = Branch {
switch: true,
..branches(&analysis, Some(©), fake::THIS_HOST_ID).remove(1)
};
assert_eq!(
line.switch_line(),
"switch to @00000002's · replaces this copy, yours stays in atuin"
... |
rust_dataset_chunk_2364 | rust_dataset.txt | 2,364 | 512 | , now, here);
match want {
Ok(head) => assert_eq!(to.unwrap().source_id.as_ref(), head),
Err(()) => assert_eq!(
to.unwrap_err(),
"it went 2 other ways: name the branch to switch to with `--branch`:\n q @00000003 \
· 53m · 4 msgs (latest)\n d @00000002 · 57m ·... |
rust_dataset_chunk_2365 | rust_dataset.txt | 2,365 | 512 | None, None)]
#[tokio::test]
async fn forks_start_from_a_heads_rows(
#[case] diverged: bool,
#[case] head: Option<&str>,
#[case] want: Option<&[&str]>,
) {
let source = FakeSource::from_rows(Vec::new()).with_synced(&handle(), rows(diverged));
let head = head.map(|h| SourceId::from(h.to_owned()));
... |
rust_dataset_chunk_2366 | rust_dataset.txt | 2,366 | 512 | : u64) -> Head {
Head {
source_id: id.to_owned().into(),
host: Some(HostId(uuid::Uuid::from_u128(0x0190_0000_0000_7000_8000_0000_0000_0000 | host))),
last_at: fake::now() - SignedDuration::from_mins(minutes_ago),
messages,
}
}
/// A branch's selector is the shortest start of its... |
rust_dataset_chunk_2367 | rust_dataset.txt | 2,367 | 512 | h\" names 3 branches; name one by id:"))]
fn branches_are_picked_by_host_or_id(#[case] selector: &str, #[case] want: Result<&str, &str>) {
let heads = [head("h2", 2, 60, 40), head("h1", 1, 120, 24), head("h3", 3, 180, 5)];
let picked = pick_branch(&heads, selector, fake::now(), fake::THIS_HOST_ID);
match wa... |
rust_dataset_chunk_2368 | rust_dataset.txt | 2,368 | 512 | like tool (notes
//! where they weren't captured whole), and that is resumed. Harnesses
//! that aren't installed aren't listed: there is nothing to do with them. The session's own
//! harness is always listed, dimmed with the reason when it can't resume it here (a directory
//! that's gone, a harness that isn't insta... |
rust_dataset_chunk_2369 | rust_dataset.txt | 2,369 | 512 | {
/// The session it opened on: what a pick acts on, whatever the list has moved to since.
pub row: SessionRow,
/// The other harnesses installed here, to continue the session in: the lines after the
/// original's and the fork's.
pub targets: Vec<HarnessKind>,
/// Whether the session can be fo... |
rust_dataset_chunk_2370 | rust_dataset.txt | 2,370 | 512 | ()
}
pub fn len(&self) -> usize {
1 + self.switches() + self.forks() + self.targets.len()
}
/// What line `n` does.
pub fn line(&self, n: usize) -> Destination {
let forks = self.first_fork();
let first = forks + self.forks();
match (n, &self.held) {
(0,... |
rust_dataset_chunk_2371 | rust_dataset.txt | 2,371 | 512 | `]) does, briefly. Claude Code
/// turns a `--resume` of a running session into a fork (a new session id, grouped under the
/// original); the others open the same session again, and both processes append to it.
fn concurrent(harness: HarnessKind) -> &'static str {
match harness {
HarnessKind::ClaudeCode =>... |
rust_dataset_chunk_2372 | rust_dataset.txt | 2,372 | 512 | (once its plan is known).
pub fn original_unavailable(&self, session: &HarnessSession) -> Option<&NotResumable> {
self.plans.get(session)?.as_ref().err()
}
/// Whether the session holds no conversation to fork, as reading what continuing it would
/// flatten found (once that's known): forking ... |
rust_dataset_chunk_2373 | rust_dataset.txt | 2,373 | 512 | } else {
0
};
if let Some(chooser) = self.chooser.as_mut() {
chooser.selected = selected;
}
}
/// Select the chooser's fork line, as if by hand.
pub fn select_fork(&mut self) {
if let Some(chooser) = self.chooser.as_mut().filter(|c| c.fork) {
... |
rust_dataset_chunk_2374 | rust_dataset.txt | 2,374 | 512 | can't
// become notes, not worth a line here.)
let continued = chooser.targets.iter().map(|target| Choice {
harness: *target,
detail: String::new(),
unavailable: None,
});
std::iter::once(original).chain(fork).chain(continued).collect()
}
///... |
rust_dataset_chunk_2375 | rust_dataset.txt | 2,375 | 512 | true)
| (KeyCodeValue::Char('k'), false) => {
chooser.select(chooser.selected.saturating_sub(1));
return InputAction::Continue;
}
(KeyCodeValue::Down, _)
| (KeyCodeValue::Char('n'), true)
| (KeyCodeValue::Char('j'), false) => {... |
rust_dataset_chunk_2376 | rust_dataset.txt | 2,376 | 512 |
/// marked), the other agents after a rule titled `Continue in`, as the list's days are.
/// Also which line is the selected choice's.
pub fn chooser_lines(
&self,
budget: usize,
theme: &Theme,
) -> Option<(Vec<Line<'static>>, usize)> {
let chooser = self.chooser.as_ref(... |
rust_dataset_chunk_2377 | rust_dataset.txt | 2,377 | 512 | );
}
}
lines.push(Line::from(spans));
}
// (Its keys are in the header, as the list's are.)
if let Some(at) = rule_at {
let widest = lines.iter().map(Line::width).max().unwrap_or(0).min(budget);
let title = "Continue in ";
... |
rust_dataset_chunk_2378 | rust_dataset.txt | 2,378 | 512 | orders(Borders::ALL)
.border_type(BorderType::Rounded)
.border_style(muted)
.padding(ratatui::widgets::Padding::horizontal(1))
.title(title);
f.render_widget(Clear, popup);
f.render_widget(Paragraph::new(Text::from(lines)).block(block), popup);
}
}
-... |
rust_dataset_chunk_2379 | rust_dataset.txt | 2,379 | 512 | return Self::Now;
}
if ago < SignedDuration::from_hours(1) {
return Self::Ago(format!("{}m", ago.as_mins()));
}
if ago < RELATIVE {
return Self::Ago(format!("{}h", ago.as_hours()));
}
let (today, ts) = (day(now, tz), tz.to_datetime(ts))... |
rust_dataset_chunk_2380 | rust_dataset.txt | 2,380 | 512 | ".to_owned())
} else if Some(day) == today.yesterday().ok() {
Some("yesterday".to_owned())
} else if within_week(day, today) {
Some(day.strftime("%A").to_string())
} else {
None
}
}
/// The local day `ts` falls on, in `tz`.
pub fn day(ts: Timestamp, tz: &TimeZone) -> Date {
... |
rust_dataset_chunk_2381 | rust_dataset.txt | 2,381 | 512 | ously.
fn within_week(day: Date, today: Date) -> bool {
day < today && (today - day).get_days() < 7
}
#[cfg(test)]
mod tests {
use rstest::rstest;
use super::*;
/// `2026-09-28T15:30:00Z`, a Monday afternoon.
const NOW: Timestamp = Timestamp::constant(1_790_609_400, 0);
#[rstest]
#[case:... |
rust_dataset_chunk_2382 | rust_dataset.txt | 2,382 | 512 | #[case::a_minute("2026-09-28T15:29:00Z".parse::<Timestamp>().unwrap(), "1m")]
#[case::minutes("2026-09-28T15:18:00Z".parse::<Timestamp>().unwrap(), "12m")]
#[case::an_hour("2026-09-28T14:30:00Z".parse::<Timestamp>().unwrap(), "1h")]
#[case::hours("2026-09-28T09:31:00Z".parse::<Timestamp>().unwrap(), "5h... |
rust_dataset_chunk_2383 | rust_dataset.txt | 2,383 | 512 | () {
let sydney = TimeZone::fixed(jiff::tz::offset(10));
let now = "2026-09-28T05:00:00Z".parse::<Timestamp>().unwrap();
let ts = "2026-09-27T21:30:00Z".parse::<Timestamp>().unwrap();
assert_eq!(When::of(now, ts, &sydney).short(), "07:30");
assert_eq!(When::of(now, ts, &TimeZone:... |
rust_dataset_chunk_2384 | rust_dataset.txt | 2,384 | 512 | , forks and subagents grouped under their roots, sessions from other
//! hosts, a deleted worktree (missing cwd), and live sessions (updated in the last two minutes).
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use async_trait::async_trait;
use atuin_client::ai_sessio... |
rust_dataset_chunk_2385 | rust_dataset.txt | 2,385 | 512 | from(REPO)),
branch: Some("ai-resume".to_owned()),
host_id: THIS_HOST_ID.to_owned(),
}
}
/// A bare row with sensible defaults, for tests.
pub fn row(harness: HarnessKind, id: &str, title: &str) -> SessionRow {
let started_at = now() - SignedDuration::from_hours(1);
SessionRow {
atu... |
rust_dataset_chunk_2386 | rust_dataset.txt | 2,386 | 512 | .
root: Option<HarnessSession>,
messages: Vec<(Role, &'static str)>,
}
pub struct FakeSource {
sessions: Vec<FakeSession>,
/// The rows sync holds of a session, for its branches ([`SessionSource::analyse`]).
synced: HashMap<HarnessSession, Vec<Message>>,
}
/// The session [`synced_rows`] are of.
p... |
rust_dataset_chunk_2387 | rust_dataset.txt | 2,387 | 512 | 0190_0000_0000_7000_8000_0000_0000_0000;
/// A row synced of session `handle`: `id`, hanging from `parent`, captured on host `host` (its
/// id's last digit: 1 is this host) `minutes` after the hour, a prompt or (`reply`) a reply.
pub fn synced_row(
handle: &HarnessSession,
(id, parent, host, minutes, reply): ... |
rust_dataset_chunk_2388 | rust_dataset.txt | 2,388 | 512 | wd.clone())
} else if spec.cwd.starts_with("/home/ellie/work/infra") {
Some(PathBuf::from("/home/ellie/work/infra"))
} else {
None
};
let updated_at = now() - spec.age;
// An untitled session is titled from its first prompt, as the sidecar source does.
let title = if spec.title.i... |
rust_dataset_chunk_2389 | rust_dataset.txt | 2,389 | 512 | 24 * days);
let resume = build(
Spec {
harness: ClaudeCode,
id: "7f3c9a12-5be0-4d7e-9c41-0a8e2b6f4d10",
title: "Add an interactive resume picker to atuin ai",
cwd: REPO,
branch: Some("ai-resume"),
model:... |
rust_dataset_chunk_2390 | rust_dataset.txt | 2,390 | 512 | ",
cwd: REPO,
branch: Some("ai-resume"),
model: "claude-haiku-4-5",
host: HERE,
age: m(50),
duration: m(4),
msgs: 18,
messages: vec![
(U, "Find where the history search res... |
rust_dataset_chunk_2391 | rust_dataset.txt | 2,391 | 512 | },
Relation::Fork,
Some(&resume.row),
);
let fork_explore = build(
Spec {
harness: ClaudeCode,
id: "agent-c9d0e1f2",
title: "Explore: how ratatui's Table highlights cells",
cwd: REPO,
... |
rust_dataset_chunk_2392 | rust_dataset.txt | 2,392 | 512 | messages: vec![
(U, "`record::sync::tests::sync_down` is flaky on CI, can you find out why?"),
(
A,
"It depends on **wall-clock ordering**: two records written in the same \
millisecond sort by id, not by t... |
rust_dataset_chunk_2393 | rust_dataset.txt | 2,393 | 512 | sessions.extend([wal, wal_fork]);
sessions.push(build(
Spec {
harness: ClaudeCode,
id: "b2c4d6e8-0a1b-4c3d-8e5f-6a7b8c9d0e1f",
title: "Plan the dotfiles sync redesign",
cwd: "/home/ellie/src/dotfiles",
branch: Some("ma... |
rust_dataset_chunk_2394 | rust_dataset.txt | 2,394 | 512 | (
A,
"On 180k messages: 41MB to 58MB. prefix='3' alone costs 9MB and covers \
most typing.",
),
],
},
Relation::Root,
None,
));
sessions.pu... |
rust_dataset_chunk_2395 | rust_dataset.txt | 2,395 | 512 | LETED_WORKTREE,
branch: Some("theme-preview"),
model: "gpt-5",
host: HERE,
age: d(4),
duration: h(1),
msgs: 36,
messages: vec![
(U, "Can atuin theme preview render the search UI with a can... |
rust_dataset_chunk_2396 | rust_dataset.txt | 2,396 | 512 | ints in atuin-client",
cwd: "/home/ellie/src/atuin/crates/atuin-client",
branch: Some("main"),
model: "anthropic/claude-haiku-4-5",
host: HERE,
age: d(12),
duration: m(35),
msgs: 24,
messages:... |
rust_dataset_chunk_2397 | rust_dataset.txt | 2,397 | 512 |
}
/// A source holding only `rows`.
#[cfg(test)]
pub fn from_rows(rows: Vec<SessionRow>) -> Self {
Self {
sessions: rows
.into_iter()
.map(|row| FakeSession {
row,
parent: None,
root: None,
... |
rust_dataset_chunk_2398 | rust_dataset.txt | 2,398 | 512 | &[String]) -> Vec<std::ops::Range<usize>> {
let lower = text.to_ascii_lowercase();
let ranges = terms
.iter()
.flat_map(|t| lower.match_indices(t.as_str()).map(|(i, m)| i..i + m.len()))
.collect();
super::title::merge(ranges)
}
/// A window of `text` around its first match, with hi... |
rust_dataset_chunk_2399 | rust_dataset.txt | 2,399 | 512 | _at = group.iter().map(|g| g.row.updated_at).max().unwrap_or(row.updated_at);
let mut score = 0;
if !terms.is_empty() {
let texts = group
.iter()
.flat_map(|g| {
std::iter::once(g.row.title.text.as_str())
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.