session-trail 0.3.2__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. {session_trail-0.3.2/src/session_trail.egg-info → session_trail-0.6.0}/PKG-INFO +42 -22
  2. {session_trail-0.3.2 → session_trail-0.6.0}/README.en.md +38 -19
  3. {session_trail-0.3.2 → session_trail-0.6.0}/README.md +39 -19
  4. {session_trail-0.3.2 → session_trail-0.6.0}/pyproject.toml +3 -3
  5. session_trail-0.6.0/src/agent_trail/acp.py +370 -0
  6. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/base.py +24 -1
  7. session_trail-0.6.0/src/agent_trail/adapters/chat_parsers.py +372 -0
  8. session_trail-0.6.0/src/agent_trail/adapters/claude_code.py +209 -0
  9. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/codebuddy.py +81 -2
  10. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/codex.py +83 -2
  11. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/jsonl_utils.py +20 -0
  12. session_trail-0.6.0/src/agent_trail/adapters/kimi_code.py +224 -0
  13. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/minimax_code.py +63 -1
  14. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/opencode.py +144 -1
  15. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/pi.py +60 -2
  16. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/zcode.py +90 -1
  17. session_trail-0.6.0/src/agent_trail/chat.py +770 -0
  18. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/cli.py +51 -3
  19. session_trail-0.6.0/src/agent_trail/content.py +169 -0
  20. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/launcher.py +3 -1
  21. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/models.py +87 -0
  22. session_trail-0.6.0/src/agent_trail/server.py +652 -0
  23. session_trail-0.6.0/src/agent_trail/static/app.js +1712 -0
  24. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/static/i18n.js +166 -4
  25. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/static/index.html +91 -3
  26. session_trail-0.6.0/src/agent_trail/static/styles.css +918 -0
  27. session_trail-0.6.0/src/agent_trail/store.py +644 -0
  28. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/tray/app.py +171 -10
  29. session_trail-0.6.0/src/agent_trail/tray/desktop.template +11 -0
  30. session_trail-0.6.0/src/agent_trail/update.py +169 -0
  31. {session_trail-0.3.2 → session_trail-0.6.0/src/session_trail.egg-info}/PKG-INFO +42 -22
  32. {session_trail-0.3.2 → session_trail-0.6.0}/src/session_trail.egg-info/SOURCES.txt +5 -0
  33. session_trail-0.3.2/src/agent_trail/adapters/claude_code.py +0 -45
  34. session_trail-0.3.2/src/agent_trail/adapters/kimi_code.py +0 -114
  35. session_trail-0.3.2/src/agent_trail/server.py +0 -260
  36. session_trail-0.3.2/src/agent_trail/static/app.js +0 -525
  37. session_trail-0.3.2/src/agent_trail/static/styles.css +0 -307
  38. session_trail-0.3.2/src/agent_trail/store.py +0 -197
  39. session_trail-0.3.2/src/agent_trail/tray/desktop.template +0 -10
  40. {session_trail-0.3.2 → session_trail-0.6.0}/LICENSE +0 -0
  41. {session_trail-0.3.2 → session_trail-0.6.0}/MANIFEST.in +0 -0
  42. {session_trail-0.3.2 → session_trail-0.6.0}/setup.cfg +0 -0
  43. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/__init__.py +0 -0
  44. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/__main__.py +0 -0
  45. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/__init__.py +0 -0
  46. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/deepseek_harness.py +0 -0
  47. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/adapters/sqlite_utils.py +0 -0
  48. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/scanner.py +0 -0
  49. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/tray/__init__.py +0 -0
  50. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/tray/icon.png +0 -0
  51. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/tray/sni.py +0 -0
  52. {session_trail-0.3.2 → session_trail-0.6.0}/src/agent_trail/watcher.py +0 -0
  53. {session_trail-0.3.2 → session_trail-0.6.0}/src/session_trail.egg-info/dependency_links.txt +0 -0
  54. {session_trail-0.3.2 → session_trail-0.6.0}/src/session_trail.egg-info/entry_points.txt +0 -0
  55. {session_trail-0.3.2 → session_trail-0.6.0}/src/session_trail.egg-info/requires.txt +0 -0
  56. {session_trail-0.3.2 → session_trail-0.6.0}/src/session_trail.egg-info/top_level.txt +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: session-trail
3
- Version: 0.3.2
4
- Summary: Local cross-agent work timeline: discover, browse and resume coding-agent sessions on your machine
3
+ Version: 0.6.0
4
+ Summary: Local agent workbench: a cross-agent session timeline plus in-app chat with your coding agents, all local-first
5
5
  Author: fwt11
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/fwt11/agent_trail
8
8
  Project-URL: Repository, https://github.com/fwt11/agent_trail
9
9
  Project-URL: Issues, https://github.com/fwt11/agent_trail/issues
10
- Keywords: ai-agents,coding-agent,timeline,session-management,local-first,tray,systray
10
+ Keywords: ai-agents,coding-agent,timeline,session-management,local-first,tray,systray,chat,workbench
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Environment :: Web Environment
13
13
  Classifier: Environment :: X11 Applications
@@ -34,7 +34,7 @@ Dynamic: license-file
34
34
 
35
35
  中文 | [English](README.en.md)
36
36
 
37
- 跨 Agent 的本地工作记忆:自动发现你机器上各种编码 Agent 留下的会话记录,汇成一条按日期分组的时间线,帮你回答"昨天那个东西我到底是用哪个工具、在哪个目录做的",并尽量一键回到原会话继续工作。
37
+ 本地 Agent 工作台:一边是跨 Agent 的会话时间线——自动发现你机器上各种编码 Agent 留下的会话记录,汇成一条按日期分组的统一视图;一边是应用内对话——直接和已安装的 Agent CLI 流式聊天,全程数据不出本机。
38
38
 
