@kymoscope/sdk 0.0.0-stage → 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.
Files changed (223) hide show
  1. package/LICENSE.md +69 -0
  2. package/README.md +138 -2
  3. package/dist/assets/duckdb-browser-eh.worker--3HUwN9R.js +14 -0
  4. package/dist/assets/duckdb-eh-D-nnNw7L.wasm.gz +0 -0
  5. package/dist/assets/h5wasmModule-BCQWU2Gw.js +24295 -0
  6. package/dist/assets/importer.worker-D4is7BLf.js +6 -0
  7. package/dist/assets/offscreenLineWorker-mShhnyXX.js +79 -0
  8. package/dist/assets/parseDataset.worker-PynRsPD8.js +5 -0
  9. package/dist/importers-DivmF3tx.js +5 -0
  10. package/dist/krc-CbE28CjD.js +9 -0
  11. package/dist/kymoscope-embed.js +633 -0
  12. package/dist/kymoscope-sdk.js +616 -0
  13. package/dist/react.js +2 -0
  14. package/dist/styles/charts.css +207 -0
  15. package/dist/styles/fonts/OFL.txt +93 -0
  16. package/dist/styles/fonts/plus-jakarta-sans-italic-latin-ext.woff2 +0 -0
  17. package/dist/styles/fonts/plus-jakarta-sans-italic-latin.woff2 +0 -0
  18. package/dist/styles/fonts/plus-jakarta-sans-latin-ext.woff2 +0 -0
  19. package/dist/styles/fonts/plus-jakarta-sans-latin.woff2 +0 -0
  20. package/dist/styles/tokens.css +218 -0
  21. package/dist/types/charts/AlarmOverlay.d.ts +11 -0
  22. package/dist/types/charts/AnnotationLayer.d.ts +29 -0
  23. package/dist/types/charts/ChartBody.d.ts +52 -0
  24. package/dist/types/charts/PerfHud.d.ts +20 -0
  25. package/dist/types/charts/beacon.d.ts +27 -0
  26. package/dist/types/charts/chartWindow.d.ts +31 -0
  27. package/dist/types/charts/liveOverlay.d.ts +16 -0
  28. package/dist/types/charts/runtime.d.ts +63 -0
  29. package/dist/types/charts/useWorksheetData.d.ts +159 -0
  30. package/dist/types/components/AreaChart.d.ts +21 -0
  31. package/dist/types/components/BarChart.d.ts +30 -0
  32. package/dist/types/components/BoxPlotChart.d.ts +16 -0
  33. package/dist/types/components/BubbleChart.d.ts +24 -0
  34. package/dist/types/components/CalibrationChart.d.ts +15 -0
  35. package/dist/types/components/CdfChart.d.ts +15 -0
  36. package/dist/types/components/ConfusionChart.d.ts +11 -0
  37. package/dist/types/components/ControlChart.d.ts +17 -0
  38. package/dist/types/components/DuckDbMultiBandPanel.d.ts +35 -0
  39. package/dist/types/components/EmbeddingChart.d.ts +25 -0
  40. package/dist/types/components/FlameGraphChart.d.ts +15 -0
  41. package/dist/types/components/GanttChart.d.ts +15 -0
  42. package/dist/types/components/GaugeChart.d.ts +27 -0
  43. package/dist/types/components/HeatmapChart.d.ts +41 -0
  44. package/dist/types/components/HistogramChart.d.ts +15 -0
  45. package/dist/types/components/LossCurveChart.d.ts +17 -0
  46. package/dist/types/components/MultiBandCanvasChart.d.ts +156 -0
  47. package/dist/types/components/ParallelCoordsChart.d.ts +21 -0
  48. package/dist/types/components/PolarChart.d.ts +17 -0
  49. package/dist/types/components/QQPlotChart.d.ts +16 -0
  50. package/dist/types/components/RadarChart.d.ts +17 -0
  51. package/dist/types/components/RocChart.d.ts +12 -0
  52. package/dist/types/components/SankeyChart.d.ts +15 -0
  53. package/dist/types/components/SpectrogramChart.d.ts +16 -0
  54. package/dist/types/components/SpectrogramWaterfall.d.ts +14 -0
  55. package/dist/types/components/SpectrumChart.d.ts +17 -0
  56. package/dist/types/components/TreemapChart.d.ts +14 -0
  57. package/dist/types/components/ViolinChart.d.ts +17 -0
  58. package/dist/types/components/XYScatterChart.d.ts +47 -0
  59. package/dist/types/components/XYZMeshChart.d.ts +68 -0
  60. package/dist/types/components/dashboardGridLayout.d.ts +50 -0
  61. package/dist/types/components/liveFollowEase.d.ts +10 -0
  62. package/dist/types/components/liveWindow.d.ts +63 -0
  63. package/dist/types/components/multiBandHover.d.ts +44 -0
  64. package/dist/types/embed/Attribution.d.ts +5 -0
  65. package/dist/types/embed/license.d.ts +29 -0
  66. package/dist/types/embed/standalone.d.ts +5 -0
  67. package/dist/types/engine/columns.d.ts +44 -0
  68. package/dist/types/engine/createEngine.d.ts +394 -0
  69. package/dist/types/engine/derive.d.ts +27 -0
  70. package/dist/types/engine/emitter.d.ts +6 -0
  71. package/dist/types/engine/errors.d.ts +7 -0
  72. package/dist/types/engine/history.d.ts +29 -0
  73. package/dist/types/engine/kinds.d.ts +9 -0
  74. package/dist/types/engine/liveController.d.ts +27 -0
  75. package/dist/types/engine/store.d.ts +8 -0
  76. package/dist/types/engine/types.d.ts +194 -0
  77. package/dist/types/index.d.ts +69 -0
  78. package/dist/types/lib/annotations.d.ts +37 -0
  79. package/dist/types/lib/beacon.d.ts +62 -0
  80. package/dist/types/lib/colorScheme.d.ts +5 -0
  81. package/dist/types/lib/colormap.d.ts +9 -0
  82. package/dist/types/lib/columnTable.d.ts +37 -0
  83. package/dist/types/lib/data/arrowDecimation.d.ts +11 -0
  84. package/dist/types/lib/data/binnedHeatmap.d.ts +27 -0
  85. package/dist/types/lib/data/columnCaches.d.ts +6 -0
  86. package/dist/types/lib/data/columnarDataSource.d.ts +34 -0
  87. package/dist/types/lib/data/createDataSource.d.ts +23 -0
  88. package/dist/types/lib/data/dataSource.d.ts +75 -0
  89. package/dist/types/lib/data/decimate.d.ts +25 -0
  90. package/dist/types/lib/data/duckDbDataSource.d.ts +42 -0
  91. package/dist/types/lib/data/envelope.d.ts +16 -0
  92. package/dist/types/lib/data/inMemoryDataSource.d.ts +25 -0
  93. package/dist/types/lib/data/liveDataSource.d.ts +77 -0
  94. package/dist/types/lib/data/lruCache.d.ts +11 -0
  95. package/dist/types/lib/data/openDataset.d.ts +24 -0
  96. package/dist/types/lib/data/opfsParquet.d.ts +4 -0
  97. package/dist/types/lib/data/pointColumns.d.ts +59 -0
  98. package/dist/types/lib/data/schemaColumns.d.ts +5 -0
  99. package/dist/types/lib/data/useSeriesPoints.d.ts +48 -0
  100. package/dist/types/lib/data/xyColumns.d.ts +77 -0
  101. package/dist/types/lib/dataBounds.d.ts +10 -0
  102. package/dist/types/lib/datasetColors.d.ts +19 -0
  103. package/dist/types/lib/datasetColumns.d.ts +3 -0
  104. package/dist/types/lib/datasetMerge.d.ts +8 -0
  105. package/dist/types/lib/duckdb/duckdbInstance.d.ts +7 -0
  106. package/dist/types/lib/duckdb/fileIdentity.d.ts +9 -0
  107. package/dist/types/lib/duckdb/sql.d.ts +124 -0
  108. package/dist/types/lib/fft.d.ts +15 -0
  109. package/dist/types/lib/folderTree.d.ts +29 -0
  110. package/dist/types/lib/gaugeColors.d.ts +32 -0
  111. package/dist/types/lib/importers/arrowSink.d.ts +35 -0
  112. package/dist/types/lib/importers/blobReader.d.ts +22 -0
  113. package/dist/types/lib/importers/bytes.d.ts +11 -0
  114. package/dist/types/lib/importers/combine.d.ts +30 -0
  115. package/dist/types/lib/importers/comtrade/format.d.ts +2 -0
  116. package/dist/types/lib/importers/comtrade/importer.d.ts +25 -0
  117. package/dist/types/lib/importers/dbc.d.ts +45 -0
  118. package/dist/types/lib/importers/edf/format.d.ts +2 -0
  119. package/dist/types/lib/importers/edf/importer.d.ts +7 -0
  120. package/dist/types/lib/importers/expr.d.ts +10 -0
  121. package/dist/types/lib/importers/formats.d.ts +23 -0
  122. package/dist/types/lib/importers/hdf5/format.d.ts +4 -0
  123. package/dist/types/lib/importers/hdf5/h5.d.ts +76 -0
  124. package/dist/types/lib/importers/hdf5/h5wasmModule.d.ts +1 -0
  125. package/dist/types/lib/importers/hdf5/importer.d.ts +2 -0
  126. package/dist/types/lib/importers/importer.worker.d.ts +5 -0
  127. package/dist/types/lib/importers/importers.d.ts +4 -0
  128. package/dist/types/lib/importers/limits.d.ts +28 -0
  129. package/dist/types/lib/importers/mat/format.d.ts +2 -0
  130. package/dist/types/lib/importers/mat/group.d.ts +19 -0
  131. package/dist/types/lib/importers/mat/importer.d.ts +2 -0
  132. package/dist/types/lib/importers/mat/v5.d.ts +24 -0
  133. package/dist/types/lib/importers/mat/v73.d.ts +13 -0
  134. package/dist/types/lib/importers/mdf/blocks3.d.ts +3 -0
  135. package/dist/types/lib/importers/mdf/blocks4.d.ts +7 -0
  136. package/dist/types/lib/importers/mdf/bus.d.ts +59 -0
  137. package/dist/types/lib/importers/mdf/conversion.d.ts +48 -0
  138. package/dist/types/lib/importers/mdf/decode.d.ts +15 -0
  139. package/dist/types/lib/importers/mdf/format.d.ts +2 -0
  140. package/dist/types/lib/importers/mdf/importer.d.ts +19 -0
  141. package/dist/types/lib/importers/mdf/model.d.ts +75 -0
  142. package/dist/types/lib/importers/mdf/records.d.ts +31 -0
  143. package/dist/types/lib/importers/mdf/stream.d.ts +42 -0
  144. package/dist/types/lib/importers/memorySink.d.ts +11 -0
  145. package/dist/types/lib/importers/names.d.ts +2 -0
  146. package/dist/types/lib/importers/openImport.d.ts +33 -0
  147. package/dist/types/lib/importers/registry.d.ts +24 -0
  148. package/dist/types/lib/importers/run.d.ts +35 -0
  149. package/dist/types/lib/importers/session.d.ts +28 -0
  150. package/dist/types/lib/importers/tdms/format.d.ts +2 -0
  151. package/dist/types/lib/importers/tdms/importer.d.ts +10 -0
  152. package/dist/types/lib/importers/types.d.ts +172 -0
  153. package/dist/types/lib/importers/workerCore.d.ts +44 -0
  154. package/dist/types/lib/importers/xdf/format.d.ts +2 -0
  155. package/dist/types/lib/importers/xdf/importer.d.ts +2 -0
  156. package/dist/types/lib/importers/zlib.d.ts +13 -0
  157. package/dist/types/lib/kde.d.ts +2 -0
  158. package/dist/types/lib/live/buffer.d.ts +265 -0
  159. package/dist/types/lib/live/columnsWire.d.ts +24 -0
  160. package/dist/types/lib/live/crypto.d.ts +157 -0
  161. package/dist/types/lib/live/liveMathChannels.d.ts +11 -0
  162. package/dist/types/lib/live/recorder.d.ts +32 -0
  163. package/dist/types/lib/live/stream.d.ts +33 -0
  164. package/dist/types/lib/live/timeBuckets.d.ts +71 -0
  165. package/dist/types/lib/live/types.d.ts +72 -0
  166. package/dist/types/lib/live/wire.d.ts +25 -0
  167. package/dist/types/lib/mathChannels/compile.d.ts +22 -0
  168. package/dist/types/lib/mathChannels/evaluator.d.ts +40 -0
  169. package/dist/types/lib/mathChannels/functions/conditional.d.ts +2 -0
  170. package/dist/types/lib/mathChannels/functions/filters.d.ts +7 -0
  171. package/dist/types/lib/mathChannels/functions/index.d.ts +3 -0
  172. package/dist/types/lib/mathChannels/functions/reference.d.ts +7 -0
  173. package/dist/types/lib/mathChannels/functions/windowOps.d.ts +11 -0
  174. package/dist/types/lib/mathChannels/index.d.ts +13 -0
  175. package/dist/types/lib/mathChannels/io.d.ts +18 -0
  176. package/dist/types/lib/mathChannels/mathjsSetup.d.ts +7 -0
  177. package/dist/types/lib/mathChannels/parseMath.d.ts +12 -0
  178. package/dist/types/lib/mathChannels/parser.d.ts +22 -0
  179. package/dist/types/lib/mathChannels/types.d.ts +34 -0
  180. package/dist/types/lib/mathChannels/usedChannels.d.ts +14 -0
  181. package/dist/types/lib/moduleWorker.d.ts +7 -0
  182. package/dist/types/lib/panelChartSettings.d.ts +438 -0
  183. package/dist/types/lib/parseDataset.d.ts +74 -0
  184. package/dist/types/lib/parseDataset.worker.d.ts +1 -0
  185. package/dist/types/lib/parseDatasetWorkerClient.d.ts +32 -0
  186. package/dist/types/lib/perfLog.d.ts +4 -0
  187. package/dist/types/lib/quantiles.d.ts +10 -0
  188. package/dist/types/lib/recordings/csvWriter.d.ts +10 -0
  189. package/dist/types/lib/recordings/export.d.ts +26 -0
  190. package/dist/types/lib/recordings/importer.d.ts +2 -0
  191. package/dist/types/lib/recordings/keys.d.ts +23 -0
  192. package/dist/types/lib/recordings/krc.d.ts +38 -0
  193. package/dist/types/lib/recordings/mf4Writer.d.ts +20 -0
  194. package/dist/types/lib/render/chartFonts.d.ts +10 -0
  195. package/dist/types/lib/render/colorBucket.d.ts +6 -0
  196. package/dist/types/lib/render/contours.d.ts +16 -0
  197. package/dist/types/lib/render/cssColor.d.ts +2 -0
  198. package/dist/types/lib/render/frames.d.ts +46 -0
  199. package/dist/types/lib/render/gl3d.d.ts +63 -0
  200. package/dist/types/lib/render/glLines.d.ts +62 -0
  201. package/dist/types/lib/render/glPlot.d.ts +36 -0
  202. package/dist/types/lib/render/glPoints.d.ts +37 -0
  203. package/dist/types/lib/render/glSeries.d.ts +67 -0
  204. package/dist/types/lib/render/heatGrid.d.ts +9 -0
  205. package/dist/types/lib/render/hitGrid.d.ts +16 -0
  206. package/dist/types/lib/render/liveZoomBus.d.ts +18 -0
  207. package/dist/types/lib/render/margins.d.ts +14 -0
  208. package/dist/types/lib/render/offscreenLineRenderer.d.ts +53 -0
  209. package/dist/types/lib/render/offscreenLineWorker.d.ts +1 -0
  210. package/dist/types/lib/render/plotFrame.d.ts +36 -0
  211. package/dist/types/lib/render/resample.d.ts +18 -0
  212. package/dist/types/lib/render/sharedGl.d.ts +38 -0
  213. package/dist/types/lib/render/useGlPlot.d.ts +7 -0
  214. package/dist/types/lib/savedLayout.d.ts +45 -0
  215. package/dist/types/lib/stft.d.ts +37 -0
  216. package/dist/types/lib/workspaces/encrypted.d.ts +50 -0
  217. package/dist/types/lib/workspaces/io.d.ts +120 -0
  218. package/dist/types/lib/xyFit.d.ts +14 -0
  219. package/dist/types/lib/yAxisTicks.d.ts +28 -0
  220. package/dist/types/react/index.d.ts +32 -0
  221. package/dist/types/types/loadedDataset.d.ts +42 -0
  222. package/dist/types/types/plotSeries.d.ts +27 -0
  223. package/package.json +63 -4
