@cognipilot/rumoca-core 0.9.4 → 0.9.6
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.
- package/README.md +5 -5
- package/modelica_language.js +88 -0
- package/package.json +11 -1
- package/parse_worker.js +1 -2
- package/rumoca_bind_wasm.d.ts +96 -5
- package/rumoca_bind_wasm.js +480 -36
- package/rumoca_bind_wasm_bg.wasm +0 -0
- package/rumoca_diffsol.js +109 -0
- package/rumoca_gpu.js +139 -79
- package/rumoca_interactive.js +1433 -0
- package/rumoca_package_meta.json +1 -1
- package/rumoca_runtime.js +164 -0
- package/rumoca_worker.js +307 -87
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# npm Packaging
|
|
2
2
|
|
|
3
3
|
This directory is the canonical npm entrypoint for Rumoca WASM packaging.
|
|
4
|
-
The build copies this README into each generated `
|
|
4
|
+
The build copies this README into each generated `packages/rumoca/dist/<profile>-<variant>`
|
|
5
5
|
package so the published npm package links back to the packaging workflow.
|
|
6
6
|
|
|
7
7
|
## Common commands
|
|
@@ -16,7 +16,7 @@ npm run build:dev:full-web:rayon
|
|
|
16
16
|
|
|
17
17
|
## Notes
|
|
18
18
|
|
|
19
|
-
- Shared build logic is implemented in `
|
|
20
|
-
- Non-pack builds land in `
|
|
21
|
-
- Packed tarballs are moved to `
|
|
22
|
-
- Publishing uses the generated `
|
|
19
|
+
- Shared build logic is implemented in `packages/rumoca/build.mjs`.
|
|
20
|
+
- Non-pack builds land in `packages/rumoca/dist/<profile>-<variant>[-rayon]`.
|
|
21
|
+
- Packed tarballs are moved to `packages/rumoca/dist/`.
|
|
22
|
+
- Publishing uses the generated `packages/rumoca/dist/*` package metadata and artifacts.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Shared Modelica language definition for Monaco editors.
|
|
2
|
+
//
|
|
3
|
+
// Used by the full WASM playground (`monaco_setup.js`) and by the mini
|
|
4
|
+
// editors embedded in the mdBook guides (`docs/user-guide/live/rumoca-live.js`).
|
|
5
|
+
// Keep this the single source of truth for Modelica tokenization in Monaco.
|
|
6
|
+
|
|
7
|
+
export function registerModelicaLanguage(monaco) {
|
|
8
|
+
if (monaco.languages.getLanguages().some((lang) => lang.id === 'modelica')) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
monaco.languages.register({ id: 'modelica' });
|
|
12
|
+
monaco.languages.setLanguageConfiguration('modelica', {
|
|
13
|
+
comments: {
|
|
14
|
+
lineComment: '//',
|
|
15
|
+
blockComment: ['/*', '*/']
|
|
16
|
+
},
|
|
17
|
+
brackets: [
|
|
18
|
+
['{', '}'],
|
|
19
|
+
['[', ']'],
|
|
20
|
+
['(', ')']
|
|
21
|
+
],
|
|
22
|
+
autoClosingPairs: [
|
|
23
|
+
{ open: '{', close: '}' },
|
|
24
|
+
{ open: '[', close: ']' },
|
|
25
|
+
{ open: '(', close: ')' },
|
|
26
|
+
{ open: '"', close: '"', notIn: ['string', 'comment'] }
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
monaco.languages.setMonarchTokensProvider('modelica', {
|
|
30
|
+
keywords: [
|
|
31
|
+
'algorithm', 'and', 'annotation', 'assert', 'block', 'break',
|
|
32
|
+
'class', 'connect', 'connector', 'constant', 'constrainedby',
|
|
33
|
+
'der', 'discrete', 'each', 'else', 'elseif', 'elsewhen',
|
|
34
|
+
'encapsulated', 'end', 'enumeration', 'equation', 'expandable',
|
|
35
|
+
'extends', 'external', 'false', 'final', 'flow', 'for',
|
|
36
|
+
'function', 'if', 'import', 'impure', 'in', 'initial',
|
|
37
|
+
'inner', 'input', 'loop', 'model', 'not', 'operator',
|
|
38
|
+
'or', 'outer', 'output', 'package', 'parameter', 'partial',
|
|
39
|
+
'protected', 'public', 'pure', 'record', 'redeclare',
|
|
40
|
+
'replaceable', 'return', 'stream', 'then', 'true', 'type',
|
|
41
|
+
'when', 'while', 'within'
|
|
42
|
+
],
|
|
43
|
+
types: ['Real', 'Integer', 'Boolean', 'String'],
|
|
44
|
+
builtins: [
|
|
45
|
+
// Event/state functions
|
|
46
|
+
'der', 'pre', 'edge', 'change', 'initial', 'terminal', 'sample',
|
|
47
|
+
'smooth', 'delay', 'cardinality', 'homotopy', 'semiLinear',
|
|
48
|
+
'inStream', 'actualStream', 'getInstanceName', 'spatialDistribution',
|
|
49
|
+
'reinit', 'assert', 'terminate',
|
|
50
|
+
// Math functions
|
|
51
|
+
'abs', 'sign', 'sqrt', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2',
|
|
52
|
+
'sinh', 'cosh', 'tanh', 'exp', 'log', 'log10',
|
|
53
|
+
'floor', 'ceil', 'mod', 'rem', 'div', 'integer',
|
|
54
|
+
// Array functions
|
|
55
|
+
'size', 'ndims', 'scalar', 'vector', 'matrix', 'transpose',
|
|
56
|
+
'outerProduct', 'symmetric', 'cross', 'skew', 'identity', 'diagonal',
|
|
57
|
+
'zeros', 'ones', 'fill', 'linspace', 'min', 'max', 'sum', 'product', 'cat',
|
|
58
|
+
// Builtin variables/special names frequently used in expressions
|
|
59
|
+
'time', 'noEvent', 'Connections'
|
|
60
|
+
],
|
|
61
|
+
tokenizer: {
|
|
62
|
+
root: [
|
|
63
|
+
[/[a-zA-Z_]\w*/, {
|
|
64
|
+
cases: {
|
|
65
|
+
'@keywords': 'keyword',
|
|
66
|
+
'@types': 'type',
|
|
67
|
+
'@builtins': 'predefined',
|
|
68
|
+
'@default': 'identifier'
|
|
69
|
+
}
|
|
70
|
+
}],
|
|
71
|
+
[/[{}()\[\]]/, 'delimiter.bracket'],
|
|
72
|
+
[/[;,.]/, 'delimiter'],
|
|
73
|
+
// Comments must be matched before '/' operator tokens.
|
|
74
|
+
[/\/\/.*$/, 'comment'],
|
|
75
|
+
[/\/\*/, 'comment', '@comment'],
|
|
76
|
+
[/[<>=!]+/, 'operator'],
|
|
77
|
+
[/[+\-*\/^:]/, 'operator'],
|
|
78
|
+
[/\d+\.?\d*([eE][-+]?\d+)?/, 'number'],
|
|
79
|
+
[/"([^"\\]|\\.)*"/, 'string'],
|
|
80
|
+
],
|
|
81
|
+
comment: [
|
|
82
|
+
[/[^/*]+/, 'comment'],
|
|
83
|
+
[/\*\//, 'comment', '@pop'],
|
|
84
|
+
[/[/*]/, 'comment']
|
|
85
|
+
],
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@cognipilot/rumoca-core",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for Rumoca compile and optional simulation surfaces",
|
|
5
|
-
"version": "0.9.
|
|
5
|
+
"version": "0.9.6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -13,8 +13,12 @@
|
|
|
13
13
|
"rumoca_bind_wasm.js",
|
|
14
14
|
"rumoca_bind_wasm.d.ts",
|
|
15
15
|
"rumoca_gpu.js",
|
|
16
|
+
"rumoca_interactive.js",
|
|
17
|
+
"rumoca_diffsol.js",
|
|
16
18
|
"rumoca_worker.js",
|
|
17
19
|
"parse_worker.js",
|
|
20
|
+
"rumoca_runtime.js",
|
|
21
|
+
"modelica_language.js",
|
|
18
22
|
"rumoca_package_meta.json",
|
|
19
23
|
"README.md"
|
|
20
24
|
],
|
|
@@ -34,6 +38,12 @@
|
|
|
34
38
|
},
|
|
35
39
|
"./gpu": {
|
|
36
40
|
"import": "./rumoca_gpu.js"
|
|
41
|
+
},
|
|
42
|
+
"./interactive": {
|
|
43
|
+
"import": "./rumoca_interactive.js"
|
|
44
|
+
},
|
|
45
|
+
"./diffsol": {
|
|
46
|
+
"import": "./rumoca_diffsol.js"
|
|
37
47
|
}
|
|
38
48
|
}
|
|
39
49
|
}
|
package/parse_worker.js
CHANGED
|
@@ -39,8 +39,7 @@ self.onmessage = async (e) => {
|
|
|
39
39
|
const ast = parse_source_root_file(source, filename);
|
|
40
40
|
results.push([filename, ast]);
|
|
41
41
|
} catch (e) {
|
|
42
|
-
// Skip files that fail to parse
|
|
43
|
-
console.warn(`[ParseWorker] Failed to parse ${filename}:`, e.message);
|
|
42
|
+
// Skip files that fail to parse; live diagnostics surface user-facing errors.
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
// Report progress every 10 files
|
package/rumoca_bind_wasm.d.ts
CHANGED
|
@@ -28,8 +28,6 @@ export function compile_check_with_source_roots_with_options(source: string, mod
|
|
|
28
28
|
*/
|
|
29
29
|
export function compile_to_json(source: string, model_name: string): string;
|
|
30
30
|
|
|
31
|
-
export function compile_with_project_sources(source: string, model_name: string, project_sources_json: string): string;
|
|
32
|
-
|
|
33
31
|
export function compile_with_source_roots(source: string, model_name: string, source_roots_json: string): string;
|
|
34
32
|
|
|
35
33
|
/**
|
|
@@ -42,6 +40,8 @@ export function compile_with_source_roots(source: string, model_name: string, so
|
|
|
42
40
|
*/
|
|
43
41
|
export function compile_with_source_roots_with_options(source: string, model_name: string, source_roots_json: string, compile_options_json: string): string;
|
|
44
42
|
|
|
43
|
+
export function compile_with_workspace_sources(source: string, model_name: string, workspace_sources_json: string): string;
|
|
44
|
+
|
|
45
45
|
export function export_parsed_source_roots_binary(uris_json: string): Uint8Array;
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -155,15 +155,91 @@ export function parse(source: string): any;
|
|
|
155
155
|
|
|
156
156
|
export function parse_source_root_file(source: string, filename: string): string;
|
|
157
157
|
|
|
158
|
+
export function prime_source_root_completion_cache(): number;
|
|
159
|
+
|
|
158
160
|
export function render_target(dae_json: string, model_name: string, target: string, manifest_source: string, templates_json: string): any;
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Default colocated `rumoca-scenario.<model>.toml` (`{ ok, path, content }`)
|
|
164
|
+
* for a create-config action on a Modelica model.
|
|
165
|
+
*/
|
|
166
|
+
export function scenario_default_scenario_config(workspace_sources_json: string, model: string, task: string): string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Configured `[codegen]` target settings for a model (`{ target, outputDir }`).
|
|
170
|
+
*/
|
|
171
|
+
export function scenario_get_codegen_config(workspace_sources_json: string, model: string): string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Parse a single `rumoca-scenario.toml` scenario file (by workspace path) into the editor's
|
|
175
|
+
* scenario descriptor (`task`, `model`, `viewerMode`, interactive ports, ...).
|
|
176
|
+
*/
|
|
177
|
+
export function scenario_get_scenario_config(workspace_sources_json: string, path: string): string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Full `rumoca-scenario.toml` scenario as a JSON tree for the config GUI:
|
|
181
|
+
* `{ ok, config: <toml-as-json>, descriptor }`. The `config` tree round-trips
|
|
182
|
+
* every section (including nested interactive-IO) losslessly.
|
|
183
|
+
*/
|
|
184
|
+
export function scenario_get_scenario_config_full(workspace_sources_json: string, path: string): string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Effective + preset + default simulation settings for a model, given the
|
|
188
|
+
* workspace's `rumoca-scenario.toml` files and an optional editor `fallback` settings JSON.
|
|
189
|
+
*/
|
|
190
|
+
export function scenario_get_simulation_config(workspace_sources_json: string, model: string, fallback_json: string): string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Scenario-local source roots configured for a model (`{ sourceRootPaths }`).
|
|
194
|
+
*/
|
|
195
|
+
export function scenario_get_source_roots(workspace_sources_json: string, model: string, task: string): string;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Configured plot/visualization views for a model (`{ views: [...] }`).
|
|
199
|
+
*/
|
|
200
|
+
export function scenario_get_visualization_config(workspace_sources_json: string, model: string): string;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Clear a model's simulation preset. Returns `{ writes, result }`.
|
|
204
|
+
*/
|
|
205
|
+
export function scenario_reset_simulation_preset(workspace_sources_json: string, model: string): string;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Write a model's `[codegen]` target settings. Returns `{ writes, result }`.
|
|
209
|
+
*/
|
|
210
|
+
export function scenario_set_codegen_config(workspace_sources_json: string, model: string, codegen_json: string): string;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Render a `rumoca-scenario.toml` from the config GUI's JSON tree. Returns
|
|
214
|
+
* `{ writes: [{path, content}], result }` for the editor to apply.
|
|
215
|
+
*/
|
|
216
|
+
export function scenario_set_scenario_config(path: string, config_json: string): string;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Write a model's simulation preset into its colocated `rum.<model>.toml`.
|
|
220
|
+
* Returns `{ writes, result }` for the editor to apply to its workspace store.
|
|
221
|
+
*/
|
|
222
|
+
export function scenario_set_simulation_preset(workspace_sources_json: string, model: string, preset_json: string): string;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Write a model's scenario-local source roots. Returns `{ writes, result }`.
|
|
226
|
+
*/
|
|
227
|
+
export function scenario_set_source_roots(workspace_sources_json: string, model: string, source_roots_json: string): string;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Write a model's plot/visualization views. Returns `{ writes, result }`.
|
|
231
|
+
*/
|
|
232
|
+
export function scenario_set_visualization_config(workspace_sources_json: string, model: string, views_json: string): string;
|
|
233
|
+
|
|
234
|
+
export function sync_workspace_sources(workspace_sources_json: string): string;
|
|
161
235
|
|
|
162
236
|
/**
|
|
163
237
|
* Fallback thread-pool initializer for non-threaded builds.
|
|
164
238
|
*/
|
|
165
239
|
export function wasm_init(_num_threads: number): boolean;
|
|
166
240
|
|
|
241
|
+
export function workspace_effective_source_roots(workspace_sources_json: string, focus_path: string): string;
|
|
242
|
+
|
|
167
243
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
168
244
|
|
|
169
245
|
export interface InitOutput {
|
|
@@ -173,9 +249,9 @@ export interface InitOutput {
|
|
|
173
249
|
readonly compile_check_with_source_roots: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
174
250
|
readonly compile_check_with_source_roots_with_options: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
175
251
|
readonly compile_to_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
176
|
-
readonly compile_with_project_sources: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
177
252
|
readonly compile_with_source_roots: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
178
253
|
readonly compile_with_source_roots_with_options: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
254
|
+
readonly compile_with_workspace_sources: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
179
255
|
readonly export_parsed_source_roots_binary: (a: number, b: number) => [number, number, number, number];
|
|
180
256
|
readonly get_build_time_utc: () => [number, number];
|
|
181
257
|
readonly get_builtin_targets: () => any;
|
|
@@ -203,9 +279,24 @@ export interface InitOutput {
|
|
|
203
279
|
readonly merge_parsed_source_roots_binary: (a: number, b: number) => [number, number, number];
|
|
204
280
|
readonly parse: (a: number, b: number) => any;
|
|
205
281
|
readonly parse_source_root_file: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
282
|
+
readonly prime_source_root_completion_cache: () => [number, number, number];
|
|
206
283
|
readonly render_target: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number];
|
|
207
|
-
readonly
|
|
284
|
+
readonly scenario_default_scenario_config: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
285
|
+
readonly scenario_get_codegen_config: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
286
|
+
readonly scenario_get_scenario_config: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
287
|
+
readonly scenario_get_scenario_config_full: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
288
|
+
readonly scenario_get_simulation_config: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
289
|
+
readonly scenario_get_source_roots: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
290
|
+
readonly scenario_get_visualization_config: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
291
|
+
readonly scenario_reset_simulation_preset: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
292
|
+
readonly scenario_set_codegen_config: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
293
|
+
readonly scenario_set_scenario_config: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
294
|
+
readonly scenario_set_simulation_preset: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
295
|
+
readonly scenario_set_source_roots: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
296
|
+
readonly scenario_set_visualization_config: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
297
|
+
readonly sync_workspace_sources: (a: number, b: number) => [number, number, number, number];
|
|
208
298
|
readonly wasm_init: (a: number) => number;
|
|
299
|
+
readonly workspace_effective_source_roots: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
209
300
|
readonly init: () => void;
|
|
210
301
|
readonly clear_source_root_cache: () => void;
|
|
211
302
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|