39
39
  ![时间线截图](docs/screenshot.png)
40
40
 
@@ -44,11 +44,16 @@ Dynamic: license-file
44
44
 
45
45
  - **自动发现**:只读扫描各 Agent 已保存的本机会话(JSONL / JSON / SQLite),不改变任何现有使用习惯
46
46
  - **统一时间线**:按本地日期分组、按最后活动时间倒序;支持今天/昨天/最近 7 天、Agent、项目目录和标题/目录文本筛选
47
+ - **会话正文查看**:在详情弹窗里直接查看会话消息(支持 Markdown 渲染),按需惰性读取,只落本机
48
+ - **全文检索**:对会话正文建本地 FTS5 索引,顶栏搜索框即输即搜,命中片段高亮并可跳转会话(FTS5 不可用时自动降级 LIKE)
49
+ - **应用内对话**:新建对话线程,与 Kimi Code(`kimi -p`,真机验证)、Claude Code(`claude -p`)、Codex(`codex exec`)、OpenCode(`opencode run`)流式对话;线程历史持久化、可续聊、可随时停止
50
+ - **对话附件**:图片与文件可作为附件发送——同机零拷贝(服务端文件浏览器选文件,只传路径,agent 直读原文件),拖拽/粘贴/上传自动落盘 `chat_uploads/`;走 ACP `resource_link` 原语
47
51
  - **实时更新**:Linux 下用 inotify 监控源文件变化,秒级反映新会话(不可用时自动回退到定时轮询)
48
52
  - **工作段折叠**:同一 Agent、同一目录、相邻间隔 ≤45 分钟的会话可折叠为一段,展开仍能定位每个原会话
49
53
  - **回到原会话**:对真实验证过恢复路径的工具,在原工作目录起一个新终端执行对应恢复命令
50
- - **隐私优先**:本地索引只存元数据(标题、目录、时间、统计),不存任何消息正文、代码、diff 或凭据;HTTP 服务只绑定 127.0.0.1,每次启动生成高熵访问令牌
51
- - **诚实降级**:没有原生标题就显示"未命名会话",恢复路径没验证过就不显示恢复按钮,绝不伪造
54
+ - **隐私优先**:正文只在本机索引(可用 `--no-content-index` 整体关闭),从不外传;HTTP 服务只绑定 127.0.0.1,每次启动生成高熵访问令牌
55
+ - **诚实降级**:没有原生标题就显示"未命名会话",恢复路径没验证过就不显示恢复按钮,CLI 不在 PATH 就如实提示,绝不伪造
56
+ - **版本更新**:每日静默检查 PyPI(仅版本号元数据,可关闭),有新版时托盘菜单与控制台提示;升级必须显式点击(托盘编排:停 serve → pip/pipx 升级 → 重启 serve),PEP 668 受管环境诚实降级为手动命令
52
57
 
53
58
  ## 平台支持
54
59
 
@@ -63,17 +68,17 @@ Dynamic: license-file
63
68
 
64
69
  ## 支持的 Agent
65
70
 
66
- | Agent | 时间线 | 回到原会话 | 说明 |
67
- | --- | :-: | :-: | --- |
68
- | Kimi Code | ✅ | ✅ | `kimi --session <id>`,真机验证 |
69
- | CodeBuddy | ✅ | ✅ | `codebuddy --resume <id>`,真机验证 |
70
- | MiniMax Code | ✅ | ✅ | `mcode --session <id>`,主会话真机验证;子代理会话只读 |
71
- | OpenCode | ✅ | ✅ | `opencode --session <id>`,真机验证 |
72
- | ZCode | ✅ | ➖ | 深链路由未验证,只读展示 |
73
- | DeepSeek Harness | ✅ | ➖ | 恢复未通过真机验证,只读展示 |
74
- | Pi | ✅ | ➖ | 恢复未通过真机验证,只读展示 |
75
- | Codex | ✅ | ➖ | 恢复需要目录信任决策,未授权验证,只读展示 |
76
- | Claude Code | ⚠️ | ➖ | 实验性检测,本机无数据时不产生虚假记录 |
71
+ | Agent | 时间线 | 正文查看 | 应用内对话 | 回到原会话 | 说明 |
72
+ | --- | :-: | :-: | :-: | :-: | --- |
73
+ | Kimi Code | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`kimi acp`,真机全能力实证:流式/思考流/工具步骤/模型与思考强度与模式切换/多轮上下文/会话恢复);恢复 `kimi --session <id>` |
74
+ | ZCode | ✅ | ✅ | ➖ | ➖ | 正文读 CLI 库 message/part 表(真机确认);内嵌的是 ACP 客户端 SDK,未发现服务端入口;深链未验证 |
75
+ | MiniMax Code | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`mcode acp`,官方文档确认 + 客户端链路已验证;本机未装 CLI,真机待验);正文读 `local_runtime_message_rows`;恢复 `mcode --session <id>` |
76
+ | CodeBuddy | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`codebuddy --acp`,官方 ACP registry 确认,已在 Zed 实测可用;本机未装 CLI,真机待验);正文读项目 JSONL;`ai-title` 作原生标题;恢复 `codebuddy --resume <id>` |
77
+ | OpenCode | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`opencode acp`,v2.4.2 原生支持);恢复 `opencode --session <id>`,真机验证 |
78
+ | Codex | ✅ | ✅ | ✅ | ➖ | **ACP 主通道**经官方适配器 `@agentclientprotocol/codex-acp`(需 Node);one-shot `codex exec` 回退;恢复需目录信任决策 |
79
+ | Claude Code | ⚠️ | ✅ | ✅ | ➖ | **ACP 主通道**经官方适配器 `claude-agent-acp`(Anthropic/Zed/JetBrains,二进制分发,需安装);one-shot `claude -p`(partial 真流式)回退 |
80
+ | Pi | ✅ | ✅ | ➖ | ➖ | 正文读会话 JSONL;恢复未验证 |
81
+ | DeepSeek Harness | ✅ | ➖ | ➖ | ➖ | 会话正文是 zstd 压缩格式,零依赖原则下不解析;恢复未验证 |
77
82
 
