@brizz/sdk 0.1.34 → 0.1.36
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 +38 -1
- package/dist/{chunk-64STNQKL.js → chunk-6OGRVH77.js} +1 -1
- package/dist/{chunk-NEF2O7HF.cjs → chunk-77UGZGMP.cjs} +3 -1
- package/dist/{chunk-3LR22M4E.cjs → chunk-CQDWK43A.cjs} +166 -136
- package/dist/{chunk-24CEDVD2.js → chunk-EC3MYSRM.js} +1 -1
- package/dist/{chunk-M3UGFLH7.cjs → chunk-EVRCHF74.cjs} +4 -4
- package/dist/chunk-KFETJN5M.cjs +63 -0
- package/dist/{chunk-VU5YDLUD.cjs → chunk-PXIW2K27.cjs} +1 -1
- package/dist/chunk-TEY6FAVZ.js +63 -0
- package/dist/{chunk-QY4VADPP.js → chunk-WII4R5RE.js} +2 -0
- package/dist/{chunk-F3O3MTQ4.js → chunk-YNCBWOHM.js} +35 -5
- package/dist/google-genai-LMEZ62FB.cjs +10 -0
- package/dist/google-genai-T7I4FFIP.js +10 -0
- package/dist/google-genai.cjs +8 -0
- package/dist/google-genai.d.cts +7 -0
- package/dist/google-genai.d.ts +7 -0
- package/dist/google-genai.js +8 -0
- package/dist/index.cjs +22 -7
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +21 -6
- package/dist/interrupt-DM3AWSBX.cjs +12 -0
- package/dist/{interrupt-KADNA6WK.js → interrupt-YJVZK4VC.js} +2 -2
- package/dist/{mcp-WCMY6ED6.cjs → mcp-HAUJ3G4Q.cjs} +7 -7
- package/dist/{mcp-ZP6AY3FE.js → mcp-ZCRMQV5L.js} +2 -2
- package/dist/preload.cjs +7 -7
- package/dist/preload.js +4 -4
- package/package.json +25 -9
- package/dist/interrupt-7MWQCOY3.cjs +0 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk77UGZGMPcjs = require('./chunk-77UGZGMP.cjs');
|
|
4
4
|
|
|
5
5
|
// src/internal/instrumentation/vercel-ai/interrupt.ts
|
|
6
6
|
var _api = require('@opentelemetry/api');
|
|
@@ -78,7 +78,7 @@ function createInterruptIntegration() {
|
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
const value = JSON.stringify(names);
|
|
81
|
-
span.setAttribute(
|
|
81
|
+
span.setAttribute(_chunk77UGZGMPcjs.INTERRUPT_TOOLS, value);
|
|
82
82
|
setPending(span.spanContext().spanId, value);
|
|
83
83
|
};
|
|
84
84
|
return {
|
|
@@ -94,7 +94,7 @@ var InterruptPropagator = class {
|
|
|
94
94
|
const parentSpanId = _optionalChain([span, 'access', _ => _.parentSpanContext, 'optionalAccess', _2 => _2.spanId]);
|
|
95
95
|
const stashed = parentSpanId && pendingByParentSpanId.get(parentSpanId);
|
|
96
96
|
if (stashed) {
|
|
97
|
-
span.setAttribute(
|
|
97
|
+
span.setAttribute(_chunk77UGZGMPcjs.INTERRUPT_TOOLS, stashed);
|
|
98
98
|
pendingByParentSpanId.delete(parentSpanId);
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
@@ -104,7 +104,7 @@ var InterruptPropagator = class {
|
|
|
104
104
|
const scoped = parsePromptToolNames(span.attributes["ai.prompt.tools"]);
|
|
105
105
|
const names = scoped === null ? [...needsApprovalToolNames] : scoped.filter((n) => needsApprovalToolNames.has(n));
|
|
106
106
|
if (names.length > 0) {
|
|
107
|
-
span.setAttribute(
|
|
107
|
+
span.setAttribute(_chunk77UGZGMPcjs.INTERRUPT_TOOLS, JSON.stringify(names));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
onEnd() {
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
4
|
+
|
|
5
|
+
// src/internal/instrumentation/google-genai.ts
|
|
6
|
+
var _instrumentation = require('@opentelemetry/instrumentation');
|
|
7
|
+
var _instrumentationgooglegenerativeai = require('@traceloop/instrumentation-google-generativeai');
|
|
8
|
+
var MODULE_NAME = "@google/genai";
|
|
9
|
+
var SUPPORTED_VERSIONS = [">=1.0.0 <3.0.0"];
|
|
10
|
+
var GoogleGenAIInstrumentation = class extends _instrumentationgooglegenerativeai.GenAIInstrumentation {
|
|
11
|
+
/**
|
|
12
|
+
* Replace — not extend — upstream's module definition. Upstream returns a
|
|
13
|
+
* single definition for `@google/genai`; registering ours alongside it would
|
|
14
|
+
* patch the same module twice on v1.
|
|
15
|
+
*/
|
|
16
|
+
init() {
|
|
17
|
+
return new (0, _instrumentation.InstrumentationNodeModuleDefinition)(
|
|
18
|
+
MODULE_NAME,
|
|
19
|
+
SUPPORTED_VERSIONS,
|
|
20
|
+
(module) => {
|
|
21
|
+
this.manuallyInstrument(module);
|
|
22
|
+
return module;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Brand the class we patched so de-duplication survives bundlers that minify
|
|
28
|
+
* upstream's runtime class name. Every patch path (module-load hook, registry
|
|
29
|
+
* `instrumentModules`, `instrumentGoogleGenAI`) funnels through here.
|
|
30
|
+
*/
|
|
31
|
+
manuallyInstrument(module) {
|
|
32
|
+
const original = module.GoogleGenAI;
|
|
33
|
+
super.manuallyInstrument(module);
|
|
34
|
+
if (module.GoogleGenAI !== original) {
|
|
35
|
+
module.GoogleGenAI[PATCHED_MARKER] = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var PATCHED_CLASS_NAME = "PatchedGoogleGenAI";
|
|
40
|
+
var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.googleGenAI.patched");
|
|
41
|
+
function instrumentGoogleGenAI(module) {
|
|
42
|
+
const original = module.GoogleGenAI;
|
|
43
|
+
const branded = original[PATCHED_MARKER] === true;
|
|
44
|
+
if (branded || original.name === PATCHED_CLASS_NAME) {
|
|
45
|
+
return original;
|
|
46
|
+
}
|
|
47
|
+
const holder = { GoogleGenAI: original };
|
|
48
|
+
const instrumentation = new GoogleGenAIInstrumentation({
|
|
49
|
+
exceptionLogger: (error) => {
|
|
50
|
+
_chunkWC573FCIcjs.logger.error(`Exception in Google GenAI instrumentation: ${String(error)}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
instrumentation.manuallyInstrument(holder);
|
|
54
|
+
if (holder.GoogleGenAI === original) {
|
|
55
|
+
_chunkWC573FCIcjs.logger.warn("Google GenAI instrumentation did not patch the client; calls will not be traced");
|
|
56
|
+
}
|
|
57
|
+
return holder.GoogleGenAI;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
exports.GoogleGenAIInstrumentation = GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = instrumentGoogleGenAI;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
logger
|
|
3
|
+
} from "./chunk-Y4HNUX3Q.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/instrumentation/google-genai.ts
|
|
6
|
+
import { InstrumentationNodeModuleDefinition } from "@opentelemetry/instrumentation";
|
|
7
|
+
import { GenAIInstrumentation } from "@traceloop/instrumentation-google-generativeai";
|
|
8
|
+
var MODULE_NAME = "@google/genai";
|
|
9
|
+
var SUPPORTED_VERSIONS = [">=1.0.0 <3.0.0"];
|
|
10
|
+
var GoogleGenAIInstrumentation = class extends GenAIInstrumentation {
|
|
11
|
+
/**
|
|
12
|
+
* Replace — not extend — upstream's module definition. Upstream returns a
|
|
13
|
+
* single definition for `@google/genai`; registering ours alongside it would
|
|
14
|
+
* patch the same module twice on v1.
|
|
15
|
+
*/
|
|
16
|
+
init() {
|
|
17
|
+
return new InstrumentationNodeModuleDefinition(
|
|
18
|
+
MODULE_NAME,
|
|
19
|
+
SUPPORTED_VERSIONS,
|
|
20
|
+
(module) => {
|
|
21
|
+
this.manuallyInstrument(module);
|
|
22
|
+
return module;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Brand the class we patched so de-duplication survives bundlers that minify
|
|
28
|
+
* upstream's runtime class name. Every patch path (module-load hook, registry
|
|
29
|
+
* `instrumentModules`, `instrumentGoogleGenAI`) funnels through here.
|
|
30
|
+
*/
|
|
31
|
+
manuallyInstrument(module) {
|
|
32
|
+
const original = module.GoogleGenAI;
|
|
33
|
+
super.manuallyInstrument(module);
|
|
34
|
+
if (module.GoogleGenAI !== original) {
|
|
35
|
+
module.GoogleGenAI[PATCHED_MARKER] = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var PATCHED_CLASS_NAME = "PatchedGoogleGenAI";
|
|
40
|
+
var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.googleGenAI.patched");
|
|
41
|
+
function instrumentGoogleGenAI(module) {
|
|
42
|
+
const original = module.GoogleGenAI;
|
|
43
|
+
const branded = original[PATCHED_MARKER] === true;
|
|
44
|
+
if (branded || original.name === PATCHED_CLASS_NAME) {
|
|
45
|
+
return original;
|
|
46
|
+
}
|
|
47
|
+
const holder = { GoogleGenAI: original };
|
|
48
|
+
const instrumentation = new GoogleGenAIInstrumentation({
|
|
49
|
+
exceptionLogger: (error) => {
|
|
50
|
+
logger.error(`Exception in Google GenAI instrumentation: ${String(error)}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
instrumentation.manuallyInstrument(holder);
|
|
54
|
+
if (holder.GoogleGenAI === original) {
|
|
55
|
+
logger.warn("Google GenAI instrumentation did not patch the client; calls will not be traced");
|
|
56
|
+
}
|
|
57
|
+
return holder.GoogleGenAI;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
GoogleGenAIInstrumentation,
|
|
62
|
+
instrumentGoogleGenAI
|
|
63
|
+
};
|
|
@@ -12,6 +12,7 @@ var SESSION_OUTPUT_CONTEXT = "brizz.session.output.context";
|
|
|
12
12
|
var SESSION_SPAN_NAME = "brizz.start_session";
|
|
13
13
|
var MUTE_INPUT = "mute.input";
|
|
14
14
|
var MUTE_OUTPUT = "mute.output";
|
|
15
|
+
var MUTE_TOOLS = "mute.tools";
|
|
15
16
|
var USER_ID = "user.id";
|
|
16
17
|
var USER_EMAIL = "user.email";
|
|
17
18
|
var USER_NAME = "user.name";
|
|
@@ -75,6 +76,7 @@ export {
|
|
|
75
76
|
SESSION_SPAN_NAME,
|
|
76
77
|
MUTE_INPUT,
|
|
77
78
|
MUTE_OUTPUT,
|
|
79
|
+
MUTE_TOOLS,
|
|
78
80
|
USER_ID,
|
|
79
81
|
USER_EMAIL,
|
|
80
82
|
USER_NAME,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-7SUF4VVI.js";
|
|
5
5
|
import {
|
|
6
6
|
getSDKVersion
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6OGRVH77.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_LOG_LEVEL,
|
|
10
10
|
logger,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-Y4HNUX3Q.js";
|
|
14
14
|
import {
|
|
15
15
|
InterruptPropagator
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EC3MYSRM.js";
|
|
17
17
|
import {
|
|
18
18
|
BRIZZ,
|
|
19
19
|
EXTERNAL_LINK_EVENT_NAME,
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
METRIC_VALUE,
|
|
44
44
|
MUTE_INPUT,
|
|
45
45
|
MUTE_OUTPUT,
|
|
46
|
+
MUTE_TOOLS,
|
|
46
47
|
ORGANIZATION_DOMAIN,
|
|
47
48
|
ORGANIZATION_ID,
|
|
48
49
|
ORGANIZATION_NAME,
|
|
@@ -64,7 +65,7 @@ import {
|
|
|
64
65
|
USER_NAME,
|
|
65
66
|
USER_PLAN,
|
|
66
67
|
USER_ROLE
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-WII4R5RE.js";
|
|
68
69
|
import {
|
|
69
70
|
__require
|
|
70
71
|
} from "./chunk-3RG5ZIWI.js";
|
|
@@ -170,11 +171,26 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
170
171
|
}
|
|
171
172
|
})();
|
|
172
173
|
}
|
|
174
|
+
if (this.manualModules?.google_genai) {
|
|
175
|
+
const genaiModule = this.manualModules.google_genai;
|
|
176
|
+
void (async () => {
|
|
177
|
+
try {
|
|
178
|
+
const { GoogleGenAIInstrumentation } = await import("./google-genai-T7I4FFIP.js");
|
|
179
|
+
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
180
|
+
genaiInst.manuallyInstrument(genaiModule);
|
|
181
|
+
logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
182
|
+
} catch (error) {
|
|
183
|
+
logger.error(
|
|
184
|
+
`Failed to apply Google GenAI instrumentation. Ensure @traceloop/instrumentation-google-generativeai is installed; on a read-only ESM module namespace use instrumentGoogleGenAI from @brizz/sdk/google-genai instead: ${String(error)}`
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
})();
|
|
188
|
+
}
|
|
173
189
|
if (this.manualModules?.mcp) {
|
|
174
190
|
const mcpModules = this.manualModules.mcp;
|
|
175
191
|
void (async () => {
|
|
176
192
|
try {
|
|
177
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
193
|
+
const { MCPInstrumentation } = await import("./mcp-ZCRMQV5L.js");
|
|
178
194
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
179
195
|
instrumentation.manuallyInstrument(mcpModules);
|
|
180
196
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1074,8 +1090,12 @@ function callWithMessageId(id, fn, thisArg, ...args) {
|
|
|
1074
1090
|
function withMessageId(id, fn, thisArg) {
|
|
1075
1091
|
return withProperties({ [MESSAGE_ID]: id }, fn, thisArg);
|
|
1076
1092
|
}
|
|
1093
|
+
function inheritedMuteTools() {
|
|
1094
|
+
const properties = context2.active().getValue(PROPERTIES_CONTEXT_KEY);
|
|
1095
|
+
return properties?.[MUTE_TOOLS];
|
|
1096
|
+
}
|
|
1077
1097
|
function muteProperties(options) {
|
|
1078
|
-
const { input = true, output = true } = options;
|
|
1098
|
+
const { input = true, output = true, tools = output } = options;
|
|
1079
1099
|
const properties = {};
|
|
1080
1100
|
if (input) {
|
|
1081
1101
|
properties[MUTE_INPUT] = "true";
|
|
@@ -1083,6 +1103,16 @@ function muteProperties(options) {
|
|
|
1083
1103
|
if (output) {
|
|
1084
1104
|
properties[MUTE_OUTPUT] = "true";
|
|
1085
1105
|
}
|
|
1106
|
+
if (tools !== output) {
|
|
1107
|
+
properties[MUTE_TOOLS] = String(tools);
|
|
1108
|
+
} else {
|
|
1109
|
+
const inherited = inheritedMuteTools();
|
|
1110
|
+
if (tools && inherited === "false") {
|
|
1111
|
+
properties[MUTE_TOOLS] = "true";
|
|
1112
|
+
} else if (options.tools === false && inherited === "true") {
|
|
1113
|
+
properties[MUTE_TOOLS] = "false";
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1086
1116
|
return properties;
|
|
1087
1117
|
}
|
|
1088
1118
|
function callWithMute(options, fn, thisArg, ...args) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkKFETJN5Mcjs = require('./chunk-KFETJN5M.cjs');
|
|
5
|
+
require('./chunk-WC573FCI.cjs');
|
|
6
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.GoogleGenAIInstrumentation = _chunkKFETJN5Mcjs.GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = _chunkKFETJN5Mcjs.instrumentGoogleGenAI;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkKFETJN5Mcjs = require('./chunk-KFETJN5M.cjs');
|
|
4
|
+
require('./chunk-WC573FCI.cjs');
|
|
5
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.instrumentGoogleGenAI = _chunkKFETJN5Mcjs.instrumentGoogleGenAI;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GenAIInstrumentation } from '@traceloop/instrumentation-google-generativeai';
|
|
2
|
+
|
|
3
|
+
type GoogleGenAIModule = Parameters<GenAIInstrumentation['manuallyInstrument']>[0];
|
|
4
|
+
type GoogleGenAIClass = GoogleGenAIModule['GoogleGenAI'];
|
|
5
|
+
declare function instrumentGoogleGenAI(module: GoogleGenAIModule): GoogleGenAIClass;
|
|
6
|
+
|
|
7
|
+
export { instrumentGoogleGenAI };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GenAIInstrumentation } from '@traceloop/instrumentation-google-generativeai';
|
|
2
|
+
|
|
3
|
+
type GoogleGenAIModule = Parameters<GenAIInstrumentation['manuallyInstrument']>[0];
|
|
4
|
+
type GoogleGenAIClass = GoogleGenAIModule['GoogleGenAI'];
|
|
5
|
+
declare function instrumentGoogleGenAI(module: GoogleGenAIModule): GoogleGenAIClass;
|
|
6
|
+
|
|
7
|
+
export { instrumentGoogleGenAI };
|
package/dist/index.cjs
CHANGED
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkCQDWK43Acjs = require('./chunk-CQDWK43A.cjs');
|
|
38
38
|
require('./chunk-UNLNNKZ7.cjs');
|
|
39
|
-
require('./chunk-
|
|
39
|
+
require('./chunk-PXIW2K27.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
46
|
-
require('./chunk-
|
|
47
|
-
require('./chunk-
|
|
46
|
+
require('./chunk-EVRCHF74.cjs');
|
|
47
|
+
require('./chunk-77UGZGMP.cjs');
|
|
48
48
|
require('./chunk-OBGZSXTJ.cjs');
|
|
49
49
|
|
|
50
50
|
// src/internal/instrumentation/auto-init.ts
|
|
@@ -94,7 +94,7 @@ function loadGenAIInstrumentations() {
|
|
|
94
94
|
function loadMCPInstrumentation() {
|
|
95
95
|
void (async () => {
|
|
96
96
|
try {
|
|
97
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
97
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-HAUJ3G4Q.cjs")));
|
|
98
98
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
99
99
|
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
|
|
100
100
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -119,6 +119,20 @@ function loadVertexAIInstrumentation() {
|
|
|
119
119
|
}
|
|
120
120
|
})();
|
|
121
121
|
}
|
|
122
|
+
function loadGoogleGenAIInstrumentation() {
|
|
123
|
+
void (async () => {
|
|
124
|
+
try {
|
|
125
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-LMEZ62FB.cjs")));
|
|
126
|
+
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
127
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [googleGenAI] });
|
|
128
|
+
_chunkWC573FCIcjs.logger.debug("Auto-loaded Google GenAI instrumentation");
|
|
129
|
+
} catch (error) {
|
|
130
|
+
_chunkWC573FCIcjs.logger.debug(
|
|
131
|
+
`Google GenAI instrumentation not loaded (install @traceloop/instrumentation-google-generativeai if you want Gemini support): ${String(error)}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
}
|
|
122
136
|
function selectTelemetryRegister(ai) {
|
|
123
137
|
const register = _nullishCoalesce(ai.registerTelemetry, () => ( ai.registerTelemetryIntegration));
|
|
124
138
|
return typeof register === "function" ? register : void 0;
|
|
@@ -136,7 +150,7 @@ function loadVercelAITelemetry() {
|
|
|
136
150
|
}
|
|
137
151
|
const isV7 = typeof ai.registerTelemetry === "function";
|
|
138
152
|
const integrations = [];
|
|
139
|
-
const { createInterruptIntegration } = await Promise.resolve().then(() => _interopRequireWildcard(require("./interrupt-
|
|
153
|
+
const { createInterruptIntegration } = await Promise.resolve().then(() => _interopRequireWildcard(require("./interrupt-DM3AWSBX.cjs")));
|
|
140
154
|
integrations.push(createInterruptIntegration());
|
|
141
155
|
let otelCollectorLoaded = false;
|
|
142
156
|
try {
|
|
@@ -169,6 +183,7 @@ function autoInitializeInstrumentations() {
|
|
|
169
183
|
const genAIInstrumentations = loadGenAIInstrumentations();
|
|
170
184
|
loadMCPInstrumentation();
|
|
171
185
|
loadVertexAIInstrumentation();
|
|
186
|
+
loadGoogleGenAIInstrumentation();
|
|
172
187
|
loadVercelAITelemetry();
|
|
173
188
|
_chunkWC573FCIcjs.logger.info(
|
|
174
189
|
`Auto-initialization complete: ${genAIInstrumentations.length} GenAI instrumentations`
|
|
@@ -228,4 +243,4 @@ var init_exports = {};
|
|
|
228
243
|
|
|
229
244
|
|
|
230
245
|
|
|
231
|
-
exports.Brizz =
|
|
246
|
+
exports.Brizz = _chunkCQDWK43Acjs.Brizz; exports.DEFAULT_PII_PATTERNS = _chunkCQDWK43Acjs.DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = _chunkCQDWK43Acjs.Session; exports.SessionTitle = _chunkCQDWK43Acjs.SessionTitle; exports.SeverityNumber = _apilogs.SeverityNumber; exports.addExternalLink = _chunkCQDWK43Acjs.addExternalLink; exports.callWithMessageId = _chunkCQDWK43Acjs.callWithMessageId; exports.callWithMute = _chunkCQDWK43Acjs.callWithMute; exports.callWithOrganization = _chunkCQDWK43Acjs.callWithOrganization; exports.callWithProperties = _chunkCQDWK43Acjs.callWithProperties; exports.callWithSessionId = _chunkCQDWK43Acjs.callWithSessionId; exports.callWithUser = _chunkCQDWK43Acjs.callWithUser; exports.detectRuntime = _chunkCQDWK43Acjs.detectRuntime; exports.emitEvent = _chunkCQDWK43Acjs.emitEvent; exports.emitEventWithSessionId = _chunkCQDWK43Acjs.emitEventWithSessionId; exports.getActiveSession = _chunkCQDWK43Acjs.getActiveSession; exports.getLogLevel = _chunkWC573FCIcjs.getLogLevel; exports.getMetricsExporter = _chunkCQDWK43Acjs.getMetricsExporter; exports.getMetricsReader = _chunkCQDWK43Acjs.getMetricsReader; exports.getSpanExporter = _chunkCQDWK43Acjs.getSpanExporter; exports.getSpanProcessor = _chunkCQDWK43Acjs.getSpanProcessor; exports.init = init_exports; exports.logger = _chunkWC573FCIcjs.logger; exports.maskAttributes = _chunkCQDWK43Acjs.maskAttributes; exports.maskValue = _chunkCQDWK43Acjs.maskValue; exports.recordFeedback = _chunkCQDWK43Acjs.recordFeedback; exports.recordMetric = _chunkCQDWK43Acjs.recordMetric; exports.setCurrentSpanCustomProperties = _chunkCQDWK43Acjs.setCurrentSpanCustomProperties; exports.setLogLevel = _chunkWC573FCIcjs.setLogLevel; exports.setMessageId = _chunkCQDWK43Acjs.setMessageId; exports.setOrganization = _chunkCQDWK43Acjs.setOrganization; exports.setUser = _chunkCQDWK43Acjs.setUser; exports.startSession = _chunkCQDWK43Acjs.startSession; exports.startSessionTitle = _chunkCQDWK43Acjs.startSessionTitle; exports.withMessageId = _chunkCQDWK43Acjs.withMessageId; exports.withMute = _chunkCQDWK43Acjs.withMute; exports.withOrganization = _chunkCQDWK43Acjs.withOrganization; exports.withProperties = _chunkCQDWK43Acjs.withProperties; exports.withSessionId = _chunkCQDWK43Acjs.withSessionId; exports.withUser = _chunkCQDWK43Acjs.withUser;
|
package/dist/index.d.cts
CHANGED
|
@@ -25,6 +25,7 @@ interface IInstrumentModules {
|
|
|
25
25
|
cohere?: unknown;
|
|
26
26
|
google_vertexai?: unknown;
|
|
27
27
|
google_aiplatform?: unknown;
|
|
28
|
+
google_genai?: unknown;
|
|
28
29
|
bedrock?: unknown;
|
|
29
30
|
pinecone?: unknown;
|
|
30
31
|
langchain?: {
|
|
@@ -194,6 +195,7 @@ declare function withMessageId<F extends (this: any, ...args: any[]) => any>(id:
|
|
|
194
195
|
interface IMuteOptions {
|
|
195
196
|
input?: boolean;
|
|
196
197
|
output?: boolean;
|
|
198
|
+
tools?: boolean;
|
|
197
199
|
}
|
|
198
200
|
declare function callWithMute<A extends unknown[], F extends (...args: A) => ReturnType<F>>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
199
201
|
declare function withMute<F extends (this: any, ...args: any[]) => any>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>): F;
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ interface IInstrumentModules {
|
|
|
25
25
|
cohere?: unknown;
|
|
26
26
|
google_vertexai?: unknown;
|
|
27
27
|
google_aiplatform?: unknown;
|
|
28
|
+
google_genai?: unknown;
|
|
28
29
|
bedrock?: unknown;
|
|
29
30
|
pinecone?: unknown;
|
|
30
31
|
langchain?: {
|
|
@@ -194,6 +195,7 @@ declare function withMessageId<F extends (this: any, ...args: any[]) => any>(id:
|
|
|
194
195
|
interface IMuteOptions {
|
|
195
196
|
input?: boolean;
|
|
196
197
|
output?: boolean;
|
|
198
|
+
tools?: boolean;
|
|
197
199
|
}
|
|
198
200
|
declare function callWithMute<A extends unknown[], F extends (...args: A) => ReturnType<F>>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
199
201
|
declare function withMute<F extends (this: any, ...args: any[]) => any>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>): F;
|
package/dist/index.js
CHANGED
|
@@ -34,17 +34,17 @@ import {
|
|
|
34
34
|
withProperties,
|
|
35
35
|
withSessionId,
|
|
36
36
|
withUser
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-YNCBWOHM.js";
|
|
38
38
|
import "./chunk-7SUF4VVI.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-6OGRVH77.js";
|
|
40
40
|
import {
|
|
41
41
|
LogLevel,
|
|
42
42
|
getLogLevel,
|
|
43
43
|
logger,
|
|
44
44
|
setLogLevel
|
|
45
45
|
} from "./chunk-Y4HNUX3Q.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-EC3MYSRM.js";
|
|
47
|
+
import "./chunk-WII4R5RE.js";
|
|
48
48
|
import "./chunk-3RG5ZIWI.js";
|
|
49
49
|
|
|
50
50
|
// src/internal/instrumentation/auto-init.ts
|
|
@@ -94,7 +94,7 @@ function loadGenAIInstrumentations() {
|
|
|
94
94
|
function loadMCPInstrumentation() {
|
|
95
95
|
void (async () => {
|
|
96
96
|
try {
|
|
97
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
97
|
+
const { MCPInstrumentation } = await import("./mcp-ZCRMQV5L.js");
|
|
98
98
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
99
99
|
registerInstrumentations({ instrumentations: [mcp] });
|
|
100
100
|
logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -119,6 +119,20 @@ function loadVertexAIInstrumentation() {
|
|
|
119
119
|
}
|
|
120
120
|
})();
|
|
121
121
|
}
|
|
122
|
+
function loadGoogleGenAIInstrumentation() {
|
|
123
|
+
void (async () => {
|
|
124
|
+
try {
|
|
125
|
+
const { GoogleGenAIInstrumentation } = await import("./google-genai-T7I4FFIP.js");
|
|
126
|
+
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
127
|
+
registerInstrumentations({ instrumentations: [googleGenAI] });
|
|
128
|
+
logger.debug("Auto-loaded Google GenAI instrumentation");
|
|
129
|
+
} catch (error) {
|
|
130
|
+
logger.debug(
|
|
131
|
+
`Google GenAI instrumentation not loaded (install @traceloop/instrumentation-google-generativeai if you want Gemini support): ${String(error)}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
}
|
|
122
136
|
function selectTelemetryRegister(ai) {
|
|
123
137
|
const register = ai.registerTelemetry ?? ai.registerTelemetryIntegration;
|
|
124
138
|
return typeof register === "function" ? register : void 0;
|
|
@@ -136,7 +150,7 @@ function loadVercelAITelemetry() {
|
|
|
136
150
|
}
|
|
137
151
|
const isV7 = typeof ai.registerTelemetry === "function";
|
|
138
152
|
const integrations = [];
|
|
139
|
-
const { createInterruptIntegration } = await import("./interrupt-
|
|
153
|
+
const { createInterruptIntegration } = await import("./interrupt-YJVZK4VC.js");
|
|
140
154
|
integrations.push(createInterruptIntegration());
|
|
141
155
|
let otelCollectorLoaded = false;
|
|
142
156
|
try {
|
|
@@ -169,6 +183,7 @@ function autoInitializeInstrumentations() {
|
|
|
169
183
|
const genAIInstrumentations = loadGenAIInstrumentations();
|
|
170
184
|
loadMCPInstrumentation();
|
|
171
185
|
loadVertexAIInstrumentation();
|
|
186
|
+
loadGoogleGenAIInstrumentation();
|
|
172
187
|
loadVercelAITelemetry();
|
|
173
188
|
logger.info(
|
|
174
189
|
`Auto-initialization complete: ${genAIInstrumentations.length} GenAI instrumentations`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkEVRCHF74cjs = require('./chunk-EVRCHF74.cjs');
|
|
6
|
+
require('./chunk-77UGZGMP.cjs');
|
|
7
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.InterruptPropagator = _chunkEVRCHF74cjs.InterruptPropagator; exports._resetInterruptState = _chunkEVRCHF74cjs._resetInterruptState; exports.createInterruptIntegration = _chunkEVRCHF74cjs.createInterruptIntegration;
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
InterruptPropagator,
|
|
3
3
|
_resetInterruptState,
|
|
4
4
|
createInterruptIntegration
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-EC3MYSRM.js";
|
|
6
|
+
import "./chunk-WII4R5RE.js";
|
|
7
7
|
import "./chunk-3RG5ZIWI.js";
|
|
8
8
|
export {
|
|
9
9
|
InterruptPropagator,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPXIW2K27cjs = require('./chunk-PXIW2K27.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
@@ -8,7 +8,7 @@ var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk77UGZGMPcjs = require('./chunk-77UGZGMP.cjs');
|
|
12
12
|
require('./chunk-OBGZSXTJ.cjs');
|
|
13
13
|
|
|
14
14
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
@@ -139,7 +139,7 @@ function stampAndPropagateSession(span, sessionId, baseContext = _api.context.ac
|
|
|
139
139
|
}
|
|
140
140
|
if (span.isRecording()) {
|
|
141
141
|
try {
|
|
142
|
-
span.setAttribute(`${
|
|
142
|
+
span.setAttribute(`${_chunk77UGZGMPcjs.BRIZZ}.${_chunk77UGZGMPcjs.SESSION_ID}`, sessionId);
|
|
143
143
|
} catch (error) {
|
|
144
144
|
_chunkWC573FCIcjs.logger.warn(
|
|
145
145
|
`Brizz MCP: failed to stamp session id on span: ${String(error)}`
|
|
@@ -147,10 +147,10 @@ function stampAndPropagateSession(span, sessionId, baseContext = _api.context.ac
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
try {
|
|
150
|
-
const prev = baseContext.getValue(
|
|
151
|
-
const merged = prev ? { ...prev, [
|
|
150
|
+
const prev = baseContext.getValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY);
|
|
151
|
+
const merged = prev ? { ...prev, [_chunk77UGZGMPcjs.SESSION_ID]: sessionId } : { [_chunk77UGZGMPcjs.SESSION_ID]: sessionId };
|
|
152
152
|
return {
|
|
153
|
-
context: baseContext.setValue(
|
|
153
|
+
context: baseContext.setValue(_chunk77UGZGMPcjs.PROPERTIES_CONTEXT_KEY, merged),
|
|
154
154
|
sessionId
|
|
155
155
|
};
|
|
156
156
|
} catch (error) {
|
|
@@ -570,7 +570,7 @@ function safeEnd(span) {
|
|
|
570
570
|
|
|
571
571
|
// src/internal/instrumentation/mcp/version.ts
|
|
572
572
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
573
|
-
var INSTRUMENTATION_VERSION =
|
|
573
|
+
var INSTRUMENTATION_VERSION = _chunkPXIW2K27cjs.getSDKVersion.call(void 0, );
|
|
574
574
|
|
|
575
575
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
576
576
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSDKVersion
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6OGRVH77.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
6
|
} from "./chunk-Y4HNUX3Q.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
BRIZZ,
|
|
9
9
|
PROPERTIES_CONTEXT_KEY,
|
|
10
10
|
SESSION_ID
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WII4R5RE.js";
|
|
12
12
|
import "./chunk-3RG5ZIWI.js";
|
|
13
13
|
|
|
14
14
|
// src/internal/instrumentation/mcp/instrumentation.ts
|