@vulcan-energy/mcp-helper 0.2.4 → 0.2.5

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.
@@ -673,7 +673,9 @@ function resolveHemTarget(id) {
673
673
  return target;
674
674
  }
675
675
  function modelArtifacts(manifest2) {
676
- return manifest2.artifacts.filter((artifact) => !artifact.path.startsWith("source/") && !artifact.path.startsWith("notices/"));
676
+ const runtime2 = [manifest2.runtime.javascript, manifest2.runtime.wasm];
677
+ const converter = [manifest2.preparation.javascript, manifest2.preparation.wasm].filter((path) => !runtime2.includes(path));
678
+ return manifest2.artifacts.filter((artifact) => !artifact.path.startsWith("source/") && !artifact.path.startsWith("notices/") && !converter.includes(artifact.path));
677
679
  }
678
680
  function validateTargetManifest(manifest2, target) {
679
681
  if (manifest2.bundleId !== target.id || manifest2.protocol !== 1 || manifest2.engineCommit !== target.engineCommit || manifest2.wrapperCommit !== target.wrapperCommit || manifest2.conversionProfile !== target.conversionProfile) {
@@ -691,7 +693,7 @@ function validateTargetManifest(manifest2, target) {
691
693
  sizesByHash.set(artifact.sha256, artifact.bytes);
692
694
  paths.add(artifact.path);
693
695
  }
694
- for (const path of [...Object.values(manifest2.preparation), manifest2.runtime.javascript, ...manifest2.runtime.wasm ? [manifest2.runtime.wasm] : [], ...manifest2.runtime.wheels ?? []]) {
696
+ for (const path of [manifest2.preparation.schema, manifest2.preparation.defaults, manifest2.runtime.javascript, ...manifest2.runtime.wasm ? [manifest2.runtime.wasm] : [], ...manifest2.runtime.wheels ?? []]) {
695
697
  if (path.startsWith("source/") || path.startsWith("notices/")) throw new Error(`Runtime/preparation cannot reference reserved source/notice material: ${path}`);
696
698
  if (!paths.has(path)) throw new Error(`Target manifest is missing required artifact ${path}`);
697
699
  }
@@ -1020,7 +1022,7 @@ async function executePreparedJobs(manifest2, bundleId, jobId, jobs, execute, wr
1020
1022
  const archive = job.archiveDirectory ?? job.outputDirectory;
1021
1023
  const inputSha256 = await sha256(new TextEncoder().encode(job.input));
1022
1024
  if (job.weather && (!job.weather.epw.trim() || await sha256(new TextEncoder().encode(job.weather.epw)) !== job.weather.sha256)) throw new Error("Prepared weather hash mismatch or empty EPW");
1023
- const provenance = { ...job.weather ? { weather: { path: job.weather.path, sha256: job.weather.sha256 } } : {}, ...job.heatingProfile ? { calculationKind: "operating-sensitivity", heatingProfile: job.heatingProfile } : {}, target: manifest2, inputSha256, modes: job.modes, jobId, ...job.startedAt ? { startedAt: job.startedAt } : {}, name: job.name, ...job.warnings?.length ? { warnings: job.warnings } : {} };
1025
+ const provenance = { ...job.weather ? { weather: { path: job.weather.path, sha256: job.weather.sha256 } } : {}, ...job.heatingProfile ? { calculationKind: "operating-sensitivity", heatingProfile: job.heatingProfile } : {}, target: manifest2, inputSha256, ...job.preparedBy ? { preparedBy: job.preparedBy } : {}, modes: job.modes, jobId, ...job.startedAt ? { startedAt: job.startedAt } : {}, name: job.name, ...job.warnings?.length ? { warnings: job.warnings } : {} };
1024
1026
  try {
1025
1027
  await write2(`${archive}/target-run.json`, JSON.stringify({ ...provenance, status: "running" }));
1026
1028
  if (archive !== job.outputDirectory) await write2(`${job.outputDirectory}/target-run.json`, JSON.stringify({ ...provenance, status: "running", archive }));
@@ -242,7 +242,9 @@ function resolveHemTarget(id) {
242
242
  return target;
243
243
  }
244
244
  function modelArtifacts(manifest2) {
245
- return manifest2.artifacts.filter((artifact) => !artifact.path.startsWith("source/") && !artifact.path.startsWith("notices/"));
245
+ const runtime = [manifest2.runtime.javascript, manifest2.runtime.wasm];
246
+ const converter = [manifest2.preparation.javascript, manifest2.preparation.wasm].filter((path) => !runtime.includes(path));
247
+ return manifest2.artifacts.filter((artifact) => !artifact.path.startsWith("source/") && !artifact.path.startsWith("notices/") && !converter.includes(artifact.path));
246
248
  }
247
249
  function validateTargetManifest(manifest2, target) {
248
250
  if (manifest2.bundleId !== target.id || manifest2.protocol !== 1 || manifest2.engineCommit !== target.engineCommit || manifest2.wrapperCommit !== target.wrapperCommit || manifest2.conversionProfile !== target.conversionProfile) {
@@ -260,7 +262,7 @@ function validateTargetManifest(manifest2, target) {
260
262
  sizesByHash.set(artifact.sha256, artifact.bytes);
261
263
  paths.add(artifact.path);
262
264
  }
263
- for (const path of [...Object.values(manifest2.preparation), manifest2.runtime.javascript, ...manifest2.runtime.wasm ? [manifest2.runtime.wasm] : [], ...manifest2.runtime.wheels ?? []]) {
265
+ for (const path of [manifest2.preparation.schema, manifest2.preparation.defaults, manifest2.runtime.javascript, ...manifest2.runtime.wasm ? [manifest2.runtime.wasm] : [], ...manifest2.runtime.wheels ?? []]) {
264
266
  if (path.startsWith("source/") || path.startsWith("notices/")) throw new Error(`Runtime/preparation cannot reference reserved source/notice material: ${path}`);
265
267
  if (!paths.has(path)) throw new Error(`Target manifest is missing required artifact ${path}`);
266
268
  }
@@ -436,7 +438,7 @@ async function executePreparedJobs(manifest2, bundleId, jobId, jobs, execute, wr
436
438
  const archive = job.archiveDirectory ?? job.outputDirectory;
437
439
  const inputSha256 = await sha256(new TextEncoder().encode(job.input));
438
440
  if (job.weather && (!job.weather.epw.trim() || await sha256(new TextEncoder().encode(job.weather.epw)) !== job.weather.sha256)) throw new Error("Prepared weather hash mismatch or empty EPW");
439
- const provenance = { ...job.weather ? { weather: { path: job.weather.path, sha256: job.weather.sha256 } } : {}, ...job.heatingProfile ? { calculationKind: "operating-sensitivity", heatingProfile: job.heatingProfile } : {}, target: manifest2, inputSha256, modes: job.modes, jobId, ...job.startedAt ? { startedAt: job.startedAt } : {}, name: job.name, ...job.warnings?.length ? { warnings: job.warnings } : {} };
441
+ const provenance = { ...job.weather ? { weather: { path: job.weather.path, sha256: job.weather.sha256 } } : {}, ...job.heatingProfile ? { calculationKind: "operating-sensitivity", heatingProfile: job.heatingProfile } : {}, target: manifest2, inputSha256, ...job.preparedBy ? { preparedBy: job.preparedBy } : {}, modes: job.modes, jobId, ...job.startedAt ? { startedAt: job.startedAt } : {}, name: job.name, ...job.warnings?.length ? { warnings: job.warnings } : {} };
440
442
  try {
441
443
  await write2(`${archive}/target-run.json`, JSON.stringify({ ...provenance, status: "running" }));
442
444
  if (archive !== job.outputDirectory) await write2(`${job.outputDirectory}/target-run.json`, JSON.stringify({ ...provenance, status: "running", archive }));