basalt-ui 2.3.0 → 2.5.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/MIGRATING.md +79 -12
  3. package/agent/rules/basalt-state.md +1 -1
  4. package/configs/lefthook.yml +4 -1
  5. package/dist/agent/ai-sdk-transport.d.ts.map +1 -1
  6. package/dist/agent/ai-sdk-transport.js +4 -1
  7. package/dist/agent/index.d.ts +1 -1
  8. package/dist/agent/index.d.ts.map +1 -1
  9. package/dist/agent/run-records.d.ts +12 -3
  10. package/dist/agent/run-records.d.ts.map +1 -1
  11. package/dist/agent/run-records.js +16 -3
  12. package/dist/agent/transport.d.ts +10 -3
  13. package/dist/agent/transport.d.ts.map +1 -1
  14. package/dist/agent/use-agent-thread-runs.d.ts.map +1 -1
  15. package/dist/agent/use-agent-thread-runs.js +23 -7
  16. package/dist/charts/CartesianChart.d.ts.map +1 -1
  17. package/dist/charts/CartesianChart.js +6 -2
  18. package/dist/charts/DualPanel.d.ts +5 -1
  19. package/dist/charts/DualPanel.d.ts.map +1 -1
  20. package/dist/charts/DualPanel.js +46 -19
  21. package/dist/charts/Heatmap.js +2 -2
  22. package/dist/charts/Lines.js +2 -2
  23. package/dist/charts/MirroredBars.d.ts.map +1 -1
  24. package/dist/charts/MirroredBars.js +14 -11
  25. package/dist/charts/compile.d.ts +19 -2
  26. package/dist/charts/compile.d.ts.map +1 -1
  27. package/dist/charts/compile.js +192 -42
  28. package/dist/charts/marks.d.ts +8 -0
  29. package/dist/charts/marks.d.ts.map +1 -1
  30. package/dist/charts/marks.js +22 -1
  31. package/dist/charts/panel.d.ts +6 -0
  32. package/dist/charts/panel.d.ts.map +1 -1
  33. package/dist/charts/panel.js +12 -3
  34. package/dist/charts/types.d.ts +39 -1
  35. package/dist/charts/types.d.ts.map +1 -1
  36. package/dist/index.d.ts +1 -1
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/provider/index.d.ts.map +1 -1
  39. package/dist/provider/index.js +8 -2
  40. package/dist/state/fields.d.ts +14 -3
  41. package/dist/state/fields.d.ts.map +1 -1
  42. package/dist/state/fields.js +41 -9
  43. package/dist/telemetry.d.ts +58 -4
  44. package/dist/telemetry.d.ts.map +1 -1
  45. package/dist/telemetry.js +13 -5
  46. package/llms.txt +2 -2
  47. package/package.json +1 -1
  48. package/src/agent/ai-sdk-transport.ts +5 -2
  49. package/src/agent/index.ts +1 -1
  50. package/src/agent/run-records.ts +27 -3
  51. package/src/agent/transport.ts +11 -5
  52. package/src/agent/use-agent-thread-runs.ts +35 -8
  53. package/src/charts/CartesianChart.tsx +7 -2
  54. package/src/charts/DualPanel.tsx +50 -19
  55. package/src/charts/Heatmap.tsx +2 -2
  56. package/src/charts/Lines.tsx +2 -2
  57. package/src/charts/MirroredBars.tsx +13 -10
  58. package/src/charts/compile.ts +261 -46
  59. package/src/charts/marks.ts +35 -1
  60. package/src/charts/panel.tsx +18 -3
  61. package/src/charts/types.ts +37 -1
  62. package/src/index.ts +1 -1
  63. package/src/provider/index.tsx +8 -2
  64. package/src/state/fields.ts +79 -21
  65. package/src/telemetry.ts +70 -7
