@brizz/sdk 0.1.58 → 0.2.0

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 (35) hide show
  1. package/README.md +41 -3
  2. package/dist/{chunk-XGD5HD5W.cjs → chunk-4QNEI7VZ.cjs} +119 -119
  3. package/dist/{chunk-LXRU77IM.js → chunk-5HCG3JKU.js} +2 -2
  4. package/dist/{chunk-O2IBZJOJ.cjs → chunk-6QXPHZEO.cjs} +4 -4
  5. package/dist/{chunk-JGATEWJB.cjs → chunk-CNVK5RA3.cjs} +8 -8
  6. package/dist/{chunk-MXKQQ6AU.js → chunk-EZCNPWKM.js} +1 -1
  7. package/dist/{chunk-7PRTTYWM.js → chunk-GABRGNAU.js} +1 -1
  8. package/dist/{chunk-GUKWVI53.js → chunk-GISL4K6Z.js} +27 -1
  9. package/dist/{chunk-RV7JIIDG.cjs → chunk-NF52RMLW.cjs} +27 -1
  10. package/dist/index.cjs +284 -106
  11. package/dist/index.js +214 -36
  12. package/dist/interrupt-36U5562Z.cjs +12 -0
  13. package/dist/{interrupt-UKJK5WOA.js → interrupt-6BSXUK3O.js} +2 -2
  14. package/dist/{mcp-YNOK6OX5.cjs → mcp-5ERVMLSA.cjs} +19 -18
  15. package/dist/{mcp-2JWY4GGY.js → mcp-EJAJTGIC.js} +4 -3
  16. package/dist/session.cjs +3 -3
  17. package/dist/session.js +2 -2
  18. package/dist/types/cjs/index.d.ts +2 -2
  19. package/dist/types/cjs/internal/error-type.d.ts +1 -0
  20. package/dist/types/cjs/internal/instrumentation/mcp/semantic-conventions.d.ts +1 -1
  21. package/dist/types/cjs/internal/instrumentation/typesafe.d.ts +0 -8
  22. package/dist/types/cjs/internal/semantic-conventions.d.ts +13 -0
  23. package/dist/types/cjs/internal/serialization.d.ts +2 -0
  24. package/dist/types/cjs/internal/trace/decision-call.d.ts +24 -0
  25. package/dist/types/cjs/internal/trace/index.d.ts +2 -0
  26. package/dist/types/esm/index.d.ts +2 -2
  27. package/dist/types/esm/internal/error-type.d.ts +1 -0
  28. package/dist/types/esm/internal/instrumentation/mcp/semantic-conventions.d.ts +1 -1
  29. package/dist/types/esm/internal/instrumentation/typesafe.d.ts +0 -8
  30. package/dist/types/esm/internal/semantic-conventions.d.ts +13 -0
  31. package/dist/types/esm/internal/serialization.d.ts +2 -0
  32. package/dist/types/esm/internal/trace/decision-call.d.ts +24 -0
  33. package/dist/types/esm/internal/trace/index.d.ts +2 -0
  34. package/package.json +26 -26
  35. package/dist/interrupt-BYLSBXTV.cjs +0 -12
@@ -64,7 +64,7 @@ var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
64
64
 
65
65
 
66
66
 
67
- var _chunkRV7JIIDGcjs = require('./chunk-RV7JIIDG.cjs');
67
+ var _chunkNF52RMLWcjs = require('./chunk-NF52RMLW.cjs');
68
68
 
69
69
  // src/internal/log/emit.ts
70
70
  var _api = require('@opentelemetry/api');
@@ -106,16 +106,16 @@ function setCurrentSpanCustomProperties(properties) {
106
106
  }
107
107
  for (const [key, value] of Object.entries(properties)) {
108
108
  try {
109
- current.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
109
+ current.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
110
110
  } catch (e) {
111
111
  }
112
112
  }
113
113
  }
114
114
  function callWithProperties(properties, fn, thisArg, ...args) {
115
115
  const base = _api.context.active();
116
- const prev = base.getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
116
+ const prev = base.getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
117
117
  const merged = prev ? { ...prev, ...properties } : properties;
118
- const next = base.setValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY, merged);
118
+ const next = base.setValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY, merged);
119
119
  return _api.context.with(next, fn, thisArg, ...args);
120
120
  }
121
121
  function withProperties(properties, fn, thisArg) {
@@ -136,25 +136,25 @@ function propagatePropertiesImperatively(properties, base = _api.context.active(
136
136
  if (!store || typeof store.enterWith !== "function") {
137
137
  return;
138
138
  }
139
- const prev = base.getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
139
+ const prev = base.getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
140
140
  const merged = prev ? { ...prev, ...properties } : properties;
141
- store.enterWith(base.setValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY, merged));
141
+ store.enterWith(base.setValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY, merged));
142
142
  } catch (e2) {
143
143
  }
144
144
  }
