René's URL Explorer Experiment


Title: feat(agent-sessions): add the local agent session record store by xiaoyumuxi · Pull Request #199 · Lithe-IDEA/Lithe-core-rust · GitHub

Open Graph Title: feat(agent-sessions): add the local agent session record store by xiaoyumuxi · Pull Request #199 · Lithe-IDEA/Lithe-core-rust

X Title: feat(agent-sessions): add the local agent session record store by xiaoyumuxi · Pull Request #199 · Lithe-IDEA/Lithe-core-rust

Description: Summary Agent 原生调用官方 CLI 设计(1lck/Lithe-IDEA#2407,API-45)的第一阶段:新增纯 crate lithe-agent-sessions,在本地 SQLite 缓存里保存 Agent 会话的调用记录,用于调用统计、token 统计、费用估算和会话搜索。 Core 不含任何 Agent 名称、目录或格式。插件后端给出要读的根目录和 glob 规则,并把每一块完整行解析成会话、调用和索引记录;Core 负责读文件、校验、入库、统计和搜索。缓存里不存对话正文:搜索索引是 contentless FTS5,结果只返回字节范围,需要展示时再从原文件读回,文件改动后不再读回。 这个 PR 只有库本身,不改插件契约,不新增命令、MCP 工具或日志事件;这些放在第二阶段。 Changes rust/crates/agent-sessions/src/discover.rs:按插件给的根目录和 glob 列出会话文件,不跟随符号链接,每个来源最多 100000 个文件,超出时标记 truncated;根目录不存在时返回空结果,非法 glob 返回 invalid_request。 src/ingest.rs、src/store.rs(增量读取): 从游标续读追加的行,按文件大小和已读部分首尾各 4 KiB 的 SHA-256 指纹判断改写和截断,判断为改写或截断时从头重读。 末尾没有换行的行等文件写完再读;超长行跳过并计数。 某一块解析失败时,这一块下次同步会重新交给插件,失败只影响该文件。 不再列出的文件和已删除的文件会清掉对应记录。 插件输出逐项校验:ID 为不含空格的可打印 ASCII、标签长度、cwd 不含控制字符、范围落在本块内、数值上限。校验失败返回 parse_failed,详情里只写字段名,不带值。 src/store.rs(查询): 调用记录按 (agent, call_key) 去重,续接会话复制出来的调用只算一次;cwd 优先取调用所在文件的会话。 会话列表合并同一会话的多个文件,按最近活动时间排序,可按 agent、cwd、活跃时间过滤并分页。 read_range 只在文件未改动时读回字节。 缓存文件名带 schema 版本;旧版本文件、损坏的数据库或 user_version 不符的数据库会删除重建。 src/text.rs:中日韩等不用空格分词的文字按相邻二字索引,其余文字按小写单词前缀匹配;查询文本不会被当成 FTS5 语法执行(引号、OR、NEAR、-、^、列过滤都只当普通词处理)。 src/stats.rs:按 agent、模型、会话、目录或用户时区的自然日汇总调用数、失败数、压缩次数、各类 token、缓存命中率和费用;按输出速度中位数给模型排序,没有首 token 时间的调用只算下限。 src/pricing.rs:读取 models.dev 格式的价格表(最大 32 MiB),支持缓存读写价、推理价和按上下文长度分档;缓存或推理没有单独价格时按输入价计并标记为近似值。费用口径是“按 API 价格折算”,不代表订阅用户的实际支出。 src/tests/:41 个测试,覆盖上面的行为,包括“缓存目录里找不到对话原文”的检查。 留给后续阶段或需要评审关注 插件 API(API-45:agents.*、agentSessions.*)、MCP 工具 lithe_sessions_search / lithe_sessions_read 和 rust/logging/events/agent.json 日志事件在第二阶段加入,所以这个 PR 不改契约,也不改更新记录。 不记录账号字段:设计上不读取、不保存任何凭据或账号标识。 价格表随包打包和定期刷新还没做,这里只提供解析和计算。 FTS 用 detail='none',没有位置信息,所以多个词只保证都出现在同一段里,不保证相邻。 搜索结果没有在续接会话复制出的多个文件之间去重(调用统计已去重)。 只被引用、没有被插件描述过的会话行不带开始时间、更新时间和 cwd。 rusqlite 沿用工作区里 lithe-remote 已经在用的 0.32(打包 SQLite 3.46),整个工作区只链接一份 SQLite。 Verification cargo test --manifest-path rust/Cargo.toml -p lithe-agent-sessions → 41 passed cargo fmt --manifest-path rust/Cargo.toml --all -- --check → passed cargo clippy --locked --manifest-path rust/Cargo.toml -p lithe-agent-sessions --all-targets --all-features -- -D warnings → passed LIBSQLITE3_SYS_USE_PKG_CONFIG=1 ZSTD_SYS_USE_PKG_CONFIG=1 PKG_CONFIG_ALLOW_CROSS=1 cargo clippy --locked ... -p lithe-agent-sessions --all-targets --target x86_64-pc-windows-msvc -- -D warnings → passed scripts/rust-core/verify-rust-core-comments.sh agent-sessions → passed node scripts/logging/generate-log-events.mjs --check → passed node scripts/rust-core/verify-platform-tests.mjs → passed(唯一的 #[cfg(unix)] 测试是“不跟随符号链接”,在 Linux 和 macOS 上运行) node --test scripts/rust-core/*.test.mjs → 16 passed crate 内搜索 Agent 和厂商名称 → 无结果

Open Graph Description: Summary Agent 原生调用官方 CLI 设计(1lck/Lithe-IDEA#2407,API-45)的第一阶段:新增纯 crate lithe-agent-sessions,在本地 SQLite 缓存里保存 Agent 会话的调用记录,用于调用统计、token 统计、费用估算和会话搜索。 Core 不含任何 Agent 名称、目录或格式。插件后端给出要读的根目录和 glob 规则...

X Description: Summary Agent 原生调用官方 CLI 设计(1lck/Lithe-IDEA#2407,API-45)的第一阶段:新增纯 crate lithe-agent-sessions,在本地 SQLite 缓存里保存 Agent 会话的调用记录,用于调用统计、token 统计、费用估算和会话搜索。 Core 不含任何 Agent 名称、目录或格式。插件后端给出要读的根目录和 glob 规则...

Opengraph URL: https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:92820d5d-7bff-f90b-0072-0dd1c17ce398
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id806E:1FB56C:5844F:74180:6B07314D
html-safe-nonce035fb8477110f87ca50161a79785031e678a3652a029a24285e17a812f31b9f2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDZFOjFGQjU2Qzo1ODQ0Rjo3NDE4MDo2QjA3MzE0RCIsInZpc2l0b3JfaWQiOiIzMDkzNzQyNjMyNDcyODgzNTMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf6df43af6376313bd2c2828a51d72d3f84aea5bc5e7f7c08f2cce5d00292dd78
hovercard-subject-tagpull_request:5486760438
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
twitter:imagehttps://avatars.githubusercontent.com/u/145102356?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/145102356?s=400&v=4
og:image:altSummary Agent 原生调用官方 CLI 设计(1lck/Lithe-IDEA#2407,API-45)的第一阶段:新增纯 crate lithe-agent-sessions,在本地 SQLite 缓存里保存 Agent 会话的调用记录,用于调用统计、token 统计、费用估算和会话搜索。 Core 不含任何 Agent 名称、目录或格式。插件后端给出要读的根目录和 glob 规则...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None2a60952cad7efb2604ea85e500208f51c1ec1943aa260ac605c13eb46a1ed83b
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/Lithe-IDEA/Lithe-core-rust git https://github.com/Lithe-IDEA/Lithe-core-rust.git
octolytics-dimension-user_id340144206
octolytics-dimension-user_loginLithe-IDEA
octolytics-dimension-repository_id1449354685
octolytics-dimension-repository_nwoLithe-IDEA/Lithe-core-rust
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1449354685
octolytics-dimension-repository_network_root_nwoLithe-IDEA/Lithe-core-rust
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release345c27626db08417fdfc84278a4415ae9a48d8f3
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FLithe-IDEA%2FLithe-core-rust%2Fpull%2F199%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FLithe-IDEA%2FLithe-core-rust%2Fpull%2F199%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=Lithe-IDEA%2FLithe-core-rust
Reloadhttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Reloadhttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Reloadhttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Lithe-IDEAhttps://github.com/Lithe-IDEA
Lithe-core-rusthttps://github.com/Lithe-IDEA/Lithe-core-rust
Codehttps://github.com/Lithe-IDEA/Lithe-core-rust
Issues1 (1)https://github.com/Lithe-IDEA/Lithe-core-rust/issues
Pull requests2 (2)https://github.com/Lithe-IDEA/Lithe-core-rust/pulls
Actionshttps://github.com/Lithe-IDEA/Lithe-core-rust/actions
Projectshttps://github.com/Lithe-IDEA/Lithe-core-rust/projects
Security and qualityhttps://github.com/Lithe-IDEA/Lithe-core-rust/security
Insightshttps://github.com/Lithe-IDEA/Lithe-core-rust/insights
Sign up for GitHub https://github.com/signup?return_to=%2FLithe-IDEA%2FLithe-core-rust%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FLithe-IDEA%2FLithe-core-rust%2Fissues%2Fnew%2Fchoose
xiaoyumuxihttps://github.com/xiaoyumuxi
mainhttps://github.com/Lithe-IDEA/Lithe-core-rust/tree/main
feat/agent-sessions-storehttps://github.com/Lithe-IDEA/Lithe-core-rust/tree/feat/agent-sessions-store
Conversation 0 https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199
Commits 1 https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/commits
Checks 15 https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/checks
Files changed https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Please reload this pagehttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
feat(agent-sessions): add the local agent session record store https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#top
Show all changes 1 commit https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
e039c82 feat(agent-sessions): add the local agent session record store xiaoyumuxi Nov 25, 2026 https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/commits/e039c82f0bb0359e79a81413408a7962e6c2c14e
Clear filters https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Please reload this pagehttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Please reload this pagehttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Cargo.lock https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-31311f589f85f3d98efe0429e90a39407857c13a4e81dd742f1ba22fab29950a
Cargo.toml https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-7a214fea8bca4cc64494f583b83abeacf52917397399aca076380e6c4c81cb48
discover.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-a25e7e142499473dcea7d631f050e838483447735a6558adc6c63a046f720a5c
ingest.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-878837dcd448a27cb25969cf617bbca5d910a0680f024523af6d8754e35db976
lib.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-2f6b6131730dd1e693936205d3a5faa8e4212fbec50e721d23392b9edae85caf
model.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-63d852c2353191380ab3ed6c07a3c2131c5ca2994e4c82fbc09fbda274801d9b
pricing.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-d0a6f1d90d86fadc14366ad0c08941e2893f7c740d283d37f391dc1f3cdbce5e
stats.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-89f1c6e3d180295f147fcf60de2c5fa09046cb789cbab5fcc9965bf9544a1b14
store.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-6f9532ae1e85e13f736921f4f9f9a440b00b7d8bbf7289f50db9a791241ee34d
discover.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-94ad6831f203a029184ba3420a32ce06319a32b81779d81da83ebcdf74e14c3f
mod.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-df5b183de73337f77afe7e238c3223aec1f18f2ec2d76bfb0a3ce5e635c0610a
pricing.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-f5ce748e8343ec09889b0ffbf6d20972470d4b85f9346c8880843d3e1ec9fb2f
stats.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-625e7093c351862b6072653ad412c724c0edd8449652b05ba846b18a8fd5b217
store.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-ec038f55e48ae2564b4d7592bdd30de2b41f649d3efe42a3bef70bddffc8ccd7
text.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-7612eefeced31b77a902b679bdbafbfd73a243418c1356811454c6be5367ed30
text.rs https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-ff38b37ae12dc160e919dba4c1a962f45e37ab3a1701e2b9b425d8350d938f27
rust/Cargo.lockhttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-31311f589f85f3d98efe0429e90a39407857c13a4e81dd742f1ba22fab29950a
View file https://github.com/Lithe-IDEA/Lithe-core-rust/blob/e039c82f0bb0359e79a81413408a7962e6c2c14e/rust/Cargo.lock
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
rust/crates/agent-sessions/Cargo.tomlhttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-7a214fea8bca4cc64494f583b83abeacf52917397399aca076380e6c4c81cb48
View file https://github.com/Lithe-IDEA/Lithe-core-rust/blob/e039c82f0bb0359e79a81413408a7962e6c2c14e/rust/crates/agent-sessions/Cargo.toml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/{{ revealButtonHref }}
rust/crates/agent-sessions/src/discover.rshttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files#diff-a25e7e142499473dcea7d631f050e838483447735a6558adc6c63a046f720a5c
View file https://github.com/Lithe-IDEA/Lithe-core-rust/blob/e039c82f0bb0359e79a81413408a7962e6c2c14e/rust/crates/agent-sessions/src/discover.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/{{ revealButtonHref }}
Please reload this pagehttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
Please reload this pagehttps://github.com/Lithe-IDEA/Lithe-core-rust/pull/199/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.