codex-snapshots 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ffffhx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # Codex Snapshots
2
+
3
+ 面向 Codex、Claude Code 和 Trae 的本地优先、只读会话快照工具。
4
+
5
+ 这个项目从 Garden Lab 中拆分出来,让会话快照查看器可以作为独立工具使用。它会扫描本地 agent 历史记录,在浏览器中提供审阅界面,导出静态 HTML/Markdown 快照,自动脱敏常见密钥,并支持把已脱敏的快照发布到一个轻量的独立分享 API。
6
+
7
+ 网站:<https://ffffhx.github.io/codex-snapshots/>
8
+
9
+ ## 快速开始
10
+
11
+ 不需要克隆仓库,可以直接通过 npm 临时运行:
12
+
13
+ ```bash
14
+ npx codex-snapshots@latest serve --port 4321
15
+ ```
16
+
17
+ 打开 <http://127.0.0.1:4321/>。
18
+
19
+ 也可以全局安装:
20
+
21
+ ```bash
22
+ npm install -g codex-snapshots
23
+ codex-snapshot serve --port 4321
24
+ ```
25
+
26
+ 要求 Node.js 18 或更高版本。
27
+
28
+ ## 从源码运行
29
+
30
+ ```bash
31
+ pnpm install
32
+ pnpm dev
33
+ ```
34
+
35
+ 打开 <http://127.0.0.1:4321/>。
36
+
37
+ 如果想在本地预览公开静态网站:
38
+
39
+ ```bash
40
+ pnpm site:dev
41
+ ```
42
+
43
+ 打开 <http://127.0.0.1:4323/>。
44
+
45
+ ## 命令行
46
+
47
+ 全局安装或通过 `npx` 使用时:
48
+
49
+ ```bash
50
+ codex-snapshot list --source all
51
+ codex-snapshot preview <session-id>
52
+ codex-snapshot export <session-id> --html --output snapshot.html
53
+ codex-snapshot export <session-id> --md --output snapshot.md
54
+ codex-snapshot serve --port 4321
55
+ codex-snapshot record-trae --port 4732
56
+ ```
57
+
58
+ 从源码运行时,也可以使用对应的 pnpm 脚本:
59
+
60
+ ```bash
61
+ pnpm snapshot list --source all
62
+ pnpm snapshot preview <session-id>
63
+ pnpm snapshot export <session-id> --html --output snapshot.html
64
+ pnpm snapshot export <session-id> --md --output snapshot.md
65
+ pnpm snapshot serve --port 4321
66
+ pnpm snapshot record-trae --port 4732
67
+ ```
68
+
69
+ 默认读取以下目录:
70
+
71
+ - Codex:`$CODEX_HOME` 或 `~/.codex`
72
+ - Claude Code:`$CLAUDE_HOME` 或 `~/.claude`
73
+ - Trae:`$TRAE_HOME` 或 `~/.trae-cn`
74
+ - Trae 应用数据:`$TRAE_APP_HOME` 或 `~/Library/Application Support/Trae CN`
75
+
76
+ ## 云端分享服务
77
+
78
+ 启动可选的分享 API:
79
+
80
+ ```bash
81
+ SNAPSHOT_SHARE_TOKEN=change-me codex-snapshot-share
82
+ ```
83
+
84
+ 如果还没有全局安装,可以用:
85
+
86
+ ```bash
87
+ SNAPSHOT_SHARE_TOKEN=change-me \
88
+ npx -p codex-snapshots@latest codex-snapshot-share
89
+ ```
90
+
91
+ 从源码运行:
92
+
93
+ ```bash
94
+ SNAPSHOT_SHARE_TOKEN=change-me pnpm share:server
95
+ ```
96
+
97
+ 发布已脱敏的快照:
98
+
99
+ ```bash
100
+ SNAPSHOT_SHARE_TOKEN=change-me \
101
+ codex-snapshot publish <session-id> \
102
+ --api-url http://127.0.0.1:8787 \
103
+ --site-url http://127.0.0.1:8787
104
+ ```
105
+
106
+ 服务端默认把分享内容保存在 `.codex-snapshots/shares.json`。如果需要使用其他路径,可以配置 `SNAPSHOT_SHARE_DATA_FILE`。
107
+
108
+ ## macOS LaunchAgent
109
+
110
+ 从源码运行时,可以把本地查看器安装为用户级 LaunchAgent:
111
+
112
+ ```bash
113
+ pnpm snapshot:install-daemon
114
+ pnpm snapshot:daemon:status
115
+ pnpm snapshot:daemon:logs
116
+ pnpm snapshot:uninstall-daemon
117
+ ```
118
+
119
+ 安装后,LaunchAgent 会在登录后保持 <http://127.0.0.1:4321/> 可用。
120
+
121
+ ## 安全模型
122
+
123
+ - 默认导出用户和助手消息。
124
+ - 跳过 developer、system 和 bootstrap 消息。
125
+ - 除非传入 `--include-tools`,否则隐藏工具调用。
126
+ - 除非传入 `--include-tool-output`,否则隐藏工具输出。
127
+ - 自动脱敏常见密钥、Bearer token、JWT、私钥块、Cookie 和本地 home 路径。
128
+ - 生成静态、只读快照;接收方无法恢复或操作原始 agent 线程。
129
+ - 除非显式允许,否则拒绝把未脱敏快照发布到云端。
130
+
131
+ 脱敏器会尽量保守处理,但并不完美。分享前请务必查看风险面板。