@tellegen/engine 0.1.1 → 0.3.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 (46) hide show
  1. package/README.md +50 -6
  2. package/dist/generated/contracts.d.ts +35 -17
  3. package/dist/generated/contracts.d.ts.map +1 -1
  4. package/dist/generated/contracts.js +3 -3
  5. package/dist/generated/study-contracts.d.ts +426 -0
  6. package/dist/generated/study-contracts.d.ts.map +1 -0
  7. package/dist/generated/study-contracts.js +4 -0
  8. package/dist/generated/study-contracts.js.map +1 -0
  9. package/dist/generated/study-schema.d.ts +2 -0
  10. package/dist/generated/study-schema.d.ts.map +1 -0
  11. package/dist/generated/study-schema.js +3 -0
  12. package/dist/generated/study-schema.js.map +1 -0
  13. package/dist/host.d.ts +12 -0
  14. package/dist/host.d.ts.map +1 -1
  15. package/dist/host.js +71 -17
  16. package/dist/host.js.map +1 -1
  17. package/dist/index.d.ts +360 -96
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +407 -89
  20. package/dist/index.js.map +1 -1
  21. package/dist/input-limit.d.ts +8 -0
  22. package/dist/input-limit.d.ts.map +1 -0
  23. package/dist/input-limit.js +14 -0
  24. package/dist/input-limit.js.map +1 -0
  25. package/dist/module.d.ts +1 -0
  26. package/dist/module.d.ts.map +1 -1
  27. package/dist/module.js.map +1 -1
  28. package/dist/protocol.d.ts +105 -20
  29. package/dist/protocol.d.ts.map +1 -1
  30. package/dist/protocol.js +67 -18
  31. package/dist/protocol.js.map +1 -1
  32. package/dist/study-document.d.ts +46 -0
  33. package/dist/study-document.d.ts.map +1 -0
  34. package/dist/study-document.js +183 -0
  35. package/dist/study-document.js.map +1 -0
  36. package/dist/study-document.test.d.ts +2 -0
  37. package/dist/study-document.test.d.ts.map +1 -0
  38. package/dist/study-document.test.js +119 -0
  39. package/dist/study-document.test.js.map +1 -0
  40. package/dist/wasm-pkg/tellegen.d.ts +191 -55
  41. package/dist/wasm-pkg/tellegen.js +754 -97
  42. package/dist/wasm-pkg/tellegen_bg.wasm +0 -0
  43. package/dist/wasm-pkg/tellegen_bg.wasm.d.ts +30 -6
  44. package/dist/worker.js +27 -3
  45. package/dist/worker.js.map +1 -1
  46. package/package.json +26 -4
package/README.md CHANGED
@@ -1,16 +1,61 @@
1
1
  # @tellegen/engine
2
2
 
3
- Browser package for tellegen case ingestion, wasm solves, Study lifecycle calls, previews, commits, and sensitivity queries.
3
+ Parses cases, runs WebAssembly solves, and exposes `Study` preview, commit, and
4
+ sensitivity calls in browsers.
4
5
 
5
6
  The package has no SvelteKit dependency. Host apps import the top level package and use either the direct functions or the `browserWasmTransport` facade:
6
7
 
7
8
  ```ts
8
- import { browserWasmTransport, createStudy, solveJson } from "@tellegen/engine";
9
+ import {
10
+ browserWasmTransport,
11
+ createStudy,
12
+ ingestJsonDrop,
13
+ solveModule,
14
+ } from "@tellegen/engine";
9
15
  ```
10
16
 
11
17
  The wasm files are resolved relative to the package module. Host apps must serve
12
18
  package asset files from `node_modules`.
13
19
 
