@brizz/sdk 0.1.52 → 0.1.53

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.
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunk2T7OEV33cjs = require('./chunk-2T7OEV33.cjs');
11
+ var _chunkSTTOBCTPcjs = require('./chunk-STTOBCTP.cjs');
12
12
 
13
13
 
14
14
  var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
@@ -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 && _chunk2T7OEV33cjs.isSessionToolCall.call(void 0, request)) {
390
+ if (method === METHOD_TOOLS_CALL && _chunkSTTOBCTPcjs.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 = _chunk2T7OEV33cjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunk2T7OEV33cjs.popTrackingArguments.call(void 0, request) : {};
397
+ const tracking = _chunkSTTOBCTPcjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkSTTOBCTPcjs.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 (_chunk2T7OEV33cjs.isEnabled.call(void 0, )) {
407
+ if (_chunkSTTOBCTPcjs.isEnabled.call(void 0, )) {
408
408
  try {
409
- advertised = _chunk2T7OEV33cjs.patchListToolsResult.call(void 0, result);
409
+ advertised = _chunkSTTOBCTPcjs.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
- _chunk2T7OEV33cjs.resolveTransportSessionId.call(void 0, this),
420
+ _chunkSTTOBCTPcjs.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
- _chunk2T7OEV33cjs.stampAndPropagateSession.call(void 0, span, _chunk2T7OEV33cjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
433
+ _chunkSTTOBCTPcjs.stampAndPropagateSession.call(void 0, span, _chunkSTTOBCTPcjs.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 } = _chunk2T7OEV33cjs.sessionToolResult.call(void 0, );
467
+ const { id, result } = _chunkSTTOBCTPcjs.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, () => ( _chunk2T7OEV33cjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
558
- const { context: sessCtx } = _chunk2T7OEV33cjs.stampAndPropagateSession.call(void 0,
557
+ const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkSTTOBCTPcjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
558
+ const { context: sessCtx } = _chunkSTTOBCTPcjs.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 = _chunk2T7OEV33cjs.getSDKVersion.call(void 0, );
614
+ var INSTRUMENTATION_VERSION = _chunkSTTOBCTPcjs.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";
@@ -16,6 +16,7 @@ export interface IInstrumentModules {
16
16
  chromadb?: unknown;
17
17
  qdrant?: unknown;
18
18
  together?: unknown;
19
+ typesafe?: unknown;
19
20
  mcp?: IMCPManualModules;
20
21
  }
21
22
  export type { IMCPManualModules } from './mcp/types.js';
@@ -0,0 +1,34 @@
1
+ import type { Tracer } from '@opentelemetry/api';
2
+ import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
3
+ import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
4
+ export declare const INSTRUMENTATION_NAME = "@brizz/sdk/typesafe";
5
+ export declare const SPAN_NAME = "typesafe.system_one";
6
+ export declare const PROVIDER_NAME = "typesafe";
7
+ export declare const OPERATION_NAME = "classify";
8
+ export declare const ATTR_OPERATION_NAME = "gen_ai.operation.name";
9
+ export declare const ATTR_PROVIDER_NAME = "gen_ai.provider.name";
10
+ export declare const ATTR_REQUEST_MODEL = "gen_ai.request.model";
11
+ export declare const ATTR_RESPONSE_MODEL = "gen_ai.response.model";
12
+ export declare const ATTR_INPUT_TOKENS = "gen_ai.usage.input_tokens";
13
+ export declare const ATTR_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
14
+ export declare const ATTR_INPUT_MESSAGES = "gen_ai.input.messages";
15
+ export declare const ATTR_QUESTIONS = "typesafe.questions";
16
+ export declare const ATTR_ANSWERS = "typesafe.answers";
17
+ interface ISystemOneRequestLike {
18
+ state?: unknown;
19
+ questions?: Record<string, unknown>;
20
+ model?: unknown;
21
+ }
22
+ type SystemOne = (this: ITypeSafeClientLike, request: ISystemOneRequestLike, ...rest: unknown[]) => unknown;
23
+ interface ITypeSafeClientLike {
24
+ systemOne: SystemOne;
25
+ }
26
+ export declare class TypeSafeInstrumentation extends InstrumentationBase<InstrumentationConfig> {
27
+ constructor(config?: InstrumentationConfig);
28
+ protected init(): InstrumentationNodeModuleDefinition[];
29
+ manuallyInstrument(moduleExports: unknown): void;
30
+ }
31
+ export declare function patchInstalledTypeSafe(): void;
32
+ export declare function isSupportedVersion(version: string): boolean;
33
+ export declare function patchSystemOne(proto: ITypeSafeClientLike, getTracer: () => Tracer): boolean;
34
+ export {};
@@ -16,6 +16,7 @@ export interface IInstrumentModules {
16
16
  chromadb?: unknown;
17
17
  qdrant?: unknown;
18
18
  together?: unknown;
19
+ typesafe?: unknown;
19
20
  mcp?: IMCPManualModules;
20
21
  }
21
22
  export type { IMCPManualModules } from './mcp/types.js';
@@ -0,0 +1,34 @@
1
+ import type { Tracer } from '@opentelemetry/api';
2
+ import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
3
+ import { InstrumentationBase, InstrumentationNodeModuleDefinition } from '@opentelemetry/instrumentation';
4
+ export declare const INSTRUMENTATION_NAME = "@brizz/sdk/typesafe";
5
+ export declare const SPAN_NAME = "typesafe.system_one";
6
+ export declare const PROVIDER_NAME = "typesafe";
7
+ export declare const OPERATION_NAME = "classify";
8
+ export declare const ATTR_OPERATION_NAME = "gen_ai.operation.name";
9
+ export declare const ATTR_PROVIDER_NAME = "gen_ai.provider.name";
10
+ export declare const ATTR_REQUEST_MODEL = "gen_ai.request.model";
11
+ export declare const ATTR_RESPONSE_MODEL = "gen_ai.response.model";
12
+ export declare const ATTR_INPUT_TOKENS = "gen_ai.usage.input_tokens";
13
+ export declare const ATTR_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
14
+ export declare const ATTR_INPUT_MESSAGES = "gen_ai.input.messages";
15
+ export declare const ATTR_QUESTIONS = "typesafe.questions";
16
+ export declare const ATTR_ANSWERS = "typesafe.answers";
17
+ interface ISystemOneRequestLike {
18
+ state?: unknown;
19
+ questions?: Record<string, unknown>;
20
+ model?: unknown;
21
+ }
22
+ type SystemOne = (this: ITypeSafeClientLike, request: ISystemOneRequestLike, ...rest: unknown[]) => unknown;
23
+ interface ITypeSafeClientLike {
24
+ systemOne: SystemOne;
25
+ }
26
+ export declare class TypeSafeInstrumentation extends InstrumentationBase<InstrumentationConfig> {
27
+ constructor(config?: InstrumentationConfig);
28
+ protected init(): InstrumentationNodeModuleDefinition[];
29
+ manuallyInstrument(moduleExports: unknown): void;
30
+ }
31
+ export declare function patchInstalledTypeSafe(): void;
32
+ export declare function isSupportedVersion(version: string): boolean;
33
+ export declare function patchSystemOne(proto: ITypeSafeClientLike, getTracer: () => Tracer): boolean;
34
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brizz/sdk",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "type": "module",
5
5
  "description": "OpenTelemetry-based observability SDK for AI applications",
6
6
  "keywords": [
@@ -60,7 +60,8 @@
60
60
  "check:types-package": "attw --pack . --entrypoints . eve google-genai --ignore-rules no-resolution",
61
61
  "check:types-consumer": "node scripts/check-consumer-types.mjs",
62
62
  "check:types": "pnpm run check:types-package && pnpm run check:types-consumer",
63
- "check:esm-langgraph": "node scripts/check-esm-langgraph.mjs"
63
+ "check:esm-langgraph": "node scripts/check-esm-langgraph.mjs",
64
+ "check:typesafe": "node scripts/check-typesafe.mjs"
64
65
  },
65
66
  "exports": {
66
67
  ".": {
@@ -121,6 +122,7 @@
121
122
  "@traceloop/instrumentation-vertexai": "^0.27.0",
122
123
  "@types/jest": "^30.0.0",
123
124
  "@types/node": "^26.6.5",
125
+ "@typesafe-ai/sdk": "^0.6.0",
124
126
  "ai": "^7.0.137",
125
127
  "babel-jest": "^30.5.2",
126
128
  "babel-plugin-transform-import-meta": "^3.0.0",
@@ -132,7 +134,7 @@
132
134
  "tsup": "^8.5.1",
133
135
  "typescript": "^7.0.2",
134
136
  "vitest": "^5.0.3",
135
- "zod": "^4.6.5"
137
+ "zod": "^4.6.6"
136
138
  },
137
139
  "peerDependencies": {
138
140
  "@ai-sdk/otel": "^1",
@@ -142,6 +144,7 @@
142
144
  "@modelcontextprotocol/sdk": "^1.29.0",
143
145
  "@traceloop/instrumentation-google-generativeai": "^0.27.0",
144
146
  "@traceloop/instrumentation-vertexai": "^0.27.0",
147
+ "@typesafe-ai/sdk": ">=0.5.7 <1",
145
148
  "ai": "*",
146
149
  "typescript": ">=5.0.0"
147
150
  },
@@ -167,6 +170,9 @@
167
170
  "@traceloop/instrumentation-vertexai": {
168
171
  "optional": true
169
172
  },
173
+ "@typesafe-ai/sdk": {
174
+ "optional": true
175
+ },
170
176
  "ai": {
171
177
  "optional": true
172
178
  },