78
83
  ## 安装
79
84
 
@@ -98,6 +103,8 @@ agent-trail scan # 扫描一次,输出各来源状态与记录数
98
103
  agent-trail list # 以 JSON Lines 输出全部会话元数据
99
104
  agent-trail serve # 启动本地控制台(默认自动打开浏览器)
100
105
  agent-trail tray # 系统托盘形态(Linux,见下)
106
+ agent-trail update # 检查并升级到 PyPI 最新版(--check 仅检查)
107
+ agent-trail version # 打印已安装与最新版本
101
108
  ```
102
109
 
103
110
  `serve` 常用选项:
@@ -107,10 +114,17 @@ agent-trail serve --port 8731 # 固定端口(默认随机)
107
114
  agent-trail serve --no-browser # 不自动打开浏览器
108
115
  agent-trail serve --no-watch # 禁用 inotify,只用定时轮询
109
116
  agent-trail serve --interval 30 # 轮询间隔(watch 健康时自动降为 5 分钟安全网)
117
+ agent-trail serve --no-content-index # 关闭正文索引(隐私优先模式:全文搜索与消息查看停用,对话仍可用)
110
118
  ```
111
119
 
112
120
  启动后控制台 URL 带一次性高熵访问令牌(如 `http://127.0.0.1:8731/?key=…`);令牌保存在浏览器 sessionStorage,后续请求通过请求头携带,所有 API 都会校验。手动刷新按钮立即触发一次扫描。
113
121
 
122
+ ### 工作台:正文 / 搜索 / 对话
123
+
124
+ - **正文与搜索**:扫描后后台增量索引支持查看的来源;顶栏搜索框全文检索正文,点击命中直接打开会话并定位正文。索引只写本机 `~/.agent-trail/index.sqlite`,每会话封顶 2000 条消息、单条 20KB。
125
+ - **对话**:切换到「对话」视图 → 选 Agent 与工作目录 → 新建对话。线程自动以首条消息命名,Agent 回复流式渲染(Markdown 代码块等),回合结束自动保存历史;对支持续聊的 CLI(claude/codex/opencode)自动记住会话引用,同一线程可继续追问。「停止」按钮会终止整个进程组(Agent 派生的子工具进程一并停止)。
126
+ - 对话不依赖任何服务器:所有流量走本机回环 + 令牌,Agent 子进程在你指定的工作目录里运行。
127
+
114
128
  ## 桌面托盘(Linux)
115
129
 
116
130
  `serve` 之外还有系统托盘形态,已整合为子命令:内嵌窗口展示控制台,托盘菜单提供打开控制台、立即刷新、启动/停止服务、开机自启和退出。
@@ -147,25 +161,31 @@ Windows 自启动写注册表 HKCU Run 键;后台运行经 pythonw 脱离终
147
161
  JSONL / JSON / SQLite ─▶ 适配器(9 种,只读) ─▶ 元数据索引 ─▶ 本地网页时间线
148
162
  ~/.kimi-code/… 规范化为统一模型 (SQLite) 127.0.0.1 + 令牌
149
163
  ~/.zcode/… 指纹增量去重 筛选 / 详情 / 恢复
