@brizz/sdk 0.2.0 → 0.2.2

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +436 -0
  2. package/LICENSE +194 -20
  3. package/README.md +36 -1
  4. package/dist/{chunk-WC573FCI.cjs → chunk-C5OT6GAQ.cjs} +10 -2
  5. package/dist/{chunk-5HCG3JKU.js → chunk-CNEZA3WB.js} +5 -5
  6. package/dist/{chunk-Y4HNUX3Q.js → chunk-CZDPIJTO.js} +8 -0
  7. package/dist/{chunk-B5IY6O4N.js → chunk-DIOULRY4.js} +3 -2
  8. package/dist/{chunk-EZCNPWKM.js → chunk-GITAPIVL.js} +9 -9
  9. package/dist/{chunk-NF52RMLW.cjs → chunk-IWSFMCHH.cjs} +5 -1
  10. package/dist/{chunk-GISL4K6Z.js → chunk-JMX23OHO.js} +4 -0
  11. package/dist/{chunk-RD4XCYKT.cjs → chunk-PUOXH4CD.cjs} +6 -5
  12. package/dist/{chunk-CNVK5RA3.cjs → chunk-STMZ73NM.cjs} +13 -13
  13. package/dist/{chunk-4QNEI7VZ.cjs → chunk-UF4GMVEY.cjs} +142 -142
  14. package/dist/eve.cjs +2 -3
  15. package/dist/eve.js +1 -2
  16. package/dist/google-genai-KDEYFHTK.cjs +12 -0
  17. package/dist/{google-genai-3ERJNC7Q.js → google-genai-ZKKWSBVY.js} +4 -3
  18. package/dist/google-genai.cjs +3 -4
  19. package/dist/google-genai.js +2 -3
  20. package/dist/index.cjs +629 -306
  21. package/dist/index.js +410 -87
  22. package/dist/{mcp-5ERVMLSA.cjs → mcp-E5TPIVFI.cjs} +39 -40
  23. package/dist/{mcp-EJAJTGIC.js → mcp-SZSGMNBB.js} +5 -6
  24. package/dist/session.cjs +4 -5
  25. package/dist/session.js +3 -4
  26. package/dist/types/cjs/internal/instrumentation/auto-init.d.ts +0 -7
  27. package/dist/types/cjs/internal/instrumentation/google-genai.d.ts +1 -0
  28. package/dist/types/cjs/internal/instrumentation/registry.d.ts +2 -0
  29. package/dist/types/cjs/internal/instrumentation/vercel-ai/index.d.ts +28 -0
  30. package/dist/types/cjs/internal/instrumentation/vercel-ai/model-call-end.d.ts +1 -0
  31. package/dist/types/cjs/internal/masking/utils.d.ts +1 -1
  32. package/dist/types/cjs/internal/sdk.d.ts +1 -0
  33. package/dist/types/cjs/internal/semantic-conventions.d.ts +2 -0
  34. package/dist/types/esm/internal/instrumentation/auto-init.d.ts +0 -7
  35. package/dist/types/esm/internal/instrumentation/google-genai.d.ts +1 -0
  36. package/dist/types/esm/internal/instrumentation/registry.d.ts +2 -0
  37. package/dist/types/esm/internal/instrumentation/vercel-ai/index.d.ts +28 -0
  38. package/dist/types/esm/internal/instrumentation/vercel-ai/model-call-end.d.ts +1 -0
  39. package/dist/types/esm/internal/masking/utils.d.ts +1 -1
  40. package/dist/types/esm/internal/sdk.d.ts +1 -0
  41. package/dist/types/esm/internal/semantic-conventions.d.ts +2 -0
  42. package/package.json +36 -29
  43. package/dist/chunk-3RG5ZIWI.js +0 -10
  44. package/dist/chunk-6QXPHZEO.cjs +0 -130
  45. package/dist/chunk-GABRGNAU.js +0 -130
  46. package/dist/chunk-OBGZSXTJ.cjs +0 -10
  47. package/dist/google-genai-GVCKSJMR.cjs +0 -11
  48. package/dist/interrupt-36U5562Z.cjs +0 -12
  49. package/dist/interrupt-6BSXUK3O.js +0 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brizz/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "OpenTelemetry-based observability SDK for AI applications",
6
6
  "keywords": [
@@ -20,6 +20,11 @@
20
20
  ],
21
21
  "license": "Apache-2.0",
22
22
  "homepage": "https://www.brizz.ai",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/brizzai/brizz-js.git",
