Skip to content

Commit 8f05cf8

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/ai-5975-tool-error-propagation
2 parents 3623461 + 12ed190 commit 8f05cf8

48 files changed

Lines changed: 2716 additions & 965 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.opencode/skills/data-viz/SKILL.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ A single insight might just be one chart with a headline and annotation. Scale c
100100
- **Responsive**: `min-h-[VALUE]` on all charts. Grid stacks on mobile
101101
- **Animation**: Entry transitions only, `duration-300` to `duration-500`. Never continuous
102102
- **Accessibility**: `aria-label` on charts, WCAG AA contrast, don't rely on color alone
103+
- **Dynamic color safety**: When colors come from external sources (brand palettes, category maps, API data, user config), never apply them directly as text color without a contrast check. Dark colors are invisible on dark card backgrounds. Safe pattern: use the external color only for non-text elements (left border, dot, underline); always use the standard text color (white / `var(--text)`) for the label itself. If color-coded text is required, apply a minimum lightness floor: `color: hsl(from brandColor h s max(l, 60%))`
104+
- **Icon semantics**: Verify every icon matches its label's actual meaning, not just its visual shape. Common traps: using a rising-trend icon (📈) for metrics where lower is better (latency, error rate, cost); using achievement icons (🏆) for plain counts. When in doubt, use a neutral descriptive icon over a thematic one that could mislead
103105

104106
### Step 5: Interactivity & Annotations
105107

@@ -133,3 +135,16 @@ A single insight might just be one chart with a headline and annotation. Scale c
133135
- Pie charts > 5 slices — use horizontal bar
134136
- Unlabeled dual y-axes — use two separate charts
135137
- Truncated bar axes — always start at zero
138+
- Filtering or mapping over a field not confirmed to exist in the data export — an undefined field in `.filter()` or `.map()` produces empty arrays or NaN silently, not an error; always validate the exported schema matches what the chart code consumes
139+
140+
## Pre-Delivery Checklist
141+
142+
Before marking a dashboard complete:
143+
144+
- [ ] Every tab / view activated — all charts render (no blank canvases, no unexpected 0–1 axes)
145+
- [ ] Every field referenced in chart/filter code confirmed present in the data export
146+
- [ ] All text readable on its background — check explicitly when colors come from external data
147+
- [ ] All icons match their label's meaning
148+
- [ ] Tooltips appear on hover for every chart
149+
- [ ] No chart silently receives an empty dataset — add a visible empty state or console warning
150+
- [ ] Mobile: grid stacks correctly, no body-level horizontal overflow

