neatlogs 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +2 -2
  2. package/dist/anthropic.cjs +68 -2
  3. package/dist/anthropic.cjs.map +1 -1
  4. package/dist/anthropic.mjs +68 -2
  5. package/dist/anthropic.mjs.map +1 -1
  6. package/dist/azure-openai.cjs +68 -2
  7. package/dist/azure-openai.cjs.map +1 -1
  8. package/dist/azure-openai.mjs +68 -2
  9. package/dist/azure-openai.mjs.map +1 -1
  10. package/dist/bedrock.cjs +68 -2
  11. package/dist/bedrock.cjs.map +1 -1
  12. package/dist/bedrock.mjs +68 -2
  13. package/dist/bedrock.mjs.map +1 -1
  14. package/dist/browser.cjs +19 -9
  15. package/dist/browser.cjs.map +1 -1
  16. package/dist/browser.d.ts +23 -5
  17. package/dist/browser.mjs +19 -9
  18. package/dist/browser.mjs.map +1 -1
  19. package/dist/index.cjs +225 -381
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.ts +38 -19
  22. package/dist/index.mjs +224 -381
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/langchain.cjs +68 -2
  25. package/dist/langchain.cjs.map +1 -1
  26. package/dist/langchain.mjs +68 -2
  27. package/dist/langchain.mjs.map +1 -1
  28. package/dist/openai.cjs +68 -2
  29. package/dist/openai.cjs.map +1 -1
  30. package/dist/openai.mjs +68 -2
  31. package/dist/openai.mjs.map +1 -1
  32. package/dist/opencode-plugin.cjs +2 -2
  33. package/dist/opencode-plugin.cjs.map +1 -1
  34. package/dist/opencode-plugin.d.ts +1 -1
  35. package/dist/opencode-plugin.mjs +2 -2
  36. package/dist/opencode-plugin.mjs.map +1 -1
  37. package/dist/openrouter-agent.cjs +68 -2
  38. package/dist/openrouter-agent.cjs.map +1 -1
  39. package/dist/openrouter-agent.mjs +68 -2
  40. package/dist/openrouter-agent.mjs.map +1 -1
  41. package/dist/vertex-ai.cjs +68 -2
  42. package/dist/vertex-ai.cjs.map +1 -1
  43. package/dist/vertex-ai.mjs +68 -2
  44. package/dist/vertex-ai.mjs.map +1 -1
  45. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  getMastraObservability: () => getMastraObservability,
50
50
  getPrompt: () => getPrompt,
51
51
  getSessionConfig: () => getSessionConfig,
52
+ identify: () => identify,
52
53
  init: () => init,
53
54
  isDebugEnabled: () => isDebugEnabled,
54
55
  langchainHandler: () => langchainHandler,
@@ -84,8 +85,7 @@ __export(index_exports, {
84
85
  module.exports = __toCommonJS(index_exports);
85
86
 
86
87
  // src/init.ts
87
- var import_node_crypto = require("crypto");
88
- var path3 = __toESM(require("path"));
88
+ var path2 = __toESM(require("path"));
89
89
  var import_api8 = require("@opentelemetry/api");
90
90
  var import_api_logs = require("@opentelemetry/api-logs");
91
91
  var import_resources = require("@opentelemetry/resources");
@@ -2374,6 +2374,31 @@ var import_api3 = require("@opentelemetry/api");
2374
2374
 
2375
2375
  // src/core/end-user.ts
2376
2376
  var import_api = require("@opentelemetry/api");
2377
+
2378
+ // src/core/identity.ts
2379
+ var import_node_async_hooks2 = require("async_hooks");
2380
+ var _GLOBAL_KEY = /* @__PURE__ */ Symbol.for("neatlogs.identity.storage");
2381
+ var _g = globalThis;
2382
+ var _storage = _g[_GLOBAL_KEY] ?? (_g[_GLOBAL_KEY] = new import_node_async_hooks2.AsyncLocalStorage());
2383
+ function currentSessionId() {
2384
+ return _storage.getStore()?.sessionId;
2385
+ }
2386
+ function currentEndUserId() {
2387
+ return _storage.getStore()?.endUserId;
2388
+ }
2389
+ function currentEndUserMetadata() {
2390
+ return _storage.getStore()?.endUserMetadata;
2391
+ }
2392
+ function identify(opts, fn) {
2393
+ const prev = _storage.getStore();
2394
+ const next = { ...prev ?? {} };
2395
+ if (opts.sessionId !== void 0) next.sessionId = opts.sessionId;
2396
+ if (opts.endUserId !== void 0) next.endUserId = opts.endUserId;
2397
+ if (opts.endUserMetadata !== void 0) next.endUserMetadata = opts.endUserMetadata;
2398
+ return _storage.run(next, fn);
2399
+ }
2400
+
2401
+ // src/core/end-user.ts
2377
2402
  var logger4 = getLogger();
2378
2403
  var END_USER_ID_KEY = "neatlogs.end_user.id";
2379
2404
  var END_USER_METADATA_KEY = "neatlogs.end_user.metadata";
@@ -2391,25 +2416,42 @@ function isRootSpan() {
2391
2416
  return !(current && current.isRecording());
2392
2417
  }
2393
2418
  function applyEndUserAttributes(span2, endUserId, endUserMetadata, isRoot = true) {
2394
- if (!endUserId && !endUserMetadata) return;
2419
+ const resolvedId = isRoot ? endUserId ?? currentEndUserId() : endUserId;
2420
+ const resolvedMeta = isRoot ? endUserMetadata ?? currentEndUserMetadata() : endUserMetadata;
2421
+ if (!resolvedId && !resolvedMeta) return;
2395
2422
  if (!isRoot) {
2396
2423
  logger4.debug(
2397
- "[end_user] Ignoring endUserId/endUserMetadata on a non-root span \u2014 declare it on the trace root (top-level trace()/span()) or init()."
2424
+ "[end_user] Ignoring endUserId/endUserMetadata on a non-root span \u2014 declare it on the trace root (top-level trace()/span()) or identify()."
2398
2425
  );
2399
2426
  return;
2400
2427
  }
2401
- if (endUserId) {
2402
- span2.setAttribute(END_USER_ID_KEY, String(endUserId));
2428
+ if (resolvedId) {
2429
+ span2.setAttribute(END_USER_ID_KEY, String(resolvedId));
2403
2430
  }
2404
- const metaJson = normalizeEndUserMetadata(endUserMetadata);
2431
+ const metaJson = normalizeEndUserMetadata(resolvedMeta);
2405
2432
  if (metaJson) {
2406
2433
  span2.setAttribute(END_USER_METADATA_KEY, metaJson);
2407
2434
  }
2408
2435
  }
2409
2436
 
2437
+ // src/core/session.ts
2438
+ var logger5 = getLogger();
2439
+ var SESSION_ID_KEY = "neatlogs.session.id";
2440
+ function applySessionAttributes(span2, sessionId, isRoot = true) {
2441
+ const resolved = isRoot ? sessionId ?? currentSessionId() : sessionId;
2442
+ if (!resolved) return;
2443
+ if (!isRoot) {
2444
+ logger5.debug(
2445
+ "[session] Ignoring sessionId on a non-root span \u2014 declare it on the trace root (top-level trace()/span()) or identify()."
2446
+ );
2447
+ return;
2448
+ }
2449
+ span2.setAttribute(SESSION_ID_KEY, String(resolved));
2450
+ }
2451
+
2410
2452
  // src/decorators/base.ts
2411
2453
  var import_api2 = require("@opentelemetry/api");
2412
- var logger5 = getLogger();
2454
+ var logger6 = getLogger();
2413
2455
  var TRACER_NAME = "neatlogs";
2414
2456
  function safeJsonDumps(value) {
2415
2457
  try {
@@ -2468,13 +2510,14 @@ function decorateSpan(opts, fn) {
2468
2510
  return tracer.startActiveSpan(spanName, (span2) => {
2469
2511
  try {
2470
2512
  setCommonSpanAttrs(span2, opts);
2513
+ applySessionAttributes(span2, opts.sessionId, isRoot);
2471
2514
  applyEndUserAttributes(span2, opts.endUserId, opts.endUserMetadata, isRoot);
2472
2515
  if (captureInput && doCapture && args.length > 0) {
2473
2516
  try {
2474
2517
  const inputValue = args.length === 1 ? serializeObj(args[0]) : args.map(serializeObj);
2475
2518
  span2.setAttribute("input.value", safeJsonDumps(inputValue));
2476
2519
  } catch (err) {
2477
- logger5.debug(`Failed to capture input: ${err}`);
2520
+ logger6.debug(`Failed to capture input: ${err}`);
2478
2521
  }
2479
2522
  }
2480
2523
  const result = fn(...args);
@@ -2484,7 +2527,7 @@ function decorateSpan(opts, fn) {
2484
2527
  try {
2485
2528
  span2.setAttribute("output.value", safeJsonDumps(serializeObj(resolved)));
2486
2529
  } catch (err) {
2487
- logger5.debug(`Failed to capture output: ${err}`);
2530
+ logger6.debug(`Failed to capture output: ${err}`);
2488
2531
  }
2489
2532
  }
2490
2533
  if (opts.postprocessResult) {
@@ -2492,7 +2535,7 @@ function decorateSpan(opts, fn) {
2492
2535
  const boundInputs = _extractBoundInputs(fn, args);
2493
2536
  opts.postprocessResult(span2, resolved, boundInputs);
2494
2537
  } catch (err) {
2495
- logger5.debug(`Postprocess failed: ${err}`);
2538
+ logger6.debug(`Postprocess failed: ${err}`);
2496
2539
  }
2497
2540
  }
2498
2541
  span2.setStatus({ code: import_api2.SpanStatusCode.OK });
@@ -2512,7 +2555,7 @@ function decorateSpan(opts, fn) {
2512
2555
  try {
2513
2556
  span2.setAttribute("output.value", safeJsonDumps(serializeObj(result)));
2514
2557
  } catch (err) {
2515
- logger5.debug(`Failed to capture output: ${err}`);
2558
+ logger6.debug(`Failed to capture output: ${err}`);
2516
2559
  }
2517
2560
  }
2518
2561
  if (opts.postprocessResult) {
@@ -2520,7 +2563,7 @@ function decorateSpan(opts, fn) {
2520
2563
  const boundInputs = _extractBoundInputs(fn, args);
2521
2564
  opts.postprocessResult(span2, result, boundInputs);
2522
2565
  } catch (err) {
2523
- logger5.debug(`Postprocess failed: ${err}`);
2566
+ logger6.debug(`Postprocess failed: ${err}`);
2524
2567
  }
2525
2568
  }
2526
2569
  span2.setStatus({ code: import_api2.SpanStatusCode.OK });
@@ -2554,7 +2597,7 @@ function _extractBoundInputs(fn, args) {
2554
2597
  }
2555
2598
 
2556
2599
  // src/core/context.ts
2557
- var logger6 = getLogger();
2600
+ var logger7 = getLogger();
2558
2601
  var _sessionConfig = {};
2559
2602
  function _setSessionConfig(config) {
2560
2603
  _sessionConfig = config;
@@ -2578,6 +2621,7 @@ var KNOWN_OPTION_KEYS = /* @__PURE__ */ new Set([
2578
2621
  "version",
2579
2622
  "mask",
2580
2623
  "attributes",
2624
+ "sessionId",
2581
2625
  "endUserId",
2582
2626
  "endUserMetadata"
2583
2627
  ]);
@@ -2596,7 +2640,7 @@ function _finalizePromptCapture(span2, isPromptTemplateObj, isUserPromptTemplate
2596
2640
  "llm.prompt_template_variables",
2597
2641
  JSON.stringify(capturedVars)
2598
2642
  );
2599
- logger6.debug(
2643
+ logger7.debug(
2600
2644
  `[trace] Auto-captured variables from PromptContext: ${Object.keys(capturedVars).join(", ")}`
2601
2645
  );
2602
2646
  }
@@ -2608,7 +2652,7 @@ function _finalizePromptCapture(span2, isPromptTemplateObj, isUserPromptTemplate
2608
2652
  "llm.user_prompt_template_variables",
2609
2653
  JSON.stringify(capturedUserVars)
2610
2654
  );
2611
- logger6.debug(
2655
+ logger7.debug(
2612
2656
  `[trace] Auto-captured variables from UserPromptContext: ${Object.keys(capturedUserVars).join(", ")}`
2613
2657
  );
2614
2658
  }
@@ -2625,13 +2669,13 @@ async function trace2(options, fn) {
2625
2669
  userPromptVariables,
2626
2670
  version,
2627
2671
  mask,
2672
+ sessionId: sessionIdOption,
2628
2673
  endUserId,
2629
2674
  endUserMetadata,
2630
2675
  attributes: explicitAttributes,
2631
2676
  ...extraOptions
2632
2677
  } = options;
2633
- const sessionConfig = getSessionConfig();
2634
- const sessionId = sessionConfig.sessionId;
2678
+ const sessionId = sessionIdOption ?? currentSessionId();
2635
2679
  const currentSpan = import_api3.trace.getSpan(import_api3.context.active());
2636
2680
  const isInActiveTrace = currentSpan !== void 0 && currentSpan.isRecording();
2637
2681
  const shouldCreateRootTrace = !!sessionId && !isInActiveTrace;
@@ -2642,7 +2686,7 @@ async function trace2(options, fn) {
2642
2686
  isPromptTemplateObj = true;
2643
2687
  const t = promptTemplate.template;
2644
2688
  templateString = typeof t === "string" ? t : JSON.stringify(t);
2645
- logger6.debug(
2689
+ logger7.debug(
2646
2690
  `[trace] Using PromptTemplate object with variables: ${promptTemplate.variables.join(", ")}`
2647
2691
  );
2648
2692
  } else if (typeof promptTemplate === "string") {
@@ -2659,7 +2703,7 @@ async function trace2(options, fn) {
2659
2703
  isUserPromptTemplateObj = true;
2660
2704
  const t = userPromptTemplate.template;
2661
2705
  userTemplateString = typeof t === "string" ? t : JSON.stringify(t);
2662
- logger6.debug(
2706
+ logger7.debug(
2663
2707
  `[trace] Using UserPromptTemplate object with variables: ${userPromptTemplate.variables.join(", ")}`
2664
2708
  );
2665
2709
  } else if (typeof userPromptTemplate === "string") {
@@ -2674,23 +2718,23 @@ async function trace2(options, fn) {
2674
2718
  const userVariablesJson = userPromptVariables ? JSON.stringify(userPromptVariables) : void 0;
2675
2719
  if (variablesJson) {
2676
2720
  ctx = ctx.setValue(PROMPT_VARIABLES_KEY, variablesJson);
2677
- logger6.debug(`[trace] Set neatlogs.prompt_variables in context: ${variablesJson}`);
2721
+ logger7.debug(`[trace] Set neatlogs.prompt_variables in context: ${variablesJson}`);
2678
2722
  }
2679
2723
  if (templateString) {
2680
2724
  ctx = ctx.setValue(PROMPT_TEMPLATE_KEY, templateString);
2681
- logger6.debug(`[trace] Set neatlogs.prompt_template in context: ${templateString}`);
2725
+ logger7.debug(`[trace] Set neatlogs.prompt_template in context: ${templateString}`);
2682
2726
  }
2683
2727
  if (userVariablesJson) {
2684
2728
  ctx = ctx.setValue(USER_PROMPT_VARIABLES_KEY, userVariablesJson);
2685
- logger6.debug(`[trace] Set neatlogs.user_prompt_variables in context: ${userVariablesJson}`);
2729
+ logger7.debug(`[trace] Set neatlogs.user_prompt_variables in context: ${userVariablesJson}`);
2686
2730
  }
2687
2731
  if (userTemplateString) {
2688
2732
  ctx = ctx.setValue(USER_PROMPT_TEMPLATE_KEY, userTemplateString);
2689
- logger6.debug(`[trace] Set neatlogs.user_prompt_template in context: ${userTemplateString}`);
2733
+ logger7.debug(`[trace] Set neatlogs.user_prompt_template in context: ${userTemplateString}`);
2690
2734
  }
2691
2735
  if (version) {
2692
2736
  ctx = ctx.setValue(PROMPT_VERSION_KEY, version);
2693
- logger6.debug(`[trace] Set neatlogs.prompt_version in context: ${version}`);
2737
+ logger7.debug(`[trace] Set neatlogs.prompt_version in context: ${version}`);
2694
2738
  }
2695
2739
  const extraAttributes = { ...explicitAttributes ?? {} };
2696
2740
  for (const [key, value] of Object.entries(extraOptions)) {
@@ -2702,6 +2746,7 @@ async function trace2(options, fn) {
2702
2746
  const tracer = import_api3.trace.getTracer("neatlogs.trace");
2703
2747
  const spanCallback = async (span2) => {
2704
2748
  _setSpanAttributes(span2, kind, extraAttributes);
2749
+ applySessionAttributes(span2, sessionId, isRootTrace);
2705
2750
  applyEndUserAttributes(span2, endUserId, endUserMetadata, isRootTrace);
2706
2751
  if (input !== void 0 && input !== null) {
2707
2752
  span2.setAttribute("input.value", safeJsonDumps(serializeObj(input)));
@@ -2741,23 +2786,23 @@ async function trace2(options, fn) {
2741
2786
  }
2742
2787
  };
2743
2788
  if (shouldCreateRootTrace) {
2744
- logger6.debug(`[trace] Creating NEW root trace '${name}' (sessionId=${sessionId})`);
2789
+ logger7.debug(`[trace] Creating NEW root trace '${name}' (sessionId=${sessionId})`);
2745
2790
  return tracer.startActiveSpan(name, {}, import_api3.ROOT_CONTEXT, spanCallback);
2746
2791
  } else {
2747
- logger6.debug(`[trace] Creating child span '${name}'`);
2792
+ logger7.debug(`[trace] Creating child span '${name}'`);
2748
2793
  return tracer.startActiveSpan(name, {}, ctx, spanCallback);
2749
2794
  }
2750
2795
  }
2751
2796
 
2752
2797
  // src/core/crewai-task-registry.ts
2753
- var logger7 = getLogger();
2798
+ var logger8 = getLogger();
2754
2799
  var _registry = /* @__PURE__ */ new Map();
2755
2800
  function registerCrewaiTask(task, userTpl, vars) {
2756
2801
  const taskId = String(task.id);
2757
2802
  const tplStr = String(userTpl.template);
2758
2803
  const varsJson = vars && Object.keys(vars).length > 0 ? JSON.stringify(vars, (_key, val) => typeof val === "undefined" ? null : val) : null;
2759
2804
  _registry.set(taskId, [tplStr, varsJson]);
2760
- logger7.debug(`Registered CrewAI task ${taskId}`);
2805
+ logger8.debug(`Registered CrewAI task ${taskId}`);
2761
2806
  }
2762
2807
  function popEntry(taskId) {
2763
2808
  const entry = _registry.get(taskId);
@@ -3899,7 +3944,7 @@ var attribute_mapping_default = {
3899
3944
  };
3900
3945
 
3901
3946
  // src/config/attribute-mapper.ts
3902
- var logger8 = getLogger();
3947
+ var logger9 = getLogger();
3903
3948
  function flattenSources(sources) {
3904
3949
  if (!sources) return [];
3905
3950
  if (Array.isArray(sources)) return sources;
@@ -4220,7 +4265,7 @@ var AttributeMapper = class {
4220
4265
  };
4221
4266
 
4222
4267
  // src/core/span-processor.ts
4223
- var logger9 = getLogger();
4268
+ var logger10 = getLogger();
4224
4269
  function resolveLogFilePath(configuredPath) {
4225
4270
  return path.isAbsolute(configuredPath) ? configuredPath : path.join(process.cwd(), configuredPath);
4226
4271
  }
@@ -4233,7 +4278,7 @@ function createLogStream(configuredPath) {
4233
4278
  const stream = fs.createWriteStream(logPath, { fd, autoClose: true });
4234
4279
  fd = null;
4235
4280
  stream.on("error", (error) => {
4236
- logger9.warn(`Failed to write span log file ${logPath}: ${error}`);
4281
+ logger10.warn(`Failed to write span log file ${logPath}: ${error}`);
4237
4282
  stream.destroy();
4238
4283
  });
4239
4284
  return stream;
@@ -4244,7 +4289,7 @@ function createLogStream(configuredPath) {
4244
4289
  } catch {
4245
4290
  }
4246
4291
  }
4247
- logger9.warn(`Failed to open span log file ${logPath}: ${error}`);
4292
+ logger10.warn(`Failed to open span log file ${logPath}: ${error}`);
4248
4293
  return null;
4249
4294
  }
4250
4295
  }
@@ -4253,7 +4298,7 @@ async function closeLogStream(stream, description) {
4253
4298
  if (!stream || stream.destroyed || stream.writableEnded) {
4254
4299
  return;
4255
4300
  }
4256
- await new Promise((resolve2) => {
4301
+ await new Promise((resolve) => {
4257
4302
  let settled = false;
4258
4303
  const settle = () => {
4259
4304
  if (settled) return;
@@ -4261,15 +4306,15 @@ async function closeLogStream(stream, description) {
4261
4306
  clearTimeout(timer);
4262
4307
  stream.off("close", closeHandler);
4263
4308
  stream.off("error", errorHandler);
4264
- resolve2();
4309
+ resolve();
4265
4310
  };
4266
4311
  const closeHandler = settle;
4267
4312
  const errorHandler = (error) => {
4268
- logger9.warn(`Failed to close ${description} log file handle: ${error}`);
4313
+ logger10.warn(`Failed to close ${description} log file handle: ${error}`);
4269
4314
  settle();
4270
4315
  };
4271
4316
  const timer = setTimeout(() => {
4272
- logger9.warn(
4317
+ logger10.warn(
4273
4318
  `Timed out waiting for ${description} log stream to close; destroying`
4274
4319
  );
4275
4320
  stream.destroy();
@@ -4280,7 +4325,7 @@ async function closeLogStream(stream, description) {
4280
4325
  try {
4281
4326
  stream.end();
4282
4327
  } catch (error) {
4283
- logger9.warn(`Failed to close ${description} log file handle: ${error}`);
4328
+ logger10.warn(`Failed to close ${description} log file handle: ${error}`);
4284
4329
  settle();
4285
4330
  }
4286
4331
  });
@@ -4359,7 +4404,7 @@ var NeatlogsSpanProcessor = class {
4359
4404
  const rawPath = process.env.NEATLOGS_LOG_RAW_SPANS_FILE ?? "spans_raw_optimized.log";
4360
4405
  this._rawLogStream = createLogStream(rawPath);
4361
4406
  if (this._rawLogStream) {
4362
- logger9.info(
4407
+ logger10.info(
4363
4408
  `Raw span logging enabled: ${resolveLogFilePath(rawPath)}`
4364
4409
  );
4365
4410
  }
@@ -4371,7 +4416,7 @@ var NeatlogsSpanProcessor = class {
4371
4416
  const processedPath = process.env.NEATLOGS_LOG_SPANS_FILE ?? "spans_optimized.log";
4372
4417
  this._processedLogStream = createLogStream(processedPath);
4373
4418
  if (this._processedLogStream) {
4374
- logger9.info(
4419
+ logger10.info(
4375
4420
  `Processed span logging enabled: ${resolveLogFilePath(processedPath)}`
4376
4421
  );
4377
4422
  }
@@ -4417,14 +4462,14 @@ var NeatlogsSpanProcessor = class {
4417
4462
  }
4418
4463
  }
4419
4464
  if (this.debug) {
4420
- logger9.debug(
4465
+ logger10.debug(
4421
4466
  `[SpanProcessor.onStart] LLM span '${spanName}' starting`
4422
4467
  );
4423
- logger9.debug(` variables_json from context: ${variablesJson}`);
4424
- logger9.debug(` template from context: ${template}`);
4425
- logger9.debug(` version from context: ${versionVal}`);
4426
- logger9.debug(` user_template from context: ${userTemplate}`);
4427
- logger9.debug(
4468
+ logger10.debug(` variables_json from context: ${variablesJson}`);
4469
+ logger10.debug(` template from context: ${template}`);
4470
+ logger10.debug(` version from context: ${versionVal}`);
4471
+ logger10.debug(` user_template from context: ${userTemplate}`);
4472
+ logger10.debug(
4428
4473
  ` user_variables_json from context: ${userVariablesJson}`
4429
4474
  );
4430
4475
  }
@@ -4459,7 +4504,7 @@ var NeatlogsSpanProcessor = class {
4459
4504
  this.perfStats.spansProcessed += 1;
4460
4505
  try {
4461
4506
  if (this.debug) {
4462
- logger9.debug(`[SpanProcessor.onEnd] Span ending: ${span2.name}`);
4507
+ logger10.debug(`[SpanProcessor.onEnd] Span ending: ${span2.name}`);
4463
4508
  }
4464
4509
  if (this._rawLogStream && !this._rawLogStream.destroyed) {
4465
4510
  try {
@@ -4467,7 +4512,7 @@ var NeatlogsSpanProcessor = class {
4467
4512
  JSON.stringify(spanToDict(span2)) + "\n"
4468
4513
  );
4469
4514
  } catch (e) {
4470
- logger9.warn(`Failed to write span to raw log file: ${e}`);
4515
+ logger10.warn(`Failed to write span to raw log file: ${e}`);
4471
4516
  }
4472
4517
  }
4473
4518
  if (this.sampleRate < 1 && Math.random() > this.sampleRate) {
@@ -4490,7 +4535,7 @@ var NeatlogsSpanProcessor = class {
4490
4535
  delete unifiedAttrs[key];
4491
4536
  }
4492
4537
  if (this.debug && keysToRemove.length > 0) {
4493
- logger9.debug(
4538
+ logger10.debug(
4494
4539
  `[EMBEDDING Filter] Removed ${keysToRemove.length} large attribute keys from ${nlKind} span (skip_output=${skipOutput})`
4495
4540
  );
4496
4541
  }
@@ -4517,7 +4562,7 @@ var NeatlogsSpanProcessor = class {
4517
4562
  this._retrieversToSuppress.delete(spanId2);
4518
4563
  unifiedAttrs["neatlogs.internal"] = true;
4519
4564
  if (this.debug) {
4520
- logger9.debug(
4565
+ logger10.debug(
4521
4566
  `[Retriever Merge] Marked OI retriever '${span2.name}' as internal (had neatlogs retriever child)`
4522
4567
  );
4523
4568
  }
@@ -4535,7 +4580,7 @@ var NeatlogsSpanProcessor = class {
4535
4580
  }
4536
4581
  }
4537
4582
  if (this.debug && "neatlogs.tags" in resourceAttrs) {
4538
- logger9.debug(
4583
+ logger10.debug(
4539
4584
  `[Tags] Span ${span2.name}: resource.neatlogs.tags = ${resourceAttrs["neatlogs.tags"]}`
4540
4585
  );
4541
4586
  }
@@ -4545,7 +4590,7 @@ var NeatlogsSpanProcessor = class {
4545
4590
  let parentSpanId = span2.parentSpanId ?? null;
4546
4591
  if (parentSpanId === spanId) {
4547
4592
  if (this.debug) {
4548
- logger9.warn(
4593
+ logger10.warn(
4549
4594
  `[SpanProcessor] Detected self-parenting span. trace_id=${traceId} span_id=${spanId} name=${span2.name}. Setting parent_span_id=None.`
4550
4595
  );
4551
4596
  }
@@ -4608,7 +4653,7 @@ var NeatlogsSpanProcessor = class {
4608
4653
  }
4609
4654
  } catch (wbExc) {
4610
4655
  if (this.debug) {
4611
- logger9.debug(
4656
+ logger10.debug(
4612
4657
  `[SpanProcessor] Attr write-back failed: ${wbExc}`
4613
4658
  );
4614
4659
  }
@@ -4619,7 +4664,7 @@ var NeatlogsSpanProcessor = class {
4619
4664
  JSON.stringify(spanData) + "\n"
4620
4665
  );
4621
4666
  } catch (e) {
4622
- logger9.warn(`Failed to write span to processed log file: ${e}`);
4667
+ logger10.warn(`Failed to write span to processed log file: ${e}`);
4623
4668
  }
4624
4669
  }
4625
4670
  this.perfStats.spansExported += 1;
@@ -4651,12 +4696,12 @@ var NeatlogsSpanProcessor = class {
4651
4696
  }
4652
4697
  marker.end();
4653
4698
  if (this.debug) {
4654
- logger9.debug(
4699
+ logger10.debug(
4655
4700
  `[SpanProcessor] Emitted completion marker for trace ${traceId}`
4656
4701
  );
4657
4702
  }
4658
4703
  } catch (e) {
4659
- logger9.warn(`[SpanProcessor] Failed to emit completion marker: ${e}`);
4704
+ logger10.warn(`[SpanProcessor] Failed to emit completion marker: ${e}`);
4660
4705
  }
4661
4706
  }
4662
4707
  // ── Framework span name normalization ─────────────────
@@ -4723,7 +4768,7 @@ var NeatlogsSpanProcessor = class {
4723
4768
  if (respMeta?.model_name && respMeta.model_name !== currentModel) {
4724
4769
  attrs["neatlogs.llm.model_name"] = respMeta.model_name;
4725
4770
  if (this.debug) {
4726
- logger9.debug(
4771
+ logger10.debug(
4727
4772
  `[ModelResolve] LangChain span: ${currentModel} \u2192 ${respMeta.model_name}`
4728
4773
  );
4729
4774
  }
@@ -4733,13 +4778,13 @@ var NeatlogsSpanProcessor = class {
4733
4778
  if (output?.model && output.model !== currentModel) {
4734
4779
  attrs["neatlogs.llm.model_name"] = output.model;
4735
4780
  if (this.debug) {
4736
- logger9.debug(
4781
+ logger10.debug(
4737
4782
  `[ModelResolve] Direct response: ${currentModel} \u2192 ${output.model}`
4738
4783
  );
4739
4784
  }
4740
4785
  }
4741
4786
  } catch (e) {
4742
- logger9.warn(`[ModelResolve] Failed to parse LLM output for model extraction: ${e}`);
4787
+ logger10.warn(`[ModelResolve] Failed to parse LLM output for model extraction: ${e}`);
4743
4788
  }
4744
4789
  }
4745
4790
  // ── forceFlush / shutdown ─────────────────────────────
@@ -4760,7 +4805,7 @@ var NeatlogsSpanProcessor = class {
4760
4805
  const totalTime = stats.onStartTime + stats.onEndTime;
4761
4806
  const avgMs = totalTime / stats.spansProcessed;
4762
4807
  try {
4763
- logger9.info(
4808
+ logger10.info(
4764
4809
  `Neatlogs overhead: ${totalTime.toFixed(2)}ms total, ${avgMs.toFixed(3)}ms/span (${stats.spansProcessed} spans processed, ${stats.spansExported} spans logged)`
4765
4810
  );
4766
4811
  } catch {
@@ -4801,187 +4846,9 @@ var FilteringExporter = class {
4801
4846
  }
4802
4847
  };
4803
4848
 
4804
- // src/core/exporter.ts
4805
- var logger10 = getLogger();
4806
- var NeatlogsExporter = class {
4807
- baseUrl;
4808
- apiKey;
4809
- batchSize;
4810
- flushIntervalMs;
4811
- disableExport;
4812
- buffer = [];
4813
- flushTimer = null;
4814
- _shutdown = false;
4815
- constructor(options) {
4816
- this.baseUrl = options.baseUrl.replace(/\/$/, "");
4817
- this.apiKey = options.apiKey;
4818
- this.batchSize = options.batchSize ?? 50;
4819
- this.flushIntervalMs = options.flushIntervalMs ?? 5e3;
4820
- this.disableExport = options.disableExport ?? false;
4821
- if (!this.disableExport) {
4822
- this.flushTimer = setInterval(() => this.flush(), this.flushIntervalMs);
4823
- if (this.flushTimer.unref) {
4824
- this.flushTimer.unref();
4825
- }
4826
- }
4827
- }
4828
- /** Add a span-like dict to the buffer. */
4829
- export(spanData) {
4830
- if (this._shutdown || this.disableExport) return;
4831
- this.buffer.push(spanData);
4832
- if (this.buffer.length >= this.batchSize) {
4833
- this.flush().catch((err) => {
4834
- logger10.warn(`Failed to flush batch: ${err}`);
4835
- });
4836
- }
4837
- }
4838
- /** Flush all buffered spans to the API. */
4839
- async flush() {
4840
- if (this.disableExport || this.buffer.length === 0) return;
4841
- const batch = this.buffer.splice(0, this.buffer.length);
4842
- try {
4843
- const url = `${this.baseUrl}/api/data/v4/batch`;
4844
- const response = await fetch(url, {
4845
- method: "POST",
4846
- headers: {
4847
- "Content-Type": "application/json",
4848
- "x-api-key": this.apiKey
4849
- },
4850
- body: JSON.stringify({ spans: batch })
4851
- });
4852
- if (!response.ok) {
4853
- logger10.warn(
4854
- `Failed to export batch: ${response.status} ${response.statusText}`
4855
- );
4856
- this._requeueBatch(batch);
4857
- } else {
4858
- logger10.debug(`Exported ${batch.length} log spans`);
4859
- }
4860
- } catch (err) {
4861
- logger10.warn(`Failed to export batch: ${err}`);
4862
- this._requeueBatch(batch);
4863
- }
4864
- }
4865
- /** Re-insert a failed batch into the buffer for retry, up to a limit. */
4866
- _requeueBatch(batch) {
4867
- if (this.buffer.length < this.batchSize * 3) {
4868
- this.buffer.unshift(...batch);
4869
- }
4870
- }
4871
- /** Shutdown the exporter, flushing remaining items. */
4872
- async shutdown() {
4873
- this._shutdown = true;
4874
- if (this.flushTimer) {
4875
- clearInterval(this.flushTimer);
4876
- this.flushTimer = null;
4877
- }
4878
- await this.flush();
4879
- }
4880
- };
4881
-
4882
- // src/core/log-exporter.ts
4883
- var crypto = __toESM(require("crypto"));
4884
- var fs2 = __toESM(require("fs"));
4885
- var path2 = __toESM(require("path"));
4886
-
4887
- // node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
4849
+ // src/core/log.ts
4888
4850
  var import_api5 = require("@opentelemetry/api");
4889
- var SUPPRESS_TRACING_KEY = (0, import_api5.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
4890
- function suppressTracing(context3) {
4891
- return context3.setValue(SUPPRESS_TRACING_KEY, true);
4892
- }
4893
-
4894
- // node_modules/@opentelemetry/core/build/esm/ExportResult.js
4895
- var ExportResultCode;
4896
- (function(ExportResultCode2) {
4897
- ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
4898
- ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
4899
- })(ExportResultCode || (ExportResultCode = {}));
4900
-
4901
- // src/core/log-exporter.ts
4902
4851
  var logger11 = getLogger();
4903
- var NeatlogsLogExporter = class {
4904
- exporter;
4905
- logFileHandle = null;
4906
- logEnabled;
4907
- constructor(exporter) {
4908
- this.exporter = exporter;
4909
- this.logEnabled = ["1", "true", "yes"].includes(
4910
- (process.env.NEATLOGS_LOG_LOGS ?? "").toLowerCase()
4911
- );
4912
- const logFile = process.env.NEATLOGS_LOG_LOGS_FILE ?? "";
4913
- if (this.logEnabled && logFile) {
4914
- const filePath = path2.resolve(process.cwd(), logFile);
4915
- try {
4916
- this.logFileHandle = fs2.openSync(filePath, "a");
4917
- logger11.info(`Log record logging enabled: ${filePath}`);
4918
- } catch (err) {
4919
- logger11.warn(`Failed to open log file ${filePath}: ${err}`);
4920
- }
4921
- }
4922
- }
4923
- export(logRecords, resultCallback) {
4924
- try {
4925
- for (const record of logRecords) {
4926
- const spanDict = this._convertLogRecord(record);
4927
- this.exporter.export(spanDict);
4928
- this._writeToFile(record, spanDict);
4929
- }
4930
- resultCallback({ code: ExportResultCode.SUCCESS });
4931
- } catch (err) {
4932
- logger11.warn(`Failed to export log records: ${err}`);
4933
- resultCallback({ code: ExportResultCode.FAILED });
4934
- }
4935
- }
4936
- async shutdown() {
4937
- if (this.logFileHandle !== null) {
4938
- fs2.closeSync(this.logFileHandle);
4939
- this.logFileHandle = null;
4940
- }
4941
- }
4942
- async forceFlush() {
4943
- await this.exporter.flush();
4944
- }
4945
- _writeToFile(record, spanDict) {
4946
- if (!this.logEnabled || this.logFileHandle === null) return;
4947
- const entry = {
4948
- trace_id: spanDict.trace_id || "",
4949
- span_id: spanDict.span_id || "",
4950
- body: spanDict.attributes?.["log.message"] ?? "",
4951
- severity: record.severityText ?? "",
4952
- template: spanDict.attributes?.["log.template"] ?? "",
4953
- timestamp: spanDict.start_time
4954
- };
4955
- fs2.writeSync(this.logFileHandle, JSON.stringify(entry) + "\n");
4956
- }
4957
- _convertLogRecord(record) {
4958
- const attributes = { ...record.attributes ?? {} };
4959
- if (record.body !== void 0 && record.body !== null) {
4960
- attributes["log.message"] = String(record.body);
4961
- }
4962
- attributes["openinference.span.kind"] = "LOG";
4963
- attributes["neatlogs.span.kind"] = "log";
4964
- return {
4965
- name: attributes["log.template"] ?? "log",
4966
- kind: "LOG",
4967
- trace_id: record.spanContext?.traceId ?? "",
4968
- span_id: crypto.randomBytes(8).toString("hex"),
4969
- parent_span_id: record.spanContext?.spanId ?? "",
4970
- start_time: record.hrTime ? this._hrTimeToIso(record.hrTime) : (/* @__PURE__ */ new Date()).toISOString(),
4971
- end_time: record.hrTime ? this._hrTimeToIso(record.hrTime) : (/* @__PURE__ */ new Date()).toISOString(),
4972
- status: "OK",
4973
- attributes
4974
- };
4975
- }
4976
- _hrTimeToIso(hrTime) {
4977
- const ms = hrTime[0] * 1e3 + hrTime[1] / 1e6;
4978
- return new Date(ms).toISOString();
4979
- }
4980
- };
4981
-
4982
- // src/core/log.ts
4983
- var import_api6 = require("@opentelemetry/api");
4984
- var logger12 = getLogger();
4985
4852
  var _otelLogger = null;
4986
4853
  var _debugMode = false;
4987
4854
  function _setOtelLogger(otelLogger, debug) {
@@ -4998,7 +4865,7 @@ function log(msgTemplate, options) {
4998
4865
  console.log(`[neatlogs:log] ${rendered}`);
4999
4866
  }
5000
4867
  if (_otelLogger) {
5001
- const activeSpan = import_api6.trace.getSpan(import_api6.context.active());
4868
+ const activeSpan = import_api5.trace.getSpan(import_api5.context.active());
5002
4869
  const spanContext = activeSpan?.spanContext();
5003
4870
  const attributes = {
5004
4871
  "log.template": msgTemplate,
@@ -5014,7 +4881,7 @@ function log(msgTemplate, options) {
5014
4881
  ...spanContext ? { spanContext } : {}
5015
4882
  });
5016
4883
  } catch (err) {
5017
- logger12.warn(`Failed to emit log record: ${err}`);
4884
+ logger11.warn(`Failed to emit log record: ${err}`);
5018
4885
  }
5019
4886
  }
5020
4887
  }
@@ -5443,7 +5310,7 @@ function getLibraryInfo(library) {
5443
5310
  }
5444
5311
 
5445
5312
  // src/instrumentation/manager.ts
5446
- var logger13 = getLogger();
5313
+ var logger12 = getLogger();
5447
5314
  var InstrumentationManager = class {
5448
5315
  provider;
5449
5316
  _instrumented = [];
@@ -5462,7 +5329,7 @@ var InstrumentationManager = class {
5462
5329
  for (const lib of libraries) {
5463
5330
  const info = getLibraryInfo(lib);
5464
5331
  if (!info) {
5465
- logger13.warn(
5332
+ logger12.warn(
5466
5333
  `Unknown library '${lib}' \u2014 not in instrumentation registry. Skipping.`
5467
5334
  );
5468
5335
  continue;
@@ -5478,7 +5345,7 @@ var InstrumentationManager = class {
5478
5345
  if (typeof instrumentor.instrument === "function") {
5479
5346
  instrumentor.instrument({ tracerProvider: this.provider });
5480
5347
  this._instrumented.push(lib);
5481
- logger13.debug(
5348
+ logger12.debug(
5482
5349
  `Instrumented '${lib}' via neatlogs custom instrumentor`
5483
5350
  );
5484
5351
  continue;
@@ -5491,23 +5358,23 @@ var InstrumentationManager = class {
5491
5358
  const targetMod = await import(info.npm_package);
5492
5359
  instrumentor.patchEager(targetMod);
5493
5360
  } catch (e) {
5494
- logger13.debug(
5361
+ logger12.debug(
5495
5362
  `Eager patch for '${lib}' skipped \u2014 ${info.npm_package} not available: ${e}`
5496
5363
  );
5497
5364
  }
5498
5365
  }
5499
5366
  this._instrumented.push(lib);
5500
- logger13.debug(
5367
+ logger12.debug(
5501
5368
  `Instrumented '${lib}' via neatlogs OTel instrumentor`
5502
5369
  );
5503
5370
  continue;
5504
5371
  }
5505
5372
  }
5506
- logger13.debug(
5373
+ logger12.debug(
5507
5374
  `neatlogs instrumentor for '${lib}' loaded but has no instrument() method \u2014 trying OpenInference`
5508
5375
  );
5509
5376
  } catch (err) {
5510
- logger13.debug(
5377
+ logger12.debug(
5511
5378
  `neatlogs instrumentor for '${lib}' failed to load: ${err} \u2014 trying OpenInference`
5512
5379
  );
5513
5380
  }
@@ -5523,7 +5390,7 @@ var InstrumentationManager = class {
5523
5390
  if (typeof instrumentor.instrument === "function") {
5524
5391
  instrumentor.instrument({ tracerProvider: this.provider });
5525
5392
  this._instrumented.push(lib);
5526
- logger13.debug(`Instrumented '${lib}' via OpenInference`);
5393
+ logger12.debug(`Instrumented '${lib}' via OpenInference`);
5527
5394
  continue;
5528
5395
  }
5529
5396
  if (typeof instrumentor.setTracerProvider === "function" && typeof instrumentor.manuallyInstrument === "function") {
@@ -5533,16 +5400,16 @@ var InstrumentationManager = class {
5533
5400
  const targetMod = await import(info.npm_package);
5534
5401
  instrumentor.manuallyInstrument(targetMod);
5535
5402
  this._instrumented.push(lib);
5536
- logger13.debug(`Instrumented '${lib}' via OpenInference (manual patch)`);
5403
+ logger12.debug(`Instrumented '${lib}' via OpenInference (manual patch)`);
5537
5404
  continue;
5538
5405
  } catch (importErr) {
5539
- logger13.debug(
5406
+ logger12.debug(
5540
5407
  `Could not import '${info.npm_package}' for manual instrumentation of '${lib}': ${importErr}`
5541
5408
  );
5542
5409
  }
5543
5410
  }
5544
5411
  this._instrumented.push(lib);
5545
- logger13.debug(`Instrumented '${lib}' via OpenInference (tracer set, awaiting module hook)`);
5412
+ logger12.debug(`Instrumented '${lib}' via OpenInference (tracer set, awaiting module hook)`);
5546
5413
  continue;
5547
5414
  }
5548
5415
  }
@@ -5551,32 +5418,41 @@ var InstrumentationManager = class {
5551
5418
  tracerProvider: this.provider
5552
5419
  });
5553
5420
  this._instrumented.push(lib);
5554
- logger13.debug(`Instrumented '${lib}' via OpenInference`);
5421
+ logger12.debug(`Instrumented '${lib}' via OpenInference`);
5555
5422
  continue;
5556
5423
  }
5557
- logger13.warn(
5424
+ logger12.warn(
5558
5425
  `OpenInference package for '${lib}' loaded but could not find instrumentor class`
5559
5426
  );
5560
5427
  } catch (err) {
5561
- logger13.debug(
5428
+ logger12.debug(
5562
5429
  `OpenInference instrumentor for '${lib}' not available: ${err}`
5563
5430
  );
5564
5431
  }
5565
5432
  }
5566
5433
  if (!info.openinference && !info.neatlogs) {
5567
- logger13.debug(
5434
+ logger12.debug(
5568
5435
  `'${lib}' instrumentation not yet available for TypeScript \u2014 skipping`
5569
5436
  );
5570
5437
  }
5571
5438
  }
5572
5439
  if (this._instrumented.length > 0) {
5573
- logger13.info(`Instrumented: ${this._instrumented.join(", ")}`);
5440
+ logger12.info(`Instrumented: ${this._instrumented.join(", ")}`);
5574
5441
  }
5575
5442
  }
5576
5443
  };
5577
5444
 
5578
5445
  // src/prompt/client.ts
5579
5446
  var import_api7 = require("@opentelemetry/api");
5447
+
5448
+ // node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
5449
+ var import_api6 = require("@opentelemetry/api");
5450
+ var SUPPRESS_TRACING_KEY = (0, import_api6.createContextKey)("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
5451
+ function suppressTracing(context3) {
5452
+ return context3.setValue(SUPPRESS_TRACING_KEY, true);
5453
+ }
5454
+
5455
+ // src/prompt/client.ts
5580
5456
  var PromptClientError = class extends Error {
5581
5457
  constructor(message) {
5582
5458
  super(message);
@@ -5765,8 +5641,8 @@ var PromptClient = class {
5765
5641
  const version = options?.version;
5766
5642
  const label = options?.label;
5767
5643
  if (label != null) {
5768
- const path4 = `/api/v1/prompts/${encodeURIComponent(name)}/fetch`;
5769
- const url = `${path4}?label=${encodeURIComponent(label)}`;
5644
+ const path3 = `/api/v1/prompts/${encodeURIComponent(name)}/fetch`;
5645
+ const url = `${path3}?label=${encodeURIComponent(label)}`;
5770
5646
  const payload = await this._request(url);
5771
5647
  return new PromptHandle(normalizePromptObject(payload));
5772
5648
  }
@@ -5870,8 +5746,8 @@ var PromptClient = class {
5870
5746
  /**
5871
5747
  * Internal fetch wrapper with auth headers and OTel suppression.
5872
5748
  */
5873
- async _request(path4, options) {
5874
- const url = `${this.baseUrl}${path4}`;
5749
+ async _request(path3, options) {
5750
+ const url = `${this.baseUrl}${path3}`;
5875
5751
  const headers = {
5876
5752
  Accept: "application/json",
5877
5753
  "Content-Type": "application/json",
@@ -5894,13 +5770,13 @@ var PromptClient = class {
5894
5770
  if (!response.ok) {
5895
5771
  const body = await response.text().catch(() => "<unavailable>");
5896
5772
  throw new PromptApiError(
5897
- `${fetchOptions.method} ${path4} failed (${response.status}): ${body.slice(0, 400)}`
5773
+ `${fetchOptions.method} ${path3} failed (${response.status}): ${body.slice(0, 400)}`
5898
5774
  );
5899
5775
  }
5900
5776
  try {
5901
5777
  return await response.json();
5902
5778
  } catch {
5903
- throw new PromptApiError(`${fetchOptions.method} ${path4} returned non-JSON response`);
5779
+ throw new PromptApiError(`${fetchOptions.method} ${path3} returned non-JSON response`);
5904
5780
  }
5905
5781
  }
5906
5782
  };
@@ -5942,15 +5818,14 @@ async function removeTag(name, tag) {
5942
5818
  }
5943
5819
 
5944
5820
  // src/version.ts
5945
- var __version__ = "1.1.1";
5821
+ var __version__ = "1.1.2";
5946
5822
 
5947
5823
  // src/init.ts
5948
- var logger14 = getLogger();
5824
+ var logger13 = getLogger();
5949
5825
  var _initialized = false;
5950
5826
  var _tracerProvider = null;
5951
5827
  var _meterProvider = null;
5952
5828
  var _logProvider = null;
5953
- var _logSpanExporter = null;
5954
5829
  var _spanProcessor = null;
5955
5830
  var _debugMode2 = false;
5956
5831
  var _sigHandlersRegistered = false;
@@ -5962,19 +5837,16 @@ function _resolveWorkflowName(workflowName) {
5962
5837
  const provided = (workflowName ?? "").trim();
5963
5838
  if (provided) return provided;
5964
5839
  const argv1 = process.argv[1] ?? "";
5965
- const base = path3.basename(argv1, path3.extname(argv1));
5840
+ const base = path2.basename(argv1, path2.extname(argv1));
5966
5841
  const slug = base.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
5967
5842
  if (slug && !["node", "ts-node", "tsx", "npx", "-e"].includes(slug)) {
5968
5843
  return slug;
5969
5844
  }
5970
5845
  return "neatlogs-app";
5971
5846
  }
5972
- function _randomHex(bytes) {
5973
- return (0, import_node_crypto.randomBytes)(bytes).toString("hex");
5974
- }
5975
5847
  async function init(options = {}) {
5976
5848
  if (_initialized) {
5977
- logger14.warn("Neatlogs already initialized, skipping re-initialization");
5849
+ logger13.warn("Neatlogs already initialized, skipping re-initialization");
5978
5850
  return;
5979
5851
  }
5980
5852
  let resolvedKey;
@@ -5990,7 +5862,7 @@ async function init(options = {}) {
5990
5862
  disableExportResolved = true;
5991
5863
  resolvedKey = "disabled";
5992
5864
  if (options.debug) {
5993
- logger14.warn(
5865
+ logger13.warn(
5994
5866
  "No NEATLOGS_API_KEY set; HTTP export disabled. Set NEATLOGS_API_KEY (or pass apiKey) to send spans to the backend."
5995
5867
  );
5996
5868
  }
@@ -6000,17 +5872,9 @@ async function init(options = {}) {
6000
5872
  }
6001
5873
  _debugMode2 = options.debug ?? false;
6002
5874
  const resolvedWorkflowName = _resolveWorkflowName(options.workflowName);
6003
- let sessionId = options.sessionId;
6004
- if (!sessionId && options.autoSession) {
6005
- sessionId = `session_${Date.now()}_${_randomHex(4)}`;
6006
- if (options.debug) {
6007
- logger14.debug(`Auto-generated session_id: ${sessionId}`);
6008
- }
6009
- }
6010
- const endpoint = options.endpoint ?? "https://staging-cloud.neatlogs.com";
5875
+ const endpoint = options.endpoint ?? "https://ingest.neatlogs.com";
6011
5876
  const baseUrl = new URL(endpoint).origin;
6012
5877
  _setSessionConfig({
6013
- sessionId,
6014
5878
  userId: options.userId,
6015
5879
  workflowName: resolvedWorkflowName,
6016
5880
  _apiKey: resolvedKey,
@@ -6024,15 +5888,7 @@ async function init(options = {}) {
6024
5888
  "service.version": __version__,
6025
5889
  "neatlogs.workflow_name": resolvedWorkflowName
6026
5890
  };
6027
- if (sessionId) resourceAttrs["session.id"] = sessionId;
6028
5891
  if (options.userId) resourceAttrs["user.id"] = options.userId;
6029
- if (options.endUserId) {
6030
- resourceAttrs[END_USER_ID_KEY] = String(options.endUserId);
6031
- }
6032
- if (options.endUserMetadata) {
6033
- const euMeta = normalizeEndUserMetadata(options.endUserMetadata);
6034
- if (euMeta) resourceAttrs[END_USER_METADATA_KEY] = euMeta;
6035
- }
6036
5892
  const tags = options.tags;
6037
5893
  if (tags !== void 0) {
6038
5894
  if (!Array.isArray(tags) || !tags.every((t) => typeof t === "string")) {
@@ -6071,40 +5927,30 @@ async function init(options = {}) {
6071
5927
  });
6072
5928
  provider.addSpanProcessor(batchProcessor);
6073
5929
  if (options.debug) {
6074
- logger14.debug(`OTLP trace exporter configured: ${tracesEndpoint}`);
5930
+ logger13.debug(`OTLP trace exporter configured: ${tracesEndpoint}`);
6075
5931
  }
6076
5932
  } else if (options.debug) {
6077
- logger14.debug("Export disabled \u2014 spans will not be sent to backend");
5933
+ logger13.debug("Export disabled \u2014 spans will not be sent to backend");
6078
5934
  }
6079
5935
  provider.register();
6080
5936
  _tracerProvider = provider;
6081
5937
  if (options.debug) {
6082
- logger14.debug("Neatlogs tracer provider initialized");
5938
+ logger13.debug("Neatlogs tracer provider initialized");
6083
5939
  }
6084
5940
  try {
6085
5941
  _meterProvider = new import_sdk_metrics.MeterProvider({ resource });
6086
5942
  import_api8.metrics.setGlobalMeterProvider(_meterProvider);
6087
5943
  if (options.debug) {
6088
- logger14.debug("Neatlogs meter provider initialized");
5944
+ logger13.debug("Neatlogs meter provider initialized");
6089
5945
  }
6090
5946
  } catch {
6091
5947
  if (options.debug) {
6092
- logger14.debug("MeterProvider not available \u2014 skipping");
5948
+ logger13.debug("MeterProvider not available \u2014 skipping");
6093
5949
  }
6094
5950
  }
6095
5951
  const captureLogs = options.captureLogs ?? false;
6096
5952
  if (captureLogs) {
6097
- _logSpanExporter = new NeatlogsExporter({
6098
- baseUrl,
6099
- apiKey: resolvedKey,
6100
- batchSize: options.batchSize ?? 100,
6101
- flushIntervalMs: (options.flushInterval ?? 5) * 1e3,
6102
- disableExport: disableExportResolved
6103
- });
6104
5953
  _logProvider = new import_sdk_logs.LoggerProvider({ resource });
6105
- _logProvider.addLogRecordProcessor(
6106
- new import_sdk_logs.SimpleLogRecordProcessor(new NeatlogsLogExporter(_logSpanExporter))
6107
- );
6108
5954
  if (!disableExportResolved) {
6109
5955
  const logsEndpoint = endpoint.endsWith("/v1/logs") ? endpoint : `${baseUrl}/v1/logs`;
6110
5956
  const otlpLogExporter = new import_exporter_logs_otlp_proto.OTLPLogExporter({
@@ -6112,20 +5958,23 @@ async function init(options = {}) {
6112
5958
  headers: resolvedKey ? { "x-api-key": resolvedKey } : void 0
6113
5959
  });
6114
5960
  _logProvider.addLogRecordProcessor(
6115
- new import_sdk_logs.BatchLogRecordProcessor(otlpLogExporter)
5961
+ new import_sdk_logs.BatchLogRecordProcessor(otlpLogExporter, {
5962
+ maxExportBatchSize: options.batchSize ?? 100,
5963
+ scheduledDelayMillis: (options.flushInterval ?? 5) * 1e3
5964
+ })
6116
5965
  );
6117
5966
  if (options.debug) {
6118
- logger14.debug(`OTLP log exporter configured: ${logsEndpoint}`);
5967
+ logger13.debug(`OTLP log exporter configured: ${logsEndpoint}`);
6119
5968
  }
6120
5969
  }
6121
5970
  import_api_logs.logs.setGlobalLoggerProvider(_logProvider);
6122
5971
  const otelLogger = _logProvider.getLogger("neatlogs");
6123
5972
  _setOtelLogger(otelLogger, options.debug ?? false);
6124
5973
  if (options.debug) {
6125
- logger14.debug(`Neatlogs log capture enabled (endpoint: ${baseUrl}/v1/logs)`);
5974
+ logger13.debug(`Neatlogs log capture enabled (endpoint: ${baseUrl}/v1/logs)`);
6126
5975
  }
6127
5976
  } else if (options.debug) {
6128
- logger14.debug("Log capture disabled (pass captureLogs: true to enable)");
5977
+ logger13.debug("Log capture disabled (pass captureLogs: true to enable)");
6129
5978
  }
6130
5979
  const manager = new InstrumentationManager({
6131
5980
  provider,
@@ -6134,7 +5983,7 @@ async function init(options = {}) {
6134
5983
  if (options.instrumentations?.length) {
6135
5984
  await manager.instrument(options.instrumentations);
6136
5985
  if (options.debug) {
6137
- logger14.debug(`Instrumented libraries: ${manager.instrumented.join(", ")}`);
5986
+ logger13.debug(`Instrumented libraries: ${manager.instrumented.join(", ")}`);
6138
5987
  }
6139
5988
  }
6140
5989
  if (!_sigHandlersRegistered) {
@@ -6145,45 +5994,44 @@ async function init(options = {}) {
6145
5994
  }
6146
5995
  _initialized = true;
6147
5996
  if (options.debug) {
6148
- logger14.info("Neatlogs SDK initialized successfully");
6149
- logger14.info(`Endpoint: ${endpoint}`);
6150
- logger14.info(`Workflow: ${resolvedWorkflowName}`);
6151
- logger14.info(`Session: ${sessionId ?? "(none)"}`);
6152
- logger14.info(`User: ${options.userId ?? "(none)"}`);
6153
- logger14.info(`Tags: ${tags ?? []}`);
6154
- logger14.info(`Instrumentations: ${manager.instrumented.join(", ") || "(none)"}`);
6155
- logger14.info(`Sample Rate: ${options.sampleRate ?? 1}`);
5997
+ logger13.info("Neatlogs SDK initialized successfully");
5998
+ logger13.info(`Endpoint: ${endpoint}`);
5999
+ logger13.info(`Workflow: ${resolvedWorkflowName}`);
6000
+ logger13.info(`User: ${options.userId ?? "(none)"}`);
6001
+ logger13.info(`Tags: ${tags ?? []}`);
6002
+ logger13.info(`Instrumentations: ${manager.instrumented.join(", ") || "(none)"}`);
6003
+ logger13.info(`Sample Rate: ${options.sampleRate ?? 1}`);
6156
6004
  }
6157
6005
  }
6158
6006
  async function flush() {
6159
6007
  let success = true;
6160
6008
  if (_tracerProvider) {
6161
6009
  try {
6162
- logger14.debug("Flushing tracer provider...");
6010
+ logger13.debug("Flushing tracer provider...");
6163
6011
  await _tracerProvider.forceFlush();
6164
- logger14.debug("Tracer provider flushed successfully");
6012
+ logger13.debug("Tracer provider flushed successfully");
6165
6013
  } catch (e) {
6166
- logger14.error(`Error flushing spans: ${e}`);
6014
+ logger13.error(`Error flushing spans: ${e}`);
6167
6015
  success = false;
6168
6016
  }
6169
6017
  }
6170
6018
  if (_meterProvider) {
6171
6019
  try {
6172
- logger14.debug("Flushing meter provider...");
6020
+ logger13.debug("Flushing meter provider...");
6173
6021
  await _meterProvider.forceFlush();
6174
- logger14.debug("Meter provider flushed successfully");
6022
+ logger13.debug("Meter provider flushed successfully");
6175
6023
  } catch (e) {
6176
- logger14.error(`Error flushing metrics: ${e}`);
6024
+ logger13.error(`Error flushing metrics: ${e}`);
6177
6025
  success = false;
6178
6026
  }
6179
6027
  }
6180
- if (_logSpanExporter) {
6028
+ if (_logProvider) {
6181
6029
  try {
6182
- logger14.debug("Flushing log span exporter...");
6183
- await _logSpanExporter.flush();
6184
- logger14.debug("Log span exporter flushed successfully");
6030
+ logger13.debug("Flushing log provider...");
6031
+ await _logProvider.forceFlush();
6032
+ logger13.debug("Log provider flushed successfully");
6185
6033
  } catch (e) {
6186
- logger14.error(`Error flushing logs: ${e}`);
6034
+ logger13.error(`Error flushing logs: ${e}`);
6187
6035
  success = false;
6188
6036
  }
6189
6037
  }
@@ -6199,41 +6047,31 @@ async function shutdown() {
6199
6047
  let success = true;
6200
6048
  if (_tracerProvider) {
6201
6049
  try {
6202
- logger14.debug("Shutting down tracer provider...");
6050
+ logger13.debug("Shutting down tracer provider...");
6203
6051
  await _tracerProvider.shutdown();
6204
- logger14.debug("Tracer provider shut down successfully");
6052
+ logger13.debug("Tracer provider shut down successfully");
6205
6053
  } catch (e) {
6206
- logger14.error(`Error shutting down tracer provider: ${e}`);
6054
+ logger13.error(`Error shutting down tracer provider: ${e}`);
6207
6055
  success = false;
6208
6056
  }
6209
6057
  }
6210
6058
  if (_meterProvider) {
6211
6059
  try {
6212
- logger14.debug("Shutting down meter provider...");
6060
+ logger13.debug("Shutting down meter provider...");
6213
6061
  await _meterProvider.shutdown();
6214
- logger14.debug("Meter provider shut down successfully");
6062
+ logger13.debug("Meter provider shut down successfully");
6215
6063
  } catch (e) {
6216
- logger14.error(`Error shutting down meter provider: ${e}`);
6064
+ logger13.error(`Error shutting down meter provider: ${e}`);
6217
6065
  success = false;
6218
6066
  }
6219
6067
  }
6220
6068
  if (_logProvider) {
6221
6069
  try {
6222
- logger14.debug("Shutting down log provider...");
6070
+ logger13.debug("Shutting down log provider...");
6223
6071
  await _logProvider.shutdown();
6224
- logger14.debug("Log provider shut down successfully");
6225
- } catch (e) {
6226
- logger14.error(`Error shutting down log provider: ${e}`);
6227
- success = false;
6228
- }
6229
- }
6230
- if (_logSpanExporter) {
6231
- try {
6232
- logger14.debug("Shutting down log span exporter...");
6233
- await _logSpanExporter.shutdown();
6234
- logger14.debug("Log span exporter shut down successfully");
6072
+ logger13.debug("Log provider shut down successfully");
6235
6073
  } catch (e) {
6236
- logger14.error(`Error shutting down log span exporter: ${e}`);
6074
+ logger13.error(`Error shutting down log provider: ${e}`);
6237
6075
  success = false;
6238
6076
  }
6239
6077
  }
@@ -6241,11 +6079,10 @@ async function shutdown() {
6241
6079
  _tracerProvider = null;
6242
6080
  _meterProvider = null;
6243
6081
  _logProvider = null;
6244
- _logSpanExporter = null;
6245
6082
  _spanProcessor = null;
6246
6083
  _debugMode2 = false;
6247
6084
  _setSessionConfig({});
6248
- logger14.info("Neatlogs SDK shutdown complete");
6085
+ logger13.info("Neatlogs SDK shutdown complete");
6249
6086
  return success;
6250
6087
  }
6251
6088
  function getTracerProvider() {
@@ -6261,7 +6098,7 @@ function isDebugEnabled() {
6261
6098
  }
6262
6099
 
6263
6100
  // src/decorators/orchestration.ts
6264
- var logger15 = getLogger();
6101
+ var logger14 = getLogger();
6265
6102
  function span(options, fn) {
6266
6103
  if (!VALID_SPAN_KINDS.has(options.kind)) {
6267
6104
  throw new Error(
@@ -6599,6 +6436,10 @@ function resolveRootWorkflowName() {
6599
6436
  }
6600
6437
  return "workflow";
6601
6438
  }
6439
+ function stampAutoRootIdentity(root) {
6440
+ applySessionAttributes(root, void 0, true);
6441
+ applyEndUserAttributes(root, void 0, void 0, true);
6442
+ }
6602
6443
  function wrapSpanWithRoot(child, root) {
6603
6444
  let ended = false;
6604
6445
  return new Proxy(child, {
@@ -6633,6 +6474,7 @@ function maybeOpenAutoRoot(tracer, kind, baseCtx) {
6633
6474
  { attributes: { "neatlogs.span.kind": "workflow", "neatlogs.auto_root": true } },
6634
6475
  baseCtx
6635
6476
  );
6477
+ stampAutoRootIdentity(root);
6636
6478
  return { root, ctx: import_api10.trace.setSpan(baseCtx, root) };
6637
6479
  }
6638
6480
  function endAutoRoot(root) {
@@ -6662,6 +6504,7 @@ var AutoRootTracer = class {
6662
6504
  { attributes: { "neatlogs.span.kind": "workflow", "neatlogs.auto_root": true } },
6663
6505
  ctx
6664
6506
  );
6507
+ stampAutoRootIdentity(root);
6665
6508
  const childCtx = import_api10.trace.setSpan(ctx, root);
6666
6509
  const child = this._tracer.startSpan(name, options, childCtx);
6667
6510
  return wrapSpanWithRoot(child, root);
@@ -6710,12 +6553,12 @@ function traceTool(name, fn) {
6710
6553
  );
6711
6554
  };
6712
6555
  }
6713
- function wrapNamespace(target, path4) {
6556
+ function wrapNamespace(target, path3) {
6714
6557
  return new Proxy(target, {
6715
6558
  get(obj, prop, receiver) {
6716
6559
  const value = Reflect.get(obj, prop, receiver);
6717
6560
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
6718
- const currentPath = [...path4, String(prop)];
6561
+ const currentPath = [...path3, String(prop)];
6719
6562
  const pathStr = currentPath.join(".");
6720
6563
  if (pathStr === "chat.completions.create" && typeof value === "function") {
6721
6564
  return tracedChatCompletionsCreate(value.bind(obj));
@@ -6730,9 +6573,9 @@ function wrapNamespace(target, path4) {
6730
6573
  }
6731
6574
  });
6732
6575
  }
6733
- function isNamespace(path4) {
6734
- if (path4.length > 3) return false;
6735
- const key = path4[path4.length - 1];
6576
+ function isNamespace(path3) {
6577
+ if (path3.length > 3) return false;
6578
+ const key = path3[path3.length - 1];
6736
6579
  return ["chat", "completions", "responses", "beta"].includes(key);
6737
6580
  }
6738
6581
  function tracedChatCompletionsCreate(original) {
@@ -7022,12 +6865,12 @@ function traceTool2(name, fn) {
7022
6865
  );
7023
6866
  };
7024
6867
  }
7025
- function wrapNamespace2(target, path4) {
6868
+ function wrapNamespace2(target, path3) {
7026
6869
  return new Proxy(target, {
7027
6870
  get(obj, prop, receiver) {
7028
6871
  const value = Reflect.get(obj, prop, receiver);
7029
6872
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
7030
- const currentPath = [...path4, String(prop)];
6873
+ const currentPath = [...path3, String(prop)];
7031
6874
  const pathStr = currentPath.join(".");
7032
6875
  if (pathStr === "messages.create" && typeof value === "function") {
7033
6876
  return tracedMessagesCreate(value.bind(obj));
@@ -7042,9 +6885,9 @@ function wrapNamespace2(target, path4) {
7042
6885
  }
7043
6886
  });
7044
6887
  }
7045
- function isNamespace2(path4) {
7046
- if (path4.length > 3) return false;
7047
- const key = path4[path4.length - 1];
6888
+ function isNamespace2(path3) {
6889
+ if (path3.length > 3) return false;
6890
+ const key = path3[path3.length - 1];
7048
6891
  return ["messages", "beta"].includes(key);
7049
6892
  }
7050
6893
  function tracedMessagesCreate(original) {
@@ -7367,12 +7210,12 @@ function traceTool3(name, fn) {
7367
7210
  );
7368
7211
  };
7369
7212
  }
7370
- function wrapNamespace3(target, path4) {
7213
+ function wrapNamespace3(target, path3) {
7371
7214
  return new Proxy(target, {
7372
7215
  get(obj, prop, receiver) {
7373
7216
  const value = Reflect.get(obj, prop, receiver);
7374
7217
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
7375
- const currentPath = [...path4, String(prop)];
7218
+ const currentPath = [...path3, String(prop)];
7376
7219
  const pathStr = currentPath.join(".");
7377
7220
  if (pathStr === "chat.completions.create" && typeof value === "function") {
7378
7221
  return tracedChatCompletionsCreate2(value.bind(obj));
@@ -7387,9 +7230,9 @@ function wrapNamespace3(target, path4) {
7387
7230
  }
7388
7231
  });
7389
7232
  }
7390
- function isNamespace3(path4) {
7391
- if (path4.length > 3) return false;
7392
- const key = path4[path4.length - 1];
7233
+ function isNamespace3(path3) {
7234
+ if (path3.length > 3) return false;
7235
+ const key = path3[path3.length - 1];
7393
7236
  return ["chat", "completions", "responses", "beta"].includes(key);
7394
7237
  }
7395
7238
  function tracedChatCompletionsCreate2(original) {
@@ -7681,12 +7524,12 @@ function traceTool4(name, fn) {
7681
7524
  );
7682
7525
  };
7683
7526
  }
7684
- function wrapNamespace4(target, path4) {
7527
+ function wrapNamespace4(target, path3) {
7685
7528
  return new Proxy(target, {
7686
7529
  get(obj, prop, receiver) {
7687
7530
  const value = Reflect.get(obj, prop, receiver);
7688
7531
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
7689
- const currentPath = [...path4, String(prop)];
7532
+ const currentPath = [...path3, String(prop)];
7690
7533
  const pathStr = currentPath.join(".");
7691
7534
  if (pathStr === "models.generateContent" && typeof value === "function") {
7692
7535
  return tracedGenerateContent(value.bind(obj), false);
@@ -7707,9 +7550,9 @@ function wrapNamespace4(target, path4) {
7707
7550
  }
7708
7551
  });
7709
7552
  }
7710
- function isNamespace4(path4) {
7711
- if (path4.length > 2) return false;
7712
- return ["models", "chats"].includes(path4[path4.length - 1]);
7553
+ function isNamespace4(path3) {
7554
+ if (path3.length > 2) return false;
7555
+ return ["models", "chats"].includes(path3[path3.length - 1]);
7713
7556
  }
7714
7557
  function wrapVertexAIChat(chat) {
7715
7558
  const c = chat;
@@ -10660,21 +10503,21 @@ var ExportTraceServiceRequest = protoRoot.lookupType(
10660
10503
  "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"
10661
10504
  );
10662
10505
  var SpanStatusCode16 = { UNSET: 0, OK: 1, ERROR: 2 };
10663
- function randomBytes3(length) {
10506
+ function randomBytes(length) {
10664
10507
  const out = new Uint8Array(length);
10665
- const crypto2 = globalThis.crypto;
10666
- if (crypto2 && typeof crypto2.getRandomValues === "function") {
10667
- crypto2.getRandomValues(out);
10508
+ const crypto = globalThis.crypto;
10509
+ if (crypto && typeof crypto.getRandomValues === "function") {
10510
+ crypto.getRandomValues(out);
10668
10511
  return out;
10669
10512
  }
10670
10513
  for (let i = 0; i < out.length; i++) out[i] = Math.floor(Math.random() * 256);
10671
10514
  return out;
10672
10515
  }
10673
10516
  function generateTraceId() {
10674
- return randomBytes3(16);
10517
+ return randomBytes(16);
10675
10518
  }
10676
10519
  function generateSpanId() {
10677
- return randomBytes3(8);
10520
+ return randomBytes(8);
10678
10521
  }
10679
10522
  function nowNanoString() {
10680
10523
  return (BigInt(Date.now()) * 1000000n).toString();
@@ -10816,7 +10659,7 @@ function nanoToLong(nanoStr) {
10816
10659
  }
10817
10660
 
10818
10661
  // src/opencode-plugin.ts
10819
- var DEFAULT_ENDPOINT = "https://staging-cloud.neatlogs.com";
10662
+ var DEFAULT_ENDPOINT = "https://ingest.neatlogs.com";
10820
10663
  var NeatlogsOpencodePlugin = async (_ctx) => {
10821
10664
  const apiKey = (process.env.NEATLOGS_API_KEY ?? "").trim();
10822
10665
  const endpoint = (process.env.NEATLOGS_ENDPOINT ?? DEFAULT_ENDPOINT).trim();
@@ -11140,7 +10983,7 @@ function safeStringify15(value) {
11140
10983
  }
11141
10984
 
11142
10985
  // src/core/llm-binder.ts
11143
- var logger16 = getLogger();
10986
+ var logger15 = getLogger();
11144
10987
  function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11145
10988
  const systemStr = String(systemTpl.template);
11146
10989
  const userStr = userTpl ? String(userTpl.template) : null;
@@ -11152,7 +10995,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11152
10995
  llmCopy = structuredClone(llm);
11153
10996
  } catch {
11154
10997
  llmCopy = llm;
11155
- logger16.debug(
10998
+ logger15.debug(
11156
10999
  `LLM type ${llm?.constructor?.name ?? "unknown"} is not copyable \u2014 binding in place.`
11157
11000
  );
11158
11001
  }
@@ -11163,7 +11006,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11163
11006
  } else if (typeof llmCopy.call === "function") {
11164
11007
  methodName = "call";
11165
11008
  } else {
11166
- logger16.warn(
11009
+ logger15.warn(
11167
11010
  `LLM type ${llm?.constructor?.name ?? "unknown"} has neither invoke() nor call() \u2014 prompt templates will not be captured on spans.`
11168
11011
  );
11169
11012
  return llmCopy;
@@ -11183,7 +11026,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11183
11026
  }
11184
11027
  }
11185
11028
  };
11186
- logger16.debug(
11029
+ logger15.debug(
11187
11030
  `Wrapped ${llm?.constructor?.name ?? "unknown"}.${methodName}() with template injection.`
11188
11031
  );
11189
11032
  return llmCopy;
@@ -11209,6 +11052,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11209
11052
  getMastraObservability,
11210
11053
  getPrompt,
11211
11054
  getSessionConfig,
11055
+ identify,
11212
11056
  init,
11213
11057
  isDebugEnabled,
11214
11058
  langchainHandler,