@voltagent/core 1.1.2 → 1.1.4

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
@@ -3168,16 +3168,9 @@ var RemoteLogProcessor = class {
3168
3168
  for (const log of this.pendingLogs) {
3169
3169
  this.actualProcessor.onEmit(log);
3170
3170
  }
3171
- this.logger?.debug(`[RemoteLogExport] Processed ${this.pendingLogs.length} pending logs`);
3172
3171
  this.pendingLogs = [];
3173
3172
  }
3174
3173
  this.initialized = true;
3175
- this.logger?.debug("[RemoteLogExport] Successfully initialized remote log export", {
3176
- url: `${baseUrl}/api/public/otel/v1/logs`,
3177
- maxQueueSize: this.config.maxQueueSize ?? 2048,
3178
- maxExportBatchSize: this.config.maxExportBatchSize ?? 512,
3179
- scheduledDelayMillis: this.config.scheduledDelayMillis ?? 5e3
3180
- });
3181
3174
  return true;
3182
3175
  } catch (error) {
3183
3176
  this.logger?.debug("[RemoteLogExport] Failed to initialize remote log export", { error });
@@ -9094,8 +9087,8 @@ var Agent = class {
9094
9087
  // Preserve prototype chain
9095
9088
  result,
9096
9089
  // Copy all enumerable properties
9097
- { context: new Map(oc.context) }
9098
- // Add context
9090
+ { context: oc.context }
9091
+ // Expose the same context instance
9099
9092
  );
9100
9093
  return returnValue;
9101
9094
  } catch (error) {
@@ -9305,7 +9298,7 @@ var Agent = class {
9305
9298
  pipeTextStreamToResponse: result.pipeTextStreamToResponse.bind(result),
9306
9299
  toTextStreamResponse: result.toTextStreamResponse.bind(result),
9307
9300
  // Add our custom context
9308
- context: new Map(oc.context)
9301
+ context: oc.context
9309
9302
  };
9310
9303
  return resultWithContext;
9311
9304
  } catch (error) {
@@ -9440,7 +9433,7 @@ var Agent = class {
9440
9433
  );
9441
9434
  return {
9442
9435
  ...result,
9443
- context: new Map(oc.context)
9436
+ context: oc.context
9444
9437
  };
9445
9438
  } catch (error) {
9446
9439
  return this.handleError(error, oc, options, startTime);
@@ -9610,7 +9603,7 @@ var Agent = class {
9610
9603
  pipeTextStreamToResponse: /* @__PURE__ */ __name((response, init) => result.pipeTextStreamToResponse(response, init), "pipeTextStreamToResponse"),
9611
9604
  toTextStreamResponse: /* @__PURE__ */ __name((init) => result.toTextStreamResponse(init), "toTextStreamResponse"),
9612
9605
  // Add our custom context
9613
- context: new Map(oc.context)
9606
+ context: oc.context
9614
9607
  };
9615
9608
  return resultWithContext;
9616
9609
  } catch (error) {
@@ -9648,11 +9641,32 @@ var Agent = class {
9648
9641
  const operationId = crypto5.randomUUID();
9649
9642
  const startTimeDate = /* @__PURE__ */ new Date();
9650
9643
  const runtimeContext = toContextMap(options?.context);
9651
- const context5 = new Map([
9652
- ...this.context?.entries() || [],
9653
- ...runtimeContext?.entries() || [],
9654
- ...options?.parentOperationContext?.context?.entries() || []
9655
- ]);
9644
+ const parentContext = options?.parentOperationContext?.context;
9645
+ let context5;
9646
+ if (parentContext) {
9647
+ context5 = parentContext;
9648
+ if (runtimeContext) {
9649
+ for (const [k, v] of runtimeContext.entries()) {
9650
+ if (!context5.has(k)) context5.set(k, v);
9651
+ }
9652
+ }
9653
+ if (this.context) {
9654
+ for (const [k, v] of this.context.entries()) {
9655
+ if (!context5.has(k)) context5.set(k, v);
9656
+ }
9657
+ }
9658
+ } else if (runtimeContext) {
9659
+ context5 = runtimeContext;
9660
+ if (this.context) {
9661
+ for (const [k, v] of this.context.entries()) {
9662
+ if (!context5.has(k)) context5.set(k, v);
9663
+ }
9664
+ }
9665
+ } else if (this.context) {
9666
+ context5 = this.context;
9667
+ } else {
9668
+ context5 = /* @__PURE__ */ new Map();
9669
+ }
9656
9670
  const logger = this.getContextualLogger(options?.parentAgentId).child({
9657
9671
  operationId,
9658
9672
  userId: options?.userId,