@brizz/sdk 0.1.35 → 0.1.37
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 +6 -1
- package/dist/{chunk-HZOBDXDS.cjs → chunk-2DSTZTDA.cjs} +1 -1
- package/dist/{chunk-KP3KG66W.js → chunk-4Q2CRWI6.js} +31 -7
- package/dist/{chunk-NEF2O7HF.cjs → chunk-77UGZGMP.cjs} +3 -1
- package/dist/{chunk-24CEDVD2.js → chunk-EC3MYSRM.js} +1 -1
- package/dist/{chunk-M3UGFLH7.cjs → chunk-EVRCHF74.cjs} +4 -4
- package/dist/{chunk-D27LNW3M.cjs → chunk-O5DVPC42.cjs} +156 -132
- package/dist/{chunk-GSKXPOLQ.js → chunk-OR3YPY4I.js} +1 -1
- package/dist/{chunk-QY4VADPP.js → chunk-WII4R5RE.js} +2 -0
- package/dist/index.cjs +14 -9
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -8
- package/dist/interrupt-DM3AWSBX.cjs +12 -0
- package/dist/{interrupt-KADNA6WK.js → interrupt-YJVZK4VC.js} +2 -2
- package/dist/{mcp-EJNZYON6.js → mcp-7Y3O5QSS.js} +2 -2
- package/dist/{mcp-KAYXU4AU.cjs → mcp-NC5OXRT4.cjs} +7 -7
- package/dist/preload.cjs +7 -7
- package/dist/preload.js +4 -4
- package/package.json +11 -11
- package/dist/interrupt-7MWQCOY3.cjs +0 -12
package/README.md
CHANGED
|
@@ -672,7 +672,7 @@ warnings, and is less prone to `this` binding issues.
|
|
|
672
672
|
|
|
673
673
|
## Mute Messages
|
|
674
674
|
|
|
675
|
-
Keep internal or unrelated LLM calls — summarization, title generation, classification, guardrail checks — out of the captured conversation. The call still runs and its telemetry (latency, tokens, cost) is recorded; only the
|
|
675
|
+
Keep internal or unrelated LLM calls — summarization, title generation, classification, guardrail checks — out of the captured conversation. The call still runs and its telemetry (latency, tokens, cost) is recorded; only the content is left out — the prompt, the reply, and the tool calls.
|
|
676
676
|
|
|
677
677
|
```typescript
|
|
678
678
|
import { callWithMute, withMute } from '@brizz/sdk';
|
|
@@ -683,10 +683,15 @@ await callWithMute({}, () => agent.run('Summarize this conversation for internal
|
|
|
683
683
|
// Keep the assistant reply, drop the prompt
|
|
684
684
|
await callWithMute({ output: false }, () => agent.run('…a long internal prompt…'));
|
|
685
685
|
|
|
686
|
+
// Keep the tool calls, drop the prompt and the reply
|
|
687
|
+
await callWithMute({ tools: false }, () => agent.run('…a long internal prompt…'));
|
|
688
|
+
|
|
686
689
|
// Pre-wrap a function to reuse the same muting
|
|
687
690
|
const muteTitle = withMute({}, agent.run, agent);
|
|
688
691
|
```
|
|
689
692
|
|
|
693
|
+
`tools` covers tool calls and their results. Leave it out and it follows `output`.
|
|
694
|
+
|
|
690
695
|
## Deployment Environment
|
|
691
696
|
|
|
692
697
|
Optionally specify the deployment environment for better filtering and organization:
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-7SUF4VVI.js";
|
|
5
5
|
import {
|
|
6
6
|
getSDKVersion
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-OR3YPY4I.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,18 +65,18 @@ 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";
|
|
71
72
|
|
|
72
73
|
// src/internal/instrumentation/registry.ts
|
|
74
|
+
import { OpenAIInstrumentation } from "@arizeai/openinference-instrumentation-openai";
|
|
73
75
|
import { AnthropicInstrumentation } from "@traceloop/instrumentation-anthropic";
|
|
74
76
|
import { BedrockInstrumentation } from "@traceloop/instrumentation-bedrock";
|
|
75
77
|
import { ChromaDBInstrumentation } from "@traceloop/instrumentation-chromadb";
|
|
76
78
|
import { CohereInstrumentation } from "@traceloop/instrumentation-cohere";
|
|
77
79
|
import { LlamaIndexInstrumentation } from "@traceloop/instrumentation-llamaindex";
|
|
78
|
-
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";
|
|
79
80
|
import { PineconeInstrumentation } from "@traceloop/instrumentation-pinecone";
|
|
80
81
|
import { QdrantInstrumentation } from "@traceloop/instrumentation-qdrant";
|
|
81
82
|
import { TogetherInstrumentation } from "@traceloop/instrumentation-together";
|
|
@@ -111,8 +112,17 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
111
112
|
* @private
|
|
112
113
|
*/
|
|
113
114
|
loadManualInstrumentations(instrumentations, exceptionLogger) {
|
|
115
|
+
if (this.manualModules?.openAI) {
|
|
116
|
+
try {
|
|
117
|
+
const openAIInst = new OpenAIInstrumentation();
|
|
118
|
+
openAIInst.manuallyInstrument(this.manualModules.openAI);
|
|
119
|
+
instrumentations.push(openAIInst);
|
|
120
|
+
logger.debug("Manual instrumentation enabled for OpenAI");
|
|
121
|
+
} catch (error) {
|
|
122
|
+
logger.error(`Failed to load OpenAI instrumentation: ${String(error)}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
114
125
|
const instrumentationConfigs = [
|
|
115
|
-
{ class: OpenAIInstrumentation, name: "OpenAI", module: this.manualModules?.openAI },
|
|
116
126
|
{ class: AnthropicInstrumentation, name: "Anthropic", module: this.manualModules?.anthropic },
|
|
117
127
|
{ class: CohereInstrumentation, name: "Cohere", module: this.manualModules?.cohere },
|
|
118
128
|
{ class: BedrockInstrumentation, name: "Bedrock", module: this.manualModules?.bedrock },
|
|
@@ -189,7 +199,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
189
199
|
const mcpModules = this.manualModules.mcp;
|
|
190
200
|
void (async () => {
|
|
191
201
|
try {
|
|
192
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
202
|
+
const { MCPInstrumentation } = await import("./mcp-7Y3O5QSS.js");
|
|
193
203
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
194
204
|
instrumentation.manuallyInstrument(mcpModules);
|
|
195
205
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1089,8 +1099,12 @@ function callWithMessageId(id, fn, thisArg, ...args) {
|
|
|
1089
1099
|
function withMessageId(id, fn, thisArg) {
|
|
1090
1100
|
return withProperties({ [MESSAGE_ID]: id }, fn, thisArg);
|
|
1091
1101
|
}
|
|
1102
|
+
function inheritedMuteTools() {
|
|
1103
|
+
const properties = context2.active().getValue(PROPERTIES_CONTEXT_KEY);
|
|
1104
|
+
return properties?.[MUTE_TOOLS];
|
|
1105
|
+
}
|
|
1092
1106
|
function muteProperties(options) {
|
|
1093
|
-
const { input = true, output = true } = options;
|
|
1107
|
+
const { input = true, output = true, tools = output } = options;
|
|
1094
1108
|
const properties = {};
|
|
1095
1109
|
if (input) {
|
|
1096
1110
|
properties[MUTE_INPUT] = "true";
|
|
@@ -1098,6 +1112,16 @@ function muteProperties(options) {
|
|
|
1098
1112
|
if (output) {
|
|
1099
1113
|
properties[MUTE_OUTPUT] = "true";
|
|
1100
1114
|
}
|
|
1115
|
+
if (tools !== output) {
|
|
1116
|
+
properties[MUTE_TOOLS] = String(tools);
|
|
1117
|
+
} else {
|
|
1118
|
+
const inherited = inheritedMuteTools();
|
|
1119
|
+
if (tools && inherited === "false") {
|
|
1120
|
+
properties[MUTE_TOOLS] = "true";
|
|
1121
|
+
} else if (options.tools === false && inherited === "true") {
|
|
1122
|
+
properties[MUTE_TOOLS] = "false";
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1101
1125
|
return properties;
|
|
1102
1126
|
}
|
|
1103
1127
|
function callWithMute(options, fn, thisArg, ...args) {
|
|
@@ -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";
|
|
@@ -114,4 +115,5 @@ var METRIC_POLARITY_NEGATIVE = "negative";
|
|
|
114
115
|
|
|
115
116
|
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
|
|
119
|
+
exports.BRIZZ = BRIZZ; exports.SESSION_ID = SESSION_ID; exports.PROPERTIES_CONTEXT_KEY = PROPERTIES_CONTEXT_KEY; exports.SESSION_OBJECT_CONTEXT_KEY = SESSION_OBJECT_CONTEXT_KEY; exports.SESSION_INPUT = SESSION_INPUT; exports.SESSION_OUTPUT = SESSION_OUTPUT; exports.SESSION_INPUT_CONTEXT = SESSION_INPUT_CONTEXT; exports.SESSION_OUTPUT_CONTEXT = SESSION_OUTPUT_CONTEXT; exports.SESSION_SPAN_NAME = SESSION_SPAN_NAME; exports.MUTE_INPUT = MUTE_INPUT; exports.MUTE_OUTPUT = MUTE_OUTPUT; exports.MUTE_TOOLS = MUTE_TOOLS; exports.USER_ID = USER_ID; exports.USER_EMAIL = USER_EMAIL; exports.USER_NAME = USER_NAME; exports.USER_ROLE = USER_ROLE; exports.USER_PLAN = USER_PLAN; exports.ORGANIZATION_ID = ORGANIZATION_ID; exports.ORGANIZATION_NAME = ORGANIZATION_NAME; exports.ORGANIZATION_PLAN = ORGANIZATION_PLAN; exports.ORGANIZATION_DOMAIN = ORGANIZATION_DOMAIN; exports.MESSAGE_ID = MESSAGE_ID; exports.SESSION_TITLE_SPAN_NAME = SESSION_TITLE_SPAN_NAME; exports.SESSION_TITLE_GENERATION = SESSION_TITLE_GENERATION; exports.SESSION_TITLE = SESSION_TITLE; exports.INTERRUPT_TOOLS = INTERRUPT_TOOLS; exports.INTERNAL_EVENT_PREFIX = INTERNAL_EVENT_PREFIX; exports.EXTERNAL_LINK_EVENT_NAME = EXTERNAL_LINK_EVENT_NAME; exports.EXTERNAL_LINK_URL = EXTERNAL_LINK_URL; exports.EXTERNAL_LINK_TITLE = EXTERNAL_LINK_TITLE; exports.EXTERNAL_LINK_TYPE = EXTERNAL_LINK_TYPE; exports.FEEDBACK_EVENT_NAME = FEEDBACK_EVENT_NAME; exports.FEEDBACK_TYPE = FEEDBACK_TYPE; exports.FEEDBACK_SCORE = FEEDBACK_SCORE; exports.FEEDBACK_REASON = FEEDBACK_REASON; exports.FEEDBACK_COMMENT = FEEDBACK_COMMENT; exports.FEEDBACK_SOURCE = FEEDBACK_SOURCE; exports.FEEDBACK_ATTR_PREFIX = FEEDBACK_ATTR_PREFIX; exports.METRIC_EVENT_NAME = METRIC_EVENT_NAME; exports.METRIC_NAME = METRIC_NAME; exports.METRIC_VALUE = METRIC_VALUE; exports.METRIC_UNIT = METRIC_UNIT; exports.METRIC_COMMENT = METRIC_COMMENT; exports.METRIC_POLARITY = METRIC_POLARITY; exports.METRIC_MIN = METRIC_MIN; exports.METRIC_MAX = METRIC_MAX; exports.METRIC_TIMESTAMP = METRIC_TIMESTAMP; exports.METRIC_ATTRIBUTE_PREFIX = METRIC_ATTRIBUTE_PREFIX; exports.RESERVED_METRIC_NAMES = RESERVED_METRIC_NAMES; exports.METRIC_POLARITY_POSITIVE = METRIC_POLARITY_POSITIVE; exports.METRIC_POLARITY_NEGATIVE = METRIC_POLARITY_NEGATIVE;
|
|
@@ -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() {
|