@barivia/barsom-mcp 0.23.3 → 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 +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
|
/** 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,
|
|
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.
|
|
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
|
-
|
|
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
|
}
|