@vulcan-energy/mcp-helper 0.3.1 → 0.3.3
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/dist/bin/vulcan-mcp-helper.js +34 -32
- package/dist/hem-target-runtime/browser-adapter.mjs +29 -1
- package/dist/hem-target-runtime/host.mjs +40 -29
- package/dist/hem-target-runtime/preparation.mjs +5728 -4625
- package/dist/hem-target-runtime/python-worker.mjs +373 -75
- package/dist/hem-target-runtime/release-manifests.mjs +49 -8
- package/dist/hem-target-runtime/rust-worker.mjs +523 -60
- package/dist/server.js +33 -31
- package/package.json +1 -1
- package/wasm/wasm_version.json +10 -10
- package/wasm/wasm_wrapper.js +27 -6
- package/wasm/wasm_wrapper_bg.wasm +0 -0
|
@@ -42,6 +42,28 @@ export async function readVerifiedBundle(manifestPath, expectedHash, { preparati
|
|
|
42
42
|
return { manifest, routes };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const NOT_AVAILABLE = 'Heating sizing is not available for this target: design-heat-loss.mjs runs Rust HEM:FHS targets only';
|
|
46
|
+
/** The target module, loaded from the verified bundle bytes, or why it cannot be used. */
|
|
47
|
+
export async function loadDesignHeatLossTarget(manifestPath, manifestSha256) {
|
|
48
|
+
let bundle;
|
|
49
|
+
try { bundle = await readVerifiedBundle(manifestPath, manifestSha256); }
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error.code === 'ENOENT') return { reason: `The HEM target is not downloaded: ${error.path} is missing. Run a model on it once in Vulcan, or stage it.` };
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
// From the manifest bytes whose hash was checked: a second read could see another file.
|
|
55
|
+
const { bundleId, runtime } = bundle.manifest;
|
|
56
|
+
if (!bundleId.startsWith('rust-fhs-') || !runtime?.javascript || !runtime.wasm) return { reason: `${NOT_AVAILABLE}. This manifest is ${bundleId}.` };
|
|
57
|
+
const bytes = path => bundle.routes.get(`/hem-targets/${bundleId}/${path}`);
|
|
58
|
+
// The glue's rayon worker helper listens on `self` when it loads; Node has none, and no workers,
|
|
59
|
+
// so the thread pool is never initialised and the target runs on this thread.
|
|
60
|
+
globalThis.self ??= new EventTarget();
|
|
61
|
+
// The verified bytes are what runs: no second read of the file.
|
|
62
|
+
const module = await import(`data:text/javascript;base64,${Buffer.from(bytes(runtime.javascript)).toString('base64')}`);
|
|
63
|
+
await module.default({ module_or_path: bytes(runtime.wasm) });
|
|
64
|
+
return { module, bundleId };
|
|
65
|
+
}
|
|
66
|
+
|
|
45
67
|
async function releaseTables() {
|
|
46
68
|
try { return await import('./release-manifests.mjs'); }
|
|
47
69
|
catch { throw new Error('HEM target release pins are missing. Build the target CLI assets with node scripts/hem-targets/build-cli-runtime.mjs, or install a helper release that includes them.'); }
|
|
@@ -205,7 +227,13 @@ export async function runTargetBrowser(options, dependencies = {}) {
|
|
|
205
227
|
const jobId = options.jobId ?? `target_${randomUUID()}`;
|
|
206
228
|
// Every record this run writes carries its start: status readers order runs by it, not by file times.
|
|
207
229
|
const startedAt = new Date().toISOString();
|
|
208
|
-
|
|
230
|
+
// A config name is the user's (the app saves "My house (free copy)"). The same rule as isWorkspaceName
|
|
231
|
+
// (hem-target-runtime/src/hem/workspaceName.ts); containment rests on `contained` below, not on this check.
|
|
232
|
+
const configName = options.configName;
|
|
233
|
+
const userName = configName === undefined || (typeof configName === 'string' && configName.trim() !== '' && !/[\\/<>:"|?*]/.test(configName)
|
|
234
|
+
&& ![...configName].some(character => character.charCodeAt(0) < 0x20)
|
|
235
|
+
&& !configName.startsWith('.') && !/[. ]$/.test(configName));
|
|
236
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(jobId) || !userName) throw new Error('Invalid target job/config name');
|
|
209
237
|
const contained = path => {
|
|
210
238
|
if (typeof path !== 'string' || path.includes('\\')) throw new Error('Invalid workspace path');
|
|
211
239
|
const file = resolve(workspace, path);
|
|
@@ -67,9 +67,9 @@ var HEM_TARGETS = [
|
|
|
67
67
|
// The Rust a9 that ECaaS runs in production (epb-ecaas-api e1c090e, lambda/Cargo.lock). Its wrapper
|
|
68
68
|
// schema equals the Python a9 one, so it keeps that conversion profile's wire name. It is built
|
|
69
69
|
// with the carried patch set fhs-a9-schema-v1 (targetSchemaCorrections.ts); build and parity:
|
|
70
|
-
// docs/development/HEM_Rust_A9_Target.md.
|
|
70
|
+
// docs/development/HEM_Rust_A9_Target.md. v2: v1's pins and patch set plus the design_heat_loss export.
|
|
71
71
|
{
|
|
72
|
-
id: "rust-fhs-a9-9e41af89-f2c2425f-
|
|
72
|
+
id: "rust-fhs-a9-9e41af89-f2c2425f-v2",
|
|
73
73
|
label: "HEM:FHS 1.0.0a9",
|
|
74
74
|
runtime: "rust",
|
|
75
75
|
version: "1.0.0a9",
|
|
@@ -79,8 +79,11 @@ var HEM_TARGETS = [
|
|
|
79
79
|
engineCommit: "9e41af890cc62a1cec08957340231c3591956dac",
|
|
80
80
|
wrapperCommit: "f2c2425f00870e1611750bd2ac1be20132301e0d",
|
|
81
81
|
conversionProfile: "python_fhs_a9",
|
|
82
|
-
|
|
83
|
-
//
|
|
82
|
+
arealHeatCapacity: { classes: "full_depth", numberTypes: ["BuildingElementAdjacentConditionedSpace", "BuildingElementAdjacentUnconditionedSpace_Simple"] },
|
|
83
|
+
// Measured, example_semi_detached at load 15-21 (15 November): Quick sim click to headline in
|
|
84
|
+
// the app 7.1-8.6 s (engine 4.9 s, results write 0.7 s); wasm-browser-cli 5.2-7.1 s.
|
|
85
|
+
// Compliance, all four modes: 48.3-48.6 s in wasm-browser-cli at load 13-19 (13 November).
|
|
86
|
+
// Method: docs/development/HEM_Rust_A9_Target.md, "Run time".
|
|
84
87
|
status: "provisional",
|
|
85
88
|
typicalRunMinutes: { fhs_assumptions: 0.15, fhs_compliance: 0.8 }
|
|
86
89
|
},
|
|
@@ -95,37 +98,45 @@ var HEM_TARGETS = [
|
|
|
95
98
|
engineCommit: "62d3df705690f33b3fc3e905c9971d4f3743bf2e",
|
|
96
99
|
wrapperCommit: "c5ba2673fbd886cfe4fb528f61b376bdf406ebbd",
|
|
97
100
|
conversionProfile: "current_rust_fhs",
|
|
98
|
-
|
|
101
|
+
arealHeatCapacity: { classes: "surface", numberTypes: [] },
|
|
102
|
+
// Actual mode, example_semi_detached at load 17-22 (15 November): Quick sim click to headline in
|
|
103
|
+
// the app 7.9-8.7 s; wasm-browser-cli 6.1-7.1 s. Compliance not measured.
|
|
99
104
|
status: "legacy",
|
|
100
105
|
typicalRunMinutes: { fhs_assumptions: 0.12 }
|
|
101
106
|
}
|
|
102
107
|
];
|
|
103
108
|
var RECOMMENDED_HEM_TARGET = HEM_TARGETS[0].id;
|
|
109
|
+
var HEM_EPC_0_13_2 = {
|
|
110
|
+
id: "python-epc-0.13.2-6367f1ec-18032feb-v1",
|
|
111
|
+
label: "HEM:EPC 0.13.2",
|
|
112
|
+
runtime: "python",
|
|
113
|
+
version: "0.13.2",
|
|
114
|
+
engineVersion: "2.0.0a4",
|
|
115
|
+
wrapperVersion: "0.13.2",
|
|
116
|
+
wrapper: "epc",
|
|
117
|
+
engineCommit: "6367f1ecb101c7f72a2006a921c732c790b0d338",
|
|
118
|
+
wrapperCommit: "18032feb59294b323fc28af4fb032d34bd44bf67",
|
|
119
|
+
conversionProfile: "epc_full_input_v1",
|
|
120
|
+
arealHeatCapacity: { classes: "full_depth", numberTypes: "all" },
|
|
121
|
+
components: {
|
|
122
|
+
"hem-epc-orchestrator": { version: "0.13.2a0", commit: "993463233ad0c416e83c4de3b84889280d3c4619" },
|
|
123
|
+
hemie: { version: "0.18.1", commit: "2876e2ec1c7bad2b738c9c3b3685d86860a91f41" },
|
|
124
|
+
"hem-db-client": { version: "1.0.0a10", commit: "9eeb026dd52a612197b5552ca113d8121fa72679" }
|
|
125
|
+
},
|
|
126
|
+
// db-client/data/*.csv at the hem-db-client commit.
|
|
127
|
+
productDataSha256: "d0acf4ebf050e80f3dc576ffbb1295ebeb1176e9fd4a9ec1d151a9e8f4df7457",
|
|
128
|
+
// Quick, measured in wasm-browser-cli at load 9-20 (15 November, UAT bundle on main): house_two_storey
|
|
129
|
+
// new build 473 s, as an existing building 365 s (HEM_EPC_Integration_Plan.md, Status).
|
|
130
|
+
// Full, estimated: 35 min natively at the measured 2.4-2.6x browser ratio (same plan, Measured).
|
|
131
|
+
status: "preview",
|
|
132
|
+
typicalRunMinutes: { epc_quick: 8, epc_full: 90 },
|
|
133
|
+
estimatedRunMinutes: ["epc_full"]
|
|
134
|
+
};
|
|
104
135
|
var UNRELEASED_HEM_TARGETS = [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
version: "0.13.2",
|
|
110
|
-
engineVersion: "2.0.0a4",
|
|
111
|
-
wrapperVersion: "0.13.2",
|
|
112
|
-
wrapper: "epc",
|
|
113
|
-
engineCommit: "6367f1ecb101c7f72a2006a921c732c790b0d338",
|
|
114
|
-
wrapperCommit: "18032feb59294b323fc28af4fb032d34bd44bf67",
|
|
115
|
-
conversionProfile: "epc_full_input_v1",
|
|
116
|
-
components: {
|
|
117
|
-
"hem-epc-orchestrator": { version: "0.13.2a0", commit: "993463233ad0c416e83c4de3b84889280d3c4619" },
|
|
118
|
-
hemie: { version: "0.18.1", commit: "2876e2ec1c7bad2b738c9c3b3685d86860a91f41" },
|
|
119
|
-
"hem-db-client": { version: "1.0.0a10", commit: "9eeb026dd52a612197b5552ca113d8121fa72679" }
|
|
120
|
-
},
|
|
121
|
-
// db-client/data/*.csv at the hem-db-client commit.
|
|
122
|
-
productDataSha256: "d0acf4ebf050e80f3dc576ffbb1295ebeb1176e9fd4a9ec1d151a9e8f4df7457",
|
|
123
|
-
// Quick, measured: house_two_storey 491-535 s in wasm-browser-cli (HEM_EPC_Integration_Plan.md, Status).
|
|
124
|
-
// Full, estimated: 35 min natively at the measured 2.4-2.6x browser ratio (same plan, Measured).
|
|
125
|
-
status: "provisional",
|
|
126
|
-
typicalRunMinutes: { epc_quick: 9, epc_full: 90 },
|
|
127
|
-
estimatedRunMinutes: ["epc_full"]
|
|
128
|
-
}
|
|
136
|
+
HEM_EPC_0_13_2,
|
|
137
|
+
// The same pins with the HEM Core engine patch set (scripts/hem-targets/stage-python-core.mjs):
|
|
138
|
+
// byte-identical outputs, faster passive-duct runs. A short-term fix; not the default until the owner's UAT.
|
|
139
|
+
{ ...HEM_EPC_0_13_2, id: "python-epc-0.13.2-6367f1ec-18032feb-v2", label: "HEM:EPC 0.13.2 (faster)" }
|
|
129
140
|
];
|
|
130
141
|
var findHemTarget = (id) => [...HEM_TARGETS, ...UNRELEASED_HEM_TARGETS].find((target) => target.id === id);
|
|
131
142
|
function resolveHemTarget(id) {
|