@barivia/barmesh-mcp 0.3.1 → 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.
package/README.md CHANGED
@@ -13,10 +13,14 @@ form on a shared self-organizing map (SOM)**:
13
13
  - **`barmesh_mesh_convergence`** — trains one SOM on all meshes (joint-normalized), projects
14
14
  each mesh to a volume-weighted fingerprint, and computes **symmetric KL** and
15
15
  **Wasserstein-1 (EMD)** distances stepwise and against a reference mesh, with publication
16
- figures and an advisory convergence reading. Submit enqueues **`cfd_prepare`** on worker-io
17
- when needed; the proxy auto-polls `prepare_job_id` before the mesh job runs. Default
18
- **`defer_figures=true`** **`cfd_finalize`** on worker-io; **`barmesh_jobs(status)`** auto-polls
19
- **`finalize_job_id`** when figures are deferred.
16
+ figures and an advisory convergence reading. The SOM features are preprocessed by the
17
+ same staged pipeline as barsom training, so any dataset (small or large, CSV/gzip/Parquet)
18
+ is handled out-of-core by default; optional `transforms`, `normalize`,
19
+ `normalization_methods`, and `row_range` give the same preprocessing controls. Submit
20
+ enqueues **`prepare_training_matrix`** on worker-io when the dataset is staged; the proxy
21
+ auto-polls `prepare_job_id` before the mesh job runs. Default **`defer_figures=true`** →
22
+ **`cfd_finalize`** on worker-io; **`barmesh_jobs(status)`** auto-polls **`finalize_job_id`**
23
+ when figures are deferred.
20
24
  - **`barmesh_richardson`** — classical three-level Richardson extrapolation / Grid
21
25
  Convergence Index (GCI) on scalar quantities of interest.
22
26
 
@@ -1,6 +1,8 @@
1
1
  import { pollUntilComplete } from "./shared.js";
2
2
  /**
3
- * When the API enqueues cfd_prepare for mesh-convergence, poll it before the mesh job runs.
3
+ * Mesh-convergence on a staged dataset enqueues a preprocessing job
4
+ * (prepare_training_matrix) first; the submit response carries its id as
5
+ * `prepare_job_id`. Poll it to completion before the mesh job runs.
4
6
  */
5
7
  export async function pollCfdPrepareIfPresent(data, label, timeoutMs = 600_000) {
6
8
  const prepareJobId = data.prepare_job_id;
@@ -8,10 +10,10 @@ export async function pollCfdPrepareIfPresent(data, label, timeoutMs = 600_000)
8
10
  return null;
9
11
  const poll = await pollUntilComplete(prepareJobId, timeoutMs);
10
12
  if (poll.status === "failed") {
11
- throw new Error(`${label}: cfd_prepare job ${prepareJobId} failed: ${poll.error ?? "unknown error"}`);
13
+ throw new Error(`${label}: data preparation job ${prepareJobId} failed: ${poll.error ?? "unknown error"}`);
12
14
  }
13
15
  if (poll.status !== "completed") {
14
- throw new Error(`${label}: cfd_prepare job ${prepareJobId} did not complete (status=${poll.status})`);
16
+ throw new Error(`${label}: data preparation job ${prepareJobId} did not complete (status=${poll.status})`);
15
17
  }
16
18
  return prepareJobId;
17
19
  }
package/dist/shared.js CHANGED
@@ -20,7 +20,7 @@ export const FETCH_TIMEOUT_MS = parseInt(process.env.BARIVIA_FETCH_TIMEOUT_MS ??
20
20
  export const MAX_RETRIES = 2;
21
21
  export const RETRYABLE_STATUS = new Set([502, 503, 504]);
22
22
  /** Single source of truth for the proxy version. Keep in sync with package.json on bump. */
23
- export const CLIENT_VERSION = "0.3.1";
23
+ export const CLIENT_VERSION = "0.4.0";
24
24
  export const PUBLIC_SITE_ORIGIN = "https://barivia.se";
25
25
  /** Large per-cell CSV uploads may exceed the default fetch timeout. */
26
26
  export const UPLOAD_DATASET_TIMEOUT_MS = 180_000;
package/dist/tools/cfd.js CHANGED
@@ -27,6 +27,10 @@ COMMON MISTAKES: omitting feature_columns (required); choosing a reference_mesh
27
27
  emd_method: z.enum(["exact", "sinkhorn"]).optional().describe("EMD solver: exact LP (default) or sinkhorn (fast approximation for large grids)"),
28
28
  component_planes_physical: z.boolean().optional().describe("Physical-scale component-plane colorbars (default true)"),
29
29
  figures: z.boolean().optional().describe("Generate publication figures (default true)"),
30
+ transforms: z.record(z.enum(["log", "log1p", "log10", "sqrt", "square", "abs", "invert", "none"])).optional().describe("Per-feature transform applied before normalization (e.g. log1p to compress k/epsilon/omega). Same preprocessing engine as barsom training."),
31
+ normalize: z.union([z.enum(["all", "auto", "mad", "sigmoidal", "sepd"]), z.array(z.string())]).optional().describe("Normalization mode for SOM features (default auto = joint z-score of non-cyclic features). Use mad for heavy-tailed channels."),
32
+ normalization_methods: z.record(z.enum(["zscore", "mad", "sigmoidal", "sepd", "none"])).optional().describe("Per-feature normalization override; keys must be in feature_columns."),
33
+ row_range: z.tuple([z.number().int().min(1), z.number().int().min(1)]).optional().describe("1-based inclusive [start, end] row slice applied during preprocessing (and to mesh labels / cell volumes)."),
30
34
  label: z.string().optional().describe("Optional job label"),
31
35
  }, async (args) => {
32
36
  const { dataset_id, label, ...rest } = args;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barivia/barmesh-mcp",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "barmesh MCP proxy — SOM-based CFD mesh-convergence and Richardson/GCI analysis on the Barivia cloud API",
5
5
  "keywords": [
6
6
  "mcp",