20
+ ## Browser Ingestion
21
+
22
+ Case and JSON entry points accept the original bytes:
23
+
24
+ ```ts
25
+ import { ingestCase, ingestJsonDrop } from "@tellegen/engine";
26
+
27
+ const bytes = new Uint8Array(await file.arrayBuffer());
28
+ const casePayload = await ingestCase(bytes, "raw");
29
+ const jsonPayload = await ingestJsonDrop(bytes);
30
+ ```
31
+
32
+ Every solvable ingest payload includes `module_json`, a generation-2 PowerIO
33
+ IR module. Pass that value to `createStudy`, `solveModule`, and geographic
34
+ transforms. The engine does not expose a second network JSON boundary.
35
+
36
+ `ingestJsonDrop(bytes)` classifies and parses JSON in one call. Its
37
+ `IngestedJsonDrop` result is discriminated by `kind`: PowerIO modules have a
38
+ `null` format; transmission and distribution results carry the selected
39
+ format; `ambiguous` and `unknown` results have a `null` payload. Historical
40
+ bare model JSON is now `unknown`; regenerate it as `pio-ir` from source data.
41
+
42
+ Every API that accepts a byte buffer rejects inputs larger than
43
+ `MAX_ENGINE_INPUT_BYTES` (128 MiB) before worker dispatch.
44
+
45
+ ## Migrating To 0.2
46
+
47
+ - Pass `Uint8Array` to `ingestCase`. For an existing string, use
48
+ `new TextEncoder().encode(text)`.
49
+ - Replace `classifyJson(text)` with `await classifyJson(bytes)`. It now returns
50
+ `{ kind, format }` instead of a kind string.
51
+ - If migrating code that imported `isStudyPackageText` from `@tellegen/svelte`,
52
+ use `await ingestJsonDrop(bytes)`. A stored document reports `kind: "module"`;
53
+ its payload determines whether it contains a supported balanced or
54
+ multiconductor value.
55
+ - Update `JsonDropKind` handling: `bmopf` and `pmd` are now
56
+ `kind: "distribution"` with a `format`; `not-json` is `unknown`; and
57
+ `transmission` and `ambiguous` are additional outcomes.
58
+
14
59
  ## Contracts
15
60
 
16
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`.
@@ -46,8 +91,7 @@ npm run build:engine
46
91
  npm run pack:engine
47
92
  ```
48
93
 
49
- The first framework release publishes this package and `@tellegen/svelte`.
50
94
  `@tellegen/engine` is the lower level browser package for custom UIs and for the
51
- Svelte package. The hosted demo under `apps/web` is private and consumes
52
- `@tellegen/svelte` through the same workspace file dependency used by the local
53
- examples.
95
+ Svelte package. It releases through Changesets with the other npm packages. The
96
+ hosted demo under `apps/web` is private and consumes `@tellegen/svelte` through
97
+ the same workspace file dependency used by the local examples.
@@ -1,10 +1,10 @@
1
- export declare const CONTRACT_VERSION: "0.1.1";
2
- export declare const CONTRACT_SOURCE_SHA256: "d17b92b8b23874c858ccb26b1740f253c95d7cfd78d9511c847b57c2f6eae05e";
1
+ export declare const CONTRACT_VERSION: "0.3.0";
2
+ export declare const CONTRACT_SOURCE_SHA256: "9728ba356f32e4174214292aa200f079d40ddad33282e2955e8e1def71c03c68";
3
3
  export declare const FORMULATION_IDS: readonly ["dcpf", "dcopf", "acpf", "socwr", "acopf"];
4
4
  export type FormulationId = (typeof FORMULATION_IDS)[number];
5
5
  export declare const SOLVE_STATUSES: readonly ["optimal", "feasible"];
6
6
  export type SolveStatus = (typeof SOLVE_STATUSES)[number];
7
- export type BrowserFormulation = Extract<FormulationId, 'dcopf' | 'acopf' | 'socwr'>;
7
+ export type BrowserFormulation = Extract<FormulationId, 'dcopf' | 'acpf' | 'acopf' | 'socwr'>;
8
8
  export type Power = 'Active' | 'Reactive';
9
9
  export type End = 'From' | 'To';
10
10
  export type VoltageKind = 'Magnitude' | 'Angle' | 'Squared' | 'ProductReal' | 'ProductImag';
@@ -60,15 +60,10 @@ export interface Edits {
60
60
  deltas?: DemandDeltas;
61
61
  rates?: BranchRatingDeltas;
62
62
  }
63
- export interface SolveOptions {
64
- shed?: boolean;
65
- warm_start?: boolean;
66
- }
67
63
  export interface SolveRequest {
68
64
  formulation?: FormulationId;
69
65
  edits?: Edits;
70
66
  sensitivities?: SensRequest[];
71
- options?: SolveOptions;
72
67
  }