package/LICENSE.md ADDED
@@ -0,0 +1,69 @@
1
+ # Kymoscope SDK License Agreement
2
+
3
+ Copyright © 2026 Kymoscope. All rights reserved.
4
+
5
+ This is proprietary software. It is licensed, not sold. By installing, copying
6
+ or using the Kymoscope SDK (the "Software") you agree to these terms. If you do not
7
+ agree, do not use the Software.
8
+
9
+ > Template notice for the owner: this agreement was drafted as a starting point.
10
+ > Have it reviewed by a lawyer for your jurisdiction and fill in the legal
11
+ > entity, governing law and contact details before relying on it.
12
+
13
+ ## 1. Licenses
14
+
15
+ **1.1 Evaluation.** You may use the Software without a license key to evaluate
16
+ it and to develop your integration. Unlicensed use displays a "Powered by
17
+ Kymoscope" attribution in the workspace.
18
+
19
+ **1.2 Production.** Using the Software in a product, service or internal tool
20
+ made available to anyone other than your own developers ("Production Use")
21
+ requires a valid license key issued by Kymoscope for each domain the Software is
22
+ served from, under an order or agreement with Kymoscope.
23
+
24
+ **1.3 Scope.** A license key is personal to the licensee named in it, for the
25
+ domains listed in it and until its expiry date.
26
+
27
+ ## 2. Restrictions
28
+
29
+ You must not, and must not allow others to:
30
+
31
+ 1. make the Software available in Production Use without a valid license key
32
+ for that domain;
33
+ 2. remove, hide, obscure or alter the attribution shown by unlicensed use, or
34
+ the copyright notices in the Software;
35
+ 3. circumvent, disable or modify the license check, or create, alter or share
36
+ license keys;
37
+ 4. copy, sell, sublicense, distribute or publish the Software, or offer it as a
38
+ standalone component library or SDK, except as embedded in your own product
39
+ as permitted above;
40
+ 5. reverse engineer, decompile or disassemble the Software, except to the
41
+ extent applicable law expressly permits it despite this restriction;
42
+ 6. use the Software to build a competing embeddable analytics or charting
43
+ product.
44
+
45
+ ## 3. Kymoscope services
46
+
47
+ Live-stream relaying, watch tickets and other hosted services are provided
48
+ under your Kymoscope account terms and may be rate limited or suspended for abuse.
49
+
50
+ ## 4. Ownership
51
+
52
+ Kymoscope and its licensors own all rights in the Software. No rights are granted
53
+ except those expressly stated here.
54
+
55
+ ## 5. Termination
56
+
57
+ This license ends automatically if you breach it. On termination you must stop
58
+ using the Software and delete all copies.
59
+
60
+ ## 6. No warranty and limitation of liability
61
+
62
+ The Software is provided "as is", without warranties of any kind. To the
63
+ maximum extent permitted by law, Kymoscope is not liable for any indirect,
64
+ incidental or consequential damages, and its total liability is limited to the
65
+ fees you paid for the Software in the twelve months before the claim.
66
+
67
+ ## 7. Contact
68
+
69
+ For license keys and commercial terms, contact Kymoscope.
package/README.md CHANGED
@@ -1,3 +1,139 @@
1
- # Temporary Holding Version
1
+ # @kymoscope/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Kymoscope data engine and its charts, without the app UI. The Kymoscope app (app.kymoscope.com) is the finished product; this package is the engine underneath it, so you can build your own interface around the same capabilities:
4
+
5
+ - import files and whole folders, including files too large for memory (DuckDB-WASM, out of core): delimited text (CSV, TSV, `.dat`, `.txt`) and binary measurement files, MF4/MDF 3 (CAN decoded with a `.dbc` dropped alongside), EDF/BDF(+), XDF, TDMS, HDF5, MAT v5/v7.3 and COMTRADE; multi-rate files are combined on the fastest rate (`datasets.splitByRate` gives one dataset per group), with cancel, progress and a channel chooser for very wide files
6
+ - laps, overlays, dataset colours and time offsets
7
+ - worksheets of charts with a shared X axis and linked zoom
8
+ - 27 chart kinds, mounted as bare plots into your own elements
9
+ - math channels (formula columns) with an optional store adapter
10
+ - local and end-to-end encrypted live streams
11
+ - workspace / worksheet / chart import and export as JSON
12
+ - plan limits enforced by the engine and reported as events
13
+
14
+ Nothing you load goes through Kymoscope servers, except live streams relayed as ciphertext if you use them. The Kymoscope app is built on this package through the same public API (`src/PlatformApp.tsx` and `src/workspace/Workspace.tsx` are the reference host).
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install @kymoscope/sdk react react-dom
20
+ ```
21
+
22
+ Or a script tag, pinned to a version: `https://cdn.jsdelivr.net/npm/@kymoscope/sdk@0.1.0/dist/kymoscope-embed.js` and `…/dist/styles/charts.css` (workers and DuckDB-WASM load from the same CDN folder). To self-host, copy `node_modules/@kymoscope/sdk/dist` into your static files (see Script tag below).
23
+
24
+ In this repo, build with `npm -w @kymoscope/sdk run build`.
25
+
26
+ | Output | Use |
27
+ |---|---|
28
+ | `dist/kymoscope-sdk.js` | ESM entry `@kymoscope/sdk` (`react`/`react-dom` 19 are peers: charts render with React) |
29
+ | `dist/react.js` | ESM entry `@kymoscope/sdk/react` (provider, hooks, `<Chart>`) |
30
+ | `dist/kymoscope-embed.js` | Standalone `<script>`: React bundled, global `Kymoscope.createEngine` |
31
+ | `dist/assets/*` | Web workers; keep them next to the JS file |
32
+ | `dist/types/` | TypeScript declarations |
33
+ | `dist/styles/charts.css` | Chart styles and colour variables; load it once |
34
+ | `dist/styles/tokens.css` | Optional: Kymoscope's own theme tokens and its typeface (Plus Jakarta Sans, `@font-face` on the woff2 files in `dist/styles/fonts/`, SIL OFL 1.1 in `fonts/OFL.txt`); keep `fonts/` next to it |
35
+
36
+ In the repo the package `exports` point at `src/`, so the app, site and admin build from source. `npm pack` and `npm publish` swap them for the `dist/` entries (`scripts/pack-manifest.mjs`, restored afterwards); publishing runs only in GitHub Actions (`.github/workflows/publish-sdk.yml`).
37
+
38
+ ## Script tag
39
+
40
+ ```html
41
+ <link rel="stylesheet" href="/vendor/kymoscope/styles/charts.css" />
42
+ <div id="chart" style="height: 360px"></div>
43
+ <script src="/vendor/kymoscope/kymoscope-embed.js"></script>
44
+ <script>
45
+ const engine = Kymoscope.createEngine({ licenseKey: '…' })
46
+ engine.datasets.addColumns({ name: 'Run 42', columns: { t, speed, rpm }, units: { speed: 'km/h' } })
47
+ const chartId = engine.charts.add('multiband', { title: 'Speed & RPM' })
48
+ engine.charts.addSeries(chartId, 'speed')
49
+ engine.charts.addSeries(chartId, 'rpm')
50
+ const view = engine.charts.mount(chartId, document.getElementById('chart'))
51
+ </script>
52
+ ```
53
+
54
+ See `examples/embed.html` (run `npx http-server packages` and open `/sdk/examples/embed.html`).
55
+
56
+ ## React
57
+
58
+ ```tsx
59
+ import { createEngine } from '@kymoscope/sdk'
60
+ import { Chart, KymoscopeProvider, useEngine, useEngineState } from '@kymoscope/sdk/react'
61
+ import '@kymoscope/sdk/styles/charts.css'
62
+
63
+ // Create in an effect (and dispose in its cleanup) when the engine belongs to a component.
64
+ const engine = createEngine({ licenseKey: LICENSE_KEY })
65
+
66
+ function Charts() {
67
+ const charts = useEngineState((s) => s.worksheets.find((w) => w.id === s.activeWorksheetId)!.charts)
68
+ return charts.map((c) => (
69
+ <Chart key={c.id} id={c.id} style={{ height: 300 }} onStatus={…} onContextMenu={…} viewRef={…} />
70
+ ))
71
+ }
72
+
73
+ <KymoscopeProvider engine={engine}><Charts /></KymoscopeProvider>
74
+ ```
75
+
76
+ ## The engine
77
+
78
+ `createEngine(options)` returns:
79
+
80
+ | Member | Purpose |
81
+ |---|---|
82
+ | `getState()`, `subscribe(fn)`, `on(event, fn)` | Immutable `EngineState`; events `change`, `limit`, `error`, `import` |
83
+ | `datasets` | `importFiles`, `warmImport`, `splitByRate`, `combine`, `chooseChannels`, `addColumns`, `addText`, `configure` (parse config, laps), `select`/`toggle`, `setColor`, `setOffset`, `remove`, `raw`, `columnBounds` |
84
+ | `folders` | `pick`, `canPick`, `fromFileList`, `fromDataTransfer`, `tree`, `isImportable` |
85
+ | `worksheets` | `add`, `rename`, `remove`, `reorder`, `activate`, `setXKey` |
86
+ | `charts` | `add`, `update`, `replaceSettings`, `rename`, `setBackground`, `remove`, series ops (`addSeries`, `updateSeries`, …), layout metadata, `mount`, `setFonts`, `kinds` |
87
+ | `view` | `setXRange`, `resetZoom`, `setLiveWindow` |
88
+ | `mathChannels` | `create`, `update`, `remove`, `importMany`, `importFile`, `exportBlob`, `preview`, `sync` |
89
+ | `live` | `openLocal`, `connect(descriptor, password)`, `disconnect`, `rowCount` |
90
+ | `io` | `exportWorkspace`/`Worksheet`/`Chart`, `importWorkspace`/`Worksheet`/`Chart`, `parseFile`, `snapshot`/`restore`, `reset` |
91
+ | `data` | `merged()`: the plotted data as one table |
92
+ | `setOptions`, `licensed`, `isLicensed`, `dispose` | Runtime options (limits, relay, store), license state, teardown |
93
+
94
+ Options (all optional): `licenseKey`, `limits`, `mathChannels` (a `MathChannelStoreAdapter`), `live.relay` (`{ url, getToken(streamId) }`), `beforeImport`.
95
+
96
+ Charts have no toolbar, menu or placeholder copy. A `ChartView` (from `engine.charts.mount` or `<Chart viewRef>`) reports `status` (`'no-data' | 'empty' | 'ready'`), `contextmenu` and `viewchange`, and offers `exportPng()`, `setShiftMode()`, `autoscale()`, `setOptions()` and `destroy()`. Style charts with `--chart-bg`, `--chart-muted`, `--chart-grid`, `--accent` and `data-color-scheme="light" | "dark"`.
97
+
98
+ Failures throw `KymoscopeError` with a `code` (`limit_reached` carries `detail.reason`).
99
+
100
+ ## Encrypted live streams for your users
101
+
102
+ 1. Publish with the Python `kymoscope_live` package, the native LMU plugin, or the raw protocol, using your Kymoscope API key and a stream password.
103
+ 2. Your **backend** asks for a watch ticket. The API key must never reach the browser:
104
+ ```http
105
+ POST {SUPABASE_URL}/functions/v1/stream-watch-ticket
106
+ x-api-key: kymoscope_…
107
+ {"streamId": "<uuid>"}
108
+ → {"ticket": "wt.…", "expiresIn": 120, "stream": { "id", "name", "salt", "key_check" }}
109
+ ```
110
+ 3. The browser connects with that ticket and the stream password:
111
+ ```js
112
+ const engine = Kymoscope.createEngine({ live: { relay: { url: RELAY_URL, getToken: async (id) => (await myTicket(id)).ticket } } })
113
+ await engine.live.connect((await myTicket(streamId)).stream, password)
114
+ ```
115
+
116
+ A ticket admits watching one stream for 2 minutes (the SDK renews it on open sockets) and nothing else. The relay only forwards ciphertext; frames are decrypted in the viewer's browser (PBKDF2-600k, AES-256-GCM).
117
+
118
+ Operator setup: set the same random `WATCH_TICKET_SECRET` on the relay Worker (`wrangler secret put WATCH_TICKET_SECRET`) and as a Supabase edge secret, and deploy `stream-watch-ticket` with `verify_jwt = false`.
119
+
120
+ ## Licensing
121
+
122
+ A license key is an offline-verified Ed25519 signature over `{ sub, domains, exp }`. Domains can use wildcards (`*.acme.com`).
123
+ - Without a valid key everything works, and every mounted chart shows a small "Powered by Kymoscope" badge. `engine.licensed` resolves to the result.
124
+ - Every host needs a key that lists it, `localhost` included.
125
+ - Terms: `LICENSE.md` (proprietary). Removing the attribution or tampering with the check is not permitted.
126
+
127
+ ```bash
128
+ node scripts/license.mjs keygen --out ~/.kymoscope/kymoscope-license-private.jwk # once; keep it secret
129
+ node scripts/license.mjs sign --key ~/.kymoscope/kymoscope-license-private.jwk \
130
+ --sub acme --domains app.acme.com,*.acme.io --days 365
131
+ ```
132
+
133
+ The public key is compiled in (`KYMOSCOPE_LICENSE_PUBLIC_KEY`, `src/embed/license.ts`). Rotating it invalidates all issued keys.
134
+
135
+ ## Browser/CSP notes
136
+
137
+ - **Workers:** needs `worker-src 'self'` (or the SDK's origin).
138
+ - **DuckDB-WASM:** files too large for memory (over 100 million values or 300 MB) load DuckDB from `assets/` (bundled, never a CDN), so allow `blob:` workers, `connect-src 'self' blob:` and `script-src 'wasm-unsafe-eval'`.
139
+ - **Fonts:** the SDK's JavaScript loads none. Pass your page's families to `engine.charts.setFonts({ sans, mono })`. The optional `tokens.css` declares Plus Jakarta Sans from the woff2 files beside it (`dist/styles/fonts/`), so it is served from your origin (`font-src 'self'`) and never from a font CDN.