.opencode/skills/data-viz/references/component-guide.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,3 +392,70 @@ const CalloutLabel = ({ viewBox, label, color = "#1e293b" }: { viewBox?: { x: nu
392392
```
393393

394394
**Rules:** Never overlap data. Use `position: "insideTopRight"/"insideTopLeft"` on labels. Pair annotations with tooltips — annotation names the event, tooltip shows the value.
395+
396+
---
397+
398+
## Multi-Tab Dashboard — Lazy Chart Initialization
399+
400+
Charts initialized inside a hidden container (`display:none`) render blank. Chart.js, Recharts, and Nivo all read container dimensions at mount time — a hidden container measures as `0×0`.
401+
402+
**Rule: never initialize a chart until its container is visible.**
403+
404+
```js
405+
// Vanilla JS pattern
406+
var _inited = {};
407+
408+
function activateTab(name) {
409+
// 1. make the tab visible first
410+
document.querySelectorAll('.tab').forEach(el => el.classList.remove('active'));
411+
document.getElementById('tab-' + name).classList.add('active');
412+
// 2. then initialize charts — only on first visit
413+
if (!_inited[name]) {
414+
_inited[name] = true;
415+
initChartsFor(name);
416+
}
417+
}
418+
419+
activateTab('overview'); // init the default visible tab on page load
420+
```
421+
422+
Library-specific notes:
423+
- **Chart.js**: canvas reads as `0×0` inside `display:none` — bars/lines never appear
424+
- **Recharts `ResponsiveContainer`**: reads `clientWidth = 0` — chart collapses to nothing
425+
- **Nivo `Responsive*`**: uses `ResizeObserver` — fires once at `0×0`, never re-fires on show
426+
- **React conditional rendering**: prefer `visibility:hidden` + `position:absolute` over toggling `display:none` if you want charts to stay mounted and pre-rendered
427+
428+
---
429+
430+
## Programmatic Dashboard Generation — Data-Code Separation
431+
432+
When generating a standalone HTML dashboard from a script (Python, shell, etc.), never embed JSON data inside a template string that also contains JavaScript. Curly-brace collisions in f-strings / template literals cause silent JS parse failures that are hard to debug.
433+
434+
**Wrong** — data and JS logic share one f-string, every `{` in JS must be escaped as `{{`:
435+
436+
```python
437+
html = f"""
438+
<script>
439+
const data = {json.dumps(data)}; // fine
440+
const fn = () => {{ return x; }} // must escape — easy to miss
441+
const obj = {{ key: getValue() }}; // one missed escape = blank page
442+
</script>
443+
"""
444+
```
445+
446+
**Right** — separate data from logic entirely:
447+
448+
```python
449+
# Step 1: write data to its own file — no template string needed
450+
with open('data.js', 'w') as f:
451+
f.write('const DATA = ' + json.dumps(data) + ';')
452+
453+
# Step 2: HTML loads both files; app.js is static and never needs escaping
454+
```
455+
456+
```html
457+
<script src="data.js"></script> <!-- generated, data only -->
458+
<script src="app.js"></script> <!-- static, logic only -->
459+
```
460+
461+
Benefits: `app.js` is static and independently testable; `data.js` is regenerated without touching logic; no escaping required in either file.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3232

3333
### Added
3434

35-
- **Recap (renamed from Tracer)** — session recap with loop detection and enhanced viewer (#381)
35+
- **Trace (session recording)** — session trace with loop detection and enhanced viewer (#381)
3636
- **ESM bundling regression tests** — 9 e2e tests verifying Node can load `altimate-dbt` via symlink, wrapper, and direct invocation paths
3737

3838
### Testing

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ Manifest parsing, test generation, model scaffolding, incremental model detectio
131131
### Data Visualization
132132
Interactive charts and dashboards from SQL results. The data-viz skill generates publication-ready visualizations with automatic chart type selection based on your data.
133133
134-
### Local-First Recap
135-
Built-in observability for AI interactions — recap tool calls, token usage, and session activity locally. No external services required. View recaps with `altimate recap`. Features include loop detection, post-session summary, and shareable HTML exports.
134+
### Local-First Tracing
135+
Built-in observability for AI interactions — trace tool calls, token usage, and session activity locally. No external services required. View session recordings with `altimate trace`. Features include loop detection, post-session summary, and shareable HTML exports.
136136
137137
### AI Teammate Training
138138
Teach your AI teammate project-specific patterns, naming conventions, and best practices. The training system learns from examples and applies rules automatically across sessions.
File renamed without changes.
File renamed without changes.
Lines changed: 53 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
1-
# Recap
1+
# Trace
22

3-
Altimate Code captures detailed recaps of every session, including LLM generations, tool calls, token usage, cost, and timing, and saves them locally as JSON files. Recaps are invaluable for debugging agent behavior, optimizing cost, and understanding how the agent solves problems.
3+
Altimate Code captures detailed traces (session recordings) of every session, including LLM generations, tool calls, token usage, cost, and timing, and saves them locally as JSON files. Traces are invaluable for debugging agent behavior, optimizing cost, and understanding how the agent solves problems.
44

5-
Recap is **enabled by default** and requires no configuration. Recaps are stored locally and never leave your machine unless you configure a remote exporter.
5+
Tracing is **enabled by default** and requires no configuration. Traces are stored locally and never leave your machine unless you configure a remote exporter.
66

7-
![Recap Summary View](../assets/images/recap/summary-tab.png)
8-
9-
!!! note "Renamed from Tracer"
10-
The tracer feature has been renamed to **recap**. The `trace` command still works as a backward-compatible alias (`--no-trace` is the backward-compatible flag name). New features include loop detection, post-session summary, and shareable HTML exports.
7+
![Trace Summary View](../assets/images/trace/summary-tab.png)
118

129
## Quick Start
1310

1411
```bash
15-
# Run a prompt (recap is saved automatically)
12+
# Run a prompt (trace is saved automatically)
1613
altimate-code run "optimize my most expensive queries"
17-
#Recap saved: ~/.local/share/altimate-code/traces/abc123.json
14+
#Trace saved: ~/.local/share/altimate-code/traces/abc123.json
1815

19-
# List recent recaps
20-
altimate-code recap list
16+
# List recent traces
17+
altimate-code trace list
2118

22-
# View a recap in the browser
23-
altimate-code recap view abc123
19+
# View a trace in the browser
20+
altimate-code trace view abc123
2421
```
2522

2623
## What's Captured
2724

28-
Each recap records the full agent session:
25+
Each trace records the full agent session:
2926

3027
| Data | Description |
3128
|------|-------------|
@@ -41,7 +38,7 @@ Each recap records the full agent session:
4138

4239
### Data Engineering Attributes
4340

44-
When using SQL and dbt tools, recaps automatically capture domain-specific data:
41+
When using SQL and dbt tools, traces automatically capture domain-specific data:
4542

4643
| Category | Examples |
4744
|----------|----------|
@@ -51,7 +48,7 @@ When using SQL and dbt tools, recaps automatically capture domain-specific data:
5148
| **Data Quality** | Row counts, null percentages, freshness, anomaly detection |
5249
| **Cost Attribution** | LLM cost + warehouse compute cost + storage delta = total cost, per user/team/project |
5350

54-
These attributes are purely optional. Recaps are valid without them. They're populated automatically by tools that have access to warehouse metadata.
51+
These attributes are purely optional. Traces are valid without them. They're populated automatically by tools that have access to warehouse metadata.
5552

5653
## Configuration
5754

@@ -70,12 +67,12 @@ Add to your config file (`~/.config/altimate-code/altimate-code.json` or project
7067

7168
| Option | Type | Default | Description |
7269
|--------|------|---------|-------------|
73-
| `enabled` | `boolean` | `true` | Enable or disable recap |
74-
| `dir` | `string` | `~/.local/share/altimate-code/traces/` | Custom directory for recap files |
75-
| `maxFiles` | `number` | `100` | Max recap files to keep (oldest pruned automatically). Set to `0` for unlimited |
70+
| `enabled` | `boolean` | `true` | Enable or disable tracing |
71+
| `dir` | `string` | `~/.local/share/altimate-code/traces/` | Custom directory for trace files |
72+
| `maxFiles` | `number` | `100` | Max trace files to keep (oldest pruned automatically). Set to `0` for unlimited |
7673
| `exporters` | `array` | `[]` | Remote HTTP exporters (see below) |
7774

78-
### Disabling Recap
75+
### Disabling Tracing
7976

8077
```json
8178
{
@@ -91,15 +88,15 @@ Or per-run with the `--no-trace` flag:
9188
altimate-code run --no-trace "quick question"
9289
```
9390

94-
## Viewing Recaps
91+
## Viewing Traces
9592

96-
### List Recaps
93+
### List Traces
9794

9895
```bash
99-
altimate-code recap list
96+
altimate-code trace list
10097
```
10198

102-
Shows a table of recent recaps with session ID, timestamp, duration, tokens, cost, tool calls, and status.
99+
Shows a table of recent traces with session ID, timestamp, duration, tokens, cost, tool calls, and status.
103100

104101
```
105102
SESSION WHEN DURATION TOKENS COST TOOLS STATUS PROMPT
@@ -112,17 +109,17 @@ Options:
112109

113110
| Flag | Description |
114111
|------|-------------|
115-
| `-n`, `--limit` | Number of recaps to show (default: 20) |
112+
| `-n`, `--limit` | Number of traces to show (default: 20) |
116113

117-
### View a Recap
114+
### View a Trace
118115

119116
```bash
120-
altimate-code recap view <session-id>
117+
altimate-code trace view <session-id>
121118
```
122119

123-
Opens a local web server with an interactive recap viewer in your browser.
120+
Opens a local web server with an interactive trace viewer in your browser.
124121

125-
![Recap Full View](../assets/images/recap/summary-full.png)
122+
![Trace Full View](../assets/images/trace/summary-full.png)
126123

127124
The viewer has 5 tabs:
128125

@@ -148,35 +145,35 @@ Options:
148145
| `--port` | Port for the viewer server (default: random) |
149146
| `--live` | Auto-refresh every 2s for in-progress sessions |
150147

151-
Partial session ID matching is supported. For example, `altimate-code recap view abc` matches `abc123def456`.
148+
Partial session ID matching is supported. For example, `altimate-code trace view abc` matches `abc123def456`.
152149

153150
### Live Viewing (In-Progress Sessions)
154151

155-
Recaps are written incrementally. After every tool call and generation, a snapshot is flushed to disk. This means you can view a recap while the session is still running:
152+
Traces are written incrementally. After every tool call and generation, a snapshot is flushed to disk. This means you can view a trace while the session is still running:
156153

157154
```bash
158155
# In terminal 1: run a long task
159156
altimate-code run "refactor the entire pipeline"
160157

161-
# In terminal 2: watch the recap live
162-
altimate-code recap view <session-id> --live
158+
# In terminal 2: watch the trace live
159+
altimate-code trace view <session-id> --live
163160
```
164161

165162
The `--live` flag adds a green "LIVE" indicator and polls for updates every 2 seconds. The page auto-refreshes when new spans appear.
166163

167164
### From the TUI
168165

169-
Type `/recap` in the TUI to open a recap history dialog listing all recent sessions. Select any recap to open it in your browser with the interactive viewer. The current session appears at the top, and recaps are grouped by date with duration and timestamp info.
166+
Type `/trace` in the TUI to open a trace history dialog listing all recent sessions. Select any trace to open it in your browser with the interactive viewer. The current session appears at the top, and traces are grouped by date with duration and timestamp info.
170167

171168
The viewer launches in live mode automatically for in-progress sessions, so you can watch spans appear as the agent works.
172169

173-
### Sharing Recaps
170+
### Sharing Traces
174171

175-
The recap viewer includes a **Share** button that exports a self-contained HTML file. This file includes all session data and can be opened in any browser without a server — perfect for sharing with teammates, attaching to tickets, or archiving sessions.
172+
The trace viewer includes a **Share Trace** button that exports a self-contained HTML file. This file includes all session data and can be opened in any browser without a server — perfect for sharing with teammates, attaching to tickets, or archiving sessions.
176173

177174
## Remote Exporters
178175

179-
Recaps can be sent to remote backends via HTTP POST. Each exporter receives the full recap JSON on session completion.
176+
Traces can be sent to remote backends via HTTP POST. Each exporter receives the full trace JSON on session completion.
180177

181178
```json
182179
{
@@ -197,7 +194,7 @@ Recaps can be sent to remote backends via HTTP POST. Each exporter receives the
197194
| Field | Type | Description |
198195
|-------|------|-------------|
199196
| `name` | `string` | Identifier for this exporter (used in logs) |
200-
| `endpoint` | `string` | HTTP endpoint to POST recap JSON to |
197+
| `endpoint` | `string` | HTTP endpoint to POST trace JSON to |
201198
| `headers` | `object` | Custom headers (e.g., auth tokens) |
202199

203200
**How it works:**
@@ -208,9 +205,9 @@ Recaps can be sent to remote backends via HTTP POST. Each exporter receives the
208205
- Exporters have a 10-second timeout
209206
- All export operations are best-effort and never crash the CLI
210207

211-
## Recap File Format
208+
## Trace File Format
212209

213-
Recaps are stored as JSON files in the traces directory. The schema is versioned for forward compatibility.
210+
Traces are stored as JSON files in the traces directory. The schema is versioned for forward compatibility.
214211

215212
```json
216213
{
@@ -322,15 +319,15 @@ All domain-specific attributes use the `de.*` prefix and are stored in the `attr
322319

323320
## Crash Recovery
324321

325-
Recaps are designed to survive process crashes:
322+
Traces are designed to survive process crashes:
326323

327-
1. **Immediate snapshot.** A recap file is written as soon as the session starts, before any LLM interaction. Even if the process crashes immediately, a minimal recap file exists.
324+
1. **Immediate snapshot.** A trace file is written as soon as the session starts, before any LLM interaction. Even if the process crashes immediately, a minimal trace file exists.
328325

329-
2. **Incremental snapshots.** After every tool call and generation completion, the recap file is updated atomically (write to temp file, then rename). The file on disk always contains a valid, complete JSON document.
326+
2. **Incremental snapshots.** After every tool call and generation completion, the trace file is updated atomically (write to temp file, then rename). The file on disk always contains a valid, complete JSON document.
330327

331-
3. **Crash handlers.** The `run` command registers `SIGINT`/`SIGTERM`/`beforeExit` handlers that flush the recap synchronously with a `"crashed"` status.
328+
3. **Crash handlers.** The `run` command registers `SIGINT`/`SIGTERM`/`beforeExit` handlers that flush the trace synchronously with a `"crashed"` status.
332329

333-
4. **Status indicators.** Recap status tells you exactly what happened:
330+
4. **Status indicators.** Trace status tells you exactly what happened:
334331

335332
| Status | Meaning |
336333
|--------|---------|
@@ -339,31 +336,31 @@ Recaps are designed to survive process crashes:
339336
| `running` | Session is still in progress (visible in live mode) |
340337
| `crashed` | Process was interrupted before the session completed |
341338

342-
Crashed recaps contain all data up to the last successful snapshot. You can view them normally with `altimate-code recap view`.
339+
Crashed traces contain all data up to the last successful snapshot. You can view them normally with `altimate-code trace view`.
343340

344-
## Historical Recaps
341+
## Historical Traces
345342

346-
All recaps are stored in the traces directory and persist across sessions. Use `recap list` to browse history:
343+
All traces are stored in the traces directory and persist across sessions. Use `trace list` to browse history:
347344

348345
```bash
349-
# Show the last 50 recaps
350-
altimate-code recap list -n 50
346+
# Show the last 50 traces
347+
altimate-code trace list -n 50
351348

352-
# View any historical recap
353-
altimate-code recap view <session-id>
349+
# View any historical trace
350+
altimate-code trace view <session-id>
354351
```
355352

356-
Recaps are automatically pruned when `maxFiles` is exceeded (default: 100). The oldest recaps are removed first. Set `maxFiles: 0` for unlimited retention.
353+
Traces are automatically pruned when `maxFiles` is exceeded (default: 100). The oldest traces are removed first. Set `maxFiles: 0` for unlimited retention.
357354

358355
## Privacy
359356

360-
Recaps are stored **locally only** by default. They contain:
357+
Traces are stored **locally only** by default. They contain:
361358

362359
- The prompt you sent
363360
- Tool inputs and outputs (SQL queries, file contents, command results)
364361
- Model responses
365362

366-
If you configure remote exporters, recap data is sent to those endpoints. No recap data is included in the anonymous telemetry described in [Telemetry](../reference/telemetry.md).
363+
If you configure remote exporters, trace data is sent to those endpoints. No trace data is included in the anonymous telemetry described in [Telemetry](../reference/telemetry.md).
367364

368365
!!! warning "Sensitive Data"
369-
Recaps may contain SQL queries, file paths, and command outputs from your session. If you share recap files or configure remote exporters, be aware that this data will be included.
366+
Traces may contain SQL queries, file paths, and command outputs from your session. If you share trace files or configure remote exporters, be aware that this data will be included.

docs/docs/data-engineering/guides/ci-headless.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,16 @@ fi
137137

138138
---
139139

140-
## Recap in Headless Mode
140+
## Traces in Headless Mode
141141

142-
Recap works in headless mode. View recaps after the run:
142+
Tracing works in headless mode. View traces (session recordings) after the run:
143143

144144
```bash
145-
altimate recap list
146-
altimate recap view <session-id>
145+
altimate trace list
146+
altimate trace view <session-id>
147147
```
148148

149-
See [Recap](../../configure/recap.md) for the full recap reference.
149+
See [Trace](../../configure/trace.md) for the full trace reference.
150150

151151
---
152152

0 commit comments

Comments
 (0)