73
68
  export interface SolveIteration {
74
69
  iter: number;
@@ -104,6 +99,7 @@ export interface BranchFlow {
104
99
  qt?: number;
105
100
  }
106
101
  export interface GenDispatch {
102
+ bus?: number;
107
103
  gen: number;
108
104
  pg: number;
109
105
  qg?: number;
@@ -148,8 +144,13 @@ export interface ProblemCaps {
148
144
  }
149
145
  export interface NetworkBus {
150
146
  id: number;
151
- /** powerio row uid; always present on an ingested case, absent on older payloads. */
152
- uid?: string;
147
+ name?: string | null;
148
+ area?: number;
149
+ zone?: number;
150
+ /** PowerIO row uid when the source carries one; older payloads omit the field. */
151
+ uid?: string | null;
152
+ /** False for a display-only row synthesized by analysis lowering. */
153
+ editable?: boolean;
153
154
  lon: number;
154
155
  lat: number;
155
156
  demand_mw: number;
@@ -157,8 +158,10 @@ export interface NetworkBus {
157
158
  }
158
159
  export interface NetworkBranch {
159
160
  id: number;
160
- /** powerio row uid; always present on an ingested case, absent on older payloads. */
161
- uid?: string;
161
+ /** PowerIO row uid when the source carries one; older payloads omit the field. */
162
+ uid?: string | null;
163
+ /** False for a display-only row synthesized by analysis lowering. */
164
+ editable?: boolean;
162
165
  from: number;
163
166
  to: number;
164
167
  rate_mw: number;
@@ -166,6 +169,8 @@ export interface NetworkBranch {
166
169
  path: [number, number][];
167
170
  }
168
171
  export interface Network {
172
+ coordinate_space?: 'geographic' | 'diagram';
173
+ model_details?: import('./study-contracts.js').ModelDetails | null;
169
174
  id: string;
170
175
  name: string;
171
176
  base_mva: number;
@@ -174,10 +179,14 @@ export interface Network {
174
179
  branches: NetworkBranch[];
175
180
  }
176
181
  export interface Solution {
177
- objective: number;
178
- lmp: {
182
+ objective: number | null;
183
+ prices: {
179
184
  bus: number;
180
- usd_per_mwh: number;
185
+ value: number;
186
+ }[];
187
+ vm?: {
188
+ bus: number;
189
+ value: number;
181
190
  }[];
182
191
  va: {
183
192
  bus: number;
@@ -194,6 +203,7 @@ export interface Solution {
194
203
  }[];
195
204
  dispatch: {
196
205
  gen: number;
206
+ bus?: number;
197
207
  mw: number;
198
208
  }[];
199
209
  }
@@ -201,9 +211,9 @@ export interface SensitivityColumn {
201
211
  case: string;
202
212
  operand: string;
203
213
  parameter: string;
204
- /** The selected source bus, for a bus-axis parameter column (∂LMP/∂d). */
214
+ /** The selected source bus, for a bus-axis price parameter column. */
205
215
  bus?: number;
206
- /** The selected source branch, for a branch-axis parameter column (∂LMP/∂fmax). */
216
+ /** The selected source branch, for a branch-axis price parameter column. */
207
217
  branch?: number;
208
218
  units: string;
209
219
  values: {
@@ -212,10 +222,18 @@ export interface SensitivityColumn {
212
222
  }[];
213
223
  }
214
224
  export interface CaseSummary {
225
+ /** Configured cases remain listed when loading or solving fails. */
226
+ unavailable_reason?: string | null;
215
227
  id: string;
216
228
  name: string;
229
+ /** Canonical typed PowerIO bus rows. */
217
230
  n_bus: number;
231
+ /** Canonical typed PowerIO branch rows. */
218
232
  n_branch: number;
233
+ /** Rendered buses after analysis lowering; absent on older servers. */
234
+ n_analysis_bus?: number;
235
+ /** Rendered branches after analysis lowering; absent on older servers. */
236
+ n_analysis_branch?: number;
219
237
  n_gen: number;
220
238
  }
221
239
  /** Keys are element keys: the original numeric id, or the powerio row uid
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/generated/contracts.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AACjD,eAAO,MAAM,sBAAsB,EAAG,kEAA2E,CAAC;AAElH,eAAO,MAAM,eAAe,sDAAmD,CAAC;AAChF,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,cAAc,kCAAkC,CAAC;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;AACrF,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;AAC1C,MAAM,MAAM,GAAG,GAAG,MAAM,GAAG,IAAI,CAAC;AAChC,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,aAAa,GAAG,aAAa,CAAC;AAC5F,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAC9C,MAAM,MAAM,EAAE,GAAG,aAAa,GAAG,aAAa,CAAC;AAC/C,MAAM,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAClC,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,YAAY,CAAC;AAC7C,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;AAElD,MAAM,MAAM,OAAO,GAChB;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,GAChB;IAAE,QAAQ,EAAE,KAAK,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE;QAA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AC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACd;AAED;yDACyD;AACzD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  // Generated by packages/engine/scripts/generate-contracts.mjs.
2
2
  // Rust source: crates/tellegen/src/api.rs
3
- // Rust source sha256: d17b92b8b23874c858ccb26b1740f253c95d7cfd78d9511c847b57c2f6eae05e
4
- export const CONTRACT_VERSION = "0.1.1";
5
- export const CONTRACT_SOURCE_SHA256 = "d17b92b8b23874c858ccb26b1740f253c95d7cfd78d9511c847b57c2f6eae05e";
3
+ // Rust source sha256: 9728ba356f32e4174214292aa200f079d40ddad33282e2955e8e1def71c03c68
4
+ export const CONTRACT_VERSION = "0.3.0";
5
+ export const CONTRACT_SOURCE_SHA256 = "9728ba356f32e4174214292aa200f079d40ddad33282e2955e8e1def71c03c68";
6
6
  export const FORMULATION_IDS = ["dcpf", "dcopf", "acpf", "socwr", "acopf"];
7
7
  export const SOLVE_STATUSES = ["optimal", "feasible"];
8
8
  //# sourceMappingURL=contracts.js.map
@@ -0,0 +1,426 @@
1
+ export type ArtifactKind = "powerio_ir" | "geo_layer" | "evidence";
2
+ export type Bound = "Min" | "Max";
3
+ export type BranchFlow = {
4
+ "branch": number;
5
+ "loading": number;
6
+ "pf": number;
7
+ "pt"?: number | null;
8
+ "qf"?: number | null;
9
+ "qt"?: number | null;
10
+ "uid"?: string | null;
11
+ };
12
+ export type BranchScalar = {
13
+ "branch": number;
14
+ "value": number;
15
+ };
16
+ export type BusInjection = {
17
+ "bus": number;
18
+ "p": number;
19
+ "q": number;
20
+ "uid"?: string | null;
21
+ };
22
+ export type BusScalar = {
23
+ "bus": number;
24
+ "uid"?: string | null;
25
+ "value": number;
26
+ };
27
+ export type Camera = {
28
+ "bearing": number;
29
+ "center": Array<number>;
30
+ "pitch": number;
31
+ "zoom": number;
32
+ };
33
+ export type ColMeta = {
34
+ "element": ElementId;
35
+ "index": number;
36
+ "parameter": Parameter;
37
+ };
38
+ export type Comparison = {
39
+ "goal"?: string | null;
40
+ "improvement"?: number | null;
41
+ "left": string;
42
+ "left_value"?: number | null;
43
+ "left_view"?: (SolveResponse) | (null);
44
+ "right": string;
45
+ "right_value"?: number | null;
46
+ "right_view"?: (SolveResponse) | (null);
47
+ };
48
+ export type CostApproximation = {
49
+ "bus": number;
50
+ "generator": number;
51
+ "max_breakpoint_error": number;
52
+ "model_cost": GenCost;
53
+ "rms_breakpoint_error": number;
54
+ "source_cost": GenCost;
55
+ };
56
+ export type CostPreparation = "exact" | "convex_quadratic_fit";
57
+ export type CostTerm = "Quadratic" | "Linear";
58
+ export type CreateDisplay = {
59
+ "camera"?: (Camera) | (null);
60
+ "case_id": string;
61
+ "diagram_camera"?: (DiagramCamera) | (null);
62
+ "geo_layer": string;
63
+ "layers"?: Array<string>;
64
+ };
65
+ export type CreateStudy = {
66
+ "base_input"?: string | null;
67
+ "decisions"?: (DecisionSpace) | (null);
68
+ "display"?: (CreateDisplay) | (null);
69
+ "formulation": "dcopf" | "acpf" | "socwr";
70
+ "id": string;
71
+ "input": string;
72
+ "interpretation"?: string;
73
+ "model_details"?: (ModelDetails) | (null);
74
+ "objective"?: (StudyObjective) | (null);
75
+ "request"?: string;
76
+ "solution"?: string | null;
77
+ "success_value"?: number | null;
78
+ "title": string;
79
+ "view"?: (SolveResponse) | (null);
80
+ };
81
+ export type DecisionKind = "retain" | "reject" | "recommend" | "apply";
82
+ export type DecisionRecord = {
83
+ "choice": DecisionKind;
84
+ "evidence": Array<string>;
85
+ "experiment": string;
86
+ "rationale": string;
87
+ "state"?: string | null;
88
+ };
89
+ export type DecisionSpace = {
90
+ "demand"?: (DemandConstraint) | (null);
91
+ "max_changed_elements": number;
92
+ "total_budget": number;
93
+ "variables": Array<DecisionVariable>;
94
+ };
95
+ export type DecisionVariable = {
96
+ "budget_weight": number;
97
+ "element": ElementKey;
98
+ "id": string;
99
+ "increment": number;
100
+ "intervention": Intervention;
101
+ "lower": number;
102
+ "upper": number;
103
+ };
104
+ export type DemandAdjustment = {
105
+ "bus": ElementKey;
106
+ "delta_mw": number;
107
+ };
108
+ export type DemandChange = {
109
+ "base_mw": number;
110
+ "bus": ElementKey;
111
+ "delta_mw": number;
112
+ "demand_mw": number;
113
+ };
114
+ export type DemandConstraint = ({
115
+ "increase_mw": number;
116
+ "kind": "placement";
117
+ }) | ({
118
+ "kind": "redistribution";
119
+ });
120
+ export type DiagramCamera = {
121
+ "center": Array<number>;
122
+ "scale": number;
123
+ };
124
+ export type DisplayContext = {
125
+ "camera"?: (Camera) | (null);
126
+ "case_id": string;
127
+ "diagram_camera"?: (DiagramCamera) | (null);
128
+ "geography": string;
129
+ "layers"?: Array<string>;
130
+ };
131
+ export type ElementId = ({
132
+ "Bus": number;
133
+ }) | ({
134
+ "Branch": number;
135
+ }) | ({
136
+ "Generator": number;
137
+ });
138
+ export type ElementKey = (number) | (string);
139
+ export type End = "From" | "To";
140
+ export type ExperimentKind = "inspection" | "sensitivity" | "planning" | "counterfactual" | "challenge" | "historical_import";
141
+ export type ExperimentRecord = {
142
+ "assessed_recommendation"?: string | null;
143
+ "evidence": Array<string>;
144
+ "goal"?: string | null;
145
+ "kind": ExperimentKind;
146
+ "rationale": string;
147
+ "result_states": Array<string>;
148
+ "solve_count": number;
149
+ "start_state"?: string | null;
150
+ "termination": string;
151
+ "trials": Array<TrialRecord>;
152
+ };
153
+ export type ExperimentSummary = {
154
+ "goal"?: string | null;
155
+ "id": string;
156
+ "kind": ExperimentKind;
157
+ "rationale": string;
158
+ "result_states": Array<string>;
159
+ "solve_count": number;
160
+ "start_state"?: string | null;
161
+ "termination": string;
162
+ "trial_count": number;
163
+ };
164
+ export type GB = "Conductance" | "Susceptance";
165
+ export type GenCost = {
166
+ "coeffs": Array<number>;
167
+ "model": number;
168
+ "ncost": number;
169
+ "shutdown": number;
170
+ "startup": number;
171
+ };
172
+ export type GenDispatch = {
173
+ "bus"?: number | null;
174
+ "gen": number;
175
+ "pg": number;
176
+ "qg"?: number | null;
177
+ };
178
+ export type GoalRevision = {
179
+ "anchor_state": string;
180
+ "decisions": DecisionSpace;
181
+ "interpretation": string;
182
+ "objective": StudyObjective;
183
+ "parent"?: string | null;
184
+ "request": string;
185
+ "success_value"?: number | null;
186
+ };
187
+ export type Intervention = "branch_rating" | "active_demand";
188
+ export type Iterations = (Array<SolveIteration>) | ({
189
+ "count": number;
190
+ "residual": number;
191
+ });
192
+ export type ModelDetails = {
193
+ "approximations": Array<CostApproximation>;
194
+ "method": CostPreparation;
195
+ "model": string;
196
+ "quantity": string;
197
+ "source": string;
198
+ "units": string;
199
+ };
200
+ export type ObservableWeight = {
201
+ "element": ElementKey;
202
+ "weight": number;
203
+ };
204
+ export type Operand = ({
205
+ "Price": Power;
206
+ }) | ({
207
+ "Dispatch": Power;
208
+ }) | ({
209
+ "Flow": {
210
+ "end": End;
211
+ "power": Power;
212
+ };
213
+ }) | ({
214
+ "Voltage": VoltageKind;
215
+ });
216
+ export type Parameter = ({
217
+ "Demand": Power;
218
+ }) | ({
219
+ "Cost": CostTerm;
220
+ }) | ("LineLimit") | ({
221
+ "SeriesAdmittance": GB;
222
+ }) | ({
223
+ "ShuntAdmittance": GB;
224
+ }) | ({
225
+ "VoltageBound": Bound;
226
+ }) | ({
227
+ "GenBound": {
228
+ "bound": Bound;
229
+ "power": Power;
230
+ };
231
+ }) | ({
232
+ "Transformer": TapKind;
233
+ }) | ("Switching");
234
+ export type Power = "Active" | "Reactive";
235
+ export type Problem = ("dcpf") | ("dcopf") | ("acpf") | ("socwr") | ("acopf");
236
+ export type RowMeta = {
237
+ "element": ElementId;
238
+ "index": number;
239
+ "operand": Operand;
240
+ };
241
+ export type SearchOptions = {
242
+ "beam_width": number;
243
+ "max_iterations": number;
244
+ "max_solves": number;
245
+ "min_improvement": number;
246
+ };
247
+ export type SensitivityMatrix = {
248
+ "cols": Array<ColMeta>;
249
+ "rows": Array<RowMeta>;
250
+ "units": string;
251
+ "values": Array<Array<number>>;
252
+ };
253
+ export type SolveIteration = {
254
+ "inf_du": number;
255
+ "inf_pr": number;
256
+ "iter": number;
257
+ "objective": number;
258
+ };
259
+ export type SolveResponse = {
260
+ "dispatch"?: Array<GenDispatch> | null;
261
+ "flows"?: Array<BranchFlow> | null;
262
+ "formulation": Problem;
263
+ "injections"?: Array<BusInjection> | null;
264
+ "iterations"?: (Iterations) | (null);
265
+ "lmp"?: Array<BusScalar> | null;
266
+ "lmp_q"?: Array<BusScalar> | null;
267
+ "objective"?: number | null;
268
+ "sensitivities"?: Array<SensitivityMatrix>;
269
+ "status": SolveStatus;
270
+ "va"?: Array<BusScalar> | null;
271
+ "vm"?: Array<BusScalar> | null;
272
+ "w"?: Array<BusScalar> | null;
273
+ "wi"?: Array<BranchScalar> | null;
274
+ "wr"?: Array<BranchScalar> | null;
275
+ };
276
+ export type SolveStatus = ("optimal") | ("feasible");
277
+ export type StateNode = {
278
+ "formulation": Problem;
279
+ "input": string;
280
+ "label": string;
281
+ "parent"?: string | null;
282
+ "solution"?: string | null;
283
+ "view"?: string | null;
284
+ };
285
+ export type StudyArtifact = {
286
+ "kind": ArtifactKind;
287
+ "text": string;
288
+ };
289
+ export type StudyBundle = {
290
+ "artifacts": {
291
+ [key: string]: StudyArtifact;
292
+ };
293
+ "document": StudyDocument;
294
+ };
295
+ export type StudyDocument = {
296
+ "active_goal"?: string | null;
297
+ "applied_state"?: string | null;
298
+ "base_input"?: string | null;
299
+ "decisions": {
300
+ [key: string]: DecisionRecord;
301
+ };
302
+ "display"?: (DisplayContext) | (null);
303
+ "experiment_order": Array<string>;
304
+ "experiments": {
305
+ [key: string]: ExperimentRecord;
306
+ };
307
+ "goals": {
308
+ [key: string]: GoalRevision;
309
+ };
310
+ "id": string;
311
+ "inspected_state"?: string | null;
312
+ "model_details"?: (ModelDetails) | (null);
313
+ "recommended_state"?: string | null;
314
+ "revision": number;
315
+ "schema": string;
316
+ "states": {
317
+ [key: string]: StateNode;
318
+ };
319
+ "title": string;
320
+ "version": number;
321
+ };
322
+ export type StudyObjective = ({
323
+ "kind": "weighted_observable";
324
+ "operand": Operand;
325
+ "weights": Array<ObservableWeight>;
326
+ }) | ({
327
+ "kind": "sum";
328
+ "terms": Array<StudyObjective>;
329
+ }) | ({
330
+ "expression": StudyObjective;
331
+ "factor": number;
332
+ "kind": "scale";
333
+ }) | ({
334
+ "expression": StudyObjective;
335
+ "kind": "squared_target";
336
+ "target": number;
337
+ }) | ({
338
+ "decision": string;
339
+ "kind": "intervention_penalty";
340
+ "linear": number;
341
+ "quadratic": number;
342
+ });
343
+ export type StudyOperation = ({
344
+ "kind": "inspect";
345
+ "state": string;
346
+ }) | ({
347
+ "kind": "branch";
348
+ "rationale": string;
349
+ "state": string;
350
+ }) | ({
351
+ "goal": GoalRevision;
352
+ "kind": "revise_goal";
353
+ }) | ({
354
+ "goal"?: string | null;
355
+ "kind": "compare";
356
+ "left": string;
357
+ "right": string;
358
+ }) | ({
359
+ "goal": string;
360
+ "kind": "propose";
361
+ "options": SearchOptions;
362
+ "rationale": string;
363
+ "state": string;
364
+ }) | ({
365
+ "changes": Array<DemandAdjustment>;
366
+ "constrain_to_goal"?: boolean;
367
+ "goal"?: string | null;
368
+ "kind": "edit_demand";
369
+ "rationale": string;
370
+ "state": string;
371
+ }) | ({
372
+ "goal"?: string | null;
373
+ "kind": "restore_base";
374
+ "rationale": string;
375
+ "state": string;
376
+ }) | ({
377
+ "assessed_recommendation"?: string | null;
378
+ "evidence": unknown;
379
+ "goal"?: string | null;
380
+ "kind": "record_evidence";
381
+ "rationale": string;
382
+ "sensitivity": boolean;
383
+ "state": string;
384
+ }) | ({
385
+ "base_state": string;
386
+ "goal"?: string | null;
387
+ "kind": "apply";
388
+ "proposal": string;
389
+ "state": string;
390
+ });
391
+ export type StudyOperationResult = {
392
+ "comparison"?: (Comparison) | (null);
393
+ "demand_changes"?: Array<DemandChange> | null;
394
+ "experiment"?: string | null;
395
+ "inspected_view"?: (SolveResponse) | (null);
396
+ "summary": StudySummary;
397
+ };
398
+ export type StudyRequest = {
399
+ "expected_revision": number;
400
+ "operation": StudyOperation;
401
+ };
402
+ export type StudySummary = {
403
+ "active_goal"?: [string, GoalRevision] | null;
404
+ "applied_state"?: string | null;
405
+ "experiment_count": number;
406
+ "id": string;
407
+ "inspected_state"?: string | null;
408
+ "recent_experiments": Array<ExperimentSummary>;
409
+ "recommended_state"?: string | null;
410
+ "revision": number;
411
+ "state_count": number;
412
+ "title": string;
413
+ "unavailable_historical_states": number;
414
+ };
415
+ export type TapKind = "Ratio" | "PhaseShift";
416
+ export type TrialRecord = {
417
+ "accepted": boolean;
418
+ "changes": Array<number>;
419
+ "evidence": Array<string>;
420
+ "exact_value"?: number | null;
421
+ "failure"?: string | null;
422
+ "predicted_value"?: number | null;
423
+ "state"?: string | null;
424
+ };
425
+ export type VoltageKind = "Magnitude" | "Angle" | "Squared" | "ProductReal" | "ProductImag";
426
+ //# sourceMappingURL=study-contracts.d.ts.map