150
- ~/.codex/… inotify 事件触发重扫
164
+ ~/.codex/… inotify 事件触发重扫 正文查看 / 全文检索
165
+ 应用内对话(SSE 流式)
166
+ claude / codex / opencode ─▶ ChatManager(argv 白名单)─▶ 子进程 stdout 事件 ─▶ 对话线程持久化
151
167
  ```
152
168
 
153
- - **适配器契约**:每个 Agent 一个适配器,实现发现(discover)、扫描(scan)、状态(status)、恢复计划(resume_plan)四个边界;数据源格式变化时报告不兼容而不是猜测
169
+ - **适配器契约**:每个 Agent 一个适配器,实现发现(discover)、扫描(scan)、状态(status)、恢复计划(resume_plan)四个边界,另有可选的正文读取(read_messages)与聊天能力(chat_support);数据源格式变化时报告不兼容而不是猜测
154
170
  - **增量扫描**:以源路径、大小、mtime 和适配器版本计算指纹,未变化的来源毫秒级跳过
155
171
  - **实时监控**:`watcher.py` 用 ctypes 直接调 libc inotify(保持零依赖),目录级 watch 覆盖原子替换与 WAL sidecar 变化;去抖 + 最小间隔合并高频写入
156
172
  - **恢复安全**:恢复命令来自适配器白名单参数数组,不经过 shell;API 只接受会话标识,服务端重新查库生成计划,调用者无法注入命令或目录
173
+ - **对话安全**:聊天子进程用 argv 数组 + 双重白名单启动,prompt 经 stdin 或单个 argv 元素传入;POSIX 独立进程组启动、整组终止;并发与超时双封顶
157
174
  - **源数据只读**:SQLite 源以 `mode=ro` 打开,禁止任何写事务;源记录删除后保留最后元数据并标记"源已缺失"、禁用恢复
158
175
 
159
176
  ## 隐私与安全
160
177
 
161
178
  - 明确不读取各工具的 credentials、auth、token、密钥类文件
162
- - 本地索引与日志不保存消息正文、代码、命令、diff、附件或凭据
163
- - HTTP 仅绑定回环地址;刷新与恢复使用 POST 并校验 Origin,防止外部网页诱导本机服务执行动作
179
+ - 消息正文仅在本机索引与展示,绝不上传;`--no-content-index` 可整体关闭正文能力
180
+ - HTTP 仅绑定回环地址;刷新、恢复、对话全部校验令牌与 Origin,防止外部网页诱导本机服务执行动作
164
181
  - 网页不加载任何第三方脚本、字体或统计
165
182
 
166
183
  ## 已知限制
167
184
 
168
- - 元数据优先:部分会话只有"未命名会话",以目录和时间辅助识别;不读取首条用户消息补标题
185
+ - 应用内对话走 ACP 通道:Kimi Code(真机验证)与 MiniMax Code(官方文档确认)原生支持;Claude Code / Codex 经 npm 适配器接入(Phase 2,需 Node);CodeBuddy 官方称兼容 ACP 但入口未验证;ZCode 未发现 ACP 服务端入口
186
+ - 交互审批(允许/拒绝卡片)按 ACP `session/request_permission` 协议实现并经合成链路验证;实测 kimi 当前在 default 模式不发起权限请求,触发待上游支持
187
+ - 正文查看支持 Kimi Code、ZCode、MiniMax Code、CodeBuddy、OpenCode、Codex、Claude Code、Pi;DeepSeek Harness 的正文是 zstd 压缩格式,零依赖原则下不解析
188
+ - 部分会话只有"未命名会话",以目录和时间辅助识别
169
189
  - 适配器基于当前各工具的本机数据格式,工具升级后可能需要更新
170
190
  - "回到工作现场"指原 Agent 会话与目录,不保证恢复未保存的文件或桌面布局
171
191
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  [中文](README.md) | English
4
4
 
5
- A local-first work memory for people who use multiple coding agents: it discovers the sessions your agents already saved on this machine, lines them up on one dated timeline, and — where verified — drops you back into the original session with one click. Answers the "I did something yesterday… with which tool, in which directory?" problem.
5
+ A local agent workbench: on one side a cross-agent session timeline — it discovers the sessions your agents already saved on this machine and lines them up on one dated view; on the other side in-app chat that streams conversations with your installed agent CLIs, with every byte staying on this machine. Answers the "I did something yesterday… with which tool, in which directory?" problem.
6
6
 
7
7
  ![Timeline screenshot](docs/screenshot.png)
8
8
 
@@ -10,11 +10,16 @@ A local-first work memory for people who use multiple coding agents: it discover
10
10
 
11
11
  - **Automatic discovery**: read-only scanning of the sessions each agent already stores locally (JSONL / JSON / SQLite); nothing about your existing habits changes
12
12
  - **One timeline**: grouped by local date, newest first; filter by today/yesterday/last 7 days, agent, project directory, and title/directory text
13
+ - **Session message viewer**: read the actual messages of a session in the detail dialog (with Markdown rendering), lazily parsed and stored locally only
14
+ - **Full-text search**: a local FTS5 index over message bodies, searchable from the header box with highlighted snippets that jump to the session (falls back to LIKE when FTS5 is unavailable)
15
+ - **In-app chat**: start threads and talk to Kimi Code (`kimi -p`, verified on a real machine), Claude Code (`claude -p`), Codex (`codex exec`) or OpenCode (`opencode run`) with streaming replies; thread history persists, resumes across turns, and can be stopped at any time
16
+ - **Chat attachments**: send images and files with a message — zero-copy on the same machine (server-side file browser selects the file, only the path is passed and the agent reads the original), drag/paste/upload auto-saves under `chat_uploads/`; transported via ACP `resource_link`
13
17
  - **Live updates**: on Linux, inotify watches the source files and reflects new sessions within seconds (falls back to interval polling automatically)
14
18
  - **Work segments**: sessions from the same tool, same directory, within 45 minutes fold into one segment — expandable down to every original session
15
19
  - **Resume original session**: for tools whose resume path is verified, opens a new terminal in the original working directory
16
- - **Privacy first**: the local index stores metadata only (titles, directories, timestamps, stats) — never message bodies, code, diffs or credentials; the HTTP console binds to 127.0.0.1 with a per-start high-entropy access token
17
- - **Honest degradation**: no native title → "Unnamed session"; unverified resume paths → no resume button. It never fakes capabilities
20
+ - **Privacy first**: message bodies are indexed locally only (disable everything with `--no-content-index`) and never leave the machine; the HTTP console binds to 127.0.0.1 with a per-start high-entropy access token
21
+ - **Honest degradation**: no native title → "Unnamed session"; unverified resume paths → no resume button; missing CLI → plainly reported. It never fakes capabilities
22
+ - **Updates**: daily silent PyPI check (version metadata only, opt-out), new versions surface in the tray menu and console; upgrading is always user-initiated (tray orchestrates: stop serve → pip/pipx upgrade → restart serve); PEP 668 managed environments degrade to a manual command
18
23
  - **i18n**: the console UI and tray menu ship in Simplified Chinese and English; the console follows your browser language (`?lang=en` / `?lang=zh-CN` to override), the tray follows `LANG` (`AGENT_TRAIL_LANG` overrides)
19
24
 
20
25
  ## Platform support
@@ -30,17 +35,17 @@ Data paths: Windows/macOS locations for the open-source CLIs are confirmed from
30
35
 
31
36
  ## Supported agents
32
37
 
33
- | Agent | Timeline | Resume | Notes |
34
- | --- | :-: | :-: | --- |
35
- | Kimi Code | ✅ | ✅ | `kimi --session <id>`, verified on a real machine |
36
- | CodeBuddy | ✅ | ✅ | `codebuddy --resume <id>`, verified |
37
- | MiniMax Code | ✅ | ✅ | `mcode --session <id>`, verified for main sessions; subagent sessions are view-only |
38
- | OpenCode | ✅ | ✅ | `opencode --session <id>`, verified |
39
- | ZCode | ✅ | ➖ | deep-link route unverified; view-only |
40
- | DeepSeek Harness | ✅ | ➖ | resume failed verification; view-only |
41
- | Pi | ✅ | ➖ | resume failed verification; view-only |
42
- | Codex | ✅ | ➖ | resume needs an interactive directory-trust decision; view-only |
43
- | Claude Code | ⚠️ | ➖ | experimental detection; no fake records without real data |
38
+ | Agent | Timeline | Messages | In-app chat | Resume | Notes |
39
+ | --- | :-: | :-: | :-: | :-: | --- |
40
+ | Kimi Code | ✅ | ✅ | ✅ | ✅ | chat `kimi -p --output-format stream-json` (verified on a real machine, `--session` resume supported) |
41
+ | ZCode | ✅ | ✅ | ➖ | ➖ | bodies read from the CLI db message/part tables (confirmed on a real machine); the desktop app exposes no verifiable headless CLI yet |
42
+ | MiniMax Code | ✅ | ✅ | ➖ | ✅ | bodies read from `local_runtime_message_rows` (msg_type=1 display messages); resume `mcode --session <id>` verified |
43
+ | CodeBuddy | ✅ | ✅ | ➖ | ✅ | bodies read from project JSONL; `ai-title` records serve as native titles; resume `codebuddy --resume <id>` verified |
44
+ | OpenCode | ✅ | ✅ | ✅ | ✅ | chat `opencode run`; resume `opencode --session <id>`, verified |
45
+ | Codex | ✅ | ✅ | ✅ | ➖ | chat `codex exec`; resume needs an interactive directory-trust decision |
46
+ | Claude Code | ⚠️ | ✅ | ✅ | ➖ | metadata/messages are experimental parsing; chat `claude -p` (prompt via stdin) |
47
+ | Pi | ✅ | ✅ | ➖ | ➖ | bodies read from session JSONL; resume unverified |
48
+ | DeepSeek Harness | ✅ | ➖ | ➖ | ➖ | bodies are zstd-compressed and not parsed under the zero-dependency rule; resume unverified |
44
49
 
45
50
  ## Install
46
51
 
@@ -65,6 +70,8 @@ agent-trail scan # scan once, print per-source status and record counts
65
70
  agent-trail list # print all session metadata as JSON Lines
66
71
  agent-trail serve # start the local console (opens the browser by default)
67
72
  agent-trail tray # system tray app (Linux, see below)
73
+ agent-trail update # check PyPI and upgrade in place (--check to only check)
74
+ agent-trail version # print installed and latest versions
68
75
  ```
