conversation-replay 0.1.1
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.md +21 -0
- package/README.md +291 -0
- package/dist/cli.js +9450 -0
- package/package.json +41 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zeltser Security Corp.
|
|
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,291 @@
|
|
|
1
|
+
# Conversation Replay
|
|
2
|
+
|
|
3
|
+
Conversation Replay is a "video" player for conversations.
|
|
4
|
+
|
|
5
|
+
After parsing the annotated conversation data you supply in a YAML file, this tool will generate a self-contained embeddable replay that uses HTML, JavaScript, and CSS. This can be help in security awareness, training, and web publishing situations.
|
|
6
|
+
|
|
7
|
+
- [Conversation Replay](#conversation-replay)
|
|
8
|
+
- [How This Is Useful](#how-this-is-useful)
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
10
|
+
- [YAML Schema](#yaml-schema)
|
|
11
|
+
- [Basic Structure](#basic-structure)
|
|
12
|
+
- [Step Types](#step-types)
|
|
13
|
+
- [Message Options](#message-options)
|
|
14
|
+
- [Meta Options](#meta-options)
|
|
15
|
+
- [Output Features](#output-features)
|
|
16
|
+
- [Embedding in Websites](#embedding-in-websites)
|
|
17
|
+
- [Automatic "Seamless" Mode](#automatic-seamless-mode)
|
|
18
|
+
- [Basic Iframe Code](#basic-iframe-code)
|
|
19
|
+
- [Dark Mode Sync](#dark-mode-sync)
|
|
20
|
+
- [Multi-Scenario Demos](#multi-scenario-demos)
|
|
21
|
+
- [Development](#development)
|
|
22
|
+
- [Repository Structure](#repository-structure)
|
|
23
|
+
- [Commands](#commands)
|
|
24
|
+
- [AI Agent Quick Reference](#ai-agent-quick-reference)
|
|
25
|
+
- [Key Files](#key-files)
|
|
26
|
+
- [Architecture](#architecture)
|
|
27
|
+
- [Threat Modeling](#threat-modeling)
|
|
28
|
+
- [Author](#author)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## How This Is Useful
|
|
32
|
+
|
|
33
|
+
Security training often involves showing how attacks unfold through conversation—phishing emails, social engineering calls, BEC attempts, scammer chat interactions. Static screenshots lose the temporal element. Video production is time-consuming and hard to update.
|
|
34
|
+
|
|
35
|
+
Conversation Replay lets you:
|
|
36
|
+
|
|
37
|
+
- **Define Conversations in YAML:** Easy to create, annotate, review, and version control
|
|
38
|
+
- **Generate Self-Contained HTML:** No external dependencies, works offline
|
|
39
|
+
- **Slick Design:** Modern UI, nice typography, clean colors, and smooth animations
|
|
40
|
+
- **Embed Anywhere:** Seamlessly integrates into blogs and LMS platforms
|
|
41
|
+
|
|
42
|
+
Want to see it in action? Open the pre-generated demo replays [examples/london-scam.html](examples/london-scam.html) or [examples/ir-report.html](examples/ir-report.html) directly in your browser.
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
To build your own conversation replay:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Prerequisite: Bun (https://bun.sh) or Node.js 18+
|
|
50
|
+
|
|
51
|
+
# Install dependencies
|
|
52
|
+
bun install
|
|
53
|
+
|
|
54
|
+
# Build a demo from YAML
|
|
55
|
+
bun run src/cli.ts build examples/london-scam.yaml -o demo.html
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Output:
|
|
59
|
+
```
|
|
60
|
+
Loading examples/london-scam.yaml...
|
|
61
|
+
Building demo.html...
|
|
62
|
+
Done! Generated demo.html
|
|
63
|
+
Title: London Scam - Social Engineering Demo
|
|
64
|
+
Scenarios: 1
|
|
65
|
+
- London Scam: 17 steps (Matt (compromised account), Rakesh)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Open in browser
|
|
70
|
+
open demo.html
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The generated replay is responsive, supports dark mode automatically, and looks nice across various browsers and devices.
|
|
74
|
+
|
|
75
|
+
## YAML Schema
|
|
76
|
+
|
|
77
|
+
### Basic Structure
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
meta:
|
|
81
|
+
title: "Demo Title"
|
|
82
|
+
description: "Shown in header"
|
|
83
|
+
theme: chat # chat | email | slack | terminal | generic
|
|
84
|
+
autoAdvance: true # Auto-advance between scenarios
|
|
85
|
+
|
|
86
|
+
scenarios:
|
|
87
|
+
- id: scenario-1
|
|
88
|
+
title: "Scenario Name" # Shown in tab (if multiple scenarios)
|
|
89
|
+
participants:
|
|
90
|
+
- id: attacker
|
|
91
|
+
label: "Scammer"
|
|
92
|
+
role: left # Messages appear on left
|
|
93
|
+
- id: victim
|
|
94
|
+
label: "Target"
|
|
95
|
+
role: right # Messages appear on right
|
|
96
|
+
steps:
|
|
97
|
+
- type: message
|
|
98
|
+
from: attacker
|
|
99
|
+
content: "Hey, how are you?"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Step Types
|
|
103
|
+
|
|
104
|
+
| Type | Purpose | Renders As |
|
|
105
|
+
|------|---------|------------|
|
|
106
|
+
| `message` | Conversation turn | Chat bubble aligned left or right based on participant role |
|
|
107
|
+
| `annotation` | Educational note | Highlighted callout with vertical accent bar |
|
|
108
|
+
| `transition` | Scene break | Centered text card indicating time/scene change |
|
|
109
|
+
|
|
110
|
+
### Message Options
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
# Basic message
|
|
114
|
+
- type: message
|
|
115
|
+
from: attacker
|
|
116
|
+
content: "Transfer the funds immediately."
|
|
117
|
+
|
|
118
|
+
# Message with code block
|
|
119
|
+
- type: message
|
|
120
|
+
from: analyst
|
|
121
|
+
content: "Here's what I found:"
|
|
122
|
+
codeBlock: |
|
|
123
|
+
error: unauthorized access
|
|
124
|
+
source: 192.168.1.105
|
|
125
|
+
|
|
126
|
+
# Message with footnote
|
|
127
|
+
- type: message
|
|
128
|
+
from: ai
|
|
129
|
+
content: "I can help with that."
|
|
130
|
+
footnote: "The AI performs a RAG search here."
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Meta Options
|
|
134
|
+
|
|
135
|
+
Display & Behavior:
|
|
136
|
+
```yaml
|
|
137
|
+
meta:
|
|
138
|
+
description: "Shown below title"
|
|
139
|
+
theme: chat # chat | email | slack | terminal | generic
|
|
140
|
+
articleUrl: "/related-article" # "View Article" link in header
|
|
141
|
+
annotationLabel: "Security Note" # Label for annotations
|
|
142
|
+
autoAdvance: true # Auto-play next scenario when current ends
|
|
143
|
+
hideHeaderInIframe: true # Hide header when embedded (default: true)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Custom colors (New Slate/Indigo Default Palette):
|
|
147
|
+
You can override any color, but the defaults are designed for a premium look:
|
|
148
|
+
```yaml
|
|
149
|
+
meta:
|
|
150
|
+
colors:
|
|
151
|
+
accent: "#4f46e5" # Indigo 600 (Buttons, links)
|
|
152
|
+
pageBg: "#f8fafc" # Slate 50 (Page background standalone)
|
|
153
|
+
canvasBg: "#ffffff" # Chat container background
|
|
154
|
+
leftBg: "#eef2ff" # Indigo 50 (Left/User bubble)
|
|
155
|
+
leftBorder: "transparent" # Border for left bubble
|
|
156
|
+
rightBg: "#f1f5f9" # Slate 100 (Right/AI bubble)
|
|
157
|
+
rightBorder: "transparent" # Border for right bubble
|
|
158
|
+
tabInactiveColor: "#94a3b8" # Slate 400
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Output Features
|
|
162
|
+
|
|
163
|
+
Generated HTML files include:
|
|
164
|
+
|
|
165
|
+
- **Zero Dependencies:** Everything inlined.
|
|
166
|
+
- **Dark Mode:** Automatic system preference detection and sync support.
|
|
167
|
+
- **Seamless Embedding:** Detects iframes and automatically removes padding/backgrounds.
|
|
168
|
+
- **Accessibility:** ARIA labels, keyboard navigation, reduced motion support.
|
|
169
|
+
- **Controls:** Floating glass bar with Play/Pause, Restart, and Speed (0.5x–4x).
|
|
170
|
+
|
|
171
|
+
## Embedding in Websites
|
|
172
|
+
|
|
173
|
+
The player is designed to look good when embedded in web pages.
|
|
174
|
+
|
|
175
|
+
### Automatic "Seamless" Mode
|
|
176
|
+
When the the player detects it is running inside an `iframe`:
|
|
177
|
+
1. **Removes Padding**: The outer page padding is removed.
|
|
178
|
+
2. **Transparent Background**: The page background becomes transparent, blending with your website.
|
|
179
|
+
3. **Hides Scrollbars**: Internal scrollbars are hidden for a "video" look, while keeping content scrollable.
|
|
180
|
+
|
|
181
|
+
### Basic Iframe Code
|
|
182
|
+
|
|
183
|
+
```html
|
|
184
|
+
<iframe
|
|
185
|
+
src="/demos/security-awareness.html"
|
|
186
|
+
style="width: 100%; height: 600px; border: none; border-radius: 12px; overflow: hidden;"
|
|
187
|
+
title="Security Awareness Demo"
|
|
188
|
+
loading="lazy"
|
|
189
|
+
></iframe>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Dark Mode Sync
|
|
193
|
+
|
|
194
|
+
To sync the player's theme with your website's dark mode toggle:
|
|
195
|
+
|
|
196
|
+
```javascript
|
|
197
|
+
// Send a message to the iframe
|
|
198
|
+
const iframe = document.querySelector('iframe');
|
|
199
|
+
iframe.contentWindow.postMessage({
|
|
200
|
+
type: 'theme-change',
|
|
201
|
+
theme: 'dark' // or 'light'
|
|
202
|
+
}, '*');
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Multi-Scenario Demos
|
|
206
|
+
|
|
207
|
+
Create rich, multi-part interactive stories using tabs.
|
|
208
|
+
|
|
209
|
+
```yaml
|
|
210
|
+
scenarios:
|
|
211
|
+
- id: part1
|
|
212
|
+
title: "Phishing Attempt"
|
|
213
|
+
steps: [...]
|
|
214
|
+
|
|
215
|
+
- id: part2
|
|
216
|
+
title: "Incident Response"
|
|
217
|
+
steps: [...]
|
|
218
|
+
|
|
219
|
+
- id: part3
|
|
220
|
+
title: "Remediation"
|
|
221
|
+
steps: [...]
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- **Tabs appear automatically** at the top of the player.
|
|
225
|
+
- **Auto-Advance**: If `autoAdvance: true` is set, the player smoothly transitions to the next tab when a scenario finishes.
|
|
226
|
+
|
|
227
|
+
## Development
|
|
228
|
+
|
|
229
|
+
### Repository Structure
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
conversation-replay/
|
|
233
|
+
├── src/
|
|
234
|
+
│ ├── cli.ts # CLI entry point
|
|
235
|
+
│ ├── parser.ts # YAML parsing & validation
|
|
236
|
+
│ ├── generator.ts # HTML generation (CSS/JS injection)
|
|
237
|
+
│ └── types.ts # TypeScript definitions
|
|
238
|
+
├── examples/ # Demo YAML files
|
|
239
|
+
└── package.json
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Commands
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
# Install dependencies
|
|
246
|
+
bun install
|
|
247
|
+
|
|
248
|
+
# Build
|
|
249
|
+
bun run src/cli.ts build examples/london-scam.yaml -o demo.html
|
|
250
|
+
|
|
251
|
+
# Validate without building
|
|
252
|
+
bun run src/cli.ts validate examples/london-scam.yaml
|
|
253
|
+
|
|
254
|
+
# Build with options
|
|
255
|
+
bun run src/cli.ts build examples/london-scam.yaml -o demo.html --theme email --no-header
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## AI Agent Quick Reference
|
|
261
|
+
|
|
262
|
+
### Key Files
|
|
263
|
+
|
|
264
|
+
| File | Purpose |
|
|
265
|
+
|------|---------|
|
|
266
|
+
| `src/types.ts` | Schema definitions. Edit this to add new YAML properties. |
|
|
267
|
+
| `src/generator.ts` | The core engine. Generates the HTML, CSS, and runtime JavaScript. |
|
|
268
|
+
| `src/parser.ts` | Input validation logic. |
|
|
269
|
+
|
|
270
|
+
### Architecture
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
YAML Input -> Parser -> Generator -> Single HTML File
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
The generator produces a Single File Application:
|
|
277
|
+
- **CSS**: Generated dynamically in `generateCss()` based on theme/colors.
|
|
278
|
+
- **JavaScript**: Logic in `generateJs()` handles playback, tabs, and resizing.
|
|
279
|
+
- **Data**: Scenario data is injected as a JSON object constant.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Threat Modeling
|
|
284
|
+
|
|
285
|
+
- **No External Calls**: Generated files make no network requests.
|
|
286
|
+
- **Safe Rendering**: Uses `textContent` to mitigate XSS.
|
|
287
|
+
- **Input Validation**: Strict schema validation mitigates injection during build.
|
|
288
|
+
|
|
289
|
+
## Author
|
|
290
|
+
|
|
291
|
+
**[Lenny Zeltser](https://zeltser.com):** Builder of security products and programs. Teacher of those who run them.
|