145
145
  function setUser(user) {
146
- const properties = { [_chunkRV7JIIDGcjs.USER_ID]: user.id };
146
+ const properties = { [_chunkNF52RMLWcjs.USER_ID]: user.id };
147
147
  if (user.email !== void 0) {
148
- properties[_chunkRV7JIIDGcjs.USER_EMAIL] = user.email;
148
+ properties[_chunkNF52RMLWcjs.USER_EMAIL] = user.email;
149
149
  }
150
150
  if (user.name !== void 0) {
151
- properties[_chunkRV7JIIDGcjs.USER_NAME] = user.name;
151
+ properties[_chunkNF52RMLWcjs.USER_NAME] = user.name;
152
152
  }
153
153
  if (user.role !== void 0) {
154
- properties[_chunkRV7JIIDGcjs.USER_ROLE] = user.role;
154
+ properties[_chunkNF52RMLWcjs.USER_ROLE] = user.role;
155
155
  }
156
156
  if (user.plan !== void 0) {
157
- properties[_chunkRV7JIIDGcjs.USER_PLAN] = user.plan;
157
+ properties[_chunkNF52RMLWcjs.USER_PLAN] = user.plan;
158
158
  }
159
159
  if (user.traits) {
160
160
  for (const [key, value] of Object.entries(user.traits)) {
@@ -168,15 +168,15 @@ function setUser(user) {
168
168
  propagatePropertiesImperatively(properties);
169
169
  }
170
170
  function setOrganization(org) {
171
- const properties = { [_chunkRV7JIIDGcjs.ORGANIZATION_ID]: org.id };
171
+ const properties = { [_chunkNF52RMLWcjs.ORGANIZATION_ID]: org.id };
172
172
  if (org.name !== void 0) {
173
- properties[_chunkRV7JIIDGcjs.ORGANIZATION_NAME] = org.name;
173
+ properties[_chunkNF52RMLWcjs.ORGANIZATION_NAME] = org.name;
174
174
  }
175
175
  if (org.plan !== void 0) {
176
- properties[_chunkRV7JIIDGcjs.ORGANIZATION_PLAN] = org.plan;
176
+ properties[_chunkNF52RMLWcjs.ORGANIZATION_PLAN] = org.plan;
177
177
  }
178
178
  if (org.domain !== void 0) {
179
- properties[_chunkRV7JIIDGcjs.ORGANIZATION_DOMAIN] = org.domain;
179
+ properties[_chunkNF52RMLWcjs.ORGANIZATION_DOMAIN] = org.domain;
180
180
  }
181
181
  if (org.traits) {
182
182
  for (const [key, value] of Object.entries(org.traits)) {
@@ -190,12 +190,12 @@ function setOrganization(org) {
190
190
  propagatePropertiesImperatively(properties);
191
191
  }
192
192
  function setMessageId(id) {
193
- const properties = { [_chunkRV7JIIDGcjs.MESSAGE_ID]: id };
193
+ const properties = { [_chunkNF52RMLWcjs.MESSAGE_ID]: id };
194
194
  setCurrentSpanCustomProperties(properties);
195
195
  propagatePropertiesImperatively(properties);
196
196
  }
197
197
  function setSessionId(id) {
198
- const properties = { [_chunkRV7JIIDGcjs.SESSION_ID]: id };
198
+ const properties = { [_chunkNF52RMLWcjs.SESSION_ID]: id };
199
199
  setCurrentSpanCustomProperties(properties);
200
200
  propagatePropertiesImperatively(properties);
201
201
  }
@@ -219,7 +219,7 @@ function serviceNameProperties(name) {
219
219
  _chunkWC573FCIcjs.logger.warn(`Service name ${problem}; keeping the configured appName.`);
220
220
  return {};
221
221
  }
222
- return { [_chunkRV7JIIDGcjs.SERVICE_NAME]: name };
222
+ return { [_chunkNF52RMLWcjs.SERVICE_NAME]: name };
223
223
  }
224
224
  function setServiceName(name) {
225
225
  const properties = serviceNameProperties(name);
@@ -233,22 +233,22 @@ function withServiceName(name, fn, thisArg) {
233
233
  return withProperties(serviceNameProperties(name), fn, thisArg);
234
234
  }
235
235
  function resolveServiceNameFromContext() {
236
- const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
237
- return _optionalChain([props, 'optionalAccess', _4 => _4[_chunkRV7JIIDGcjs.SERVICE_NAME]]);
236
+ const props = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
237
+ return _optionalChain([props, 'optionalAccess', _4 => _4[_chunkNF52RMLWcjs.SERVICE_NAME]]);
238
238
  }
239
239
  function userProperties(user) {
240
- const properties = { [_chunkRV7JIIDGcjs.USER_ID]: user.id };
240
+ const properties = { [_chunkNF52RMLWcjs.USER_ID]: user.id };
241
241
  if (user.email !== void 0) {
242
- properties[_chunkRV7JIIDGcjs.USER_EMAIL] = user.email;
242
+ properties[_chunkNF52RMLWcjs.USER_EMAIL] = user.email;
243
243
  }
244
244
  if (user.name !== void 0) {
245
- properties[_chunkRV7JIIDGcjs.USER_NAME] = user.name;
245
+ properties[_chunkNF52RMLWcjs.USER_NAME] = user.name;
246
246
  }
247
247
  if (user.role !== void 0) {
248
- properties[_chunkRV7JIIDGcjs.USER_ROLE] = user.role;
248
+ properties[_chunkNF52RMLWcjs.USER_ROLE] = user.role;
249
249
  }
250
250
  if (user.plan !== void 0) {
251
- properties[_chunkRV7JIIDGcjs.USER_PLAN] = user.plan;
251
+ properties[_chunkNF52RMLWcjs.USER_PLAN] = user.plan;
252
252
  }
253
253
  if (user.traits) {
254
254
  for (const [key, value] of Object.entries(user.traits)) {
@@ -261,15 +261,15 @@ function userProperties(user) {
261
261
  return properties;
262
262
  }
263
263
  function organizationProperties(org) {
264
- const properties = { [_chunkRV7JIIDGcjs.ORGANIZATION_ID]: org.id };
264
+ const properties = { [_chunkNF52RMLWcjs.ORGANIZATION_ID]: org.id };
265
265
  if (org.name !== void 0) {
266
- properties[_chunkRV7JIIDGcjs.ORGANIZATION_NAME] = org.name;
266
+ properties[_chunkNF52RMLWcjs.ORGANIZATION_NAME] = org.name;
267
267
  }
268
268
  if (org.plan !== void 0) {
269
- properties[_chunkRV7JIIDGcjs.ORGANIZATION_PLAN] = org.plan;
269
+ properties[_chunkNF52RMLWcjs.ORGANIZATION_PLAN] = org.plan;
270
270
  }
271
271
  if (org.domain !== void 0) {
272
- properties[_chunkRV7JIIDGcjs.ORGANIZATION_DOMAIN] = org.domain;
272
+ properties[_chunkNF52RMLWcjs.ORGANIZATION_DOMAIN] = org.domain;
273
273
  }
274
274
  if (org.traits) {
275
275
  for (const [key, value] of Object.entries(org.traits)) {
@@ -294,32 +294,32 @@ function withOrganization(org, fn, thisArg) {
294
294
  return withProperties(organizationProperties(org), fn, thisArg);
295
295
  }
296
296
  function callWithMessageId(id, fn, thisArg, ...args) {
297
- return callWithProperties({ [_chunkRV7JIIDGcjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
297
+ return callWithProperties({ [_chunkNF52RMLWcjs.MESSAGE_ID]: id }, fn, thisArg, ...args);
298
298
  }
299
299
  function withMessageId(id, fn, thisArg) {
300
- return withProperties({ [_chunkRV7JIIDGcjs.MESSAGE_ID]: id }, fn, thisArg);
300
+ return withProperties({ [_chunkNF52RMLWcjs.MESSAGE_ID]: id }, fn, thisArg);
301
301
  }
302
302
  function inheritedMuteTools() {
303
- const properties = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
304
- return _optionalChain([properties, 'optionalAccess', _5 => _5[_chunkRV7JIIDGcjs.MUTE_TOOLS]]);
303
+ const properties = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
304
+ return _optionalChain([properties, 'optionalAccess', _5 => _5[_chunkNF52RMLWcjs.MUTE_TOOLS]]);
305
305
  }
306
306
  function muteProperties(options) {
307
307
  const { input = true, output = true, tools = output } = options;
308
308
  const properties = {};
309
309
  if (input) {
310
- properties[_chunkRV7JIIDGcjs.MUTE_INPUT] = "true";
310
+ properties[_chunkNF52RMLWcjs.MUTE_INPUT] = "true";
311
311
  }
312
312
  if (output) {
313
- properties[_chunkRV7JIIDGcjs.MUTE_OUTPUT] = "true";
313
+ properties[_chunkNF52RMLWcjs.MUTE_OUTPUT] = "true";
314
314
  }
315
315
  if (tools !== output) {
316
- properties[_chunkRV7JIIDGcjs.MUTE_TOOLS] = String(tools);
316
+ properties[_chunkNF52RMLWcjs.MUTE_TOOLS] = String(tools);
317
317
  } else {
318
318
  const inherited = inheritedMuteTools();
319
319
  if (tools && inherited === "false") {
320
- properties[_chunkRV7JIIDGcjs.MUTE_TOOLS] = "true";
320
+ properties[_chunkNF52RMLWcjs.MUTE_TOOLS] = "true";
321
321
  } else if (options.tools === false && inherited === "true") {
322
- properties[_chunkRV7JIIDGcjs.MUTE_TOOLS] = "false";
322
+ properties[_chunkNF52RMLWcjs.MUTE_TOOLS] = "false";
323
323
  }
324
324
  }
325
325
  return properties;
@@ -331,11 +331,11 @@ function withMute(options, fn, thisArg) {
331
331
  return withProperties(muteProperties(options), fn, thisArg);
332
332
  }
333
333
  function withSessionId(sessionId, fn, thisArg, extraProperties) {
334
- const properties = { [_chunkRV7JIIDGcjs.SESSION_ID]: sessionId, ...extraProperties };
334
+ const properties = { [_chunkNF52RMLWcjs.SESSION_ID]: sessionId, ...extraProperties };
335
335
  return withProperties(properties, fn, thisArg);
336
336
  }
337
337
  function callWithSessionId(sessionId, fn, thisArg, ...args) {
338
- return callWithProperties({ [_chunkRV7JIIDGcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
338
+ return callWithProperties({ [_chunkNF52RMLWcjs.SESSION_ID]: sessionId }, fn, thisArg, ...args);
339
339
  }
340
340
  var Session = (_class = class {
341
341
 
@@ -363,8 +363,8 @@ var Session = (_class = class {
363
363
  setInput(text, context3) {
364
364
  this.inputs.push(text);
365
365
  this.inputContexts.push(_nullishCoalesce(context3, () => ( {})));
366
- this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_INPUT, JSON.stringify(this.inputs));
367
- this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
366
+ this.span.setAttribute(_chunkNF52RMLWcjs.SESSION_INPUT, JSON.stringify(this.inputs));
367
+ this.span.setAttribute(_chunkNF52RMLWcjs.SESSION_INPUT_CONTEXT, JSON.stringify(this.inputContexts));
368
368
  }
369
369
  /**
370
370
  * Append an assistant turn to session output tracking.
@@ -379,8 +379,8 @@ var Session = (_class = class {
379
379
  setOutput(text, context3) {
380
380
  this.outputs.push(text);
381
381
  this.outputContexts.push(_nullishCoalesce(context3, () => ( {})));
382
- this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
383
- this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
382
+ this.span.setAttribute(_chunkNF52RMLWcjs.SESSION_OUTPUT, JSON.stringify(this.outputs));
383
+ this.span.setAttribute(_chunkNF52RMLWcjs.SESSION_OUTPUT_CONTEXT, JSON.stringify(this.outputContexts));
384
384
  }
385
385
  /**
386
386
  * Set the session title on the span.
@@ -388,7 +388,7 @@ var Session = (_class = class {
388
388
  * @param title - The generated title string
389
389
  */
390
390
  setTitle(title) {
391
- this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_TITLE, title);
391
+ this.span.setAttribute(_chunkNF52RMLWcjs.SESSION_TITLE, title);
392
392
  }
393
393
  /**
394
394
  * Update custom properties on the session span.
@@ -398,7 +398,7 @@ var Session = (_class = class {
398
398
  */
399
399
  updateProperties(properties) {
400
400
  for (const [key, value] of Object.entries(properties)) {
401
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
401
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
402
402
  }
403
403
  }
404
404
  /**
@@ -410,21 +410,21 @@ var Session = (_class = class {
410
410
  setUser(user) {
411
411
  if (user.traits) {
412
412
  for (const [key, value] of Object.entries(user.traits)) {
413
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.user.${key}`, value);
413
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.user.${key}`, value);
414
414
  }
415
415
  }
416
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.USER_ID}`, user.id);
416
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.USER_ID}`, user.id);
417
417
  if (user.email !== void 0) {
418
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.USER_EMAIL}`, user.email);
418
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.USER_EMAIL}`, user.email);
419
419
  }
420
420
  if (user.name !== void 0) {
421
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.USER_NAME}`, user.name);
421
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.USER_NAME}`, user.name);
422
422
  }
423
423
  if (user.role !== void 0) {
424
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.USER_ROLE}`, user.role);
424
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.USER_ROLE}`, user.role);
425
425
  }
426
426
  if (user.plan !== void 0) {
427
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.USER_PLAN}`, user.plan);
427
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.USER_PLAN}`, user.plan);
428
428
  }
429
429
  }
430
430
  /**
@@ -436,18 +436,18 @@ var Session = (_class = class {
436
436
  setOrganization(org) {
437
437
  if (org.traits) {
438
438
  for (const [key, value] of Object.entries(org.traits)) {
439
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.organization.${key}`, value);
439
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.organization.${key}`, value);
440
440
  }
441
441
  }
442
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.ORGANIZATION_ID}`, org.id);
442
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.ORGANIZATION_ID}`, org.id);
443
443
  if (org.name !== void 0) {
444
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.ORGANIZATION_NAME}`, org.name);
444
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.ORGANIZATION_NAME}`, org.name);
445
445
  }
446
446
  if (org.plan !== void 0) {
447
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.ORGANIZATION_PLAN}`, org.plan);
447
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.ORGANIZATION_PLAN}`, org.plan);
448
448
  }
449
449
  if (org.domain !== void 0) {
450
- this.span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.ORGANIZATION_DOMAIN}`, org.domain);
450
+ this.span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.ORGANIZATION_DOMAIN}`, org.domain);
451
451
  }
452
452
  }
453
453
  /**
@@ -477,23 +477,23 @@ var SessionTitle = class {
477
477
  * @param title - The generated title string
478
478
  */
479
479
  setTitle(title) {
480
- this.span.setAttribute(_chunkRV7JIIDGcjs.SESSION_TITLE, title);
480
+ this.span.setAttribute(_chunkNF52RMLWcjs.SESSION_TITLE, title);
481
481
  }
482
482
  };
483
483
  function getActiveSession() {
484
- return _api.context.active().getValue(_chunkRV7JIIDGcjs.SESSION_OBJECT_CONTEXT_KEY);
484
+ return _api.context.active().getValue(_chunkNF52RMLWcjs.SESSION_OBJECT_CONTEXT_KEY);
485
485
  }
486
486
  function resolveSessionIdFromContext() {
487
487
  const active = getActiveSession();
488
488
  if (active) {
489
489
  return active.sessionId;
490
490
  }
491
- const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
492
- return _optionalChain([props, 'optionalAccess', _8 => _8[_chunkRV7JIIDGcjs.SESSION_ID]]);
491
+ const props = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
492
+ return _optionalChain([props, 'optionalAccess', _8 => _8[_chunkNF52RMLWcjs.SESSION_ID]]);
493
493
  }
494
494
  function resolveMessageIdFromContext() {
495
- const props = _api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
496
- return _optionalChain([props, 'optionalAccess', _9 => _9[_chunkRV7JIIDGcjs.MESSAGE_ID]]);
495
+ const props = _api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
496
+ return _optionalChain([props, 'optionalAccess', _9 => _9[_chunkNF52RMLWcjs.MESSAGE_ID]]);
497
497
  }
498
498
  function emitEventWithSessionId(sessionId, name, attributes, body, severityNumber) {
499
499
  return callWithSessionId(sessionId, () => {
@@ -502,10 +502,10 @@ function emitEventWithSessionId(sessionId, name, attributes, body, severityNumbe
502
502
  }
503
503
  function emitExternalLink(sessionId, url, title, linkType) {
504
504
  try {
505
- emitEventWithSessionId(sessionId, _chunkRV7JIIDGcjs.EXTERNAL_LINK_EVENT_NAME, {
506
- [_chunkRV7JIIDGcjs.EXTERNAL_LINK_URL]: url,
507
- [_chunkRV7JIIDGcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
508
- [_chunkRV7JIIDGcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
505
+ emitEventWithSessionId(sessionId, _chunkNF52RMLWcjs.EXTERNAL_LINK_EVENT_NAME, {
506
+ [_chunkNF52RMLWcjs.EXTERNAL_LINK_URL]: url,
507
+ [_chunkNF52RMLWcjs.EXTERNAL_LINK_TITLE]: _nullishCoalesce(title, () => ( "")),
508
+ [_chunkNF52RMLWcjs.EXTERNAL_LINK_TYPE]: _nullishCoalesce(linkType, () => ( "generic"))
509
509
  });
510
510
  } catch (error) {
511
511
  _chunkWC573FCIcjs.logger.warn("addExternalLink: failed to emit external link", error);
@@ -522,22 +522,22 @@ function addExternalLink(url, options) {
522
522
  emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _11 => _11.title]), _optionalChain([options, 'optionalAccess', _12 => _12.linkType]));
523
523
  }
524
524
  function recordFeedback(type, options) {
525
- const eventAttributes = { [_chunkRV7JIIDGcjs.FEEDBACK_TYPE]: type };
525
+ const eventAttributes = { [_chunkNF52RMLWcjs.FEEDBACK_TYPE]: type };
526
526
  if (_optionalChain([options, 'optionalAccess', _13 => _13.score]) !== void 0) {
527
- eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SCORE] = options.score;
527
+ eventAttributes[_chunkNF52RMLWcjs.FEEDBACK_SCORE] = options.score;
528
528
  }
529
529
  if (_optionalChain([options, 'optionalAccess', _14 => _14.reason]) !== void 0) {
530
- eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_REASON] = options.reason;
530
+ eventAttributes[_chunkNF52RMLWcjs.FEEDBACK_REASON] = options.reason;
531
531
  }
532
532
  if (_optionalChain([options, 'optionalAccess', _15 => _15.comment]) !== void 0) {
533
- eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_COMMENT] = options.comment;
533
+ eventAttributes[_chunkNF52RMLWcjs.FEEDBACK_COMMENT] = options.comment;
534
534
  }
535
535
  if (_optionalChain([options, 'optionalAccess', _16 => _16.source]) !== void 0) {
536
- eventAttributes[_chunkRV7JIIDGcjs.FEEDBACK_SOURCE] = options.source;
536
+ eventAttributes[_chunkNF52RMLWcjs.FEEDBACK_SOURCE] = options.source;
537
537
  }
538
538
  if (_optionalChain([options, 'optionalAccess', _17 => _17.attributes])) {
539
539
  for (const [key, value] of Object.entries(options.attributes)) {
540
- const k = `${_chunkRV7JIIDGcjs.FEEDBACK_ATTR_PREFIX}${key}`;
540
+ const k = `${_chunkNF52RMLWcjs.FEEDBACK_ATTR_PREFIX}${key}`;
541
541
  if (eventAttributes[k] === void 0) {
542
542
  eventAttributes[k] = value;
543
543
  }
@@ -552,16 +552,16 @@ function recordFeedback(type, options) {
552
552
  }
553
553
  const anchor = {};
554
554
  if (messageId !== void 0) {
555
- anchor[_chunkRV7JIIDGcjs.MESSAGE_ID] = messageId;
555
+ anchor[_chunkNF52RMLWcjs.MESSAGE_ID] = messageId;
556
556
  }
557
557
  if (sessionId !== void 0) {
558
- anchor[_chunkRV7JIIDGcjs.SESSION_ID] = sessionId;
558
+ anchor[_chunkNF52RMLWcjs.SESSION_ID] = sessionId;
559
559
  }
560
560
  try {
561
561
  if (Object.keys(anchor).length === 0) {
562
- emitEvent(_chunkRV7JIIDGcjs.FEEDBACK_EVENT_NAME, eventAttributes);
562
+ emitEvent(_chunkNF52RMLWcjs.FEEDBACK_EVENT_NAME, eventAttributes);
563
563
  } else {
564
- callWithProperties(anchor, () => emitEvent(_chunkRV7JIIDGcjs.FEEDBACK_EVENT_NAME, eventAttributes));
564
+ callWithProperties(anchor, () => emitEvent(_chunkNF52RMLWcjs.FEEDBACK_EVENT_NAME, eventAttributes));
565
565
  }
566
566
  } catch (error) {
567
567
  _chunkWC573FCIcjs.logger.warn("recordFeedback: failed to emit feedback event", error);
@@ -586,7 +586,7 @@ function recordMetricImpl(options) {
586
586
  );
587
587
  return;
588
588
  }
589
- if (_chunkRV7JIIDGcjs.RESERVED_METRIC_NAMES.has(name)) {
589
+ if (_chunkNF52RMLWcjs.RESERVED_METRIC_NAMES.has(name)) {
590
590
  _chunkWC573FCIcjs.logger.warn(
591
591
  `recordMetric called with the reserved name ${JSON.stringify(name)}; metric dropped. Brizz computes this metric itself \u2014 pick a different name.`
592
592
  );
@@ -611,28 +611,28 @@ function recordMetricImpl(options) {
611
611
  return;
612
612
  }
613
613
  }
614
- const scope = _nullishCoalesce(options.scope, () => ( _chunkRV7JIIDGcjs.METRIC_SCOPE_SESSION));
615
- if (scope !== _chunkRV7JIIDGcjs.METRIC_SCOPE_SESSION && scope !== _chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE) {
614
+ const scope = _nullishCoalesce(options.scope, () => ( _chunkNF52RMLWcjs.METRIC_SCOPE_SESSION));
615
+ if (scope !== _chunkNF52RMLWcjs.METRIC_SCOPE_SESSION && scope !== _chunkNF52RMLWcjs.METRIC_SCOPE_TRACE) {
616
616
  _chunkWC573FCIcjs.logger.warn(
617
- `recordMetric(${name}) called with an invalid scope ${JSON.stringify(scope)}; expected '${_chunkRV7JIIDGcjs.METRIC_SCOPE_SESSION}' or '${_chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE}'. Metric dropped.`
617
+ `recordMetric(${name}) called with an invalid scope ${JSON.stringify(scope)}; expected '${_chunkNF52RMLWcjs.METRIC_SCOPE_SESSION}' or '${_chunkNF52RMLWcjs.METRIC_SCOPE_TRACE}'. Metric dropped.`
618
618
  );
619
619
  return;
620
620
  }
621
621
  const eventAttributes = {
622
- [_chunkRV7JIIDGcjs.METRIC_NAME]: name,
623
- [_chunkRV7JIIDGcjs.METRIC_VALUE]: numericValue
622
+ [_chunkNF52RMLWcjs.METRIC_NAME]: name,
623
+ [_chunkNF52RMLWcjs.METRIC_VALUE]: numericValue
624
624
  };
625
625
  if (options.scope !== void 0) {
626
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_SCOPE] = scope;
626
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_SCOPE] = scope;
627
627
  }
628
628
  if (options.unit !== void 0) {
629
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_UNIT] = options.unit;
629
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_UNIT] = options.unit;
630
630
  }
631
631
  if (options.minValue !== void 0) {
632
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_MIN] = options.minValue;
632
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_MIN] = options.minValue;
633
633
  }
634
634
  if (options.maxValue !== void 0) {
635
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_MAX] = options.maxValue;
635
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_MAX] = options.maxValue;
636
636
  }
637
637
  if (options.comment !== void 0) {
638
638
  let comment = options.comment;
@@ -642,21 +642,21 @@ function recordMetricImpl(options) {
642
642
  );
643
643
  comment = comment.slice(0, METRIC_COMMENT_MAX_LEN);
644
644
  }
645
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_COMMENT] = comment;
645
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_COMMENT] = comment;
646
646
  }
647
647
  if (options.polarity !== void 0) {
648
648
  const polarity = options.polarity;
649
- if (polarity === _chunkRV7JIIDGcjs.METRIC_POLARITY_POSITIVE || polarity === _chunkRV7JIIDGcjs.METRIC_POLARITY_NEGATIVE) {
650
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_POLARITY] = polarity;
649
+ if (polarity === _chunkNF52RMLWcjs.METRIC_POLARITY_POSITIVE || polarity === _chunkNF52RMLWcjs.METRIC_POLARITY_NEGATIVE) {
650
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_POLARITY] = polarity;
651
651
  } else {
652
652
  _chunkWC573FCIcjs.logger.warn(
653
- `recordMetric(${name}) called with an invalid polarity ${JSON.stringify(polarity)}; expected '${_chunkRV7JIIDGcjs.METRIC_POLARITY_POSITIVE}' or '${_chunkRV7JIIDGcjs.METRIC_POLARITY_NEGATIVE}'. Emitting the metric without it.`
653
+ `recordMetric(${name}) called with an invalid polarity ${JSON.stringify(polarity)}; expected '${_chunkNF52RMLWcjs.METRIC_POLARITY_POSITIVE}' or '${_chunkNF52RMLWcjs.METRIC_POLARITY_NEGATIVE}'. Emitting the metric without it.`
654
654
  );
655
655
  }
656
656
  }
657
657
  if (options.timestamp !== void 0) {
658
658
  if (Number.isFinite(options.timestamp.getTime())) {
659
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_TIMESTAMP] = options.timestamp.toISOString();
659
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_TIMESTAMP] = options.timestamp.toISOString();
660
660
  } else {
661
661
  _chunkWC573FCIcjs.logger.warn(
662
662
  `recordMetric(${name}) called with an invalid timestamp; emitting the metric without it.`
@@ -686,15 +686,15 @@ function recordMetricImpl(options) {
686
686
  );
687
687
  text = text.slice(0, METRIC_ATTRIBUTE_VALUE_MAX_LEN);
688
688
  }
689
- eventAttributes[`${_chunkRV7JIIDGcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
689
+ eventAttributes[`${_chunkNF52RMLWcjs.METRIC_ATTRIBUTE_PREFIX}${normalizedKey}`] = text;
690
690
  accepted += 1;
691
691
  }
692
692
  }
693
693
  const traceId = typeof options.traceId === "string" && options.traceId !== "" ? options.traceId : void 0;
694
694
  if (traceId !== void 0) {
695
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_TRACE_ID] = traceId;
695
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_TRACE_ID] = traceId;
696
696
  }
697
- if (scope === _chunkRV7JIIDGcjs.METRIC_SCOPE_TRACE && traceId === void 0) {
697
+ if (scope === _chunkNF52RMLWcjs.METRIC_SCOPE_TRACE && traceId === void 0) {
698
698
  const spanContext = _optionalChain([_api.trace, 'access', _21 => _21.getActiveSpan, 'call', _22 => _22(), 'optionalAccess', _23 => _23.spanContext, 'call', _24 => _24()]);
699
699
  if (!spanContext || !_api.isSpanContextValid.call(void 0, spanContext)) {
700
700
  _chunkWC573FCIcjs.logger.warn(
@@ -702,7 +702,7 @@ function recordMetricImpl(options) {
702
702
  );
703
703
  return;
704
704
  }
705
- eventAttributes[_chunkRV7JIIDGcjs.METRIC_TRACE_ID] = spanContext.traceId;
705
+ eventAttributes[_chunkNF52RMLWcjs.METRIC_TRACE_ID] = spanContext.traceId;
706
706
  }
707
707
  const sessionId = _nullishCoalesce(options.sessionId, () => ( (traceId === void 0 ? resolveSessionIdFromContext() : void 0)));
708
708
  if (sessionId === void 0 && traceId === void 0) {
@@ -712,21 +712,21 @@ function recordMetricImpl(options) {
712
712
  return;
713
713
  }
714
714
  const base = _api.context.active();
715
- const ambient = base.getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY);
715
+ const ambient = base.getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY);
716
716
  const properties = { ...ambient };
717
717
  if (sessionId === void 0) {
718
- delete properties[_chunkRV7JIIDGcjs.SESSION_ID];
719
- delete properties[_chunkRV7JIIDGcjs.MESSAGE_ID];
718
+ delete properties[_chunkNF52RMLWcjs.SESSION_ID];
719
+ delete properties[_chunkNF52RMLWcjs.MESSAGE_ID];
720
720
  } else {
721
- properties[_chunkRV7JIIDGcjs.SESSION_ID] = sessionId;
721
+ properties[_chunkNF52RMLWcjs.SESSION_ID] = sessionId;
722
722
  }
723
723
  if (options.serviceName !== void 0) {
724
- properties[_chunkRV7JIIDGcjs.SERVICE_NAME] = options.serviceName;
724
+ properties[_chunkNF52RMLWcjs.SERVICE_NAME] = options.serviceName;
725
725
  }
726
726
  try {
727
727
  _api.context.with(
728
- base.setValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY, properties),
729
- () => emitEvent(_chunkRV7JIIDGcjs.METRIC_EVENT_NAME, eventAttributes)
728
+ base.setValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY, properties),
729
+ () => emitEvent(_chunkNF52RMLWcjs.METRIC_EVENT_NAME, eventAttributes)
730
730
  );
731
731
  } catch (error) {
732
732
  _chunkWC573FCIcjs.logger.warn("recordMetric: failed to emit metric event", error);
@@ -734,18 +734,18 @@ function recordMetricImpl(options) {
734
734
  }
735
735
  function startSession(sessionId, callback, extraProperties, options) {
736
736
  const isTitle = _optionalChain([options, 'optionalAccess', _25 => _25.mode]) === "title";
737
- const spanName = isTitle ? _chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME : _chunkRV7JIIDGcjs.SESSION_SPAN_NAME;
737
+ const spanName = isTitle ? _chunkNF52RMLWcjs.SESSION_TITLE_SPAN_NAME : _chunkNF52RMLWcjs.SESSION_SPAN_NAME;
738
738
  return sessionTracer.startActiveSpan(spanName, (span) => {
739
- span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, sessionId);
739
+ span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.SESSION_ID}`, sessionId);
740
740
  if (extraProperties) {
741
741
  for (const [key, value] of Object.entries(extraProperties)) {
742
- span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${key}`, value);
742
+ span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${key}`, value);
743
743
  }
744
744
  }
745
745
  const session = new Session(sessionId, span);
746
- const contextProperties = { [_chunkRV7JIIDGcjs.SESSION_ID]: sessionId };
746
+ const contextProperties = { [_chunkNF52RMLWcjs.SESSION_ID]: sessionId };
747
747
  if (isTitle) {
748
- contextProperties[_chunkRV7JIIDGcjs.SESSION_TITLE_GENERATION] = "true";
748
+ contextProperties[_chunkNF52RMLWcjs.SESSION_TITLE_GENERATION] = "true";
749
749
  }
750
750
  if (extraProperties) {
751
751
  for (const [key, value] of Object.entries(extraProperties)) {
@@ -753,7 +753,7 @@ function startSession(sessionId, callback, extraProperties, options) {
753
753
  }
754
754
  }
755
755
  return callWithProperties(contextProperties, () => {
756
- const sessionCtx = _api.context.active().setValue(_chunkRV7JIIDGcjs.SESSION_OBJECT_CONTEXT_KEY, session);
756
+ const sessionCtx = _api.context.active().setValue(_chunkNF52RMLWcjs.SESSION_OBJECT_CONTEXT_KEY, session);
757
757
  return _api.context.with(sessionCtx, () => {
758
758
  try {
759
759
  const result = callback(session);
@@ -782,14 +782,14 @@ function startSession(sessionId, callback, extraProperties, options) {
782
782
  }
783
783
  function startSessionTitle(callback, options) {
784
784
  const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _26 => _26.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _27 => _27(), 'optionalAccess', _28 => _28.sessionId])));
785
- return sessionTracer.startActiveSpan(_chunkRV7JIIDGcjs.SESSION_TITLE_SPAN_NAME, (span) => {
785
+ return sessionTracer.startActiveSpan(_chunkNF52RMLWcjs.SESSION_TITLE_SPAN_NAME, (span) => {
786
786
  if (resolvedSessionId) {
787
- span.setAttribute(`${_chunkRV7JIIDGcjs.BRIZZ}.${_chunkRV7JIIDGcjs.SESSION_ID}`, resolvedSessionId);
787
+ span.setAttribute(`${_chunkNF52RMLWcjs.BRIZZ}.${_chunkNF52RMLWcjs.SESSION_ID}`, resolvedSessionId);
788
788
  }
789
789
  const sessionTitle = new SessionTitle(span);
790
- const properties = { [_chunkRV7JIIDGcjs.SESSION_TITLE_GENERATION]: "true" };
790
+ const properties = { [_chunkNF52RMLWcjs.SESSION_TITLE_GENERATION]: "true" };
791
791
  if (resolvedSessionId) {
792
- properties[_chunkRV7JIIDGcjs.SESSION_ID] = resolvedSessionId;
792
+ properties[_chunkNF52RMLWcjs.SESSION_ID] = resolvedSessionId;
793
793
  }
794
794
  return callWithProperties(properties, () => {
795
795
  try {
@@ -824,7 +824,7 @@ function newInstanceId() {
824
824
  return _crypto.randomUUID.call(void 0, ).replaceAll("-", "").slice(0, 8);
825
825
  }
826
826
  function activeProperties() {
827
- return _nullishCoalesce(_api.context.active().getValue(_chunkRV7JIIDGcjs.PROPERTIES_CONTEXT_KEY), () => ( {}));
827
+ return _nullishCoalesce(_api.context.active().getValue(_chunkNF52RMLWcjs.PROPERTIES_CONTEXT_KEY), () => ( {}));
828
828
  }
829
829
  function encodeToken(agent) {
830
830
  const payload = {
@@ -850,7 +850,7 @@ function agentHandle(id, parentId, name) {
850
850
  parentId,
851
851
  name,
852
852
  traceparent: currentTraceparent(),
853
- sessionId: _nullishCoalesce(activeProperties()[_chunkRV7JIIDGcjs.SESSION_ID], () => ( ""))
853
+ sessionId: _nullishCoalesce(activeProperties()[_chunkNF52RMLWcjs.SESSION_ID], () => ( ""))
854
854
  };
855
855
  return {
856
856
  ...opened,
@@ -886,7 +886,7 @@ function resolveAgent(agent) {
886
886
  let parentContext = _api.context.active();
887
887
  if (options.token === void 0) {
888
888
  id = options.id || newInstanceId();
889
- parentId = options.parentId || activeProperties()[_chunkRV7JIIDGcjs.AGENT_ID] || "";
889
+ parentId = options.parentId || activeProperties()[_chunkNF52RMLWcjs.AGENT_ID] || "";
890
890
  name = _nullishCoalesce(options.name, () => ( ""));
891
891
  } else {
892
892
  const decoded = decodeToken(options.token);
@@ -905,12 +905,12 @@ function resolveAgent(agent) {
905
905
  }
906
906
  }
907
907
  }
908
- const properties = { [_chunkRV7JIIDGcjs.AGENT_ID]: id, [_chunkRV7JIIDGcjs.AGENT_NAME]: name };
908
+ const properties = { [_chunkNF52RMLWcjs.AGENT_ID]: id, [_chunkNF52RMLWcjs.AGENT_NAME]: name };
909
909
  if (parentId) {
910
- properties[_chunkRV7JIIDGcjs.AGENT_PARENT_ID] = parentId;
910
+ properties[_chunkNF52RMLWcjs.AGENT_PARENT_ID] = parentId;
911
911
  }
912
912
  if (sessionId) {
913
- properties[_chunkRV7JIIDGcjs.SESSION_ID] = sessionId;
913
+ properties[_chunkNF52RMLWcjs.SESSION_ID] = sessionId;
914
914
  }
915
915
  return { id, parentId, name, properties, parentContext };
916
916
  }
@@ -5,11 +5,11 @@ import {
5
5
  BRIZZ,
6
6
  PROPERTIES_CONTEXT_KEY,
7
7
  SESSION_ID
8
- } from "./chunk-GUKWVI53.js";
8
+ } from "./chunk-GISL4K6Z.js";
9
9
 
10
10
  // src/internal/version.ts
11
11
  function getSDKVersion() {
12
- return "0.1.58";
12
+ return "0.2.0";
13
13
  }
14
14
 
15
15
  // src/internal/instrumentation/mcp/session.ts