69
76
 
70
77
  Common `serve` options:
@@ -74,10 +81,17 @@ agent-trail serve --port 8731 # fixed port (random by default)
74
81
  agent-trail serve --no-browser # do not open the browser
75
82
  agent-trail serve --no-watch # disable inotify, poll on an interval
76
83
  agent-trail serve --interval 30 # poll interval (drops to a 5-minute safety net while watching)
84
+ agent-trail serve --no-content-index # disable body indexing (privacy-first: search & message views off, chat still works)
77
85
  ```
78
86
 
79
87
  The console URL carries a one-time high-entropy token (`http://127.0.0.1:8731/?key=…`); the token lives in the browser's sessionStorage and every API call is checked. The refresh button triggers a scan immediately.
80
88
 
89
+ ### Workbench: messages / search / chat
90
+
91
+ - **Messages & search**: supported sources are indexed in the background after each scan; the header search box full-texts message bodies, and clicking a hit opens the session with its messages. The index lives only in `~/.agent-trail/index.sqlite`, capped at 2000 messages per session and 20 KB per message.
92
+ - **Chat**: switch to the "Chat" view → pick an agent and working directory → new chat. Threads are auto-titled from the first message, agent replies stream in with Markdown rendering, and each finished turn is persisted. For CLIs that support it (claude/codex/opencode) the session reference is remembered so a thread can continue across turns. "Stop" terminates the whole process group (agent-spawned tool processes included).
93
+ - Chat needs no server: all traffic stays on loopback behind the token, and agent subprocesses run inside the working directory you choose.
94
+
81
95
  ## Desktop tray (Linux)
82
96
 
83
97
  Beyond `serve`, a tray application embeds the console in a native window and adds a tray menu: open console, refresh, start/stop service, launch at login, quit.
@@ -114,25 +128,30 @@ Agent session data this tool presentation
114
128
  JSONL / JSON / SQLite ─▶ 9 read-only adapters ─▶ metadata index ─▶ local web console
115
129
  ~/.kimi-code/… normalized model (SQLite) 127.0.0.1 + token
116
130
  ~/.zcode/… fingerprinted deltas filters / details / resume