26
+ "directory": "typescript"
27
+ },
23
28
  "author": {
24
29
  "name": "Brizz",
25
30
  "email": "contact@brizz.ai",
@@ -31,7 +36,8 @@
31
36
  "files": [
32
37
  "dist",
33
38
  "LICENSE",
34
- "README.md"
39
+ "README.md",
40
+ "CHANGELOG.md"
35
41
  ],
36
42
  "scripts": {
37
43
  "build": "pnpm run clean && tsup && tsc -p tsconfig.dts.json && node scripts/emit-cjs-dts.mjs",
@@ -52,7 +58,7 @@
52
58
  "quality": "pnpm run lint && pnpm run format && pnpm run type-check && pnpm run test",
53
59
  "pack": "pnpm run build && pnpm pack",
54
60
  "changeset": "changeset",
55
- "changeset:version": "changeset version && pnpm install --lockfile-only",
61
+ "changeset:version": "changeset version && pnpm install --lockfile-only && node ../../dashboard/scripts/generate-sdk-changelogs.mjs",
56
62
  "changeset:publish": "pnpm build && changeset publish",
57
63
  "changeset:status": "changeset status --verbose",
58
64
  "prerelease:enter": "changeset pre enter",
@@ -115,33 +121,34 @@
115
121
  "registry": "https://registry.npmjs.org/"
116
122
  },
117
123
  "devDependencies": {
118
- "@ai-sdk/anthropic": "^4.0.99",
119
- "@ai-sdk/openai": "^4.0.111",
120
- "@ai-sdk/otel": "^1.0.165",
124
+ "@ai-sdk/anthropic": "^4.0.105",
125
+ "@ai-sdk/openai": "^4.0.118",
126
+ "@ai-sdk/otel": "^1.0.173",
121
127
  "@arethetypeswrong/cli": "^0.18.5",
122
- "@arizeai/openinference-instrumentation-mcp": "^0.2.37",
123
- "@babel/core": "^8.1.0",
128
+ "@arizeai/openinference-instrumentation-mcp": "^0.2.39",
129
+ "@babel/core": "^8.1.2",
124
130
  "@babel/preset-env": "^8.0.7",
125
131
  "@babel/preset-typescript": "^8.0.7",
126
- "@changesets/changelog-github": "^1.0.1",
127
132
  "@changesets/cli": "^3.0.3",
128
- "@google/genai": "^2.32.0",
129
- "@langchain/core": "^1.3.5",
130
- "@langchain/langgraph": "^1.7.2",
133
+ "@google/genai": "^3.3.0",
134
+ "@langchain/core": "^1.4.1",
135
+ "@langchain/langgraph": "^1.7.4",
131
136
  "@modelcontextprotocol/sdk": "^1.32.2",
132
137
  "@traceloop/instrumentation-google-generativeai": "^0.27.0",
133
138
  "@traceloop/instrumentation-vertexai": "^0.27.0",
134
139
  "@types/jest": "^30.0.0",
135
140
  "@types/node": "^26.6.6",
141
+ "@types/semver": "^7.8.0",
136
142
  "@typesafe-ai/sdk": "^0.7.0",
137
- "ai": "^7.0.165",
143
+ "ai": "^7.0.173",
138
144
  "babel-jest": "^30.5.2",
139
145
  "babel-plugin-transform-import-meta": "^3.1.0",
140
146
  "jest": "^30.5.2",
141
147
  "jest-environment-jsdom": "^30.5.2",
142
- "openai": "^7.53.0",
143
- "oxlint": "^1.92.0",
144
- "prettier": "^3.9.10",
148
+ "openai": "^7.57.0",
149
+ "oxlint": "^1.93.0",
150
+ "prettier": "^3.10.1",
151
+ "semver": "^7.8.6",
145
152
  "tsup": "^9.0.0",
146
153
  "typescript": "^7.0.2",
147
154
  "vitest": "^5.1.0",
@@ -192,20 +199,20 @@
192
199
  }
193
200
  },
