@brizz/sdk 0.1.43 → 0.1.44
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 +44 -0
- package/dist/{chunk-QUV5HYJ2.cjs → chunk-3IGBYXLR.cjs} +4 -4
- package/dist/{chunk-FORVS4QW.cjs → chunk-5WBPX342.cjs} +7 -1
- package/dist/{chunk-WTQTF57J.cjs → chunk-A3HH5OUL.cjs} +8 -8
- package/dist/{chunk-5SWAZUC5.js → chunk-AELIATPI.js} +2 -2
- package/dist/{chunk-Y7NMZAQT.js → chunk-AOT5NJDV.js} +6 -0
- package/dist/{chunk-7FQQHF5U.js → chunk-APOYOP7D.js} +1 -1
- package/dist/index.cjs +261 -129
- package/dist/index.js +144 -12
- package/dist/{interrupt-ERCX5RXR.js → interrupt-A6O7N72X.js} +2 -2
- package/dist/interrupt-IKOUBQGN.cjs +12 -0
- package/dist/{mcp-UJD6KF7G.cjs → mcp-5FSUXYHM.cjs} +12 -12
- package/dist/{mcp-6R6KZ5U3.js → mcp-7EJXVCPI.js} +2 -2
- package/dist/types/cjs/index.d.ts +2 -2
- package/dist/types/cjs/internal/semantic-conventions.d.ts +3 -0
- package/dist/types/cjs/internal/trace/agent.d.ts +18 -0
- package/dist/types/cjs/internal/trace/index.d.ts +2 -0
- package/dist/types/cjs/internal/trace/session.d.ts +2 -1
- package/dist/types/esm/index.d.ts +2 -2
- package/dist/types/esm/internal/semantic-conventions.d.ts +3 -0
- package/dist/types/esm/internal/trace/agent.d.ts +18 -0
- package/dist/types/esm/internal/trace/index.d.ts +2 -0
- package/dist/types/esm/internal/trace/session.d.ts +2 -1
- package/package.json +10 -10
- package/dist/interrupt-3NXOTY4N.cjs +0 -12
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
configure,
|
|
7
7
|
getSDKVersion
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AELIATPI.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_LOG_LEVEL,
|
|
11
11
|
LogLevel,
|
|
@@ -16,8 +16,11 @@ import {
|
|
|
16
16
|
} from "./chunk-Y4HNUX3Q.js";
|
|
17
17
|
import {
|
|
18
18
|
InterruptPropagator
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-APOYOP7D.js";
|
|
20
20
|
import {
|
|
21
|
+
AGENT_ID,
|
|
22
|
+
AGENT_NAME,
|
|
23
|
+
AGENT_PARENT_ID,
|
|
21
24
|
BRIZZ,
|
|
22
25
|
EXTERNAL_LINK_EVENT_NAME,
|
|
23
26
|
EXTERNAL_LINK_TITLE,
|
|
@@ -70,7 +73,7 @@ import {
|
|
|
70
73
|
USER_NAME,
|
|
71
74
|
USER_PLAN,
|
|
72
75
|
USER_ROLE
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-AOT5NJDV.js";
|
|
74
77
|
import {
|
|
75
78
|
__require
|
|
76
79
|
} from "./chunk-3RG5ZIWI.js";
|
|
@@ -127,7 +130,7 @@ function loadGenAIInstrumentations() {
|
|
|
127
130
|
function loadMCPInstrumentation() {
|
|
128
131
|
void (async () => {
|
|
129
132
|
try {
|
|
130
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
133
|
+
const { MCPInstrumentation } = await import("./mcp-7EJXVCPI.js");
|
|
131
134
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
132
135
|
registerInstrumentations({ instrumentations: [mcp] });
|
|
133
136
|
logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -183,7 +186,7 @@ function loadVercelAITelemetry() {
|
|
|
183
186
|
}
|
|
184
187
|
const isV7 = typeof ai.registerTelemetry === "function";
|
|
185
188
|
const integrations = [];
|
|
186
|
-
const { createInterruptIntegration } = await import("./interrupt-
|
|
189
|
+
const { createInterruptIntegration } = await import("./interrupt-A6O7N72X.js");
|
|
187
190
|
integrations.push(createInterruptIntegration());
|
|
188
191
|
let otelCollectorLoaded = false;
|
|
189
192
|
try {
|
|
@@ -510,7 +513,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
510
513
|
const mcpModules = this.manualModules.mcp;
|
|
511
514
|
void (async () => {
|
|
512
515
|
try {
|
|
513
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
516
|
+
const { MCPInstrumentation } = await import("./mcp-7EJXVCPI.js");
|
|
514
517
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
515
518
|
instrumentation.manuallyInstrument(mcpModules);
|
|
516
519
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -583,7 +586,7 @@ function withProperties(properties, fn, thisArg) {
|
|
|
583
586
|
);
|
|
584
587
|
};
|
|
585
588
|
}
|
|
586
|
-
function propagatePropertiesImperatively(properties) {
|
|
589
|
+
function propagatePropertiesImperatively(properties, base = context.active()) {
|
|
587
590
|
try {
|
|
588
591
|
const manager = context;
|
|
589
592
|
const mgr = manager._getContextManager?.();
|
|
@@ -591,7 +594,6 @@ function propagatePropertiesImperatively(properties) {
|
|
|
591
594
|
if (!store || typeof store.enterWith !== "function") {
|
|
592
595
|
return;
|
|
593
596
|
}
|
|
594
|
-
const base = context.active();
|
|
595
597
|
const prev = base.getValue(PROPERTIES_CONTEXT_KEY);
|
|
596
598
|
const merged = prev ? { ...prev, ...properties } : properties;
|
|
597
599
|
store.enterWith(base.setValue(PROPERTIES_CONTEXT_KEY, merged));
|
|
@@ -815,9 +817,9 @@ var Session = class {
|
|
|
815
817
|
* @param text - Text to append (null becomes a null/"hide marker")
|
|
816
818
|
* @param context - Optional per-turn context bag to attach to this turn
|
|
817
819
|
*/
|
|
818
|
-
setInput(text,
|
|
820
|
+
setInput(text, context5) {
|
|
819
821
|
this.inputs.push(text);
|
|
820
|
-
this.inputContexts.push(
|
|
822
|
+
this.inputContexts.push(context5 ?? {});
|
|
821
823
|
this.span.setAttribute(SESSION_INPUT, JSON.stringify(this.inputs));
|
|
822
824
|
this.span.setAttribute(SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
|
|
823
825
|
}
|
|
@@ -831,9 +833,9 @@ var Session = class {
|
|
|
831
833
|
* @param text - Text to append (null becomes a null/"hide marker")
|
|
832
834
|
* @param context - Optional per-turn context bag to attach to this turn
|
|
833
835
|
*/
|
|
834
|
-
setOutput(text,
|
|
836
|
+
setOutput(text, context5) {
|
|
835
837
|
this.outputs.push(text);
|
|
836
|
-
this.outputContexts.push(
|
|
838
|
+
this.outputContexts.push(context5 ?? {});
|
|
837
839
|
this.span.setAttribute(SESSION_OUTPUT, JSON.stringify(this.outputs));
|
|
838
840
|
this.span.setAttribute(SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
|
|
839
841
|
}
|
|
@@ -2362,6 +2364,133 @@ function getSpanProcessor() {
|
|
|
2362
2364
|
return TracingModule.getInstance().getSpanProcessor();
|
|
2363
2365
|
}
|
|
2364
2366
|
|
|
2367
|
+
// src/internal/trace/agent.ts
|
|
2368
|
+
import { randomUUID } from "crypto";
|
|
2369
|
+
import { context as context4, propagation } from "@opentelemetry/api";
|
|
2370
|
+
function newInstanceId() {
|
|
2371
|
+
return randomUUID().replaceAll("-", "").slice(0, 8);
|
|
2372
|
+
}
|
|
2373
|
+
function activeProperties() {
|
|
2374
|
+
return context4.active().getValue(PROPERTIES_CONTEXT_KEY) ?? {};
|
|
2375
|
+
}
|
|
2376
|
+
function encodeToken(agent) {
|
|
2377
|
+
const payload = {
|
|
2378
|
+
id: agent.id,
|
|
2379
|
+
parentId: agent.parentId,
|
|
2380
|
+
name: agent.name,
|
|
2381
|
+
traceparent: agent.traceparent,
|
|
2382
|
+
sessionId: agent.sessionId
|
|
2383
|
+
};
|
|
2384
|
+
return Buffer.from(JSON.stringify(payload), "utf8").toString("base64url");
|
|
2385
|
+
}
|
|
2386
|
+
function currentTraceparent() {
|
|
2387
|
+
const carrier = {};
|
|
2388
|
+
try {
|
|
2389
|
+
propagation.inject(context4.active(), carrier);
|
|
2390
|
+
} catch {
|
|
2391
|
+
}
|
|
2392
|
+
return carrier["traceparent"] ?? "";
|
|
2393
|
+
}
|
|
2394
|
+
function agentHandle(id, parentId, name) {
|
|
2395
|
+
const opened = {
|
|
2396
|
+
id,
|
|
2397
|
+
parentId,
|
|
2398
|
+
name,
|
|
2399
|
+
traceparent: currentTraceparent(),
|
|
2400
|
+
sessionId: activeProperties()[SESSION_ID] ?? ""
|
|
2401
|
+
};
|
|
2402
|
+
return {
|
|
2403
|
+
...opened,
|
|
2404
|
+
get token() {
|
|
2405
|
+
return encodeToken(opened);
|
|
2406
|
+
}
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
function decodeToken(token) {
|
|
2410
|
+
try {
|
|
2411
|
+
const payload = JSON.parse(Buffer.from(token, "base64url").toString("utf8"));
|
|
2412
|
+
return payload.id ? payload : void 0;
|
|
2413
|
+
} catch {
|
|
2414
|
+
return void 0;
|
|
2415
|
+
}
|
|
2416
|
+
}
|
|
2417
|
+
function unreadableAgent(agent) {
|
|
2418
|
+
return {
|
|
2419
|
+
id: "",
|
|
2420
|
+
parentId: "",
|
|
2421
|
+
name: "",
|
|
2422
|
+
traceparent: "",
|
|
2423
|
+
sessionId: "",
|
|
2424
|
+
token: typeof agent === "string" ? "" : agent.token ?? ""
|
|
2425
|
+
};
|
|
2426
|
+
}
|
|
2427
|
+
function resolveAgent(agent) {
|
|
2428
|
+
const options = typeof agent === "string" ? { name: agent } : agent;
|
|
2429
|
+
let id;
|
|
2430
|
+
let parentId;
|
|
2431
|
+
let name;
|
|
2432
|
+
let sessionId = "";
|
|
2433
|
+
let parentContext = context4.active();
|
|
2434
|
+
if (options.token === void 0) {
|
|
2435
|
+
id = options.id || newInstanceId();
|
|
2436
|
+
parentId = options.parentId || activeProperties()[AGENT_ID] || "";
|
|
2437
|
+
name = options.name ?? "";
|
|
2438
|
+
} else {
|
|
2439
|
+
const decoded = decodeToken(options.token);
|
|
2440
|
+
if (!decoded) {
|
|
2441
|
+
logger.warn("Brizz: ignoring an unreadable agent token");
|
|
2442
|
+
return void 0;
|
|
2443
|
+
}
|
|
2444
|
+
id = decoded.id;
|
|
2445
|
+
parentId = decoded.parentId;
|
|
2446
|
+
name = decoded.name;
|
|
2447
|
+
sessionId = decoded.sessionId;
|
|
2448
|
+
if (decoded.traceparent) {
|
|
2449
|
+
try {
|
|
2450
|
+
parentContext = propagation.extract(parentContext, { traceparent: decoded.traceparent });
|
|
2451
|
+
} catch {
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
const properties = { [AGENT_ID]: id, [AGENT_NAME]: name };
|
|
2456
|
+
if (parentId) {
|
|
2457
|
+
properties[AGENT_PARENT_ID] = parentId;
|
|
2458
|
+
}
|
|
2459
|
+
if (sessionId) {
|
|
2460
|
+
properties[SESSION_ID] = sessionId;
|
|
2461
|
+
}
|
|
2462
|
+
return { id, parentId, name, properties, parentContext };
|
|
2463
|
+
}
|
|
2464
|
+
function startAgent(agent, callback) {
|
|
2465
|
+
const resolved = resolveAgent(agent);
|
|
2466
|
+
if (!resolved) {
|
|
2467
|
+
return callback(unreadableAgent(agent));
|
|
2468
|
+
}
|
|
2469
|
+
const { id, parentId, name, properties, parentContext } = resolved;
|
|
2470
|
+
return context4.with(
|
|
2471
|
+
parentContext,
|
|
2472
|
+
() => callWithProperties(properties, () => callback(agentHandle(id, parentId, name)))
|
|
2473
|
+
);
|
|
2474
|
+
}
|
|
2475
|
+
function withAgent(agent, fn, thisArg) {
|
|
2476
|
+
return function wrapped(...args) {
|
|
2477
|
+
return startAgent(
|
|
2478
|
+
agent,
|
|
2479
|
+
() => fn.apply(thisArg !== void 0 ? thisArg : this, args)
|
|
2480
|
+
);
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
function setAgent(agent) {
|
|
2484
|
+
const resolved = resolveAgent(agent);
|
|
2485
|
+
if (!resolved) {
|
|
2486
|
+
return unreadableAgent(agent);
|
|
2487
|
+
}
|
|
2488
|
+
const { id, parentId, name, properties, parentContext } = resolved;
|
|
2489
|
+
setCurrentSpanCustomProperties(properties);
|
|
2490
|
+
propagatePropertiesImperatively(properties, parentContext);
|
|
2491
|
+
return agentHandle(id, parentId, name);
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2365
2494
|
// src/internal/sdk.ts
|
|
2366
2495
|
function resolveMcpSessionTracking(configured) {
|
|
2367
2496
|
const fromEnv = process.env["BRIZZ_MCP_SESSION_TRACKING"];
|
|
@@ -2613,6 +2742,7 @@ export {
|
|
|
2613
2742
|
maskValue,
|
|
2614
2743
|
recordFeedback,
|
|
2615
2744
|
recordMetric,
|
|
2745
|
+
setAgent,
|
|
2616
2746
|
setCurrentSpanCustomProperties,
|
|
2617
2747
|
setLogLevel,
|
|
2618
2748
|
setMessageId,
|
|
@@ -2620,8 +2750,10 @@ export {
|
|
|
2620
2750
|
setServiceName,
|
|
2621
2751
|
setSessionId,
|
|
2622
2752
|
setUser,
|
|
2753
|
+
startAgent,
|
|
2623
2754
|
startSession,
|
|
2624
2755
|
startSessionTitle,
|
|
2756
|
+
withAgent,
|
|
2625
2757
|
withMessageId,
|
|
2626
2758
|
withMute,
|
|
2627
2759
|
withOrganization,
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
InterruptPropagator,
|
|
3
3
|
_resetInterruptState,
|
|
4
4
|
createInterruptIntegration
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-APOYOP7D.js";
|
|
6
|
+
import "./chunk-AOT5NJDV.js";
|
|
7
7
|
import "./chunk-3RG5ZIWI.js";
|
|
8
8
|
export {
|
|
9
9
|
InterruptPropagator,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunk3IGBYXLRcjs = require('./chunk-3IGBYXLR.cjs');
|
|
6
|
+
require('./chunk-5WBPX342.cjs');
|
|
7
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.InterruptPropagator = _chunk3IGBYXLRcjs.InterruptPropagator; exports._resetInterruptState = _chunk3IGBYXLRcjs._resetInterruptState; exports.createInterruptIntegration = _chunk3IGBYXLRcjs.createInterruptIntegration;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkA3HH5OULcjs = require('./chunk-A3HH5OUL.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
15
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-5WBPX342.cjs');
|
|
16
16
|
require('./chunk-OBGZSXTJ.cjs');
|
|
17
17
|
|
|
18
18
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
@@ -387,14 +387,14 @@ function wrapOnRequest(original, tracer) {
|
|
|
387
387
|
return original.apply(this, args);
|
|
388
388
|
}
|
|
389
389
|
const method = request.method;
|
|
390
|
-
if (method === METHOD_TOOLS_CALL &&
|
|
390
|
+
if (method === METHOD_TOOLS_CALL && _chunkA3HH5OULcjs.isSessionToolCall.call(void 0, request)) {
|
|
391
391
|
return answerSessionToolCall(this, request, tracer, args, original);
|
|
392
392
|
}
|
|
393
393
|
const handler = _nullishCoalesce(handlers.get(method), () => ( this.fallbackRequestHandler));
|
|
394
394
|
if (!handler) {
|
|
395
395
|
return original.apply(this, args);
|
|
396
396
|
}
|
|
397
|
-
const tracking =
|
|
397
|
+
const tracking = _chunkA3HH5OULcjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkA3HH5OULcjs.popTrackingArguments.call(void 0, request) : {};
|
|
398
398
|
const started = safeStartServerSpan(tracer, request, this, tracking);
|
|
399
399
|
if (!started) {
|
|
400
400
|
return original.apply(this, args);
|
|
@@ -404,9 +404,9 @@ function wrapOnRequest(original, tracer) {
|
|
|
404
404
|
if (method === METHOD_TOOLS_LIST) {
|
|
405
405
|
hooks.onResult = (result) => {
|
|
406
406
|
let advertised = result;
|
|
407
|
-
if (
|
|
407
|
+
if (_chunkA3HH5OULcjs.isEnabled.call(void 0, )) {
|
|
408
408
|
try {
|
|
409
|
-
advertised =
|
|
409
|
+
advertised = _chunkA3HH5OULcjs.patchListToolsResult.call(void 0, result);
|
|
410
410
|
} catch (error) {
|
|
411
411
|
_chunkWC573FCIcjs.logger.warn(
|
|
412
412
|
`Brizz MCP: failed to patch tools/list schemas: ${String(error)}`
|
|
@@ -417,7 +417,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
417
417
|
try {
|
|
418
418
|
emitSchemaSpansFromListResponse(
|
|
419
419
|
advertised,
|
|
420
|
-
|
|
420
|
+
_chunkA3HH5OULcjs.resolveTransportSessionId.call(void 0, this),
|
|
421
421
|
tracer
|
|
422
422
|
);
|
|
423
423
|
} catch (error) {
|
|
@@ -430,7 +430,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
430
430
|
}
|
|
431
431
|
if (method !== METHOD_TOOLS_CALL) {
|
|
432
432
|
hooks.onError = () => {
|
|
433
|
-
|
|
433
|
+
_chunkA3HH5OULcjs.stampAndPropagateSession.call(void 0, span, _chunkA3HH5OULcjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
|
|
434
434
|
};
|
|
435
435
|
}
|
|
436
436
|
const wrappedHandler = (req, extra) => _api.context.with(
|
|
@@ -464,7 +464,7 @@ function answerSessionToolCall(protocol, request, tracer, args, original) {
|
|
|
464
464
|
if (!handlers) {
|
|
465
465
|
return original.apply(protocol, args);
|
|
466
466
|
}
|
|
467
|
-
const { id, result } =
|
|
467
|
+
const { id, result } = _chunkA3HH5OULcjs.sessionToolResult.call(void 0, );
|
|
468
468
|
const started = safeStartServerSpan(tracer, request, protocol, { sessionId: id });
|
|
469
469
|
const handler = () => started ? _api.context.with(started.spanCtx, () => result) : result;
|
|
470
470
|
const hadEntry = handlers.has(METHOD_TOOLS_CALL);
|
|
@@ -554,8 +554,8 @@ function safeStartServerSpan(tracer, request, protocol, tracking = {}) {
|
|
|
554
554
|
parentCtx
|
|
555
555
|
);
|
|
556
556
|
applyServerRequestAttributes(span, request, protocol);
|
|
557
|
-
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => (
|
|
558
|
-
const { context: sessCtx } =
|
|
557
|
+
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkA3HH5OULcjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
|
|
558
|
+
const { context: sessCtx } = _chunkA3HH5OULcjs.stampAndPropagateSession.call(void 0,
|
|
559
559
|
span,
|
|
560
560
|
resolved,
|
|
561
561
|
parentCtx,
|
|
@@ -611,7 +611,7 @@ function safeEnd(span) {
|
|
|
611
611
|
|
|
612
612
|
// src/internal/instrumentation/mcp/version.ts
|
|
613
613
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
614
|
-
var INSTRUMENTATION_VERSION =
|
|
614
|
+
var INSTRUMENTATION_VERSION = _chunkA3HH5OULcjs.getSDKVersion.call(void 0, );
|
|
615
615
|
|
|
616
616
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
617
617
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
resolveTransportSessionId,
|
|
9
9
|
sessionToolResult,
|
|
10
10
|
stampAndPropagateSession
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AELIATPI.js";
|
|
12
12
|
import {
|
|
13
13
|
logger
|
|
14
14
|
} from "./chunk-Y4HNUX3Q.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-AOT5NJDV.js";
|
|
16
16
|
import "./chunk-3RG5ZIWI.js";
|
|
17
17
|
|
|
18
18
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
@@ -2,8 +2,8 @@ import './internal/instrumentation/auto-init.js';
|
|
|
2
2
|
export { Brizz, type IBrizzInitializeOptions } from './internal/sdk.js';
|
|
3
3
|
export { type IInstrumentModules, type IMCPManualModules, } from './internal/instrumentation/index.js';
|
|
4
4
|
export { emitEvent, emitEventWithSessionId } from './internal/log/index.js';
|
|
5
|
-
export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
|
|
6
|
-
export type { IMuteOptions } from './internal/trace/index.js';
|
|
5
|
+
export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startAgent, withAgent, setAgent, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
|
|
6
|
+
export type { IMuteOptions, AgentRef, IAgent, IAgentOptions } from './internal/trace/index.js';
|
|
7
7
|
export { getMetricsExporter, getMetricsReader } from './internal/metric/index.js';
|
|
8
8
|
export type { IMaskingConfig, ISpanMaskingConfig, ILogMaskingConfig, IEventMaskingConfig, IEventMaskingRule, MaskingMode, IAttributesMaskingRule, } from './internal/masking/index.js';
|
|
9
9
|
export { DEFAULT_PII_PATTERNS } from './internal/masking/patterns.js';
|
|
@@ -26,6 +26,9 @@ export declare const SERVICE_NAME_ATTRIBUTE = "brizz.service.name";
|
|
|
26
26
|
export declare const SESSION_TITLE_SPAN_NAME = "brizz.session_title";
|
|
27
27
|
export declare const SESSION_TITLE_GENERATION = "session.title_generation";
|
|
28
28
|
export declare const SESSION_TITLE = "brizz.session.title";
|
|
29
|
+
export declare const AGENT_ID = "internal.agent.id";
|
|
30
|
+
export declare const AGENT_PARENT_ID = "internal.agent.parent_id";
|
|
31
|
+
export declare const AGENT_NAME = "internal.agent.name";
|
|
29
32
|
export declare const INTERRUPT_TOOLS = "brizz.internal.interrupt";
|
|
30
33
|
export declare const INTERNAL_EVENT_PREFIX = "brizz.internal.";
|
|
31
34
|
export declare const EXTERNAL_LINK_EVENT_NAME = "brizz.internal.external_link";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IAgent {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly parentId: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly traceparent: string;
|
|
6
|
+
readonly sessionId: string;
|
|
7
|
+
readonly token: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IAgentOptions {
|
|
10
|
+
name?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
parentId?: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
}
|
|
15
|
+
export type AgentRef = string | IAgentOptions;
|
|
16
|
+
export declare function startAgent<T>(agent: AgentRef, callback: (agent: IAgent) => T): T;
|
|
17
|
+
export declare function withAgent<F extends (this: any, ...args: any[]) => any>(agent: AgentRef, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
18
|
+
export declare function setAgent(agent: AgentRef): IAgent;
|
|
@@ -2,3 +2,5 @@ export { TracingModule, getSpanExporter, getSpanProcessor } from './tracing.js';
|
|
|
2
2
|
export { BrizzBatchSpanProcessor, BrizzSimpleSpanProcessor } from './processors/span-processor.js';
|
|
3
3
|
export { withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './session.js';
|
|
4
4
|
export type { IMuteOptions } from './session.js';
|
|
5
|
+
export { startAgent, withAgent, setAgent } from './agent.js';
|
|
6
|
+
export type { AgentRef, IAgent, IAgentOptions } from './agent.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Span, AttributeValue } from '@opentelemetry/api';
|
|
1
|
+
import type { Context, Span, AttributeValue } from '@opentelemetry/api';
|
|
2
2
|
export declare function setCurrentSpanCustomProperties(properties: Record<string, AttributeValue>): void;
|
|
3
3
|
export declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
|
|
4
4
|
[name: string]: string;
|
|
@@ -6,6 +6,7 @@ export declare function callWithProperties<A extends unknown[], F extends (...ar
|
|
|
6
6
|
export declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
|
|
7
7
|
[name: string]: string;
|
|
8
8
|
}, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
9
|
+
export declare function propagatePropertiesImperatively(properties: Record<string, string>, base?: Context): void;
|
|
9
10
|
export declare function setUser(user: {
|
|
10
11
|
id: string;
|
|
11
12
|
email?: string;
|
|
@@ -2,8 +2,8 @@ import './internal/instrumentation/auto-init.js';
|
|
|
2
2
|
export { Brizz, type IBrizzInitializeOptions } from './internal/sdk.js';
|
|
3
3
|
export { type IInstrumentModules, type IMCPManualModules, } from './internal/instrumentation/index.js';
|
|
4
4
|
export { emitEvent, emitEventWithSessionId } from './internal/log/index.js';
|
|
5
|
-
export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
|
|
6
|
-
export type { IMuteOptions } from './internal/trace/index.js';
|
|
5
|
+
export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startAgent, withAgent, setAgent, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
|
|
6
|
+
export type { IMuteOptions, AgentRef, IAgent, IAgentOptions } from './internal/trace/index.js';
|
|
7
7
|
export { getMetricsExporter, getMetricsReader } from './internal/metric/index.js';
|
|
8
8
|
export type { IMaskingConfig, ISpanMaskingConfig, ILogMaskingConfig, IEventMaskingConfig, IEventMaskingRule, MaskingMode, IAttributesMaskingRule, } from './internal/masking/index.js';
|
|
9
9
|
export { DEFAULT_PII_PATTERNS } from './internal/masking/patterns.js';
|
|
@@ -26,6 +26,9 @@ export declare const SERVICE_NAME_ATTRIBUTE = "brizz.service.name";
|
|
|
26
26
|
export declare const SESSION_TITLE_SPAN_NAME = "brizz.session_title";
|
|
27
27
|
export declare const SESSION_TITLE_GENERATION = "session.title_generation";
|
|
28
28
|
export declare const SESSION_TITLE = "brizz.session.title";
|
|
29
|
+
export declare const AGENT_ID = "internal.agent.id";
|
|
30
|
+
export declare const AGENT_PARENT_ID = "internal.agent.parent_id";
|
|
31
|
+
export declare const AGENT_NAME = "internal.agent.name";
|
|
29
32
|
export declare const INTERRUPT_TOOLS = "brizz.internal.interrupt";
|
|
30
33
|
export declare const INTERNAL_EVENT_PREFIX = "brizz.internal.";
|
|
31
34
|
export declare const EXTERNAL_LINK_EVENT_NAME = "brizz.internal.external_link";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface IAgent {
|
|
2
|
+
readonly id: string;
|
|
3
|
+
readonly parentId: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly traceparent: string;
|
|
6
|
+
readonly sessionId: string;
|
|
7
|
+
readonly token: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IAgentOptions {
|
|
10
|
+
name?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
parentId?: string;
|
|
13
|
+
token?: string;
|
|
14
|
+
}
|
|
15
|
+
export type AgentRef = string | IAgentOptions;
|
|
16
|
+
export declare function startAgent<T>(agent: AgentRef, callback: (agent: IAgent) => T): T;
|
|
17
|
+
export declare function withAgent<F extends (this: any, ...args: any[]) => any>(agent: AgentRef, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
18
|
+
export declare function setAgent(agent: AgentRef): IAgent;
|
|
@@ -2,3 +2,5 @@ export { TracingModule, getSpanExporter, getSpanProcessor } from './tracing.js';
|
|
|
2
2
|
export { BrizzBatchSpanProcessor, BrizzSimpleSpanProcessor } from './processors/span-processor.js';
|
|
3
3
|
export { withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './session.js';
|
|
4
4
|
export type { IMuteOptions } from './session.js';
|
|
5
|
+
export { startAgent, withAgent, setAgent } from './agent.js';
|
|
6
|
+
export type { AgentRef, IAgent, IAgentOptions } from './agent.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Span, AttributeValue } from '@opentelemetry/api';
|
|
1
|
+
import type { Context, Span, AttributeValue } from '@opentelemetry/api';
|
|
2
2
|
export declare function setCurrentSpanCustomProperties(properties: Record<string, AttributeValue>): void;
|
|
3
3
|
export declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
|
|
4
4
|
[name: string]: string;
|
|
@@ -6,6 +6,7 @@ export declare function callWithProperties<A extends unknown[], F extends (...ar
|
|
|
6
6
|
export declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
|
|
7
7
|
[name: string]: string;
|
|
8
8
|
}, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
9
|
+
export declare function propagatePropertiesImperatively(properties: Record<string, string>, base?: Context): void;
|
|
9
10
|
export declare function setUser(user: {
|
|
10
11
|
id: string;
|
|
11
12
|
email?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brizz/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTelemetry-based observability SDK for AI applications",
|
|
6
6
|
"keywords": [
|
|
@@ -101,32 +101,32 @@
|
|
|
101
101
|
"registry": "https://registry.npmjs.org/"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@ai-sdk/anthropic": "^4.0.
|
|
105
|
-
"@ai-sdk/openai": "^4.0.
|
|
106
|
-
"@ai-sdk/otel": "^1.0.
|
|
104
|
+
"@ai-sdk/anthropic": "^4.0.40",
|
|
105
|
+
"@ai-sdk/openai": "^4.0.44",
|
|
106
|
+
"@ai-sdk/otel": "^1.0.70",
|
|
107
107
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
108
108
|
"@arizeai/openinference-instrumentation-mcp": "^0.2.24",
|
|
109
109
|
"@babel/core": "^8.0.1",
|
|
110
110
|
"@babel/preset-env": "^8.0.2",
|
|
111
111
|
"@babel/preset-typescript": "^8.0.1",
|
|
112
112
|
"@changesets/changelog-github": "^1.0.0",
|
|
113
|
-
"@changesets/cli": "^3.0.
|
|
114
|
-
"@google/genai": "^2.
|
|
113
|
+
"@changesets/cli": "^3.0.1",
|
|
114
|
+
"@google/genai": "^2.18.0",
|
|
115
115
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
116
116
|
"@traceloop/instrumentation-google-generativeai": "^0.27.0",
|
|
117
117
|
"@traceloop/instrumentation-vertexai": "^0.27.0",
|
|
118
118
|
"@types/jest": "^30.0.0",
|
|
119
119
|
"@types/node": "^26.2.0",
|
|
120
|
-
"ai": "^7.0.
|
|
120
|
+
"ai": "^7.0.70",
|
|
121
121
|
"babel-jest": "^30.4.1",
|
|
122
122
|
"jest": "^30.4.2",
|
|
123
123
|
"jest-environment-jsdom": "^30.4.1",
|
|
124
|
-
"openai": "^7.
|
|
125
|
-
"oxlint": "^1.
|
|
124
|
+
"openai": "^7.5.0",
|
|
125
|
+
"oxlint": "^1.79.0",
|
|
126
126
|
"prettier": "^3.9.6",
|
|
127
127
|
"tsup": "^8.5.1",
|
|
128
128
|
"typescript": "^7.0.2",
|
|
129
|
-
"vitest": "^4.1.
|
|
129
|
+
"vitest": "^4.1.11",
|
|
130
130
|
"zod": "^4.4.3"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkQUV5HYJ2cjs = require('./chunk-QUV5HYJ2.cjs');
|
|
6
|
-
require('./chunk-FORVS4QW.cjs');
|
|
7
|
-
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.InterruptPropagator = _chunkQUV5HYJ2cjs.InterruptPropagator; exports._resetInterruptState = _chunkQUV5HYJ2cjs._resetInterruptState; exports.createInterruptIntegration = _chunkQUV5HYJ2cjs.createInterruptIntegration;
|