117
- ~/.codex/… inotify-triggered rescans
131
+ ~/.codex/… inotify-triggered rescans message views / full-text search
132
+ in-app chat (SSE streaming)
133
+ claude / codex / opencode ─▶ ChatManager (argv whitelist) ─▶ subprocess stdout events ─▶ persisted threads
118
134
  ```
119
135
 
120
- - **Adapter contract**: one adapter per agent implementing discover / scan / status / resume_plan; incompatible formats are reported, never guessed
136
+ - **Adapter contract**: one adapter per agent implementing discover / scan / status / resume_plan, plus optional read_messages (bodies) and chat_support (headless chat); incompatible formats are reported, never guessed
121
137
  - **Incremental scans**: a fingerprint over source paths, sizes, mtimes and adapter version; unchanged sources skip in milliseconds
122
138
  - **Live watching**: `watcher.py` calls libc inotify via ctypes (staying dependency-free); directory-level watches cover atomic renames and WAL sidecars; debounce + minimum spacing merge write bursts
123
139
  - **Resume safety**: resume commands come from an adapter whitelist and run as argument arrays — never through a shell; the API only accepts session identifiers and regenerates the plan server-side
140
+ - **Chat safety**: chat subprocesses launch from a double whitelist (backend registry + shutil.which) with argv arrays; the prompt goes through stdin or a single argv element; POSIX runs them in their own process group and cancels kill the whole group; concurrency and wall-clock timeouts are capped
124
141
  - **Source data is read-only**: SQLite sources open with `mode=ro`; deleted source records keep their last metadata, flagged missing with resume disabled
125
142
 
126
143
  ## Privacy & security
127
144
 
128
145
  - Never reads credentials, auth, token, or key files of any agent
129
- - The local index and logs contain no message bodies, code, commands, diffs, attachments or credentials
130
- - HTTP binds to the loopback interface only; refresh and resume are POST with Origin checks, so foreign web pages cannot drive the local service
146
+ - Message bodies are indexed and shown locally only, never uploaded; `--no-content-index` turns body features off entirely
147
+ - HTTP binds to the loopback interface only; refresh, resume and chat are POST with Origin checks (and the token), so foreign web pages cannot drive the local service
131
148
  - The web console loads no third-party scripts, fonts or analytics
132
149
 
133
150
  ## Known limitations
134
151
 
135
- - Metadata-first: some sessions appear as "Unnamed session", identified by directory and time; first user messages are never read to fabricate titles
152
+ - Message viewing covers Kimi Code, ZCode, MiniMax Code, CodeBuddy, OpenCode, Codex, Claude Code and Pi; DeepSeek Harness bodies are zstd-compressed and not parsed under the zero-dependency rule
153
+ - In-app chat requires the CLI in PATH (kimi / claude / codex / opencode); ZCode, CodeBuddy and MiniMax have no verifiable headless mode yet and fall back to terminal resume
154
+ - Some sessions appear as "Unnamed session", identified by directory and time
136
155
  - Adapters target current on-disk formats; tool upgrades may require adapter updates
137
156
  - "Back to the work site" means the original agent session and directory — unsaved files or desktop layout are not restored
138
157
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  中文 | [English](README.en.md)
4
4
 
5
- 跨 Agent 的本地工作记忆:自动发现你机器上各种编码 Agent 留下的会话记录,汇成一条按日期分组的时间线,帮你回答"昨天那个东西我到底是用哪个工具、在哪个目录做的",并尽量一键回到原会话继续工作。
5
+ 本地 Agent 工作台:一边是跨 Agent 的会话时间线——自动发现你机器上各种编码 Agent 留下的会话记录,汇成一条按日期分组的统一视图;一边是应用内对话——直接和已安装的 Agent CLI 流式聊天,全程数据不出本机。
6
6
 
7
7
  ![时间线截图](docs/screenshot.png)
8
8
 
@@ -12,11 +12,16 @@
12
12
 
13
13
  - **自动发现**:只读扫描各 Agent 已保存的本机会话(JSONL / JSON / SQLite),不改变任何现有使用习惯
14
14
  - **统一时间线**:按本地日期分组、按最后活动时间倒序;支持今天/昨天/最近 7 天、Agent、项目目录和标题/目录文本筛选
15
+ - **会话正文查看**:在详情弹窗里直接查看会话消息(支持 Markdown 渲染),按需惰性读取,只落本机
16
+ - **全文检索**:对会话正文建本地 FTS5 索引,顶栏搜索框即输即搜,命中片段高亮并可跳转会话(FTS5 不可用时自动降级 LIKE)
17
+ - **应用内对话**:新建对话线程,与 Kimi Code(`kimi -p`,真机验证)、Claude Code(`claude -p`)、Codex(`codex exec`)、OpenCode(`opencode run`)流式对话;线程历史持久化、可续聊、可随时停止
18
+ - **对话附件**:图片与文件可作为附件发送——同机零拷贝(服务端文件浏览器选文件,只传路径,agent 直读原文件),拖拽/粘贴/上传自动落盘 `chat_uploads/`;走 ACP `resource_link` 原语
15
19
  - **实时更新**:Linux 下用 inotify 监控源文件变化,秒级反映新会话(不可用时自动回退到定时轮询)
16
20
  - **工作段折叠**:同一 Agent、同一目录、相邻间隔 ≤45 分钟的会话可折叠为一段,展开仍能定位每个原会话
17
21
  - **回到原会话**:对真实验证过恢复路径的工具,在原工作目录起一个新终端执行对应恢复命令
18
- - **隐私优先**:本地索引只存元数据(标题、目录、时间、统计),不存任何消息正文、代码、diff 或凭据;HTTP 服务只绑定 127.0.0.1,每次启动生成高熵访问令牌
19
- - **诚实降级**:没有原生标题就显示"未命名会话",恢复路径没验证过就不显示恢复按钮,绝不伪造
22
+ - **隐私优先**:正文只在本机索引(可用 `--no-content-index` 整体关闭),从不外传;HTTP 服务只绑定 127.0.0.1,每次启动生成高熵访问令牌
23
+ - **诚实降级**:没有原生标题就显示"未命名会话",恢复路径没验证过就不显示恢复按钮,CLI 不在 PATH 就如实提示,绝不伪造
24
+ - **版本更新**:每日静默检查 PyPI(仅版本号元数据,可关闭),有新版时托盘菜单与控制台提示;升级必须显式点击(托盘编排:停 serve → pip/pipx 升级 → 重启 serve),PEP 668 受管环境诚实降级为手动命令
20
25
 
21
26
  ## 平台支持
22
27
 
@@ -31,17 +36,17 @@
31
36
 
32
37
  ## 支持的 Agent
33
38
 
34
- | Agent | 时间线 | 回到原会话 | 说明 |
35
- | --- | :-: | :-: | --- |
36
- | Kimi Code | ✅ | ✅ | `kimi --session <id>`,真机验证 |
37
- | CodeBuddy | ✅ | ✅ | `codebuddy --resume <id>`,真机验证 |
38
- | MiniMax Code | ✅ | ✅ | `mcode --session <id>`,主会话真机验证;子代理会话只读 |
39
- | OpenCode | ✅ | ✅ | `opencode --session <id>`,真机验证 |
40
- | ZCode | ✅ | ➖ | 深链路由未验证,只读展示 |
41
- | DeepSeek Harness | ✅ | ➖ | 恢复未通过真机验证,只读展示 |
42
- | Pi | ✅ | ➖ | 恢复未通过真机验证,只读展示 |
43
- | Codex | ✅ | ➖ | 恢复需要目录信任决策,未授权验证,只读展示 |
44
- | Claude Code | ⚠️ | ➖ | 实验性检测,本机无数据时不产生虚假记录 |
39
+ | Agent | 时间线 | 正文查看 | 应用内对话 | 回到原会话 | 说明 |
40
+ | --- | :-: | :-: | :-: | :-: | --- |
41
+ | Kimi Code | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`kimi acp`,真机全能力实证:流式/思考流/工具步骤/模型与思考强度与模式切换/多轮上下文/会话恢复);恢复 `kimi --session <id>` |
42
+ | ZCode | ✅ | ✅ | ➖ | ➖ | 正文读 CLI 库 message/part 表(真机确认);内嵌的是 ACP 客户端 SDK,未发现服务端入口;深链未验证 |
43
+ | MiniMax Code | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`mcode acp`,官方文档确认 + 客户端链路已验证;本机未装 CLI,真机待验);正文读 `local_runtime_message_rows`;恢复 `mcode --session <id>` |
44
+ | CodeBuddy | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`codebuddy --acp`,官方 ACP registry 确认,已在 Zed 实测可用;本机未装 CLI,真机待验);正文读项目 JSONL;`ai-title` 作原生标题;恢复 `codebuddy --resume <id>` |
45
+ | OpenCode | ✅ | ✅ | ✅ | ✅ | **ACP 主通道**(`opencode acp`,v2.4.2 原生支持);恢复 `opencode --session <id>`,真机验证 |
46
+ | Codex | ✅ | ✅ | ✅ | ➖ | **ACP 主通道**经官方适配器 `@agentclientprotocol/codex-acp`(需 Node);one-shot `codex exec` 回退;恢复需目录信任决策 |
47
+ | Claude Code | ⚠️ | ✅ | ✅ | ➖ | **ACP 主通道**经官方适配器 `claude-agent-acp`(Anthropic/Zed/JetBrains,二进制分发,需安装);one-shot `claude -p`(partial 真流式)回退 |
48
+ | Pi | ✅ | ✅ | ➖ | ➖ | 正文读会话 JSONL;恢复未验证 |
49
+ | DeepSeek Harness | ✅ | ➖ | ➖ | ➖ | 会话正文是 zstd 压缩格式,零依赖原则下不解析;恢复未验证 |
45
50
 
46
51
  ## 安装
47
52
 
@@ -66,6 +71,8 @@ agent-trail scan # 扫描一次,输出各来源状态与记录数
66
71
  agent-trail list # 以 JSON Lines 输出全部会话元数据
67
72
  agent-trail serve # 启动本地控制台(默认自动打开浏览器)
68
73
  agent-trail tray # 系统托盘形态(Linux,见下)
74
+ agent-trail update # 检查并升级到 PyPI 最新版(--check 仅检查)
75
+ agent-trail version # 打印已安装与最新版本
69
76
  ```
