@tellegen/engine 0.3.0 → 0.4.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 (56) hide show
  1. package/README.md +51 -5
  2. package/dist/data/populated_places.json +1 -0
  3. package/dist/generated/{contracts.d.ts → api-types.d.ts} +4 -4
  4. package/dist/generated/api-types.d.ts.map +1 -0
  5. package/dist/generated/api-types.js +8 -0
  6. package/dist/generated/api-types.js.map +1 -0
  7. package/dist/generated/study-schema.d.ts.map +1 -1
  8. package/dist/generated/study-schema.js +2 -2
  9. package/dist/generated/study-schema.js.map +1 -1
  10. package/dist/generated/{study-contracts.d.ts → study-types.d.ts} +1 -1
  11. package/dist/generated/study-types.d.ts.map +1 -0
  12. package/dist/generated/study-types.js +4 -0
  13. package/dist/generated/study-types.js.map +1 -0
  14. package/dist/generated/synth-schema.d.ts +2 -0
  15. package/dist/generated/synth-schema.d.ts.map +1 -0
  16. package/dist/generated/synth-schema.js +3 -0
  17. package/dist/generated/synth-schema.js.map +1 -0
  18. package/dist/generated/synth-types.d.ts +482 -0
  19. package/dist/generated/synth-types.d.ts.map +1 -0
  20. package/dist/generated/synth-types.js +4 -0
  21. package/dist/generated/synth-types.js.map +1 -0
  22. package/dist/host.d.ts +23 -2
  23. package/dist/host.d.ts.map +1 -1
  24. package/dist/host.js +60 -22
  25. package/dist/host.js.map +1 -1
  26. package/dist/index.d.ts +253 -16
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +433 -11
  29. package/dist/index.js.map +1 -1
  30. package/dist/module.d.ts +1 -0
  31. package/dist/module.d.ts.map +1 -1
  32. package/dist/module.js.map +1 -1
  33. package/dist/protocol.d.ts +97 -7
  34. package/dist/protocol.d.ts.map +1 -1
  35. package/dist/protocol.js +96 -6
  36. package/dist/protocol.js.map +1 -1
  37. package/dist/study-document.d.ts +2 -2
  38. package/dist/study-document.d.ts.map +1 -1
  39. package/dist/study-document.js +1 -1
  40. package/dist/study-document.js.map +1 -1
  41. package/dist/wasm-pkg/LICENSE +17 -4
  42. package/dist/wasm-pkg/tellegen.d.ts +171 -6
  43. package/dist/wasm-pkg/tellegen.js +627 -33
  44. package/dist/wasm-pkg/tellegen_bg.wasm +0 -0
  45. package/dist/wasm-pkg/tellegen_bg.wasm.d.ts +32 -2
  46. package/dist/worker.js +10 -7
  47. package/dist/worker.js.map +1 -1
  48. package/package.json +14 -10
  49. package/dist/generated/contracts.d.ts.map +0 -1
  50. package/dist/generated/contracts.js +0 -8
  51. package/dist/generated/contracts.js.map +0 -1
  52. package/dist/generated/study-contracts.d.ts.map +0 -1
  53. package/dist/generated/study-contracts.js +0 -4
  54. package/dist/generated/study-contracts.js.map +0 -1
  55. package/dist/wasm-pkg/LICENSE-APACHE +0 -201
  56. package/dist/wasm-pkg/LICENSE-MIT +0 -19