package/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ # [2.5.0](https://github.com/jkrumm/basalt-ui/compare/v2.4.0...v2.5.0) (2026-10-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * keep short-chart y labels inside only and lift ref swatch contrast ([480ca90](https://github.com/jkrumm/basalt-ui/commit/480ca90ae9ed3d7c4b9d057051bbf5308e7a871b))
7
+ * thread the short-chart label rule through composed panes ([7d56a17](https://github.com/jkrumm/basalt-ui/commit/7d56a17e6de2942a4ad7ceb385d59e40d6a4b1ff))
8
+
9
+
10
+ ### Features
11
+
12
+ * carry a call-site fallback from a store field into its control ([cb8819b](https://github.com/jkrumm/basalt-ui/commit/cb8819bd36a832258616915778ab84786291fcb7))
13
+ * make withFallback the only call-site fallback ([f946e67](https://github.com/jkrumm/basalt-ui/commit/f946e6750b52543389aea55bbf44fc11b6f2368d))
14
+ * propagate the chat turn's trace context to the chat endpoint ([c321b55](https://github.com/jkrumm/basalt-ui/commit/c321b555f4f443046ec00c1eec10d2cd124c8390))
15
+ * settle a superseded turn's trace and export the trace-context types ([7aa3781](https://github.com/jkrumm/basalt-ui/commit/7aa3781e807b0c89fc0e5dd6853240596ab000ff))
16
+
17
+ # [2.4.0](https://github.com/jkrumm/basalt-ui/compare/v2.3.0...v2.4.0) (2026-10-14)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * guard band edge rules in one place and share the tooltip row builders ([75a386b](https://github.com/jkrumm/basalt-ui/commit/75a386b677518e24fc7b13ab7c49c3469c1aaa9d))
23
+ * let the managed pre-commit pass when every staged file is lint-ignored ([dbaa6bc](https://github.com/jkrumm/basalt-ui/commit/dbaa6bce1ea0eefbecee0666ea94c656f81d5b18))
24
+
25
+
26
+ ### Features
27
+
28
+ * connect a series across null rows ([3c14ed1](https://github.com/jkrumm/basalt-ui/commit/3c14ed18583710c9b742cd5fa0139c75c06beb4d))
29
+ * cursor dots for marks-drawn series and edge rules on bands ([27bb5b2](https://github.com/jkrumm/basalt-ui/commit/27bb5b228e6212f9e86737aa7868ed375fd66cda))
30
+ * dashed tooltip swatches for reference and dashed series ([5938eb8](https://github.com/jkrumm/basalt-ui/commit/5938eb859fb571a527394b157ab47614406b5444))
31
+ * let a store field take a fallback derived at the call site ([3c12371](https://github.com/jkrumm/basalt-ui/commit/3c12371536a73b45418b1f75ff3479fa4012bd23))
32
+ * reference lines name themselves in the legend ([b49ae5b](https://github.com/jkrumm/basalt-ui/commit/b49ae5bb0317aa99f02e33bcb72f5f493351ddd9))
33
+ * tooltipFormat on the DualPanel bar and top specs ([bde88fe](https://github.com/jkrumm/basalt-ui/commit/bde88fe59de3cdc931a94ed52a696cec3987ab86))
34
+
1
35
  # [2.3.0](https://github.com/jkrumm/basalt-ui/compare/v2.2.0...v2.3.0) (2026-10-14)
2
36
 
3
37
 
package/MIGRATING.md CHANGED
@@ -66,18 +66,18 @@ There is one row per SURFACE, not per export, and a surface earns a row once any
66
66
  shipped lefthook preset both changed in 1.30.0 with no row that owned them — which is how a
67
67
  consumer read this index, found nothing, and diffed a KPI row that had silently gone 4-up → 2-up.
68
68
 
69
- | Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.0 | 2.2.0 | 2.3.0 | Unreleased |
70
- | ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
71
- | **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
72
- | **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
73
- | **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
74
- | **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
75
- | **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
76
- | **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
77
- | **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
78
- | **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
79
- | **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — | — | — | — |
80
- | **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
69
+ | Surface | 1.27.0 | 1.28.0 | 1.29.0 | 1.30.0 | 1.30.1 | 1.30.2 | 1.31.0 | 1.32.0 | 1.32.1 | 1.33.0 | 1.34.0 | 1.34.1 | 1.35.0 | 1.36.0 | 1.36.1 | 1.37.0 | 1.37.1 | 1.38.0 | 1.38.1 | 1.39.0 | 1.40.0 | 1.40.1 | 1.40.2 | 1.40.3 | 1.41.0 | 2.0.0 | 2.0.1 | 2.0.2 | 2.0.3 | 2.0.4 | 2.0.5 | 2.1.0 | 2.2.0 | 2.3.0 | 2.4.0 | 2.5.0 | Unreleased |
70
+ | ----------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ---------------------------------- | ------ | ------ | -------------------------------------------------------------------------------------------- | ------ | ------ | ------ | ------ | ------ | ----------------------------------------------- | ------ | ------ | ------ | ------ | ------------------------------------------------------------ | ---------- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
71
+ | **tokens** (`./tokens`) | — | `--vx-divider` → `rgba()` on both schemes (§ Shell) | `--vx-space-touch-target` added (§ Additions) | eight spacing numbers (§ Chrome) | — | — | `--vx-hit` replaces the touch vars; `SIZE_CLASSES` (§ 1.31.0) | — | `SIZE_CLASSES`/`CONTAINER_CLASSES` actually exported (§ Fixes) | `CONTAINER_GRID_BREAKPOINTS`; `raw-breakpoint` trusts it (§ 1.33.0) | `CONTAINER_KEYS` (§ 1.34.0) | — | — | — | — | — | — | — | | `appShellInset` 20 → 16 (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
72
+ | **charts** (`./charts`) | — | phone tier, `curve`, formatters, `state`, log axis (§ preamble) | `ChartState.empty: string`, `AxisBottomNumeric` (§ Additions) | responsive `height`, `legend.maxRows` (§ Charts) | `height` reaches the kinds; `maxRows` beats the `fill` fit (§ Charts) | — | container-class tier + `height` keys (§ 1.31.0) | — | `ResponsiveChartHeight` `sm` → key (§ Container recipes) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
73
+ | **shell** (`.`) | — | scrollport, region seams, **the brand left the sidebar** (§§ scrollport, brand, Shell) | `PageTitle`, `BasaltDevDock`, `useBreakpoint` (§ Additions) | More popover, aside pill, the responsive gutter, `useBasaltSpacing` (§ Chrome) | — | — | `theme.breakpoints` derived, `useSizeClass`, `data-basalt-host`, `useBreakpoint` on notice (§ 1.31.0) | `useBreakpoint` removal → 1.33.0; `useSizeClass` is shell-only (§ 1.32.0) | shell-less `shell/` gutter, `AppShell` breakpoints, `useSizeClass` for overlays (§§ Shell-less, `useSizeClass`) | — | `useBreakpoint` removed (§ 1.34.0) | — | — | `useCoarsePointer()` (§ `useCoarsePointer()`) | — | — | — | — | | content gutter 16, block 8 from `sm` (§ 1.38.1) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
74
+ | **controls** (`./controls`) | `NumberFilter`, `field.number` (§ Controls) | sheet renders panel rows; `PanelRow`, `SliderControl` (§ `basalt-ui/controls`) | — | — | — | — | — | — | — | `NumberFilter clearable`; `createSearchStore` `resets` (§ State and controls) | — | — | — | `FormSection`/`FormRow`/`FormGroup`/`FormActions` move here (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
75
+ | **forms** (`./forms`) | — | `field` → `inputProps`, **`inputProps` drops `key`**, the layout tier (§ `inputProps`) | `field` DELETED — and the `--fix` recipe no longer works (§ Consolidation) | — | — | — | — | — | `FormGroup` row no longer stretches (§ Fixes) | — | — | — | — | the layout + `useForm`/`schemaResolver` deprecated, removed 1.37.0 (§ The form layout moves) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
76
+ | **data** (`./data/table`) | — | root is a `<div>`, row selection, `getItemKey` required (§ `basalt-ui/data`) | `./data` + `./query` + `./connectivity` dropped (§ Consolidation) | — | — | — | — | — | `renderCard` documented (§ `renderCard`) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
77
+ | **dashboard** (`.`) | `StatCard`: `unit`, `breakdown`, delta format (§ `StatCard`) | `StatGroup`, `WidgetGrid`, query-aware `StatCard` — additive | — | **the column law keys on the CONTAINER; `cols={4}` is 2-up at `sm`** (§ Dashboard) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
78
+ | **toolchain** (`./configs/*`) | — | — | the shipped lefthook preset's `check-theme` BROKE — the CLI resolver stopped ascending (§ CLI) | the preset's default bin, and the `root:` recipe (§ Toolchain) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
79
+ | **CLI** (`basalt-ui`) | — | — | **resolver stops relocating; `doctor` loses 6 of 10 checks** (§ CLI) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | the managed block moves `CLAUDE.md` → `AGENTS.md` (§ 1.41.0) | — | — | — | — | — | — | — | — | — | — | — | — |
80
+ | **guards** | five rules → `error` (§ Guards) | six new ids at `warn` (§ preamble) | `query-dual-import` retired in 1.29.1 (§ Guards) | four rules → `error` (§ Guards) | — | — | — | `raw-breakpoint`: the container-grid answer, `error` at 1.33.0 (§ 1.32.0) | `FormRow`/`FormGroup` homes in both lanes; `basalt-main` dropped (§ Fixes) | C1 + breakpoint pairs → `error`; `unknown-vx-token` `warn` (§ Guards) | — | — | — | `unknown-vx-token` → `error`; the token factories throw (§ Guards) | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — | — |
81
81
 
82
82
  ---
83
83
 
@@ -992,6 +992,73 @@ optional, subpath-required peers.
992
992
  _Nothing yet. Author the next section under this heading as `## Unreleased — <title>`; the
993
993
  release renames it and opens a new one here._
994
994
 
995
+ ## 2.5.0 — call-site fallbacks for controls, chat trace headers, axis labels
996
+
997
+ - `createLocalStore` fields take `withFallback(value)`: the same field (key, setter, `clear()`)
998
+ with a call-site unset value, for `use()` and any filter control as `field=`
999
+ (`<SelectFilter field={store.field.exercise.withFallback(leader)} />`). Never persisted; a reset
1000
+ returns to it; `fallback` and `isDefault` on the derived handle report it. Rule: `basalt-state`.
1001
+ `createSearchStore` fields do not take it: the URL lane drops a value equal to the definition's
1002
+ fallback, so a second default would make one URL mean two things.
1003
+ - `use({ fallback })` is removed — replaced by `field.withFallback(value).use()`. It existed in
1004
+ 2.4.0 only and has no known consumers. argo `strength-composite-chart.tsx`: bind
1005
+ `store.field.exercise.withFallback(leader)` instead of rebuilding the store per leader.
1006
+ - A `telemetry` sink may define `startChatTurn(turn)` returning `{ headers?: { traceparent,
1007
+ tracestate? }, settle?(end) }`: `aiSdkTransport` sends those headers with that turn's chat
1008
+ request (so the API span joins the dashboard trace) and `settle` runs once when the turn ends
1009
+ (also on a superseded or failed turn). `Telemetry`, `ChatTurnTrace`, `ChatTurnEnd`,
1010
+ `TraceHeaders` are exported. Optional: without the hook nothing changes. A cross-origin chat API
1011
+ must allow `traceparent` in CORS.
1012
+ - Y-axis tick labels sit inside the plot only for a compact chart under the box's short height
1013
+ (180 px), across every kind including `DualPanel` and `MirroredBars`; a regular-height chart
1014
+ keeps them in the left gutter. Reference-line legend swatches meet the series-swatch contrast in
1015
+ light and dark.
1016
+
1017
+ ## 2.4.0 — chart gaps and legends, local-store fallbacks, the pre-commit hook
1018
+
1019
+ All additive; no call site changes. Named consumers are argo `apps/dashboard/src/features/…`.
1020
+
1021
+ - `createLocalStore` fields take `use({ fallback })`: a call-site default (e.g. a prop-derived
1022
+ leader) that applies only while the field is unset and is never persisted, so a reset returns to
1023
+ it. Replace a store rebuilt per prop with it. `createSearchStore` fields do not take it yet.
1024
+ - The managed lefthook oxlint step passes `--no-error-on-unmatched-pattern`, so a commit whose
1025
+ staged files are all in `ignorePatterns` no longer fails; a real lint error still does. Picked up
1026
+ through the extended preset.
1027
+
1028
+ - `ChartTooltipRow` takes `swatch: 'solid' | 'dashed'`. A series with `dash: 'dashed'` now lists a
1029
+ dashed swatch in its own tooltip row on `CartesianChart`, `Lines`, `Bars` and `DualPanel` (it was
1030
+ solid while the legend and the line were dashed), and a `tooltip.rows` entry sets it itself. A
1031
+ `color` per point needs no new option: `tooltip.rows(d)` already receives the datum, so the row's
1032
+ `color` can be a function of it (garmin-health `recovery-trend-chart.tsx`, its `Zone` row). argo:
1033
+ `garmin-health/charts/stress-chart.tsx` (the dashed `Overnight` line).
1034
+ - `RefLine.legend: { label, mark? }` gives a reference line its own legend entry (the line's color,
1035
+ dashed as `dashed`, role `reference`; a toggle hides the line, keyed by its index in `refLines`; series keys starting `__ref-` are reserved and throw in dev), so a threshold needs no always-`null`
1036
+ series. argo `strength-tracker/charts/weekly-volume-chart.tsx`: delete `LANDMARK_LEGEND` and put
1037
+ `legend: { label: 'MEV' }` on the three `refLines`.
1038
+ - `DualPanelBar.tooltipFormat` and `DualPanelProps.top.tooltipFormat` format the tooltip rows while
1039
+ `format` keeps the axis ticks (default: `format`; `formatValue` still wins per row). argo
1040
+ `strength-tracker/charts/momentum-chart.tsx`: drop the separate `formatValue` copy of the axis format.
1041
+ - `ChartSeries.cursorValue: (d) => number | null` gives a series drawn from your own `marks` a cursor
1042
+ dot: the y at each datum, shown while the cursor is on that x, in the series color. Pass a series
1043
+ with `getValue: () => null` (no tooltip row) and the mark stays yours. argo
1044
+ `astro-window/charts/sky-panorama.tsx` (the sun track).
1045
+ - `ZoneSpec.edge` (`side: 'top' | 'bottom' | 'both'`) and `XZoneSpec.edge` (`'start' | 'end' | 'both'`)
1046
+ draw a rule along the band's boundary, with `color`, `dashed` and `width`. A bound at the plot edge
1047
+ (infinite, outside the domain, or an omitted x bound) draws none. argo
1048
+ `astro-window/charts/night-timeline-chart.tsx`: the shooting-window `rect` + two `ruleX` become one
1049
+ `xZones` entry with `edge: { side: 'both', color: VX.accent, width: 2 }`.
1050
+ - `ChartSeries.gaps: 'break' | 'connect'` (`Lines`; default `'break'`, today's behaviour). `'connect'`
1051
+ draws the line, and its `area`, through the series' non-null points only, so a series that is null
1052
+ on most shared x values is one continuous line instead of dots and stubs. Markers stay on real
1053
+ points; the cursor and tooltip read the value at the hovered x (no value, no row). argo
1054
+ `strength-tracker/charts/relative-progression-chart.tsx` and `one-rm-trend-chart.tsx`: set
1055
+ `gaps: 'connect'` on each lift's series.
1056
+ - Not added: a per-datum `fill` for the engine's `rect`. `@tanstack/charts` 1.1.0 types `RectOptions.fill`
1057
+ as a `string`; its `color` channel resolves through the chart's own color scale, which `marks` cannot
1058
+ reach. Keep one `rect` per fill bucket (argo `astro-window/charts/sky-panorama.tsx`, skyglow).
1059
+ - The night-timeline lines can use `chartCurve(s.curve ?? 'monotone')` from 2.3.0 unchanged; nothing
1060
+ is missing there.
1061
+
995
1062
  ## 2.3.0 — optional-safe chart props, `chartCurve`, zone-coloured area
996
1063
 
997
1064
  - Every optional prop of `ChartState`, `ChartSeries`, `AxisConfig`, the tooltip config and the chart
@@ -24,7 +24,7 @@ State a control reads or writes is a field on a store; the URL wins over localSt
24
24
  - Option labels come from `.labels()` at definition, never a control prop. [type createSearchStore]
25
25
  - Route `validateSearch` is `store.validateSearch`; a wider search shape spreads `...store.validateSearch(raw)`. [type createSearchStore]
26
26
  - Read with `store.useValues()` or take the value as a prop; never `useSearch({ from: '<literal>' })`. [basalt/use-search-from-literal]
27
- - A handle's `use()` returns `[value, setValue]`; the setter owns the navigate and the persist. [type field]
27
+ - A handle's `use()` returns `[value, setValue]`; the setter owns the navigate and the persist; on a `createLocalStore` field a prop-derived default is `store.field.x.withFallback(value)`, passed to `use()` and to any control as `field=` (unset only, never persisted, a reset returns to it, `isDefault` follows it; search stores lack it, a derived handle does not derive again), never a store rebuilt per prop. [type field]
28
28
  - Count active filters and reset them with the store's `useActiveCount()` and `useReset()`; a reset unsets, it does not write the fallback. [type createSearchStore]
29
29
  - A color scheme is `useMantineColorScheme()`, never a store or `localStorage['theme']`. [check-theme localstorage-theme]
30
30
  - A preference that must survive navigation but is not URL-worthy uses `createPersistedState`, called once at module scope. [type createPersistedState]
@@ -37,9 +37,12 @@
37
37
  pre-commit:
38
38
  parallel: true
39
39
  commands:
40
+ # `--no-error-on-unmatched-pattern`: oxlint exits 1 ("No files found to lint") when EVERY staged
41
+ # file is excluded by `ignorePatterns` (a consumer's `scripts/`), failing a commit that touches
42
+ # only ignored files. A real error in a non-ignored staged file still fails.
40
43
  oxlint:
41
44
  glob: '*.{ts,tsx,js,jsx}'
42
- run: bunx oxlint {staged_files}
45
+ run: bunx oxlint --no-error-on-unmatched-pattern {staged_files}
43
46
  # `css` is load-bearing, not tidiness: oxfmt formats stylesheets, so without it a CSS-only
44
47
  # commit passes the hook and then fails the same check in CI. `oxlint` above deliberately
45
48
  # stops at JS — it has nothing to say about CSS.
@@ -1 +1 @@
1
- {"version":3,"file":"ai-sdk-transport.d.ts","sourceRoot":"","sources":["../../src/agent/ai-sdk-transport.ts"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAK1D,OAAO,KAAK,EACV,aAAa,EAGb,SAAS,EAGV,MAAM,IAAI,CAAA;AAOX,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;IAC9B,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,SA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Q,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,GAAG,SAAS,CAAA;IAC/D,oFAAoF;IACpF,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAA;IACrD;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,GAAG,SAAS,CAAA;CACrD,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,kBAAkB,CAAA;AAIzE,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,SAAS,IAAI,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG;IACvF;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;CAC/E,CAAA;AA8RD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,KAAK,GAAG,SAAS,EAC9C,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CAAC,KAAK,CAAC,CA+DvB"}
@@ -177,7 +177,10 @@ function aiSdkTransport(options) {
177
177
  messages: [userMessage],
178
178
  trigger: "submit-message",
179
179
  messageId: void 0,
180
- abortSignal: signal
180
+ abortSignal: signal,
181
+ // Per-turn trace context goes to the chat endpoint only (merged over the static headers by
182
+ // AI SDK's HTTP transport); absent, the request is exactly what it was.
183
+ ...ctx?.headers !== void 0 ? { headers: ctx.headers } : {}
181
184
  });
182
185
  yield* diffChunkStream(chatId, chunkStream, readStream, signal);
183
186
  },
@@ -18,7 +18,7 @@ export { toAgentError } from './error.js';
18
18
  export type { ChatMessage } from './history.js';
19
19
  export type { AgentThread, ThreadStatus, ThreadsStore } from './thread.js';
20
20
  export type { AgentOutcome, OutcomeResolver } from './outcome.js';
21
- export type { AgentTransport, ResumableAgentTransport } from './transport.js';
21
+ export type { AgentStreamContext, AgentTransport, ResumableAgentTransport } from './transport.js';
22
22
  export { ThreadFeed } from './chat/thread-feed.js';
23
23
  export { ThreadFeedRow } from './chat/thread-feed-row.js';
24
24
  export type { MessageAffordances } from './chat/message-affordances.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAGzF,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGtC,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC9D,YAAY,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAG1E,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,YAAY,EAAE,kBAAkB,EAAE,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,EAAE,MAAM,iBAAiB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA"}
@@ -11,12 +11,13 @@
11
11
  * being driven, long before the `setRuns` it queues renders. That window is what the record
12
12
  * covers: it outlives the run only until a render shows the outcome (`sweepFlushed`).
13
13
  */
14
+ import type { ChatTurnEnd, ChatTurnTrace } from '../telemetry.js';
14
15
  /** The part of a rendered `runs` entry this module reads. */
15
16
  type RenderedRun<TPart> = {
16
17
  readonly status: string;
17
18
  readonly parts: TPart[];
18
19
  };
19
- export type RunEnd = 'settled' | 'failed' | 'stopped';
20
+ export type RunEnd = ChatTurnEnd;
20
21
  export type RunRecord<TPart> = {
21
22
  readonly controller: AbortController;
22
23
  /** The unthrottled accumulator; `runs` may lag it by one throttle window. Emptied when the run ends. */
@@ -28,10 +29,18 @@ export type RunRecord<TPart> = {
28
29
  ended: RunEnd | undefined;
29
30
  /** A newer run began on the same thread (set by `beginRun` on the record it replaces). */
30
31
  superseded: boolean;
32
+ /** The turn's telemetry `settle`, run once by `settleTrace`. */
33
+ settle: ChatTurnTrace['settle'];
31
34
  };
32
35
  export type RunRecords<TPart> = Map<string, RunRecord<TPart>>;
33
- /** Registers a live run for `threadId`, replacing whatever record the previous run left. */
34
- export declare function beginRun<TPart>(records: RunRecords<TPart>, threadId: string, controller: AbortController): RunRecord<TPart>;
36
+ /**
37
+ * Registers a live run for `threadId`, replacing whatever record the previous run left. A previous
38
+ * run still being driven is cut short: its trace settles as `stopped`. `settle` is the new turn's
39
+ * telemetry hook (absent for a resume).
40
+ */
41
+ export declare function beginRun<TPart>(records: RunRecords<TPart>, threadId: string, controller: AbortController, settle?: ChatTurnTrace['settle']): RunRecord<TPart>;
42
+ /** Runs the turn's telemetry `settle` once; a throwing consumer hook never breaks the run. */
43
+ export declare function settleTrace<TPart>(record: RunRecord<TPart>, end: RunEnd): void;
35
44
  /** Marks a run as no longer driven and drops the content it held. */
36
45
  export declare function endRun<TPart>(record: RunRecord<TPart>, reason: RunEnd): void;
37
46
  /** True while `controller`'s run is still the thread's live one. */
@@ -1 +1 @@
1
- {"version":3,"file":"run-records.d.ts","sourceRoot":"","sources":["../../src/agent/run-records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,6DAA6D;AAC7D,KAAK,WAAW,CAAC,KAAK,IAAI;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,CAAA;CAAE,CAAA;AAE9E,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAA;AAErD,MAAM,MAAM,SAAS,CAAC,KAAK,IAAI;IAC7B,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAA;IACpC,wGAAwG;IACxG,KAAK,EAAE,KAAK,EAAE,CAAA;IACd,8DAA8D;IAC9D,QAAQ,EAAE,OAAO,CAAA;IACjB,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,0FAA0F;IAC1F,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;AAE7D,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAC5B,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,EAC1B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,eAAe,GAC1B,SAAS,CAAC,KAAK,CAAC,CAalB;AAED,qEAAqE;AACrE,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG5E;AAED,oEAAoE;AACpE,wBAAgB,MAAM,CAAC,KAAK,EAC1B,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,EAC1B,QAAQ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,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,GAC5C,MAAM,EAAE,CAKV;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEpF;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,OAAO,CAEpE;AAED,mGAAmG;AACnG,wBAAgB,YAAY,CAAC,KAAK,EAChC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,EAC1B,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,GAC5C,IAAI,CAQN"}
@@ -1,17 +1,29 @@
1
- function beginRun(records, threadId, controller) {
1
+ function beginRun(records, threadId, controller, settle) {
2
2
  const record = {
3
3
  controller,
4
4
  parts: [],
5
5
  appended: false,
6
6
  resolving: false,
7
7
  ended: void 0,
8
- superseded: false
8
+ superseded: false,
9
+ settle
9
10
  };
10
11
  const previous = records.get(threadId);
11
- if (previous !== void 0) previous.superseded = true;
12
+ if (previous !== void 0) {
13
+ previous.superseded = true;
14
+ settleTrace(previous, "stopped");
15
+ }
12
16
  records.set(threadId, record);
13
17
  return record;
14
18
  }
19
+ function settleTrace(record, end) {
20
+ const { settle } = record;
21
+ record.settle = void 0;
22
+ try {
23
+ settle?.(end);
24
+ } catch {
25
+ }
26
+ }
15
27
  function endRun(record, reason) {
16
28
  record.ended = reason;
17
29
  record.parts = [];
@@ -65,5 +77,6 @@ export {
65
77
  isLatestRun,
66
78
  isLive,
67
79
  planStopWithTombstone,
80
+ settleTrace,
68
81
  sweepFlushed
69
82
  };
@@ -13,6 +13,15 @@
13
13
  *
14
14
  */
15
15
  import type { AgentPartDraft } from './parts.js';
16
+ /**
17
+ * The third `stream` argument. `headers` are extra request headers for THIS turn's request to the
18
+ * transport's own endpoint — today the W3C trace context a telemetry sink's `startChatTurn`
19
+ * returned. Absent unless a sink contributed; a transport that ignores them keeps working.
20
+ */
21
+ export type AgentStreamContext = {
22
+ readonly messageId: string;
23
+ readonly headers?: Readonly<Record<string, string>> | undefined;
24
+ };
16
25
  /**
17
26
  * The injected transport seam. `stream(input, signal, ctx)` returns an async generator of parts.
18
27
  * Implement this interface for any backend — fetch-based SSE, AI SDK, or a mock.
@@ -40,9 +49,7 @@ import type { AgentPartDraft } from './parts.js';
40
49
  * }
41
50
  */
42
51
  export type AgentTransport<TPart = AgentPartDraft, TInput = string> = {
43
- stream: (input: TInput, signal?: AbortSignal, ctx?: {
44
- readonly messageId: string;
45
- }) => AsyncGenerator<TPart>;
52
+ stream: (input: TInput, signal?: AbortSignal, ctx?: AgentStreamContext) => AsyncGenerator<TPart>;
46
53
  /** Optional: resume a previously-started run from its resumeToken (see StartPart). Transports that don't support resumption simply omit this. */
47
54
  resume?: ((resumeToken: string, signal?: AbortSignal) => AsyncGenerator<TPart>) | undefined;
48
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/agent/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAI7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,GAAG,cAAc,EAAE,MAAM,GAAG,MAAM,IAAI;IACpE,MAAM,EAAE,CACN,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,WAAW,EACpB,GAAG,CAAC,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KACjC,cAAc,CAAC,KAAK,CAAC,CAAA;IAC1B,iJAAiJ;IACjJ,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,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AAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;CAC3C,CAAA;AAID,MAAM,MAAM,wBAAwB,CAAC,KAAK,GAAG,SAAS,IAAI;IACxD,6FAA6F;IAC7F,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,CAAA;IACzD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACzD;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IAC1C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAC7B,CAAA;AAyZD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,QAAQ,GAAG,SAAS,EAAE,EACrE,SAAS,EACT,KAAK,EACL,cAAc,EACd,WAAW,EACX,OAAO,EACP,QAAc,EACd,SAAS,GACV,EAAE,sBAAsB,CAAC,KAAK,CAAC,GAAG,wBAAwB,CAAC,KAAK,CAAC,CA8UjE"}
@@ -7,6 +7,7 @@ import { createRunCommitter, isContentPart } from "./run-committer.js";
7
7
  import {
8
8
  beginRun,
9
9
  endRun,
10
+ settleTrace,
10
11
  failedThreadIds,
11
12
  dismissRun,
12
13
  hasLiveRun,
@@ -16,7 +17,7 @@ import {
16
17
  sweepFlushed
17
18
  } from "./run-records.js";
18
19
  import { isResumable } from "./transport.js";
19
- import { TelemetryContext, createEmitter, errorName, now } from "../telemetry.js";
20
+ import { TelemetryContext, createLiveEmitter, errorName, now } from "../telemetry.js";
20
21
  function defaultToUserParts(input) {
21
22
  return [{ id: mintThreadId(), type: "text", text: input }];
22
23
  }
@@ -129,6 +130,7 @@ async function consumeAndFinalize(args) {
129
130
  status: outcome.status
130
131
  })
131
132
  );
133
+ settleTrace(record, "settled");
132
134
  } catch (err) {
133
135
  if (!live()) {
134
136
  if (record.ended === "stopped" && record.appended) onError?.({ threadId, error: err });
@@ -154,6 +156,7 @@ async function consumeAndFinalize(args) {
154
156
  failure: { error: err, agentError }
155
157
  })
156
158
  );
159
+ settleTrace(record, "failed");
157
160
  onError?.({ threadId, error: err });
158
161
  } finally {
159
162
  committer.cancel();
@@ -220,6 +223,15 @@ async function finalizeStop(args) {
220
223
  record.resolving = false;
221
224
  }
222
225
  }
226
+ const TRACEPARENT = /^[\da-f]{2}-[\da-f]{32}-[\da-f]{16}-[\da-f]{2}$/;
227
+ const TRACESTATE_MEMBER = /^[\da-z][\w*/@-]{0,255}=[^\s,=]([^,=]{0,254}[^\s,=])?$/;
228
+ function traceRequestHeaders(headers) {
229
+ const { traceparent, tracestate } = headers;
230
+ if (typeof traceparent !== "string" || !TRACEPARENT.test(traceparent)) return void 0;
231
+ const members = typeof tracestate === "string" ? tracestate.split(",") : [];
232
+ const valid = members.length > 0 && members.length <= 32 && members.every((member) => TRACESTATE_MEMBER.test(member.trim()));
233
+ return valid ? { traceparent, tracestate } : { traceparent };
234
+ }
223
235
  function buildTurnEvent(args) {
224
236
  const { threadId, startedAt, firstContentAt, partCount, status, failure } = args;
225
237
  const endedAt = now();
@@ -274,10 +286,7 @@ function useAgentThreadRuns({
274
286
  const resolvedToUserParts = toUserParts ?? defaultToUserParts;
275
287
  const toUserPartsRef = useRef(resolvedToUserParts);
276
288
  toUserPartsRef.current = resolvedToUserParts;
277
- const emitTelemetry = useMemo(
278
- () => createEmitter((event) => telemetryRef.current?.(event)),
279
- []
280
- );
289
+ const emitTelemetry = useMemo(() => createLiveEmitter(() => telemetryRef.current), []);
281
290
  const resolveTransport = (threadId) => {
282
291
  const currentTransport = transportRef.current;
283
292
  if (typeof currentTransport !== "function") return currentTransport;
@@ -294,6 +303,7 @@ function useAgentThreadRuns({
294
303
  if (record.ended !== void 0) continue;
295
304
  abortedThreadIds.push(threadId);
296
305
  record.controller.abort();
306
+ settleTrace(record, "stopped");
297
307
  }
298
308
  recordsRef.current.clear();
299
309
  if (abortedThreadIds.length === 0) return;
@@ -374,8 +384,10 @@ function useAgentThreadRuns({
374
384
  return next;
375
385
  });
376
386
  const controller = new AbortController();
377
- const record = beginRun(recordsRef.current, threadId, controller);
387
+ const trace = emitTelemetry.startChatTurn?.({ threadId, messageId: userMessage.id });
388
+ const record = beginRun(recordsRef.current, threadId, controller, trace?.settle);
378
389
  const resolvedTransport = resolveTransport(threadId);
390
+ const headers = trace?.headers === void 0 ? void 0 : traceRequestHeaders(trace.headers);
379
391
  void consumeAndFinalize({
380
392
  threadId,
381
393
  record,
@@ -385,7 +397,10 @@ function useAgentThreadRuns({
385
397
  // id instead of a second, unrelated one (R1 — see AgentTransport.stream's doc).
386
398
  generator: withPartIds(
387
399
  threadId,
388
- resolvedTransport.stream(input, controller.signal, { messageId: userMessage.id })
400
+ resolvedTransport.stream(input, controller.signal, {
401
+ messageId: userMessage.id,
402
+ ...headers !== void 0 ? { headers } : {}
403
+ })
389
404
  ),
390
405
  userMessage,
391
406
  recordsRef,
@@ -433,6 +448,7 @@ function useAgentThreadRuns({
433
448
  const { appended, resolving } = record;
434
449
  endRun(record, "stopped");
435
450
  record.controller.abort();
451
+ settleTrace(record, "stopped");
436
452
  void finalizeStop({
437
453
  threadId,
438
454
  parts,
@@ -1 +1 @@
1
- {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../src/charts/CartesianChart.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAiB,YAAY,EAAa,MAAM,OAAO,CAAA;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;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AAC,CAAC,EAAE,CAAA;IACjC,6FAA6F;IAC7F,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,mBAAmB,CAAA;IACnD,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CAuErE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAC/C,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,GAC7C,YAAY,CAwBd;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAChD,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC/B,YAAY,CAEd"}
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useId, useMemo, useState } from "react";
3
3
  import { useInChartCard } from "./card-context.js";
4
- import { compileCartesian } from "./compile.js";
4
+ import { compileCartesian, refLegendSeries } from "./compile.js";
5
5
  import { ChartEngine, idPrefixOf } from "./host.js";
6
6
  import { ChartLegend, legendEntries } from "./legend.js";
7
7
  import { INITIAL_WIDTH, useChartSize } from "./sizing.js";
@@ -97,10 +97,14 @@ function CartesianRung(props) {
97
97
  (ctx) => compileCartesian({ ...stable, ...ctx }),
98
98
  [stable]
99
99
  );
100
+ const legendSeries = useMemo(
101
+ () => [...stable.series, ...refLegendSeries(stable.refLines)],
102
+ [stable.series, stable.refLines]
103
+ );
100
104
  return /* @__PURE__ */ jsx(
101
105
  ChartShell,
102
106
  {
103
- series,
107
+ series: legendSeries,
104
108
  compile,
105
109
  ariaLabel,
106
110
  ...legend !== void 0 && { legend },
@@ -10,8 +10,10 @@ export type DualPanelBar<T> = {
10
10
  positive: string;
11
11
  /** The fill below zero. */
12
12
  negative: string;
13
- /** Tick and tooltip formatter. */
13
+ /** Tick formatter, and the tooltip's too unless `tooltipFormat` is given. */
14
14
  format: (v: number) => string;
15
+ /** The tooltip row's formatter. Default: `format`. */
16
+ tooltipFormat?: ((v: number) => string) | undefined;
15
17
  /** The tooltip row's value, for a unit or a decimal `format` cannot carry. */
16
18
  formatValue?: ((v: number, d: T) => string) | undefined;
17
19
  /** Default `'auto'`: a symmetric `[-maxAbs, maxAbs]` from the data, rounded to nice ticks. A tuple
@@ -28,6 +30,8 @@ export type DualPanelProps<T, X extends Date | number = Date | number> = Pick<Ca
28
30
  top?: {
29
31
  domain?: readonly [number, number] | 'auto' | undefined;
30
32
  format?: ((v: number) => string) | undefined;
33
+ /** The lines' tooltip formatter. Default: `format`. */
34
+ tooltipFormat?: ((v: number) => string) | undefined;
31
35
  } | undefined;
32
36
  /**
33
37
  * Shades the band between two top lines (by key), where both are visible. `aboveFill` colours the
@@ -1 +1 @@
1
- {"version":3,"file":"DualPanel.d.ts","sourceRoot":"","sources":["../../src/charts/DualPanel.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AASzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAwB,MAAM,SAAS,CAAA;AAcrF,uBAAuB;AACvB,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,IAAI,CACjC,WAAW,CAAC,CAAC,CAAC,EACZ,KAAK,GACL,OAAO,GACP,OAAO,GACP,UAAU,GACV,aAAa,GACb,SAAS,GACT,QAAQ,GACR,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,aAAa,GACb,eAAe,GACf,WAAW,CACd,CAAA;AAED,mEAAmE;AACnE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAA;IACjC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