70
77
 
71
78
  `serve` 常用选项:
@@ -75,10 +82,17 @@ agent-trail serve --port 8731 # 固定端口(默认随机)
75
82
  agent-trail serve --no-browser # 不自动打开浏览器
76
83
  agent-trail serve --no-watch # 禁用 inotify,只用定时轮询
77
84
  agent-trail serve --interval 30 # 轮询间隔(watch 健康时自动降为 5 分钟安全网)
85
+ agent-trail serve --no-content-index # 关闭正文索引(隐私优先模式:全文搜索与消息查看停用,对话仍可用)
78
86
  ```
79
87
 
80
88
  启动后控制台 URL 带一次性高熵访问令牌(如 `http://127.0.0.1:8731/?key=…`);令牌保存在浏览器 sessionStorage,后续请求通过请求头携带,所有 API 都会校验。手动刷新按钮立即触发一次扫描。
81
89
 
90
+ ### 工作台:正文 / 搜索 / 对话
91
+
92
+ - **正文与搜索**:扫描后后台增量索引支持查看的来源;顶栏搜索框全文检索正文,点击命中直接打开会话并定位正文。索引只写本机 `~/.agent-trail/index.sqlite`,每会话封顶 2000 条消息、单条 20KB。
93
+ - **对话**:切换到「对话」视图 → 选 Agent 与工作目录 → 新建对话。线程自动以首条消息命名,Agent 回复流式渲染(Markdown 代码块等),回合结束自动保存历史;对支持续聊的 CLI(claude/codex/opencode)自动记住会话引用,同一线程可继续追问。「停止」按钮会终止整个进程组(Agent 派生的子工具进程一并停止)。
94
+ - 对话不依赖任何服务器:所有流量走本机回环 + 令牌,Agent 子进程在你指定的工作目录里运行。
95
+
82
96
  ## 桌面托盘(Linux)
