@tellegen/engine 0.3.0 → 0.4.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 (56) hide show
  1. package/README.md +65 -5
  2. package/dist/data/populated_places.json +7351 -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 +484 -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 +17 -11
  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,23 @@ 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
+ A host that preloads or budgets the engine's two large assets names them by
21
+ export rather than by path: `@tellegen/engine/wasm` is the WebAssembly binary
22
+ and `@tellegen/engine/places` the populated places table. In Vite, import them
23
+ with `?url`:
24
+
25
+ ```ts
26
+ import engineWasmUrl from "@tellegen/engine/wasm?url";
27
+ import placesUrl from "@tellegen/engine/places?url";
28
+ ```
29
+
30
+ Elsewhere, `import.meta.resolve("@tellegen/engine/wasm")` gives the file's URL.
31
+ `syntheticPlacesUrl()` returns the places table's URL at run time.
32
+
33
+ Under a Content Security Policy the engine needs `script-src 'wasm-unsafe-eval'`
34
+ (to compile WebAssembly; never `'unsafe-eval'`) and `worker-src 'self'`: its
35
+ workers are same-origin module workers.
36
+
20
37
  ## Browser Ingestion
21
38
 
22
39
  Case and JSON entry points accept the original bytes:
@@ -42,6 +59,39 @@ bare model JSON is now `unknown`; regenerate it as `pio-ir` from source data.
42
59
  Every API that accepts a byte buffer rejects inputs larger than
43
60
  `MAX_ENGINE_INPUT_BYTES` (128 MiB) before worker dispatch.
44
61
 
62
+ ## Synthetic Grid Generation
63
+
64
+ `createSynthSession(request, { osm?, places?, signal? })` generates a
65
+ geo-referenced transmission grid for a region, one stage per `advance()`, on a
66
+ dedicated worker. Request and report types come from `@tellegen/engine/synth`.
67
+ The populated places table ships as `dist/data/populated_places.json`;
68
+ `syntheticPlacesUrl()`, `fetchSyntheticPlaces()` and `loadSyntheticPlaces()`
69
+ locate and load it. The
70
+ [synthetic generation guide](https://eigenergy.github.io/tellegen/synthetic-generation.html)
71
+ describes the stages, the demand model and the evidence.
72
+
73
+ ## Data Sources
74
+
75
+ The package ships data from third parties:
76
+
77
+ - **Natural Earth** v5.1.2 populated places (`dist/data/populated_places.json`,
78
+ which names the release and its source file's SHA-256) and country areas
79
+ (compiled into the wasm): public domain,
80
+ [naturalearthdata.com](https://www.naturalearthdata.com/about/terms-of-use/).
81
+ - **Ember**, *Yearly Electricity Data*, through **Our World in Data**,
82
+ *Energy dataset*: national electricity demand, compiled into the wasm.
83
+ Licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/);
84
+ the table keeps each country's latest year, so changes were made. Its
85
+ population column is Our World in Data's series, compiled from the sources
86
+ at [ourworldindata.org/population-sources](https://ourworldindata.org/population-sources).
87
+ - **National transmission voltage levels**, compiled into the wasm from the
88
+ operator, regulator and standards documents each entry cites.
89
+
90
+ Grids generated with `source: "osm"` contain data from OpenStreetMap, ©
91
+ OpenStreetMap contributors, under the ODbL 1.0. The
92
+ [third-party notices](https://eigenergy.github.io/tellegen/third-party-notices.html)
93
+ give the full credits.
94
+
45
95
  ## Migrating To 0.2
46
96
 
47
97
  - Pass `Uint8Array` to `ingestCase`. For an existing string, use
@@ -56,20 +106,20 @@ Every API that accepts a byte buffer rejects inputs larger than
56
106
  `kind: "distribution"` with a `format`; `not-json` is `unknown`; and
57
107
  `transmission` and `ambiguous` are additional outcomes.
58
108
 
59
- ## Contracts
109
+ ## Generated types
60
110
 
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`.
111
+ `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
112
 
63
113
  Run the generator after Rust API changes:
64
114
 
65
115
  ```sh
66
- npm run contracts
116
+ npm run types
67
117
  ```
68
118
 
69
119
  CI runs `npm run build:engine` from the repository root, and that runs
70
- `contracts:check`. A stale generated contract fails the build.
120
+ `types:check`. Stale generated types fail the build.
71
121
 
72
- Breaking contract changes:
122
+ Breaking changes to the generated types:
73
123
 
74
124
  - Removing or renaming exported request or response fields.
75
125
  - Changing field units, enum tags, formulation ids, solve status tags, or sensitivity operand/parameter shapes.
@@ -95,3 +145,13 @@ npm run pack:engine
95
145
  Svelte package. It releases through Changesets with the other npm packages. The
96
146
  hosted demo under `apps/web` is private and consumes `@tellegen/svelte` through
97
147
  the same workspace file dependency used by the local examples.
148
+
149
+ ## Citing
150
+
151
+ If you use this package in published work, please cite the tellegen paper:
152
+ Samuel Talkington, Frederik Geth, Qian Zhang, Le Xie, and Skyler Liu. 2026.
153
+ *Interactive Power Flow in the Browser*. The Inaugural ACM Conference on Digital
154
+ Transformation (ACM DXConf 2026), Ann Arbor, MI, USA.
155
+ [doi:10.1145/3847238.3849038](https://doi.org/10.1145/3847238.3849038). The
156
+ [repository README](https://github.com/eigenergy/tellegen#citing) has the BibTeX
157
+ entry.