@barivia/barmesh-mcp 0.5.4 → 0.6.1
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/blocking_monitor.js +34 -0
- package/dist/convergence_reading.js +25 -0
- package/dist/figure_sections.js +50 -0
- package/dist/index.js +1 -1
- package/dist/job_monitor.js +14 -3
- package/dist/results_metadata.js +78 -0
- package/dist/shared.js +1 -1
- package/dist/tools/barmesh_results_explorer.js +31 -53
- package/dist/tools/cfd.js +1 -0
- package/dist/tools/guide.js +1 -1
- package/dist/tools/jobs.js +4 -3
- package/dist/tools/results.js +3 -13
- package/dist/tools/training_monitor.js +75 -52
- package/dist/training_monitor_curve.js +60 -0
- package/dist/training_review.js +222 -0
- package/dist/views/src/views/barmesh-results-explorer/index.html +20 -19
- package/dist/views/src/views/barmesh-training-monitor/index.html +155 -0
- package/dist/viz-server.js +52 -1
- package/package.json +4 -3
package/dist/viz-server.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import http from "node:http";
|
|
8
8
|
const ID_REGEX = /^[a-zA-Z0-9_-]+$/;
|
|
9
9
|
const FILENAME_REGEX = /^[a-zA-Z0-9_.-]+$/;
|
|
10
|
-
const ALLOWED_VIEWS = new Set(["barmesh-results-explorer"]);
|
|
10
|
+
const ALLOWED_VIEWS = new Set(["barmesh-results-explorer", "barmesh-training-monitor"]);
|
|
11
11
|
const CORS_HEADERS = {
|
|
12
12
|
"Access-Control-Allow-Origin": "*",
|
|
13
13
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
@@ -111,6 +111,57 @@ export function startVizServer(apiCall, apiRawCall, loadViewHtml) {
|
|
|
111
111
|
}
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
+
const trainingLogMatch = pathname.match(/^\/api\/results\/([^/]+)\/training-log$/);
|
|
115
|
+
if (req.method === "GET" && trainingLogMatch) {
|
|
116
|
+
const jobId = trainingLogMatch[1];
|
|
117
|
+
if (!ID_REGEX.test(jobId)) {
|
|
118
|
+
sendJson(400, { error: "Invalid job_id" });
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
const data = await apiCall("GET", `/v1/results/${jobId}/training-log`);
|
|
123
|
+
sendJson(200, data);
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
const status = err?.httpStatus ?? 500;
|
|
127
|
+
sendJson(status, { error: err instanceof Error ? err.message : "Request failed" });
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const jobMatch = pathname.match(/^\/api\/jobs\/([^/]+)$/);
|
|
132
|
+
if (req.method === "GET" && jobMatch) {
|
|
133
|
+
const jobId = jobMatch[1];
|
|
134
|
+
if (!ID_REGEX.test(jobId)) {
|
|
135
|
+
sendJson(400, { error: "Invalid job_id" });
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
try {
|
|
139
|
+
const data = await apiCall("GET", `/v1/jobs/${jobId}`);
|
|
140
|
+
sendJson(200, data);
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
const status = err?.httpStatus ?? 500;
|
|
144
|
+
sendJson(status, { error: err instanceof Error ? err.message : "Request failed" });
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const cancelMatch = pathname.match(/^\/api\/jobs\/([^/]+)\/cancel$/);
|
|
149
|
+
if (req.method === "POST" && cancelMatch) {
|
|
150
|
+
const jobId = cancelMatch[1];
|
|
151
|
+
if (!ID_REGEX.test(jobId)) {
|
|
152
|
+
sendJson(400, { error: "Invalid job_id" });
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const data = await apiCall("POST", `/v1/jobs/${jobId}/cancel`, {});
|
|
157
|
+
sendJson(200, data);
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
const status = err?.httpStatus ?? 500;
|
|
161
|
+
sendJson(status, { error: err instanceof Error ? err.message : "Request failed" });
|
|
162
|
+
}
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
114
165
|
send(404, "Not found", "text/plain");
|
|
115
166
|
});
|
|
116
167
|
return new Promise((resolve, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barivia/barmesh-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"minify": "terser dist/index.js -o dist/index.js -c -m --toplevel",
|
|
38
38
|
"build": "tsc && npm run build:views && npm run minify",
|
|
39
39
|
"build:publish": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.publish.json && npm run build:views && npm run minify",
|
|
40
|
-
"build:views": "INPUT=src/views/barmesh-results-explorer/index.html vite build",
|
|
40
|
+
"build:views": "INPUT=src/views/barmesh-results-explorer/index.html vite build && INPUT=src/views/barmesh-training-monitor/index.html vite build",
|
|
41
41
|
"dev": "tsx src/index.ts",
|
|
42
42
|
"test": "vitest run --config vitest.config.ts",
|
|
43
43
|
"prepublishOnly": "npm run build:publish"
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@modelcontextprotocol/ext-apps": "^1.0.1",
|
|
47
47
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
48
|
-
"zod": "^3.23.0"
|
|
48
|
+
"zod": "^3.23.0",
|
|
49
|
+
"uplot": "^1.6.31"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@types/node": "^22.0.0",
|