83
97
 
84
98
  `serve` 之外还有系统托盘形态,已整合为子命令:内嵌窗口展示控制台,托盘菜单提供打开控制台、立即刷新、启动/停止服务、开机自启和退出。
@@ -115,25 +129,31 @@ Windows 自启动写注册表 HKCU Run 键;后台运行经 pythonw 脱离终
115
129
  JSONL / JSON / SQLite ─▶ 适配器(9 种,只读) ─▶ 元数据索引 ─▶ 本地网页时间线
116
130
  ~/.kimi-code/… 规范化为统一模型 (SQLite) 127.0.0.1 + 令牌
117
131
  ~/.zcode/… 指纹增量去重 筛选 / 详情 / 恢复
118
- ~/.codex/… inotify 事件触发重扫
132
+ ~/.codex/… inotify 事件触发重扫 正文查看 / 全文检索
133
+ 应用内对话(SSE 流式)
134
+ claude / codex / opencode ─▶ ChatManager(argv 白名单)─▶ 子进程 stdout 事件 ─▶ 对话线程持久化
119
135
  ```
120
136
 
121
- - **适配器契约**:每个 Agent 一个适配器,实现发现(discover)、扫描(scan)、状态(status)、恢复计划(resume_plan)四个边界;数据源格式变化时报告不兼容而不是猜测
137
+ - **适配器契约**:每个 Agent 一个适配器,实现发现(discover)、扫描(scan)、状态(status)、恢复计划(resume_plan)四个边界,另有可选的正文读取(read_messages)与聊天能力(chat_support);数据源格式变化时报告不兼容而不是猜测
122
138
  - **增量扫描**:以源路径、大小、mtime 和适配器版本计算指纹,未变化的来源毫秒级跳过
123
139
  - **实时监控**:`watcher.py` 用 ctypes 直接调 libc inotify(保持零依赖),目录级 watch 覆盖原子替换与 WAL sidecar 变化;去抖 + 最小间隔合并高频写入
124
140
  - **恢复安全**:恢复命令来自适配器白名单参数数组,不经过 shell;API 只接受会话标识,服务端重新查库生成计划,调用者无法注入命令或目录
141
+ - **对话安全**:聊天子进程用 argv 数组 + 双重白名单启动,prompt 经 stdin 或单个 argv 元素传入;POSIX 独立进程组启动、整组终止;并发与超时双封顶
125
142
  - **源数据只读**:SQLite 源以 `mode=ro` 打开,禁止任何写事务;源记录删除后保留最后元数据并标记"源已缺失"、禁用恢复
126
143
 
127
144
  ## 隐私与安全
128
145
 
129
146
  - 明确不读取各工具的 credentials、auth、token、密钥类文件
130
- - 本地索引与日志不保存消息正文、代码、命令、diff、附件或凭据
131
- - HTTP 仅绑定回环地址;刷新与恢复使用 POST 并校验 Origin,防止外部网页诱导本机服务执行动作
147
+ - 消息正文仅在本机索引与展示,绝不上传;`--no-content-index` 可整体关闭正文能力
148
+ - HTTP 仅绑定回环地址;刷新、恢复、对话全部校验令牌与 Origin,防止外部网页诱导本机服务执行动作
132
149
  - 网页不加载任何第三方脚本、字体或统计
133
150
 
134
151
  ## 已知限制
135
152
 
136
- - 元数据优先:部分会话只有"未命名会话",以目录和时间辅助识别;不读取首条用户消息补标题
153
+ - 应用内对话走 ACP 通道:Kimi Code(真机验证)与 MiniMax Code(官方文档确认)原生支持;Claude Code / Codex 经 npm 适配器接入(Phase 2,需 Node);CodeBuddy 官方称兼容 ACP 但入口未验证;ZCode 未发现 ACP 服务端入口
154
+ - 交互审批(允许/拒绝卡片)按 ACP `session/request_permission` 协议实现并经合成链路验证;实测 kimi 当前在 default 模式不发起权限请求,触发待上游支持
155
+ - 正文查看支持 Kimi Code、ZCode、MiniMax Code、CodeBuddy、OpenCode、Codex、Claude Code、Pi;DeepSeek Harness 的正文是 zstd 压缩格式,零依赖原则下不解析
156
+ - 部分会话只有"未命名会话",以目录和时间辅助识别
137
157
  - 适配器基于当前各工具的本机数据格式,工具升级后可能需要更新
138
158
  - "回到工作现场"指原 Agent 会话与目录,不保证恢复未保存的文件或桌面布局
139
159
 
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "session-trail"
7
- version = "0.3.2"
8
- description = "Local cross-agent work timeline: discover, browse and resume coding-agent sessions on your machine"
7
+ version = "0.6.0"
8
+ description = "Local agent workbench: a cross-agent session timeline plus in-app chat with your coding agents, all local-first"
9
9
  readme = "README.md"
10
10
  license = "MIT"
11
11
  license-files = ["LICENSE"]
12
12
  authors = [{ name = "fwt11" }]
13
13
  requires-python = ">=3.10"
14
14
  dependencies = []
15
- keywords = ["ai-agents", "coding-agent", "timeline", "session-management", "local-first", "tray", "systray"]
15
+ keywords = ["ai-agents", "coding-agent", "timeline", "session-management", "local-first", "tray", "systray", "chat", "workbench"]
16
16
  classifiers = [
17
17
  "Development Status :: 4 - Beta",
18
18
  "Environment :: Web Environment",