@tellegen/engine 0.2.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 (60) hide show
  1. package/README.md +71 -20
  2. package/dist/data/populated_places.json +1 -0
  3. package/dist/generated/{contracts.d.ts → api-types.d.ts} +26 -18
  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 +2 -0
  8. package/dist/generated/study-schema.d.ts.map +1 -0
  9. package/dist/generated/study-schema.js +3 -0
  10. package/dist/generated/study-schema.js.map +1 -0
  11. package/dist/generated/study-types.d.ts +426 -0
  12. package/dist/generated/study-types.d.ts.map +1 -0
  13. package/dist/generated/study-types.js +4 -0
  14. package/dist/generated/study-types.js.map +1 -0
  15. package/dist/generated/synth-schema.d.ts +2 -0
  16. package/dist/generated/synth-schema.d.ts.map +1 -0
  17. package/dist/generated/synth-schema.js +3 -0
  18. package/dist/generated/synth-schema.js.map +1 -0
  19. package/dist/generated/synth-types.d.ts +482 -0
  20. package/dist/generated/synth-types.d.ts.map +1 -0
  21. package/dist/generated/synth-types.js +4 -0
  22. package/dist/generated/synth-types.js.map +1 -0
  23. package/dist/host.d.ts +35 -2
  24. package/dist/host.d.ts.map +1 -1
  25. package/dist/host.js +103 -17
  26. package/dist/host.js.map +1 -1
  27. package/dist/index.d.ts +549 -122
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +780 -109
  30. package/dist/index.js.map +1 -1
  31. package/dist/input-limit.d.ts +1 -1
  32. package/dist/input-limit.js +1 -1
  33. package/dist/module.d.ts +2 -0
  34. package/dist/module.d.ts.map +1 -1
  35. package/dist/module.js.map +1 -1
  36. package/dist/protocol.d.ts +182 -31
  37. package/dist/protocol.d.ts.map +1 -1
  38. package/dist/protocol.js +153 -26
  39. package/dist/protocol.js.map +1 -1
  40. package/dist/study-document.d.ts +46 -0
  41. package/dist/study-document.d.ts.map +1 -0
  42. package/dist/study-document.js +183 -0
  43. package/dist/study-document.js.map +1 -0
  44. package/dist/study-document.test.d.ts +2 -0
  45. package/dist/study-document.test.d.ts.map +1 -0
  46. package/dist/study-document.test.js +119 -0
  47. package/dist/study-document.test.js.map +1 -0
  48. package/dist/wasm-pkg/LICENSE +17 -4
  49. package/dist/wasm-pkg/tellegen.d.ts +332 -85
  50. package/dist/wasm-pkg/tellegen.js +1324 -250
  51. package/dist/wasm-pkg/tellegen_bg.wasm +0 -0
  52. package/dist/wasm-pkg/tellegen_bg.wasm.d.ts +57 -9
  53. package/dist/worker.js +20 -5
  54. package/dist/worker.js.map +1 -1
  55. package/package.json +32 -11
  56. package/dist/generated/contracts.d.ts.map +0 -1
  57. package/dist/generated/contracts.js +0 -8
  58. package/dist/generated/contracts.js.map +0 -1
  59. package/dist/wasm-pkg/LICENSE-APACHE +0 -201
  60. package/dist/wasm-pkg/LICENSE-MIT +0 -19
package/dist/index.d.ts CHANGED
@@ -3,10 +3,29 @@
3
3
  * thread otherwise (see host.ts). Nothing downloads until the first engine
4
4
  * call; dropped files are parsed locally and never leave the machine. */
5
5
  import { type EngineHost } from "./host.js";
6
- import type { BranchRatingDeltas, BrowserFormulation, DemandDeltas, NetworkBranch, NetworkBus, ProblemCaps, SensitivityColumn, Solution, SolveRequest, SolveResponse, SolveIteration } from "./generated/contracts.js";
7
- export { CONTRACT_SOURCE_SHA256, CONTRACT_VERSION, FORMULATION_IDS, SOLVE_STATUSES, } from "./generated/contracts.js";
6
+ import type { BranchRatingDeltas, BrowserFormulation, DemandDeltas, NetworkBranch, NetworkBus, ProblemCaps, SensitivityColumn, Solution, SolveRequest, SolveResponse, SolveIteration } from "./generated/api-types.js";
7
+ import type { ErrorPayload as SynthErrorPayload, GenerationReport, Stage as SynthStage, StepOutcome, SynthRequest } from "./generated/synth-types.js";
8
+ export { API_SOURCE_SHA256, ENGINE_VERSION, FORMULATION_IDS, SOLVE_STATUSES, } from "./generated/api-types.js";
8
9
  export { MAX_ENGINE_INPUT_BYTES } from "./input-limit.js";
9
- export type { BranchRatingDeltas, BrowserFormulation, CaseSummary, DemandDeltas, Network, NetworkBranch, NetworkBus, ProblemCaps, SensRequest, SensitivityColumn, SensitivityMatrix, Solution, SolveIteration, SolveRequest, SolveResponse, } from "./generated/contracts.js";
10
+ export type { BranchRatingDeltas, BrowserFormulation, CaseSummary, DemandDeltas, Network, NetworkBranch, NetworkBus, ProblemCaps, SensRequest, SensitivityColumn, SensitivityMatrix, Solution, SolveIteration, SolveRequest, SolveResponse, } from "./generated/api-types.js";
11
+ /** One structured PowerIO finding. */
12
+ export interface PowerIoDiagnostic {
13
+ code: string;
14
+ severity: "note" | "remark" | "warning" | "error";
15
+ message: string;
16
+ id?: string;
17
+ target?: string;
18
+ spans?: {
19
+ source: string;
20
+ byte_start: number;
21
+ byte_end: number;
22
+ }[];
23
+ related?: string[];
24
+ details?: Record<string, unknown>;
25
+ suggested_action?: string;
26
+ }
27
+ /** Compact display spelling for a structured PowerIO finding. */
28
+ export declare function formatPowerIoDiagnostic(diagnostic: PowerIoDiagnostic): string;
10
29
  export interface CaseFileSummary {
11
30
  name: string;
12
31
  base_mva: number;
@@ -27,12 +46,20 @@ export interface CaseFileSummary {
27
46
  * package echoes the kind it was saved with), `synthetic_pending` when the
28
47
  * case awaits placement. */
29
48
  coords_kind: "file" | "synthetic_pending" | "synthetic" | "manual";
49
+ /** How `synthetic` coordinates were made, when the module records it:
50
+ * `generated` for a grid a generator sited on real geography (the module's
51
+ * history holds `tellegen-synth.generate`). Absent for a stamped topology
52
+ * layout. */
53
+ coords_method?: "generated";
54
+ /** Findings produced while PowerIO parsed the retained module. */
55
+ diagnostics: PowerIoDiagnostic[];
56
+ /** Tellegen display notes, such as omitted unlocated analysis rows. */
30
57
  warnings: string[];
31
58
  }
