Skip to content

feat(plugins): add a read-only usage.listTurns API - #602

Merged
vastsa merged 2 commits into
mainfrom
feat/plugin-usage-api
Sep 18, 2026
Merged

vastsa merged 2 commits into
mainfrom
feat/plugin-usage-api

Conversation

@vastsa

@vastsa vastsa commented Sep 18, 2026

Copy link
Copy Markdown
Owner

#503 叠在未合的 #502 上,且和 main 冲突。这是同一刀用量 API,从当前 main 重提,不含索引/统计页。

Summary

  • pi.usage.listTurns + usage.read(medium)
  • 已完成 turn 事实行:标识符 + token 计数,无消息正文、无看板形状
  • 查询在 plugin_usage.rs,不往 rpc/mod.rs 堆 SQL
  • Electron / host 同一套窗口与 limit 校验;空标题返回 null

Test

  • cargo test -p host-core plugin_usage
  • node --test test/plugin-session-api.test.mjs
  • plugin-sdk / i18n catalogs

Relates to #478, #503. Does not replace #502.

Copilot AI lite review requested due to automatic review settings September 18, 2026 13:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Give plugins a host-owned completed-turn fact listing gated by
usage.read, so dashboards like pi.token-insights can stop reading
pi.sqlite. The host returns identifiers and token counters only:
no message body, no ranking, no dashboard shape.

Query logic lives in plugin_usage.rs. Electron and host reject the
same window/limit bounds; empty session titles serialize as null.
cargo fmt on sessions.rs and user_skills tests, and make ADR 0287/0288
H1 ids match their filenames so the host and docs jobs can pass.
@vastsa
vastsa force-pushed the feat/plugin-usage-api branch from e4c47a8 to af1580c Compare September 18, 2026 13:58
@vastsa
vastsa merged commit 77c0093 into main Sep 18, 2026
4 checks passed
@vastsa
vastsa deleted the feat/plugin-usage-api branch September 18, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants