@elizaos/server 1.6.2-alpha.10 → 1.6.2-alpha.11

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/dist/index.js CHANGED
@@ -12295,21 +12295,21 @@ var require_ParentBasedSampler = __commonJS((exports) => {
12295
12295
  this._localParentSampled = config.localParentSampled ?? new AlwaysOnSampler_1.AlwaysOnSampler;
12296
12296
  this._localParentNotSampled = config.localParentNotSampled ?? new AlwaysOffSampler_1.AlwaysOffSampler;
12297
12297
  }
12298
- shouldSample(context2, traceId, spanName, spanKind, attributes, links) {
12299
- const parentContext = api_1.trace.getSpanContext(context2);
12298
+ shouldSample(context3, traceId, spanName, spanKind, attributes, links) {
12299
+ const parentContext = api_1.trace.getSpanContext(context3);
12300
12300
  if (!parentContext || !(0, api_1.isSpanContextValid)(parentContext)) {
12301
- return this._root.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
12301
+ return this._root.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
12302
12302
  }
12303
12303
  if (parentContext.isRemote) {
12304
12304
  if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
12305
- return this._remoteParentSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
12305
+ return this._remoteParentSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
12306
12306
  }
12307
- return this._remoteParentNotSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
12307
+ return this._remoteParentNotSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
12308
12308
  }
12309
12309
  if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) {
12310
- return this._localParentSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
12310
+ return this._localParentSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
12311
12311
  }
12312
- return this._localParentNotSampled.shouldSample(context2, traceId, spanName, spanKind, attributes, links);
12312
+ return this._localParentNotSampled.shouldSample(context3, traceId, spanName, spanKind, attributes, links);
12313
12313
  }
12314
12314
  toString() {
12315
12315
  return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`;
@@ -12333,7 +12333,7 @@ var require_TraceIdRatioBasedSampler = __commonJS((exports) => {
12333
12333
  this._ratio = this._normalize(_ratio);
12334
12334
  this._upperBound = Math.floor(this._ratio * 4294967295);
12335
12335
  }
12336
- shouldSample(context2, traceId) {
12336
+ shouldSample(context3, traceId) {
12337
12337
  return {
12338
12338
  decision: (0, api_1.isValidTraceId)(traceId) && this._accumulate(traceId) < this._upperBound ? Sampler_1.SamplingDecision.RECORD_AND_SAMPLED : Sampler_1.SamplingDecision.NOT_RECORD
12339
12339
  };
@@ -12729,12 +12729,12 @@ var require_Tracer = __commonJS((exports) => {
12729
12729
  this._spanProcessor = spanProcessor;
12730
12730
  this.instrumentationScope = instrumentationScope;
12731
12731
  }
12732
- startSpan(name, options = {}, context2 = api.context.active()) {
12732
+ startSpan(name, options = {}, context3 = api.context.active()) {
12733
12733
  if (options.root) {
12734
- context2 = api.trace.deleteSpan(context2);
12734
+ context3 = api.trace.deleteSpan(context3);
12735
12735
  }
12736
- const parentSpan = api.trace.getSpan(context2);
12737
- if ((0, core_1.isTracingSuppressed)(context2)) {
12736
+ const parentSpan = api.trace.getSpan(context3);
12737
+ if ((0, core_1.isTracingSuppressed)(context3)) {
12738
12738
  api.diag.debug("Instrumentation suppressed, returning Noop Span");
12739
12739
  const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT);
12740
12740
  return nonRecordingSpan;
@@ -12759,7 +12759,7 @@ var require_Tracer = __commonJS((exports) => {
12759
12759
  };
12760
12760
  });
12761
12761
  const attributes = (0, core_1.sanitizeAttributes)(options.attributes);
12762
- const samplingResult = this._sampler.shouldSample(context2, traceId, name, spanKind, attributes, links);
12762
+ const samplingResult = this._sampler.shouldSample(context3, traceId, name, spanKind, attributes, links);
12763
12763
  traceState = samplingResult.traceState ?? traceState;
12764
12764
  const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED ? api.TraceFlags.SAMPLED : api.TraceFlags.NONE;
12765
12765
  const spanContext = { traceId, spanId, traceFlags, traceState };
@@ -12772,7 +12772,7 @@ var require_Tracer = __commonJS((exports) => {
12772
12772
  const span = new Span_1.SpanImpl({
12773
12773
  resource: this._resource,
12774
12774
  scope: this.instrumentationScope,
12775
- context: context2,
12775
+ context: context3,
12776
12776
  spanContext,
12777
12777
  name,
12778
12778
  kind: spanKind,
@@ -12841,9 +12841,9 @@ var require_MultiSpanProcessor = __commonJS((exports) => {
12841
12841
  });
12842
12842
  });
12843
12843
  }
12844
- onStart(span, context2) {
12844
+ onStart(span, context3) {
12845
12845
  for (const spanProcessor of this._spanProcessors) {
12846
- spanProcessor.onStart(span, context2);
12846
+ spanProcessor.onStart(span, context3);
12847
12847
  }
12848
12848
  }
12849
12849
  onEnd(span) {
@@ -13171,19 +13171,19 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
13171
13171
  ];
13172
13172
 
13173
13173
  class AbstractAsyncHooksContextManager {
13174
- bind(context6, target) {
13174
+ bind(context7, target) {
13175
13175
  if (target instanceof events_1.EventEmitter) {
13176
- return this._bindEventEmitter(context6, target);
13176
+ return this._bindEventEmitter(context7, target);
13177
13177
  }
13178
13178
  if (typeof target === "function") {
13179
- return this._bindFunction(context6, target);
13179
+ return this._bindFunction(context7, target);
13180
13180
  }
13181
13181
  return target;
13182
13182
  }
13183
- _bindFunction(context6, target) {
13183
+ _bindFunction(context7, target) {
13184
13184
  const manager = this;
13185
13185
  const contextWrapper = function(...args) {
13186
- return manager.with(context6, () => target.apply(this, args));
13186
+ return manager.with(context7, () => target.apply(this, args));
13187
13187
  };
13188
13188
  Object.defineProperty(contextWrapper, "length", {
13189
13189
  enumerable: false,
@@ -13193,7 +13193,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
13193
13193
  });
13194
13194
  return contextWrapper;
13195
13195
  }
13196
- _bindEventEmitter(context6, ee) {
13196
+ _bindEventEmitter(context7, ee) {
13197
13197
  const map = this._getPatchMap(ee);
13198
13198
  if (map !== undefined)
13199
13199
  return ee;
@@ -13201,7 +13201,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
13201
13201
  ADD_LISTENER_METHODS.forEach((methodName) => {
13202
13202
  if (ee[methodName] === undefined)
13203
13203
  return;
13204
- ee[methodName] = this._patchAddListener(ee, ee[methodName], context6);
13204
+ ee[methodName] = this._patchAddListener(ee, ee[methodName], context7);
13205
13205
  });
13206
13206
  if (typeof ee.removeListener === "function") {
13207
13207
  ee.removeListener = this._patchRemoveListener(ee, ee.removeListener);
@@ -13239,7 +13239,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
13239
13239
  return original.apply(this, arguments);
13240
13240
  };
13241
13241
  }
13242
- _patchAddListener(ee, original, context6) {
13242
+ _patchAddListener(ee, original, context7) {
13243
13243
  const contextManager = this;
13244
13244
  return function(event, listener) {
13245
13245
  if (contextManager._wrapped) {
@@ -13254,7 +13254,7 @@ var require_AbstractAsyncHooksContextManager = __commonJS((exports) => {
13254
13254
  listeners = new WeakMap;
13255
13255
  map[event] = listeners;
13256
13256
  }
13257
- const patchedListener = contextManager.bind(context6, listener);
13257
+ const patchedListener = contextManager.bind(context7, listener);
13258
13258
  listeners.set(listener, patchedListener);
13259
13259
  contextManager._wrapped = true;
13260
13260
  try {
@@ -13303,8 +13303,8 @@ var require_AsyncHooksContextManager = __commonJS((exports) => {
13303
13303
  active() {
13304
13304
  return this._stack[this._stack.length - 1] ?? api_1.ROOT_CONTEXT;
13305
13305
  }
13306
- with(context6, fn, thisArg, ...args) {
13307
- this._enterContext(context6);
13306
+ with(context7, fn, thisArg, ...args) {
13307
+ this._enterContext(context7);
13308
13308
  try {
13309
13309
  return fn.call(thisArg, ...args);
13310
13310
  } finally {
@@ -13324,25 +13324,25 @@ var require_AsyncHooksContextManager = __commonJS((exports) => {
13324
13324
  _init(uid, type) {
13325
13325
  if (type === "TIMERWRAP")
13326
13326
  return;
13327
- const context6 = this._stack[this._stack.length - 1];
13328
- if (context6 !== undefined) {
13329
- this._contexts.set(uid, context6);
13327
+ const context7 = this._stack[this._stack.length - 1];
13328
+ if (context7 !== undefined) {
13329
+ this._contexts.set(uid, context7);
13330
13330
  }
13331
13331
  }
13332
13332
  _destroy(uid) {
13333
13333
  this._contexts.delete(uid);
13334
13334
  }
13335
13335
  _before(uid) {
13336
- const context6 = this._contexts.get(uid);
13337
- if (context6 !== undefined) {
13338
- this._enterContext(context6);
13336
+ const context7 = this._contexts.get(uid);
13337
+ if (context7 !== undefined) {
13338
+ this._enterContext(context7);
13339
13339
  }
13340
13340
  }
13341
13341
  _after() {
13342
13342
  this._exitContext();
13343
13343
  }
13344
- _enterContext(context6) {
13345
- this._stack.push(context6);
13344
+ _enterContext(context7) {
13345
+ this._stack.push(context7);
13346
13346
  }
13347
13347
  _exitContext() {
13348
13348
  this._stack.pop();
@@ -13368,9 +13368,9 @@ var require_AsyncLocalStorageContextManager = __commonJS((exports) => {
13368
13368
  active() {
13369
13369
  return this._asyncLocalStorage.getStore() ?? api_1.ROOT_CONTEXT;
13370
13370
  }
13371
- with(context6, fn, thisArg, ...args) {
13371
+ with(context7, fn, thisArg, ...args) {
13372
13372
  const cb = thisArg == null ? fn : fn.bind(thisArg);
13373
- return this._asyncLocalStorage.run(context6, cb, ...args);
13373
+ return this._asyncLocalStorage.run(context7, cb, ...args);
13374
13374
  }
13375
13375
  enable() {
13376
13376
  return this;
@@ -19072,6 +19072,9 @@ var require_parse_options = __commonJS((exports, module) => {
19072
19072
  var require_identifiers = __commonJS((exports, module) => {
19073
19073
  var numeric = /^[0-9]+$/;
19074
19074
  var compareIdentifiers = (a, b) => {
19075
+ if (typeof a === "number" && typeof b === "number") {
19076
+ return a === b ? 0 : a < b ? -1 : 1;
19077
+ }
19075
19078
  const anum = numeric.test(a);
19076
19079
  const bnum = numeric.test(b);
19077
19080
  if (anum && bnum) {
@@ -19174,7 +19177,25 @@ var require_semver3 = __commonJS((exports, module) => {
19174
19177
  if (!(other instanceof SemVer)) {
19175
19178
  other = new SemVer(other, this.options);
19176
19179
  }
19177
- return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
19180
+ if (this.major < other.major) {
19181
+ return -1;
19182
+ }
19183
+ if (this.major > other.major) {
19184
+ return 1;
19185
+ }
19186
+ if (this.minor < other.minor) {
19187
+ return -1;
19188
+ }
19189
+ if (this.minor > other.minor) {
19190
+ return 1;
19191
+ }
19192
+ if (this.patch < other.patch) {
19193
+ return -1;
19194
+ }
19195
+ if (this.patch > other.patch) {
19196
+ return 1;
19197
+ }
19198
+ return 0;
19178
19199
  }
19179
19200
  comparePre(other) {
19180
19201
  if (!(other instanceof SemVer)) {
@@ -19851,6 +19872,7 @@ var require_range = __commonJS((exports, module) => {
19851
19872
  return result;
19852
19873
  };
19853
19874
  var parseComparator = (comp, options) => {
19875
+ comp = comp.replace(re[t.BUILD], "");
19854
19876
  debug2("comp", comp, options);
19855
19877
  comp = replaceCarets(comp, options);
19856
19878
  debug2("caret", comp);
@@ -21778,7 +21800,7 @@ var require_utils20 = __commonJS((exports) => {
21778
21800
  var types_1 = require_types3();
21779
21801
  var AttributeNames_1 = require_AttributeNames7();
21780
21802
  var semantic_conventions_1 = require_src2();
21781
- var getMiddlewareMetadata = (context11, layer, isRouter, layerPath) => {
21803
+ var getMiddlewareMetadata = (context12, layer, isRouter, layerPath) => {
21782
21804
  if (isRouter) {
21783
21805
  return {
21784
21806
  attributes: {
@@ -21786,7 +21808,7 @@ var require_utils20 = __commonJS((exports) => {
21786
21808
  [AttributeNames_1.AttributeNames.KOA_TYPE]: types_1.KoaLayerType.ROUTER,
21787
21809
  [semantic_conventions_1.SEMATTRS_HTTP_ROUTE]: layerPath?.toString()
21788
21810
  },
21789
- name: context11._matchedRouteName || `router - ${layerPath}`
21811
+ name: context12._matchedRouteName || `router - ${layerPath}`
21790
21812
  };
21791
21813
  } else {
21792
21814
  return {
@@ -21882,23 +21904,23 @@ var require_instrumentation17 = __commonJS((exports) => {
21882
21904
  }
21883
21905
  middlewareLayer[internal_types_1.kLayerPatched] = true;
21884
21906
  api2.diag.debug("patching Koa middleware layer");
21885
- return async (context11, next) => {
21907
+ return async (context12, next) => {
21886
21908
  const parent = api2.trace.getSpan(api2.context.active());
21887
21909
  if (parent === undefined) {
21888
- return middlewareLayer(context11, next);
21910
+ return middlewareLayer(context12, next);
21889
21911
  }
21890
- const metadata = (0, utils_1.getMiddlewareMetadata)(context11, middlewareLayer, isRouter, layerPath);
21912
+ const metadata = (0, utils_1.getMiddlewareMetadata)(context12, middlewareLayer, isRouter, layerPath);
21891
21913
  const span = this.tracer.startSpan(metadata.name, {
21892
21914
  attributes: metadata.attributes
21893
21915
  });
21894
21916
  const rpcMetadata = (0, core_1.getRPCMetadata)(api2.context.active());
21895
- if (rpcMetadata?.type === core_1.RPCType.HTTP && context11._matchedRoute) {
21896
- rpcMetadata.route = context11._matchedRoute.toString();
21917
+ if (rpcMetadata?.type === core_1.RPCType.HTTP && context12._matchedRoute) {
21918
+ rpcMetadata.route = context12._matchedRoute.toString();
21897
21919
  }
21898
21920
  const { requestHook: requestHook2 } = this.getConfig();
21899
21921
  if (requestHook2) {
21900
21922
  (0, instrumentation_1.safeExecuteInTheMiddle)(() => requestHook2(span, {
21901
- context: context11,
21923
+ context: context12,
21902
21924
  middlewareLayer,
21903
21925
  layerType
21904
21926
  }), (e) => {
@@ -21910,7 +21932,7 @@ var require_instrumentation17 = __commonJS((exports) => {
21910
21932
  const newContext = api2.trace.setSpan(api2.context.active(), span);
21911
21933
  return api2.context.with(newContext, async () => {
21912
21934
  try {
21913
- return await middlewareLayer(context11, next);
21935
+ return await middlewareLayer(context12, next);
21914
21936
  } catch (err) {
21915
21937
  span.recordException(err);
21916
21938
  throw err;
@@ -22615,16 +22637,16 @@ var require_utils23 = __commonJS((exports) => {
22615
22637
  return attributes;
22616
22638
  };
22617
22639
  exports.getConnectionAttributesFromUrl = getConnectionAttributesFromUrl;
22618
- var markConfirmChannelTracing = (context11) => {
22619
- return context11.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);
22640
+ var markConfirmChannelTracing = (context12) => {
22641
+ return context12.setValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY, true);
22620
22642
  };
22621
22643
  exports.markConfirmChannelTracing = markConfirmChannelTracing;
22622
- var unmarkConfirmChannelTracing = (context11) => {
22623
- return context11.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);
22644
+ var unmarkConfirmChannelTracing = (context12) => {
22645
+ return context12.deleteValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY);
22624
22646
  };
22625
22647
  exports.unmarkConfirmChannelTracing = unmarkConfirmChannelTracing;
22626
- var isConfirmChannelTracing = (context11) => {
22627
- return context11.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;
22648
+ var isConfirmChannelTracing = (context12) => {
22649
+ return context12.getValue(IS_CONFIRM_CHANNEL_CONTEXT_KEY) === true;
22628
22650
  };
22629
22651
  exports.isConfirmChannelTracing = isConfirmChannelTracing;
22630
22652
  });
@@ -23045,7 +23067,7 @@ var require_src32 = __commonJS((exports) => {
23045
23067
 
23046
23068
  // src/index.ts
23047
23069
  import {
23048
- logger as logger32,
23070
+ logger as logger30,
23049
23071
  parseBooleanFromText,
23050
23072
  getDatabaseDir,
23051
23073
  getGeneratedDir as getGeneratedDir2,
@@ -23595,10 +23617,10 @@ var helmet = Object.assign(function helmet2(options = {}) {
23595
23617
  });
23596
23618
 
23597
23619
  // src/index.ts
23598
- import * as fs7 from "node:fs";
23620
+ import * as fs6 from "node:fs";
23599
23621
  import http4 from "node:http";
23600
23622
  import os3 from "node:os";
23601
- import path9, { basename as basename2, dirname as dirname3, extname, join as join5 } from "node:path";
23623
+ import path8, { basename as basename2, dirname as dirname3, extname, join as join4 } from "node:path";
23602
23624
  import { fileURLToPath as fileURLToPath2 } from "node:url";
23603
23625
 
23604
23626
  // src/api/index.ts
@@ -28833,7 +28855,7 @@ import express30 from "express";
28833
28855
  // package.json
28834
28856
  var package_default = {
28835
28857
  name: "@elizaos/server",
28836
- version: "1.6.2-alpha.10",
28858
+ version: "1.6.2-alpha.11",
28837
28859
  description: "ElizaOS Server - Core server infrastructure for ElizaOS agents",
28838
28860
  publishConfig: {
28839
28861
  access: "public",
@@ -30380,7 +30402,7 @@ async function loadCharacters(charactersArg) {
30380
30402
  }
30381
30403
 
30382
30404
  // ../../node_modules/@sentry/node/build/esm/integrations/http.js
30383
- var import_api9 = __toESM(require_src(), 1);
30405
+ var import_api10 = __toESM(require_src(), 1);
30384
30406
  var import_instrumentation_http = __toESM(require_src7(), 1);
30385
30407
 
30386
30408
  // ../../node_modules/@sentry/core/build/esm/debug-build.js
@@ -30390,7 +30412,7 @@ var DEBUG_BUILD = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
30390
30412
  var GLOBAL_OBJ = globalThis;
30391
30413
 
30392
30414
  // ../../node_modules/@sentry/core/build/esm/utils/version.js
30393
- var SDK_VERSION = "10.16.0";
30415
+ var SDK_VERSION = "10.18.0";
30394
30416
 
30395
30417
  // ../../node_modules/@sentry/core/build/esm/carrier.js
30396
30418
  function getMainCarrier() {
@@ -31820,13 +31842,21 @@ function parseBaggageHeader(baggageHeader) {
31820
31842
  return baggageHeaderToObject(baggageHeader);
31821
31843
  }
31822
31844
  function baggageHeaderToObject(baggageHeader) {
31823
- return baggageHeader.split(",").map((baggageEntry) => baggageEntry.split("=").map((keyOrValue) => {
31824
- try {
31825
- return decodeURIComponent(keyOrValue.trim());
31826
- } catch {
31827
- return;
31845
+ return baggageHeader.split(",").map((baggageEntry) => {
31846
+ const eqIdx = baggageEntry.indexOf("=");
31847
+ if (eqIdx === -1) {
31848
+ return [];
31828
31849
  }
31829
- })).reduce((acc, [key, value]) => {
31850
+ const key = baggageEntry.slice(0, eqIdx);
31851
+ const value = baggageEntry.slice(eqIdx + 1);
31852
+ return [key, value].map((keyOrValue) => {
31853
+ try {
31854
+ return decodeURIComponent(keyOrValue.trim());
31855
+ } catch {
31856
+ return;
31857
+ }
31858
+ });
31859
+ }).reduce((acc, [key, value]) => {
31830
31860
  if (key && value) {
31831
31861
  acc[key] = value;
31832
31862
  }
@@ -35795,6 +35825,7 @@ function _INTERNAL_cleanupToolCallSpan(toolCallId) {
35795
35825
 
35796
35826
  // ../../node_modules/@sentry/core/build/esm/utils/vercel-ai/vercel-ai-attributes.js
35797
35827
  var AI_PROMPT_ATTRIBUTE = "ai.prompt";
35828
+ var AI_SCHEMA_ATTRIBUTE = "ai.schema";
35798
35829
  var AI_RESPONSE_OBJECT_ATTRIBUTE = "ai.response.object";
35799
35830
  var AI_RESPONSE_TEXT_ATTRIBUTE = "ai.response.text";
35800
35831
  var AI_RESPONSE_TOOL_CALLS_ATTRIBUTE = "ai.response.toolCalls";
@@ -35871,6 +35902,7 @@ function processEndedVercelAiSpan(span) {
35871
35902
  renameAttributeKey(attributes, AI_PROMPT_TOOLS_ATTRIBUTE, "gen_ai.request.available_tools");
35872
35903
  renameAttributeKey(attributes, AI_TOOL_CALL_ARGS_ATTRIBUTE, "gen_ai.tool.input");
35873
35904
  renameAttributeKey(attributes, AI_TOOL_CALL_RESULT_ATTRIBUTE, "gen_ai.tool.output");
35905
+ renameAttributeKey(attributes, AI_SCHEMA_ATTRIBUTE, "gen_ai.request.schema");
35874
35906
  addProviderMetadataToAttributes(attributes);
35875
35907
  for (const key of Object.keys(attributes)) {
35876
35908
  if (key.startsWith("ai.")) {
@@ -35907,7 +35939,7 @@ function processGenerateSpan(span, name, attributes) {
35907
35939
  span.setAttribute("ai.pipeline.name", nameWthoutAi);
35908
35940
  span.updateName(nameWthoutAi);
35909
35941
  const functionId = attributes[AI_TELEMETRY_FUNCTION_ID_ATTRIBUTE];
35910
- if (functionId && typeof functionId === "string" && name.split(".").length - 1 === 1) {
35942
+ if (functionId && typeof functionId === "string") {
35911
35943
  span.updateName(`${nameWthoutAi} ${functionId}`);
35912
35944
  span.setAttribute("gen_ai.function_id", functionId);
35913
35945
  }
@@ -36935,11 +36967,112 @@ function instrumentAnthropicAiClient(anthropicAiClient, options) {
36935
36967
  }
36936
36968
  // ../../node_modules/@sentry/core/build/esm/utils/google-genai/constants.js
36937
36969
  var GOOGLE_GENAI_INTEGRATION_NAME = "Google_GenAI";
36938
- var GOOGLE_GENAI_INSTRUMENTED_METHODS = ["models.generateContent", "chats.create", "sendMessage"];
36970
+ var GOOGLE_GENAI_INSTRUMENTED_METHODS = [
36971
+ "models.generateContent",
36972
+ "models.generateContentStream",
36973
+ "chats.create",
36974
+ "sendMessage",
36975
+ "sendMessageStream"
36976
+ ];
36939
36977
  var GOOGLE_GENAI_SYSTEM_NAME = "google_genai";
36940
36978
  var CHATS_CREATE_METHOD = "chats.create";
36941
36979
  var CHAT_PATH = "chat";
36942
36980
 
36981
+ // ../../node_modules/@sentry/core/build/esm/utils/google-genai/streaming.js
36982
+ function isErrorChunk(chunk, span) {
36983
+ const feedback = chunk?.promptFeedback;
36984
+ if (feedback?.blockReason) {
36985
+ const message = feedback.blockReasonMessage ?? feedback.blockReason;
36986
+ span.setStatus({ code: SPAN_STATUS_ERROR, message: `Content blocked: ${message}` });
36987
+ captureException(`Content blocked: ${message}`, {
36988
+ mechanism: { handled: false, type: "auto.ai.google_genai" }
36989
+ });
36990
+ return true;
36991
+ }
36992
+ return false;
36993
+ }
36994
+ function handleResponseMetadata(chunk, state) {
36995
+ if (typeof chunk.responseId === "string")
36996
+ state.responseId = chunk.responseId;
36997
+ if (typeof chunk.modelVersion === "string")
36998
+ state.responseModel = chunk.modelVersion;
36999
+ const usage = chunk.usageMetadata;
37000
+ if (usage) {
37001
+ if (typeof usage.promptTokenCount === "number")
37002
+ state.promptTokens = usage.promptTokenCount;
37003
+ if (typeof usage.candidatesTokenCount === "number")
37004
+ state.completionTokens = usage.candidatesTokenCount;
37005
+ if (typeof usage.totalTokenCount === "number")
37006
+ state.totalTokens = usage.totalTokenCount;
37007
+ }
37008
+ }
37009
+ function handleCandidateContent(chunk, state, recordOutputs) {
37010
+ if (Array.isArray(chunk.functionCalls)) {
37011
+ state.toolCalls.push(...chunk.functionCalls);
37012
+ }
37013
+ for (const candidate of chunk.candidates ?? []) {
37014
+ if (candidate?.finishReason && !state.finishReasons.includes(candidate.finishReason)) {
37015
+ state.finishReasons.push(candidate.finishReason);
37016
+ }
37017
+ for (const part of candidate?.content?.parts ?? []) {
37018
+ if (recordOutputs && part.text)
37019
+ state.responseTexts.push(part.text);
37020
+ if (part.functionCall) {
37021
+ state.toolCalls.push({
37022
+ type: "function",
37023
+ id: part.functionCall.id,
37024
+ name: part.functionCall.name,
37025
+ arguments: part.functionCall.args
37026
+ });
37027
+ }
37028
+ }
37029
+ }
37030
+ }
37031
+ function processChunk(chunk, state, recordOutputs, span) {
37032
+ if (!chunk || isErrorChunk(chunk, span))
37033
+ return;
37034
+ handleResponseMetadata(chunk, state);
37035
+ handleCandidateContent(chunk, state, recordOutputs);
37036
+ }
37037
+ async function* instrumentStream2(stream, span, recordOutputs) {
37038
+ const state = {
37039
+ responseTexts: [],
37040
+ finishReasons: [],
37041
+ toolCalls: []
37042
+ };
37043
+ try {
37044
+ for await (const chunk of stream) {
37045
+ processChunk(chunk, state, recordOutputs, span);
37046
+ yield chunk;
37047
+ }
37048
+ } finally {
37049
+ const attrs = {
37050
+ [GEN_AI_RESPONSE_STREAMING_ATTRIBUTE]: true
37051
+ };
37052
+ if (state.responseId)
37053
+ attrs[GEN_AI_RESPONSE_ID_ATTRIBUTE] = state.responseId;
37054
+ if (state.responseModel)
37055
+ attrs[GEN_AI_RESPONSE_MODEL_ATTRIBUTE] = state.responseModel;
37056
+ if (state.promptTokens !== undefined)
37057
+ attrs[GEN_AI_USAGE_INPUT_TOKENS_ATTRIBUTE] = state.promptTokens;
37058
+ if (state.completionTokens !== undefined)
37059
+ attrs[GEN_AI_USAGE_OUTPUT_TOKENS_ATTRIBUTE] = state.completionTokens;
37060
+ if (state.totalTokens !== undefined)
37061
+ attrs[GEN_AI_USAGE_TOTAL_TOKENS_ATTRIBUTE] = state.totalTokens;
37062
+ if (state.finishReasons.length) {
37063
+ attrs[GEN_AI_RESPONSE_FINISH_REASONS_ATTRIBUTE] = JSON.stringify(state.finishReasons);
37064
+ }
37065
+ if (recordOutputs && state.responseTexts.length) {
37066
+ attrs[GEN_AI_RESPONSE_TEXT_ATTRIBUTE] = state.responseTexts.join("");
37067
+ }
37068
+ if (recordOutputs && state.toolCalls.length) {
37069
+ attrs[GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE] = JSON.stringify(state.toolCalls);
37070
+ }
37071
+ span.setAttributes(attrs);
37072
+ span.end();
37073
+ }
37074
+ }
37075
+
36943
37076
  // ../../node_modules/@sentry/core/build/esm/utils/google-genai/utils.js
36944
37077
  function shouldInstrument3(methodPath) {
36945
37078
  if (GOOGLE_GENAI_INSTRUMENTED_METHODS.includes(methodPath)) {
@@ -36948,6 +37081,9 @@ function shouldInstrument3(methodPath) {
36948
37081
  const methodName = methodPath.split(".").pop();
36949
37082
  return GOOGLE_GENAI_INSTRUMENTED_METHODS.includes(methodName);
36950
37083
  }
37084
+ function isStreamingMethod(methodPath) {
37085
+ return methodPath.includes("Stream") || methodPath.endsWith("generateContentStream") || methodPath.endsWith("sendMessageStream");
37086
+ }
36951
37087
 
36952
37088
  // ../../node_modules/@sentry/core/build/esm/utils/google-genai/index.js
36953
37089
  function extractModel(params, context) {
@@ -36987,17 +37123,21 @@ function extractConfigAttributes(config) {
36987
37123
  }
36988
37124
  return attributes;
36989
37125
  }
36990
- function extractRequestAttributes3(args, methodPath, context) {
37126
+ function extractRequestAttributes3(methodPath, params, context) {
36991
37127
  const attributes = {
36992
37128
  [GEN_AI_SYSTEM_ATTRIBUTE]: GOOGLE_GENAI_SYSTEM_NAME,
36993
37129
  [GEN_AI_OPERATION_NAME_ATTRIBUTE]: getFinalOperationName(methodPath),
36994
37130
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.ai.google_genai"
36995
37131
  };
36996
- if (args.length > 0 && typeof args[0] === "object" && args[0] !== null) {
36997
- const params = args[0];
37132
+ if (params) {
36998
37133
  attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] = extractModel(params, context);
36999
37134
  if ("config" in params && typeof params.config === "object" && params.config) {
37000
- Object.assign(attributes, extractConfigAttributes(params.config));
37135
+ const config = params.config;
37136
+ Object.assign(attributes, extractConfigAttributes(config));
37137
+ if ("tools" in config && Array.isArray(config.tools)) {
37138
+ const functionDeclarations = config.tools.map((tool) => tool.functionDeclarations);
37139
+ attributes[GEN_AI_REQUEST_AVAILABLE_TOOLS_ATTRIBUTE] = JSON.stringify(functionDeclarations);
37140
+ }
37001
37141
  }
37002
37142
  } else {
37003
37143
  attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] = extractModel({}, context);
@@ -37049,33 +37189,69 @@ function addResponseAttributes3(span, response, recordOutputs) {
37049
37189
  });
37050
37190
  }
37051
37191
  }
37192
+ if (recordOutputs && response.functionCalls) {
37193
+ const functionCalls = response.functionCalls;
37194
+ if (Array.isArray(functionCalls) && functionCalls.length > 0) {
37195
+ span.setAttributes({
37196
+ [GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE]: JSON.stringify(functionCalls)
37197
+ });
37198
+ }
37199
+ }
37052
37200
  }
37053
37201
  function instrumentMethod3(originalMethod, methodPath, context, options) {
37054
37202
  const isSyncCreate = methodPath === CHATS_CREATE_METHOD;
37055
- const run = (...args) => {
37056
- const requestAttributes = extractRequestAttributes3(args, methodPath, context);
37057
- const model = requestAttributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] ?? "unknown";
37058
- const operationName = getFinalOperationName(methodPath);
37059
- return startSpan({
37060
- name: isSyncCreate ? `${operationName} ${model} create` : `${operationName} ${model}`,
37061
- op: getSpanOperation2(methodPath),
37062
- attributes: requestAttributes
37063
- }, (span) => {
37064
- if (options.recordInputs && args[0] && typeof args[0] === "object") {
37065
- addPrivateRequestAttributes2(span, args[0]);
37066
- }
37067
- return handleCallbackErrors(() => originalMethod.apply(context, args), (error2) => {
37068
- captureException(error2, {
37069
- mechanism: { handled: false, type: "auto.ai.google_genai", data: { function: methodPath } }
37203
+ return new Proxy(originalMethod, {
37204
+ apply(target, _, args) {
37205
+ const params = args[0];
37206
+ const requestAttributes = extractRequestAttributes3(methodPath, params, context);
37207
+ const model = requestAttributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] ?? "unknown";
37208
+ const operationName = getFinalOperationName(methodPath);
37209
+ if (isStreamingMethod(methodPath)) {
37210
+ return startSpanManual({
37211
+ name: `${operationName} ${model} stream-response`,
37212
+ op: getSpanOperation2(methodPath),
37213
+ attributes: requestAttributes
37214
+ }, async (span) => {
37215
+ try {
37216
+ if (options.recordInputs && params) {
37217
+ addPrivateRequestAttributes2(span, params);
37218
+ }
37219
+ const stream = await target.apply(context, args);
37220
+ return instrumentStream2(stream, span, Boolean(options.recordOutputs));
37221
+ } catch (error2) {
37222
+ span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
37223
+ captureException(error2, {
37224
+ mechanism: {
37225
+ handled: false,
37226
+ type: "auto.ai.google_genai",
37227
+ data: { function: methodPath }
37228
+ }
37229
+ });
37230
+ span.end();
37231
+ throw error2;
37232
+ }
37070
37233
  });
37071
- }, () => {}, (result) => {
37072
- if (!isSyncCreate) {
37073
- addResponseAttributes3(span, result, options.recordOutputs);
37234
+ }
37235
+ return startSpan({
37236
+ name: isSyncCreate ? `${operationName} ${model} create` : `${operationName} ${model}`,
37237
+ op: getSpanOperation2(methodPath),
37238
+ attributes: requestAttributes
37239
+ }, (span) => {
37240
+ if (options.recordInputs && params) {
37241
+ addPrivateRequestAttributes2(span, params);
37074
37242
  }
37243
+ return handleCallbackErrors(() => target.apply(context, args), (error2) => {
37244
+ captureException(error2, {
37245
+ mechanism: { handled: false, type: "auto.ai.google_genai", data: { function: methodPath } }
37246
+ });
37247
+ }, () => {}, (result) => {
37248
+ if (!isSyncCreate) {
37249
+ addResponseAttributes3(span, result, options.recordOutputs);
37250
+ }
37251
+ });
37075
37252
  });
37076
- });
37077
- };
37078
- return run;
37253
+ }
37254
+ });
37079
37255
  }
37080
37256
  function createDeepProxy3(target, currentPath = "", options) {
37081
37257
  return new Proxy(target, {
@@ -37282,9 +37458,6 @@ class LRUMap {
37282
37458
  return values;
37283
37459
  }
37284
37460
  }
37285
- // ../../node_modules/@sentry/node-core/build/esm/debug-build.js
37286
- var DEBUG_BUILD2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
37287
-
37288
37461
  // ../../node_modules/@sentry/node-core/build/esm/otel/instrument.js
37289
37462
  var import_instrumentation = __toESM(require_src6(), 1);
37290
37463
  var INSTRUMENTED = {};
@@ -37354,76 +37527,85 @@ function hasWrap(instrumentation) {
37354
37527
  return typeof instrumentation["_wrap"] === "function";
37355
37528
  }
37356
37529
 
37357
- // ../../node_modules/@sentry/node-core/build/esm/integrations/http/SentryHttpInstrumentation.js
37358
- var import_api4 = __toESM(require_src(), 1);
37359
- var import_core40 = __toESM(require_src3(), 1);
37360
- var import_instrumentation2 = __toESM(require_src6(), 1);
37361
- import { subscribe, unsubscribe } from "node:diagnostics_channel";
37530
+ // ../../node_modules/@sentry/node-core/build/esm/integrations/http/httpServerIntegration.js
37531
+ var import_api2 = __toESM(require_src(), 1);
37532
+ import { subscribe } from "node:diagnostics_channel";
37362
37533
 
37363
- // ../../node_modules/@sentry/node-core/build/esm/utils/getRequestUrl.js
37364
- function getRequestUrl(requestOptions) {
37365
- const protocol = requestOptions.protocol || "";
37366
- const hostname = requestOptions.hostname || requestOptions.host || "";
37367
- const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname) ? "" : `:${requestOptions.port}`;
37368
- const path7 = requestOptions.path ? requestOptions.path : "/";
37369
- return `${protocol}//${hostname}${port}${path7}`;
37370
- }
37534
+ // ../../node_modules/@sentry/node-core/build/esm/debug-build.js
37535
+ var DEBUG_BUILD2 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
37371
37536
 
37372
37537
  // ../../node_modules/@sentry/node-core/build/esm/integrations/http/constants.js
37373
37538
  var INSTRUMENTATION_NAME = "@sentry/instrumentation-http";
37374
37539
  var MAX_BODY_BYTE_LENGTH = 1024 * 1024;
37375
37540
 
37376
- // ../../node_modules/@sentry/node-core/build/esm/integrations/http/incoming-requests.js
37377
- var import_api2 = __toESM(require_src(), 1);
37378
- var import_core34 = __toESM(require_src3(), 1);
37379
- var import_semantic_conventions = __toESM(require_src2(), 1);
37380
- import { errorMonitor } from "events";
37541
+ // ../../node_modules/@sentry/node-core/build/esm/integrations/http/httpServerIntegration.js
37381
37542
  var HTTP_SERVER_INSTRUMENTED_KEY = import_api2.createContextKey("sentry_http_server_instrumented");
37543
+ var INTEGRATION_NAME6 = "Http.Server";
37382
37544
  var clientToRequestSessionAggregatesMap = new Map;
37383
37545
  var wrappedEmitFns = new WeakSet;
37546
+ function addStartSpanCallback(request, callback) {
37547
+ addNonEnumerableProperty(request, "_startSpanCallback", new WeakRef(callback));
37548
+ }
37549
+ var _httpServerIntegration = (options = {}) => {
37550
+ const _options = {
37551
+ sessions: options.sessions ?? true,
37552
+ sessionFlushingDelayMS: options.sessionFlushingDelayMS ?? 60000,
37553
+ maxRequestBodySize: options.maxRequestBodySize ?? "medium",
37554
+ ignoreRequestBody: options.ignoreRequestBody
37555
+ };
37556
+ return {
37557
+ name: INTEGRATION_NAME6,
37558
+ setupOnce() {
37559
+ const onHttpServerRequestStart = (_data) => {
37560
+ const data = _data;
37561
+ instrumentServer(data.server, _options);
37562
+ };
37563
+ subscribe("http.server.request.start", onHttpServerRequestStart);
37564
+ },
37565
+ afterAllSetup(client) {
37566
+ if (DEBUG_BUILD2 && client.getIntegrationByName("Http")) {
37567
+ debug.warn("It seems that you have manually added `httpServerIntegration` while `httpIntegration` is also present. Make sure to remove `httpServerIntegration` when adding `httpIntegration`.");
37568
+ }
37569
+ }
37570
+ };
37571
+ };
37572
+ var httpServerIntegration = _httpServerIntegration;
37384
37573
  function instrumentServer(server, {
37385
- ignoreIncomingRequestBody,
37386
- ignoreSpansForIncomingRequests,
37387
- maxIncomingRequestBodySize = "medium",
37388
- trackIncomingRequestsAsSessions = true,
37389
- spans,
37390
- ignoreStaticAssets = true,
37391
- sessionFlushingDelayMS,
37392
- instrumentation,
37393
- incomingRequestSpanHook
37574
+ ignoreRequestBody,
37575
+ maxRequestBodySize,
37576
+ sessions: sessions2,
37577
+ sessionFlushingDelayMS
37394
37578
  }) {
37395
37579
  const originalEmit = server.emit;
37396
37580
  if (wrappedEmitFns.has(originalEmit)) {
37397
- DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, "Incoming requests already instrumented, not instrumenting again...");
37398
37581
  return;
37399
37582
  }