package/README.md CHANGED
@@ -17,6 +17,10 @@ import {
17
17
  The wasm files are resolved relative to the package module. Host apps must serve
18
18
  package asset files from `node_modules`.
19
19
 
20
+ Under a Content Security Policy the engine needs `script-src 'wasm-unsafe-eval'`
21
+ (to compile WebAssembly; never `'unsafe-eval'`) and `worker-src 'self'`: its
22
+ workers are same-origin module workers.
23
+
20
24
  ## Browser Ingestion
21
25
 
22
26
  Case and JSON entry points accept the original bytes:
@@ -42,6 +46,38 @@ bare model JSON is now `unknown`; regenerate it as `pio-ir` from source data.
42
46
  Every API that accepts a byte buffer rejects inputs larger than
43
47
  `MAX_ENGINE_INPUT_BYTES` (128 MiB) before worker dispatch.
44
48
 
49
+ ## Synthetic Grid Generation
50
+
51
+ `createSynthSession(request, { osm?, places?, signal? })` generates a
52
+ geo-referenced transmission grid for a region, one stage per `advance()`, on a
53
+ dedicated worker. Request and report types come from `@tellegen/engine/synth`.
54
+ The populated places table ships as `dist/data/populated_places.json`;
55
+ `syntheticPlacesUrl()`, `fetchSyntheticPlaces()` and `loadSyntheticPlaces()`
56
+ locate and load it. The
57
+ [synthetic generation guide](https://eigenergy.github.io/tellegen/synthetic-generation.html)
58
+ describes the stages, the demand model and the evidence.
59
+
60
+ ## Data Sources
61
+
62
+ The package ships data from third parties:
63
+
64
+ - **Natural Earth** populated places (`dist/data/populated_places.json`) and
65
+ country areas (compiled into the wasm): public domain,
66
+ [naturalearthdata.com](https://www.naturalearthdata.com/about/terms-of-use/).
67
+ - **Ember**, *Yearly Electricity Data*, through **Our World in Data**,
68
+ *Energy dataset*: national electricity demand, compiled into the wasm.
69
+ Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/);
70
+ the table keeps each country's latest year, so changes were made. Its
71
+ population column is Our World in Data's series, compiled from the sources
72
+ at [ourworldindata.org/population-sources](https://ourworldindata.org/population-sources).
73
+ - **National transmission voltage levels**, compiled into the wasm from the
74
+ operator, regulator and standards documents each entry cites.
75
+
76
+ Grids generated with `source: "osm"` contain data from OpenStreetMap, ©
77
+ OpenStreetMap contributors, under the ODbL 1.0. The
78
+ [third-party notices](https://eigenergy.github.io/tellegen/third-party-notices.html)
79
+ give the full credits.
80
+
45
81
  ## Migrating To 0.2
46
82
 
47
83
  - Pass `Uint8Array` to `ingestCase`. For an existing string, use
@@ -56,20 +92,20 @@ Every API that accepts a byte buffer rejects inputs larger than
56
92
  `kind: "distribution"` with a `format`; `not-json` is `unknown`; and
57
93
  `transmission` and `ambiguous` are additional outcomes.
58
94
 
59
- ## Contracts
95
+ ## Generated types
60
96
 
61
- The public contract version is `CONTRACT_VERSION`, which matches the package version. `CONTRACT_SOURCE_SHA256` records the `crates/tellegen/src/api.rs` content used to generate `src/generated/contracts.ts`.
97
+ `ENGINE_VERSION` is the package version. `API_SOURCE_SHA256` records the `crates/tellegen/src/api.rs` content used to generate `src/generated/api-types.ts`.
62
98
 
63
99
  Run the generator after Rust API changes:
64
100
 
65
101
  ```sh
66
- npm run contracts
102
+ npm run types
67
103
  ```
68
104
 
69
105
  CI runs `npm run build:engine` from the repository root, and that runs
70
- `contracts:check`. A stale generated contract fails the build.
106
+ `types:check`. Stale generated types fail the build.
71
107
 
72
- Breaking contract changes:
108
+ Breaking changes to the generated types:
73
109
 
74
110
  - Removing or renaming exported request or response fields.
75
111
  - Changing field units, enum tags, formulation ids, solve status tags, or sensitivity operand/parameter shapes.
@@ -95,3 +131,13 @@ npm run pack:engine
95
131
  Svelte package. It releases through Changesets with the other npm packages. The
96
132
  hosted demo under `apps/web` is private and consumes `@tellegen/svelte` through
97
133
  the same workspace file dependency used by the local examples.
134
+
135
+ ## Citing
136
+
137
+ If you use this package in published work, please cite the tellegen paper:
138
+ Samuel Talkington, Frederik Geth, Qian Zhang, Le Xie, and Skyler Liu. 2026.
139
+ *Interactive Power Flow in the Browser*. The Inaugural ACM Conference on Digital
140
+ Transformation (ACM DXConf 2026), Ann Arbor, MI, USA.
141
+ [doi:10.1145/3847238.3849038](https://doi.org/10.1145/3847238.3849038). The
142
+ [repository README](https://github.com/eigenergy/tellegen#citing) has the BibTeX
143
+ entry.