@barivia/barmesh-mcp 0.8.2 → 0.8.3
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 +3 -1
- package/dist/logger.js +2 -1
- package/dist/shared.js +6 -2
- package/package.json +1 -1
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
|
const AUDIT_PARAM_KEYS = new Set([
|
|
7
7
|
"action",
|
|
8
8
|
"preset",
|
|
@@ -69,6 +69,7 @@ export async function runMcpToolAudit(tool, action, args, handler) {
|
|
|
69
69
|
action,
|
|
70
70
|
duration_ms: Date.now() - t0,
|
|
71
71
|
outcome: "ok",
|
|
72
|
+
trace_id: currentTraceId(),
|
|
72
73
|
...ids,
|
|
73
74
|
...(Object.keys(params).length > 0 ? { params } : {}),
|
|
74
75
|
});
|
|
@@ -81,6 +82,7 @@ export async function runMcpToolAudit(tool, action, args, handler) {
|
|
|
81
82
|
duration_ms: Date.now() - t0,
|
|
82
83
|
outcome: "error",
|
|
83
84
|
error_code: errorCodeFrom(err),
|
|
85
|
+
trace_id: currentTraceId(),
|
|
84
86
|
...(Object.keys(params).length > 0 ? { params } : {}),
|
|
85
87
|
});
|
|
86
88
|
throw err;
|
package/dist/logger.js
CHANGED
|
@@ -32,6 +32,7 @@ export function logInfo(msg, fields = {}) {
|
|
|
32
32
|
export function logWarn(msg, fields = {}) {
|
|
33
33
|
emit({ ...fields, level: "warn", msg });
|
|
34
34
|
}
|
|
35
|
+
/** Audit line: stable event name is `msg=mcp_tool_call` (OBSERVABILITY taxonomy). */
|
|
35
36
|
export function logAudit(fields) {
|
|
36
|
-
emit({ ...fields,
|
|
37
|
+
emit({ ...fields, level: "info", msg: "mcp_tool_call" });
|
|
37
38
|
}
|
package/dist/shared.js
CHANGED
|
@@ -35,7 +35,7 @@ function newRequestId() {
|
|
|
35
35
|
return randomUUID();
|
|
36
36
|
}
|
|
37
37
|
/** Single source of truth for the proxy version. Keep in sync with package.json on bump. */
|
|
38
|
-
export const CLIENT_VERSION = "0.8.
|
|
38
|
+
export const CLIENT_VERSION = "0.8.3";
|
|
39
39
|
export const PUBLIC_SITE_ORIGIN = "https://barivia.se";
|
|
40
40
|
/** Large per-cell CSV uploads may exceed the default fetch timeout. */
|
|
41
41
|
export const UPLOAD_DATASET_TIMEOUT_MS = 180_000;
|
|
@@ -532,8 +532,12 @@ function _newSpanId() {
|
|
|
532
532
|
export function runWithTrace(fn) {
|
|
533
533
|
return _traceStore.run(_newTraceId(), fn);
|
|
534
534
|
}
|
|
535
|
+
/** Current ALS trace id, or a fresh id if called outside `runWithTrace`. */
|
|
536
|
+
export function currentTraceId() {
|
|
537
|
+
return _traceStore.getStore() ?? _newTraceId();
|
|
538
|
+
}
|
|
535
539
|
function _traceparentHeader() {
|
|
536
|
-
return `00-${
|
|
540
|
+
return `00-${currentTraceId()}-${_newSpanId()}-01`;
|
|
537
541
|
}
|
|
538
542
|
export async function apiCall(method, pathPart, body, extraHeaders, requestTimeoutMs) {
|
|
539
543
|
const url = `${API_URL}${pathPart}`;
|