194
201
  "dependencies": {
195
- "@arizeai/openinference-instrumentation-langchain": "^4.1.5",
202
+ "@arizeai/openinference-instrumentation-langchain": "^4.2.1",
196
203
  "@arizeai/openinference-instrumentation-openai": "^2.3.1",
197
204
  "@opentelemetry/api": "^1.10.0",
198
- "@opentelemetry/context-async-hooks": "^3.1.0",
199
- "@opentelemetry/core": "^3.1.0",
200
- "@opentelemetry/exporter-logs-otlp-http": "^0.301.0",
201
- "@opentelemetry/exporter-metrics-otlp-http": "^0.301.0",
202
- "@opentelemetry/exporter-trace-otlp-http": "^0.301.0",
203
- "@opentelemetry/exporter-trace-otlp-proto": "^0.301.0",
204
- "@opentelemetry/instrumentation": "^0.301.0",
205
- "@opentelemetry/resources": "^3.1.0",
206
- "@opentelemetry/sdk-logs": "^3.1.0",
207
- "@opentelemetry/sdk-metrics": "^3.1.0",
208
- "@opentelemetry/sdk-trace": "^3.1.0",
205
+ "@opentelemetry/context-async-hooks": "^3.1.1",
206
+ "@opentelemetry/core": "^3.1.1",
207
+ "@opentelemetry/exporter-logs-otlp-http": "^0.301.2",
208
+ "@opentelemetry/exporter-metrics-otlp-http": "^0.301.2",
209
+ "@opentelemetry/exporter-trace-otlp-http": "^0.301.2",
210
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.301.2",
211
+ "@opentelemetry/instrumentation": "^0.301.2",
212
+ "@opentelemetry/resources": "^3.1.1",
213
+ "@opentelemetry/sdk-logs": "^3.1.1",
214
+ "@opentelemetry/sdk-metrics": "^3.1.1",
215
+ "@opentelemetry/sdk-trace": "^3.1.1",
209
216
  "@opentelemetry/semantic-conventions": "^1.45.0",
210
217
  "@traceloop/ai-semantic-conventions": "^0.27.0",
211
218
  "@traceloop/instrumentation-anthropic": "^0.27.0",
@@ -223,7 +230,7 @@
223
230
  "packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef",
224
231
  "pnpm": {
225
232
  "overrides": {
226
- "@babel/core": "^8.1.0",
233
+ "@babel/core": "^8.1.2",
227
234
  "@opentelemetry/core@<2.12.0": "^2.12.0"
228
235
  },
229
236
  "updateConfig": {
@@ -1,10 +0,0 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
- export {
9
- __require
10
- };
@@ -1,130 +0,0 @@
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
-
3
- var _chunkNF52RMLWcjs = require('./chunk-NF52RMLW.cjs');
4
-
5
- // src/internal/instrumentation/vercel-ai/interrupt.ts
6
- var _api = require('@opentelemetry/api');
7
- var INNER_OPERATION_IDS = /* @__PURE__ */ new Set([
8
- "ai.generateText.doGenerate",
9
- "ai.streamText.doStream"
10
- ]);
11
- function isInnerLLMSpan(span) {
12
- if (INNER_OPERATION_IDS.has(span.name)) {
13
- return true;
14
- }
15
- const opId = span.attributes["ai.operationId"];
16
- return typeof opId === "string" && INNER_OPERATION_IDS.has(opId);
17
- }
18
- var MAX_PENDING_ENTRIES = 1024;
19
- var pendingByParentSpanId = /* @__PURE__ */ new Map();
20
- var needsApprovalToolNames = /* @__PURE__ */ new Set();
21
- var versionState = { sawActiveSpan: false };
22
- function setPending(parentSpanId, value) {
23
- pendingByParentSpanId.set(parentSpanId, value);
24
- while (pendingByParentSpanId.size > MAX_PENDING_ENTRIES) {
25
- const oldest = pendingByParentSpanId.keys().next().value;
26
- if (oldest === void 0) {
27
- break;
28
- }
29
- pendingByParentSpanId.delete(oldest);
30
- }
31
- }
32
- function extractInterruptTools(tools) {
33
- if (!tools || typeof tools !== "object") {
34
- return [];
35
- }
36
- return Object.entries(tools).filter(
37
- ([, t]) => !!t && typeof t === "object" && t.needsApproval
38
- ).map(([name]) => name);
39
- }
40
- function parsePromptToolNames(raw) {
41
- if (!Array.isArray(raw)) {
42
- return null;
43
- }
44
- const names = [];
45
- for (const element of raw) {
46
- if (typeof element !== "string") {
47
- continue;
48
- }
49
- try {
50
- const parsed = JSON.parse(element);
51
- if (parsed && typeof parsed.name === "string") {
52
- names.push(parsed.name);
53
- }
54
- } catch (e) {
55
- }
56
- }
57
- return names.length > 0 ? names : null;
58
- }
59
- function createInterruptIntegration() {
60
- const onStart = (event) => {
61
- for (const name of extractInterruptTools(event.tools)) {
62
- needsApprovalToolNames.add(name);
63
- }
64
- };
65
- const onStepStart = (event) => {
66
- const span = _api.trace.getActiveSpan();
67
- if (span) {
68
- versionState.sawActiveSpan = true;
69
- }
70
- const names = extractInterruptTools(event.tools);
71
- if (names.length === 0) {
72
- return;
73
- }
74
- for (const name of names) {
75
- needsApprovalToolNames.add(name);
76
- }
77
- if (!span) {
78
- return;
79
- }
80
- const value = JSON.stringify(names);
81
- span.setAttribute(_chunkNF52RMLWcjs.INTERRUPT_TOOLS, value);
82
- setPending(span.spanContext().spanId, value);
83
- };
84
- return {
85
- onStart,
86
- onStepStart
87
- };
88
- }
89
- var InterruptPropagator = class {
90
- onStart(span, _parentContext) {
91
- if (!isInnerLLMSpan(span)) {
92
- return;
93
- }
94
- const parentSpanId = _optionalChain([span, 'access', _ => _.parentSpanContext, 'optionalAccess', _2 => _2.spanId]);
95
- const stashed = parentSpanId && pendingByParentSpanId.get(parentSpanId);
96
- if (stashed) {
97
- span.setAttribute(_chunkNF52RMLWcjs.INTERRUPT_TOOLS, stashed);
98
- pendingByParentSpanId.delete(parentSpanId);
99
- return;
100
- }
101
- if (versionState.sawActiveSpan || needsApprovalToolNames.size === 0) {
102
- return;
103
- }
104
- const scoped = parsePromptToolNames(span.attributes["ai.prompt.tools"]);
105
- const names = scoped === null ? [...needsApprovalToolNames] : scoped.filter((n) => needsApprovalToolNames.has(n));
106
- if (names.length > 0) {
107
- span.setAttribute(_chunkNF52RMLWcjs.INTERRUPT_TOOLS, JSON.stringify(names));
108
- }
109
- }
110
- onEnd() {
111
- }
112
- async shutdown() {
113
- }
114
- async forceFlush() {
115
- }
116
- };
117
- function _resetInterruptState() {
118
- if (process.env["NODE_ENV"] !== "test") {
119
- return;
120
- }
121
- pendingByParentSpanId.clear();
122
- needsApprovalToolNames.clear();
123
- versionState.sawActiveSpan = false;
124
- }
125
-
126
-
127
-
128
-
129
-
130
- exports.createInterruptIntegration = createInterruptIntegration; exports.InterruptPropagator = InterruptPropagator; exports._resetInterruptState = _resetInterruptState;
@@ -1,130 +0,0 @@
1
- import {
2
- INTERRUPT_TOOLS
3
- } from "./chunk-GISL4K6Z.js";
4
-
5
- // src/internal/instrumentation/vercel-ai/interrupt.ts
6
- import { trace } from "@opentelemetry/api";
7
- var INNER_OPERATION_IDS = /* @__PURE__ */ new Set([
8
- "ai.generateText.doGenerate",
9
- "ai.streamText.doStream"
10
- ]);
11
- function isInnerLLMSpan(span) {
12
- if (INNER_OPERATION_IDS.has(span.name)) {
13
- return true;
14
- }
15
- const opId = span.attributes["ai.operationId"];
16
- return typeof opId === "string" && INNER_OPERATION_IDS.has(opId);
17
- }
18
- var MAX_PENDING_ENTRIES = 1024;
19
- var pendingByParentSpanId = /* @__PURE__ */ new Map();
20
- var needsApprovalToolNames = /* @__PURE__ */ new Set();
21
- var versionState = { sawActiveSpan: false };
22
- function setPending(parentSpanId, value) {
23
- pendingByParentSpanId.set(parentSpanId, value);
24
- while (pendingByParentSpanId.size > MAX_PENDING_ENTRIES) {
25
- const oldest = pendingByParentSpanId.keys().next().value;
26
- if (oldest === void 0) {
27
- break;
28
- }
29
- pendingByParentSpanId.delete(oldest);
30
- }
31
- }
32
- function extractInterruptTools(tools) {
33
- if (!tools || typeof tools !== "object") {
34
- return [];
35
- }
36
- return Object.entries(tools).filter(
37
- ([, t]) => !!t && typeof t === "object" && t.needsApproval
38
- ).map(([name]) => name);
39
- }
40
- function parsePromptToolNames(raw) {
41
- if (!Array.isArray(raw)) {
42
- return null;
43
- }
44
- const names = [];
45
- for (const element of raw) {
46
- if (typeof element !== "string") {
47
- continue;
48
- }
49
- try {
50
- const parsed = JSON.parse(element);
51
- if (parsed && typeof parsed.name === "string") {
52
- names.push(parsed.name);
53
- }
54
- } catch {
55
- }
56
- }
57
- return names.length > 0 ? names : null;
58
- }
59
- function createInterruptIntegration() {
60
- const onStart = (event) => {
61
- for (const name of extractInterruptTools(event.tools)) {
62
- needsApprovalToolNames.add(name);
63
- }
64
- };
65
- const onStepStart = (event) => {
66
- const span = trace.getActiveSpan();
67
- if (span) {
68
- versionState.sawActiveSpan = true;
69
- }
70
- const names = extractInterruptTools(event.tools);
71
- if (names.length === 0) {
72
- return;
73
- }
74
- for (const name of names) {
75
- needsApprovalToolNames.add(name);
76
- }
77
- if (!span) {
78
- return;
79
- }
80
- const value = JSON.stringify(names);
81
- span.setAttribute(INTERRUPT_TOOLS, value);
82
- setPending(span.spanContext().spanId, value);
83
- };
84
- return {
85
- onStart,
86
- onStepStart
87
- };
88
- }
89
- var InterruptPropagator = class {
90
- onStart(span, _parentContext) {
91
- if (!isInnerLLMSpan(span)) {
92
- return;
93
- }
94
- const parentSpanId = span.parentSpanContext?.spanId;
95
- const stashed = parentSpanId && pendingByParentSpanId.get(parentSpanId);
96
- if (stashed) {
97
- span.setAttribute(INTERRUPT_TOOLS, stashed);
98
- pendingByParentSpanId.delete(parentSpanId);
99
- return;
100
- }
101
- if (versionState.sawActiveSpan || needsApprovalToolNames.size === 0) {
102
- return;
103
- }
104
- const scoped = parsePromptToolNames(span.attributes["ai.prompt.tools"]);
105
- const names = scoped === null ? [...needsApprovalToolNames] : scoped.filter((n) => needsApprovalToolNames.has(n));
106
- if (names.length > 0) {
107
- span.setAttribute(INTERRUPT_TOOLS, JSON.stringify(names));
108
- }
109
- }
110
- onEnd() {
111
- }
112
- async shutdown() {
113
- }
114
- async forceFlush() {
115
- }
116
- };
117
- function _resetInterruptState() {
118
- if (process.env["NODE_ENV"] !== "test") {
119
- return;
120
- }
121
- pendingByParentSpanId.clear();
122
- needsApprovalToolNames.clear();
123
- versionState.sawActiveSpan = false;
124
- }
125
-
126
- export {
127
- createInterruptIntegration,
128
- InterruptPropagator,
129
- _resetInterruptState
130
- };
@@ -1,10 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined") return require.apply(this, arguments);
5
- throw Error('Dynamic require of "' + x + '" is not supported');
6
- });
7
-
8
-
9
-
10
- exports.__require = __require;
@@ -1,11 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkRD4XCYKTcjs = require('./chunk-RD4XCYKT.cjs');
5
- require('./chunk-DC2MFO65.cjs');
6
- require('./chunk-WC573FCI.cjs');
7
- require('./chunk-OBGZSXTJ.cjs');
8
-
9
-
10
-
11
- exports.GoogleGenAIInstrumentation = _chunkRD4XCYKTcjs.GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = _chunkRD4XCYKTcjs.instrumentGoogleGenAI;
@@ -1,12 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
- var _chunk6QXPHZEOcjs = require('./chunk-6QXPHZEO.cjs');
6
- require('./chunk-NF52RMLW.cjs');
7
- require('./chunk-OBGZSXTJ.cjs');
8
-
9
-
10
-
11
-
12
- exports.InterruptPropagator = _chunk6QXPHZEOcjs.InterruptPropagator; exports._resetInterruptState = _chunk6QXPHZEOcjs._resetInterruptState; exports.createInterruptIntegration = _chunk6QXPHZEOcjs.createInterruptIntegration;
@@ -1,12 +0,0 @@
1
- import {
2
- InterruptPropagator,
3
- _resetInterruptState,
4
- createInterruptIntegration
5
- } from "./chunk-GABRGNAU.js";
6
- import "./chunk-GISL4K6Z.js";
7
- import "./chunk-3RG5ZIWI.js";
8
- export {
9
- InterruptPropagator,
10
- _resetInterruptState,
11
- createInterruptIntegration
12
- };