@barivia/barsom-mcp 0.23.2 → 0.23.4

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/audit.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * MCP tool audit wrapper — tool name, action, latency, outcome; no secrets.
3
3
  */
4
4
  import { logAudit } from "./logger.js";
5
- import { runWithTrace } from "./shared.js";
5
+ import { currentTraceId, runWithTrace } from "./shared.js";
6
6
  /** Keys safe to include in audit param summaries (no paths, keys, or bodies). */
7
7
  const AUDIT_PARAM_KEYS = new Set([
8
8
  "action",
@@ -137,6 +137,7 @@ export async function runMcpToolAudit(tool, action, args, handler) {
137
137
  action,
138
138
  duration_ms: Date.now() - t0,
139
139
  outcome: "ok",
140
+ trace_id: currentTraceId(),
140
141
  ...ids,
141
142
  ...(extras.timeout_hit ? { timeout_hit: true } : {}),
142
143
  ...(extras.output_truncated ? { output_truncated: true } : {}),
@@ -151,6 +152,7 @@ export async function runMcpToolAudit(tool, action, args, handler) {
151
152
  duration_ms: Date.now() - t0,
152
153
  outcome: "error",
153
154
  error_code: errorCodeFrom(err),
155
+ trace_id: currentTraceId(),
154
156
  ...(Object.keys(params).length > 0 ? { params } : {}),
155
157
  });
156
158
  throw err;
package/dist/logger.js CHANGED
@@ -35,6 +35,7 @@ export function logWarn(msg, fields = {}) {
35
35
  export function logError(msg, fields = {}) {
36
36
  emit({ ...fields, level: "error", msg });
37
37
  }
38
+ /** Audit line: stable event name is `msg=mcp_tool_call` (OBSERVABILITY taxonomy). */
38
39
  export function logAudit(fields) {
39
- emit({ ...fields, event: "mcp_tool_call", level: "info", msg: "mcp_tool_call" });
40
+ emit({ ...fields, level: "info", msg: "mcp_tool_call" });
40
41
  }
package/dist/shared.js CHANGED
@@ -39,7 +39,7 @@ function newRequestId() {
39
39
  * X-Barsom-Client-Version so the server can annotate tool guidance with the
40
40
  * wrapper version each action requires. Keep in sync with package.json on bump.
41
41
  */
42
- export const CLIENT_VERSION = "0.23.2";
42
+ export const CLIENT_VERSION = "0.23.4";
43
43
  /** User-facing links; keep aligned with barivia.se / api.barivia.se. */
44
44
  export const PUBLIC_SITE_ORIGIN = "https://barivia.se";
45
45
  /** Self-serve account dashboard (manage plan, billing, and API keys). */
@@ -630,9 +630,13 @@ function _newSpanId() {
630
630
  export function runWithTrace(fn) {
631
631
  return _traceStore.run(_newTraceId(), fn);
632
632
  }
633
- function _currentTraceId() {
633
+ /** Current ALS trace id, or a fresh id if called outside `runWithTrace`. */
634
+ export function currentTraceId() {
634
635
  return _traceStore.getStore() ?? _newTraceId();
635
636
  }
637
+ function _currentTraceId() {
638
+ return currentTraceId();
639
+ }
636
640
  function _traceparentHeader() {
637
641
  return `00-${_currentTraceId()}-${_newSpanId()}-01`;
638
642
  }
@@ -19,6 +19,26 @@ export function isKernelTrainingComplete(data, status) {
19
19
  export function teCurveLabel(base) {
20
20
  return `${base} (panel)`;
21
21
  }
22
+ /**
23
+ * Detect FLooP jobs for chart axis/labels.
24
+ * Do NOT infer from "ordering-only curves" — mesh_convergence / train_som often use
25
+ * epochs=[N,0], so convergence_errors is empty while ordering has many batch points.
26
+ */
27
+ export function isFloopJob(data) {
28
+ const phase = String(data.training_progress_phase ?? data.progress_phase ?? "").toLowerCase();
29
+ if (phase === "floop")
30
+ return true;
31
+ const jt = String(data.job_type ?? "").toLowerCase();
32
+ if (jt.includes("floop"))
33
+ return true;
34
+ const rc = data.run_config;
35
+ if (rc && typeof rc === "object") {
36
+ const model = String(rc.model ?? "").toLowerCase();
37
+ if (model.includes("floop"))
38
+ return true;
39
+ }
40
+ return false;
41
+ }
22
42
  export function formatCurveSourceNote(data) {
23
43
  const src = data.training_curve_source_batches;
24
44
  const parts = [];