32
59
  export interface TopologyBus {
33
60
  id: number;
34
- /** powerio row uid, stamped at ingest (e.g. "buses:0"). */
35
- uid: string;
61
+ /** PowerIO row uid when the source carries one. */
62
+ uid: string | null;
36
63
  /** False for a display-only row synthesized by analysis lowering. */
37
64
  editable?: boolean;
38
65
  demand_mw: number;
@@ -40,8 +67,8 @@ export interface TopologyBus {
40
67
  }
41
68
  export interface TopologyBranch {
42
69
  id: number;
43
- /** powerio row uid, stamped at ingest (e.g. "branches:0"). */
44
- uid: string;
70
+ /** PowerIO row uid when the source carries one. */
71
+ uid: string | null;
45
72
  /** False for a display-only row synthesized by analysis lowering. */
46
73
  editable?: boolean;
47
74
  from: number;
@@ -56,9 +83,13 @@ export interface Topology {
56
83
  /** One parse per dropped file: summary stats, plus map geometry when the
57
84
  * file carries coordinates and topology for synthetic placement otherwise. */
58
85
  export interface IngestedCase extends CaseFileSummary {
59
- network_json: string;
86
+ /** Calculation declared by a typed problem instance. */
87
+ formulation?: Formulation;
88
+ /** Generation 2 PowerIO IR used for display edits and every solver Study. */
89
+ module_json: string;
60
90
  topology: Topology;
61
91
  view: {
92
+ coordinate_space?: "geographic" | "diagram";
62
93
  buses: NetworkBus[];
63
94
  branches: NetworkBranch[];
64
95
  } | null;
@@ -80,6 +111,8 @@ export interface DistGraphBus {
80
111
  id: string;
81
112
  terminals: string[];
82
113
  grounded: string[];
114
+ /** Declared or conservative conventional neutral terminal, when present. */
115
+ neutral_terminal?: string | null;
83
116
  xy?: [number, number];
84
117
  load_kw: number;
85
118
  gen_kw: number;
@@ -103,13 +136,12 @@ export interface DistGraph {
103
136
  buses: DistGraphBus[];
104
137
  edges: DistGraphEdge[];
105
138
  }
106
- /** One multiconductor parse for the viewing path: element counts, connected
107
- * load and generation (kW), parse warnings, coordinate provenance, and the
108
- * bus/terminal graph. No solve, no network JSON — distribution cases are viewed,
109
- * not solved. `coords_kind` tells the frontend how to place buses: `geographic`
110
- * drops `xy` straight onto the map, `planar` fits provided positions into a box
111
- * at a placement center, `synthetic` runs the force layout. */
139
+ /** Multiconductor case data, terminal graph, and retained PowerIO IR. */
112
140
  export interface IngestedDistCase {
141
+ module_json?: string;
142
+ geo_layer?: string;
143
+ mc_pf_enabled?: boolean;
144
+ mc_pf_unavailable_reason?: string | null;
113
145
  name: string | null;
114
146
  model: "multiconductor";
115
147
  n_bus: number;
@@ -124,7 +156,7 @@ export interface IngestedDistCase {
124
156
  n_shunt: number;
125
157
  /** Capacitor banks read as their own type, which only the BMOPF reader does.
126
158
  * A `.dss` or PMD capacitor counts in `n_shunt` instead. Optional because an
127
- * engine build before this field satisfies the same `^0.1.0` range. */
159
+ * older compatible engine payload can omit it. */
128
160
  n_capacitor?: number;
129
161
  load_kw: number;
130
162
  gen_kw: number;
@@ -133,32 +165,79 @@ export interface IngestedDistCase {
133
165
  placed_buses: number;
134
166
  coords_space: "geographic" | "projected" | "diagram" | "unknown" | "none";
135
167
  coords_kind: "geographic" | "planar" | "synthetic";
136
- warnings: string[];
168
+ diagnostics: PowerIoDiagnostic[];
137
169
  graph: DistGraph;
170
+ /** Explicit capability from the reader; absent means inspection only. */
171
+ mc_pf_supported?: boolean;
172
+ /** Reader explanation for an inspection-only distribution payload. */
173
+ mc_pf_reason?: string;
138
174
  }
139
- /** A study restored from a saved `.pio.json` package: the ingest payload plus the
140
- * restored formulation, solve options, and folded edit state. `deltas` are keyed by
141
- * bus id and `rates` by branch id — the numeric keys the sliders use. */
142
- export interface LoadedPackage extends IngestedCase {
143
- formulation: Formulation;
144
- options: {
145
- shed: boolean;
146
- warm_start: boolean;
147
- };
148
- deltas: DemandDeltas;
149
- rates: BranchRatingDeltas;
150
- }
151
- /** A study state written to a target format: the serialized case text, the writer's
152
- * fidelity warnings (empty when the conversion is faithful), and the format token and
153
- * file extension so a caller can name the download. */
175
+ /** A materialized case written to a target format: the serialized case text,
176
+ * this output operation's diagnostics, and the format token and file extension. */
154
177
  export interface ExportedCase {
155
178
  text: string;
156
- warnings: string[];
179
+ diagnostics: PowerIoDiagnostic[];
157
180
  format: string;
158
181
  extension: string;
159
182
  }
183
+ /** One weighted LMP objective term, addressed by its PowerIO bus id. */
184
+ export interface CapacityPlanBusWeightJson {
185
+ bus: number;
186
+ weight: number;
187
+ }
188
+ export type ImplicitObjectiveJson = {
189
+ kind: "weighted_lmp";
190
+ weights: CapacityPlanBusWeightJson[];
191
+ };
192
+ /** Capacity increases considered by the bounded planning search. */
193
+ export interface CapacityPlanSpecJson {
194
+ objective: ImplicitObjectiveJson;
195
+ candidates: string[];
196
+ max_increase_per_branch_mw: number;
197
+ budget_mw: number;
198
+ increment_mw: number;
199
+ max_changed_lines: number;
200
+ exact_solve_budget: number;
201
+ }
202
+ export interface CapacityPlanRatingChangeJson {
203
+ branch: string;
204
+ delta_mw: number;
205
+ }
206
+ /** One recorded search step: the gradient direction, the trial, the first
207
+ * order prediction, the exact outcome, and whether the step was kept. */
208
+ export interface CapacityPlanIterationJson {
209
+ gradient: Array<{
210
+ branch: string;
211
+ value: number;
212
+ }>;
213
+ delta_mw: CapacityPlanRatingChangeJson[];
214
+ predicted_phi_delta: number;
215
+ exact_phi_delta: number | null;
216
+ first_order_error: number | null;
217
+ first_order_error_rel: number | null;
218
+ accepted: boolean;
219
+ reason: string;
220
+ }
221
+ export interface CapacityPlanResultSummaryJson {
222
+ phi: number;
223
+ declared_objective: number;
224
+ /** One-based position in this planning operation's exact solve budget. */
225
+ exact_solve: number;
226
+ }
227
+ /** The outcome of one bounded planning search and its unapplied
228
+ * proposal. */
229
+ export interface CapacityPlanOutcomeJson {
230
+ baseline: CapacityPlanResultSummaryJson;
231
+ exact_verified_result: CapacityPlanResultSummaryJson;
232
+ baseline_phi: number;
233
+ final_phi: number;
234
+ proposal: CapacityPlanRatingChangeJson[];
235
+ spent_budget_mw: number;
236
+ exact_solves: number;
237
+ iterations: CapacityPlanIterationJson[];
238
+ }
160
239
  export declare function preloadEngine(): Promise<void>;
161
- export type JsonDropKind = "balanced-package" | "multiconductor-package" | "model-json" | "transmission" | "distribution" | "ambiguous" | "unknown";
240
+ export type JsonDropKind = "module" | "transmission" | "distribution" | "ambiguous" | "unknown";
162
241
  export interface JsonDropClassification {
163
242
  kind: JsonDropKind;
164
243
  format: string | null;
@@ -167,17 +246,11 @@ export interface JsonDropClassification {
167
246
  * ambiguous documents carry no payload; every recognized family carries the
168
247
  * same typed payload returned by its dedicated ingest API. */
169
248
  export type IngestedJsonDrop = {
170
- kind: "balanced-package";
249
+ /** A generation 2 `pio-ir` document; the payload family follows the
250
+ * network family carried by the module value. */
251
+ kind: "module";
171
252
  format: null;
172
- payload: LoadedPackage;
173
- } | {
174
- kind: "multiconductor-package";
175
- format: null;
176
- payload: IngestedDistCase;
177
- } | {
178
- kind: "model-json";
179
- format: null;
180
- payload: IngestedCase;
253
+ payload: IngestedCase | IngestedDistCase;
181
254
  } | {
182
255
  kind: "transmission";
183
256
  format: string;
@@ -191,8 +264,8 @@ export type IngestedJsonDrop = {
191
264
  format: null;
192
265
  payload: null;
193
266
  };
194
- /** Classify JSON bytes through powerio's Rust routing table. Package markers
195
- * also pass the strict package reader so the payload family is authoritative. */
267
+ /** Classify JSON bytes through powerio's Rust routing table. A stored module
268
+ * passes the strict module reader so the payload family is authoritative. */
196
269
  export declare function classifyJson(bytes: Uint8Array): Promise<JsonDropClassification>;
197
270
  /** Classify and ingest one dropped JSON document in the same engine request.
198
271
  * This avoids parsing a recognized package once to classify it and again to
@@ -204,12 +277,6 @@ export declare function formatOf(name: string): string | null;
204
277
  * decoded text: powerio refuses a text format whose bytes are not UTF-8, where
205
278
  * `File.text()` would have replaced each offending byte with U+FFFD. */
206
279
  export declare function ingestCase(bytes: Uint8Array, format: string): Promise<IngestedCase>;
207
- /** Parse powerio's own model JSON (the `model-json` export, or the payload a
208
- * package carries) for viewing. It is not a case format, so it does not go
209
- * through `ingestCase`. */
210
- export declare function ingestModelJson(networkJson: string): Promise<IngestedCase>;
211
- /** Byte entry point for a dropped model JSON document. */
212
- export declare function ingestModelJsonBytes(bytes: Uint8Array): Promise<IngestedCase>;
213
280
  /** Parse a multiconductor distribution case for viewing. `format` is a
214
281
  * distribution reader token (`dss`, `bmopf`, `pmd`) or `pio` for a `.pio.json`
215
282
  * package carrying a multiconductor payload. Rejects on malformed input or a
@@ -217,33 +284,18 @@ export declare function ingestModelJsonBytes(bytes: Uint8Array): Promise<Ingeste
217
284
  export declare function ingestDistCase(text: string, format: string): Promise<IngestedDistCase>;
218
285
  /** Byte entry point for a dropped distribution case or package. */
219
286
  export declare function ingestDistCaseBytes(bytes: Uint8Array, format: string): Promise<IngestedDistCase>;
220
- /** Substations from a PowerWorld .pwd display file. `x`/`y` are diagram
221
- * coordinates as stored; `lon`/`lat` are the engine's approximate projection
222
- * (powerio's inverse of the auto layout Mercator — hand edited diagrams
223
- * drift from it). */
224
- export interface DisplayPreview {
225
- substations: {
226
- number: number;
227
- name: string;
228
- x: number;
229
- y: number;
230
- lon: number;
231
- lat: number;
232
- }[];
233
- canvas_width: number;
234
- canvas_height: number;
235
- }
287
+ /** A PowerWorld drawing decoded in its declared diagram coordinate system. */
288
+ export type DisplayPreview = ParsedGeoLayer;
236
289
  /** True for binary display files (PowerWorld .pwd), read via parseDisplay.
237
290
  * Kept separate from formatOf: a .pwd is display data, not a case format. */
238
291
  export declare function isDisplayFile(name: string): boolean;
239
292
  export declare function parseDisplay(bytes: Uint8Array): Promise<DisplayPreview>;
240
293
  /** A parsed geographic sidecar: the layer as its canonical `.geo.json`
241
294
  * document (hand it to {@link applyGeo} or `BrowserStudy.applyGeoLayer`),
242
- * the tolerant reader's notes on records it could not use, and the feature
243
- * counts. */
295
+ * the reader's structured diagnostics, and the feature counts. */
244
296
  export interface ParsedGeoLayer {
245
297
  layer: string;
246
- warnings: string[];
298
+ diagnostics: PowerIoDiagnostic[];
247
299
  n_points: number;
248
300
  n_routes: number;
249
301
  }
@@ -254,9 +306,12 @@ export interface GeoApplyReport {
254
306
  unmatched_features: number;
255
307
  notes: string[];
256
308
  }
257
- /** The refreshed ingest payload after a geo apply: `network_json`, the view,
309
+ /** The refreshed ingest payload after a geo apply: `module_json`, the view,
258
310
  * and the summary all reflect the applied coordinates, and `report` carries
259
311
  * the matched/unmatched counts for the warnings panel. */
312
+ export interface AppliedMcGeoCase extends IngestedDistCase {
313
+ report: GeoApplyReport;
314
+ }
260
315
  export interface AppliedGeoCase extends IngestedCase {
261
316
  report: GeoApplyReport;
262
317
  }
@@ -274,36 +329,270 @@ export declare function parseGeo(bytes: Uint8Array, hint: string): Promise<Parse
274
329
  /** Apply a parsed layer onto a case network (matching by uid, external id,
275
330
  * name, and the unordered branch endpoint pair). Rejects when nothing
276
331
  * matched. */
277
- export declare function applyGeo(networkJson: string, layer: string): Promise<AppliedGeoCase>;
332
+ export declare function applyGeo(moduleJson: string, layer: string): Promise<AppliedGeoCase>;
333
+ /** Apply geographic or drawing coordinates to a multiconductor case. */
334
+ export declare function applyMcGeo(moduleJson: string, layer: string): Promise<AppliedMcGeoCase>;
278
335
  /** Stamp a computed layout (bus id => [lon, lat]) onto a case network with
279
336
  * its provenance, so saves and exports carry it. */
280
- export declare function applyLayout(networkJson: string, coords: Record<number, [number, number]>, kind: "synthetic" | "manual"): Promise<StampedLayoutCase>;
337
+ export declare function applyLayout(moduleJson: string, coords: Record<number, [number, number]>, kind: "synthetic" | "manual"): Promise<StampedLayoutCase>;
281
338
  /** A case's coordinates as a canonical `.geo.json` document. Rejects when the
282
339
  * case carries none. */
283
- export declare function extractGeo(networkJson: string): Promise<string>;
340
+ export declare function extractGeo(moduleJson: string): Promise<string>;
284
341
  /** Fill case coordinates from a PowerWorld `.pwd` sibling: substation symbols
285
342
  * project to approximate longitude/latitude and join onto buses through the
286
343
  * `SubNum` extras key. Rejects when no bus joined. */
287
- export declare function applyDisplayGeo(networkJson: string, bytes: Uint8Array): Promise<AppliedGeoCase>;
344
+ export declare function applyDisplayGeo(moduleJson: string, bytes: Uint8Array): Promise<AppliedGeoCase>;
288
345
  export declare function capabilities(): Promise<ProblemCaps[]>;
289
- export declare function solveJson(networkJson: string, request?: SolveRequest): Promise<SolveResponse>;
346
+ export declare function solveModule(moduleJson: string, request?: SolveRequest): Promise<SolveResponse>;
347
+ /** Portable terminal-aware result returned by the multiconductor fixed-point
348
+ * BMOPF entry point. Complex quantities use `{re, im}` so the JSON remains
349
+ * lossless across the wasm boundary. */
350
+ export interface McPfOptions {
351
+ tolerance?: number;
352
+ max_iterations?: number;
353
+ damping?: number;
354
+ zero_voltage_tolerance?: number;
355
+ /** Absolute physical KCL floor in amperes; default 1e-6. */
356
+ absolute_kcl_tolerance?: number;
357
+ /** Relative KCL tolerance against prepared incident current. */
358
+ relative_kcl_tolerance?: number;
359
+ /** Apply the OpenDSS-style bounded-voltage load envelope; default true. */
360
+ voltage_envelope?: boolean;
361
+ /** Nominal-impedance breakpoint in per unit; default 0.5. */
362
+ v_low_pu?: number;
363
+ /** Lower edge of the normal load-model range; default 0.85. */
364
+ v_min_pu?: number;
365
+ /** Upper edge of the normal load-model range; default 1.15. */
366
+ v_max_pu?: number;
367
+ }
368
+ export interface McComplex {
369
+ re: number;
370
+ im: number;
371
+ }
372
+ export interface McElementPort {
373
+ element: string;
374
+ kind: string;
375
+ branch: number;
376
+ bus: string;
377
+ terminal: string;
378
+ current_into_element: McComplex;
379
+ power_into_element: McComplex;
380
+ }
381
+ export interface McSourceReaction {
382
+ source: string;
383
+ terminal: string;
384
+ current_into_network: McComplex;
385
+ power_into_network: McComplex;
386
+ }
387
+ export interface McPfResult {
388
+ converged: boolean;
389
+ voltage_valid: boolean;
390
+ min_voltage_pu: number | null;
391
+ max_voltage_pu: number | null;
392
+ voltage_violations: Array<{
393
+ load: string;
394
+ branch: number;
395
+ bus: string;
396
+ voltage: number;
397
+ nominal_voltage: number;
398
+ voltage_pu: number;
399
+ bound: "minimum" | "maximum";
400
+ }>;
401
+ iterations: number;
402
+ factorization_count: number;
403
+ matrix_dimension: number;
404
+ matrix_nonzeros: number;
405
+ voltage_change: number;
406
+ physical_kcl_residual: number;
407
+ scaled_kcl_residual: number;
408
+ terminals: McTerminalResult[];
409
+ element_ports: McElementPort[];
410
+ source_reactions: McSourceReaction[];
411
+ }
412
+ export interface McTerminalResult {
413
+ bus: string;
414
+ terminal: string;
415
+ voltage: McComplex;
416
+ /** Current injected into the network at this terminal, amperes. */
417
+ current_into_network: McComplex;
418
+ power_into_network: McComplex;
419
+ }
420
+ /** The constant-size view of one converged operating point. Scalar fields
421
+ * match {@link McPfResult}; the aggregates are what a results summary shows.
422
+ * Interactive edits return this instead of the full result. */
423
+ export interface McPfSummary {
424
+ converged: boolean;
425
+ voltage_valid: boolean;
426
+ min_voltage_pu: number | null;
427
+ max_voltage_pu: number | null;
428
+ voltage_violation_count: number;
429
+ iterations: number;
430
+ factorization_count: number;
431
+ matrix_dimension: number;
432
+ matrix_nonzeros: number;
433
+ voltage_change: number;
434
+ physical_kcl_residual: number;
435
+ scaled_kcl_residual: number;
436
+ terminal_count: number;
437
+ element_port_count: number;
438
+ /** Sum of the source reactions' `V * conj(I)`, VA. */
439
+ source_power_into_network: McComplex;
440
+ /** Sum of `V * conj(I)` over passive equipment ports, VA. */
441
+ passive_loss: McComplex;
442
+ /** Solves performed by the producing session (0 for a stored result). */
443
+ solve_count: number;
444
+ }
445
+ /** Where one solve spent its time, in milliseconds. */
446
+ export interface McPfProfile {
447
+ timed: boolean;
448
+ parse_ms: number;
449
+ prepare_ms: number;
450
+ factor_ms: number;
451
+ load_evaluation_ms: number;
452
+ kcl_and_matvec_ms: number;
453
+ linear_solve_ms: number;
454
+ summary_ms: number;
455
+ total_ms: number;
456
+ iterations: number;
457
+ linear_solves: number;
458
+ }
459
+ /** A bounded request for one bus's terminals and a page of equipment ports. */
460
+ export interface McPfDetailQuery {
461
+ bus?: string | null;
462
+ element?: string | null;
463
+ port_offset?: number;
464
+ /** At most 500; 0 or omitted selects 20. */
465
+ port_limit?: number;
466
+ }
467
+ export interface McPfDetail {
468
+ /** The session solve this page describes; compare with the summary. */
469
+ solve_count: number;
470
+ terminals: McTerminalResult[];
471
+ element_ports: McElementPort[];
472
+ element_port_total: number;
473
+ }
474
+ /** Engine heap accounting: live and peak allocator bytes (peak since the last
475
+ * reset) and the WASM linear memory size, which only grows. */
476
+ export interface EngineMemoryStats {
477
+ heap_live_bytes: number;
478
+ heap_peak_bytes: number;
479
+ linear_memory_bytes: number;
480
+ }
481
+ /** Latency breakdown of the most recent session call, milliseconds. */
482
+ export interface McPfCallTiming {
483
+ /** Time inside the engine thread: solve plus its own serialization. */
484
+ engine_ms: number | null;
485
+ /** Request to response on the calling thread, including transfer. */
486
+ round_trip_ms: number;
487
+ /** JSON parsing on the calling thread. */
488
+ parse_ms: number;
489
+ /** Characters of JSON received. */
490
+ payload_chars: number;
491
+ }
492
+ /** Reduce a stored full result to the summary an interactive edit returns.
493
+ * Sums run in result order, matching the engine's own aggregation. */
494
+ export declare function summarizeMcPfResult(result: McPfResult, solveCount?: number): McPfSummary;
495
+ /** The detail page {@link BrowserMcPfSession.detail} would return, read from
496
+ * a stored full result (a saved Study, or a solve without a session). */
497
+ export declare function mcPfResultDetail(result: McPfResult, query: McPfDetailQuery, solveCount?: number): McPfDetail;
498
+ /** Self-contained saved Study result for a supported distribution AC PF.
499
+ * The input and solution modules make this replayable; `result` is the rich
500
+ * terminal/element view rendered by the Study panel. */
501
+ export interface McStudySnapshot {
502
+ schema: "tellegen-mc-pf-study";
503
+ version: 1;
504
+ id: string;
505
+ title: string;
506
+ formulation: "mc_ac_pf";
507
+ input_module: string;
508
+ solution_module: string;
509
+ options: McPfOptions;
510
+ result: McPfResult;
511
+ }
512
+ export interface McLoadPowerEdit {
513
+ load: string;
514
+ branch: number;
515
+ p_w: number;
516
+ q_var: number;
517
+ }
518
+ export interface McLoadBranchState extends McLoadPowerEdit {
519
+ bus: string;
520
+ base_p_w: number;
521
+ base_q_var: number;
522
+ }
523
+ /** A live fixed-point current-injection solver retained in the shared engine
524
+ * worker. Load edits reuse its sparse LU and previous converged phasors and
525
+ * answer with the constant-size {@link McPfSummary}; terminal and equipment
526
+ * detail is fetched on demand, as bounded pages or numeric arrays. */
527
+ export declare class BrowserMcPfSession {
528
+ #private;
529
+ private readonly host;
530
+ private readonly handle;
531
+ /** Summary of the operating point solved when the session was created. */
532
+ readonly initialSummary: McPfSummary;
533
+ /** Breakdown of the most recent {@link replaceLoadPowers} call. */
534
+ lastTiming: McPfCallTiming | null;
535
+ constructor(host: EngineHost, handle: number,
536
+ /** Summary of the operating point solved when the session was created. */
537
+ initialSummary: McPfSummary);
538
+ summary(): Promise<McPfSummary>;
539
+ /** The complete terminal and equipment result. Its size grows with the
540
+ * network, so interactive views use {@link detail} instead. */
541
+ result(): Promise<McPfResult>;
542
+ loadBranches(): Promise<McLoadBranchState[]>;
543
+ /** Replace the absolute edit set and re-solve warm. Returns the summary
544
+ * and records its latency breakdown in {@link lastTiming}. */
545
+ replaceLoadPowers(edits: McLoadPowerEdit[]): Promise<McPfSummary>;
546
+ /** One bus's terminals and a page of equipment ports. */
547
+ detail(query: McPfDetailQuery): Promise<McPfDetail>;
548
+ /** `[bus, terminal]` identities in the order of the terminal arrays. They
549
+ * are fixed for the session, so they are fetched once. */
550
+ terminalIds(): Promise<Array<[string, string]>>;
551
+ /** Terminal voltages as interleaved `[re, im]` volts. */
552
+ terminalVoltages(): Promise<Float64Array>;
553
+ /** Currents injected into the network as interleaved `[re, im]` amperes. */
554
+ terminalCurrents(): Promise<Float64Array>;
555
+ /** Engine phase timings of the latest solve, or of the cold start. */
556
+ profile(cold?: boolean): Promise<McPfProfile>;
557
+ /** Edited networks built for portable output; ordinary edits build none. */
558
+ materializationCount(): Promise<number>;
559
+ inputModule(): Promise<string>;
560
+ snapshot(studyId: string, studyTitle: string): Promise<McStudySnapshot>;
561
+ free(): void;
562
+ }
563
+ /** Parse, prepare, factor, and solve a persistent multiconductor PF session. */
564
+ export declare function createMcPfSession(moduleJson: string, options?: McPfOptions, signal?: AbortSignal): Promise<BrowserMcPfSession>;
565
+ /** Live and peak heap of the shared engine, with its linear memory size. */
566
+ export declare function engineMemoryStats(): Promise<EngineMemoryStats>;
567
+ /** Start a new peak-heap window in the shared engine. */
568
+ export declare function resetEngineMemoryPeak(): Promise<void>;
569
+ /** Parse and solve a raw BMOPF multiconductor case in the wasm module. */
570
+ export declare function solveMcBmopf(text: string, options?: McPfOptions): Promise<McPfResult>;
571
+ /** Solve a stored PowerIO multiconductor module through the same PF engine. */
572
+ export declare function solveMcModule(moduleJson: string, options?: McPfOptions, signal?: AbortSignal): Promise<McPfResult>;
573
+ /** Solve a supported multiconductor Study input and return a replayable
574
+ * snapshot containing the typed input, PowerIO solution, and rich result. */
575
+ export declare function solveMcStudy(moduleJson: string, studyId: string, studyTitle: string, options?: McPfOptions, signal?: AbortSignal): Promise<McStudySnapshot>;
576
+ /** Validate and canonicalize a saved multiconductor Study snapshot without
577
+ * running the solver again. */
578
+ export declare function replayMcStudy(snapshotJson: string): Promise<McStudySnapshot>;
579
+ /** Update both saved modules with matching positions while retaining the solved values. */
580
+ export declare function applyMcStudyGeo(snapshot: McStudySnapshot, layer: string): Promise<McStudySnapshot>;
290
581
  export { errorText } from "./errors.js";
291
582
  /** True when the engine wasm module has failed to load in a way it can never
292
583
  * recover from in this browser. Nothing solves client side when this is true;
293
584
  * the caller decides whether a server fallback exists. */
294
585
  export declare function isPermanentEngineFailure(message: string): boolean;
295
- /** The sensitivity selection target: a bus (the ∂LMP/∂d column at that bus) or a
296
- * branch (the ∂LMP/∂rating column at that branch). Ids are the external element
586
+ /** The sensitivity selection target: a bus (the nodal-value/demand column at that bus) or a
587
+ * branch (the nodal-value/rating column at that branch). Ids are the external element
297
588
  * ids; `BrowserStudy` translates them to the engine's dense indices. */
298
589
  export type SensTarget = {
299
590
  bus: number;
300
591
  } | {
301
592
  branch: number;
302
593
  };
303
- /** The formulations the full wasm build solves entirely in the browser. Each returns LMP,
304
- * so the price map, legend, and the ∂LMP/∂d overlay apply unchanged to all of them. Tags
305
- * are the engine's serde-lowercase `Problem` variants accepted by `new Study(json, tag)`.
306
- * `dcopf` is the default (zero regression from the prior fixed behavior). */
594
+ /** Calculation names accepted by the browser engine. Power flow returns voltages
595
+ * and flows; OPF calculations also return an objective and LMPs. */
307
596
  export type Formulation = BrowserFormulation;
308
597
  /** UI-facing formulation menu: tag, a short label, and a one-line description. The order
309
598
  * is the menu order; `dcopf` is first and is the default. */
@@ -313,95 +602,233 @@ export declare const FORMULATIONS: ReadonlyArray<{
313
602
  hint: string;
314
603
  disabled?: boolean;
315
604
  }>;
316
- /** The default formulation: DC OPF, preserving the prior fixed behavior byte-for-byte. */
605
+ /** DC OPF is the default calculation. */
317
606
  export declare const DEFAULT_FORMULATION: Formulation;
318
- /** Build-once browser transport for the reactive demand drag. The network is
319
- * parsed and the model built when the Study is created; `commit` solves exactly
607
+ /** Browser transport for the reactive demand drag. The retained PowerIO module
608
+ * is parsed and the model built when the Study is created; `commit` solves exactly
320
609
  * at the UI's absolute demand delta state and `preview` returns a first-order
321
610
  * linearization toward an absolute demand delta state, neither re-parsing the
322
611
  * network. The wasm Study lives behind the engine host (a dedicated worker
323
612
  * when the browser allows one), so every method is async. */
324
613
  export declare class BrowserStudy {
325
614
  #private;
326
- constructor(host: EngineHost, handle: number);
615
+ constructor(host: EngineHost, handle: number, formulation?: Formulation, planningHost?: () => EngineHost);
327
616
  /** Exact solve at demand = base + `deltas` and ratings = base + `rates`, replacing
328
- * the committed point. When `target` names a bus or branch, its ∂LMP/∂parameter
617
+ * the committed point. When `target` names a bus or branch, its nodal-value/parameter
329
618
  * column is computed in the *same* solve and returned (no second round-trip);
330
619
  * otherwise `sensitivity` is null. `caseId` labels the returned column. Returns the
331
620
  * UI Solution, the solver iterates, and the column. */
332
- commit(caseId: string, deltas: DemandDeltas, rates: BranchRatingDeltas, target: SensTarget | null): Promise<{
621
+ commit(caseId: string, deltas: DemandDeltas, rates: BranchRatingDeltas, target: SensTarget | null, signal?: AbortSignal): Promise<{
333
622
  solution: Solution;
334
623
  iterations: SolveIteration[];
335
624
  sensitivity: SensitivityColumn | null;
336
625
  }>;
337
- /** The ∂LMP/∂parameter column at `target` for this study's formulation, computed by
626
+ /** The nodal-value/parameter column at `target` for this study's formulation, computed by
338
627
  * an exact re-solve at the edited point (the same one-call path `commit` uses, but
339
628
  * returning only the column). Used when a bus or branch is selected so the overlay
340
629
  * matches the active formulation rather than always the DC sensitivity. `caseId`
341
630
  * labels the column; returns null when no recognized column comes back. */
342
631
  sensitivity(caseId: string, deltas: DemandDeltas, rates: BranchRatingDeltas, target: SensTarget): Promise<SensitivityColumn | null>;
343
- /** First-order LMP preview for replacing the committed point with
632
+ /** First order nodal value preview for replacing the committed point with
344
633
  * demand = base + `deltas` and ratings = base + `rates`, with no re-solve:
345
- * predicted per-bus ΔLMP and the predicted Δobjective. */
634
+ * predicted per-bus nodal value changes and the predicted objective change. */
346
635
  preview(deltas: DemandDeltas, rates?: BranchRatingDeltas): Promise<{
347
- lmp: {
636
+ prices: {
348
637
  bus: number;
349
- usd_per_mwh: number;
638
+ value: number;
350
639
  }[];
351
640
  objectiveDelta: number | null;
641
+ units: string | null;
352
642
  }>;
353
643
  /** The Study's current exact solution. Called immediately after Study creation
354
644
  * to cache the base point for formulation comparisons. */
645
+ currentView(): Promise<import("./generated/study-types.js").SolveResponse>;
355
646
  currentSolution(): Promise<Solution>;
356
- /** Serialize this study as a `.pio.json` package: the base network payload, the
357
- * edit log as the study block, and the formulation and solve options under
358
- * `study.app["tellegen"]`. The returned text is ready to download or hand to
359
- * `exportStudy`. */
360
- savePackage(): Promise<string>;
647
+ /** Materialize the current case as generation 2 PowerIO IR. */
648
+ saveModule(): Promise<string>;
649
+ /** Preserve the materialized instance's inner objective and constraints in PowerIO IR. */
650
+ saveInstanceModule(): Promise<string>;
651
+ /** Serialize the current exact DC OPF result as a PowerIO solution module.
652
+ * Its embedded problem instance contains the materialized case that was
653
+ * solved. */
654
+ saveSolutionModule(): Promise<string>;
655
+ /** Write the current materialized case to one PowerIO target format. */
656
+ export(format: string): Promise<ExportedCase>;
657
+ /** Run a bounded differentiable planning search over the committed
658
+ * operating point. Read only: the committed case, edits, and revision are
659
+ * untouched; the returned outcome carries the unapplied proposal and the
660
+ * search trace (gradient, per step prediction, exact result, first
661
+ * order error, accept or reject reason). Rejects on a non-DC formulation
662
+ * or an unknown element key. Worker hosts stop the solve on cancellation;
663
+ * the synchronous fallback finishes the wasm call but rejects its result. */
664
+ plan(spec: CapacityPlanSpecJson, signal?: AbortSignal): Promise<CapacityPlanOutcomeJson>;
361
665
  /** Apply a parsed geographic layer (the canonical `.geo.json` from
362
666
  * `parseGeo` or `applyLayout`) onto this study's base network, so the next
363
- * `savePackage` or export carries the coordinates on screen. Locations are
667
+ * `saveModule` or export carries the coordinates on screen. Locations are
364
668
  * metadata the model never reads; nothing re-solves. */
365
669
  applyGeoLayer(layer: string): Promise<GeoApplyReport>;
366
670
  /** Release the wasm Study; call when discarding it (e.g. the case's
367
- * networkJson changed, or the case was removed). Fire and forget: the
671
+ * module input changed, or the case was removed). Fire and forget: the
368
672
  * handle is invalid from this call on. */
369
673
  free(): void;
370
674
  }
371
- export declare function createStudy(networkJson: string, formulation?: Formulation): Promise<BrowserStudy>;
372
- /** Restore a study saved by `BrowserStudy.savePackage`: the case, edit sliders,
373
- * formulation, and solve options in one step. Rejects on a malformed package or one
374
- * that is not a tellegen study (the engine fails the load closed). */
375
- export declare function loadPackage(text: string): Promise<LoadedPackage>;
376
- /** Restore a dropped package without decoding it in JavaScript. */
377
- export declare function loadPackageBytes(bytes: Uint8Array): Promise<LoadedPackage>;
378
- /** Export a saved study package at commit `commit` to a powerio `format` (`matpower`,
379
- * `psse`, `model-json`, ...). Returns the serialized case text, the writer's fidelity
380
- * warnings, and the format token and file extension. */
381
- export declare function exportStudy(packageJson: string, commit: number, format: string): Promise<ExportedCase>;
675
+ export declare function createStudy(moduleJson: string, formulation?: Formulation, options?: {
676
+ isolated?: boolean;
677
+ signal?: AbortSignal;
678
+ }): Promise<BrowserStudy>;
679
+ export type { GenerationReport, StepOutcome, SynthRequest, SynthStage, SynthErrorPayload, };
680
+ /** One `advance()`: the stage that ran, the next one, progress, warnings,
681
+ * and whether the preview changed. */
682
+ export type SynthAdvance = StepOutcome;
683
+ /** A synthetic generation preview, ready for binary map attributes: bus
684
+ * `[lon, lat]` pairs, kinds (0 load, 1 substation, 2 generator, 3 converter)
685
+ * and kV in bus order (bus id = index + 1); concatenated branch route points,
686
+ * the point index where each route starts (one entry more than there are
687
+ * branches, the path layer's binary layout), and branch kV. */
688
+ export interface SynthPreview {
689
+ busPositions: Float64Array;
690
+ busKinds: Uint8Array;
691
+ busKv: Float32Array;
692
+ branchPositions: Float64Array;
693
+ branchStartIndices: Uint32Array;
694
+ branchKv: Float32Array;
695
+ }
696
+ /** Summary of a loaded places table. */
697
+ export interface SynthPlacesInfo {
698
+ count: number;
699
+ sha256: string;
700
+ }
701
+ /** A refusal from the generator, with the code a caller switches on:
702
+ * `invalid_request`, `region`, `places`, `osm`, `osm_insufficient` (an
703
+ * Overpass document too thin to build from, with its bus and branch counts),
704
+ * `build`, `engine`, `state`, `cancelled`. */
705
+ export declare class SynthEngineError extends Error {
706
+ readonly code: string;
707
+ readonly buses?: number;
708
+ readonly branches?: number;
709
+ constructor(payload: SynthErrorPayload);
710
+ }
711
+ /** URL of the places table shipped beside this module (Natural Earth
712
+ * populated places, public domain). Resolved on use, like the wasm asset. */
713
+ export declare function syntheticPlacesUrl(): string;
714
+ /** Fetch the shipped places table, once per page. */
715
+ export declare function fetchSyntheticPlaces(): Promise<Uint8Array>;
716
+ /** Load a places table onto the synthetic generation host. Sessions load the
717
+ * shipped table on their own; call this to warm the host up or to use
718
+ * another table of `{n, lo, la, p, c}` rows. */
719
+ export declare function loadSyntheticPlaces(bytes: Uint8Array): Promise<SynthPlacesInfo>;
720
+ /** The Overpass QL queries for a request's region, one per bounding box (two
721
+ * when it crosses the antimeridian). The caller fetches them and passes the
722
+ * documents as the `osm` option. */
723
+ export declare function syntheticOverpassQueries(request: SynthRequest): Promise<string[]>;
724
+ /** A staged synthetic grid generation on the dedicated synthetic host. Each
725
+ * `advance()` runs one bounded stage (`context`, `site_buses`, `topology`,
726
+ * `electrify`, `dc_opf`, `calibrate` once per iteration, `ac_pf`, `finalize`),
727
+ * so a caller can show progress and a map preview between stages. */
728
+ export declare class BrowserSynthSession {
729
+ #private;
730
+ private readonly host;
731
+ private readonly handle;
732
+ constructor(host: EngineHost, handle: number);
733
+ /** Where the session runs: `"direct"` means the page's own thread, which
734
+ * can pause while a stage runs. */
735
+ get hostKind(): "worker" | "direct";
736
+ /** True once `finalize` has run. */
737
+ get done(): boolean;
738
+ /** Run one stage. With `withPreview`, a stage that changed the preview
739
+ * also returns it. */
740
+ advance(options?: {
741
+ withPreview?: boolean;
742
+ }): Promise<SynthAdvance & {
743
+ preview?: SynthPreview;
744
+ }>;
745
+ /** Advance to the end, calling `onStep` after each stage (with the preview
746
+ * when it changed). An abort cancels the session; the promise rejects with
747
+ * the abort reason. */
748
+ run(onStep?: (outcome: SynthAdvance, preview?: SynthPreview) => void, signal?: AbortSignal): Promise<GenerationReport>;
749
+ preview(): Promise<SynthPreview>;
750
+ /** The generation report, partial until the session is done. */
751
+ report(): Promise<GenerationReport>;
752
+ /** The module as generation 2 PowerIO IR text, with bus locations and
753
+ * branch routes. Available from `electrify` on; does not free the session. */
754
+ takeModule(): Promise<string>;
755
+ /** The module's drop-panel payload, the same {@link IngestedCase} a
756
+ * dropped `.pio.json` produces, so it opens without a second parse. */
757
+ ingest(): Promise<IngestedCase>;
758
+ /** The network as GridFM graphkit JSON: per-unit bus, branch and
759
+ * generator feature matrices on a 0-based bus index, with the edge index
760
+ * in both directions. Available from `electrify` on. */
761
+ exportGridfm(): Promise<string>;
762
+ /** Stop the generation. On a worker host this terminates the synthetic
763
+ * generation worker: interactive studies live on another worker and are
764
+ * untouched, and the next session starts a fresh one. On the page's own
765
+ * thread it takes effect before the next stage. Later calls reject with
766
+ * `reason`. */
767
+ cancel(reason?: unknown): void;
768
+ /** Release the session's engine state. */
769
+ free(): void;
770
+ }
771
+ export interface SynthSessionOptions {
772
+ /** Overpass document(s) for `source: "osm"`: JSON text, or the parsed
773
+ * document or array of documents. Kept out of the request, which is hashed
774
+ * for provenance. */
775
+ osm?: string | object;
776
+ /** A places table to use instead of the shipped one. */
777
+ places?: Uint8Array;
778
+ signal?: AbortSignal;
779
+ }
780
+ /** Open a staged generation on the synthetic host, loading the places table
781
+ * there first when the host has none. */
782
+ export declare function createSynthSession(request: SynthRequest, options?: SynthSessionOptions): Promise<BrowserSynthSession>;
783
+ /** Run every stage in one engine request and return the module, the report
784
+ * and the drop-panel payload. An abort cancels the run. */
785
+ export declare function generateSynthetic(request: SynthRequest, options?: SynthSessionOptions): Promise<{
786
+ moduleJson: string;
787
+ report: GenerationReport;
788
+ ingest: IngestedCase;
789
+ }>;
382
790
  export interface EngineTransport {
383
791
  preloadEngine(): Promise<void>;
384
792
  classifyJson(bytes: Uint8Array): Promise<JsonDropClassification>;
385
793
  ingestJsonDrop(bytes: Uint8Array): Promise<IngestedJsonDrop>;
386
794
  ingestCase(bytes: Uint8Array, format: string): Promise<IngestedCase>;
387
- ingestModelJson(networkJson: string): Promise<IngestedCase>;
388
- ingestModelJsonBytes(bytes: Uint8Array): Promise<IngestedCase>;
389
795
  ingestDistCase(text: string, format: string): Promise<IngestedDistCase>;
390
796
  ingestDistCaseBytes(bytes: Uint8Array, format: string): Promise<IngestedDistCase>;
391
797
  parseDisplay(bytes: Uint8Array): Promise<DisplayPreview>;
392
798
  parseGeo(bytes: Uint8Array, hint: string): Promise<ParsedGeoLayer>;
393
- applyGeo(networkJson: string, layer: string): Promise<AppliedGeoCase>;
394
- applyLayout(networkJson: string, coords: Record<number, [number, number]>, kind: "synthetic" | "manual"): Promise<StampedLayoutCase>;
395
- extractGeo(networkJson: string): Promise<string>;
396
- applyDisplayGeo(networkJson: string, bytes: Uint8Array): Promise<AppliedGeoCase>;
799
+ applyGeo(moduleJson: string, layer: string): Promise<AppliedGeoCase>;
800
+ applyMcGeo?(moduleJson: string, layer: string): Promise<AppliedMcGeoCase>;
801
+ applyLayout(moduleJson: string, coords: Record<number, [number, number]>, kind: "synthetic" | "manual"): Promise<StampedLayoutCase>;
802
+ extractGeo(moduleJson: string): Promise<string>;
803
+ applyDisplayGeo(moduleJson: string, bytes: Uint8Array): Promise<AppliedGeoCase>;
397
804
  capabilities(): Promise<ProblemCaps[]>;
398
- solveJson(networkJson: string, request?: SolveRequest): Promise<SolveResponse>;
399
- createStudy(networkJson: string, formulation?: Formulation): Promise<BrowserStudy>;
400
- loadPackage(text: string): Promise<LoadedPackage>;
401
- loadPackageBytes(bytes: Uint8Array): Promise<LoadedPackage>;
402
- exportStudy(packageJson: string, commit: number, format: string): Promise<ExportedCase>;
805
+ solveModule(moduleJson: string, request?: SolveRequest): Promise<SolveResponse>;
806
+ solveMcBmopf(text: string, options?: McPfOptions): Promise<McPfResult>;
807
+ solveMcModule(moduleJson: string, options?: McPfOptions, signal?: AbortSignal): Promise<McPfResult>;
808
+ solveMcStudy(moduleJson: string, studyId: string, studyTitle: string, options?: McPfOptions, signal?: AbortSignal): Promise<McStudySnapshot>;
809
+ createMcPfSession(moduleJson: string, options?: McPfOptions, signal?: AbortSignal): Promise<BrowserMcPfSession>;
810
+ replayMcStudy(snapshotJson: string): Promise<McStudySnapshot>;
811
+ applyMcStudyGeo?(snapshot: McStudySnapshot, layer: string): Promise<McStudySnapshot>;
812
+ createStudy(moduleJson: string, formulation?: Formulation, options?: {
813
+ isolated?: boolean;
814
+ signal?: AbortSignal;
815
+ }): Promise<BrowserStudy>;
816
+ loadSyntheticPlaces?(bytes: Uint8Array): Promise<SynthPlacesInfo>;
817
+ syntheticOverpassQueries?(request: SynthRequest): Promise<string[]>;
818
+ createSynthSession?(request: SynthRequest, options?: SynthSessionOptions): Promise<BrowserSynthSession>;
819
+ generateSynthetic?(request: SynthRequest, options?: SynthSessionOptions): Promise<{
820
+ moduleJson: string;
821
+ report: GenerationReport;
822
+ ingest: IngestedCase;
823
+ }>;
403
824
  }
404
825
  export declare const browserWasmTransport: EngineTransport;
405
826
  export declare function createBrowserWasmTransport(): EngineTransport;
406
827
  export { BrowserStudy as Study };
828
+ export { IndexedDbStudyStore, StudyDocumentController, studyBackend, } from "./study-document.js";
829
+ export type { StudyBackend, StudyStore } from "./study-document.js";
830
+ export type { CreateStudy, StudyBundle, StudyDocument, StudyRequest, StudyOperation, StudyOperationResult, GoalRevision, DecisionSpace, StudyObjective, StateNode, Comparison, } from "./generated/study-types.js";
831
+ export type { ModelDetails, SolveResponse as StudyView, SearchOptions, StudySummary, } from "./generated/study-types.js";
832
+ export { studySchema } from "./generated/study-schema.js";
833
+ export { synthSchema } from "./generated/synth-schema.js";
407
834
  //# sourceMappingURL=index.d.ts.map