@barivia/barsom-mcp 0.23.10 → 0.23.12
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 -4
- package/dist/audit.js +9 -3
- package/dist/figure_sections.js +63 -0
- package/dist/index.js +1 -1
- package/dist/job_monitor.js +20 -1
- package/dist/shared.js +51 -9
- package/dist/tools/account.js +1 -1
- package/dist/tools/explore_map.js +8 -5
- package/dist/tools/feedback.js +6 -1
- package/dist/tools/jobs.js +2 -2
- package/dist/tools/results.js +9 -1
- package/dist/tools/train.js +1 -1
- package/dist/tools/training_monitor.js +27 -15
- package/dist/ui-delivery.js +44 -10
- package/dist/views/src/views/results-explorer/index.html +10 -10
- package/dist/views/src/views/training-monitor/index.html +1 -1
- package/package.json +1 -1
package/dist/ui-delivery.js
CHANGED
|
@@ -6,11 +6,20 @@ import { apiRawCall, getClientSupportsMcpApps, getVizPort, mimeForFilename, rese
|
|
|
6
6
|
import { buildVizStandaloneUrl } from "./viz_links.js";
|
|
7
7
|
export function parseUiDeliveryOverride() {
|
|
8
8
|
const raw = (process.env.BARIVIA_UI_DELIVERY ?? "auto").trim().toLowerCase();
|
|
9
|
-
if (raw === "apps" ||
|
|
9
|
+
if (raw === "apps" ||
|
|
10
|
+
raw === "localhost" ||
|
|
11
|
+
raw === "inline" ||
|
|
12
|
+
raw === "text_only" ||
|
|
13
|
+
raw === "auto") {
|
|
10
14
|
return raw;
|
|
11
15
|
}
|
|
12
16
|
return "auto";
|
|
13
17
|
}
|
|
18
|
+
/** Opt-in: force localhost under auto even when the host advertises MCP Apps (e.g. Cursor list-without-mount). */
|
|
19
|
+
export function preferLocalhostUi() {
|
|
20
|
+
const v = (process.env.BARIVIA_UI_PREFER_LOCALHOST ?? "").trim().toLowerCase();
|
|
21
|
+
return v === "1" || v === "true" || v === "yes";
|
|
22
|
+
}
|
|
14
23
|
function vizPortPinned() {
|
|
15
24
|
return Boolean(process.env.BARIVIA_VIZ_PORT?.trim());
|
|
16
25
|
}
|
|
@@ -30,17 +39,26 @@ export function buildHealthUrl(jobId) {
|
|
|
30
39
|
}
|
|
31
40
|
function hintForTier(tier, tool, opts) {
|
|
32
41
|
const label = tool === "training_monitor" ? "training monitor" : "results explorer";
|
|
42
|
+
const linkFirst = opts.standaloneUrl
|
|
43
|
+
? `AGENT: Post a clickable markdown link first (e.g. "[Open ${label}](${opts.standaloneUrl})") — do not bury it after metrics.`
|
|
44
|
+
: undefined;
|
|
33
45
|
switch (tier) {
|
|
34
46
|
case "embedded":
|
|
35
|
-
return
|
|
47
|
+
return linkFirst
|
|
48
|
+
? `${linkFirst} Embedded MCP App panel if the host mounts it; some hosts list ui:// without mounting (use the URL).`
|
|
49
|
+
: `The ${label} MCP App panel may embed. Use jobs(status) / results(get) if no panel or URL appears.`;
|
|
36
50
|
case "localhost":
|
|
37
|
-
return
|
|
38
|
-
?
|
|
51
|
+
return linkFirst
|
|
52
|
+
? `${linkFirst} Re-post after the job completes if status was running. Set BARIVIA_VIZ_PORT for a stable port.`
|
|
39
53
|
: `AGENT: Viz server unavailable — use jobs(status) and results(get) for progress and figures.`;
|
|
40
54
|
case "inline_image":
|
|
41
|
-
return
|
|
55
|
+
return linkFirst
|
|
56
|
+
? `${linkFirst} Inline raster figure(s) may also be attached; summarize metrics; offer results_explorer or results(get) for more.`
|
|
57
|
+
: `AGENT: Inline raster figure(s) are attached below. Summarize metrics; offer results_explorer or results(get) for additional figures.`;
|
|
42
58
|
case "text_only":
|
|
43
|
-
return
|
|
59
|
+
return linkFirst
|
|
60
|
+
? `${linkFirst} Otherwise use jobs(status) for progress and results(get) for figures.`
|
|
61
|
+
: `AGENT: No embedded panel or localhost viz — use jobs(status) for training progress and results(get) or results_explorer for figures.`;
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
64
|
export function resolveUiDelivery(options) {
|
|
@@ -58,9 +76,15 @@ export function resolveUiDelivery(options) {
|
|
|
58
76
|
else if (override === "inline") {
|
|
59
77
|
delivery = options.inlineImageAttached ? "inline_image" : "text_only";
|
|
60
78
|
}
|
|
79
|
+
else if (override === "text_only") {
|
|
80
|
+
delivery = "text_only";
|
|
81
|
+
}
|
|
61
82
|
else {
|
|
62
|
-
// auto
|
|
63
|
-
if (
|
|
83
|
+
// auto — default unchanged: prefer embedded when Apps advertised unless opt-in prefer-localhost
|
|
84
|
+
if (preferLocalhostUi() && port) {
|
|
85
|
+
delivery = "localhost";
|
|
86
|
+
}
|
|
87
|
+
else if (mcpApps) {
|
|
64
88
|
delivery = "embedded";
|
|
65
89
|
}
|
|
66
90
|
else if (port) {
|
|
@@ -73,12 +97,13 @@ export function resolveUiDelivery(options) {
|
|
|
73
97
|
delivery = "text_only";
|
|
74
98
|
}
|
|
75
99
|
}
|
|
100
|
+
// Always include standalone URL when the viz port exists (all tiers) — hosts may not mount Apps.
|
|
76
101
|
const urls = [];
|
|
77
|
-
if (standaloneUrl
|
|
102
|
+
if (standaloneUrl) {
|
|
78
103
|
urls.push(standaloneUrl);
|
|
79
104
|
}
|
|
80
105
|
const healthUrl = buildHealthUrl(options.jobId);
|
|
81
|
-
if (healthUrl && delivery === "localhost") {
|
|
106
|
+
if (healthUrl && (delivery === "localhost" || preferLocalhostUi())) {
|
|
82
107
|
urls.push(healthUrl);
|
|
83
108
|
}
|
|
84
109
|
const crossLink = options.tool === "training_monitor" && options.jobStatus === "completed"
|
|
@@ -97,6 +122,7 @@ export function resolveUiDelivery(options) {
|
|
|
97
122
|
viz_port: port,
|
|
98
123
|
port_pinned: vizPortPinned(),
|
|
99
124
|
override,
|
|
125
|
+
...(options.uiResourceUri ? { ui_resource_uri: options.uiResourceUri } : {}),
|
|
100
126
|
};
|
|
101
127
|
}
|
|
102
128
|
/**
|
|
@@ -154,6 +180,7 @@ export function getMcpClientDiagnostics() {
|
|
|
154
180
|
const override = parseUiDeliveryOverride();
|
|
155
181
|
const mcpApps = getClientSupportsMcpApps();
|
|
156
182
|
const port = getVizPort() || null;
|
|
183
|
+
const preferLocal = preferLocalhostUi();
|
|
157
184
|
let activeTier = "text_only";
|
|
158
185
|
if (override === "apps") {
|
|
159
186
|
activeTier = mcpApps ? "embedded" : port ? "localhost" : "text_only";
|
|
@@ -164,6 +191,12 @@ export function getMcpClientDiagnostics() {
|
|
|
164
191
|
else if (override === "inline") {
|
|
165
192
|
activeTier = "inline_image";
|
|
166
193
|
}
|
|
194
|
+
else if (override === "text_only") {
|
|
195
|
+
activeTier = "text_only";
|
|
196
|
+
}
|
|
197
|
+
else if (preferLocal && port) {
|
|
198
|
+
activeTier = "localhost";
|
|
199
|
+
}
|
|
167
200
|
else if (mcpApps) {
|
|
168
201
|
activeTier = "embedded";
|
|
169
202
|
}
|
|
@@ -175,6 +208,7 @@ export function getMcpClientDiagnostics() {
|
|
|
175
208
|
viz_port: port,
|
|
176
209
|
viz_port_pinned: vizPortPinned(),
|
|
177
210
|
ui_delivery_override: override,
|
|
211
|
+
ui_prefer_localhost: preferLocal,
|
|
178
212
|
active_delivery_tier: activeTier,
|
|
179
213
|
health_url: buildHealthUrl(),
|
|
180
214
|
};
|