@niracler/encore 0.1.0 → 0.3.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/README.md +105 -97
- package/README.zh-CN.md +123 -72
- package/bin/encore.mjs +134 -82
- package/package.json +28 -13
- package/player/encore-player.css +83 -1
- package/player/encore-player.js +595 -157
- package/schema/session.schema.json +255 -0
- package/skills/encore/SKILL.md +39 -35
- package/src/attachment-previews.mjs +169 -0
- package/src/attachment-reader.mjs +169 -0
- package/src/claude-ai.mjs +3 -1
- package/src/claude-code.mjs +13 -9
- package/src/codex.mjs +34 -10
- package/src/common.mjs +45 -15
- package/src/detect.mjs +37 -9
- package/src/external-files.mjs +176 -0
- package/src/i18n.mjs +107 -25
- package/src/index.d.ts +260 -0
- package/src/index.mjs +61 -40
- package/src/markdown.mjs +14 -11
- package/src/player-assets.mjs +4 -1
- package/src/player-runtime.mjs +74 -11
- package/src/render.mjs +66 -18
- package/src/server.mjs +2 -0
- package/src/timeline.mjs +165 -91
- package/src/workbuddy.mjs +48 -0
package/README.md
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./docs/hero-en.svg" alt="Encore · Replay an AI Agent session to see how it worked and what it delivered." width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://encore.niracler.com/?lang=en"><strong>Live Demos (encore.niracler.com)</strong></a> ·
|
|
7
|
+
<a href="https://www.npmjs.com/package/@niracler/encore"><strong>npm</strong></a> ·
|
|
8
|
+
<a href="./README.md"><strong>English</strong></a> ·
|
|
9
|
+
<a href="./README.zh-CN.md">简体中文</a>
|
|
10
|
+
</p>
|
|
5
11
|
|
|
6
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/@niracler/encore"><img src="https://img.shields.io/npm/v/@niracler/encore?style=flat-square&color=c2410c" alt="npm version"></a>
|
|
14
|
+
<a href="https://github.com/niracler/encore/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/niracler/encore/ci.yml?branch=main&style=flat-square&label=CI" alt="CI status"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/node-%3E%3D20.10-334155?style=flat-square" alt="Node.js >= 20.10">
|
|
16
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-2563eb?style=flat-square" alt="MIT License"></a>
|
|
17
|
+
</p>
|
|
7
18
|
|
|
8
|
-
|
|
19
|
+
**Encore** is like [`asciinema`](https://asciinema.org) for AI Agent sessions. Locally, it turns a raw log from **Codex**, **Claude Code**, **Claude.ai**, or **WorkBuddy** into a portable web replay. Readers can step through turns, tool calls, sub-agents, frames, and deliverables while watching the context snapshot grow and compact in real time.
|
|
20
|
+
|
|
21
|
+

|
|
9
22
|
|
|
10
23
|
---
|
|
11
24
|
|
|
12
|
-
##
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
Requires **Node.js >= 20.10**. No global install needed.
|
|
13
28
|
|
|
14
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npx @niracler/encore@latest
|
|
31
|
+
```
|
|
15
32
|
|
|
16
|
-
|
|
33
|
+
The interactive picker scans recent local **Codex**, **Claude Code**, and **WorkBuddy** sessions and opens the selected replay in your browser. You can also pass a `.jsonl` or `.jsonl.zst` raw log, or a Claude.ai `conversations.json` export directly.
|
|
17
34
|
|
|
18
|
-
|
|
19
|
-
| :--- | :--- |
|
|
20
|
-
| **Left · Conversation & Artifact Stage** | Typewriter prompt composer, soft-breathing Markdown reply streaming, live tool call shimmer (`1.0×` / `12×` / `0.8×`), sub-agent dispatches & reports, inline `.webp` visual outputs, intermediate Markdown drafts, and audio/video deliverables. |
|
|
21
|
-
| **Right · Live Context Window Inspector** | Real-time token gauge (`200k` / `1.0M`), 7-color stacked bar (`System Prompt`, `Tool Schemas & MCP`, `User Messages`, `Memory & Rules`, `Skills`, `Assistant`, `Tool Outputs`), auto-compaction headroom markers, and drill-down payload inspection for every step. |
|
|
22
|
-
| **Bottom · Segmented Milestone Timeline** | Interactive step segments with pinned visual frames (`🖼`), draft documents (`📄`), context compactions (`🗜`), and user turns (`💬`). |
|
|
35
|
+
Without `-o`, replays write to a temporary directory. Pass `-o <dir>` to keep a portable copy for publishing; see `npx @niracler/encore@latest --help` for all commands and options.
|
|
23
36
|
|
|
24
37
|
---
|
|
25
38
|
|
|
26
|
-
##
|
|
39
|
+
## How It Works
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
<p align="center">
|
|
42
|
+
<picture>
|
|
43
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/architecture-en-dark.webp">
|
|
44
|
+
<source media="(prefers-color-scheme: light)" srcset="./docs/architecture-en-light.webp">
|
|
45
|
+
<img src="./docs/architecture-en-light.webp" alt="Encore architecture: from raw Agent logs and referenced local files in Asset Roots, through automatic CLI export and optional pre-publish Curation, to a portable Replay and standalone Player" width="100%">
|
|
46
|
+
</picture>
|
|
47
|
+
</p>
|
|
29
48
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<link rel="stylesheet" href="./encore-player.css">
|
|
34
|
-
<div data-encore-player src="./session.json" data-lang="en"></div>
|
|
35
|
-
<script src="./encore-player.js" defer></script>
|
|
36
|
-
```
|
|
37
|
-
3. **CLI (`encore`)**: Auto-detects `Codex`, `Claude Code`, and `Claude.ai` logs, extracts embedded images into `.webp`, redacts local paths & secrets, writes the static replay folder, and serves a live local preview.
|
|
49
|
+
- **Local-only processing**: Adapters, `.webp` frame extraction, automatic redaction, and leak checks all run locally in Node.js. Nothing is uploaded.
|
|
50
|
+
- **Decoupled Session and Player**: `session.json`, extracted `.webp` frames, and collected files live beside the zero-dependency player, so edits to `session.json` appear on browser reload.
|
|
51
|
+
- **Explicit file collection boundaries**: Encore collects locally referenced attachments and deliverables within allowed asset roots (defaulting to the current directory and native session workspace; override with `--asset-root`), builds in-place PDF and workbook previews, and labels each file as verified (matching SHA-256), an export-time copy, or missing.
|
|
38
52
|
|
|
39
53
|
---
|
|
40
54
|
|
|
41
|
-
##
|
|
55
|
+
## Curating Before Publishing (Optional)
|
|
42
56
|
|
|
43
|
-
|
|
57
|
+
For personal review or internal archiving, the CLI export is ready to watch as-is—no skill needed. When preparing a replay for a blog, course, or public showcase, pair the export with the companion `encore` skill for a semantic curation pass.
|
|
44
58
|
|
|
45
|
-
|
|
59
|
+
**What the CLI handles automatically**
|
|
46
60
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
- Adapts the raw log, extracts deduplicated `.webp` frames, collects referenced attachments and deliverables from asset roots, and builds in-place previews
|
|
62
|
+
- Redacts common API keys, private keys, JWTs, database URLs, emails, private IPs, and home paths, omits cross-session `MEMORY_SUMMARY` and user-level `CLAUDE.md` bodies by default, and runs a non-blocking leak check
|
|
63
|
+
- Packages a standalone replay directory with the zero-dependency player
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
**What the `encore` skill adds during curation**
|
|
52
66
|
|
|
53
|
-
|
|
67
|
+
- **Curate & label frames**: Inspects `.webp` frames, drops noisy intermediate states, keeps key milestones, and replaces fallback labels with concrete descriptions
|
|
68
|
+
- **Write intro & trim turns**: Drafts a concise `title` and opening `description` from full context, and trims off-topic opening or closing turns
|
|
69
|
+
- **Manual redaction & file review**: Reviews leak check warnings, removes internal codenames, people's names, and business figures regex cannot detect, and audits raw files in `attachments/`
|
|
70
|
+
- **Lossless rebuild**: Runs `npx @niracler/encore@latest <replay-dir>` to refresh player assets and previews, sync `<title>`, drop deleted frame references, and re-run the leak check without overwriting curation edits or added media
|
|
71
|
+
|
|
72
|
+
Install the skill globally (or copy [`skills/encore/SKILL.md`](./skills/encore/SKILL.md) manually):
|
|
54
73
|
|
|
55
74
|
```bash
|
|
56
|
-
npx
|
|
75
|
+
npx skills add niracler/encore -g
|
|
57
76
|
```
|
|
58
77
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Because `index.html` loads `./session.json` dynamically, **any edit you make to `session.json` (changing `title`, adding `description`, renaming or deleting `frames`) appears immediately when you refresh the browser.**
|
|
78
|
+
Then ask your Agent from any workspace:
|
|
62
79
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
npx @niracler/encore ./replays/my-session
|
|
80
|
+
```text
|
|
81
|
+
Use the encore skill to export my latest session and curate it for publishing.
|
|
67
82
|
```
|
|
68
83
|
|
|
69
|
-
|
|
84
|
+
> **Review before sharing**: Automatic redaction only rewrites `session.json`; it never modifies copied PDFs, workbooks, images, or videos in `attachments/`. Review `session.json`, every kept `.webp` frame, and all packaged attachments and deliverables before publishing.
|
|
70
85
|
|
|
71
|
-
|
|
86
|
+
---
|
|
72
87
|
|
|
73
|
-
|
|
88
|
+
## Embedding on Any Site
|
|
74
89
|
|
|
75
|
-
|
|
90
|
+
Export with `-o ./replays/<slug>` and deploy the entire replay directory to GitHub Pages, Cloudflare Pages, Vercel, or any static host—or embed the player in an existing HTML page with three lines:
|
|
76
91
|
|
|
77
|
-
|
|
92
|
+
```html
|
|
93
|
+
<link rel="stylesheet" href="./encore-player.css">
|
|
94
|
+
<div data-encore-player src="./session.json" data-lang="en"></div>
|
|
95
|
+
<script src="./encore-player.js" defer></script>
|
|
96
|
+
```
|
|
78
97
|
|
|
79
|
-
|
|
80
|
-
1. **Visual Frame Pruning & Naming**: Visually inspects every extracted `.webp` image, deletes broken or redundant screenshots from `frames[]`, and writes concise narrative labels (e.g. `"V1 wireframe"`, `"Final dark-mode layout"`).
|
|
81
|
-
2. **Title & Opening Story Intro**: Writes a punchy `title` and a 1–3 sentence `description` explaining the problem, mid-session pivot, and outcome without fluff.
|
|
82
|
-
3. **Semantic Privacy Cleanup**: Scans `items[]` for internal codenames, colleague names, or sensitive business logic and replaces them with `(Internal context redacted)`.
|
|
83
|
-
4. **Time-Window Trimming**: Cuts unrelated off-topic turns at the start or end of a session.
|
|
98
|
+
Omit `data-lang` to follow the language set in `session.json`. The player also natively renders optional curated extensions in `session.json`, including per-step audio (`item.audio`), landscape/portrait video switching, and PDF/workbook revision diffs.
|
|
84
99
|
|
|
85
|
-
|
|
100
|
+
<details>
|
|
101
|
+
<summary><strong><code>session.json</code> Schema</strong></summary>
|
|
86
102
|
|
|
87
|
-
|
|
103
|
+
Formal JSON Schema: [`schema/session.schema.json`](./schema/session.schema.json) (`https://encore.niracler.com/schema/session.schema.json`) · TypeScript Definitions: [`src/index.d.ts`](./src/index.d.ts)
|
|
88
104
|
|
|
89
105
|
```json
|
|
90
106
|
{
|
|
107
|
+
"$schema": "https://encore.niracler.com/schema/session.schema.json",
|
|
91
108
|
"tool": "codex",
|
|
92
109
|
"model": "gpt-5.4",
|
|
93
110
|
"title": "Redesigning the 7-Stage Architecture Diagram",
|
|
94
111
|
"description": "Started with a cluttered layout, pivoted to a two-column grid after visual review, and exported the final SVG.",
|
|
95
112
|
"lang": "en",
|
|
96
|
-
"started": "2026-11-17T10:00:00.000Z",
|
|
97
|
-
"ended": "2026-11-17T10:18:30.000Z",
|
|
98
113
|
"contextWindow": 258400,
|
|
99
|
-
"deliverables": [
|
|
100
|
-
|
|
101
|
-
"title": "Final Architecture Diagram",
|
|
102
|
-
"href": "./final-diagram.webp",
|
|
103
|
-
"meta": "SVG / WebP · 1920×1080"
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
"frames": [
|
|
107
|
-
{
|
|
108
|
-
"time": "2026-11-17T10:04:12.000Z",
|
|
109
|
-
"img": "a1b2c3d4e5f6.webp",
|
|
110
|
-
"who": "ai",
|
|
111
|
-
"label": "Draft 1: Overcrowded labels",
|
|
112
|
-
"w": 960,
|
|
113
|
-
"h": 540
|
|
114
|
-
}
|
|
115
|
-
],
|
|
114
|
+
"deliverables": [{ "title": "Final Diagram", "href": "./final-diagram.webp", "meta": "SVG / WebP · 1920×1080" }],
|
|
115
|
+
"frames": [{ "time": "2026-11-17T10:04:12.000Z", "img": "a1b2c3d4e5f6.webp", "who": "ai", "label": "Draft 1", "w": 960, "h": 540 }],
|
|
116
116
|
"items": [
|
|
117
117
|
{ "type": "user", "text": "...", "time": "..." },
|
|
118
118
|
{ "type": "tool", "name": "exec_command", "summary": "...", "stats": { "command": 1 }, "time": "..." },
|
|
@@ -122,37 +122,45 @@ The skill guides the agent through four curation steps:
|
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
</details>
|
|
126
|
+
|
|
125
127
|
---
|
|
126
128
|
|
|
127
|
-
##
|
|
129
|
+
## FAQ
|
|
128
130
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
--no-images Skip extracting embedded images to .webp
|
|
143
|
-
--image-width <px> Max width for extracted WebP frames (default: 960)
|
|
144
|
-
--clip <chars> Max chars per tool input/output (default: 1500/2000)
|
|
145
|
-
--conversation <id> Conversation UUID for multi-chat Claude.ai exports
|
|
146
|
-
--include-memory Include full cross-session MEMORY_SUMMARY / User CLAUDE.md text
|
|
147
|
-
--list List recent local sessions without interactive prompt
|
|
148
|
-
--serve Start local HTTP preview server after building
|
|
149
|
-
--no-serve Do not start local HTTP preview server
|
|
150
|
-
--no-open Do not automatically open browser when serving
|
|
151
|
-
-p, --port <number> Preview server port (default: 4180)
|
|
152
|
-
-v, --version Show version number
|
|
153
|
-
-h, --help Show help message
|
|
131
|
+
### Does Encore upload my logs? How does redaction work?
|
|
132
|
+
|
|
133
|
+
**No—everything runs locally.**
|
|
134
|
+
|
|
135
|
+
- **Automatic redaction**: Hides common API keys, private keys, JWTs, database URLs, emails, private IPs, and home directory paths (replaced with `~`), omits cross-session `MEMORY_SUMMARY` and user-level `CLAUDE.md` bodies by default, and runs a non-blocking leak check.
|
|
136
|
+
- **Manual review still needed**: Project codenames, business figures, and raw files copied into `attachments/` (PDFs, workbooks, images, videos) are never rewritten automatically.
|
|
137
|
+
|
|
138
|
+
### Why doesn't double-clicking `index.html` work?
|
|
139
|
+
|
|
140
|
+
Browser security rules block `fetch('./session.json')` on `file://` URLs. Open the replay through the local preview server, or deploy the folder to any static host:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npx @niracler/encore@latest play ./replays/<slug>
|
|
154
144
|
```
|
|
155
145
|
|
|
156
|
-
|
|
146
|
+
### Will deleting the raw log or source files break a replay?
|
|
147
|
+
|
|
148
|
+
**No.** A replay directory is a self-contained static bundle (`session.json`, `.webp` frames, `attachments/`, and player assets). Keep the directory intact; only external URLs still depend on their hosts.
|
|
149
|
+
|
|
150
|
+
### Why is an attachment labeled as an export-time copy or missing?
|
|
151
|
+
|
|
152
|
+
- **Verified**: Found inside an allowed asset root with a SHA-256 matching the digest recorded in the session.
|
|
153
|
+
- **Export-time copy**: Found at export time, but no matching session digest exists or the file changed afterward.
|
|
154
|
+
- **Missing / Outside asset roots**: Referenced in the log, but absent on disk or outside the allowed asset roots (pass `--asset-root` to include another directory; the filename stays visible under the message).
|
|
155
|
+
|
|
156
|
+
### Are token counts in the Context Snapshot exact billing figures?
|
|
157
|
+
|
|
158
|
+
**No.** They visualize context structure and growth: when a raw log includes real token counts (including `preTokens` / `postTokens` around compactions), Encore displays them directly; when per-step totals or category breakdowns are missing, it estimates from content length.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Contributing & License
|
|
163
|
+
|
|
164
|
+
Architecture notes and development commands live in [`AGENTS.md`](./AGENTS.md), and shared domain terminology lives in [`GLOSSARY.md`](./GLOSSARY.md). Run `pnpm test` before opening a pull request to verify adapters, redaction rules, and player build sync. To request support for another Agent format, open an issue.
|
|
157
165
|
|
|
158
166
|
[MIT](./LICENSE)
|
package/README.zh-CN.md
CHANGED
|
@@ -1,115 +1,166 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./docs/hero-zh.svg" alt="Encore · 回看一次 AI Agent 会话,看它怎么完成任务,交付了什么。" width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://encore.niracler.com/?lang=zh"><strong>在线演示(encore.niracler.com)</strong></a> ·
|
|
7
|
+
<a href="https://www.npmjs.com/package/@niracler/encore"><strong>npm</strong></a> ·
|
|
8
|
+
<a href="./README.md">English</a> ·
|
|
9
|
+
<a href="./README.zh-CN.md"><strong>简体中文</strong></a>
|
|
10
|
+
</p>
|
|
5
11
|
|
|
6
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/@niracler/encore"><img src="https://img.shields.io/npm/v/@niracler/encore?style=flat-square&color=c2410c" alt="npm 版本"></a>
|
|
14
|
+
<a href="https://github.com/niracler/encore/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/niracler/encore/ci.yml?branch=main&style=flat-square&label=CI" alt="CI 状态"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/node-%3E%3D20.10-334155?style=flat-square" alt="Node.js >= 20.10">
|
|
16
|
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-MIT-2563eb?style=flat-square" alt="MIT 协议"></a>
|
|
17
|
+
</p>
|
|
7
18
|
|
|
8
|
-
|
|
19
|
+
**Encore** 是面向 AI Agent 会话的 [`asciinema`](https://asciinema.org)。它在本地将 **Codex**、**Claude Code**、**Claude.ai** 或 **WorkBuddy** 的原始日志转换为可独立托管的网页回放。打开回放后,读者可以按步骤查看对话轮次、工具调用、子 Agent 协作、画面帧与交付物,并在右侧同步查看上下文快照的增长与压缩。
|
|
20
|
+
|
|
21
|
+

|
|
9
22
|
|
|
10
23
|
---
|
|
11
24
|
|
|
12
|
-
##
|
|
25
|
+
## 快速开始
|
|
26
|
+
|
|
27
|
+
需要 **Node.js >= 20.10**,无需全局安装。
|
|
13
28
|
|
|
14
|
-
|
|
29
|
+
```bash
|
|
30
|
+
npx @niracler/encore@latest
|
|
31
|
+
```
|
|
15
32
|
|
|
16
|
-
|
|
33
|
+
命令会扫描本机最近的 **Codex**、**Claude Code** 与 **WorkBuddy** 会话,选中后在浏览器中打开回放;也可以直接传入 `.jsonl`、`.jsonl.zst` 或 Claude.ai 导出的 `conversations.json`。
|
|
17
34
|
|
|
18
|
-
|
|
19
|
-
| :--- | :--- |
|
|
20
|
-
| **左屏 · 对话流与作品演进** | 底部输入框打字上屏、Agent 回复呼吸感流式输出、工具调用流光快切(`1.0×` / `12×` / `0.8×`)、子任务派发与报告弹窗、内嵌 `.webp` 过程效果图、Markdown 中间草稿与音视频交付物。 |
|
|
21
|
-
| **右屏 · Context 实时透视面板** | 实时显示上下文窗口水位(`200k` / `1.0M`)、7 色分段进度条(系统提示词、工具定义、用户消息、注入规则、技能、助手回复、工具输出)、自动压缩警戒线,点击任意消息或色块即可定格查看当时的原文载荷。 |
|
|
22
|
-
| **底部 · 关键帧章节时间轴** | 按步骤切分的时间轴,自动钉出过程效果图(`🖼`)、中间文稿(`📄`)、上下文压缩(`🗜`)与提问轮次(`💬`)。 |
|
|
35
|
+
未传 `-o` 时,回放默认写入系统临时目录;需要保存可移植副本或部署时,传入 `-o <目录>`。完整子命令与选项见 `npx @niracler/encore@latest --help`。
|
|
23
36
|
|
|
24
37
|
---
|
|
25
38
|
|
|
26
|
-
##
|
|
39
|
+
## 工作原理
|
|
27
40
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
<p align="center">
|
|
42
|
+
<picture>
|
|
43
|
+
<source media="(prefers-color-scheme: dark)" srcset="./docs/architecture-zh-dark.webp">
|
|
44
|
+
<source media="(prefers-color-scheme: light)" srcset="./docs/architecture-zh-light.webp">
|
|
45
|
+
<img src="./docs/architecture-zh-light.webp" alt="Encore 处理架构:从原始 Agent 日志与资产根目录内的本地文件,经 CLI 自动导出与可选的发布前整理,生成可独立托管的回放目录与零依赖播放器" width="100%">
|
|
46
|
+
</picture>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
- **全本地离线运行**:日志适配、`.webp` 画面帧转码、自动脱敏与泄露检查都在本地 Node.js 环境中完成,不上传任何数据。
|
|
50
|
+
- **会话数据与播放器分离**:`session.json`、提取出的 `.webp` 画面帧与收录文件都与零依赖播放器同目录存放,编辑 `session.json` 后刷新页面即可生效。
|
|
51
|
+
- **明确的文件收集边界**:自动收集允许的资产根目录(默认为当前工作目录与原始会话工作区,可用 `--asset-root` 覆盖)内日志明确引用的附件与交付物,生成 PDF 与表格的页内预览,并在原消息下标注「已核对版本」「导出时的副本」或「原文件缺失」。
|
|
36
52
|
|
|
37
53
|
---
|
|
38
54
|
|
|
39
|
-
##
|
|
55
|
+
## 发布前整理(可选)
|
|
40
56
|
|
|
41
|
-
|
|
57
|
+
个人复盘或内部留档时,CLI 导出的回放已经可以直接观看,不需要安装技能。准备公开发布到博客、课程或展示页时,可以配合 `encore` 技能在导出结果上做一轮语义整理。
|
|
42
58
|
|
|
43
|
-
|
|
59
|
+
**CLI 自动导出已完成**
|
|
44
60
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
- 转换原始日志,提取去重 `.webp` 画面帧,收集资产根目录内引用的附件与交付物并生成页内预览
|
|
62
|
+
- 对常见密钥、私钥、JWT、数据库连接串、邮箱、内网 IP 与本机路径自动脱敏,默认省略 `MEMORY_SUMMARY` 与用户级 `CLAUDE.md` 正文,并输出非阻塞泄露检查预警
|
|
63
|
+
- 打包独立的回放目录与零依赖播放器
|
|
64
|
+
|
|
65
|
+
**`encore` 技能负责发布前整理**
|
|
48
66
|
|
|
49
|
-
|
|
67
|
+
- **筛选与标注画面帧**:逐张查看 `.webp` 画面帧,剔除报错与冗余中间态,只保留里程碑画面并写清变化标签
|
|
68
|
+
- **撰写导读与裁剪轮次**:结合上下文撰写标题(`title`)与开场说明(`description`),删去首尾无关轮次
|
|
69
|
+
- **人工脱敏与附件复核**:处理泄露检查预警,清理正则识别不出的内部代号、人名与业务数据,并核对 `attachments/` 中的原件
|
|
70
|
+
- **无损重建同步**:整理完成后运行 `npx @niracler/encore@latest <回放目录>`,刷新播放器与预览、同步页面 `<title>`、清理已删画面帧引用并重跑泄露检查(保留整理修改与补充媒体)
|
|
50
71
|
|
|
51
|
-
|
|
72
|
+
全局安装该技能(或手动复制 [`skills/encore/SKILL.md`](./skills/encore/SKILL.md)):
|
|
52
73
|
|
|
53
74
|
```bash
|
|
54
|
-
npx
|
|
75
|
+
npx skills add niracler/encore -g
|
|
55
76
|
```
|
|
56
77
|
|
|
57
|
-
|
|
78
|
+
之后在任意工作区直接告诉 Agent:
|
|
58
79
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
如果需要同步更新 `index.html` 的 `<title>` 标签或重新运行隐私脱敏检查,对目录再跑一次命令即可:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npx @niracler/encore ./replays/my-session
|
|
80
|
+
```text
|
|
81
|
+
用 encore 技能把我刚才那段对话导出并整理一下。
|
|
65
82
|
```
|
|
66
83
|
|
|
84
|
+
> **公开分享前请复核**:自动脱敏只改写 `session.json`,不会修改 `attachments/` 中复制进来的 PDF、工作簿、图片或视频原件。发布前请检查 `session.json`、保留的 `.webp` 画面帧以及所有打包的附件和交付物。
|
|
85
|
+
|
|
67
86
|
---
|
|
68
87
|
|
|
69
|
-
##
|
|
88
|
+
## 嵌入网页
|
|
70
89
|
|
|
71
|
-
|
|
90
|
+
使用 `-o ./replays/<会话短名>` 导出后,将整个回放目录部署到 GitHub Pages、Cloudflare Pages、Vercel 或任意静态托管服务即可直接访问,也可通过 3 行代码嵌入已有 HTML 页面:
|
|
72
91
|
|
|
73
|
-
|
|
92
|
+
```html
|
|
93
|
+
<link rel="stylesheet" href="./encore-player.css">
|
|
94
|
+
<div data-encore-player src="./session.json" data-lang="zh"></div>
|
|
95
|
+
<script src="./encore-player.js" defer></script>
|
|
96
|
+
```
|
|
74
97
|
|
|
75
|
-
|
|
98
|
+
省略 `data-lang` 时,界面语言自动跟随 `session.json` 的设置。播放器同时原生支持在 `session.json` 中手动挂载步骤音频(`item.audio`)、横竖屏视频切换与 PDF / 表格修订对照。
|
|
99
|
+
|
|
100
|
+
<details>
|
|
101
|
+
<summary><strong><code>session.json</code> 核心结构</strong></summary>
|
|
102
|
+
|
|
103
|
+
JSON Schema 规范:[`schema/session.schema.json`](./schema/session.schema.json)(`https://encore.niracler.com/schema/session.schema.json`);TypeScript 类型声明:[`src/index.d.ts`](./src/index.d.ts)。
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"$schema": "https://encore.niracler.com/schema/session.schema.json",
|
|
108
|
+
"tool": "codex",
|
|
109
|
+
"model": "gpt-5.4",
|
|
110
|
+
"title": "定下像素风和红发主角·课程海报视觉探索",
|
|
111
|
+
"description": "从信息过载的第一版草图出发,确立三阶段路线图,最终定版像素风课程海报。",
|
|
112
|
+
"lang": "zh",
|
|
113
|
+
"contextWindow": 258400,
|
|
114
|
+
"deliverables": [{ "title": "定版课程海报", "href": "./final-poster.webp", "meta": "WebP · 1920×1080" }],
|
|
115
|
+
"frames": [{ "time": "2026-11-17T10:04:12.000Z", "img": "a1b2c3d4e5f6.webp", "who": "ai", "label": "像素风草图", "w": 960, "h": 540 }],
|
|
116
|
+
"items": [
|
|
117
|
+
{ "type": "user", "text": "...", "time": "..." },
|
|
118
|
+
{ "type": "tool", "name": "exec_command", "summary": "...", "stats": { "command": 1 }, "time": "..." },
|
|
119
|
+
{ "type": "compact", "seq": 1, "trigger": "auto", "preTokens": 210000, "postTokens": 42000, "time": "..." },
|
|
120
|
+
{ "type": "assistant", "text": "...", "time": "..." }
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
76
124
|
|
|
77
|
-
|
|
78
|
-
1. **逐张看图筛废片与起名**:用多模态看图检查导出目录里的 `.webp`,删掉报错图与重复图,只留关键演进节点,并补写清晰的 `label`(如 `"第一张草图:信息过载"`、`"终稿:定版海报"`)。
|
|
79
|
-
2. **提炼短标题与故事导读**:去掉空洞套话,在 `session.json` 顶层写出直奔主题的 `title` 与几十宇的 `description` 开场脉络。
|
|
80
|
-
3. **语义级隐私与噪音清理**:识别正则抓不到的业务代号、同事姓名或内部地址,替换为 `(涉及内部业务细节,已略去)`。
|
|
81
|
-
4. **掐头去尾(时间切片)**:切掉会话首尾顺手聊的无关话题,只保留完整讲好一件事的片段。
|
|
125
|
+
</details>
|
|
82
126
|
|
|
83
127
|
---
|
|
84
128
|
|
|
85
|
-
##
|
|
129
|
+
## 常见问题
|
|
86
130
|
|
|
87
|
-
|
|
88
|
-
- `description`:点击播放前在空白舞台中央展示的开场导读。
|
|
89
|
-
- `lang`:界面默认语言(`"zh"` 或 `"en"`,也可点击网页右上角按钮随时切换中英文)。
|
|
90
|
-
- `frames`:过程图片数组 `[{ time, img, who, label, w, h }]`,删掉不需要的项即可从时间轴和对话流中移除该图。
|
|
91
|
-
- `deliverables`:会话结束时展示的最终成果列表 `[{ title, href, meta, cover }]`。
|
|
131
|
+
### 日志会上传吗?隐私怎么处理?
|
|
92
132
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
--from <iso-time> 起始时间切片(如 2026-11-10T09:00)
|
|
105
|
-
--to <iso-time> 结束时间切片
|
|
106
|
-
--no-images 不提取内嵌图片
|
|
107
|
-
--include-memory 保留完整的跨会话 MEMORY_SUMMARY / 用户级 CLAUDE.md 原文(默认自动折叠脱敏)
|
|
108
|
-
--list 仅列出本机最近会话,不进入交互菜单
|
|
109
|
-
--no-serve 生成文件后直接退出,不启动本地预览服务
|
|
110
|
-
-v, --version 显示版本号
|
|
133
|
+
**不会,全部在本地运行。**
|
|
134
|
+
|
|
135
|
+
- **自动脱敏**:隐藏常见密钥、私钥、JWT、数据库连接串、邮箱、内网 IP 与本机用户目录(替换为 `~`),默认省略 `MEMORY_SUMMARY` 与用户级 `CLAUDE.md` 正文,并输出非阻塞泄露检查预警。
|
|
136
|
+
- **需人工复核**:项目代号、业务数据,以及 `attachments/` 里复制进来的原件(PDF、工作簿、图片、视频)不会被自动改写。
|
|
137
|
+
|
|
138
|
+
### 为什么双击 `index.html` 无法播放?
|
|
139
|
+
|
|
140
|
+
浏览器安全策略会拦截 `file://` 协议下的 `fetch('./session.json')` 请求。用本地预览服务打开,或部署到任意静态托管即可:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npx @niracler/encore@latest play ./replays/<会话短名>
|
|
111
144
|
```
|
|
112
145
|
|
|
113
|
-
|
|
146
|
+
### 导出后删掉原始日志或原文件,回放会坏吗?
|
|
147
|
+
|
|
148
|
+
**不会。** 回放目录是自包含的静态包(`session.json`、`.webp` 画面帧、`attachments/` 与播放器文件),保持整个目录完整即可;只有外链 URL 仍依赖原地址。
|
|
149
|
+
|
|
150
|
+
### 为什么附件会标为「导出时的副本」或「原文件缺失」?
|
|
151
|
+
|
|
152
|
+
- **已核对版本**:文件在允许的资产根目录内找到,且 SHA-256 与日志记录一致。
|
|
153
|
+
- **导出时的副本**:文件在导出时找到了,但日志里没有可比对的摘要或内容已变化。
|
|
154
|
+
- **原文件缺失 / 未收录**:日志引用了该文件,但导出时在磁盘上已找不到,或位于资产根目录之外(可用 `--asset-root` 补充目录;原消息下会保留文件名)。
|
|
155
|
+
|
|
156
|
+
### 上下文快照里的 Token 数值是实际账单吗?
|
|
157
|
+
|
|
158
|
+
**不是。** 它用于观察上下文结构与增长趋势:原始日志带真实统计(含压缩前后 `preTokens` / `postTokens`)时直接显示,缺失步级或分类明细时按内容长度估算。
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## 参与贡献与开源协议
|
|
163
|
+
|
|
164
|
+
架构说明与开发命令见 [`AGENTS.md`](./AGENTS.md),统一领域术语见 [`GLOSSARY.md`](./GLOSSARY.md)。提交改动前运行 `pnpm test` 验证适配器、脱敏规则与播放器构建产物一致性;如需支持其他 AI Agent 日志格式,欢迎提交 Issue。
|
|
114
165
|
|
|
115
166
|
[MIT](./LICENSE)
|