37400
- const { requestHook, responseHook, applyCustomAttributesOnSpan } = instrumentation ?? {};
37401
37583
  const newEmit = new Proxy(originalEmit, {
37402
37584
  apply(target, thisArg, args) {
37403
37585
  if (args[0] !== "request") {
37404
37586
  return target.apply(thisArg, args);
37405
37587
  }
37406
- if (import_api2.context.active().getValue(HTTP_SERVER_INSTRUMENTED_KEY)) {
37588
+ const client = getClient();
37589
+ if (import_api2.context.active().getValue(HTTP_SERVER_INSTRUMENTED_KEY) || !client) {
37407
37590
  return target.apply(thisArg, args);
37408
37591
  }
37409
- DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, "Handling incoming request");
37410
- const client = getClient();
37592
+ DEBUG_BUILD2 && debug.log(INTEGRATION_NAME6, "Handling incoming request");
37411
37593
  const isolationScope = getIsolationScope().clone();
37412
37594
  const request = args[1];
37413
37595
  const response = args[2];
37414
37596
  const normalizedRequest = httpRequestToRequestData(request);
37415
37597
  const ipAddress = request.ip || request.socket?.remoteAddress;
37416
37598
  const url = request.url || "/";
37417
- if (maxIncomingRequestBodySize !== "none" && !ignoreIncomingRequestBody?.(url, request)) {
37418
- patchRequestToCaptureBody(request, isolationScope, maxIncomingRequestBodySize);
37599
+ if (maxRequestBodySize !== "none" && !ignoreRequestBody?.(url, request)) {
37600
+ patchRequestToCaptureBody(request, isolationScope, maxRequestBodySize);
37419
37601
  }
37420
37602
  isolationScope.setSDKProcessingMetadata({ normalizedRequest, ipAddress });
37421
37603
  const httpMethod = (request.method || "GET").toUpperCase();
37422
37604
  const httpTargetWithoutQueryFragment = stripUrlQueryAndFragment(url);
37423
37605
  const bestEffortTransactionName = `${httpMethod} ${httpTargetWithoutQueryFragment}`;
37424
37606
  isolationScope.setTransactionName(bestEffortTransactionName);
37425
- if (trackIncomingRequestsAsSessions !== false) {
37426
- recordRequestSession({
37607
+ if (sessions2 && client) {
37608
+ recordRequestSession(client, {
37427
37609
  requestIsolationScope: isolationScope,
37428
37610
  response,
37429
37611
  sessionFlushingDelayMS: sessionFlushingDelayMS ?? 60000
@@ -37433,14 +37615,170 @@ function instrumentServer(server, {
37433
37615
  getCurrentScope().getPropagationContext().propagationSpanId = generateSpanId();
37434
37616
  const ctx = import_api2.propagation.extract(import_api2.context.active(), normalizedRequest.headers).setValue(HTTP_SERVER_INSTRUMENTED_KEY, true);
37435
37617
  return import_api2.context.with(ctx, () => {
37436
- if (typeof __SENTRY_TRACING__ !== "undefined" && !__SENTRY_TRACING__ || !spans || !client || shouldIgnoreSpansForIncomingRequest(request, {
37618
+ client.emit("httpServerRequest", request, response, normalizedRequest);
37619
+ const callback = request._startSpanCallback?.deref();
37620
+ if (callback) {
37621
+ return callback(() => target.apply(thisArg, args));
37622
+ }
37623
+ return target.apply(thisArg, args);
37624
+ });
37625
+ });
37626
+ }
37627
+ });
37628
+ wrappedEmitFns.add(newEmit);
37629
+ server.emit = newEmit;
37630
+ }
37631
+ function recordRequestSession(client, {
37632
+ requestIsolationScope,
37633
+ response,
37634
+ sessionFlushingDelayMS
37635
+ }) {
37636
+ requestIsolationScope.setSDKProcessingMetadata({
37637
+ requestSession: { status: "ok" }
37638
+ });
37639
+ response.once("close", () => {
37640
+ const requestSession = requestIsolationScope.getScopeData().sdkProcessingMetadata.requestSession;
37641
+ if (client && requestSession) {
37642
+ DEBUG_BUILD2 && debug.log(`Recorded request session with status: ${requestSession.status}`);
37643
+ const roundedDate = new Date;
37644
+ roundedDate.setSeconds(0, 0);
37645
+ const dateBucketKey = roundedDate.toISOString();
37646
+ const existingClientAggregate = clientToRequestSessionAggregatesMap.get(client);
37647
+ const bucket = existingClientAggregate?.[dateBucketKey] || { exited: 0, crashed: 0, errored: 0 };
37648
+ bucket[{ ok: "exited", crashed: "crashed", errored: "errored" }[requestSession.status]]++;
37649
+ if (existingClientAggregate) {
37650
+ existingClientAggregate[dateBucketKey] = bucket;
37651
+ } else {
37652
+ DEBUG_BUILD2 && debug.log("Opened new request session aggregate.");
37653
+ const newClientAggregate = { [dateBucketKey]: bucket };
37654
+ clientToRequestSessionAggregatesMap.set(client, newClientAggregate);
37655
+ const flushPendingClientAggregates = () => {
37656
+ clearTimeout(timeout);
37657
+ unregisterClientFlushHook();
37658
+ clientToRequestSessionAggregatesMap.delete(client);
37659
+ const aggregatePayload = Object.entries(newClientAggregate).map(([timestamp, value]) => ({
37660
+ started: timestamp,
37661
+ exited: value.exited,
37662
+ errored: value.errored,
37663
+ crashed: value.crashed
37664
+ }));
37665
+ client.sendSession({ aggregates: aggregatePayload });
37666
+ };
37667
+ const unregisterClientFlushHook = client.on("flush", () => {
37668
+ DEBUG_BUILD2 && debug.log("Sending request session aggregate due to client flush");
37669
+ flushPendingClientAggregates();
37670
+ });
37671
+ const timeout = setTimeout(() => {
37672
+ DEBUG_BUILD2 && debug.log("Sending request session aggregate due to flushing schedule");
37673
+ flushPendingClientAggregates();
37674
+ }, sessionFlushingDelayMS).unref();
37675
+ }
37676
+ }
37677
+ });
37678
+ }
37679
+ function patchRequestToCaptureBody(req, isolationScope, maxIncomingRequestBodySize) {
37680
+ let bodyByteLength = 0;
37681
+ const chunks = [];
37682
+ DEBUG_BUILD2 && debug.log(INTEGRATION_NAME6, "Patching request.on");
37683
+ const callbackMap = new WeakMap;
37684
+ const maxBodySize = maxIncomingRequestBodySize === "small" ? 1000 : maxIncomingRequestBodySize === "medium" ? 1e4 : MAX_BODY_BYTE_LENGTH;
37685
+ try {
37686
+ req.on = new Proxy(req.on, {
37687
+ apply: (target, thisArg, args) => {
37688
+ const [event, listener, ...restArgs] = args;
37689
+ if (event === "data") {
37690
+ DEBUG_BUILD2 && debug.log(INTEGRATION_NAME6, `Handling request.on("data") with maximum body size of ${maxBodySize}b`);
37691
+ const callback = new Proxy(listener, {
37692
+ apply: (target2, thisArg2, args2) => {
37693
+ try {
37694
+ const chunk = args2[0];
37695
+ const bufferifiedChunk = Buffer.from(chunk);
37696
+ if (bodyByteLength < maxBodySize) {
37697
+ chunks.push(bufferifiedChunk);
37698
+ bodyByteLength += bufferifiedChunk.byteLength;
37699
+ } else if (DEBUG_BUILD2) {
37700
+ debug.log(INTEGRATION_NAME6, `Dropping request body chunk because maximum body length of ${maxBodySize}b is exceeded.`);
37701
+ }
37702
+ } catch (err) {
37703
+ DEBUG_BUILD2 && debug.error(INTEGRATION_NAME6, "Encountered error while storing body chunk.");
37704
+ }
37705
+ return Reflect.apply(target2, thisArg2, args2);
37706
+ }
37707
+ });
37708
+ callbackMap.set(listener, callback);
37709
+ return Reflect.apply(target, thisArg, [event, callback, ...restArgs]);
37710
+ }
37711
+ return Reflect.apply(target, thisArg, args);
37712
+ }
37713
+ });
37714
+ req.off = new Proxy(req.off, {
37715
+ apply: (target, thisArg, args) => {
37716
+ const [, listener] = args;
37717
+ const callback = callbackMap.get(listener);
37718
+ if (callback) {
37719
+ callbackMap.delete(listener);
37720
+ const modifiedArgs = args.slice();
37721
+ modifiedArgs[1] = callback;
37722
+ return Reflect.apply(target, thisArg, modifiedArgs);
37723
+ }
37724
+ return Reflect.apply(target, thisArg, args);
37725
+ }
37726
+ });
37727
+ req.on("end", () => {
37728
+ try {
37729
+ const body = Buffer.concat(chunks).toString("utf-8");
37730
+ if (body) {
37731
+ const bodyByteLength2 = Buffer.byteLength(body, "utf-8");
37732
+ const truncatedBody = bodyByteLength2 > maxBodySize ? `${Buffer.from(body).subarray(0, maxBodySize - 3).toString("utf-8")}...` : body;
37733
+ isolationScope.setSDKProcessingMetadata({ normalizedRequest: { data: truncatedBody } });
37734
+ }
37735
+ } catch (error2) {
37736
+ if (DEBUG_BUILD2) {
37737
+ debug.error(INTEGRATION_NAME6, "Error building captured request body", error2);
37738
+ }
37739
+ }
37740
+ });
37741
+ } catch (error2) {
37742
+ if (DEBUG_BUILD2) {
37743
+ debug.error(INTEGRATION_NAME6, "Error patching request to capture body", error2);
37744
+ }
37745
+ }
37746
+ }
37747
+
37748
+ // ../../node_modules/@sentry/node-core/build/esm/integrations/http/httpServerSpansIntegration.js
37749
+ var import_api3 = __toESM(require_src(), 1);
37750
+ var import_core35 = __toESM(require_src3(), 1);
37751
+ var import_semantic_conventions = __toESM(require_src2(), 1);
37752
+ import { errorMonitor } from "node:events";
37753
+ var INTEGRATION_NAME7 = "Http.ServerSpans";
37754
+ var _httpServerSpansIntegration = (options = {}) => {
37755
+ const ignoreStaticAssets = options.ignoreStaticAssets ?? true;
37756
+ const ignoreIncomingRequests = options.ignoreIncomingRequests;
37757
+ const ignoreStatusCodes = options.ignoreStatusCodes ?? [
37758
+ [401, 404],
37759
+ [301, 303],
37760
+ [305, 399]
37761
+ ];
37762
+ const { onSpanCreated } = options;
37763
+ const { requestHook, responseHook, applyCustomAttributesOnSpan } = options.instrumentation ?? {};
37764
+ return {
37765
+ name: INTEGRATION_NAME7,
37766
+ setup(client) {
37767
+ if (typeof __SENTRY_TRACING__ !== "undefined" && !__SENTRY_TRACING__) {
37768
+ return;
37769
+ }
37770
+ client.on("httpServerRequest", (_request, _response, normalizedRequest) => {
37771
+ const request = _request;
37772
+ const response = _response;
37773
+ const startSpan2 = (next) => {
37774
+ if (shouldIgnoreSpansForIncomingRequest(request, {
37437
37775
  ignoreStaticAssets,
37438
- ignoreSpansForIncomingRequests
37776
+ ignoreIncomingRequests
37439
37777
  })) {
37440
- DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, "Skipping span creation for incoming request");
37441
- return target.apply(thisArg, args);
37778
+ DEBUG_BUILD2 && debug.log(INTEGRATION_NAME7, "Skipping span creation for incoming request", request.url);
37779
+ return next();
37442
37780
  }
37443
- const fullUrl = normalizedRequest.url || url;
37781
+ const fullUrl = normalizedRequest.url || request.url || "/";
37444
37782
  const urlObj = parseStringToURLObject(fullUrl);
37445
37783
  const headers = request.headers;
37446
37784
  const userAgent = headers["user-agent"];
@@ -37450,15 +37788,18 @@ function instrumentServer(server, {
37450
37788
  const hostname = host?.replace(/^(.*)(:[0-9]{1,5})/, "$1") || "localhost";
37451
37789
  const tracer = client.tracer;
37452
37790
  const scheme = fullUrl.startsWith("https") ? "https" : "http";
37453
- const shouldSendDefaultPii = client?.getOptions().sendDefaultPii ?? false;
37791
+ const method = normalizedRequest.method || request.method?.toUpperCase() || "GET";
37792
+ const httpTargetWithoutQueryFragment = urlObj ? urlObj.pathname : stripUrlQueryAndFragment(fullUrl);
37793
+ const bestEffortTransactionName = `${method} ${httpTargetWithoutQueryFragment}`;
37794
+ const shouldSendDefaultPii = client.getOptions().sendDefaultPii ?? false;
37454
37795
  const span = tracer.startSpan(bestEffortTransactionName, {
37455
- kind: import_api2.SpanKind.SERVER,
37796
+ kind: import_api3.SpanKind.SERVER,
37456
37797
  attributes: {
37457
37798
  [SEMANTIC_ATTRIBUTE_SENTRY_OP]: "http.server",
37458
37799
  [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.otel.http",
37459
37800
  "sentry.http.prefetch": isKnownPrefetchRequest(request) || undefined,
37460
37801
  "http.url": fullUrl,
37461
- "http.method": httpMethod,
37802
+ "http.method": normalizedRequest.method,
37462
37803
  "http.target": urlObj ? `${urlObj.pathname}${urlObj.search}` : httpTargetWithoutQueryFragment,
37463
37804
  "http.host": host,
37464
37805
  "net.host.name": hostname,
@@ -37474,14 +37815,14 @@ function instrumentServer(server, {
37474
37815
  requestHook?.(span, request);
37475
37816
  responseHook?.(span, response);
37476
37817
  applyCustomAttributesOnSpan?.(span, request, response);
37477
- incomingRequestSpanHook?.(span, request, response);
37818
+ onSpanCreated?.(span, request, response);
37478
37819
  const rpcMetadata = {
37479
- type: import_core34.RPCType.HTTP,
37820
+ type: import_core35.RPCType.HTTP,
37480
37821
  span
37481
37822
  };
37482
- import_api2.context.with(import_core34.setRPCMetadata(import_api2.trace.setSpan(import_api2.context.active(), span), rpcMetadata), () => {
37483
- import_api2.context.bind(import_api2.context.active(), request);
37484
- import_api2.context.bind(import_api2.context.active(), response);
37823
+ return import_api3.context.with(import_core35.setRPCMetadata(import_api3.trace.setSpan(import_api3.context.active(), span), rpcMetadata), () => {
37824
+ import_api3.context.bind(import_api3.context.active(), request);
37825
+ import_api3.context.bind(import_api3.context.active(), response);
37485
37826
  let isEnded = false;
37486
37827
  function endSpan(status) {
37487
37828
  if (isEnded) {
@@ -37504,131 +37845,71 @@ function instrumentServer(server, {
37504
37845
  const httpStatus = getSpanStatusFromHttpCode(response.statusCode);
37505
37846
  endSpan(httpStatus.code === SPAN_STATUS_ERROR ? httpStatus : { code: SPAN_STATUS_ERROR });
37506
37847
  });
37507
- return target.apply(thisArg, args);
37848
+ return next();
37508
37849
  });
37509
- });
37510
- });
37511
- }
37512
- });
37513
- wrappedEmitFns.add(newEmit);
37514
- server.emit = newEmit;
37515
- }
37516
- function recordRequestSession({
37517
- requestIsolationScope,
37518
- response,
37519
- sessionFlushingDelayMS
37520
- }) {
37521
- requestIsolationScope.setSDKProcessingMetadata({
37522
- requestSession: { status: "ok" }
37523
- });
37524
- response.once("close", () => {
37525
- const client = getClient();
37526
- const requestSession = requestIsolationScope.getScopeData().sdkProcessingMetadata.requestSession;
37527
- if (client && requestSession) {
37528
- DEBUG_BUILD2 && debug.log(`Recorded request session with status: ${requestSession.status}`);
37529
- const roundedDate = new Date;
37530
- roundedDate.setSeconds(0, 0);
37531
- const dateBucketKey = roundedDate.toISOString();
37532
- const existingClientAggregate = clientToRequestSessionAggregatesMap.get(client);
37533
- const bucket = existingClientAggregate?.[dateBucketKey] || { exited: 0, crashed: 0, errored: 0 };
37534
- bucket[{ ok: "exited", crashed: "crashed", errored: "errored" }[requestSession.status]]++;
37535
- if (existingClientAggregate) {
37536
- existingClientAggregate[dateBucketKey] = bucket;
37537
- } else {
37538
- DEBUG_BUILD2 && debug.log("Opened new request session aggregate.");
37539
- const newClientAggregate = { [dateBucketKey]: bucket };
37540
- clientToRequestSessionAggregatesMap.set(client, newClientAggregate);
37541
- const flushPendingClientAggregates = () => {
37542
- clearTimeout(timeout);
37543
- unregisterClientFlushHook();
37544
- clientToRequestSessionAggregatesMap.delete(client);
37545
- const aggregatePayload = Object.entries(newClientAggregate).map(([timestamp, value]) => ({
37546
- started: timestamp,
37547
- exited: value.exited,
37548
- errored: value.errored,
37549
- crashed: value.crashed
37550
- }));
37551
- client.sendSession({ aggregates: aggregatePayload });
37552
37850
  };
37553
- const unregisterClientFlushHook = client.on("flush", () => {
37554
- DEBUG_BUILD2 && debug.log("Sending request session aggregate due to client flush");
37555
- flushPendingClientAggregates();
37556
- });
37557
- const timeout = setTimeout(() => {
37558
- DEBUG_BUILD2 && debug.log("Sending request session aggregate due to flushing schedule");
37559
- flushPendingClientAggregates();
37560
- }, sessionFlushingDelayMS).unref();
37561
- }
37562
- }
37563
- });
37564
- }
37565
- function patchRequestToCaptureBody(req, isolationScope, maxIncomingRequestBodySize) {
37566
- let bodyByteLength = 0;
37567
- const chunks = [];
37568
- DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, "Patching request.on");
37569
- const callbackMap = new WeakMap;
37570
- const maxBodySize = maxIncomingRequestBodySize === "small" ? 1000 : maxIncomingRequestBodySize === "medium" ? 1e4 : MAX_BODY_BYTE_LENGTH;
37571
- try {
37572
- req.on = new Proxy(req.on, {
37573
- apply: (target, thisArg, args) => {
37574
- const [event, listener, ...restArgs] = args;
37575
- if (event === "data") {
37576
- DEBUG_BUILD2 && debug.log(INSTRUMENTATION_NAME, `Handling request.on("data") with maximum body size of ${maxBodySize}b`);
37577
- const callback = new Proxy(listener, {
37578
- apply: (target2, thisArg2, args2) => {
37579
- try {
37580
- const chunk = args2[0];
37581
- const bufferifiedChunk = Buffer.from(chunk);
37582
- if (bodyByteLength < maxBodySize) {
37583
- chunks.push(bufferifiedChunk);
37584
- bodyByteLength += bufferifiedChunk.byteLength;
37585
- } else if (DEBUG_BUILD2) {
37586
- debug.log(INSTRUMENTATION_NAME, `Dropping request body chunk because maximum body length of ${maxBodySize}b is exceeded.`);
37587
- }
37588
- } catch (err) {
37589
- DEBUG_BUILD2 && debug.error(INSTRUMENTATION_NAME, "Encountered error while storing body chunk.");
37590
- }
37591
- return Reflect.apply(target2, thisArg2, args2);
37592
- }
37593
- });
37594
- callbackMap.set(listener, callback);
37595
- return Reflect.apply(target, thisArg, [event, callback, ...restArgs]);
37851
+ addStartSpanCallback(request, startSpan2);
37852
+ });
37853
+ },
37854
+ processEvent(event) {
37855
+ if (event.type === "transaction") {
37856
+ const statusCode = event.contexts?.trace?.data?.["http.response.status_code"];
37857
+ if (typeof statusCode === "number") {
37858
+ const shouldDrop = shouldFilterStatusCode(statusCode, ignoreStatusCodes);
37859
+ if (shouldDrop) {
37860
+ DEBUG_BUILD2 && debug.log("Dropping transaction due to status code", statusCode);
37861
+ return null;
37862
+ }
37596
37863
  }
37597
- return Reflect.apply(target, thisArg, args);
37598
37864
  }
37599
- });
37600
- req.off = new Proxy(req.off, {
37601
- apply: (target, thisArg, args) => {
37602
- const [, listener] = args;
37603
- const callback = callbackMap.get(listener);
37604
- if (callback) {
37605
- callbackMap.delete(listener);
37606
- const modifiedArgs = args.slice();
37607
- modifiedArgs[1] = callback;
37608
- return Reflect.apply(target, thisArg, modifiedArgs);
37609
- }
37610
- return Reflect.apply(target, thisArg, args);
37865
+ return event;
37866
+ },
37867
+ afterAllSetup(client) {
37868
+ if (!DEBUG_BUILD2) {
37869
+ return;
37611
37870
  }
37612
- });
37613
- req.on("end", () => {
37614
- try {
37615
- const body = Buffer.concat(chunks).toString("utf-8");
37616
- if (body) {
37617
- const bodyByteLength2 = Buffer.byteLength(body, "utf-8");
37618
- const truncatedBody = bodyByteLength2 > maxBodySize ? `${Buffer.from(body).subarray(0, maxBodySize - 3).toString("utf-8")}...` : body;
37619
- isolationScope.setSDKProcessingMetadata({ normalizedRequest: { data: truncatedBody } });
37620
- }
37621
- } catch (error2) {
37622
- if (DEBUG_BUILD2) {
37623
- debug.error(INSTRUMENTATION_NAME, "Error building captured request body", error2);
37624
- }
37871
+ if (client.getIntegrationByName("Http")) {
37872
+ debug.warn("It seems that you have manually added `httpServerSpansIntergation` while `httpIntegration` is also present. Make sure to remove `httpIntegration` when adding `httpServerSpansIntegration`.");
37873
+ }
37874
+ if (!client.getIntegrationByName("Http.Server")) {
37875
+ debug.error("It seems that you have manually added `httpServerSpansIntergation` without adding `httpServerIntegration`. This is a requiement for spans to be created - please add the `httpServerIntegration` integration.");
37625
37876
  }
37626
- });
37627
- } catch (error2) {
37628
- if (DEBUG_BUILD2) {
37629
- debug.error(INSTRUMENTATION_NAME, "Error patching request to capture body", error2);
37630
37877
  }
37878
+ };
37879
+ };
37880
+ var httpServerSpansIntegration = _httpServerSpansIntegration;
37881
+ function isKnownPrefetchRequest(req) {
37882
+ return req.headers["next-router-prefetch"] === "1";
37883
+ }
37884
+ function isStaticAssetRequest(urlPath) {
37885
+ const path7 = stripUrlQueryAndFragment(urlPath);
37886
+ if (path7.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
37887
+ return true;
37888
+ }
37889
+ if (path7.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
37890
+ return true;
37891
+ }
37892
+ return false;
37893
+ }
37894
+ function shouldIgnoreSpansForIncomingRequest(request, {
37895
+ ignoreStaticAssets,
37896
+ ignoreIncomingRequests
37897
+ }) {
37898
+ if (import_core35.isTracingSuppressed(import_api3.context.active())) {
37899
+ return true;
37631
37900
  }
37901
+ const urlPath = request.url;
37902
+ const method = request.method?.toUpperCase();
37903
+ if (method === "OPTIONS" || method === "HEAD" || !urlPath) {
37904
+ return true;
37905
+ }
37906
+ if (ignoreStaticAssets && method === "GET" && isStaticAssetRequest(urlPath)) {
37907
+ return true;
37908
+ }
37909
+ if (ignoreIncomingRequests?.(urlPath, request)) {
37910
+ return true;
37911
+ }
37912
+ return false;
37632
37913
  }
37633
37914
  function getRequestContentLengthAttribute(request) {
37634
37915
  const length = getContentLength(request.headers);
@@ -37666,7 +37947,7 @@ function getIncomingRequestAttributesOnResponse(request, response) {
37666
37947
  [import_semantic_conventions.SEMATTRS_HTTP_STATUS_CODE]: statusCode,
37667
37948
  "http.status_text": statusMessage?.toUpperCase()
37668
37949
  };
37669
- const rpcMetadata = import_core34.getRPCMetadata(import_api2.context.active());
37950
+ const rpcMetadata = import_core35.getRPCMetadata(import_api3.context.active());
37670
37951
  if (socket) {
37671
37952
  const { localAddress, localPort, remoteAddress, remotePort } = socket;
37672
37953
  newAttributes[import_semantic_conventions.SEMATTRS_NET_HOST_IP] = localAddress;
@@ -37676,51 +37957,42 @@ function getIncomingRequestAttributesOnResponse(request, response) {
37676
37957
  }
37677
37958
  newAttributes[import_semantic_conventions.SEMATTRS_HTTP_STATUS_CODE] = statusCode;
37678
37959
  newAttributes["http.status_text"] = (statusMessage || "").toUpperCase();
37679
- if (rpcMetadata?.type === import_core34.RPCType.HTTP && rpcMetadata.route !== undefined) {
37960
+ if (rpcMetadata?.type === import_core35.RPCType.HTTP && rpcMetadata.route !== undefined) {
37680
37961
  const routeName = rpcMetadata.route;
37681
37962
  newAttributes[import_semantic_conventions.ATTR_HTTP_ROUTE] = routeName;
37682
37963
  }
37683
37964
  return newAttributes;
37684
37965
  }
37685
- function isKnownPrefetchRequest(req) {
37686
- return req.headers["next-router-prefetch"] === "1";
37687
- }
37688
- function isStaticAssetRequest(urlPath) {
37689
- const path7 = stripUrlQueryAndFragment(urlPath);
37690
- if (path7.match(/\.(ico|png|jpg|jpeg|gif|svg|css|js|woff|woff2|ttf|eot|webp|avif)$/)) {
37691
- return true;
37692
- }
37693
- if (path7.match(/^\/(robots\.txt|sitemap\.xml|manifest\.json|browserconfig\.xml)$/)) {
37694
- return true;
37695
- }
37696
- return false;
37966
+ function shouldFilterStatusCode(statusCode, dropForStatusCodes) {
37967
+ return dropForStatusCodes.some((code) => {
37968
+ if (typeof code === "number") {
37969
+ return code === statusCode;
37970
+ }
37971
+ const [min, max] = code;
37972
+ return statusCode >= min && statusCode <= max;
37973
+ });
37697
37974
  }
37698
- function shouldIgnoreSpansForIncomingRequest(request, {
37699
- ignoreStaticAssets,
37700
- ignoreSpansForIncomingRequests
37701
- }) {
37702
- if (import_core34.isTracingSuppressed(import_api2.context.active())) {
37703
- return true;
37704
- }
37705
- const urlPath = request.url;
37706
- const method = request.method?.toUpperCase();
37707
- if (method === "OPTIONS" || method === "HEAD" || !urlPath) {
37708
- return true;
37709
- }
37710
- if (ignoreStaticAssets && method === "GET" && isStaticAssetRequest(urlPath)) {
37711
- return true;
37712
- }
37713
- if (ignoreSpansForIncomingRequests?.(urlPath, request)) {
37714
- return true;
37715
- }
37716
- return false;
37975
+
37976
+ // ../../node_modules/@sentry/node-core/build/esm/integrations/http/SentryHttpInstrumentation.js
37977
+ var import_api5 = __toESM(require_src(), 1);
37978
+ var import_core41 = __toESM(require_src3(), 1);
37979
+ var import_instrumentation2 = __toESM(require_src6(), 1);
37980
+ import { subscribe as subscribe2, unsubscribe } from "node:diagnostics_channel";
37981
+
37982
+ // ../../node_modules/@sentry/node-core/build/esm/utils/getRequestUrl.js
37983
+ function getRequestUrl(requestOptions) {
37984
+ const protocol = requestOptions.protocol || "";
37985
+ const hostname = requestOptions.hostname || requestOptions.host || "";
37986
+ const port = !requestOptions.port || requestOptions.port === 80 || requestOptions.port === 443 || /^(.*):(\d+)$/.test(hostname) ? "" : `:${requestOptions.port}`;
37987
+ const path7 = requestOptions.path ? requestOptions.path : "/";
37988
+ return `${protocol}//${hostname}${port}${path7}`;
37717
37989
  }
37718
37990
 
37719
37991
  // ../../node_modules/@sentry/opentelemetry/build/esm/index.js
37720
37992
  var import_semantic_conventions2 = __toESM(require_src2(), 1);
37721
37993
  var api = __toESM(require_src(), 1);
37722
- var import_api3 = __toESM(require_src(), 1);
37723
- var import_core37 = __toESM(require_src3(), 1);
37994
+ var import_api4 = __toESM(require_src(), 1);
37995
+ var import_core38 = __toESM(require_src3(), 1);
37724
37996
  var import_sdk_trace_base = __toESM(require_src9(), 1);
37725
37997
  var SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE = "sentry.parentIsRemote";
37726
37998
  var SEMANTIC_ATTRIBUTE_SENTRY_GRAPHQL_OPERATION = "sentry.graphql.operation";
@@ -37778,7 +38050,7 @@ function getSpanKind(span) {
37778
38050
  if (spanHasKind(span)) {
37779
38051
  return span.kind;
37780
38052
  }
37781
- return import_api3.SpanKind.INTERNAL;
38053
+ return import_api4.SpanKind.INTERNAL;
37782
38054
  }
37783
38055
  var SENTRY_TRACE_HEADER = "sentry-trace";
37784
38056
  var SENTRY_BAGGAGE_HEADER = "baggage";
@@ -37787,19 +38059,19 @@ var SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING = "sentry.sampled_not_recording";
37787
38059
  var SENTRY_TRACE_STATE_URL = "sentry.url";
37788
38060
  var SENTRY_TRACE_STATE_SAMPLE_RAND = "sentry.sample_rand";
37789
38061
  var SENTRY_TRACE_STATE_SAMPLE_RATE = "sentry.sample_rate";
37790
- var SENTRY_SCOPES_CONTEXT_KEY = import_api3.createContextKey("sentry_scopes");
37791
- var SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY = import_api3.createContextKey("sentry_fork_isolation_scope");
37792
- var SENTRY_FORK_SET_SCOPE_CONTEXT_KEY = import_api3.createContextKey("sentry_fork_set_scope");
37793
- var SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY = import_api3.createContextKey("sentry_fork_set_isolation_scope");
38062
+ var SENTRY_SCOPES_CONTEXT_KEY = import_api4.createContextKey("sentry_scopes");
38063
+ var SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY = import_api4.createContextKey("sentry_fork_isolation_scope");
38064
+ var SENTRY_FORK_SET_SCOPE_CONTEXT_KEY = import_api4.createContextKey("sentry_fork_set_scope");
38065
+ var SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY = import_api4.createContextKey("sentry_fork_set_isolation_scope");
37794
38066
  var SCOPE_CONTEXT_FIELD = "_scopeContext";
37795
- function getScopesFromContext(context4) {
37796
- return context4.getValue(SENTRY_SCOPES_CONTEXT_KEY);
38067
+ function getScopesFromContext(context5) {
38068
+ return context5.getValue(SENTRY_SCOPES_CONTEXT_KEY);
37797
38069
  }
37798
- function setScopesOnContext(context4, scopes) {
37799
- return context4.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);
38070
+ function setScopesOnContext(context5, scopes) {
38071
+ return context5.setValue(SENTRY_SCOPES_CONTEXT_KEY, scopes);
37800
38072
  }
37801
- function setContextOnScope(scope, context4) {
37802
- addNonEnumerableProperty(scope, SCOPE_CONTEXT_FIELD, context4);
38073
+ function setContextOnScope(scope, context5) {
38074
+ addNonEnumerableProperty(scope, SCOPE_CONTEXT_FIELD, context5);
37803
38075
  }
37804
38076
  function getContextFromScope(scope) {
37805
38077
  return scope[SCOPE_CONTEXT_FIELD];
@@ -37807,7 +38079,7 @@ function getContextFromScope(scope) {
37807
38079
  function getSamplingDecision(spanContext) {
37808
38080
  const { traceFlags, traceState } = spanContext;
37809
38081
  const sampledNotRecording = traceState ? traceState.get(SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING) === "1" : false;
37810
- if (traceFlags === import_api3.TraceFlags.SAMPLED) {
38082
+ if (traceFlags === import_api4.TraceFlags.SAMPLED) {
37811
38083
  return true;
37812
38084
  }
37813
38085
  if (sampledNotRecording) {
@@ -37882,10 +38154,10 @@ function descriptionForDbSystem({ attributes, name }) {
37882
38154
  function descriptionForHttpMethod({ name, kind, attributes }, httpMethod) {
37883
38155
  const opParts = ["http"];
37884
38156
  switch (kind) {
37885
- case import_api3.SpanKind.CLIENT:
38157
+ case import_api4.SpanKind.CLIENT:
37886
38158
  opParts.push("client");
37887
38159
  break;
37888
- case import_api3.SpanKind.SERVER:
38160
+ case import_api4.SpanKind.SERVER:
37889
38161
  opParts.push("server");
37890
38162
  break;
37891
38163
  }
@@ -37910,7 +38182,7 @@ function descriptionForHttpMethod({ name, kind, attributes }, httpMethod) {
37910
38182
  if (fragment) {
37911
38183
  data["http.fragment"] = fragment;
37912
38184
  }
37913
- const isClientOrServerKind = kind === import_api3.SpanKind.CLIENT || kind === import_api3.SpanKind.SERVER;
38185
+ const isClientOrServerKind = kind === import_api4.SpanKind.CLIENT || kind === import_api4.SpanKind.SERVER;
37914
38186
  const origin = attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] || "manual";
37915
38187
  const isManualSpan = !`${origin}`.startsWith("auto");
37916
38188
  const alreadyHasCustomSource = attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] === "custom";
@@ -37946,7 +38218,7 @@ function getSanitizedUrl(attributes, kind) {
37946
38218
  if (typeof httpRoute === "string") {
37947
38219
  return { urlPath: httpRoute, url, query, fragment, hasRoute: true };
37948
38220
  }
37949
- if (kind === import_api3.SpanKind.SERVER && typeof httpTarget === "string") {
38221
+ if (kind === import_api4.SpanKind.SERVER && typeof httpTarget === "string") {
37950
38222
  return { urlPath: stripUrlQueryAndFragment(httpTarget), url, query, fragment, hasRoute: false };
37951
38223
  }
37952
38224
  if (parsedUrl) {
@@ -37987,7 +38259,7 @@ function enhanceDscWithOpenTelemetryRootSpanName(client) {
37987
38259
  });
37988
38260
  }
37989
38261
  function getActiveSpan2() {
37990
- return import_api3.trace.getActiveSpan();
38262
+ return import_api4.trace.getActiveSpan();
37991
38263
  }
37992
38264
  var DEBUG_BUILD3 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
37993
38265
  function makeTraceState({
@@ -37995,7 +38267,7 @@ function makeTraceState({
37995
38267
  sampled
37996
38268
  }) {
37997
38269
  const dscString = dsc ? dynamicSamplingContextToSentryBaggageHeader(dsc) : undefined;
37998
- const traceStateBase = new import_core37.TraceState;
38270
+ const traceStateBase = new import_core38.TraceState;
37999
38271
  const traceStateWithDsc = dscString ? traceStateBase.set(SENTRY_TRACE_STATE_DSC, dscString) : traceStateBase;
38000
38272
  return sampled === false ? traceStateWithDsc.set(SENTRY_TRACE_STATE_SAMPLED_NOT_RECORDING, "1") : traceStateWithDsc;
38001
38273
  }
@@ -38007,18 +38279,18 @@ function setIsSetup(element) {
38007
38279
  setupElements.add(element);
38008
38280
  }
38009
38281
 
38010
- class SentryPropagator extends import_core37.W3CBaggagePropagator {
38282
+ class SentryPropagator extends import_core38.W3CBaggagePropagator {
38011
38283
  constructor() {
38012
38284
  super();
38013
38285
  setIsSetup("SentryPropagator");
38014
38286
  this._urlMatchesTargetsMap = new LRUMap(100);
38015
38287
  }
38016
- inject(context4, carrier, setter) {
38017
- if (import_core37.isTracingSuppressed(context4)) {
38288
+ inject(context5, carrier, setter) {
38289
+ if (import_core38.isTracingSuppressed(context5)) {
38018
38290
  DEBUG_BUILD3 && debug.log("[Tracing] Not injecting trace data for url because tracing is suppressed.");
38019
38291
  return;
38020
38292
  }
38021
- const activeSpan = import_api3.trace.getSpan(context4);
38293
+ const activeSpan = import_api4.trace.getSpan(context5);
38022
38294
  const url = activeSpan && getCurrentURL(activeSpan);
38023
38295
  const tracePropagationTargets = getClient()?.getOptions()?.tracePropagationTargets;
38024
38296
  if (!shouldPropagateTraceForUrl(url, tracePropagationTargets, this._urlMatchesTargetsMap)) {
@@ -38026,8 +38298,8 @@ class SentryPropagator extends import_core37.W3CBaggagePropagator {
38026
38298
  return;
38027
38299
  }
38028
38300
  const existingBaggageHeader = getExistingBaggage(carrier);
38029
- let baggage = import_api3.propagation.getBaggage(context4) || import_api3.propagation.createBaggage({});
38030
- const { dynamicSamplingContext, traceId, spanId, sampled } = getInjectionData(context4);
38301
+ let baggage = import_api4.propagation.getBaggage(context5) || import_api4.propagation.createBaggage({});
38302
+ const { dynamicSamplingContext, traceId, spanId, sampled } = getInjectionData(context5);
38031
38303
  if (existingBaggageHeader) {
38032
38304
  const baggageEntries = parseBaggageHeader(existingBaggageHeader);
38033
38305
  if (baggageEntries) {
@@ -38044,16 +38316,16 @@ class SentryPropagator extends import_core37.W3CBaggagePropagator {
38044
38316
  return b;
38045
38317
  }, baggage);
38046
38318
  }
38047
- if (traceId && traceId !== import_api3.INVALID_TRACEID) {
38319
+ if (traceId && traceId !== import_api4.INVALID_TRACEID) {
38048
38320
  setter.set(carrier, SENTRY_TRACE_HEADER, generateSentryTraceHeader(traceId, spanId, sampled));
38049
38321
  }
38050
- super.inject(import_api3.propagation.setBaggage(context4, baggage), carrier, setter);
38322
+ super.inject(import_api4.propagation.setBaggage(context5, baggage), carrier, setter);
38051
38323
  }
38052
- extract(context4, carrier, getter) {
38324
+ extract(context5, carrier, getter) {
38053
38325
  const maybeSentryTraceHeader = getter.get(carrier, SENTRY_TRACE_HEADER);
38054
38326
  const baggage = getter.get(carrier, SENTRY_BAGGAGE_HEADER);
38055
38327
  const sentryTrace = maybeSentryTraceHeader ? Array.isArray(maybeSentryTraceHeader) ? maybeSentryTraceHeader[0] : maybeSentryTraceHeader : undefined;
38056
- return ensureScopesOnContext(getContextWithRemoteActiveSpan(context4, { sentryTrace, baggage }));
38328
+ return ensureScopesOnContext(getContextWithRemoteActiveSpan(context5, { sentryTrace, baggage }));
38057
38329
  }
38058
38330
  fields() {
38059
38331
  return [SENTRY_TRACE_HEADER, SENTRY_BAGGAGE_HEADER];
@@ -38074,8 +38346,8 @@ function shouldPropagateTraceForUrl(url, tracePropagationTargets, decisionMap) {
38074
38346
  DEBUG_BUILD3 && !decision && debug.log(NOT_PROPAGATED_MESSAGE, url);
38075
38347
  return decision;
38076
38348
  }
38077
- function getInjectionData(context4, options = {}) {
38078
- const span = import_api3.trace.getSpan(context4);
38349
+ function getInjectionData(context5, options = {}) {
38350
+ const span = import_api4.trace.getSpan(context5);
38079
38351
  if (span?.spanContext().isRemote) {
38080
38352
  const spanContext = span.spanContext();
38081
38353
  const dynamicSamplingContext2 = getDynamicSamplingContextFromSpan(span);
@@ -38096,7 +38368,7 @@ function getInjectionData(context4, options = {}) {
38096
38368
  sampled: getSamplingDecision(spanContext)
38097
38369
  };
38098
38370
  }
38099
- const scope = options.scope || getScopesFromContext(context4)?.scope || getCurrentScope();
38371
+ const scope = options.scope || getScopesFromContext(context5)?.scope || getCurrentScope();
38100
38372
  const client = options.client || getClient();
38101
38373
  const propagationContext = scope.getPropagationContext();
38102
38374
  const dynamicSamplingContext = client ? getDynamicSamplingContextFromScope(client, scope) : undefined;
@@ -38121,11 +38393,11 @@ function getContextWithRemoteActiveSpan(ctx, { sentryTrace, baggage }) {
38121
38393
  sampled,
38122
38394
  dsc
38123
38395
  });
38124
- return import_api3.trace.setSpanContext(ctx, spanContext);
38396
+ return import_api4.trace.setSpanContext(ctx, spanContext);
38125
38397
  }
38126
38398
  function continueTraceAsRemoteSpan(ctx, options, callback) {
38127
38399
  const ctxWithSpanContext = ensureScopesOnContext(getContextWithRemoteActiveSpan(ctx, options));
38128
- return import_api3.context.with(ctxWithSpanContext, callback);
38400
+ return import_api4.context.with(ctxWithSpanContext, callback);
38129
38401
  }
38130
38402
  function ensureScopesOnContext(ctx) {
38131
38403
  const scopes = getScopesFromContext(ctx);
@@ -38169,7 +38441,7 @@ function generateRemoteSpanContext({
38169
38441
  traceId,
38170
38442
  spanId,
38171
38443
  isRemote: true,
38172
- traceFlags: sampled ? import_api3.TraceFlags.SAMPLED : import_api3.TraceFlags.NONE,
38444
+ traceFlags: sampled ? import_api4.TraceFlags.SAMPLED : import_api4.TraceFlags.NONE,
38173
38445
  traceState
38174
38446
  };
38175
38447
  return spanContext;
@@ -38180,13 +38452,13 @@ function startSpan2(options, callback) {
38180
38452
  const wrapper = getActiveSpanWrapper2(customParentSpan);
38181
38453
  return wrapper(() => {
38182
38454
  const activeCtx = getContext(options.scope, options.forceTransaction);
38183
- const shouldSkipSpan = options.onlyIfParent && !import_api3.trace.getSpan(activeCtx);
38184
- const ctx = shouldSkipSpan ? import_core37.suppressTracing(activeCtx) : activeCtx;
38455
+ const shouldSkipSpan = options.onlyIfParent && !import_api4.trace.getSpan(activeCtx);
38456
+ const ctx = shouldSkipSpan ? import_core38.suppressTracing(activeCtx) : activeCtx;
38185
38457
  const spanOptions = getSpanOptions(options);
38186
38458
  return tracer.startActiveSpan(name, spanOptions, ctx, (span) => {
38187
38459
  return handleCallbackErrors(() => callback(span), () => {
38188
38460
  if (spanToJSON(span).status === undefined) {
38189
- span.setStatus({ code: import_api3.SpanStatusCode.ERROR });
38461
+ span.setStatus({ code: import_api4.SpanStatusCode.ERROR });
38190
38462
  }
38191
38463
  }, () => span.end());
38192
38464
  });
@@ -38198,13 +38470,13 @@ function startSpanManual2(options, callback) {
38198
38470
  const wrapper = getActiveSpanWrapper2(customParentSpan);
38199
38471
  return wrapper(() => {
38200
38472
  const activeCtx = getContext(options.scope, options.forceTransaction);
38201
- const shouldSkipSpan = options.onlyIfParent && !import_api3.trace.getSpan(activeCtx);
38202
- const ctx = shouldSkipSpan ? import_core37.suppressTracing(activeCtx) : activeCtx;
38473
+ const shouldSkipSpan = options.onlyIfParent && !import_api4.trace.getSpan(activeCtx);
38474
+ const ctx = shouldSkipSpan ? import_core38.suppressTracing(activeCtx) : activeCtx;
38203
38475
  const spanOptions = getSpanOptions(options);
38204
38476
  return tracer.startActiveSpan(name, spanOptions, ctx, (span) => {
38205
38477
  return handleCallbackErrors(() => callback(span, () => span.end()), () => {
38206
38478
  if (spanToJSON(span).status === undefined) {
38207
- span.setStatus({ code: import_api3.SpanStatusCode.ERROR });
38479
+ span.setStatus({ code: import_api4.SpanStatusCode.ERROR });
38208
38480
  }
38209
38481
  });
38210
38482
  });
@@ -38216,20 +38488,20 @@ function startInactiveSpan2(options) {
38216
38488
  const wrapper = getActiveSpanWrapper2(customParentSpan);
38217
38489
  return wrapper(() => {
38218
38490
  const activeCtx = getContext(options.scope, options.forceTransaction);
38219
- const shouldSkipSpan = options.onlyIfParent && !import_api3.trace.getSpan(activeCtx);
38220
- const ctx = shouldSkipSpan ? import_core37.suppressTracing(activeCtx) : activeCtx;
38491
+ const shouldSkipSpan = options.onlyIfParent && !import_api4.trace.getSpan(activeCtx);
38492
+ const ctx = shouldSkipSpan ? import_core38.suppressTracing(activeCtx) : activeCtx;
38221
38493
  const spanOptions = getSpanOptions(options);
38222
38494
  const span = tracer.startSpan(name, spanOptions, ctx);
38223
38495
  return span;
38224
38496
  });
38225
38497
  }
38226
38498
  function withActiveSpan2(span, callback) {
38227
- const newContextWithActiveSpan = span ? import_api3.trace.setSpan(import_api3.context.active(), span) : import_api3.trace.deleteSpan(import_api3.context.active());
38228
- return import_api3.context.with(newContextWithActiveSpan, () => callback(getCurrentScope()));
38499
+ const newContextWithActiveSpan = span ? import_api4.trace.setSpan(import_api4.context.active(), span) : import_api4.trace.deleteSpan(import_api4.context.active());
38500
+ return import_api4.context.with(newContextWithActiveSpan, () => callback(getCurrentScope()));
38229
38501
  }
38230
38502
  function getTracer() {
38231
38503
  const client = getClient();
38232
- return client?.tracer || import_api3.trace.getTracer("@sentry/opentelemetry", SDK_VERSION);
38504
+ return client?.tracer || import_api4.trace.getTracer("@sentry/opentelemetry", SDK_VERSION);
38233
38505
  }
38234
38506
  function getSpanOptions(options) {
38235
38507
  const { startTime, attributes, kind, op, links } = options;
@@ -38250,14 +38522,14 @@ function ensureTimestampInMilliseconds(timestamp) {
38250
38522
  }
38251
38523
  function getContext(scope, forceTransaction) {
38252
38524
  const ctx = getContextForScope(scope);
38253
- const parentSpan = import_api3.trace.getSpan(ctx);
38525
+ const parentSpan = import_api4.trace.getSpan(ctx);
38254
38526
  if (!parentSpan) {
38255
38527
  return ctx;
38256
38528
  }
38257
38529
  if (!forceTransaction) {
38258
38530
  return ctx;
38259
38531
  }
38260
- const ctxWithoutSpan = import_api3.trace.deleteSpan(ctx);
38532
+ const ctxWithoutSpan = import_api4.trace.deleteSpan(ctx);
38261
38533
  const { spanId, traceId } = parentSpan.spanContext();
38262
38534
  const sampled = getSamplingDecision(parentSpan.spanContext());
38263
38535
  const rootSpan = getRootSpan(parentSpan);
@@ -38270,10 +38542,10 @@ function getContext(scope, forceTransaction) {
38270
38542
  traceId,
38271
38543
  spanId,
38272
38544
  isRemote: true,
38273
- traceFlags: sampled ? import_api3.TraceFlags.SAMPLED : import_api3.TraceFlags.NONE,
38545
+ traceFlags: sampled ? import_api4.TraceFlags.SAMPLED : import_api4.TraceFlags.NONE,
38274
38546
  traceState
38275
38547
  };
38276
- const ctxWithSpanContext = import_api3.trace.setSpanContext(ctxWithoutSpan, spanOptions);
38548
+ const ctxWithSpanContext = import_api4.trace.setSpanContext(ctxWithoutSpan, spanOptions);
38277
38549
  return ctxWithSpanContext;
38278
38550
  }
38279
38551
  function getContextForScope(scope) {
@@ -38283,14 +38555,14 @@ function getContextForScope(scope) {
38283
38555
  return ctx;
38284
38556
  }
38285
38557
  }
38286
- return import_api3.context.active();
38558
+ return import_api4.context.active();
38287
38559
  }
38288
38560
  function continueTrace2(options, callback) {
38289
- return continueTraceAsRemoteSpan(import_api3.context.active(), options, callback);
38561
+ return continueTraceAsRemoteSpan(import_api4.context.active(), options, callback);
38290
38562
  }
38291
38563
  function getTraceContextForScope(client, scope) {
38292
38564
  const ctx = getContextFromScope(scope);
38293
- const span = ctx && import_api3.trace.getSpan(ctx);
38565
+ const span = ctx && import_api4.trace.getSpan(ctx);
38294
38566
  const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope);
38295
38567
  const dynamicSamplingContext = span ? getDynamicSamplingContextFromSpan(span) : getDynamicSamplingContextFromScope(client, scope);
38296
38568
  return [dynamicSamplingContext, traceContext];
@@ -38301,8 +38573,8 @@ function getActiveSpanWrapper2(parentSpan) {
38301
38573
  } : (callback) => callback();
38302
38574
  }
38303
38575
  function suppressTracing2(callback) {
38304
- const ctx = import_core37.suppressTracing(import_api3.context.active());
38305
- return import_api3.context.with(ctx, callback);
38576
+ const ctx = import_core38.suppressTracing(import_api4.context.active());
38577
+ return import_api4.context.with(ctx, callback);
38306
38578
  }
38307
38579
  function setupEventContextTrace(client) {
38308
38580
  client.on("preprocessEvent", (event) => {
@@ -38404,17 +38676,17 @@ function wrapContextManagerClass(ContextManagerClass) {
38404
38676
  super(...args);
38405
38677
  setIsSetup("SentryContextManager");
38406
38678
  }
38407
- with(context4, fn, thisArg, ...args) {
38408
- const currentScopes = getScopesFromContext(context4);
38679
+ with(context5, fn, thisArg, ...args) {
38680
+ const currentScopes = getScopesFromContext(context5);
38409
38681
  const currentScope = currentScopes?.scope || getCurrentScope();
38410
38682
  const currentIsolationScope = currentScopes?.isolationScope || getIsolationScope();
38411
- const shouldForkIsolationScope = context4.getValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY) === true;
38412
- const scope = context4.getValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY);
38413
- const isolationScope = context4.getValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);
38683
+ const shouldForkIsolationScope = context5.getValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY) === true;
38684
+ const scope = context5.getValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY);
38685
+ const isolationScope = context5.getValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);
38414
38686
  const newCurrentScope = scope || currentScope.clone();
38415
38687
  const newIsolationScope = isolationScope || (shouldForkIsolationScope ? currentIsolationScope.clone() : currentIsolationScope);
38416
38688
  const scopes = { scope: newCurrentScope, isolationScope: newIsolationScope };
38417
- const ctx1 = setScopesOnContext(context4, scopes);
38689
+ const ctx1 = setScopesOnContext(context5, scopes);
38418
38690
  const ctx2 = ctx1.deleteValue(SENTRY_FORK_ISOLATION_SCOPE_CONTEXT_KEY).deleteValue(SENTRY_FORK_SET_SCOPE_CONTEXT_KEY).deleteValue(SENTRY_FORK_SET_ISOLATION_SCOPE_CONTEXT_KEY);
38419
38691
  setContextOnScope(newCurrentScope, ctx2);
38420
38692
  return super.with(ctx2, fn, thisArg, ...args);
@@ -38491,9 +38763,9 @@ function mapStatus(span) {
38491
38763
  const attributes = spanHasAttributes(span) ? span.attributes : {};
38492
38764
  const status = spanHasStatus(span) ? span.status : undefined;
38493
38765
  if (status) {
38494
- if (status.code === import_api3.SpanStatusCode.OK) {
38766
+ if (status.code === import_api4.SpanStatusCode.OK) {
38495
38767
  return { code: SPAN_STATUS_OK };
38496
- } else if (status.code === import_api3.SpanStatusCode.ERROR) {
38768
+ } else if (status.code === import_api4.SpanStatusCode.ERROR) {
38497
38769
  if (typeof status.message === "undefined") {
38498
38770
  const inferredStatus2 = inferStatusFromAttributes(attributes);
38499
38771
  if (inferredStatus2) {
@@ -38511,7 +38783,7 @@ function mapStatus(span) {
38511
38783
  if (inferredStatus) {
38512
38784
  return inferredStatus;
38513
38785
  }
38514
- if (status?.code === import_api3.SpanStatusCode.UNSET) {
38786
+ if (status?.code === import_api4.SpanStatusCode.UNSET) {
38515
38787
  return { code: SPAN_STATUS_OK };
38516
38788
  } else {
38517
38789
  return { code: SPAN_STATUS_ERROR, message: "unknown_error" };
@@ -38762,8 +39034,8 @@ function removeSentryAttributes(data) {
38762
39034
  function getData(span) {
38763
39035
  const attributes = span.attributes;
38764
39036
  const data = {};
38765
- if (span.kind !== import_api3.SpanKind.INTERNAL) {
38766
- data["otel.kind"] = import_api3.SpanKind[span.kind];
39037
+ if (span.kind !== import_api4.SpanKind.INTERNAL) {
39038
+ data["otel.kind"] = import_api4.SpanKind[span.kind];
38767
39039
  }
38768
39040
  const maybeHttpStatusCodeAttribute = attributes[import_semantic_conventions2.SEMATTRS_HTTP_STATUS_CODE];
38769
39041
  if (maybeHttpStatusCodeAttribute) {
@@ -38782,7 +39054,7 @@ function getData(span) {
38782
39054
  return data;
38783
39055
  }
38784
39056
  function onSpanStart(span, parentContext) {
38785
- const parentSpan = import_api3.trace.getSpan(parentContext);
39057
+ const parentSpan = import_api4.trace.getSpan(parentContext);
38786
39058
  let scopes = getScopesFromContext(parentContext);
38787
39059
  if (parentSpan && !parentSpan.spanContext().isRemote) {
38788
39060
  addChildSpanToSpan(parentSpan, span);
@@ -38790,7 +39062,7 @@ function onSpanStart(span, parentContext) {
38790
39062
  if (parentSpan?.spanContext().isRemote) {
38791
39063
  span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE, true);
38792
39064
  }
38793
- if (parentContext === import_api3.ROOT_CONTEXT) {
39065
+ if (parentContext === import_api4.ROOT_CONTEXT) {
38794
39066
  scopes = {
38795
39067
  scope: getDefaultCurrentScope(),
38796
39068
  isolationScope: getDefaultIsolationScope()
@@ -38834,23 +39106,23 @@ class SentrySampler {
38834
39106
  this._client = client;
38835
39107
  setIsSetup("SentrySampler");
38836
39108
  }
38837
- shouldSample(context4, traceId, spanName, spanKind, spanAttributes, _links) {
39109
+ shouldSample(context5, traceId, spanName, spanKind, spanAttributes, _links) {
38838
39110
  const options = this._client.getOptions();
38839
- const parentSpan = getValidSpan(context4);
39111
+ const parentSpan = getValidSpan(context5);
38840
39112
  const parentContext = parentSpan?.spanContext();
38841
39113
  if (!hasSpansEnabled(options)) {
38842
- return wrapSamplingDecision({ decision: undefined, context: context4, spanAttributes });
39114
+ return wrapSamplingDecision({ decision: undefined, context: context5, spanAttributes });
38843
39115
  }
38844
39116
  const maybeSpanHttpMethod = spanAttributes[import_semantic_conventions2.SEMATTRS_HTTP_METHOD] || spanAttributes[import_semantic_conventions2.ATTR_HTTP_REQUEST_METHOD];
38845
- if (spanKind === import_api3.SpanKind.CLIENT && maybeSpanHttpMethod && (!parentSpan || parentContext?.isRemote)) {
38846
- return wrapSamplingDecision({ decision: undefined, context: context4, spanAttributes });
39117
+ if (spanKind === import_api4.SpanKind.CLIENT && maybeSpanHttpMethod && (!parentSpan || parentContext?.isRemote)) {
39118
+ return wrapSamplingDecision({ decision: undefined, context: context5, spanAttributes });
38847
39119
  }
38848
39120
  const parentSampled = parentSpan ? getParentSampled(parentSpan, traceId, spanName) : undefined;
38849
39121
  const isRootSpan = !parentSpan || parentContext?.isRemote;
38850
39122
  if (!isRootSpan) {
38851
39123
  return wrapSamplingDecision({
38852
39124
  decision: parentSampled ? import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED : import_sdk_trace_base.SamplingDecision.NOT_RECORD,
38853
- context: context4,
39125
+ context: context5,
38854
39126
  spanAttributes
38855
39127
  });
38856
39128
  }
@@ -38874,9 +39146,9 @@ class SentrySampler {
38874
39146
  parentContext
38875
39147
  }, mutableSamplingDecision);
38876
39148
  if (!mutableSamplingDecision.decision) {
38877
- return wrapSamplingDecision({ decision: undefined, context: context4, spanAttributes });
39149
+ return wrapSamplingDecision({ decision: undefined, context: context5, spanAttributes });
38878
39150
  }
38879
- const { isolationScope } = getScopesFromContext(context4) ?? {};
39151
+ const { isolationScope } = getScopesFromContext(context5) ?? {};
38880
39152
  const dscString = parentContext?.traceState ? parentContext.traceState.get(SENTRY_TRACE_STATE_DSC) : undefined;
38881
39153
  const dsc = dscString ? baggageHeaderToDynamicSamplingContext(dscString) : undefined;
38882
39154
  const sampleRand = parseSampleRate(dsc?.sample_rand) ?? Math.random();
@@ -38892,7 +39164,7 @@ class SentrySampler {
38892
39164
  DEBUG_BUILD3 && debug.log(`[Tracing] Not sampling span because HTTP method is '${method}' for ${spanName}`);
38893
39165
  return wrapSamplingDecision({
38894
39166
  decision: import_sdk_trace_base.SamplingDecision.NOT_RECORD,
38895
- context: context4,
39167
+ context: context5,
38896
39168
  spanAttributes,
38897
39169
  sampleRand,
38898
39170
  downstreamTraceSampleRate: 0
@@ -38905,7 +39177,7 @@ class SentrySampler {
38905
39177
  return {
38906
39178
  ...wrapSamplingDecision({
38907
39179
  decision: sampled ? import_sdk_trace_base.SamplingDecision.RECORD_AND_SAMPLED : import_sdk_trace_base.SamplingDecision.NOT_RECORD,
38908
- context: context4,
39180
+ context: context5,
38909
39181
  spanAttributes,
38910
39182
  sampleRand,
38911
39183
  downstreamTraceSampleRate: localSampleRateWasApplied ? sampleRate : undefined
@@ -38921,7 +39193,7 @@ class SentrySampler {
38921
39193
  }
38922
39194
  function getParentSampled(parentSpan, traceId, spanName) {
38923
39195
  const parentContext = parentSpan.spanContext();
38924
- if (import_api3.isSpanContextValid(parentContext) && parentContext.traceId === traceId) {
39196
+ if (import_api4.isSpanContextValid(parentContext) && parentContext.traceId === traceId) {
38925
39197
  if (parentContext.isRemote) {
38926
39198
  const parentSampled2 = getSamplingDecision(parentSpan.spanContext());
38927
39199
  DEBUG_BUILD3 && debug.log(`[Tracing] Inheriting remote parent's sampled decision for ${spanName}: ${parentSampled2}`);
@@ -38935,12 +39207,12 @@ function getParentSampled(parentSpan, traceId, spanName) {
38935
39207
  }
38936
39208
  function wrapSamplingDecision({
38937
39209
  decision,
38938
- context: context4,
39210
+ context: context5,
38939
39211
  spanAttributes,
38940
39212
  sampleRand,
38941
39213
  downstreamTraceSampleRate
38942
39214
  }) {
38943
- let traceState = getBaseTraceState(context4, spanAttributes);
39215
+ let traceState = getBaseTraceState(context5, spanAttributes);
38944
39216
  if (downstreamTraceSampleRate !== undefined) {
38945
39217
  traceState = traceState.set(SENTRY_TRACE_STATE_SAMPLE_RATE, `${downstreamTraceSampleRate}`);
38946
39218
  }
@@ -38955,19 +39227,19 @@ function wrapSamplingDecision({
38955
39227
  }
38956
39228
  return { decision, traceState };
38957
39229
  }
38958
- function getBaseTraceState(context4, spanAttributes) {
38959
- const parentSpan = import_api3.trace.getSpan(context4);
39230
+ function getBaseTraceState(context5, spanAttributes) {
39231
+ const parentSpan = import_api4.trace.getSpan(context5);
38960
39232
  const parentContext = parentSpan?.spanContext();
38961
- let traceState = parentContext?.traceState || new import_core37.TraceState;
39233
+ let traceState = parentContext?.traceState || new import_core38.TraceState;
38962
39234
  const url = spanAttributes[import_semantic_conventions2.SEMATTRS_HTTP_URL] || spanAttributes[import_semantic_conventions2.ATTR_URL_FULL];
38963
39235
  if (url && typeof url === "string") {
38964
39236
  traceState = traceState.set(SENTRY_TRACE_STATE_URL, url);
38965
39237
  }
38966
39238
  return traceState;
38967
39239
  }
38968
- function getValidSpan(context4) {
38969
- const span = import_api3.trace.getSpan(context4);
38970
- return span && import_api3.isSpanContextValid(span.spanContext()) ? span : undefined;
39240
+ function getValidSpan(context5) {
39241
+ const span = import_api4.trace.getSpan(context5);
39242
+ return span && import_api4.isSpanContextValid(span.spanContext()) ? span : undefined;
38971
39243
  }
38972
39244
 
38973
39245
  // ../../node_modules/@sentry/node-core/build/esm/utils/baggage.js
@@ -39082,21 +39354,6 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
39082
39354
  }
39083
39355
  init() {
39084
39356
  let hasRegisteredHandlers = false;
39085
- const spansEnabled = this.getConfig().spans ?? true;
39086
- const onHttpServerRequestStart = (_data) => {
39087
- const data = _data;
39088
- instrumentServer(data.server, {
39089
- instrumentation: this.getConfig().instrumentation,
39090
- ignoreIncomingRequestBody: this.getConfig().ignoreIncomingRequestBody,
39091
- ignoreSpansForIncomingRequests: this.getConfig().ignoreSpansForIncomingRequests,
39092
- incomingRequestSpanHook: this.getConfig().incomingRequestSpanHook,
39093
- maxIncomingRequestBodySize: this.getConfig().maxIncomingRequestBodySize,
39094
- trackIncomingRequestsAsSessions: this.getConfig().trackIncomingRequestsAsSessions,
39095
- sessionFlushingDelayMS: this.getConfig().sessionFlushingDelayMS ?? 60000,
39096
- ignoreStaticAssets: this.getConfig().ignoreStaticAssets,
39097
- spans: spansEnabled && !this.getConfig().disableIncomingRequestSpans
39098
- });
39099
- };
39100
39357
  const onHttpClientResponseFinish = (_data) => {
39101
39358
  const data = _data;
39102
39359
  this._onOutgoingRequestFinish(data.request, data.response);
@@ -39114,16 +39371,14 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
39114
39371
  return moduleExports;
39115
39372
  }
39116
39373
  hasRegisteredHandlers = true;
39117
- subscribe("http.server.request.start", onHttpServerRequestStart);
39118
- subscribe("http.client.response.finish", onHttpClientResponseFinish);
39119
- subscribe("http.client.request.error", onHttpClientRequestError);
39374
+ subscribe2("http.client.response.finish", onHttpClientResponseFinish);
39375
+ subscribe2("http.client.request.error", onHttpClientRequestError);
39120
39376
  if (this.getConfig().propagateTraceInOutgoingRequests) {
39121
- subscribe("http.client.request.created", onHttpClientRequestCreated);
39377
+ subscribe2("http.client.request.created", onHttpClientRequestCreated);
39122
39378
  }
39123
39379
  return moduleExports;
39124
39380
  };
39125
39381
  const unwrap = () => {
39126
- unsubscribe("http.server.request.start", onHttpServerRequestStart);
39127
39382
  unsubscribe("http.client.response.finish", onHttpClientResponseFinish);
39128
39383
  unsubscribe("http.client.request.error", onHttpClientRequestError);
39129
39384
  unsubscribe("http.client.request.created", onHttpClientRequestCreated);
@@ -39152,7 +39407,7 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
39152
39407
  addTracePropagationHeadersToOutgoingRequest(request, this._propagationDecisionMap);
39153
39408
  }
39154
39409
  _shouldIgnoreOutgoingRequest(request) {
39155
- if (import_core40.isTracingSuppressed(import_api4.context.active())) {
39410
+ if (import_core41.isTracingSuppressed(import_api5.context.active())) {
39156
39411
  return true;
39157
39412
  }
39158
39413
  const ignoreOutgoingRequests = this.getConfig().ignoreOutgoingRequests;
@@ -39166,53 +39421,51 @@ class SentryHttpInstrumentation extends import_instrumentation2.InstrumentationB
39166
39421
  }
39167
39422
 
39168
39423
  // ../../node_modules/@sentry/node-core/build/esm/integrations/http/index.js
39169
- var INTEGRATION_NAME6 = "Http";
39170
- var instrumentSentryHttp = generateInstrumentOnce(`${INTEGRATION_NAME6}.sentry`, (options) => {
39424
+ var INTEGRATION_NAME8 = "Http";
39425
+ var instrumentSentryHttp = generateInstrumentOnce(`${INTEGRATION_NAME8}.sentry`, (options) => {
39171
39426
  return new SentryHttpInstrumentation(options);
39172
39427
  });
39173
39428
  var httpIntegration = defineIntegration((options = {}) => {
39174
- const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [
39175
- [401, 404],
39176
- [301, 303],
39177
- [305, 399]
39178
- ];
39429
+ const serverOptions = {
39430
+ sessions: options.trackIncomingRequestsAsSessions,
39431
+ sessionFlushingDelayMS: options.sessionFlushingDelayMS,
39432
+ ignoreRequestBody: options.ignoreIncomingRequestBody,
39433
+ maxRequestBodySize: options.maxIncomingRequestBodySize
39434
+ };
39435
+ const serverSpansOptions = {
39436
+ ignoreIncomingRequests: options.ignoreIncomingRequests,
39437
+ ignoreStaticAssets: options.ignoreStaticAssets,
39438
+ ignoreStatusCodes: options.dropSpansForIncomingRequestStatusCodes
39439
+ };
39440
+ const httpInstrumentationOptions = {
39441
+ breadcrumbs: options.breadcrumbs,
39442
+ propagateTraceInOutgoingRequests: true,
39443
+ ignoreOutgoingRequests: options.ignoreOutgoingRequests
39444
+ };
39445
+ const server = httpServerIntegration(serverOptions);
39446
+ const serverSpans = httpServerSpansIntegration(serverSpansOptions);
39447
+ const spans = options.spans ?? false;
39448
+ const disableIncomingRequestSpans = options.disableIncomingRequestSpans ?? false;
39449
+ const enabledServerSpans = spans && !disableIncomingRequestSpans;
39179
39450
  return {
39180
- name: INTEGRATION_NAME6,
39451
+ name: INTEGRATION_NAME8,
39452
+ setup(client) {
39453
+ if (enabledServerSpans) {
39454
+ serverSpans.setup(client);
39455
+ }
39456
+ },
39181
39457
  setupOnce() {
39182
- instrumentSentryHttp({
39183
- ...options,
39184
- ignoreSpansForIncomingRequests: options.ignoreIncomingRequests,
39185
- disableIncomingRequestSpans: true,
39186
- propagateTraceInOutgoingRequests: true
39187
- });
39458
+ server.setupOnce();
39459
+ instrumentSentryHttp(httpInstrumentationOptions);
39188
39460
  },
39189
39461
  processEvent(event) {
39190
- if (event.type === "transaction") {
39191
- const statusCode = event.contexts?.trace?.data?.["http.response.status_code"];
39192
- if (typeof statusCode === "number") {
39193
- const shouldDrop = shouldFilterStatusCode(statusCode, dropSpansForIncomingRequestStatusCodes);
39194
- if (shouldDrop) {
39195
- DEBUG_BUILD2 && debug.log("Dropping transaction due to status code", statusCode);
39196
- return null;
39197
- }
39198
- }
39199
- }
39200
- return event;
39462
+ return serverSpans.processEvent(event);
39201
39463
  }
39202
39464
  };
39203
39465
  });
39204
- function shouldFilterStatusCode(statusCode, dropForStatusCodes) {
39205
- return dropForStatusCodes.some((code) => {
39206
- if (typeof code === "number") {
39207
- return code === statusCode;
39208
- }
39209
- const [min, max] = code;
39210
- return statusCode >= min && statusCode <= max;
39211
- });
39212
- }
39213
39466
  // ../../node_modules/@sentry/node-core/build/esm/integrations/node-fetch/SentryNodeFetchInstrumentation.js
39214
- var import_api5 = __toESM(require_src(), 1);
39215
- var import_core44 = __toESM(require_src3(), 1);
39467
+ var import_api6 = __toESM(require_src(), 1);
39468
+ var import_core45 = __toESM(require_src3(), 1);
39216
39469
  var import_instrumentation3 = __toESM(require_src6(), 1);
39217
39470
  import * as diagch from "diagnostics_channel";
39218
39471
 
@@ -39332,7 +39585,7 @@ class SentryNodeFetchInstrumentation extends import_instrumentation3.Instrumenta
39332
39585
  });
39333
39586
  }
39334
39587
  _shouldIgnoreOutgoingRequest(request) {
39335
- if (import_core44.isTracingSuppressed(import_api5.context.active())) {
39588
+ if (import_core45.isTracingSuppressed(import_api6.context.active())) {
39336
39589
  return true;
39337
39590
  }
39338
39591
  const url = getAbsoluteUrl2(request.origin, request.path);
@@ -39397,8 +39650,8 @@ function getAbsoluteUrl2(origin, path7 = "/") {
39397
39650
  }
39398
39651
 
39399
39652
  // ../../node_modules/@sentry/node-core/build/esm/integrations/node-fetch/index.js
39400
- var INTEGRATION_NAME7 = "NodeFetch";
39401
- var instrumentSentryNodeFetch = generateInstrumentOnce(`${INTEGRATION_NAME7}.sentry`, SentryNodeFetchInstrumentation, (options) => {
39653
+ var INTEGRATION_NAME9 = "NodeFetch";
39654
+ var instrumentSentryNodeFetch = generateInstrumentOnce(`${INTEGRATION_NAME9}.sentry`, SentryNodeFetchInstrumentation, (options) => {
39402
39655
  return options;
39403
39656
  });
39404
39657
  var _nativeNodeFetchIntegration = (options = {}) => {
@@ -39418,7 +39671,7 @@ import { join as join2 } from "node:path";
39418
39671
  import { promisify } from "node:util";
39419
39672
  var readFileAsync = promisify(readFile);
39420
39673
  var readDirAsync = promisify(readdir);
39421
- var INTEGRATION_NAME8 = "Context";
39674
+ var INTEGRATION_NAME10 = "Context";
39422
39675
  var _nodeContextIntegration = (options = {}) => {
39423
39676
  let cachedContext;
39424
39677
  const _options = {
@@ -39467,7 +39720,7 @@ var _nodeContextIntegration = (options = {}) => {
39467
39720
  return contexts;
39468
39721
  }
39469
39722
  return {
39470
- name: INTEGRATION_NAME8,
39723
+ name: INTEGRATION_NAME10,
39471
39724
  processEvent(event) {
39472
39725
  return addContext(event);
39473
39726
  }
@@ -39701,7 +39954,7 @@ import { createInterface } from "node:readline";
39701
39954
  var LRU_FILE_CONTENTS_CACHE = new LRUMap(10);
39702
39955
  var LRU_FILE_CONTENTS_FS_READ_FAILED = new LRUMap(20);
39703
39956
  var DEFAULT_LINES_OF_CONTEXT = 7;
39704
- var INTEGRATION_NAME9 = "ContextLines";
39957
+ var INTEGRATION_NAME11 = "ContextLines";
39705
39958
  var MAX_CONTEXTLINES_COLNO = 1000;
39706
39959
  var MAX_CONTEXTLINES_LINENO = 1e4;
39707
39960
  function emplace(map, key, contents) {
@@ -39938,7 +40191,7 @@ function makeContextRange(line, linecontext) {
39938
40191
  var _contextLinesIntegration = (options = {}) => {
39939
40192
  const contextLines = options.frameContextLines !== undefined ? options.frameContextLines : DEFAULT_LINES_OF_CONTEXT;
39940
40193
  return {
39941
- name: INTEGRATION_NAME9,
40194
+ name: INTEGRATION_NAME11,
39942
40195
  processEvent(event) {
39943
40196
  return addSourceContext(event, contextLines);
39944
40197
  }
@@ -39999,7 +40252,7 @@ function functionNamesMatch(a, b) {
39999
40252
  }
40000
40253
 
40001
40254
  // ../../node_modules/@sentry/node-core/build/esm/integrations/local-variables/local-variables-async.js
40002
- var base64WorkerScript = "LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjE2LjAgKDc0YzUyMTMpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";
40255
+ var base64WorkerScript = "LyohIEBzZW50cnkvbm9kZS1jb3JlIDEwLjE4LjAgKDcxNmVjMzEpIHwgaHR0cHM6Ly9naXRodWIuY29tL2dldHNlbnRyeS9zZW50cnktamF2YXNjcmlwdCAqLwppbXBvcnR7U2Vzc2lvbiBhcyBlfWZyb20ibm9kZTppbnNwZWN0b3IvcHJvbWlzZXMiO2ltcG9ydHt3b3JrZXJEYXRhIGFzIHR9ZnJvbSJub2RlOndvcmtlcl90aHJlYWRzIjtjb25zdCBuPWdsb2JhbFRoaXMsaT17fTtjb25zdCBvPSJfX1NFTlRSWV9FUlJPUl9MT0NBTF9WQVJJQUJMRVNfXyI7Y29uc3QgYT10O2Z1bmN0aW9uIHMoLi4uZSl7YS5kZWJ1ZyYmZnVuY3Rpb24oZSl7aWYoISgiY29uc29sZSJpbiBuKSlyZXR1cm4gZSgpO2NvbnN0IHQ9bi5jb25zb2xlLG89e30sYT1PYmplY3Qua2V5cyhpKTthLmZvckVhY2goZT0+e2NvbnN0IG49aVtlXTtvW2VdPXRbZV0sdFtlXT1ufSk7dHJ5e3JldHVybiBlKCl9ZmluYWxseXthLmZvckVhY2goZT0+e3RbZV09b1tlXX0pfX0oKCk9PmNvbnNvbGUubG9nKCJbTG9jYWxWYXJpYWJsZXMgV29ya2VyXSIsLi4uZSkpfWFzeW5jIGZ1bmN0aW9uIGMoZSx0LG4saSl7Y29uc3Qgbz1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pO2lbbl09by5yZXN1bHQuZmlsdGVyKGU9PiJsZW5ndGgiIT09ZS5uYW1lJiYhaXNOYU4ocGFyc2VJbnQoZS5uYW1lLDEwKSkpLnNvcnQoKGUsdCk9PnBhcnNlSW50KGUubmFtZSwxMCktcGFyc2VJbnQodC5uYW1lLDEwKSkubWFwKGU9PmUudmFsdWU/LnZhbHVlKX1hc3luYyBmdW5jdGlvbiByKGUsdCxuLGkpe2NvbnN0IG89YXdhaXQgZS5wb3N0KCJSdW50aW1lLmdldFByb3BlcnRpZXMiLHtvYmplY3RJZDp0LG93blByb3BlcnRpZXM6ITB9KTtpW25dPW8ucmVzdWx0Lm1hcChlPT5bZS5uYW1lLGUudmFsdWU/LnZhbHVlXSkucmVkdWNlKChlLFt0LG5dKT0+KGVbdF09bixlKSx7fSl9ZnVuY3Rpb24gdShlLHQpe2UudmFsdWUmJigidmFsdWUiaW4gZS52YWx1ZT92b2lkIDA9PT1lLnZhbHVlLnZhbHVlfHxudWxsPT09ZS52YWx1ZS52YWx1ZT90W2UubmFtZV09YDwke2UudmFsdWUudmFsdWV9PmA6dFtlLm5hbWVdPWUudmFsdWUudmFsdWU6ImRlc2NyaXB0aW9uImluIGUudmFsdWUmJiJmdW5jdGlvbiIhPT1lLnZhbHVlLnR5cGU/dFtlLm5hbWVdPWA8JHtlLnZhbHVlLmRlc2NyaXB0aW9ufT5gOiJ1bmRlZmluZWQiPT09ZS52YWx1ZS50eXBlJiYodFtlLm5hbWVdPSI8dW5kZWZpbmVkPiIpKX1hc3luYyBmdW5jdGlvbiBsKGUsdCl7Y29uc3Qgbj1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuZ2V0UHJvcGVydGllcyIse29iamVjdElkOnQsb3duUHJvcGVydGllczohMH0pLGk9e307Zm9yKGNvbnN0IHQgb2Ygbi5yZXN1bHQpaWYodC52YWx1ZT8ub2JqZWN0SWQmJiJBcnJheSI9PT10LnZhbHVlLmNsYXNzTmFtZSl7Y29uc3Qgbj10LnZhbHVlLm9iamVjdElkO2F3YWl0IGMoZSxuLHQubmFtZSxpKX1lbHNlIGlmKHQudmFsdWU/Lm9iamVjdElkJiYiT2JqZWN0Ij09PXQudmFsdWUuY2xhc3NOYW1lKXtjb25zdCBuPXQudmFsdWUub2JqZWN0SWQ7YXdhaXQgcihlLG4sdC5uYW1lLGkpfWVsc2UgdC52YWx1ZSYmdSh0LGkpO3JldHVybiBpfWxldCBmOyhhc3luYyBmdW5jdGlvbigpe2NvbnN0IHQ9bmV3IGU7dC5jb25uZWN0VG9NYWluVGhyZWFkKCkscygiQ29ubmVjdGVkIHRvIG1haW4gdGhyZWFkIik7bGV0IG49ITE7dC5vbigiRGVidWdnZXIucmVzdW1lZCIsKCk9PntuPSExfSksdC5vbigiRGVidWdnZXIucGF1c2VkIixlPT57bj0hMCxhc3luYyBmdW5jdGlvbihlLHtyZWFzb246dCxkYXRhOntvYmplY3RJZDpufSxjYWxsRnJhbWVzOml9KXtpZigiZXhjZXB0aW9uIiE9PXQmJiJwcm9taXNlUmVqZWN0aW9uIiE9PXQpcmV0dXJuO2lmKGY/LigpLG51bGw9PW4pcmV0dXJuO2NvbnN0IGE9W107Zm9yKGxldCB0PTA7dDxpLmxlbmd0aDt0Kyspe2NvbnN0e3Njb3BlQ2hhaW46bixmdW5jdGlvbk5hbWU6byx0aGlzOnN9PWlbdF0sYz1uLmZpbmQoZT0+ImxvY2FsIj09PWUudHlwZSkscj0iZ2xvYmFsIiE9PXMuY2xhc3NOYW1lJiZzLmNsYXNzTmFtZT9gJHtzLmNsYXNzTmFtZX0uJHtvfWA6bztpZih2b2lkIDA9PT1jPy5vYmplY3Qub2JqZWN0SWQpYVt0XT17ZnVuY3Rpb246cn07ZWxzZXtjb25zdCBuPWF3YWl0IGwoZSxjLm9iamVjdC5vYmplY3RJZCk7YVt0XT17ZnVuY3Rpb246cix2YXJzOm59fX1hd2FpdCBlLnBvc3QoIlJ1bnRpbWUuY2FsbEZ1bmN0aW9uT24iLHtmdW5jdGlvbkRlY2xhcmF0aW9uOmBmdW5jdGlvbigpIHsgdGhpcy4ke299ID0gdGhpcy4ke299IHx8ICR7SlNPTi5zdHJpbmdpZnkoYSl9OyB9YCxzaWxlbnQ6ITAsb2JqZWN0SWQ6bn0pLGF3YWl0IGUucG9zdCgiUnVudGltZS5yZWxlYXNlT2JqZWN0Iix7b2JqZWN0SWQ6bn0pfSh0LGUucGFyYW1zKS50aGVuKGFzeW5jKCk9PntuJiZhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnJlc3VtZSIpfSxhc3luYyBlPT57biYmYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5yZXN1bWUiKX0pfSksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5lbmFibGUiKTtjb25zdCBpPSExIT09YS5jYXB0dXJlQWxsRXhjZXB0aW9ucztpZihhd2FpdCB0LnBvc3QoIkRlYnVnZ2VyLnNldFBhdXNlT25FeGNlcHRpb25zIix7c3RhdGU6aT8iYWxsIjoidW5jYXVnaHQifSksaSl7Y29uc3QgZT1hLm1heEV4Y2VwdGlvbnNQZXJTZWNvbmR8fDUwO2Y9ZnVuY3Rpb24oZSx0LG4pe2xldCBpPTAsbz01LGE9MDtyZXR1cm4gc2V0SW50ZXJ2YWwoKCk9PnswPT09YT9pPmUmJihvKj0yLG4obyksbz44NjQwMCYmKG89ODY0MDApLGE9byk6KGEtPTEsMD09PWEmJnQoKSksaT0wfSwxZTMpLnVucmVmKCksKCk9PntpKz0xfX0oZSxhc3luYygpPT57cygiUmF0ZS1saW1pdCBsaWZ0ZWQuIiksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJhbGwifSl9LGFzeW5jIGU9PntzKGBSYXRlLWxpbWl0IGV4Y2VlZGVkLiBEaXNhYmxpbmcgY2FwdHVyaW5nIG9mIGNhdWdodCBleGNlcHRpb25zIGZvciAke2V9IHNlY29uZHMuYCksYXdhaXQgdC5wb3N0KCJEZWJ1Z2dlci5zZXRQYXVzZU9uRXhjZXB0aW9ucyIse3N0YXRlOiJ1bmNhdWdodCJ9KX0pfX0pKCkuY2F0Y2goZT0+e3MoIkZhaWxlZCB0byBzdGFydCBkZWJ1Z2dlciIsZSl9KSxzZXRJbnRlcnZhbCgoKT0+e30sMWU0KTs=";
40003
40256
  function log2(...args) {
40004
40257
  debug.log("[LocalVariables]", ...args);
40005
40258
  }
@@ -40206,7 +40459,7 @@ class AsyncSession {
40206
40459
  next(vars);
40207
40460
  }
40208
40461
  }
40209
- var INTEGRATION_NAME10 = "LocalVariables";
40462
+ var INTEGRATION_NAME12 = "LocalVariables";
40210
40463
  var _localVariablesSyncIntegration = (options = {}, sessionOverride) => {
40211
40464
  const cachedFrames = new LRUMap(20);
40212
40465
  let rateLimiter;
@@ -40241,7 +40494,7 @@ var _localVariablesSyncIntegration = (options = {}, sessionOverride) => {
40241
40494
  return event;
40242
40495
  }
40243
40496
  return {
40244
- name: INTEGRATION_NAME10,
40497
+ name: INTEGRATION_NAME12,
40245
40498
  async setupOnce() {
40246
40499
  const client = getClient();
40247
40500
  const clientOptions = client?.getOptions();
@@ -40361,11 +40614,11 @@ function supportsEsmLoaderHooks() {
40361
40614
 
40362
40615
  // ../../node_modules/@sentry/node-core/build/esm/integrations/modules.js
40363
40616
  var moduleCache;
40364
- var INTEGRATION_NAME11 = "Modules";
40617
+ var INTEGRATION_NAME13 = "Modules";
40365
40618
  var SERVER_MODULES = typeof __SENTRY_SERVER_MODULES__ === "undefined" ? {} : __SENTRY_SERVER_MODULES__;
40366
40619
  var _modulesIntegration = () => {
40367
40620
  return {
40368
- name: INTEGRATION_NAME11,
40621
+ name: INTEGRATION_NAME13,
40369
40622
  processEvent(event) {
40370
40623
  event.modules = {
40371
40624
  ...event.modules,
@@ -40469,14 +40722,14 @@ function logAndExitProcess(error2) {
40469
40722
  }
40470
40723
 
40471
40724
  // ../../node_modules/@sentry/node-core/build/esm/integrations/onuncaughtexception.js
40472
- var INTEGRATION_NAME12 = "OnUncaughtException";
40725
+ var INTEGRATION_NAME14 = "OnUncaughtException";
40473
40726
  var onUncaughtExceptionIntegration = defineIntegration((options = {}) => {
40474
40727
  const optionsWithDefaults = {
40475
40728
  exitEvenIfOtherHandlersAreRegistered: false,
40476
40729
  ...options
40477
40730
  };
40478
40731
  return {
40479
- name: INTEGRATION_NAME12,
40732
+ name: INTEGRATION_NAME14,
40480
40733
  setup(client) {
40481
40734
  global.process.on("uncaughtException", makeErrorHandler(client, optionsWithDefaults));
40482
40735
  }
@@ -40540,25 +40793,51 @@ function makeErrorHandler(client, options) {
40540
40793
  }
40541
40794
 
40542
40795
  // ../../node_modules/@sentry/node-core/build/esm/integrations/onunhandledrejection.js
40543
- var INTEGRATION_NAME13 = "OnUnhandledRejection";
40796
+ var INTEGRATION_NAME15 = "OnUnhandledRejection";
40797
+ var DEFAULT_IGNORES = [
40798
+ {
40799
+ name: "AI_NoOutputGeneratedError"
40800
+ }
40801
+ ];
40544
40802
  var _onUnhandledRejectionIntegration = (options = {}) => {
40545
40803
  const opts = {
40546
- mode: "warn",
40547
- ...options
40804
+ mode: options.mode ?? "warn",
40805
+ ignore: [...DEFAULT_IGNORES, ...options.ignore ?? []]
40548
40806
  };
40549
40807
  return {
40550
- name: INTEGRATION_NAME13,
40808
+ name: INTEGRATION_NAME15,
40551
40809
  setup(client) {
40552
40810
  global.process.on("unhandledRejection", makeUnhandledPromiseHandler(client, opts));
40553
40811
  }
40554
40812
  };
40555
40813
  };
40556
40814
  var onUnhandledRejectionIntegration = defineIntegration(_onUnhandledRejectionIntegration);
40815
+ function extractErrorInfo(reason) {
40816
+ if (typeof reason !== "object" || reason === null) {
40817
+ return { name: "", message: String(reason ?? "") };
40818
+ }
40819
+ const errorLike = reason;
40820
+ const name = typeof errorLike.name === "string" ? errorLike.name : "";
40821
+ const message = typeof errorLike.message === "string" ? errorLike.message : String(reason);
40822
+ return { name, message };
40823
+ }
40824
+ function isMatchingReason(matcher, errorInfo) {
40825
+ const nameMatches = matcher.name === undefined || isMatchingPattern(errorInfo.name, matcher.name, true);
40826
+ const messageMatches = matcher.message === undefined || isMatchingPattern(errorInfo.message, matcher.message);
40827
+ return nameMatches && messageMatches;
40828
+ }
40829
+ function matchesIgnore(list, reason) {
40830
+ const errorInfo = extractErrorInfo(reason);
40831
+ return list.some((matcher) => isMatchingReason(matcher, errorInfo));
40832
+ }
40557
40833
  function makeUnhandledPromiseHandler(client, options) {
40558
40834
  return function sendUnhandledPromise(reason, promise) {
40559
40835
  if (getClient() !== client) {
40560
40836
  return;
40561
40837
  }
40838
+ if (matchesIgnore(options.ignore ?? [], reason)) {
40839
+ return;
40840
+ }
40562
40841
  const level = options.mode === "strict" ? "fatal" : "error";
40563
40842
  const activeSpanForError = reason && typeof reason === "object" ? reason._sentry_active_span : undefined;
40564
40843
  const activeSpanWrapper = activeSpanForError ? (fn) => withActiveSpan(activeSpanForError, fn) : (fn) => fn();
@@ -40595,13 +40874,13 @@ function handleRejection(reason, mode) {
40595
40874
 
40596
40875
  // ../../node_modules/@sentry/node-core/build/esm/integrations/spotlight.js
40597
40876
  import * as http from "node:http";
40598
- var INTEGRATION_NAME14 = "Spotlight";
40877
+ var INTEGRATION_NAME16 = "Spotlight";
40599
40878
  var _spotlightIntegration = (options = {}) => {
40600
40879
  const _options = {
40601
40880
  sidecarUrl: options.sidecarUrl || "http://localhost:8969/stream"
40602
40881
  };
40603
40882
  return {
40604
- name: INTEGRATION_NAME14,
40883
+ name: INTEGRATION_NAME16,
40605
40884
  setup(client) {
40606
40885
  try {
40607
40886
  if (false) {}
@@ -40660,7 +40939,7 @@ function parseSidecarUrl(url) {
40660
40939
 
40661
40940
  // ../../node_modules/@sentry/node-core/build/esm/integrations/systemError.js
40662
40941
  import * as util from "node:util";
40663
- var INTEGRATION_NAME15 = "NodeSystemError";
40942
+ var INTEGRATION_NAME17 = "NodeSystemError";
40664
40943
  function isSystemError(error2) {
40665
40944
  if (!(error2 instanceof Error)) {
40666
40945
  return false;
@@ -40672,7 +40951,7 @@ function isSystemError(error2) {
40672
40951
  }
40673
40952
  var systemErrorIntegration = defineIntegration((options = {}) => {
40674
40953
  return {
40675
- name: INTEGRATION_NAME15,
40954
+ name: INTEGRATION_NAME17,
40676
40955
  processEvent: (event, hint, client) => {
40677
40956
  if (!isSystemError(hint.originalException)) {
40678
40957
  return event;
@@ -40706,10 +40985,10 @@ var systemErrorIntegration = defineIntegration((options = {}) => {
40706
40985
 
40707
40986
  // ../../node_modules/@sentry/node-core/build/esm/integrations/childProcess.js
40708
40987
  import * as diagnosticsChannel from "node:diagnostics_channel";
40709
- var INTEGRATION_NAME16 = "ChildProcess";
40988
+ var INTEGRATION_NAME18 = "ChildProcess";
40710
40989
  var childProcessIntegration = defineIntegration((options = {}) => {
40711
40990
  return {
40712
- name: INTEGRATION_NAME16,
40991
+ name: INTEGRATION_NAME18,
40713
40992
  setup() {
40714
40993
  diagnosticsChannel.channel("child_process").subscribe((event) => {
40715
40994
  if (event && typeof event === "object" && "process" in event) {
@@ -40784,22 +41063,22 @@ function captureWorkerThreadEvents(worker, options) {
40784
41063
  var import_context_async_hooks = __toESM(require_src10(), 1);
40785
41064
  var SentryContextManager = wrapContextManagerClass(import_context_async_hooks.AsyncLocalStorageContextManager);
40786
41065
  // ../../node_modules/@sentry/node-core/build/esm/otel/logger.js
40787
- var import_api6 = __toESM(require_src(), 1);
41066
+ var import_api7 = __toESM(require_src(), 1);
40788
41067
  function setupOpenTelemetryLogger() {
40789
- import_api6.diag.disable();
40790
- import_api6.diag.setLogger({
41068
+ import_api7.diag.disable();
41069
+ import_api7.diag.setLogger({
40791
41070
  error: debug.error,
40792
41071
  warn: debug.warn,
40793
41072
  info: debug.log,
40794
41073
  debug: debug.log,
40795
41074
  verbose: debug.log
40796
- }, import_api6.DiagLogLevel.DEBUG);
41075
+ }, import_api7.DiagLogLevel.DEBUG);
40797
41076
  }
40798
41077
  // ../../node_modules/@sentry/node-core/build/esm/integrations/processSession.js
40799
- var INTEGRATION_NAME17 = "ProcessSession";
41078
+ var INTEGRATION_NAME19 = "ProcessSession";
40800
41079
  var processSessionIntegration = defineIntegration(() => {
40801
41080
  return {
40802
- name: INTEGRATION_NAME17,
41081
+ name: INTEGRATION_NAME19,
40803
41082
  setupOnce() {
40804
41083
  startSession();
40805
41084
  process.on("beforeExit", () => {
@@ -41216,7 +41495,7 @@ function getSentryRelease(fallback) {
41216
41495
  var defaultStackParser = createStackParser(nodeStackLineParser(createGetModuleFromFilename()));
41217
41496
 
41218
41497
  // ../../node_modules/@sentry/node-core/build/esm/sdk/client.js
41219
- var import_api7 = __toESM(require_src(), 1);
41498
+ var import_api8 = __toESM(require_src(), 1);
41220
41499
  var import_instrumentation4 = __toESM(require_src6(), 1);
41221
41500
  import * as os2 from "node:os";
41222
41501
  import { threadId, isMainThread } from "worker_threads";
@@ -41260,7 +41539,7 @@ class NodeClient extends ServerRuntimeClient {
41260
41539
  }
41261
41540
  const name = "@sentry/node";
41262
41541
  const version = SDK_VERSION;
41263
- const tracer = import_api7.trace.getTracer(name, version);
41542
+ const tracer = import_api8.trace.getTracer(name, version);
41264
41543
  this._tracer = tracer;
41265
41544
  return tracer;
41266
41545
  }
@@ -41370,7 +41649,7 @@ function _init(_options = {}, getDefaultIntegrationsImpl) {
41370
41649
  setOpenTelemetryContextAsyncContextStrategy();
41371
41650
  const scope = getCurrentScope();
41372
41651
  scope.update(options.initialScope);
41373
- if (options.spotlight && !options.integrations.some(({ name }) => name === INTEGRATION_NAME14)) {
41652
+ if (options.spotlight && !options.integrations.some(({ name }) => name === INTEGRATION_NAME16)) {
41374
41653
  options.integrations.push(spotlightIntegration({
41375
41654
  sidecarUrl: typeof options.spotlight === "string" ? options.spotlight : undefined
41376
41655
  }));
@@ -41379,6 +41658,7 @@ function _init(_options = {}, getDefaultIntegrationsImpl) {
41379
41658
  const client = new NodeClient(options);
41380
41659
  getCurrentScope().setClient(client);
41381
41660
  client.init();
41661
+ GLOBAL_OBJ._sentryInjectLoaderHookRegister?.();
41382
41662
  debug.log(`SDK initialized from ${isCjs() ? "CommonJS" : "ESM"}`);
41383
41663
  client.startClientReportTracking();
41384
41664
  updateScopeFromEnvVariables();
@@ -41463,22 +41743,19 @@ function updateScopeFromEnvVariables() {
41463
41743
  function addOriginToSpan2(span, origin) {
41464
41744
  span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, origin);
41465
41745
  }
41466
- // ../../node_modules/@sentry/node/build/esm/debug-build.js
41467
- var DEBUG_BUILD4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
41468
-
41469
41746
  // ../../node_modules/@sentry/node/build/esm/integrations/http.js
41470
- var INTEGRATION_NAME18 = "Http";
41747
+ var INTEGRATION_NAME20 = "Http";
41471
41748
  var INSTRUMENTATION_NAME2 = "@opentelemetry_sentry-patched/instrumentation-http";
41472
- var instrumentSentryHttp2 = generateInstrumentOnce(`${INTEGRATION_NAME18}.sentry`, (options) => {
41749
+ var instrumentSentryHttp2 = generateInstrumentOnce(`${INTEGRATION_NAME20}.sentry`, (options) => {
41473
41750
  return new SentryHttpInstrumentation(options);
41474
41751
  });
41475
- var instrumentOtelHttp = generateInstrumentOnce(INTEGRATION_NAME18, (config) => {
41752
+ var instrumentOtelHttp = generateInstrumentOnce(INTEGRATION_NAME20, (config) => {
41476
41753
  const instrumentation = new import_instrumentation_http.HttpInstrumentation({
41477
41754
  ...config,
41478
41755
  disableIncomingRequestInstrumentation: true
41479
41756
  });
41480
41757
  try {
41481
- instrumentation["_diag"] = import_api9.diag.createComponentLogger({
41758
+ instrumentation["_diag"] = import_api10.diag.createComponentLogger({
41482
41759
  namespace: INSTRUMENTATION_NAME2
41483
41760
  });
41484
41761
  instrumentation.instrumentationName = INSTRUMENTATION_NAME2;
@@ -41498,40 +41775,49 @@ function _shouldUseOtelHttpInstrumentation(options, clientOptions = {}) {
41498
41775
  return true;
41499
41776
  }
41500
41777
  var httpIntegration2 = defineIntegration((options = {}) => {
41501
- const dropSpansForIncomingRequestStatusCodes = options.dropSpansForIncomingRequestStatusCodes ?? [
41502
- [401, 404],
41503
- [301, 303],
41504
- [305, 399]
41505
- ];
41778
+ const spans = options.spans ?? true;
41779
+ const disableIncomingRequestSpans = options.disableIncomingRequestSpans;
41780
+ const serverOptions = {
41781
+ sessions: options.trackIncomingRequestsAsSessions,
41782
+ sessionFlushingDelayMS: options.sessionFlushingDelayMS,
41783
+ ignoreRequestBody: options.ignoreIncomingRequestBody,
41784
+ maxRequestBodySize: options.maxIncomingRequestBodySize
41785
+ };
41786
+ const serverSpansOptions = {
41787
+ ignoreIncomingRequests: options.ignoreIncomingRequests,
41788
+ ignoreStaticAssets: options.ignoreStaticAssets,
41789
+ ignoreStatusCodes: options.dropSpansForIncomingRequestStatusCodes,
41790
+ instrumentation: options.instrumentation,
41791
+ onSpanCreated: options.incomingRequestSpanHook
41792
+ };
41793
+ const server = httpServerIntegration(serverOptions);
41794
+ const serverSpans = httpServerSpansIntegration(serverSpansOptions);
41795
+ const enableServerSpans = spans && !disableIncomingRequestSpans;
41506
41796
  return {
41507
- name: INTEGRATION_NAME18,
41797
+ name: INTEGRATION_NAME20,
41798
+ setup(client) {
41799
+ const clientOptions = client.getOptions();
41800
+ if (enableServerSpans && hasSpansEnabled(clientOptions)) {
41801
+ serverSpans.setup(client);
41802
+ }
41803
+ },
41508
41804
  setupOnce() {
41509
41805
  const clientOptions = getClient()?.getOptions() || {};
41510
41806
  const useOtelHttpInstrumentation = _shouldUseOtelHttpInstrumentation(options, clientOptions);
41511
- const disableIncomingRequestSpans = options.disableIncomingRequestSpans ?? !hasSpansEnabled(clientOptions);
41512
- instrumentSentryHttp2({
41513
- ...options,
41514
- disableIncomingRequestSpans,
41515
- ignoreSpansForIncomingRequests: options.ignoreIncomingRequests,
41516
- propagateTraceInOutgoingRequests: !useOtelHttpInstrumentation
41517
- });
41807
+ server.setupOnce();
41808
+ const sentryHttpInstrumentationOptions = {
41809
+ breadcrumbs: options.breadcrumbs,
41810
+ propagateTraceInOutgoingRequests: !useOtelHttpInstrumentation,
41811
+ ignoreOutgoingRequests: options.ignoreOutgoingRequests
41812
+ };
41813
+ instrumentSentryHttp2(sentryHttpInstrumentationOptions);
41518
41814
  if (useOtelHttpInstrumentation) {
41519
41815
  const instrumentationConfig = getConfigWithDefaults(options);
41520
41816
  instrumentOtelHttp(instrumentationConfig);
41521
41817
  }
41522
41818
  },
41523
41819
  processEvent(event) {
41524
- if (event.type === "transaction") {
41525
- const statusCode = event.contexts?.trace?.data?.["http.response.status_code"];
41526
- if (typeof statusCode === "number") {
41527
- const shouldDrop = shouldFilterStatusCode2(statusCode, dropSpansForIncomingRequestStatusCodes);
41528
- if (shouldDrop) {
41529
- DEBUG_BUILD4 && debug.log("Dropping transaction due to status code", statusCode);
41530
- return null;
41531
- }
41532
- }
41533
- }
41534
- return event;
41820
+ return serverSpans.processEvent(event);
41535
41821
  }
41536
41822
  };
41537
41823
  });
@@ -41562,23 +41848,14 @@ function getConfigWithDefaults(options = {}) {
41562
41848
  };
41563
41849
  return instrumentationConfig;
41564
41850
  }
41565
- function shouldFilterStatusCode2(statusCode, dropForStatusCodes) {
41566
- return dropForStatusCodes.some((code) => {
41567
- if (typeof code === "number") {
41568
- return code === statusCode;
41569
- }
41570
- const [min, max] = code;
41571
- return statusCode >= min && statusCode <= max;
41572
- });
41573
- }
41574
41851
 
41575
41852
  // ../../node_modules/@sentry/node/build/esm/integrations/node-fetch.js
41576
41853
  var import_instrumentation_undici = __toESM(require_src11(), 1);
41577
- var INTEGRATION_NAME19 = "NodeFetch";
41578
- var instrumentOtelNodeFetch = generateInstrumentOnce(INTEGRATION_NAME19, import_instrumentation_undici.UndiciInstrumentation, (options) => {
41854
+ var INTEGRATION_NAME21 = "NodeFetch";
41855
+ var instrumentOtelNodeFetch = generateInstrumentOnce(INTEGRATION_NAME21, import_instrumentation_undici.UndiciInstrumentation, (options) => {
41579
41856
  return getConfigWithDefaults2(options);
41580
41857
  });
41581
- var instrumentSentryNodeFetch2 = generateInstrumentOnce(`${INTEGRATION_NAME19}.sentry`, SentryNodeFetchInstrumentation, (options) => {
41858
+ var instrumentSentryNodeFetch2 = generateInstrumentOnce(`${INTEGRATION_NAME21}.sentry`, SentryNodeFetchInstrumentation, (options) => {
41582
41859
  return options;
41583
41860
  });
41584
41861
  var _nativeNodeFetchIntegration2 = (options = {}) => {
@@ -41627,7 +41904,12 @@ function getConfigWithDefaults2(options = {}) {
41627
41904
 
41628
41905
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/express.js
41629
41906
  var import_instrumentation_express = __toESM(require_src12(), 1);
41630
- var INTEGRATION_NAME20 = "Express";
41907
+
41908
+ // ../../node_modules/@sentry/node/build/esm/debug-build.js
41909
+ var DEBUG_BUILD4 = typeof __SENTRY_DEBUG__ === "undefined" || __SENTRY_DEBUG__;
41910
+
41911
+ // ../../node_modules/@sentry/node/build/esm/integrations/tracing/express.js
41912
+ var INTEGRATION_NAME22 = "Express";
41631
41913
  function requestHook(span) {
41632
41914
  addOriginToSpan2(span, "auto.http.otel.express");
41633
41915
  const attributes = spanToJSON(span).data;
@@ -41652,13 +41934,13 @@ function spanNameHook(info, defaultName) {
41652
41934
  }
41653
41935
  return defaultName;
41654
41936
  }
41655
- var instrumentExpress = generateInstrumentOnce(INTEGRATION_NAME20, () => new import_instrumentation_express.ExpressInstrumentation({
41937
+ var instrumentExpress = generateInstrumentOnce(INTEGRATION_NAME22, () => new import_instrumentation_express.ExpressInstrumentation({
41656
41938
  requestHook: (span) => requestHook(span),
41657
41939
  spanNameHook: (info, defaultName) => spanNameHook(info, defaultName)
41658
41940
  }));
41659
41941
  var _expressIntegration = () => {
41660
41942
  return {
41661
- name: INTEGRATION_NAME20,
41943
+ name: INTEGRATION_NAME22,
41662
41944
  setupOnce() {
41663
41945
  instrumentExpress();
41664
41946
  }
@@ -41670,8 +41952,8 @@ var expressIntegration = defineIntegration(_expressIntegration);
41670
41952
  import * as dc from "node:diagnostics_channel";
41671
41953
 
41672
41954
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/fastify-otel/index.js
41673
- var import_api10 = __toESM(require_src(), 1);
41674
- var import_core72 = __toESM(require_src3(), 1);
41955
+ var import_api11 = __toESM(require_src(), 1);
41956
+ var import_core73 = __toESM(require_src3(), 1);
41675
41957
  var import_instrumentation5 = __toESM(require_src6(), 1);
41676
41958
  var import_semantic_conventions3 = __toESM(require_src2(), 1);
41677
41959
  import dc__default from "node:diagnostics_channel";
@@ -42927,7 +43209,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
42927
43209
  super(PACKAGE_NAME, PACKAGE_VERSION, config);
42928
43210
  this.servername = config?.servername ?? process.env.OTEL_SERVICE_NAME ?? "fastify";
42929
43211
  this[kIgnorePaths] = null;
42930
- this._logger = import_api10.diag.createComponentLogger({ namespace: PACKAGE_NAME });
43212
+ this._logger = import_api11.diag.createComponentLogger({ namespace: PACKAGE_NAME });
42931
43213
  if (config?.ignorePaths != null || process.env.OTEL_FASTIFY_IGNORE_PATHS != null) {
42932
43214
  const ignorePaths = config?.ignorePaths ?? process.env.OTEL_FASTIFY_IGNORE_PATHS;
42933
43215
  if ((typeof ignorePaths !== "string" || ignorePaths.length === 0) && typeof ignorePaths !== "function") {
@@ -42984,10 +43266,10 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
42984
43266
  tracer: instrumentation.tracer,
42985
43267
  context: ctx,
42986
43268
  inject: (carrier, setter) => {
42987
- return import_api10.propagation.inject(ctx, carrier, setter);
43269
+ return import_api11.propagation.inject(ctx, carrier, setter);
42988
43270
  },
42989
43271
  extract: (carrier, getter) => {
42990
- return import_api10.propagation.extract(ctx, carrier, getter);
43272
+ return import_api11.propagation.extract(ctx, carrier, getter);
42991
43273
  }
42992
43274
  };
42993
43275
  });
@@ -43052,12 +43334,12 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43052
43334
  this[kInstrumentation]._logger.debug(`Ignoring request ${request2.method} ${request2.url} because it matches the ignore path`);
43053
43335
  return hookDone();
43054
43336
  }
43055
- let ctx = import_api10.context.active();
43056
- if (import_api10.trace.getSpan(ctx) == null) {
43057
- ctx = import_api10.propagation.extract(ctx, request2.headers);
43337
+ let ctx = import_api11.context.active();
43338
+ if (import_api11.trace.getSpan(ctx) == null) {
43339
+ ctx = import_api11.propagation.extract(ctx, request2.headers);
43058
43340
  }
43059
- const rpcMetadata = import_core72.getRPCMetadata(ctx);
43060
- if (request2.routeOptions.url != null && rpcMetadata?.type === import_core72.RPCType.HTTP) {
43341
+ const rpcMetadata = import_core73.getRPCMetadata(ctx);
43342
+ if (request2.routeOptions.url != null && rpcMetadata?.type === import_core73.RPCType.HTTP) {
43061
43343
  rpcMetadata.route = request2.routeOptions.url;
43062
43344
  }
43063
43345
  const span = this[kInstrumentation].tracer.startSpan("request", {
@@ -43068,9 +43350,9 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43068
43350
  [import_semantic_conventions3.ATTR_HTTP_REQUEST_METHOD]: request2.method
43069
43351
  }
43070
43352
  }, ctx);
43071
- request2[kRequestContext] = import_api10.trace.setSpan(ctx, span);
43353
+ request2[kRequestContext] = import_api11.trace.setSpan(ctx, span);
43072
43354
  request2[kRequestSpan] = span;
43073
- import_api10.context.with(request2[kRequestContext], () => {
43355
+ import_api11.context.with(request2[kRequestContext], () => {
43074
43356
  hookDone();
43075
43357
  });
43076
43358
  });
@@ -43078,7 +43360,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43078
43360
  const span = request2[kRequestSpan];
43079
43361
  if (span != null) {
43080
43362
  span.setStatus({
43081
- code: import_api10.SpanStatusCode.OK,
43363
+ code: import_api11.SpanStatusCode.OK,
43082
43364
  message: "OK"
43083
43365
  });
43084
43366
  span.setAttributes({
@@ -43097,7 +43379,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43097
43379
  if (span != null) {
43098
43380
  if (reply.statusCode < 500) {
43099
43381
  span.setStatus({
43100
- code: import_api10.SpanStatusCode.OK,
43382
+ code: import_api11.SpanStatusCode.OK,
43101
43383
  message: "OK"
43102
43384
  });
43103
43385
  }
@@ -43113,7 +43395,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43113
43395
  const span = request2[kRequestSpan];
43114
43396
  if (span != null) {
43115
43397
  span.setStatus({
43116
- code: import_api10.SpanStatusCode.ERROR,
43398
+ code: import_api11.SpanStatusCode.ERROR,
43117
43399
  message: error2.message
43118
43400
  });
43119
43401
  span.recordException(error2);
@@ -43176,11 +43458,11 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43176
43458
  if (instrumentation2.isEnabled() === false) {
43177
43459
  return handler.call(this, ...args);
43178
43460
  }
43179
- const ctx = request2[kRequestContext] ?? import_api10.context.active();
43461
+ const ctx = request2[kRequestContext] ?? import_api11.context.active();
43180
43462
  const span = instrumentation2.tracer.startSpan(`handler - ${handler.name?.length > 0 ? handler.name : this.pluginName ?? ANONYMOUS_FUNCTION_NAME}`, {
43181
43463
  attributes: spanAttributes
43182
43464
  }, ctx);
43183
- return import_api10.context.with(import_api10.trace.setSpan(ctx, span), function() {
43465
+ return import_api11.context.with(import_api11.trace.setSpan(ctx, span), function() {
43184
43466
  try {
43185
43467
  const res = handler.call(this, ...args);
43186
43468
  if (typeof res?.then === "function") {
@@ -43189,7 +43471,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43189
43471
  return result;
43190
43472
  }, (error2) => {
43191
43473
  span.setStatus({
43192
- code: import_api10.SpanStatusCode.ERROR,
43474
+ code: import_api11.SpanStatusCode.ERROR,
43193
43475
  message: error2.message
43194
43476
  });
43195
43477
  span.recordException(error2);
@@ -43201,7 +43483,7 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43201
43483
  return res;
43202
43484
  } catch (error2) {
43203
43485
  span.setStatus({
43204
- code: import_api10.SpanStatusCode.ERROR,
43486
+ code: import_api11.SpanStatusCode.ERROR,
43205
43487
  message: error2.message
43206
43488
  });
43207
43489
  span.recordException(error2);
@@ -43216,8 +43498,8 @@ class FastifyOtelInstrumentation extends import_instrumentation5.Instrumentation
43216
43498
  }
43217
43499
 
43218
43500
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/instrumentation.js
43219
- var import_api12 = __toESM(require_src(), 1);
43220
- var import_core73 = __toESM(require_src3(), 1);
43501
+ var import_api13 = __toESM(require_src(), 1);
43502
+ var import_core74 = __toESM(require_src3(), 1);
43221
43503
  var import_instrumentation6 = __toESM(require_src6(), 1);
43222
43504
  var import_semantic_conventions4 = __toESM(require_src2(), 1);
43223
43505
 
@@ -43249,7 +43531,7 @@ var FastifyNames;
43249
43531
  })(FastifyNames || (FastifyNames = {}));
43250
43532
 
43251
43533
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/utils.js
43252
- var import_api11 = __toESM(require_src(), 1);
43534
+ var import_api12 = __toESM(require_src(), 1);
43253
43535
 
43254
43536
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/v3/constants.js
43255
43537
  var spanRequestSymbol = Symbol("opentelemetry.instrumentation.fastify.request_active_span");
@@ -43274,7 +43556,7 @@ function endSpan(reply, err) {
43274
43556
  spans.forEach((span) => {
43275
43557
  if (err) {
43276
43558
  span.setStatus({
43277
- code: import_api11.SpanStatusCode.ERROR,
43559
+ code: import_api12.SpanStatusCode.ERROR,
43278
43560
  message: err.message
43279
43561
  });
43280
43562
  span.recordException(err);
@@ -43342,9 +43624,9 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
43342
43624
  }
43343
43625
  instrumentation._wrap(reply, "send", instrumentation._patchSend());
43344
43626
  const anyRequest = request2;
43345
- const rpcMetadata = import_core73.getRPCMetadata(import_api12.context.active());
43627
+ const rpcMetadata = import_core74.getRPCMetadata(import_api13.context.active());
43346
43628
  const routeName = anyRequest.routeOptions ? anyRequest.routeOptions.url : request2.routerPath;
43347
- if (routeName && rpcMetadata?.type === import_core73.RPCType.HTTP) {
43629
+ if (routeName && rpcMetadata?.type === import_core74.RPCType.HTTP) {
43348
43630
  rpcMetadata.route = routeName;
43349
43631
  }
43350
43632
  const method = request2.method || "GET";
@@ -43374,13 +43656,13 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
43374
43656
  origDone.apply(this, doneArgs);
43375
43657
  };
43376
43658
  }
43377
- return import_api12.context.with(import_api12.trace.setSpan(import_api12.context.active(), span), () => {
43659
+ return import_api13.context.with(import_api13.trace.setSpan(import_api13.context.active(), span), () => {
43378
43660
  return safeExecuteInTheMiddleMaybePromise(() => {
43379
43661
  return original.apply(this, args);
43380
43662
  }, (err) => {
43381
43663
  if (err instanceof Error) {
43382
43664
  span.setStatus({
43383
- code: import_api12.SpanStatusCode.ERROR,
43665
+ code: import_api13.SpanStatusCode.ERROR,
43384
43666
  message: err.message
43385
43667
  });
43386
43668
  span.recordException(err);
@@ -43477,7 +43759,7 @@ class FastifyInstrumentationV3 extends import_instrumentation6.InstrumentationBa
43477
43759
  }
43478
43760
  }, true);
43479
43761
  }
43480
- return import_api12.context.with(import_api12.trace.setSpan(import_api12.context.active(), span), () => {
43762
+ return import_api13.context.with(import_api13.trace.setSpan(import_api13.context.active(), span), () => {
43481
43763
  done();
43482
43764
  });
43483
43765
  };
@@ -43509,14 +43791,14 @@ function addFastifyV3SpanAttributes(span) {
43509
43791
  }
43510
43792
 
43511
43793
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/fastify/index.js
43512
- var INTEGRATION_NAME21 = "Fastify";
43513
- var instrumentFastifyV3 = generateInstrumentOnce(`${INTEGRATION_NAME21}.v3`, () => new FastifyInstrumentationV3);
43794
+ var INTEGRATION_NAME23 = "Fastify";
43795
+ var instrumentFastifyV3 = generateInstrumentOnce(`${INTEGRATION_NAME23}.v3`, () => new FastifyInstrumentationV3);
43514
43796
  function getFastifyIntegration() {
43515
43797
  const client = getClient();
43516
43798
  if (!client) {
43517
43799
  return;
43518
43800
  } else {
43519
- return client.getIntegrationByName(INTEGRATION_NAME21);
43801
+ return client.getIntegrationByName(INTEGRATION_NAME23);
43520
43802
  }
43521
43803
  }
43522
43804
  function handleFastifyError(error2, request2, reply, handlerOrigin) {
@@ -43532,7 +43814,7 @@ function handleFastifyError(error2, request2, reply, handlerOrigin) {
43532
43814
  captureException(error2, { mechanism: { handled: false, type: "auto.function.fastify" } });
43533
43815
  }
43534
43816
  }
43535
- var instrumentFastify = generateInstrumentOnce(`${INTEGRATION_NAME21}.v5`, () => {
43817
+ var instrumentFastify = generateInstrumentOnce(`${INTEGRATION_NAME23}.v5`, () => {
43536
43818
  const fastifyOtelInstrumentationInstance = new FastifyOtelInstrumentation;
43537
43819
  const plugin = fastifyOtelInstrumentationInstance.plugin();
43538
43820
  dc.subscribe("fastify.initialization", (message) => {
@@ -43557,7 +43839,7 @@ var instrumentFastify = generateInstrumentOnce(`${INTEGRATION_NAME21}.v5`, () =>
43557
43839
  var _fastifyIntegration = ({ shouldHandleError }) => {
43558
43840
  let _shouldHandleError;
43559
43841
  return {
43560
- name: INTEGRATION_NAME21,
43842
+ name: INTEGRATION_NAME23,
43561
43843
  setupOnce() {
43562
43844
  _shouldHandleError = shouldHandleError || defaultShouldHandleError;
43563
43845
  instrumentFastifyV3();
@@ -43621,10 +43903,10 @@ function instrumentOnRequest(fastify) {
43621
43903
  }
43622
43904
 
43623
43905
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/graphql.js
43624
- var import_api13 = __toESM(require_src(), 1);
43906
+ var import_api14 = __toESM(require_src(), 1);
43625
43907
  var import_instrumentation_graphql = __toESM(require_src13(), 1);
43626
- var INTEGRATION_NAME22 = "Graphql";
43627
- var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME22, import_instrumentation_graphql.GraphQLInstrumentation, (_options) => {
43908
+ var INTEGRATION_NAME24 = "Graphql";
43909
+ var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME24, import_instrumentation_graphql.GraphQLInstrumentation, (_options) => {
43628
43910
  const options = getOptionsWithDefaults(_options);
43629
43911
  return {
43630
43912
  ...options,
@@ -43632,7 +43914,7 @@ var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME22, import_instru
43632
43914
  addOriginToSpan2(span, "auto.graphql.otel.graphql");
43633
43915
  const resultWithMaybeError = result;
43634
43916
  if (resultWithMaybeError.errors?.length && !spanToJSON(span).status) {
43635
- span.setStatus({ code: import_api13.SpanStatusCode.ERROR });
43917
+ span.setStatus({ code: import_api14.SpanStatusCode.ERROR });
43636
43918
  }
43637
43919
  const attributes = spanToJSON(span).data;
43638
43920
  const operationType = attributes["graphql.operation.type"];
@@ -43660,7 +43942,7 @@ var instrumentGraphql = generateInstrumentOnce(INTEGRATION_NAME22, import_instru
43660
43942
  });
43661
43943
  var _graphqlIntegration = (options = {}) => {
43662
43944
  return {
43663
- name: INTEGRATION_NAME22,
43945
+ name: INTEGRATION_NAME24,
43664
43946
  setupOnce() {
43665
43947
  instrumentGraphql(getOptionsWithDefaults(options));
43666
43948
  }
@@ -43689,8 +43971,8 @@ function getGraphqlOperationNamesFromAttribute2(attr) {
43689
43971
 
43690
43972
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/kafka.js
43691
43973
  var import_instrumentation_kafkajs = __toESM(require_src14(), 1);
43692
- var INTEGRATION_NAME23 = "Kafka";
43693
- var instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME23, () => new import_instrumentation_kafkajs.KafkaJsInstrumentation({
43974
+ var INTEGRATION_NAME25 = "Kafka";
43975
+ var instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME25, () => new import_instrumentation_kafkajs.KafkaJsInstrumentation({
43694
43976
  consumerHook(span) {
43695
43977
  addOriginToSpan2(span, "auto.kafkajs.otel.consumer");
43696
43978
  },
@@ -43700,7 +43982,7 @@ var instrumentKafka = generateInstrumentOnce(INTEGRATION_NAME23, () => new impor
43700
43982
  }));
43701
43983
  var _kafkaIntegration = () => {
43702
43984
  return {
43703
- name: INTEGRATION_NAME23,
43985
+ name: INTEGRATION_NAME25,
43704
43986
  setupOnce() {
43705
43987
  instrumentKafka();
43706
43988
  }
@@ -43710,11 +43992,11 @@ var kafkaIntegration = defineIntegration(_kafkaIntegration);
43710
43992
 
43711
43993
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/lrumemoizer.js
43712
43994
  var import_instrumentation_lru_memoizer = __toESM(require_src15(), 1);
43713
- var INTEGRATION_NAME24 = "LruMemoizer";
43714
- var instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME24, () => new import_instrumentation_lru_memoizer.LruMemoizerInstrumentation);
43995
+ var INTEGRATION_NAME26 = "LruMemoizer";
43996
+ var instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME26, () => new import_instrumentation_lru_memoizer.LruMemoizerInstrumentation);
43715
43997
  var _lruMemoizerIntegration = () => {
43716
43998
  return {
43717
- name: INTEGRATION_NAME24,
43999
+ name: INTEGRATION_NAME26,
43718
44000
  setupOnce() {
43719
44001
  instrumentLruMemoizer();
43720
44002
  }
@@ -43724,8 +44006,8 @@ var lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);
43724
44006
 
43725
44007
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/mongo.js
43726
44008
  var import_instrumentation_mongodb = __toESM(require_src16(), 1);
43727
- var INTEGRATION_NAME25 = "Mongo";
43728
- var instrumentMongo = generateInstrumentOnce(INTEGRATION_NAME25, () => new import_instrumentation_mongodb.MongoDBInstrumentation({
44009
+ var INTEGRATION_NAME27 = "Mongo";
44010
+ var instrumentMongo = generateInstrumentOnce(INTEGRATION_NAME27, () => new import_instrumentation_mongodb.MongoDBInstrumentation({
43729
44011
  dbStatementSerializer: _defaultDbStatementSerializer,
43730
44012
  responseHook(span) {
43731
44013
  addOriginToSpan2(span, "auto.db.otel.mongo");
@@ -43765,7 +44047,7 @@ function isCommandEntry(value) {
43765
44047
  }
43766
44048
  var _mongoIntegration = () => {
43767
44049
  return {
43768
- name: INTEGRATION_NAME25,
44050
+ name: INTEGRATION_NAME27,
43769
44051
  setupOnce() {
43770
44052
  instrumentMongo();
43771
44053
  }
@@ -43775,15 +44057,15 @@ var mongoIntegration = defineIntegration(_mongoIntegration);
43775
44057
 
43776
44058
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/mongoose.js
43777
44059
  var import_instrumentation_mongoose = __toESM(require_src17(), 1);
43778
- var INTEGRATION_NAME26 = "Mongoose";
43779
- var instrumentMongoose = generateInstrumentOnce(INTEGRATION_NAME26, () => new import_instrumentation_mongoose.MongooseInstrumentation({
44060
+ var INTEGRATION_NAME28 = "Mongoose";
44061
+ var instrumentMongoose = generateInstrumentOnce(INTEGRATION_NAME28, () => new import_instrumentation_mongoose.MongooseInstrumentation({
43780
44062
  responseHook(span) {
43781
44063
  addOriginToSpan2(span, "auto.db.otel.mongoose");
43782
44064
  }
43783
44065
  }));
43784
44066
  var _mongooseIntegration = () => {
43785
44067
  return {
43786
- name: INTEGRATION_NAME26,
44068
+ name: INTEGRATION_NAME28,
43787
44069
  setupOnce() {
43788
44070
  instrumentMongoose();
43789
44071
  }
@@ -43793,11 +44075,11 @@ var mongooseIntegration = defineIntegration(_mongooseIntegration);
43793
44075
 
43794
44076
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/mysql.js
43795
44077
  var import_instrumentation_mysql = __toESM(require_src18(), 1);
43796
- var INTEGRATION_NAME27 = "Mysql";
43797
- var instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME27, () => new import_instrumentation_mysql.MySQLInstrumentation({}));
44078
+ var INTEGRATION_NAME29 = "Mysql";
44079
+ var instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME29, () => new import_instrumentation_mysql.MySQLInstrumentation({}));
43798
44080
  var _mysqlIntegration = () => {
43799
44081
  return {
43800
- name: INTEGRATION_NAME27,
44082
+ name: INTEGRATION_NAME29,
43801
44083
  setupOnce() {
43802
44084
  instrumentMysql();
43803
44085
  }
@@ -43807,15 +44089,15 @@ var mysqlIntegration = defineIntegration(_mysqlIntegration);
43807
44089
 
43808
44090
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/mysql2.js
43809
44091
  var import_instrumentation_mysql2 = __toESM(require_src20(), 1);
43810
- var INTEGRATION_NAME28 = "Mysql2";
43811
- var instrumentMysql2 = generateInstrumentOnce(INTEGRATION_NAME28, () => new import_instrumentation_mysql2.MySQL2Instrumentation({
44092
+ var INTEGRATION_NAME30 = "Mysql2";
44093
+ var instrumentMysql2 = generateInstrumentOnce(INTEGRATION_NAME30, () => new import_instrumentation_mysql2.MySQL2Instrumentation({
43812
44094
  responseHook(span) {
43813
44095
  addOriginToSpan2(span, "auto.db.otel.mysql2");
43814
44096
  }
43815
44097
  }));
43816
44098
  var _mysql2Integration = () => {
43817
44099
  return {
43818
- name: INTEGRATION_NAME28,
44100
+ name: INTEGRATION_NAME30,
43819
44101
  setupOnce() {
43820
44102
  instrumentMysql2();
43821
44103
  }
@@ -43917,7 +44199,7 @@ function flatten(input) {
43917
44199
  }
43918
44200
 
43919
44201
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/redis.js
43920
- var INTEGRATION_NAME29 = "Redis";
44202
+ var INTEGRATION_NAME31 = "Redis";
43921
44203
  var _redisOptions = {};
43922
44204
  var cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
43923
44205
  span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, "auto.db.otel.redis");
@@ -43945,12 +44227,12 @@ var cacheResponseHook = (span, redisCommand, cmdArgs, response) => {
43945
44227
  const spanDescription = safeKey.join(", ");
43946
44228
  span.updateName(truncate(spanDescription, 1024));
43947
44229
  };
43948
- var instrumentIORedis = generateInstrumentOnce(`${INTEGRATION_NAME29}.IORedis`, () => {
44230
+ var instrumentIORedis = generateInstrumentOnce(`${INTEGRATION_NAME31}.IORedis`, () => {
43949
44231
  return new import_instrumentation_ioredis.IORedisInstrumentation({
43950
44232
  responseHook: cacheResponseHook
43951
44233
  });
43952
44234
  });
43953
- var instrumentRedisModule = generateInstrumentOnce(`${INTEGRATION_NAME29}.Redis`, () => {
44235
+ var instrumentRedisModule = generateInstrumentOnce(`${INTEGRATION_NAME31}.Redis`, () => {
43954
44236
  return new import_instrumentation_redis.RedisInstrumentation({
43955
44237
  responseHook: cacheResponseHook
43956
44238
  });
@@ -43958,10 +44240,10 @@ var instrumentRedisModule = generateInstrumentOnce(`${INTEGRATION_NAME29}.Redis`
43958
44240
  var instrumentRedis = Object.assign(() => {
43959
44241
  instrumentIORedis();
43960
44242
  instrumentRedisModule();
43961
- }, { id: INTEGRATION_NAME29 });
44243
+ }, { id: INTEGRATION_NAME31 });
43962
44244
  var _redisIntegration = (options = {}) => {
43963
44245
  return {
43964
- name: INTEGRATION_NAME29,
44246
+ name: INTEGRATION_NAME31,
43965
44247
  setupOnce() {
43966
44248
  _redisOptions = options;
43967
44249
  instrumentRedis();
@@ -43972,8 +44254,8 @@ var redisIntegration = defineIntegration(_redisIntegration);
43972
44254
 
43973
44255
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/postgres.js
43974
44256
  var import_instrumentation_pg = __toESM(require_src24(), 1);
43975
- var INTEGRATION_NAME30 = "Postgres";
43976
- var instrumentPostgres = generateInstrumentOnce(INTEGRATION_NAME30, () => new import_instrumentation_pg.PgInstrumentation({
44257
+ var INTEGRATION_NAME32 = "Postgres";
44258
+ var instrumentPostgres = generateInstrumentOnce(INTEGRATION_NAME32, () => new import_instrumentation_pg.PgInstrumentation({
43977
44259
  requireParentSpan: true,
43978
44260
  requestHook(span) {
43979
44261
  addOriginToSpan2(span, "auto.db.otel.postgres");
@@ -43981,7 +44263,7 @@ var instrumentPostgres = generateInstrumentOnce(INTEGRATION_NAME30, () => new im
43981
44263
  }));
43982
44264
  var _postgresIntegration = () => {
43983
44265
  return {
43984
- name: INTEGRATION_NAME30,
44266
+ name: INTEGRATION_NAME32,
43985
44267
  setupOnce() {
43986
44268
  instrumentPostgres();
43987
44269
  }
@@ -43990,12 +44272,12 @@ var _postgresIntegration = () => {
43990
44272
  var postgresIntegration = defineIntegration(_postgresIntegration);
43991
44273
 
43992
44274
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/postgresjs.js
43993
- var import_api14 = __toESM(require_src(), 1);
44275
+ var import_api15 = __toESM(require_src(), 1);
43994
44276
  var import_instrumentation8 = __toESM(require_src6(), 1);
43995
44277
  var import_semantic_conventions5 = __toESM(require_src2(), 1);
43996
- var INTEGRATION_NAME31 = "PostgresJs";
44278
+ var INTEGRATION_NAME33 = "PostgresJs";
43997
44279
  var SUPPORTED_VERSIONS2 = [">=3.0.0 <4"];
43998
- var instrumentPostgresJs = generateInstrumentOnce(INTEGRATION_NAME31, (options) => new PostgresJsInstrumentation({
44280
+ var instrumentPostgresJs = generateInstrumentOnce(INTEGRATION_NAME33, (options) => new PostgresJsInstrumentation({
43999
44281
  requireParentSpan: options?.requireParentSpan ?? true,
44000
44282
  requestHook: options?.requestHook
44001
44283
  }));
@@ -44014,7 +44296,7 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
44014
44296
  }
44015
44297
  _shouldCreateSpans() {
44016
44298
  const config = this.getConfig();
44017
- const hasParentSpan = import_api14.trace.getSpan(import_api14.context.active()) !== undefined;
44299
+ const hasParentSpan = import_api15.trace.getSpan(import_api15.context.active()) !== undefined;
44018
44300
  return hasParentSpan || !config.requireParentSpan;
44019
44301
  }
44020
44302
  _patchReject(rejectTarget, span) {
@@ -44063,7 +44345,7 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
44063
44345
  if (requestHook2) {
44064
44346
  import_instrumentation8.safeExecuteInTheMiddle(() => requestHook2(span, sanitizedSqlQuery, postgresConnectionContext), (error2) => {
44065
44347
  if (error2) {
44066
- debug.error(`Error in requestHook for ${INTEGRATION_NAME31} integration:`, error2);
44348
+ debug.error(`Error in requestHook for ${INTEGRATION_NAME33} integration:`, error2);
44067
44349
  }
44068
44350
  });
44069
44351
  }
@@ -44116,7 +44398,7 @@ class PostgresJsInstrumentation extends import_instrumentation8.InstrumentationB
44116
44398
  }
44117
44399
  var _postgresJsIntegration = () => {
44118
44400
  return {
44119
- name: INTEGRATION_NAME31,
44401
+ name: INTEGRATION_NAME33,
44120
44402
  setupOnce() {
44121
44403
  instrumentPostgresJs();
44122
44404
  }
@@ -44125,21 +44407,21 @@ var _postgresJsIntegration = () => {
44125
44407
  var postgresJsIntegration = defineIntegration(_postgresJsIntegration);
44126
44408
 
44127
44409
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/prisma.js
44128
- var import_api17 = __toESM(require_src(), 1);
44410
+ var import_api18 = __toESM(require_src(), 1);
44129
44411
 
44130
44412
  // ../../node_modules/@prisma/instrumentation/dist/index.mjs
44131
- var import_api15 = __toESM(require_src(), 1);
44132
- var import_instrumentation9 = __toESM(require_src26(), 1);
44133
44413
  var import_api16 = __toESM(require_src(), 1);
44414
+ var import_instrumentation9 = __toESM(require_src26(), 1);
44415
+ var import_api17 = __toESM(require_src(), 1);
44134
44416
  var showAllTraces = process.env.PRISMA_SHOW_ALL_TRACES === "true";
44135
44417
  var nonSampledTraceParent = `00-10-10-00`;
44136
44418
  function engineSpanKindToOtelSpanKind(engineSpanKind) {
44137
44419
  switch (engineSpanKind) {
44138
44420
  case "client":
44139
- return import_api16.SpanKind.CLIENT;
44421
+ return import_api17.SpanKind.CLIENT;
44140
44422
  case "internal":
44141
44423
  default:
44142
- return import_api16.SpanKind.INTERNAL;
44424
+ return import_api17.SpanKind.INTERNAL;
44143
44425
  }
44144
44426
  }
44145
44427
  var ActiveTracingHelper = class {
@@ -44152,8 +44434,8 @@ var ActiveTracingHelper = class {
44152
44434
  isEnabled() {
44153
44435
  return true;
44154
44436
  }
44155
- getTraceParent(context9) {
44156
- const span = import_api16.trace.getSpanContext(context9 ?? import_api16.context.active());
44437
+ getTraceParent(context10) {
44438
+ const span = import_api17.trace.getSpanContext(context10 ?? import_api17.context.active());
44157
44439
  if (span) {
44158
44440
  return `00-${span.traceId}-${span.spanId}-0${span.traceFlags}`;
44159
44441
  }
@@ -44168,7 +44450,7 @@ var ActiveTracingHelper = class {
44168
44450
  }
44169
44451
  }
44170
44452
  getActiveContext() {
44171
- return import_api16.context.active();
44453
+ return import_api17.context.active();
44172
44454
  }
44173
44455
  runInChildSpan(options, callback) {
44174
44456
  if (typeof options === "string") {
@@ -44178,16 +44460,16 @@ var ActiveTracingHelper = class {
44178
44460
  return callback();
44179
44461
  }
44180
44462
  const tracer = this.tracerProvider.getTracer("prisma");
44181
- const context9 = options.context ?? this.getActiveContext();
44463
+ const context10 = options.context ?? this.getActiveContext();
44182
44464
  const name = `prisma:client:${options.name}`;
44183
44465
  if (shouldIgnoreSpan2(name, this.ignoreSpanTypes)) {
44184
44466
  return callback();
44185
44467
  }
44186
44468
  if (options.active === false) {
44187
- const span = tracer.startSpan(name, options, context9);
44188
- return endSpan2(span, callback(span, context9));
44469
+ const span = tracer.startSpan(name, options, context10);
44470
+ return endSpan2(span, callback(span, context10));
44189
44471
  }
44190
- return tracer.startActiveSpan(name, options, (span) => endSpan2(span, callback(span, context9)));
44472
+ return tracer.startActiveSpan(name, options, (span) => endSpan2(span, callback(span, context10)));
44191
44473
  }
44192
44474
  };
44193
44475
  function dispatchEngineSpan(tracer, engineSpan, allSpans, linkIds, ignoreSpanTypes) {
@@ -44323,7 +44605,7 @@ var PrismaInstrumentation = class extends import_instrumentation9.Instrumentatio
44323
44605
  const config = this._config;
44324
44606
  const globalValue = {
44325
44607
  helper: new ActiveTracingHelper({
44326
- tracerProvider: this.tracerProvider ?? import_api15.trace.getTracerProvider(),
44608
+ tracerProvider: this.tracerProvider ?? import_api16.trace.getTracerProvider(),
44327
44609
  ignoreSpanTypes: config.ignoreSpanTypes ?? []
44328
44610
  })
44329
44611
  };
@@ -44340,7 +44622,7 @@ var PrismaInstrumentation = class extends import_instrumentation9.Instrumentatio
44340
44622
  };
44341
44623
 
44342
44624
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/prisma.js
44343
- var INTEGRATION_NAME32 = "Prisma";
44625
+ var INTEGRATION_NAME34 = "Prisma";
44344
44626
  function isPrismaV6TracingHelper(helper) {
44345
44627
  return !!helper && typeof helper === "object" && "dispatchEngineSpans" in helper;
44346
44628
  }
@@ -44359,7 +44641,7 @@ class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
44359
44641
  const prismaTracingHelper = getPrismaTracingHelper();
44360
44642
  if (isPrismaV6TracingHelper(prismaTracingHelper)) {
44361
44643
  prismaTracingHelper.createEngineSpan = (engineSpanEvent) => {
44362
- const tracer = import_api17.trace.getTracer("prismaV5Compatibility");
44644
+ const tracer = import_api18.trace.getTracer("prismaV5Compatibility");
44363
44645
  const initialIdGenerator = tracer._idGenerator;
44364
44646
  if (!initialIdGenerator) {
44365
44647
  consoleSandbox(() => {
@@ -44378,16 +44660,16 @@ class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
44378
44660
  context: {
44379
44661
  traceId: link.trace_id,
44380
44662
  spanId: link.span_id,
44381
- traceFlags: import_api17.TraceFlags.SAMPLED
44663
+ traceFlags: import_api18.TraceFlags.SAMPLED
44382
44664
  }
44383
44665
  };
44384
44666
  });
44385
- const ctx = import_api17.trace.setSpanContext(import_api17.context.active(), {
44667
+ const ctx = import_api18.trace.setSpanContext(import_api18.context.active(), {
44386
44668
  traceId,
44387
44669
  spanId: parentSpanId,
44388
- traceFlags: import_api17.TraceFlags.SAMPLED
44670
+ traceFlags: import_api18.TraceFlags.SAMPLED
44389
44671
  });
44390
- import_api17.context.with(ctx, () => {
44672
+ import_api18.context.with(ctx, () => {
44391
44673
  const temporaryIdGenerator = {
44392
44674
  generateTraceId: () => {
44393
44675
  return traceId;
@@ -44417,18 +44699,18 @@ class SentryPrismaInteropInstrumentation extends PrismaInstrumentation {
44417
44699
  function engineSpanKindToOTELSpanKind(engineSpanKind) {
44418
44700
  switch (engineSpanKind) {
44419
44701
  case "client":
44420
- return import_api17.SpanKind.CLIENT;
44702
+ return import_api18.SpanKind.CLIENT;
44421
44703
  case "internal":
44422
44704
  default:
44423
- return import_api17.SpanKind.INTERNAL;
44705
+ return import_api18.SpanKind.INTERNAL;
44424
44706
  }
44425
44707
  }
44426
- var instrumentPrisma = generateInstrumentOnce(INTEGRATION_NAME32, (_options) => {
44708
+ var instrumentPrisma = generateInstrumentOnce(INTEGRATION_NAME34, (_options) => {
44427
44709
  return new SentryPrismaInteropInstrumentation;
44428
44710
  });
44429
44711
  var prismaIntegration = defineIntegration((_options) => {
44430
44712
  return {
44431
- name: INTEGRATION_NAME32,
44713
+ name: INTEGRATION_NAME34,
44432
44714
  setupOnce() {
44433
44715
  instrumentPrisma();
44434
44716
  },
@@ -44454,11 +44736,11 @@ var prismaIntegration = defineIntegration((_options) => {
44454
44736
 
44455
44737
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/hapi/index.js
44456
44738
  var import_instrumentation_hapi = __toESM(require_src27(), 1);
44457
- var INTEGRATION_NAME33 = "Hapi";
44458
- var instrumentHapi = generateInstrumentOnce(INTEGRATION_NAME33, () => new import_instrumentation_hapi.HapiInstrumentation);
44739
+ var INTEGRATION_NAME35 = "Hapi";
44740
+ var instrumentHapi = generateInstrumentOnce(INTEGRATION_NAME35, () => new import_instrumentation_hapi.HapiInstrumentation);
44459
44741
  var _hapiIntegration = () => {
44460
44742
  return {
44461
- name: INTEGRATION_NAME33,
44743
+ name: INTEGRATION_NAME35,
44462
44744
  setupOnce() {
44463
44745
  instrumentHapi();
44464
44746
  }
@@ -44480,7 +44762,7 @@ var HonoTypes = {
44480
44762
  };
44481
44763
 
44482
44764
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/hono/instrumentation.js
44483
- var import_api18 = __toESM(require_src(), 1);
44765
+ var import_api19 = __toESM(require_src(), 1);
44484
44766
  var import_instrumentation11 = __toESM(require_src6(), 1);
44485
44767
  var PACKAGE_NAME3 = "@sentry/instrumentation-hono";
44486
44768
  var PACKAGE_VERSION3 = "0.0.1";
@@ -44576,7 +44858,7 @@ class HonoInstrumentation extends import_instrumentation11.InstrumentationBase {
44576
44858
  }
44577
44859
  const path8 = c.req.path;
44578
44860
  const span = instrumentation.tracer.startSpan(path8);
44579
- return import_api18.context.with(import_api18.trace.setSpan(import_api18.context.active(), span), () => {
44861
+ return import_api19.context.with(import_api19.trace.setSpan(import_api19.context.active(), span), () => {
44580
44862
  return instrumentation._safeExecute(() => {
44581
44863
  const result = handler.apply(this, [c, next]);
44582
44864
  if (isThenable(result)) {
@@ -44625,7 +44907,7 @@ class HonoInstrumentation extends import_instrumentation11.InstrumentationBase {
44625
44907
  _handleError(span, error2) {
44626
44908
  if (error2 instanceof Error) {
44627
44909
  span.setStatus({
44628
- code: import_api18.SpanStatusCode.ERROR,
44910
+ code: import_api19.SpanStatusCode.ERROR,
44629
44911
  message: error2.message
44630
44912
  });
44631
44913
  span.recordException(error2);
@@ -44634,7 +44916,7 @@ class HonoInstrumentation extends import_instrumentation11.InstrumentationBase {
44634
44916
  }
44635
44917
 
44636
44918
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/hono/index.js
44637
- var INTEGRATION_NAME34 = "Hono";
44919
+ var INTEGRATION_NAME36 = "Hono";
44638
44920
  function addHonoSpanAttributes(span) {
44639
44921
  const attributes = spanToJSON(span).data;
44640
44922
  const type = attributes[AttributeNames2.HONO_TYPE];
@@ -44659,14 +44941,14 @@ function addHonoSpanAttributes(span) {
44659
44941
  getIsolationScope().setTransactionName(`${method} ${route}`);
44660
44942
  }
44661
44943
  }
44662
- var instrumentHono = generateInstrumentOnce(INTEGRATION_NAME34, () => new HonoInstrumentation({
44944
+ var instrumentHono = generateInstrumentOnce(INTEGRATION_NAME36, () => new HonoInstrumentation({
44663
44945
  responseHook: (span) => {
44664
44946
  addHonoSpanAttributes(span);
44665
44947
  }
44666
44948
  }));
44667
44949
  var _honoIntegration = () => {
44668
44950
  return {
44669
- name: INTEGRATION_NAME34,
44951
+ name: INTEGRATION_NAME36,
44670
44952
  setupOnce() {
44671
44953
  instrumentHono();
44672
44954
  }
@@ -44677,8 +44959,8 @@ var honoIntegration = defineIntegration(_honoIntegration);
44677
44959
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/koa.js
44678
44960
  var import_instrumentation_koa = __toESM(require_src28(), 1);
44679
44961
  var import_semantic_conventions7 = __toESM(require_src2(), 1);
44680
- var INTEGRATION_NAME35 = "Koa";
44681
- var instrumentKoa = generateInstrumentOnce(INTEGRATION_NAME35, import_instrumentation_koa.KoaInstrumentation, (options = {}) => {
44962
+ var INTEGRATION_NAME37 = "Koa";
44963
+ var instrumentKoa = generateInstrumentOnce(INTEGRATION_NAME37, import_instrumentation_koa.KoaInstrumentation, (options = {}) => {
44682
44964
  return {
44683
44965
  ignoreLayersType: options.ignoreLayersType,
44684
44966
  requestHook(span, info) {
@@ -44706,7 +44988,7 @@ var instrumentKoa = generateInstrumentOnce(INTEGRATION_NAME35, import_instrument
44706
44988
  });
44707
44989
  var _koaIntegration = (options = {}) => {
44708
44990
  return {
44709
- name: INTEGRATION_NAME35,
44991
+ name: INTEGRATION_NAME37,
44710
44992
  setupOnce() {
44711
44993
  instrumentKoa(options);
44712
44994
  }
@@ -44716,11 +44998,11 @@ var koaIntegration = defineIntegration(_koaIntegration);
44716
44998
 
44717
44999
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/connect.js
44718
45000
  var import_instrumentation_connect = __toESM(require_src29(), 1);
44719
- var INTEGRATION_NAME36 = "Connect";
44720
- var instrumentConnect = generateInstrumentOnce(INTEGRATION_NAME36, () => new import_instrumentation_connect.ConnectInstrumentation);
45001
+ var INTEGRATION_NAME38 = "Connect";
45002
+ var instrumentConnect = generateInstrumentOnce(INTEGRATION_NAME38, () => new import_instrumentation_connect.ConnectInstrumentation);
44721
45003
  var _connectIntegration = () => {
44722
45004
  return {
44723
- name: INTEGRATION_NAME36,
45005
+ name: INTEGRATION_NAME38,
44724
45006
  setupOnce() {
44725
45007
  instrumentConnect();
44726
45008
  }
@@ -44738,12 +45020,12 @@ var TEDIUS_INSTRUMENTED_METHODS = new Set([
44738
45020
  "prepare",
44739
45021
  "execute"
44740
45022
  ]);
44741
- var INTEGRATION_NAME37 = "Tedious";
44742
- var instrumentTedious = generateInstrumentOnce(INTEGRATION_NAME37, () => new import_instrumentation_tedious.TediousInstrumentation({}));
45023
+ var INTEGRATION_NAME39 = "Tedious";
45024
+ var instrumentTedious = generateInstrumentOnce(INTEGRATION_NAME39, () => new import_instrumentation_tedious.TediousInstrumentation({}));
44743
45025
  var _tediousIntegration = () => {
44744
45026
  let instrumentationWrappedCallback;
44745
45027
  return {
44746
- name: INTEGRATION_NAME37,
45028
+ name: INTEGRATION_NAME39,
44747
45029
  setupOnce() {
44748
45030
  const instrumentation = instrumentTedious();
44749
45031
  instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);
@@ -44766,12 +45048,12 @@ var tediousIntegration = defineIntegration(_tediousIntegration);
44766
45048
 
44767
45049
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/genericPool.js
44768
45050
  var import_instrumentation_generic_pool = __toESM(require_src31(), 1);
44769
- var INTEGRATION_NAME38 = "GenericPool";
44770
- var instrumentGenericPool = generateInstrumentOnce(INTEGRATION_NAME38, () => new import_instrumentation_generic_pool.GenericPoolInstrumentation({}));
45051
+ var INTEGRATION_NAME40 = "GenericPool";
45052
+ var instrumentGenericPool = generateInstrumentOnce(INTEGRATION_NAME40, () => new import_instrumentation_generic_pool.GenericPoolInstrumentation({}));
44771
45053
  var _genericPoolIntegration = () => {
44772
45054
  let instrumentationWrappedCallback;
44773
45055
  return {
44774
- name: INTEGRATION_NAME38,
45056
+ name: INTEGRATION_NAME40,
44775
45057
  setupOnce() {
44776
45058
  const instrumentation = instrumentGenericPool();
44777
45059
  instrumentationWrappedCallback = instrumentWhenWrapped(instrumentation);
@@ -44792,7 +45074,7 @@ var genericPoolIntegration = defineIntegration(_genericPoolIntegration);
44792
45074
 
44793
45075
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/amqplib.js
44794
45076
  var import_instrumentation_amqplib = __toESM(require_src32(), 1);
44795
- var INTEGRATION_NAME39 = "Amqplib";
45077
+ var INTEGRATION_NAME41 = "Amqplib";
44796
45078
  var config = {
44797
45079
  consumeEndHook: (span) => {
44798
45080
  addOriginToSpan2(span, "auto.amqplib.otel.consumer");
@@ -44801,10 +45083,10 @@ var config = {
44801
45083
  addOriginToSpan2(span, "auto.amqplib.otel.publisher");
44802
45084
  }
44803
45085
  };
44804
- var instrumentAmqplib = generateInstrumentOnce(INTEGRATION_NAME39, () => new import_instrumentation_amqplib.AmqplibInstrumentation(config));
45086
+ var instrumentAmqplib = generateInstrumentOnce(INTEGRATION_NAME41, () => new import_instrumentation_amqplib.AmqplibInstrumentation(config));
44805
45087
  var _amqplibIntegration = () => {
44806
45088
  return {
44807
- name: INTEGRATION_NAME39,
45089
+ name: INTEGRATION_NAME41,
44808
45090
  setupOnce() {
44809
45091
  instrumentAmqplib();
44810
45092
  }
@@ -44813,7 +45095,7 @@ var _amqplibIntegration = () => {
44813
45095
  var amqplibIntegration = defineIntegration(_amqplibIntegration);
44814
45096
 
44815
45097
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/constants.js
44816
- var INTEGRATION_NAME40 = "VercelAI";
45098
+ var INTEGRATION_NAME42 = "VercelAI";
44817
45099
 
44818
45100
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/instrumentation.js
44819
45101
  var import_instrumentation13 = __toESM(require_src6(), 1);
@@ -44916,7 +45198,7 @@ class SentryVercelAiInstrumentation extends import_instrumentation13.Instrumenta
44916
45198
  const existingExperimentalTelemetry = args[0].experimental_telemetry || {};
44917
45199
  const isEnabled3 = existingExperimentalTelemetry.isEnabled;
44918
45200
  const client = getClient();
44919
- const integration = client?.getIntegrationByName(INTEGRATION_NAME40);
45201
+ const integration = client?.getIntegrationByName(INTEGRATION_NAME42);
44920
45202
  const integrationOptions = integration?.options;
44921
45203
  const shouldRecordInputsAndOutputs = integration ? Boolean(client?.getOptions().sendDefaultPii) : false;
44922
45204
  const { recordInputs, recordOutputs } = determineRecordingSettings(integrationOptions, existingExperimentalTelemetry, isEnabled3, shouldRecordInputsAndOutputs);
@@ -44952,7 +45234,7 @@ class SentryVercelAiInstrumentation extends import_instrumentation13.Instrumenta
44952
45234
  }
44953
45235
 
44954
45236
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/vercelai/index.js
44955
- var instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME40, () => new SentryVercelAiInstrumentation({}));
45237
+ var instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME42, () => new SentryVercelAiInstrumentation({}));
44956
45238
  function shouldForceIntegration(client) {
44957
45239
  const modules = client.getIntegrationByName("Modules");
44958
45240
  return !!modules?.getModules?.()?.ai;
@@ -44960,7 +45242,7 @@ function shouldForceIntegration(client) {
44960
45242
  var _vercelAIIntegration = (options = {}) => {
44961
45243
  let instrumentation;
44962
45244
  return {
44963
- name: INTEGRATION_NAME40,
45245
+ name: INTEGRATION_NAME42,
44964
45246
  options,
44965
45247
  setupOnce() {
44966
45248
  instrumentation = instrumentVercelAi();
@@ -45194,7 +45476,7 @@ var googleGenAIIntegration = defineIntegration(_googleGenAIIntegration);
45194
45476
  var import_instrumentation22 = __toESM(require_src6(), 1);
45195
45477
 
45196
45478
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/firebase/otel/patches/firestore.js
45197
- var import_api19 = __toESM(require_src(), 1);
45479
+ var import_api20 = __toESM(require_src(), 1);
45198
45480
  var import_instrumentation21 = __toESM(require_src6(), 1);
45199
45481
  var import_semantic_conventions8 = __toESM(require_src2(), 1);
45200
45482
  import * as net2 from "node:net";
@@ -45208,7 +45490,7 @@ function patchFirestore(tracer, firestoreSupportedVersions, wrap, unwrap, config
45208
45490
  if (!error2) {
45209
45491
  return;
45210
45492
  }
45211
- import_api19.diag.error(error2?.message);
45493
+ import_api20.diag.error(error2?.message);
45212
45494
  }, true);
45213
45495
  };
45214
45496
  }
@@ -45285,7 +45567,7 @@ function patchSetDoc(tracer, firestoreSpanCreationHook) {
45285
45567
  };
45286
45568
  }
45287
45569
  function executeContextWithSpan(span, callback) {
45288
- return import_api19.context.with(import_api19.trace.setSpan(import_api19.context.active(), span), () => {
45570
+ return import_api20.context.with(import_api20.trace.setSpan(import_api20.context.active(), span), () => {
45289
45571
  return import_instrumentation21.safeExecuteInTheMiddle(() => {
45290
45572
  return callback();
45291
45573
  }, (err) => {
@@ -45297,7 +45579,7 @@ function executeContextWithSpan(span, callback) {
45297
45579
  });
45298
45580
  }
45299
45581
  function startDBSpan(tracer, spanName, reference) {
45300
- const span = tracer.startSpan(`${spanName} ${reference.path}`, { kind: import_api19.SpanKind.CLIENT });
45582
+ const span = tracer.startSpan(`${spanName} ${reference.path}`, { kind: import_api20.SpanKind.CLIENT });
45301
45583
  addAttributes(span, reference);
45302
45584
  span.setAttribute(import_semantic_conventions8.ATTR_DB_OPERATION_NAME, spanName);
45303
45585
  return span;
@@ -45379,17 +45661,17 @@ class FirebaseInstrumentation extends import_instrumentation22.InstrumentationBa
45379
45661
  }
45380
45662
 
45381
45663
  // ../../node_modules/@sentry/node/build/esm/integrations/tracing/firebase/firebase.js
45382
- var INTEGRATION_NAME41 = "Firebase";
45664
+ var INTEGRATION_NAME43 = "Firebase";
45383
45665
  var config2 = {
45384
45666
  firestoreSpanCreationHook: (span) => {
45385
45667
  addOriginToSpan2(span, "auto.firebase.otel.firestore");
45386
45668
  span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, "db.query");
45387
45669
  }
45388
45670
  };
45389
- var instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME41, () => new FirebaseInstrumentation(config2));
45671
+ var instrumentFirebase = generateInstrumentOnce(INTEGRATION_NAME43, () => new FirebaseInstrumentation(config2));
45390
45672
  var _firebaseIntegration = () => {
45391
45673
  return {
45392
- name: INTEGRATION_NAME41,
45674
+ name: INTEGRATION_NAME43,
45393
45675
  setupOnce() {
45394
45676
  instrumentFirebase();
45395
45677
  }
@@ -45429,7 +45711,7 @@ function getAutoPerformanceIntegrations() {
45429
45711
  }
45430
45712
 
45431
45713
  // ../../node_modules/@sentry/node/build/esm/sdk/initOtel.js
45432
- var import_api20 = __toESM(require_src(), 1);
45714
+ var import_api21 = __toESM(require_src(), 1);
45433
45715
  var import_resources = __toESM(require_src8(), 1);
45434
45716
  var import_sdk_trace_base2 = __toESM(require_src9(), 1);
45435
45717
  var import_semantic_conventions9 = __toESM(require_src2(), 1);
@@ -45457,9 +45739,9 @@ function setupOtel(client, options = {}) {
45457
45739
  ...options.spanProcessors || []
45458
45740
  ]
45459
45741
  });
45460
- import_api20.trace.setGlobalTracerProvider(provider);
45461
- import_api20.propagation.setGlobalPropagator(new SentryPropagator);
45462
- import_api20.context.setGlobalContextManager(new SentryContextManager);
45742
+ import_api21.trace.setGlobalTracerProvider(provider);
45743
+ import_api21.propagation.setGlobalPropagator(new SentryPropagator);
45744
+ import_api21.context.setGlobalContextManager(new SentryContextManager);
45463
45745
  return provider;
45464
45746
  }
45465
45747
  function _clampSpanProcessorTimeout(maxSpanWaitDuration) {
@@ -45506,277 +45788,9 @@ function _init2(options = {}, getDefaultIntegrationsImpl) {
45506
45788
  }
45507
45789
  // src/index.ts
45508
45790
  import sqlPlugin, { createDatabaseAdapter, DatabaseMigrationService } from "@elizaos/plugin-sql";
45509
-
45510
- // src/managers/PluginLoader.ts
45511
- import { logger as logger31 } from "@elizaos/core";
45512
-
45513
- // src/managers/PluginInstaller.ts
45514
- import { logger as logger30 } from "@elizaos/core";
45515
-
45516
- class PluginInstaller {
45517
- attempted = new Set;
45518
- async tryInstall(pluginName) {
45519
- try {
45520
- if (!this.isAllowed()) {
45521
- logger30.debug(`Auto-install disabled or not allowed in this environment. Skipping install for ${pluginName}.`);
45522
- return false;
45523
- }
45524
- if (this.attempted.has(pluginName)) {
45525
- logger30.debug(`Auto-install already attempted for ${pluginName}. Skipping.`);
45526
- return false;
45527
- }
45528
- this.attempted.add(pluginName);
45529
- try {
45530
- const check = Bun.spawn(["bun", "--version"], { stdout: "pipe", stderr: "pipe" });
45531
- const code = await check.exited;
45532
- if (code !== 0) {
45533
- logger30.warn(`Bun not available on PATH. Cannot auto-install ${pluginName}. Please run: bun add ${pluginName}`);
45534
- return false;
45535
- }
45536
- } catch {
45537
- logger30.warn(`Bun not available on PATH. Cannot auto-install ${pluginName}. Please run: bun add ${pluginName}`);
45538
- return false;
45539
- }
45540
- logger30.info(`Attempting to auto-install missing plugin: ${pluginName}`);
45541
- const install = Bun.spawn(["bun", "add", pluginName], {
45542
- cwd: process.cwd(),
45543
- env: process.env,
45544
- stdout: "inherit",
45545
- stderr: "inherit"
45546
- });
45547
- const exit = await install.exited;
45548
- if (exit === 0) {
45549
- logger30.info(`Successfully installed ${pluginName}. Retrying import...`);
45550
- return true;
45551
- }
45552
- logger30.error(`bun add ${pluginName} failed with exit code ${exit}. Please install manually.`);
45553
- return false;
45554
- } catch (e) {
45555
- const message = e instanceof Error ? e.message : String(e);
45556
- logger30.error(`Unexpected error during auto-install of ${pluginName}: ${message}`);
45557
- return false;
45558
- }
45559
- }
45560
- isAllowed() {
45561
- if (process.env.ELIZA_NO_AUTO_INSTALL === "true")
45562
- return false;
45563
- if (process.env.ELIZA_NO_PLUGIN_AUTO_INSTALL === "true")
45564
- return false;
45565
- if (process.env.CI === "true")
45566
- return false;
45567
- if (process.env.ELIZA_TEST_MODE === "true")
45568
- return false;
45569
- if (false)
45570
- ;
45571
- return true;
45572
- }
45573
- }
45574
- var pluginInstaller = new PluginInstaller;
45575
-
45576
- // src/managers/PluginLoader.ts
45577
- class PluginLoader {
45578
- isValidPluginShape(obj) {
45579
- if (!obj || typeof obj !== "object" || !obj.name) {
45580
- return false;
45581
- }
45582
- return !!(obj.init || obj.services || obj.providers || obj.actions || obj.evaluators || obj.description);
45583
- }
45584
- validatePlugin(plugin) {
45585
- const errors = [];
45586
- if (!plugin) {
45587
- errors.push("Plugin is null or undefined");
45588
- return { isValid: false, errors };
45589
- }
45590
- if (!plugin.name) {
45591
- errors.push("Plugin must have a name");
45592
- }
45593
- if (plugin.actions) {
45594
- if (!Array.isArray(plugin.actions)) {
45595
- errors.push("Plugin actions must be an array");
45596
- } else {
45597
- const invalidActions = plugin.actions.filter((a) => typeof a !== "object" || !a);
45598
- if (invalidActions.length > 0) {
45599
- errors.push("Plugin actions must be an array of action objects");
45600
- }
45601
- }
45602
- }
45603
- if (plugin.services) {
45604
- if (!Array.isArray(plugin.services)) {
45605
- errors.push("Plugin services must be an array");
45606
- } else {
45607
- const invalidServices = plugin.services.filter((s) => typeof s !== "function" && (typeof s !== "object" || !s));
45608
- if (invalidServices.length > 0) {
45609
- errors.push("Plugin services must be an array of service classes or objects");
45610
- }
45611
- }
45612
- }
45613
- if (plugin.providers && !Array.isArray(plugin.providers)) {
45614
- errors.push("Plugin providers must be an array");
45615
- }
45616
- if (plugin.evaluators && !Array.isArray(plugin.evaluators)) {
45617
- errors.push("Plugin evaluators must be an array");
45618
- }
45619
- return {
45620
- isValid: errors.length === 0,
45621
- errors
45622
- };
45623
- }
45624
- async loadAndPreparePlugin(pluginName) {
45625
- try {
45626
- let pluginModule;
45627
- try {
45628
- pluginModule = await import(pluginName);
45629
- } catch (error2) {
45630
- logger31.warn(`Failed to load plugin ${pluginName}: ${error2}`);
45631
- const attempted = await pluginInstaller.tryInstall(pluginName);
45632
- if (!attempted) {
45633
- return null;
45634
- }
45635
- try {
45636
- pluginModule = await import(pluginName);
45637
- } catch (secondError) {
45638
- logger31.error(`Auto-install attempted for ${pluginName} but import still failed: ${secondError}`);
45639
- return null;
45640
- }
45641
- }
45642
- if (!pluginModule) {
45643
- logger31.error(`Failed to load module for plugin ${pluginName}.`);
45644
- return null;
45645
- }
45646
- const expectedFunctionName = `${pluginName.replace(/^@elizaos\/plugin-/, "").replace(/^@elizaos\//, "").replace(/-./g, (match3) => match3[1].toUpperCase())}Plugin`;
45647
- const exportsToCheck = [
45648
- pluginModule[expectedFunctionName],
45649
- pluginModule.default,
45650
- ...Object.values(pluginModule)
45651
- ];
45652
- for (const potentialPlugin of exportsToCheck) {
45653
- if (this.isValidPluginShape(potentialPlugin)) {
45654
- return potentialPlugin;
45655
- }
45656
- if (typeof potentialPlugin === "function" && potentialPlugin.length === 0) {
45657
- try {
45658
- const produced = potentialPlugin();
45659
- if (this.isValidPluginShape(produced)) {
45660
- return produced;
45661
- }
45662
- } catch (err) {
45663
- logger31.debug(`Factory export threw for ${pluginName}: ${err}`);
45664
- }
45665
- }
45666
- }
45667
- logger31.warn(`Could not find a valid plugin export in ${pluginName}.`);
45668
- return null;
45669
- } catch (error2) {
45670
- logger31.error(`Error loading plugin ${pluginName}: ${error2}`);
45671
- return null;
45672
- }
45673
- }
45674
- resolvePluginDependencies(availablePlugins, isTestMode = false) {
45675
- const resolutionOrder = [];
45676
- const visited = new Set;
45677
- const visiting = new Set;
45678
- function visit2(pluginName) {
45679
- if (!availablePlugins.has(pluginName)) {
45680
- logger31.warn(`Plugin dependency "${pluginName}" not found and will be skipped.`);
45681
- return;
45682
- }
45683
- if (visited.has(pluginName))
45684
- return;
45685
- if (visiting.has(pluginName)) {
45686
- logger31.error(`Circular dependency detected involving plugin: ${pluginName}`);
45687
- return;
45688
- }
45689
- visiting.add(pluginName);
45690
- const plugin = availablePlugins.get(pluginName);
45691
- if (plugin) {
45692
- const deps = [...plugin.dependencies || []];
45693
- if (isTestMode) {
45694
- deps.push(...plugin.testDependencies || []);
45695
- }
45696
- for (const dep of deps) {
45697
- visit2(dep);
45698
- }
45699
- }
45700
- visiting.delete(pluginName);
45701
- visited.add(pluginName);
45702
- resolutionOrder.push(pluginName);
45703
- }
45704
- for (const name of availablePlugins.keys()) {
45705
- if (!visited.has(name)) {
45706
- visit2(name);
45707
- }
45708
- }
45709
- const finalPlugins = resolutionOrder.map((name) => availablePlugins.get(name)).filter((p) => p);
45710
- logger31.info({ plugins: finalPlugins.map((p) => p.name) }, `Final plugins being loaded:`);
45711
- return finalPlugins;
45712
- }
45713
- }
45714
-
45715
- // src/managers/ConfigManager.ts
45716
- var import_dotenv2 = __toESM(require_main(), 1);
45717
- import * as fs6 from "node:fs";
45718
- import * as path8 from "node:path";
45719
-
45720
- class ConfigManager {
45721
- async loadEnvConfig() {
45722
- const envPath = this.findEnvFile();
45723
- if (envPath) {
45724
- import_dotenv2.default.config({ path: envPath });
45725
- }
45726
- return process.env;
45727
- }
45728
- findEnvFile() {
45729
- const possiblePaths = [
45730
- path8.join(process.cwd(), ".env"),
45731
- path8.join(process.cwd(), ".env.local")
45732
- ];
45733
- for (const envPath of possiblePaths) {
45734
- if (fs6.existsSync(envPath)) {
45735
- return envPath;
45736
- }
45737
- }
45738
- return null;
45739
- }
45740
- hasCharacterSecrets(character) {
45741
- return Boolean(character?.settings?.secrets && Object.keys(character.settings.secrets).length > 0);
45742
- }
45743
- ensureCharacterSettings(character) {
45744
- if (!character.settings) {
45745
- character.settings = {};
45746
- }
45747
- }
45748
- async loadLocalEnvSecrets() {
45749
- const envPath = this.findEnvFile();
45750
- if (!envPath)
45751
- return null;
45752
- try {
45753
- const buf = fs6.readFileSync(envPath);
45754
- return import_dotenv2.default.parse(buf);
45755
- } catch {
45756
- return null;
45757
- }
45758
- }
45759
- async setDefaultSecretsFromEnv(character) {
45760
- this.ensureCharacterSettings(character);
45761
- if (this.hasCharacterSecrets(character)) {
45762
- return false;
45763
- }
45764
- const envSecrets = await this.loadLocalEnvSecrets();
45765
- if (!envSecrets) {
45766
- return false;
45767
- }
45768
- if (!character.settings) {
45769
- character.settings = {};
45770
- }
45771
- character.settings.secrets = envSecrets;
45772
- return true;
45773
- }
45774
- }
45775
-
45776
- // src/index.ts
45777
45791
  import { encryptedCharacter, stringToUuid as stringToUuid2 } from "@elizaos/core";
45778
- import { existsSync as existsSync5 } from "node:fs";
45779
- var import_dotenv3 = __toESM(require_main(), 1);
45792
+ import { existsSync as existsSync4 } from "node:fs";
45793
+ var import_dotenv2 = __toESM(require_main(), 1);
45780
45794
  import { ElizaOS as ElizaOS3 } from "@elizaos/core";
45781
45795
  function expandTildePath(filepath) {
45782
45796
  if (!filepath) {
@@ -45786,19 +45800,19 @@ function expandTildePath(filepath) {
45786
45800
  if (filepath === "~") {
45787
45801
  return process.cwd();
45788
45802
  } else if (filepath.startsWith("~/")) {
45789
- return path9.join(process.cwd(), filepath.slice(2));
45803
+ return path8.join(process.cwd(), filepath.slice(2));
45790
45804
  } else if (filepath.startsWith("~~")) {
45791
45805
  return filepath;
45792
45806
  } else {
45793
- return path9.join(process.cwd(), filepath.slice(1));
45807
+ return path8.join(process.cwd(), filepath.slice(1));
45794
45808
  }
45795
45809
  }
45796
45810
  return filepath;
45797
45811
  }
45798
45812
  function resolvePgliteDir(dir, fallbackDir) {
45799
45813
  const envPath = resolveEnvFile();
45800
- if (existsSync5(envPath)) {
45801
- import_dotenv3.default.config({ path: envPath });
45814
+ if (existsSync4(envPath)) {
45815
+ import_dotenv2.default.config({ path: envPath });
45802
45816
  }
45803
45817
  if (dir) {
45804
45818
  const resolved2 = expandTildePath(dir);
@@ -45833,65 +45847,26 @@ class AgentServer {
45833
45847
  isWebUIEnabled = true;
45834
45848
  clientPath;
45835
45849
  elizaOS;
45836
- pluginLoader;
45837
- configManager;
45838
45850
  database;
45839
45851
  loadCharacterTryPath;
45840
45852
  jsonToCharacter;
45841
45853
  async startAgents(characters, plugins = []) {
45842
- if (!this.elizaOS || !this.pluginLoader || !this.configManager) {
45854
+ if (!this.elizaOS) {
45843
45855
  throw new Error("Server not properly initialized");
45844
45856
  }
45845
- const preparations = await Promise.all(characters.map(async (character) => {
45857
+ const agentConfigs = characters.map((character) => {
45846
45858
  character.id ??= stringToUuid2(character.name);
45847
- if (!this.configManager?.hasCharacterSecrets(character)) {
45848
- await this.configManager?.setDefaultSecretsFromEnv(character);
45849
- }
45850
- const loadedPlugins = new Map;
45851
- const pluginsToLoad = new Set(character.plugins || []);
45852
- for (const p of plugins) {
45853
- if (typeof p === "string") {
45854
- pluginsToLoad.add(p);
45855
- } else if (this.pluginLoader?.isValidPluginShape(p) && !loadedPlugins.has(p.name)) {
45856
- loadedPlugins.set(p.name, p);
45857
- (p.dependencies || []).forEach((dep) => {
45858
- pluginsToLoad.add(dep);
45859
- });
45860
- }
45861
- }
45862
- const allAvailablePlugins = new Map;
45863
- for (const p of loadedPlugins.values()) {
45864
- allAvailablePlugins.set(p.name, p);
45865
- }
45866
- for (const name of pluginsToLoad) {
45867
- if (!allAvailablePlugins.has(name)) {
45868
- const loaded = await this.pluginLoader?.loadAndPreparePlugin(name);
45869
- if (loaded) {
45870
- allAvailablePlugins.set(loaded.name, loaded);
45871
- }
45872
- }
45873
- }
45874
- let haveSql = false;
45875
- for (const [name] of allAvailablePlugins.entries()) {
45876
- if (name === sqlPlugin.name || name === "mysql") {
45877
- haveSql = true;
45878
- break;
45879
- }
45880
- }
45881
- if (!haveSql) {
45882
- allAvailablePlugins.set(sqlPlugin.name, sqlPlugin);
45883
- }
45884
- allAvailablePlugins.set(messageBusConnectorPlugin.name, messageBusConnectorPlugin);
45885
- const finalPlugins = this.pluginLoader?.resolvePluginDependencies(allAvailablePlugins, false);
45886
- const preparedCharacter = encryptedCharacter(character);
45887
- return { character: preparedCharacter, plugins: finalPlugins };
45888
- }));
45889
- const settings = await this.configManager?.loadEnvConfig();
45890
- const agentIds = await this.elizaOS.addAgents(preparations.map((p) => ({
45891
- character: p.character,
45892
- plugins: p.plugins,
45893
- settings: settings || {}
45894
- })));
45859
+ const allPlugins = [
45860
+ ...character.plugins || [],
45861
+ ...plugins,
45862
+ sqlPlugin
45863
+ ];
45864
+ return {
45865
+ character: encryptedCharacter(character),
45866
+ plugins: allPlugins
45867
+ };
45868
+ });
45869
+ const agentIds = await this.elizaOS.addAgents(agentConfigs);
45895
45870
  await this.elizaOS.startAgents(agentIds);
45896
45871
  const runtimes = [];
45897
45872
  for (const id of agentIds) {
@@ -45906,10 +45881,10 @@ class AgentServer {
45906
45881
  ...runtime.character,
45907
45882
  id: runtime.agentId
45908
45883
  });
45909
- logger32.info(`Persisted agent ${runtime.character.name} (${runtime.agentId}) to database`);
45884
+ logger30.info(`Persisted agent ${runtime.character.name} (${runtime.agentId}) to database`);
45910
45885
  }
45911
45886
  } catch (error2) {
45912
- logger32.error({ error: error2 }, `Failed to persist agent ${runtime.agentId} to database`);
45887
+ logger30.error({ error: error2 }, `Failed to persist agent ${runtime.agentId} to database`);
45913
45888
  }
45914
45889
  }
45915
45890
  runtimes.push(runtime);
@@ -45937,28 +45912,28 @@ class AgentServer {
45937
45912
  }
45938
45913
  constructor() {
45939
45914
  try {
45940
- logger32.debug("Initializing AgentServer (constructor)...");
45915
+ logger30.debug("Initializing AgentServer (constructor)...");
45941
45916
  this.loadCharacterTryPath = loadCharacterTryPath;
45942
45917
  this.jsonToCharacter = jsonToCharacter;
45943
45918
  this.registerSignalHandlers();
45944
45919
  } catch (error2) {
45945
- logger32.error({ error: error2 }, "Failed to initialize AgentServer (constructor):");
45920
+ logger30.error({ error: error2 }, "Failed to initialize AgentServer (constructor):");
45946
45921
  throw error2;
45947
45922
  }
45948
45923
  }
45949
45924
  async initialize(options) {
45950
45925
  if (this.isInitialized) {
45951
- logger32.warn("AgentServer is already initialized, skipping initialization");
45926
+ logger30.warn("AgentServer is already initialized, skipping initialization");
45952
45927
  return;
45953
45928
  }
45954
45929
  try {
45955
- logger32.debug("Initializing AgentServer (async operations)...");
45930
+ logger30.debug("Initializing AgentServer (async operations)...");
45956
45931
  const agentDataDir = resolvePgliteDir(options?.dataDir);
45957
- logger32.info(`[INIT] Database Dir for SQL plugin: ${agentDataDir}`);
45958
- const dbDir = path9.dirname(agentDataDir);
45959
- if (!fs7.existsSync(dbDir)) {
45960
- fs7.mkdirSync(dbDir, { recursive: true });
45961
- logger32.info(`[INIT] Created database directory: ${dbDir}`);
45932
+ logger30.info(`[INIT] Database Dir for SQL plugin: ${agentDataDir}`);
45933
+ const dbDir = path8.dirname(agentDataDir);
45934
+ if (!fs6.existsSync(dbDir)) {
45935
+ fs6.mkdirSync(dbDir, { recursive: true });
45936
+ logger30.info(`[INIT] Created database directory: ${dbDir}`);
45962
45937
  }
45963
45938
  const tempServerAgentId = "00000000-0000-0000-0000-000000000000";
45964
45939
  this.database = createDatabaseAdapter({
@@ -45966,90 +45941,88 @@ class AgentServer {
45966
45941
  postgresUrl: options?.postgresUrl
45967
45942
  }, tempServerAgentId);
45968
45943
  await this.database.init();
45969
- logger32.success("Database initialized for server operations");
45970
- logger32.info("[INIT] Running database migrations for messaging tables...");
45944
+ logger30.success("Database initialized for server operations");
45945
+ logger30.info("[INIT] Running database migrations for messaging tables...");
45971
45946
  try {
45972
45947
  const migrationService = new DatabaseMigrationService;
45973
45948
  const db = this.database.getDatabase();
45974
45949
  await migrationService.initializeWithDatabase(db);
45975
45950
  migrationService.discoverAndRegisterPluginSchemas([sqlPlugin]);
45976
45951
  await migrationService.runAllPluginMigrations();
45977
- logger32.success("[INIT] Database migrations completed successfully");
45952
+ logger30.success("[INIT] Database migrations completed successfully");
45978
45953
  } catch (migrationError) {
45979
- logger32.error({ error: migrationError }, "[INIT] Failed to run database migrations:");
45954
+ logger30.error({ error: migrationError }, "[INIT] Failed to run database migrations:");
45980
45955
  throw new Error(`Database migration failed: ${migrationError instanceof Error ? migrationError.message : String(migrationError)}`);
45981
45956
  }
45982
45957
  await new Promise((resolve2) => setTimeout(resolve2, 500));
45983
- logger32.info("[INIT] Ensuring default server exists...");
45958
+ logger30.info("[INIT] Ensuring default server exists...");
45984
45959
  await this.ensureDefaultServer();
45985
- logger32.success("[INIT] Default server setup complete");
45986
- logger32.info("[INIT] Server uses temporary adapter for migrations only");
45987
- logger32.info("[INIT] Initializing ElizaOS...");
45988
- logger32.debug("[INIT] ElizaOS will use agent-specific database adapters from SQL plugin");
45960
+ logger30.success("[INIT] Default server setup complete");
45961
+ logger30.info("[INIT] Server uses temporary adapter for migrations only");
45962
+ logger30.info("[INIT] Initializing ElizaOS...");
45963
+ logger30.debug("[INIT] ElizaOS will use agent-specific database adapters from SQL plugin");
45989
45964
  this.elizaOS = new ElizaOS2;
45990
45965
  this.elizaOS.enableEditableMode();
45991
- this.pluginLoader = new PluginLoader;
45992
- this.configManager = new ConfigManager;
45993
- logger32.success("[INIT] ElizaOS initialized");
45966
+ logger30.success("[INIT] ElizaOS initialized");
45994
45967
  await this.initializeServer(options);
45995
45968
  await new Promise((resolve2) => setTimeout(resolve2, 250));
45996
45969
  this.isInitialized = true;
45997
45970
  } catch (error2) {
45998
- logger32.error({ error: error2 }, "Failed to initialize AgentServer (async operations):");
45971
+ logger30.error({ error: error2 }, "Failed to initialize AgentServer (async operations):");
45999
45972
  console.trace(error2);
46000
45973
  throw error2;
46001
45974
  }
46002
45975
  }
46003
45976
  async ensureDefaultServer() {
46004
45977
  try {
46005
- logger32.info("[AgentServer] Checking for default server...");
45978
+ logger30.info("[AgentServer] Checking for default server...");
46006
45979
  const servers = await this.database.getMessageServers();
46007
- logger32.debug(`[AgentServer] Found ${servers.length} existing servers`);
45980
+ logger30.debug(`[AgentServer] Found ${servers.length} existing servers`);
46008
45981
  servers.forEach((s) => {
46009
- logger32.debug(`[AgentServer] Existing server: ID=${s.id}, Name=${s.name}`);
45982
+ logger30.debug(`[AgentServer] Existing server: ID=${s.id}, Name=${s.name}`);
46010
45983
  });
46011
45984
  const defaultServer = servers.find((s) => s.id === "00000000-0000-0000-0000-000000000000");
46012
45985
  if (!defaultServer) {
46013
- logger32.info("[AgentServer] Creating default server with UUID 00000000-0000-0000-0000-000000000000...");
45986
+ logger30.info("[AgentServer] Creating default server with UUID 00000000-0000-0000-0000-000000000000...");
46014
45987
  try {
46015
45988
  await this.database.db.execute(`
46016
45989
  INSERT INTO message_servers (id, name, source_type, created_at, updated_at)
46017
45990
  VALUES ('00000000-0000-0000-0000-000000000000', 'Default Server', 'eliza_default', NOW(), NOW())
46018
45991
  ON CONFLICT (id) DO NOTHING
46019
45992
  `);
46020
- logger32.success("[AgentServer] Default server created via raw SQL");
45993
+ logger30.success("[AgentServer] Default server created via raw SQL");
46021
45994
  const checkResult = await this.database.db.execute("SELECT id, name FROM message_servers WHERE id = '00000000-0000-0000-0000-000000000000'");
46022
- logger32.debug("[AgentServer] Raw SQL check result:", checkResult);
45995
+ logger30.debug("[AgentServer] Raw SQL check result:", checkResult);
46023
45996
  } catch (sqlError) {
46024
- logger32.error("[AgentServer] Raw SQL insert failed:", sqlError);
45997
+ logger30.error("[AgentServer] Raw SQL insert failed:", sqlError);
46025
45998
  try {
46026
45999
  const server = await this.database.createMessageServer({
46027
46000
  id: "00000000-0000-0000-0000-000000000000",
46028
46001
  name: "Default Server",
46029
46002
  sourceType: "eliza_default"
46030
46003
  });
46031
- logger32.success("[AgentServer] Default server created via ORM with ID:", server.id);
46004
+ logger30.success("[AgentServer] Default server created via ORM with ID:", server.id);
46032
46005
  } catch (ormError) {
46033
- logger32.error("[AgentServer] Both SQL and ORM creation failed:", ormError);
46006
+ logger30.error("[AgentServer] Both SQL and ORM creation failed:", ormError);
46034
46007
  throw new Error(`Failed to create default server: ${ormError.message}`);
46035
46008
  }
46036
46009
  }
46037
46010
  const verifyServers = await this.database.getMessageServers();
46038
- logger32.debug(`[AgentServer] After creation attempt, found ${verifyServers.length} servers`);
46011
+ logger30.debug(`[AgentServer] After creation attempt, found ${verifyServers.length} servers`);
46039
46012
  verifyServers.forEach((s) => {
46040
- logger32.debug(`[AgentServer] Server after creation: ID=${s.id}, Name=${s.name}`);
46013
+ logger30.debug(`[AgentServer] Server after creation: ID=${s.id}, Name=${s.name}`);
46041
46014
  });
46042
46015
  const verifyDefault = verifyServers.find((s) => s.id === "00000000-0000-0000-0000-000000000000");
46043
46016
  if (!verifyDefault) {
46044
46017
  throw new Error(`Failed to create or verify default server with ID ${DEFAULT_SERVER_ID6}`);
46045
46018
  } else {
46046
- logger32.success("[AgentServer] Default server creation verified successfully");
46019
+ logger30.success("[AgentServer] Default server creation verified successfully");
46047
46020
  }
46048
46021
  } else {
46049
- logger32.info("[AgentServer] Default server already exists with ID:", defaultServer.id);
46022
+ logger30.info("[AgentServer] Default server already exists with ID:", defaultServer.id);
46050
46023
  }
46051
46024
  } catch (error2) {
46052
- logger32.error({ error: error2 }, "[AgentServer] Error ensuring default server:");
46025
+ logger30.error({ error: error2 }, "[AgentServer] Error ensuring default server:");
46053
46026
  throw error2;
46054
46027
  }
46055
46028
  }
@@ -46070,16 +46043,16 @@ class AgentServer {
46070
46043
  integrations: [vercelAIIntegration({ force: sentryEnabled })],
46071
46044
  tracesSampleRate: Number(process.env.SENTRY_TRACES_SAMPLE_RATE || 0)
46072
46045
  });
46073
- logger32.info("[Sentry] Initialized Sentry for @elizaos/server");
46046
+ logger30.info("[Sentry] Initialized Sentry for @elizaos/server");
46074
46047
  } catch (sentryInitError) {
46075
- logger32.error({ error: sentryInitError }, "[Sentry] Failed to initialize Sentry");
46048
+ logger30.error({ error: sentryInitError }, "[Sentry] Failed to initialize Sentry");
46076
46049
  }
46077
46050
  }
46078
46051
  const isProd = false;
46079
- logger32.debug("Setting up security headers...");
46052
+ logger30.debug("Setting up security headers...");
46080
46053
  if (!isProd) {
46081
- logger32.debug(`NODE_ENV: ${"development"}`);
46082
- logger32.debug(`CSP will be: ${isProd ? "ENABLED" : "MINIMAL_DEV"}`);
46054
+ logger30.debug(`NODE_ENV: ${"development"}`);
46055
+ logger30.debug(`CSP will be: ${isProd ? "ENABLED" : "MINIMAL_DEV"}`);
46083
46056
  }
46084
46057
  this.app.use(helmet({
46085
46058
  contentSecurityPolicy: isProd ? {
@@ -46127,12 +46100,12 @@ class AgentServer {
46127
46100
  xssFilter: true
46128
46101
  }));
46129
46102
  if (options?.middlewares) {
46130
- logger32.debug("Applying custom middlewares...");
46103
+ logger30.debug("Applying custom middlewares...");
46131
46104
  for (const middleware2 of options.middlewares) {
46132
46105
  this.app.use(middleware2);
46133
46106
  }
46134
46107
  }
46135
- logger32.debug("Setting up standard middlewares...");
46108
+ logger30.debug("Setting up standard middlewares...");
46136
46109
  this.app.use(cors2({
46137
46110
  origin: process.env.CORS_ORIGIN || true,
46138
46111
  credentials: true,
@@ -46144,28 +46117,28 @@ class AgentServer {
46144
46117
  }));
46145
46118
  const serverAuthToken = process.env.ELIZA_SERVER_AUTH_TOKEN;
46146
46119
  if (serverAuthToken) {
46147
- logger32.info("Server authentication enabled. Requires X-API-KEY header for /api routes.");
46120
+ logger30.info("Server authentication enabled. Requires X-API-KEY header for /api routes.");
46148
46121
  this.app.use("/api", (req, res, next) => {
46149
46122
  apiKeyAuthMiddleware(req, res, next);
46150
46123
  });
46151
46124
  } else {
46152
- logger32.warn("Server authentication is disabled. Set ELIZA_SERVER_AUTH_TOKEN environment variable to enable.");
46125
+ logger30.warn("Server authentication is disabled. Set ELIZA_SERVER_AUTH_TOKEN environment variable to enable.");
46153
46126
  }
46154
46127
  this.isWebUIEnabled = isWebUIEnabled();
46155
46128
  if (this.isWebUIEnabled) {
46156
- logger32.info("Web UI enabled");
46129
+ logger30.info("Web UI enabled");
46157
46130
  } else {
46158
46131
  const uiEnabledEnv = process.env.ELIZA_UI_ENABLE;
46159
46132
  if (uiEnabledEnv !== undefined && uiEnabledEnv.trim() !== "") {
46160
- logger32.info(`Web UI disabled by environment variable (ELIZA_UI_ENABLE=${uiEnabledEnv})`);
46133
+ logger30.info(`Web UI disabled by environment variable (ELIZA_UI_ENABLE=${uiEnabledEnv})`);
46161
46134
  } else {
46162
- logger32.info("Web UI disabled for security (production mode)");
46135
+ logger30.info("Web UI disabled for security (production mode)");
46163
46136
  }
46164
46137
  }
46165
46138
  const uploadsBasePath = getUploadsAgentsDir4();
46166
46139
  const generatedBasePath = getGeneratedDir2();
46167
- fs7.mkdirSync(uploadsBasePath, { recursive: true });
46168
- fs7.mkdirSync(generatedBasePath, { recursive: true });
46140
+ fs6.mkdirSync(uploadsBasePath, { recursive: true });
46141
+ fs6.mkdirSync(generatedBasePath, { recursive: true });
46169
46142
  this.app.get("/media/uploads/agents/:agentId/:filename", (req, res) => {
46170
46143
  const agentId = req.params.agentId;
46171
46144
  const filename = req.params.filename;
@@ -46175,26 +46148,26 @@ class AgentServer {
46175
46148
  return;
46176
46149
  }
46177
46150
  const sanitizedFilename = basename2(filename);
46178
- const agentUploadsPath = join5(uploadsBasePath, agentId);
46179
- const filePath = join5(agentUploadsPath, sanitizedFilename);
46151
+ const agentUploadsPath = join4(uploadsBasePath, agentId);
46152
+ const filePath = join4(agentUploadsPath, sanitizedFilename);
46180
46153
  if (!filePath.startsWith(agentUploadsPath)) {
46181
46154
  res.status(403).json({ error: "Access denied" });
46182
46155
  return;
46183
46156
  }
46184
- if (!fs7.existsSync(filePath)) {
46157
+ if (!fs6.existsSync(filePath)) {
46185
46158
  res.status(404).json({ error: "File does not exist!!!!!!!" });
46186
46159
  return;
46187
46160
  }
46188
46161
  res.sendFile(sanitizedFilename, { root: agentUploadsPath }, (err) => {
46189
46162
  if (err) {
46190
46163
  if (err.message === "Request aborted") {
46191
- logger32.warn(`[MEDIA] Download aborted: ${req.originalUrl}`);
46164
+ logger30.warn(`[MEDIA] Download aborted: ${req.originalUrl}`);
46192
46165
  } else if (!res.headersSent) {
46193
- logger32.warn(`[MEDIA] File not found: ${agentUploadsPath}/${sanitizedFilename}`);
46166
+ logger30.warn(`[MEDIA] File not found: ${agentUploadsPath}/${sanitizedFilename}`);
46194
46167
  res.status(404).json({ error: "File not found" });
46195
46168
  }
46196
46169
  } else {
46197
- logger32.debug(`[MEDIA] Successfully served: ${sanitizedFilename}`);
46170
+ logger30.debug(`[MEDIA] Successfully served: ${sanitizedFilename}`);
46198
46171
  }
46199
46172
  });
46200
46173
  });
@@ -46207,17 +46180,17 @@ class AgentServer {
46207
46180
  return;
46208
46181
  }
46209
46182
  const sanitizedFilename = basename2(filename);
46210
- const agentGeneratedPath = join5(generatedBasePath, agentId);
46211
- const filePath = join5(agentGeneratedPath, sanitizedFilename);
46183
+ const agentGeneratedPath = join4(generatedBasePath, agentId);
46184
+ const filePath = join4(agentGeneratedPath, sanitizedFilename);
46212
46185
  if (!filePath.startsWith(agentGeneratedPath)) {
46213
46186
  res.status(403).json({ error: "Access denied" });
46214
46187
  return;
46215
46188
  }
46216
- if (!existsSync5(filePath)) {
46189
+ if (!existsSync4(filePath)) {
46217
46190
  res.status(404).json({ error: "File not found" });
46218
46191
  return;
46219
46192
  }
46220
- const absolutePath = path9.resolve(filePath);
46193
+ const absolutePath = path8.resolve(filePath);
46221
46194
  const options2 = {
46222
46195
  dotfiles: "deny"
46223
46196
  };
@@ -46226,7 +46199,7 @@ class AgentServer {
46226
46199
  const ext2 = extname(filename).toLowerCase();
46227
46200
  const mimeType = ext2 === ".png" ? "image/png" : ext2 === ".jpg" || ext2 === ".jpeg" ? "image/jpeg" : "application/octet-stream";
46228
46201
  res.setHeader("Content-Type", mimeType);
46229
- const stream = fs7.createReadStream(absolutePath);
46202
+ const stream = fs6.createReadStream(absolutePath);
46230
46203
  stream.on("error", () => res.status(404).json({ error: "File not found" }));
46231
46204
  stream.pipe(res);
46232
46205
  }
@@ -46241,20 +46214,20 @@ class AgentServer {
46241
46214
  return;
46242
46215
  }
46243
46216
  const sanitizedFilename = basename2(filename);
46244
- const channelUploadsPath = join5(uploadsBasePath, "channels", channelId);
46245
- const filePath = join5(channelUploadsPath, sanitizedFilename);
46217
+ const channelUploadsPath = join4(uploadsBasePath, "channels", channelId);
46218
+ const filePath = join4(channelUploadsPath, sanitizedFilename);
46246
46219
  if (!filePath.startsWith(channelUploadsPath)) {
46247
46220
  res.status(403).json({ error: "Access denied" });
46248
46221
  return;
46249
46222
  }
46250
46223
  res.sendFile(filePath, (err) => {
46251
46224
  if (err) {
46252
- logger32.warn({ err, filePath }, `[STATIC] Channel media file not found: ${filePath}`);
46225
+ logger30.warn({ err, filePath }, `[STATIC] Channel media file not found: ${filePath}`);
46253
46226
  if (!res.headersSent) {
46254
46227
  res.status(404).json({ error: "File not found" });
46255
46228
  }
46256
46229
  } else {
46257
- logger32.debug(`[STATIC] Served channel media file: ${filePath}`);
46230
+ logger30.debug(`[STATIC] Served channel media file: ${filePath}`);
46258
46231
  }
46259
46232
  });
46260
46233
  });
@@ -46298,11 +46271,11 @@ class AgentServer {
46298
46271
  if (this.isWebUIEnabled) {
46299
46272
  const possiblePaths = [
46300
46273
  this.clientPath,
46301
- path9.resolve(__dirname3, "client"),
46302
- path9.resolve(__dirname3, "../../client/dist"),
46274
+ path8.resolve(__dirname3, "client"),
46275
+ path8.resolve(__dirname3, "../../client/dist"),
46303
46276
  (() => {
46304
46277
  try {
46305
- return path9.resolve(path9.dirname(__require.resolve("@elizaos/client/package.json")), "dist");
46278
+ return path8.resolve(path8.dirname(__require.resolve("@elizaos/client/package.json")), "dist");
46306
46279
  } catch {
46307
46280
  return null;
46308
46281
  }
@@ -46310,12 +46283,12 @@ class AgentServer {
46310
46283
  (() => {
46311
46284
  try {
46312
46285
  if (process.argv[1]) {
46313
- const serverPath = path9.dirname(process.argv[1]);
46314
- const possibleClientPath = path9.join(serverPath, "client");
46315
- if (existsSync5(path9.join(possibleClientPath, "index.html"))) {
46286
+ const serverPath = path8.dirname(process.argv[1]);
46287
+ const possibleClientPath = path8.join(serverPath, "client");
46288
+ if (existsSync4(path8.join(possibleClientPath, "index.html"))) {
46316
46289
  return possibleClientPath;
46317
46290
  }
46318
- if (existsSync5(path9.join(serverPath, "index.html"))) {
46291
+ if (existsSync4(path8.join(serverPath, "index.html"))) {
46319
46292
  return serverPath;
46320
46293
  }
46321
46294
  }
@@ -46324,8 +46297,8 @@ class AgentServer {
46324
46297
  })(),
46325
46298
  (() => {
46326
46299
  try {
46327
- const bunGlobalPath = path9.join(os3.homedir(), ".bun/install/global/node_modules/@elizaos/server/dist/client");
46328
- if (existsSync5(path9.join(bunGlobalPath, "index.html"))) {
46300
+ const bunGlobalPath = path8.join(os3.homedir(), ".bun/install/global/node_modules/@elizaos/server/dist/client");
46301
+ if (existsSync4(path8.join(bunGlobalPath, "index.html"))) {
46329
46302
  return bunGlobalPath;
46330
46303
  }
46331
46304
  try {
@@ -46335,8 +46308,8 @@ class AgentServer {
46335
46308
  });
46336
46309
  if (proc.exitCode === 0 && proc.stdout) {
46337
46310
  const npmRoot = new TextDecoder().decode(proc.stdout).trim();
46338
- const globalServerPath = path9.join(npmRoot, "@elizaos/server/dist/client");
46339
- if (existsSync5(path9.join(globalServerPath, "index.html"))) {
46311
+ const globalServerPath = path8.join(npmRoot, "@elizaos/server/dist/client");
46312
+ if (existsSync4(path8.join(globalServerPath, "index.html"))) {
46340
46313
  return globalServerPath;
46341
46314
  }
46342
46315
  }
@@ -46347,15 +46320,15 @@ class AgentServer {
46347
46320
  ...[
46348
46321
  "/usr/local/lib/node_modules/@elizaos/server/dist/client",
46349
46322
  "/usr/lib/node_modules/@elizaos/server/dist/client",
46350
- path9.join(os3.homedir(), ".npm-global/lib/node_modules/@elizaos/server/dist/client"),
46323
+ path8.join(os3.homedir(), ".npm-global/lib/node_modules/@elizaos/server/dist/client"),
46351
46324
  (() => {
46352
46325
  try {
46353
- const nvmPath = path9.join(os3.homedir(), ".nvm/versions/node");
46354
- if (existsSync5(nvmPath)) {
46355
- const versions = fs7.readdirSync(nvmPath);
46326
+ const nvmPath = path8.join(os3.homedir(), ".nvm/versions/node");
46327
+ if (existsSync4(nvmPath)) {
46328
+ const versions = fs6.readdirSync(nvmPath);
46356
46329
  for (const version of versions) {
46357
- const cliPath = path9.join(nvmPath, version, "lib/node_modules/@elizaos/server/dist/client");
46358
- if (existsSync5(path9.join(cliPath, "index.html"))) {
46330
+ const cliPath = path8.join(nvmPath, version, "lib/node_modules/@elizaos/server/dist/client");
46331
+ if (existsSync4(path8.join(cliPath, "index.html"))) {
46359
46332
  return cliPath;
46360
46333
  }
46361
46334
  }
@@ -46365,29 +46338,29 @@ class AgentServer {
46365
46338
  })()
46366
46339
  ].filter(Boolean)
46367
46340
  ].filter(Boolean);
46368
- logger32.debug(`[STATIC] process.argv[0]: ${process.argv[0]}`);
46369
- logger32.debug(`[STATIC] process.argv[1]: ${process.argv[1]}`);
46370
- logger32.debug(`[STATIC] __dirname: ${__dirname3}`);
46341
+ logger30.debug(`[STATIC] process.argv[0]: ${process.argv[0]}`);
46342
+ logger30.debug(`[STATIC] process.argv[1]: ${process.argv[1]}`);
46343
+ logger30.debug(`[STATIC] __dirname: ${__dirname3}`);
46371
46344
  for (const possiblePath of possiblePaths) {
46372
- if (possiblePath && existsSync5(path9.join(possiblePath, "index.html"))) {
46345
+ if (possiblePath && existsSync4(path8.join(possiblePath, "index.html"))) {
46373
46346
  clientPath = possiblePath;
46374
- logger32.info(`[STATIC] Found client files at: ${clientPath}`);
46347
+ logger30.info(`[STATIC] Found client files at: ${clientPath}`);
46375
46348
  break;
46376
46349
  }
46377
46350
  }
46378
46351
  if (clientPath) {
46379
46352
  this.clientPath = clientPath;
46380
46353
  this.app.use(express33.static(clientPath, staticOptions));
46381
- logger32.info(`[STATIC] Serving static files from: ${clientPath}`);
46354
+ logger30.info(`[STATIC] Serving static files from: ${clientPath}`);
46382
46355
  } else {
46383
- logger32.warn("[STATIC] Client dist path not found. Searched locations:");
46356
+ logger30.warn("[STATIC] Client dist path not found. Searched locations:");
46384
46357
  possiblePaths.forEach((p) => {
46385
46358
  if (p)
46386
- logger32.warn(`[STATIC] - ${p}`);
46359
+ logger30.warn(`[STATIC] - ${p}`);
46387
46360
  });
46388
- logger32.warn("[STATIC] The web UI will not be available.");
46389
- logger32.warn("[STATIC] To fix this, ensure the client is built: cd packages/client && bun run build");
46390
- logger32.warn("[STATIC] Then rebuild the server: cd packages/server && bun run build");
46361
+ logger30.warn("[STATIC] The web UI will not be available.");
46362
+ logger30.warn("[STATIC] To fix this, ensure the client is built: cd packages/client && bun run build");
46363
+ logger30.warn("[STATIC] Then rebuild the server: cd packages/server && bun run build");
46391
46364
  }
46392
46365
  }
46393
46366
  const pluginRouteHandler = createPluginRouteHandler(this.elizaOS);
@@ -46395,7 +46368,7 @@ class AgentServer {
46395
46368
  const apiRouter = createApiRouter(this.elizaOS, this);
46396
46369
  this.app.use("/api", (req, _res, next) => {
46397
46370
  if (req.path !== "/ping") {
46398
- logger32.debug(`API request: ${req.method} ${req.path}`);
46371
+ logger30.debug(`API request: ${req.method} ${req.path}`);
46399
46372
  }
46400
46373
  next();
46401
46374
  }, apiRouter, (err, req, res, _next) => {
@@ -46410,7 +46383,7 @@ class AgentServer {
46410
46383
  return scope;
46411
46384
  });
46412
46385
  }
46413
- logger32.error({ err }, `API error: ${req.method} ${req.path}`);
46386
+ logger30.error({ err }, `API error: ${req.method} ${req.path}`);
46414
46387
  res.status(500).json({
46415
46388
  success: false,
46416
46389
  error: {
@@ -46458,29 +46431,29 @@ class AgentServer {
46458
46431
  }
46459
46432
  const resolvedClientPath = clientPath || this.clientPath;
46460
46433
  if (resolvedClientPath) {
46461
- const indexFilePath = path9.join(resolvedClientPath, "index.html");
46462
- if (!existsSync5(indexFilePath)) {
46463
- logger32.error(`[STATIC] index.html not found at expected path: ${indexFilePath}`);
46464
- logger32.error(`[STATIC] Client path was: ${resolvedClientPath}`);
46434
+ const indexFilePath = path8.join(resolvedClientPath, "index.html");
46435
+ if (!existsSync4(indexFilePath)) {
46436
+ logger30.error(`[STATIC] index.html not found at expected path: ${indexFilePath}`);
46437
+ logger30.error(`[STATIC] Client path was: ${resolvedClientPath}`);
46465
46438
  res.status(404).send("Client application not found");
46466
46439
  return;
46467
46440
  }
46468
46441
  res.sendFile("index.html", { root: resolvedClientPath }, (err) => {
46469
46442
  if (err) {
46470
- logger32.warn(`[STATIC] Failed to serve index.html: ${err.message}`);
46471
- logger32.warn(`[STATIC] Attempted root: ${resolvedClientPath}`);
46472
- logger32.warn(`[STATIC] Full path was: ${indexFilePath}`);
46473
- logger32.warn(`[STATIC] Error code: ${err.code || "unknown"}`);
46443
+ logger30.warn(`[STATIC] Failed to serve index.html: ${err.message}`);
46444
+ logger30.warn(`[STATIC] Attempted root: ${resolvedClientPath}`);
46445
+ logger30.warn(`[STATIC] Full path was: ${indexFilePath}`);
46446
+ logger30.warn(`[STATIC] Error code: ${err.code || "unknown"}`);
46474
46447
  if (!res.headersSent) {
46475
46448
  res.status(404).send("Client application not found");
46476
46449
  }
46477
46450
  } else {
46478
- logger32.debug(`[STATIC] Successfully served index.html for route: ${req.path}`);
46451
+ logger30.debug(`[STATIC] Successfully served index.html for route: ${req.path}`);
46479
46452
  }
46480
46453
  });
46481
46454
  } else {
46482
- logger32.warn("[STATIC] Client dist path not found in SPA fallback");
46483
- logger32.warn("[STATIC] Neither local nor instance clientPath variables are set");
46455
+ logger30.warn("[STATIC] Client dist path not found in SPA fallback");
46456
+ logger30.warn("[STATIC] Neither local nor instance clientPath variables are set");
46484
46457
  res.status(404).send("Client application not found");
46485
46458
  }
46486
46459
  });
@@ -46491,9 +46464,9 @@ class AgentServer {
46491
46464
  }
46492
46465
  this.server = http4.createServer(this.app);
46493
46466
  this.socketIO = setupSocketIO(this.server, this.elizaOS, this);
46494
- logger32.success("AgentServer HTTP server and Socket.IO initialized");
46467
+ logger30.success("AgentServer HTTP server and Socket.IO initialized");
46495
46468
  } catch (error2) {
46496
- logger32.error({ error: error2 }, "Failed to complete server initialization:");
46469
+ logger30.error({ error: error2 }, "Failed to complete server initialization:");
46497
46470
  throw error2;
46498
46471
  }
46499
46472
  }
@@ -46508,63 +46481,63 @@ class AgentServer {
46508
46481
  if (!runtime.character) {
46509
46482
  throw new Error("Runtime missing character configuration");
46510
46483
  }
46511
- logger32.debug(`Agent ${runtime.character.name} (${runtime.agentId}) registered`);
46484
+ logger30.debug(`Agent ${runtime.character.name} (${runtime.agentId}) registered`);
46512
46485
  try {
46513
46486
  if (messageBusConnectorPlugin) {
46514
46487
  await runtime.registerPlugin(messageBusConnectorPlugin);
46515
- logger32.info(`[AgentServer] Automatically registered MessageBusConnector for agent ${runtime.character.name}`);
46488
+ logger30.info(`[AgentServer] Registered MessageBusConnector for agent ${runtime.character.name}`);
46516
46489
  } else {
46517
- logger32.error(`[AgentServer] CRITICAL: MessageBusConnector plugin definition not found.`);
46490
+ logger30.error(`[AgentServer] CRITICAL: MessageBusConnector plugin definition not found.`);
46518
46491
  }
46519
46492
  } catch (e) {
46520
- logger32.error({ error: e }, `[AgentServer] CRITICAL: Failed to register MessageBusConnector for agent ${runtime.character.name}`);
46493
+ logger30.error({ error: e }, `[AgentServer] CRITICAL: Failed to register MessageBusConnector for agent ${runtime.character.name}`);
46521
46494
  }
46522
46495
  const teePlugin = runtime.plugins.find((p) => p.name === "phala-tee-plugin");
46523
46496
  if (teePlugin) {
46524
- logger32.debug(`Found TEE plugin for agent ${runtime.agentId}`);
46497
+ logger30.debug(`Found TEE plugin for agent ${runtime.agentId}`);
46525
46498
  if (teePlugin.providers) {
46526
46499
  for (const provider of teePlugin.providers) {
46527
46500
  runtime.registerProvider(provider);
46528
- logger32.debug(`Registered TEE provider: ${provider.name}`);
46501
+ logger30.debug(`Registered TEE provider: ${provider.name}`);
46529
46502
  }
46530
46503
  }
46531
46504
  if (teePlugin.actions) {
46532
46505
  for (const action of teePlugin.actions) {
46533
46506
  runtime.registerAction(action);
46534
- logger32.debug(`Registered TEE action: ${action.name}`);
46507
+ logger30.debug(`Registered TEE action: ${action.name}`);
46535
46508
  }
46536
46509
  }
46537
46510
  }
46538
- logger32.success(`Successfully registered agent ${runtime.character.name} (${runtime.agentId}) with core services.`);
46511
+ logger30.success(`Successfully registered agent ${runtime.character.name} (${runtime.agentId}) with core services.`);
46539
46512
  await this.addAgentToServer(DEFAULT_SERVER_ID6, runtime.agentId);
46540
- logger32.info(`[AgentServer] Auto-associated agent ${runtime.character.name} with server ID: ${DEFAULT_SERVER_ID6}`);
46513
+ logger30.info(`[AgentServer] Auto-associated agent ${runtime.character.name} with server ID: ${DEFAULT_SERVER_ID6}`);
46541
46514
  } catch (error2) {
46542
- logger32.error({ error: error2 }, "Failed to register agent:");
46515
+ logger30.error({ error: error2 }, "Failed to register agent:");
46543
46516
  throw error2;
46544
46517
  }
46545
46518
  }
46546
46519
  async unregisterAgent(agentId) {
46547
46520
  if (!agentId) {
46548
- logger32.warn("[AGENT UNREGISTER] Attempted to unregister undefined or invalid agent runtime");
46521
+ logger30.warn("[AGENT UNREGISTER] Attempted to unregister undefined or invalid agent runtime");
46549
46522
  return;
46550
46523
  }
46551
46524
  try {
46552
46525
  const agent = this.elizaOS?.getAgent(agentId);
46553
46526
  if (agent) {
46554
46527
  try {
46555
- logger32.debug(`[AGENT UNREGISTER] Stopping services for agent ${agentId}`);
46528
+ logger30.debug(`[AGENT UNREGISTER] Stopping services for agent ${agentId}`);
46556
46529
  await agent.stop();
46557
- logger32.debug(`[AGENT UNREGISTER] All services stopped for agent ${agentId}`);
46530
+ logger30.debug(`[AGENT UNREGISTER] All services stopped for agent ${agentId}`);
46558
46531
  } catch (stopError) {
46559
- logger32.error({ error: stopError, agentId }, `[AGENT UNREGISTER] Error stopping agent services for ${agentId}:`);
46532
+ logger30.error({ error: stopError, agentId }, `[AGENT UNREGISTER] Error stopping agent services for ${agentId}:`);
46560
46533
  }
46561
46534
  }
46562
46535
  if (this.elizaOS) {
46563
46536
  await this.elizaOS.deleteAgents([agentId]);
46564
46537
  }
46565
- logger32.debug(`Agent ${agentId} unregistered`);
46538
+ logger30.debug(`Agent ${agentId} unregistered`);
46566
46539
  } catch (error2) {
46567
- logger32.error({ error: error2, agentId }, `Error removing agent ${agentId}:`);
46540
+ logger30.error({ error: error2, agentId }, `Error removing agent ${agentId}:`);
46568
46541
  }
46569
46542
  }
46570
46543
  registerMiddleware(middleware2) {
@@ -46576,9 +46549,9 @@ class AgentServer {
46576
46549
  if (!port || typeof port !== "number") {
46577
46550
  throw new Error(`Invalid port number: ${port}`);
46578
46551
  }
46579
- logger32.debug(`Starting server on port ${port}...`);
46580
- logger32.debug(`Current agents count: ${this.elizaOS?.getAgents().length || 0}`);
46581
- logger32.debug(`Environment: ${"development"}`);
46552
+ logger30.debug(`Starting server on port ${port}...`);
46553
+ logger30.debug(`Current agents count: ${this.elizaOS?.getAgents().length || 0}`);
46554
+ logger30.debug(`Environment: ${"development"}`);
46582
46555
  const host = process.env.SERVER_HOST || "0.0.0.0";
46583
46556
  this.server.listen(port, host, () => {
46584
46557
  if (this.isWebUIEnabled && false) {} else if (!this.isWebUIEnabled) {
@@ -46591,26 +46564,26 @@ class AgentServer {
46591
46564
  ` + ` \x1B[1m${baseUrl}/api/messaging\x1B[22m\x1B[0m`);
46592
46565
  }
46593
46566
  console.log(`AgentServer is listening on port ${port}`);
46594
- logger32.success(`REST API bound to ${host}:${port}. If running locally, access it at http://localhost:${port}.`);
46567
+ logger30.success(`REST API bound to ${host}:${port}. If running locally, access it at http://localhost:${port}.`);
46595
46568
  const agents = this.elizaOS?.getAgents() || [];
46596
- logger32.debug(`Active agents: ${agents.length}`);
46569
+ logger30.debug(`Active agents: ${agents.length}`);
46597
46570
  agents.forEach((agent) => {
46598
- logger32.debug(`- Agent ${agent.agentId}: ${agent.character.name}`);
46571
+ logger30.debug(`- Agent ${agent.agentId}: ${agent.character.name}`);
46599
46572
  });
46600
46573
  resolve2();
46601
46574
  }).on("error", (error2) => {
46602
- logger32.error({ error: error2, host, port }, `Failed to bind server to ${host}:${port}:`);
46575
+ logger30.error({ error: error2, host, port }, `Failed to bind server to ${host}:${port}:`);
46603
46576
  if (error2.code === "EADDRINUSE") {
46604
- logger32.error(`Port ${port} is already in use. Please try a different port or stop the process using that port.`);
46577
+ logger30.error(`Port ${port} is already in use. Please try a different port or stop the process using that port.`);
46605
46578
  } else if (error2.code === "EACCES") {
46606
- logger32.error(`Permission denied to bind to port ${port}. Try using a port above 1024 or running with appropriate permissions.`);
46579
+ logger30.error(`Permission denied to bind to port ${port}. Try using a port above 1024 or running with appropriate permissions.`);
46607
46580
  } else if (error2.code === "EADDRNOTAVAIL") {
46608
- logger32.error(`Cannot bind to ${host}:${port} - address not available. Check if the host address is correct.`);
46581
+ logger30.error(`Cannot bind to ${host}:${port} - address not available. Check if the host address is correct.`);
46609
46582
  }
46610
46583
  reject(error2);
46611
46584
  });
46612
46585
  } catch (error2) {
46613
- logger32.error({ error: error2 }, "Failed to start server:");
46586
+ logger30.error({ error: error2 }, "Failed to start server:");
46614
46587
  reject(error2);
46615
46588
  }
46616
46589
  });
@@ -46618,7 +46591,7 @@ class AgentServer {
46618
46591
  async stop() {
46619
46592
  if (this.server) {
46620
46593
  this.server.close(() => {
46621
- logger32.success("Server stopped");
46594
+ logger30.success("Server stopped");
46622
46595
  });
46623
46596
  }
46624
46597
  }
@@ -46665,7 +46638,7 @@ class AgentServer {
46665
46638
  for (const message of messages) {
46666
46639
  await this.database.deleteMessage(message.id);
46667
46640
  }
46668
- logger32.info(`[AgentServer] Cleared all messages for central channel: ${channelId}`);
46641
+ logger30.info(`[AgentServer] Cleared all messages for central channel: ${channelId}`);
46669
46642
  }
46670
46643
  async findOrCreateCentralDmChannel(user1Id, user2Id, messageServerId) {
46671
46644
  return this.database.findOrCreateDmChannel(user1Id, user2Id, messageServerId);
@@ -46688,7 +46661,7 @@ class AgentServer {
46688
46661
  metadata: createdMessage.metadata
46689
46662
  };
46690
46663
  bus_default.emit("new_message", messageForBus);
46691
- logger32.info(`[AgentServer] Published message ${createdMessage.id} to internal message bus`);
46664
+ logger30.info(`[AgentServer] Published message ${createdMessage.id} to internal message bus`);
46692
46665
  }
46693
46666
  return createdMessage;
46694
46667
  }
@@ -46699,7 +46672,7 @@ class AgentServer {
46699
46672
  return this.database.updateMessage(messageId, patch);
46700
46673
  }
46701
46674
  async removeParticipantFromChannel() {
46702
- logger32.warn(`[AgentServer] Remove participant operation not directly supported in database adapter`);
46675
+ logger30.warn(`[AgentServer] Remove participant operation not directly supported in database adapter`);
46703
46676
  }
46704
46677
  async addAgentToServer(serverId, agentId) {
46705
46678
  const server = await this.getServerById(serverId);
@@ -46727,32 +46700,32 @@ class AgentServer {
46727
46700
  }
46728
46701
  registerSignalHandlers() {
46729
46702
  const gracefulShutdown = async () => {
46730
- logger32.info("Received shutdown signal, initiating graceful shutdown...");
46731
- logger32.debug("Stopping all agents...");
46703
+ logger30.info("Received shutdown signal, initiating graceful shutdown...");
46704
+ logger30.debug("Stopping all agents...");
46732
46705
  const agents = this.elizaOS?.getAgents() || [];
46733
46706
  for (const agent of agents) {
46734
46707
  try {
46735
46708
  await agent.stop();
46736
- logger32.debug(`Stopped agent ${agent.agentId}`);
46709
+ logger30.debug(`Stopped agent ${agent.agentId}`);
46737
46710
  } catch (error2) {
46738
- logger32.error({ error: error2, agentId: agent.agentId }, `Error stopping agent ${agent.agentId}:`);
46711
+ logger30.error({ error: error2, agentId: agent.agentId }, `Error stopping agent ${agent.agentId}:`);
46739
46712
  }
46740
46713
  }
46741
46714
  if (this.database) {
46742
46715
  try {
46743
46716
  await this.database.close();
46744
- logger32.info("Database closed.");
46717
+ logger30.info("Database closed.");
46745
46718
  } catch (error2) {
46746
- logger32.error({ error: error2 }, "Error closing database:");
46719
+ logger30.error({ error: error2 }, "Error closing database:");
46747
46720
  }
46748
46721
  }
46749
46722
  if (this.server) {
46750
46723
  this.server.close(() => {
46751
- logger32.success("Server closed successfully");
46724
+ logger30.success("Server closed successfully");
46752
46725
  process.exit(0);
46753
46726
  });
46754
46727
  setTimeout(() => {
46755
- logger32.error("Could not close connections in time, forcing shutdown");
46728
+ logger30.error("Could not close connections in time, forcing shutdown");
46756
46729
  process.exit(1);
46757
46730
  }, 5000);
46758
46731
  } else {
@@ -46761,7 +46734,7 @@ class AgentServer {
46761
46734
  };
46762
46735
  process.on("SIGTERM", gracefulShutdown);
46763
46736
  process.on("SIGINT", gracefulShutdown);
46764
- logger32.debug("Shutdown handlers registered");
46737
+ logger30.debug("Shutdown handlers registered");
46765
46738
  }
46766
46739
  }
46767
46740
  export {
@@ -46775,8 +46748,6 @@ export {
46775
46748
  isWebUIEnabled,
46776
46749
  hasValidRemoteUrls,
46777
46750
  expandTildePath,
46778
- PluginLoader,
46779
46751
  ElizaOS3 as ElizaOS,
46780
- ConfigManager,
46781
46752
  AgentServer
46782
46753
  };