Skip to main content

agent_session/
lib.rs

1// SPDX-License-Identifier: MIT
2// Copyright (c) 2026 eunomia-bpf org.
3
4//! Portable session IR, parsers, discovery, and process matching for local AI
5//! coding-agent transcripts.
6//!
7//! The crate currently normalizes Claude Code, Codex, and Gemini CLI sessions.
8//! It intentionally stops at session data and process/session correlation; UI,
9//! database storage, eBPF collection, and OpenTelemetry export belong in
10//! extensions that consume this crate.
11
12mod parser;
13mod process_match;
14mod types;
15#[cfg(target_arch = "wasm32")]
16mod component;
17
18pub const AGENT_CLAUDE: &str = "claude";
19pub const AGENT_CODEX: &str = "codex";
20pub const AGENT_GEMINI: &str = "gemini";
21pub const AGENT_CURSOR: &str = "cursor";
22
23pub const TRACE_EBPF_FILE: &str = "ebpf_file";
24pub const TRACE_PROC_FD: &str = "proc_fd";
25pub const TRACE_STICKY_BINDING: &str = "sticky";
26pub const TRACE_RECENT_CWD: &str = "cwd_recent";
27pub const SOURCE_SESSION_PROCESS_MATCH: &str = "agent_session.process_match";
28
29pub use types::{
30    AgentSession, LlmResponse, PlanStep, SessionCache, SessionCandidate, SessionDirStat,
31    SessionEvents, TokenUsage, ToolEvent, ToolPath, UserPrompt,
32};
33
34pub use parser::{
35    agent_source_for_path, codex_exec_prompt, codex_latest_plan, codex_total_token_usage,
36    collapse_project_path, command_process_chain, contains_private_marker, count_session_dirs,
37    count_session_dirs_in_home, discover_session_files, discover_session_files_in_dir,
38    discover_session_files_in_home, fixture_session_path, is_codex_cli_entrypoint,
39    normalize_session_log_path, parse_session_content, parse_session_file, parse_session_path,
40    path_component_strings, path_group, semantic_task_label, session_candidate_from_path,
41    session_log_path_from_str, short_hash, tool_category, truncate_clean,
42};
43
44pub use process_match::{
45    LiveProcessCandidate, ProcessKey, ProcessTree, SessionProcessInput, SessionProcessMatch,
46    SessionProcessMatcher, SessionProcessMatches,
47};