neatlogs 1.1.0 → 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 +5 -5
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  // src/init.ts
2
- import { randomBytes as randomBytes2 } from "crypto";
3
- import * as path3 from "path";
2
+ import * as path2 from "path";
4
3
  import { metrics } from "@opentelemetry/api";
5
4
  import { logs } from "@opentelemetry/api-logs";
6
5
  import { Resource } from "@opentelemetry/resources";
@@ -9,7 +8,7 @@ import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
9
8
  import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-base";
10
9
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
11
10
  import { MeterProvider } from "@opentelemetry/sdk-metrics";
12
- import { LoggerProvider, SimpleLogRecordProcessor, BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
11
+ import { LoggerProvider, BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
13
12
  import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
14
13
 
15
14
  // src/core/span-processor.ts
@@ -2300,6 +2299,31 @@ import {
2300
2299
 
2301
2300
  // src/core/end-user.ts
2302
2301
  import { trace as otelTrace, context as otelContext } from "@opentelemetry/api";
2302
+
2303
+ // src/core/identity.ts
2304
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
2305
+ var _GLOBAL_KEY = /* @__PURE__ */ Symbol.for("neatlogs.identity.storage");
2306
+ var _g = globalThis;
2307
+ var _storage = _g[_GLOBAL_KEY] ?? (_g[_GLOBAL_KEY] = new AsyncLocalStorage2());
2308
+ function currentSessionId() {
2309
+ return _storage.getStore()?.sessionId;
2310
+ }
2311
+ function currentEndUserId() {
2312
+ return _storage.getStore()?.endUserId;
2313
+ }
2314
+ function currentEndUserMetadata() {
2315
+ return _storage.getStore()?.endUserMetadata;
2316
+ }
2317
+ function identify(opts, fn) {
2318
+ const prev = _storage.getStore();
2319
+ const next = { ...prev ?? {} };
2320
+ if (opts.sessionId !== void 0) next.sessionId = opts.sessionId;
2321
+ if (opts.endUserId !== void 0) next.endUserId = opts.endUserId;
2322
+ if (opts.endUserMetadata !== void 0) next.endUserMetadata = opts.endUserMetadata;
2323
+ return _storage.run(next, fn);
2324
+ }
2325
+
2326
+ // src/core/end-user.ts
2303
2327
  var logger4 = getLogger();
2304
2328
  var END_USER_ID_KEY = "neatlogs.end_user.id";
2305
2329
  var END_USER_METADATA_KEY = "neatlogs.end_user.metadata";
@@ -2317,25 +2341,42 @@ function isRootSpan() {
2317
2341
  return !(current && current.isRecording());
2318
2342
  }
2319
2343
  function applyEndUserAttributes(span2, endUserId, endUserMetadata, isRoot = true) {
2320
- if (!endUserId && !endUserMetadata) return;
2344
+ const resolvedId = isRoot ? endUserId ?? currentEndUserId() : endUserId;
2345
+ const resolvedMeta = isRoot ? endUserMetadata ?? currentEndUserMetadata() : endUserMetadata;
2346
+ if (!resolvedId && !resolvedMeta) return;
2321
2347
  if (!isRoot) {
2322
2348
  logger4.debug(
2323
- "[end_user] Ignoring endUserId/endUserMetadata on a non-root span \u2014 declare it on the trace root (top-level trace()/span()) or init()."
2349
+ "[end_user] Ignoring endUserId/endUserMetadata on a non-root span \u2014 declare it on the trace root (top-level trace()/span()) or identify()."
2324
2350
  );
2325
2351
  return;
2326
2352
  }
2327
- if (endUserId) {
2328
- span2.setAttribute(END_USER_ID_KEY, String(endUserId));
2353
+ if (resolvedId) {
2354
+ span2.setAttribute(END_USER_ID_KEY, String(resolvedId));
2329
2355
  }
2330
- const metaJson = normalizeEndUserMetadata(endUserMetadata);
2356
+ const metaJson = normalizeEndUserMetadata(resolvedMeta);
2331
2357
  if (metaJson) {
2332
2358
  span2.setAttribute(END_USER_METADATA_KEY, metaJson);
2333
2359
  }
2334
2360
  }
2335
2361
 
2362
+ // src/core/session.ts
2363
+ var logger5 = getLogger();
2364
+ var SESSION_ID_KEY = "neatlogs.session.id";
2365
+ function applySessionAttributes(span2, sessionId, isRoot = true) {
2366
+ const resolved = isRoot ? sessionId ?? currentSessionId() : sessionId;
2367
+ if (!resolved) return;
2368
+ if (!isRoot) {
2369
+ logger5.debug(
2370
+ "[session] Ignoring sessionId on a non-root span \u2014 declare it on the trace root (top-level trace()/span()) or identify()."
2371
+ );
2372
+ return;
2373
+ }
2374
+ span2.setAttribute(SESSION_ID_KEY, String(resolved));
2375
+ }
2376
+
2336
2377
  // src/decorators/base.ts
2337
2378
  import { trace, SpanStatusCode } from "@opentelemetry/api";
2338
- var logger5 = getLogger();
2379
+ var logger6 = getLogger();
2339
2380
  var TRACER_NAME = "neatlogs";
2340
2381
  function safeJsonDumps(value) {
2341
2382
  try {
@@ -2394,13 +2435,14 @@ function decorateSpan(opts, fn) {
2394
2435
  return tracer.startActiveSpan(spanName, (span2) => {
2395
2436
  try {
2396
2437
  setCommonSpanAttrs(span2, opts);
2438
+ applySessionAttributes(span2, opts.sessionId, isRoot);
2397
2439
  applyEndUserAttributes(span2, opts.endUserId, opts.endUserMetadata, isRoot);
2398
2440
  if (captureInput && doCapture && args.length > 0) {
2399
2441
  try {
2400
2442
  const inputValue = args.length === 1 ? serializeObj(args[0]) : args.map(serializeObj);
2401
2443
  span2.setAttribute("input.value", safeJsonDumps(inputValue));
2402
2444
  } catch (err) {
2403
- logger5.debug(`Failed to capture input: ${err}`);
2445
+ logger6.debug(`Failed to capture input: ${err}`);
2404
2446
  }
2405
2447
  }
2406
2448
  const result = fn(...args);
@@ -2410,7 +2452,7 @@ function decorateSpan(opts, fn) {
2410
2452
  try {
2411
2453
  span2.setAttribute("output.value", safeJsonDumps(serializeObj(resolved)));
2412
2454
  } catch (err) {
2413
- logger5.debug(`Failed to capture output: ${err}`);
2455
+ logger6.debug(`Failed to capture output: ${err}`);
2414
2456
  }
2415
2457
  }
2416
2458
  if (opts.postprocessResult) {
@@ -2418,7 +2460,7 @@ function decorateSpan(opts, fn) {
2418
2460
  const boundInputs = _extractBoundInputs(fn, args);
2419
2461
  opts.postprocessResult(span2, resolved, boundInputs);
2420
2462
  } catch (err) {
2421
- logger5.debug(`Postprocess failed: ${err}`);
2463
+ logger6.debug(`Postprocess failed: ${err}`);
2422
2464
  }
2423
2465
  }
2424
2466
  span2.setStatus({ code: SpanStatusCode.OK });
@@ -2438,7 +2480,7 @@ function decorateSpan(opts, fn) {
2438
2480
  try {
2439
2481
  span2.setAttribute("output.value", safeJsonDumps(serializeObj(result)));
2440
2482
  } catch (err) {
2441
- logger5.debug(`Failed to capture output: ${err}`);
2483
+ logger6.debug(`Failed to capture output: ${err}`);
2442
2484
  }
2443
2485
  }
2444
2486
  if (opts.postprocessResult) {
@@ -2446,7 +2488,7 @@ function decorateSpan(opts, fn) {
2446
2488
  const boundInputs = _extractBoundInputs(fn, args);
2447
2489
  opts.postprocessResult(span2, result, boundInputs);
2448
2490
  } catch (err) {
2449
- logger5.debug(`Postprocess failed: ${err}`);
2491
+ logger6.debug(`Postprocess failed: ${err}`);
2450
2492
  }
2451
2493
  }
2452
2494
  span2.setStatus({ code: SpanStatusCode.OK });
@@ -2480,7 +2522,7 @@ function _extractBoundInputs(fn, args) {
2480
2522
  }
2481
2523
 
2482
2524
  // src/core/context.ts
2483
- var logger6 = getLogger();
2525
+ var logger7 = getLogger();
2484
2526
  var _sessionConfig = {};
2485
2527
  function _setSessionConfig(config) {
2486
2528
  _sessionConfig = config;
@@ -2504,6 +2546,7 @@ var KNOWN_OPTION_KEYS = /* @__PURE__ */ new Set([
2504
2546
  "version",
2505
2547
  "mask",
2506
2548
  "attributes",
2549
+ "sessionId",
2507
2550
  "endUserId",
2508
2551
  "endUserMetadata"
2509
2552
  ]);
@@ -2522,7 +2565,7 @@ function _finalizePromptCapture(span2, isPromptTemplateObj, isUserPromptTemplate
2522
2565
  "llm.prompt_template_variables",
2523
2566
  JSON.stringify(capturedVars)
2524
2567
  );
2525
- logger6.debug(
2568
+ logger7.debug(
2526
2569
  `[trace] Auto-captured variables from PromptContext: ${Object.keys(capturedVars).join(", ")}`
2527
2570
  );
2528
2571
  }
@@ -2534,7 +2577,7 @@ function _finalizePromptCapture(span2, isPromptTemplateObj, isUserPromptTemplate
2534
2577
  "llm.user_prompt_template_variables",
2535
2578
  JSON.stringify(capturedUserVars)
2536
2579
  );
2537
- logger6.debug(
2580
+ logger7.debug(
2538
2581
  `[trace] Auto-captured variables from UserPromptContext: ${Object.keys(capturedUserVars).join(", ")}`
2539
2582
  );
2540
2583
  }
@@ -2551,13 +2594,13 @@ async function trace2(options, fn) {
2551
2594
  userPromptVariables,
2552
2595
  version,
2553
2596
  mask,
2597
+ sessionId: sessionIdOption,
2554
2598
  endUserId,
2555
2599
  endUserMetadata,
2556
2600
  attributes: explicitAttributes,
2557
2601
  ...extraOptions
2558
2602
  } = options;
2559
- const sessionConfig = getSessionConfig();
2560
- const sessionId = sessionConfig.sessionId;
2603
+ const sessionId = sessionIdOption ?? currentSessionId();
2561
2604
  const currentSpan = otelTrace2.getSpan(otelContext2.active());
2562
2605
  const isInActiveTrace = currentSpan !== void 0 && currentSpan.isRecording();
2563
2606
  const shouldCreateRootTrace = !!sessionId && !isInActiveTrace;
@@ -2568,7 +2611,7 @@ async function trace2(options, fn) {
2568
2611
  isPromptTemplateObj = true;
2569
2612
  const t = promptTemplate.template;
2570
2613
  templateString = typeof t === "string" ? t : JSON.stringify(t);
2571
- logger6.debug(
2614
+ logger7.debug(
2572
2615
  `[trace] Using PromptTemplate object with variables: ${promptTemplate.variables.join(", ")}`
2573
2616
  );
2574
2617
  } else if (typeof promptTemplate === "string") {
@@ -2585,7 +2628,7 @@ async function trace2(options, fn) {
2585
2628
  isUserPromptTemplateObj = true;
2586
2629
  const t = userPromptTemplate.template;
2587
2630
  userTemplateString = typeof t === "string" ? t : JSON.stringify(t);
2588
- logger6.debug(
2631
+ logger7.debug(
2589
2632
  `[trace] Using UserPromptTemplate object with variables: ${userPromptTemplate.variables.join(", ")}`
2590
2633
  );
2591
2634
  } else if (typeof userPromptTemplate === "string") {
@@ -2600,23 +2643,23 @@ async function trace2(options, fn) {
2600
2643
  const userVariablesJson = userPromptVariables ? JSON.stringify(userPromptVariables) : void 0;
2601
2644
  if (variablesJson) {
2602
2645
  ctx = ctx.setValue(PROMPT_VARIABLES_KEY, variablesJson);
2603
- logger6.debug(`[trace] Set neatlogs.prompt_variables in context: ${variablesJson}`);
2646
+ logger7.debug(`[trace] Set neatlogs.prompt_variables in context: ${variablesJson}`);
2604
2647
  }
2605
2648
  if (templateString) {
2606
2649
  ctx = ctx.setValue(PROMPT_TEMPLATE_KEY, templateString);
2607
- logger6.debug(`[trace] Set neatlogs.prompt_template in context: ${templateString}`);
2650
+ logger7.debug(`[trace] Set neatlogs.prompt_template in context: ${templateString}`);
2608
2651
  }
2609
2652
  if (userVariablesJson) {
2610
2653
  ctx = ctx.setValue(USER_PROMPT_VARIABLES_KEY, userVariablesJson);
2611
- logger6.debug(`[trace] Set neatlogs.user_prompt_variables in context: ${userVariablesJson}`);
2654
+ logger7.debug(`[trace] Set neatlogs.user_prompt_variables in context: ${userVariablesJson}`);
2612
2655
  }
2613
2656
  if (userTemplateString) {
2614
2657
  ctx = ctx.setValue(USER_PROMPT_TEMPLATE_KEY, userTemplateString);
2615
- logger6.debug(`[trace] Set neatlogs.user_prompt_template in context: ${userTemplateString}`);
2658
+ logger7.debug(`[trace] Set neatlogs.user_prompt_template in context: ${userTemplateString}`);
2616
2659
  }
2617
2660
  if (version) {
2618
2661
  ctx = ctx.setValue(PROMPT_VERSION_KEY, version);
2619
- logger6.debug(`[trace] Set neatlogs.prompt_version in context: ${version}`);
2662
+ logger7.debug(`[trace] Set neatlogs.prompt_version in context: ${version}`);
2620
2663
  }
2621
2664
  const extraAttributes = { ...explicitAttributes ?? {} };
2622
2665
  for (const [key, value] of Object.entries(extraOptions)) {
@@ -2628,6 +2671,7 @@ async function trace2(options, fn) {
2628
2671
  const tracer = otelTrace2.getTracer("neatlogs.trace");
2629
2672
  const spanCallback = async (span2) => {
2630
2673
  _setSpanAttributes(span2, kind, extraAttributes);
2674
+ applySessionAttributes(span2, sessionId, isRootTrace);
2631
2675
  applyEndUserAttributes(span2, endUserId, endUserMetadata, isRootTrace);
2632
2676
  if (input !== void 0 && input !== null) {
2633
2677
  span2.setAttribute("input.value", safeJsonDumps(serializeObj(input)));
@@ -2667,23 +2711,23 @@ async function trace2(options, fn) {
2667
2711
  }
2668
2712
  };
2669
2713
  if (shouldCreateRootTrace) {
2670
- logger6.debug(`[trace] Creating NEW root trace '${name}' (sessionId=${sessionId})`);
2714
+ logger7.debug(`[trace] Creating NEW root trace '${name}' (sessionId=${sessionId})`);
2671
2715
  return tracer.startActiveSpan(name, {}, ROOT_CONTEXT, spanCallback);
2672
2716
  } else {
2673
- logger6.debug(`[trace] Creating child span '${name}'`);
2717
+ logger7.debug(`[trace] Creating child span '${name}'`);
2674
2718
  return tracer.startActiveSpan(name, {}, ctx, spanCallback);
2675
2719
  }
2676
2720
  }
2677
2721
 
2678
2722
  // src/core/crewai-task-registry.ts
2679
- var logger7 = getLogger();
2723
+ var logger8 = getLogger();
2680
2724
  var _registry = /* @__PURE__ */ new Map();
2681
2725
  function registerCrewaiTask(task, userTpl, vars) {
2682
2726
  const taskId = String(task.id);
2683
2727
  const tplStr = String(userTpl.template);
2684
2728
  const varsJson = vars && Object.keys(vars).length > 0 ? JSON.stringify(vars, (_key, val) => typeof val === "undefined" ? null : val) : null;
2685
2729
  _registry.set(taskId, [tplStr, varsJson]);
2686
- logger7.debug(`Registered CrewAI task ${taskId}`);
2730
+ logger8.debug(`Registered CrewAI task ${taskId}`);
2687
2731
  }
2688
2732
  function popEntry(taskId) {
2689
2733
  const entry = _registry.get(taskId);
@@ -3825,7 +3869,7 @@ var attribute_mapping_default = {
3825
3869
  };
3826
3870
 
3827
3871
  // src/config/attribute-mapper.ts
3828
- var logger8 = getLogger();
3872
+ var logger9 = getLogger();
3829
3873
  function flattenSources(sources) {
3830
3874
  if (!sources) return [];
3831
3875
  if (Array.isArray(sources)) return sources;
@@ -4146,7 +4190,7 @@ var AttributeMapper = class {
4146
4190
  };
4147
4191
 
4148
4192
  // src/core/span-processor.ts
4149
- var logger9 = getLogger();
4193
+ var logger10 = getLogger();
4150
4194
  function resolveLogFilePath(configuredPath) {
4151
4195
  return path.isAbsolute(configuredPath) ? configuredPath : path.join(process.cwd(), configuredPath);
4152
4196
  }
@@ -4159,7 +4203,7 @@ function createLogStream(configuredPath) {
4159
4203
  const stream = fs.createWriteStream(logPath, { fd, autoClose: true });
4160
4204
  fd = null;
4161
4205
  stream.on("error", (error) => {
4162
- logger9.warn(`Failed to write span log file ${logPath}: ${error}`);
4206
+ logger10.warn(`Failed to write span log file ${logPath}: ${error}`);
4163
4207
  stream.destroy();
4164
4208
  });
4165
4209
  return stream;
@@ -4170,7 +4214,7 @@ function createLogStream(configuredPath) {
4170
4214
  } catch {
4171
4215
  }
4172
4216
  }
4173
- logger9.warn(`Failed to open span log file ${logPath}: ${error}`);
4217
+ logger10.warn(`Failed to open span log file ${logPath}: ${error}`);
4174
4218
  return null;
4175
4219
  }
4176
4220
  }
@@ -4179,7 +4223,7 @@ async function closeLogStream(stream, description) {
4179
4223
  if (!stream || stream.destroyed || stream.writableEnded) {
4180
4224
  return;
4181
4225
  }
4182
- await new Promise((resolve2) => {
4226
+ await new Promise((resolve) => {
4183
4227
  let settled = false;
4184
4228
  const settle = () => {
4185
4229
  if (settled) return;
@@ -4187,15 +4231,15 @@ async function closeLogStream(stream, description) {
4187
4231
  clearTimeout(timer);
4188
4232
  stream.off("close", closeHandler);
4189
4233
  stream.off("error", errorHandler);
4190
- resolve2();
4234
+ resolve();
4191
4235
  };
4192
4236
  const closeHandler = settle;
4193
4237
  const errorHandler = (error) => {
4194
- logger9.warn(`Failed to close ${description} log file handle: ${error}`);
4238
+ logger10.warn(`Failed to close ${description} log file handle: ${error}`);
4195
4239
  settle();
4196
4240
  };
4197
4241
  const timer = setTimeout(() => {
4198
- logger9.warn(
4242
+ logger10.warn(
4199
4243
  `Timed out waiting for ${description} log stream to close; destroying`
4200
4244
  );
4201
4245
  stream.destroy();
@@ -4206,7 +4250,7 @@ async function closeLogStream(stream, description) {
4206
4250
  try {
4207
4251
  stream.end();
4208
4252
  } catch (error) {
4209
- logger9.warn(`Failed to close ${description} log file handle: ${error}`);
4253
+ logger10.warn(`Failed to close ${description} log file handle: ${error}`);
4210
4254
  settle();
4211
4255
  }
4212
4256
  });
@@ -4285,7 +4329,7 @@ var NeatlogsSpanProcessor = class {
4285
4329
  const rawPath = process.env.NEATLOGS_LOG_RAW_SPANS_FILE ?? "spans_raw_optimized.log";
4286
4330
  this._rawLogStream = createLogStream(rawPath);
4287
4331
  if (this._rawLogStream) {
4288
- logger9.info(
4332
+ logger10.info(
4289
4333
  `Raw span logging enabled: ${resolveLogFilePath(rawPath)}`
4290
4334
  );
4291
4335
  }
@@ -4297,7 +4341,7 @@ var NeatlogsSpanProcessor = class {
4297
4341
  const processedPath = process.env.NEATLOGS_LOG_SPANS_FILE ?? "spans_optimized.log";
4298
4342
  this._processedLogStream = createLogStream(processedPath);
4299
4343
  if (this._processedLogStream) {
4300
- logger9.info(
4344
+ logger10.info(
4301
4345
  `Processed span logging enabled: ${resolveLogFilePath(processedPath)}`
4302
4346
  );
4303
4347
  }
@@ -4343,14 +4387,14 @@ var NeatlogsSpanProcessor = class {
4343
4387
  }
4344
4388
  }
4345
4389
  if (this.debug) {
4346
- logger9.debug(
4390
+ logger10.debug(
4347
4391
  `[SpanProcessor.onStart] LLM span '${spanName}' starting`
4348
4392
  );
4349
- logger9.debug(` variables_json from context: ${variablesJson}`);
4350
- logger9.debug(` template from context: ${template}`);
4351
- logger9.debug(` version from context: ${versionVal}`);
4352
- logger9.debug(` user_template from context: ${userTemplate}`);
4353
- logger9.debug(
4393
+ logger10.debug(` variables_json from context: ${variablesJson}`);
4394
+ logger10.debug(` template from context: ${template}`);
4395
+ logger10.debug(` version from context: ${versionVal}`);
4396
+ logger10.debug(` user_template from context: ${userTemplate}`);
4397
+ logger10.debug(
4354
4398
  ` user_variables_json from context: ${userVariablesJson}`
4355
4399
  );
4356
4400
  }
@@ -4385,7 +4429,7 @@ var NeatlogsSpanProcessor = class {
4385
4429
  this.perfStats.spansProcessed += 1;
4386
4430
  try {
4387
4431
  if (this.debug) {
4388
- logger9.debug(`[SpanProcessor.onEnd] Span ending: ${span2.name}`);
4432
+ logger10.debug(`[SpanProcessor.onEnd] Span ending: ${span2.name}`);
4389
4433
  }
4390
4434
  if (this._rawLogStream && !this._rawLogStream.destroyed) {
4391
4435
  try {
@@ -4393,7 +4437,7 @@ var NeatlogsSpanProcessor = class {
4393
4437
  JSON.stringify(spanToDict(span2)) + "\n"
4394
4438
  );
4395
4439
  } catch (e) {
4396
- logger9.warn(`Failed to write span to raw log file: ${e}`);
4440
+ logger10.warn(`Failed to write span to raw log file: ${e}`);
4397
4441
  }
4398
4442
  }
4399
4443
  if (this.sampleRate < 1 && Math.random() > this.sampleRate) {
@@ -4416,7 +4460,7 @@ var NeatlogsSpanProcessor = class {
4416
4460
  delete unifiedAttrs[key];
4417
4461
  }
4418
4462
  if (this.debug && keysToRemove.length > 0) {
4419
- logger9.debug(
4463
+ logger10.debug(
4420
4464
  `[EMBEDDING Filter] Removed ${keysToRemove.length} large attribute keys from ${nlKind} span (skip_output=${skipOutput})`
4421
4465
  );
4422
4466
  }
@@ -4443,7 +4487,7 @@ var NeatlogsSpanProcessor = class {
4443
4487
  this._retrieversToSuppress.delete(spanId2);
4444
4488
  unifiedAttrs["neatlogs.internal"] = true;
4445
4489
  if (this.debug) {
4446
- logger9.debug(
4490
+ logger10.debug(
4447
4491
  `[Retriever Merge] Marked OI retriever '${span2.name}' as internal (had neatlogs retriever child)`
4448
4492
  );
4449
4493
  }
@@ -4461,7 +4505,7 @@ var NeatlogsSpanProcessor = class {
4461
4505
  }
4462
4506
  }
4463
4507
  if (this.debug && "neatlogs.tags" in resourceAttrs) {
4464
- logger9.debug(
4508
+ logger10.debug(
4465
4509
  `[Tags] Span ${span2.name}: resource.neatlogs.tags = ${resourceAttrs["neatlogs.tags"]}`
4466
4510
  );
4467
4511
  }
@@ -4471,7 +4515,7 @@ var NeatlogsSpanProcessor = class {
4471
4515
  let parentSpanId = span2.parentSpanId ?? null;
4472
4516
  if (parentSpanId === spanId) {
4473
4517
  if (this.debug) {
4474
- logger9.warn(
4518
+ logger10.warn(
4475
4519
  `[SpanProcessor] Detected self-parenting span. trace_id=${traceId} span_id=${spanId} name=${span2.name}. Setting parent_span_id=None.`
4476
4520
  );
4477
4521
  }
@@ -4534,7 +4578,7 @@ var NeatlogsSpanProcessor = class {
4534
4578
  }
4535
4579
  } catch (wbExc) {
4536
4580
  if (this.debug) {
4537
- logger9.debug(
4581
+ logger10.debug(
4538
4582
  `[SpanProcessor] Attr write-back failed: ${wbExc}`
4539
4583
  );
4540
4584
  }
@@ -4545,7 +4589,7 @@ var NeatlogsSpanProcessor = class {
4545
4589
  JSON.stringify(spanData) + "\n"
4546
4590
  );
4547
4591
  } catch (e) {
4548
- logger9.warn(`Failed to write span to processed log file: ${e}`);
4592
+ logger10.warn(`Failed to write span to processed log file: ${e}`);
4549
4593
  }
4550
4594
  }
4551
4595
  this.perfStats.spansExported += 1;
@@ -4577,12 +4621,12 @@ var NeatlogsSpanProcessor = class {
4577
4621
  }
4578
4622
  marker.end();
4579
4623
  if (this.debug) {
4580
- logger9.debug(
4624
+ logger10.debug(
4581
4625
  `[SpanProcessor] Emitted completion marker for trace ${traceId}`
4582
4626
  );
4583
4627
  }
4584
4628
  } catch (e) {
4585
- logger9.warn(`[SpanProcessor] Failed to emit completion marker: ${e}`);
4629
+ logger10.warn(`[SpanProcessor] Failed to emit completion marker: ${e}`);
4586
4630
  }
4587
4631
  }
4588
4632
  // ── Framework span name normalization ─────────────────
@@ -4649,7 +4693,7 @@ var NeatlogsSpanProcessor = class {
4649
4693
  if (respMeta?.model_name && respMeta.model_name !== currentModel) {
4650
4694
  attrs["neatlogs.llm.model_name"] = respMeta.model_name;
4651
4695
  if (this.debug) {
4652
- logger9.debug(
4696
+ logger10.debug(
4653
4697
  `[ModelResolve] LangChain span: ${currentModel} \u2192 ${respMeta.model_name}`
4654
4698
  );
4655
4699
  }
@@ -4659,13 +4703,13 @@ var NeatlogsSpanProcessor = class {
4659
4703
  if (output?.model && output.model !== currentModel) {
4660
4704
  attrs["neatlogs.llm.model_name"] = output.model;
4661
4705
  if (this.debug) {
4662
- logger9.debug(
4706
+ logger10.debug(
4663
4707
  `[ModelResolve] Direct response: ${currentModel} \u2192 ${output.model}`
4664
4708
  );
4665
4709
  }
4666
4710
  }
4667
4711
  } catch (e) {
4668
- logger9.warn(`[ModelResolve] Failed to parse LLM output for model extraction: ${e}`);
4712
+ logger10.warn(`[ModelResolve] Failed to parse LLM output for model extraction: ${e}`);
4669
4713
  }
4670
4714
  }
4671
4715
  // ── forceFlush / shutdown ─────────────────────────────
@@ -4686,7 +4730,7 @@ var NeatlogsSpanProcessor = class {
4686
4730
  const totalTime = stats.onStartTime + stats.onEndTime;
4687
4731
  const avgMs = totalTime / stats.spansProcessed;
4688
4732
  try {
4689
- logger9.info(
4733
+ logger10.info(
4690
4734
  `Neatlogs overhead: ${totalTime.toFixed(2)}ms total, ${avgMs.toFixed(3)}ms/span (${stats.spansProcessed} spans processed, ${stats.spansExported} spans logged)`
4691
4735
  );
4692
4736
  } catch {
@@ -4727,187 +4771,9 @@ var FilteringExporter = class {
4727
4771
  }
4728
4772
  };
4729
4773
 
4730
- // src/core/exporter.ts
4731
- var logger10 = getLogger();
4732
- var NeatlogsExporter = class {
4733
- baseUrl;
4734
- apiKey;
4735
- batchSize;
4736
- flushIntervalMs;
4737
- disableExport;
4738
- buffer = [];
4739
- flushTimer = null;
4740
- _shutdown = false;
4741
- constructor(options) {
4742
- this.baseUrl = options.baseUrl.replace(/\/$/, "");
4743
- this.apiKey = options.apiKey;
4744
- this.batchSize = options.batchSize ?? 50;
4745
- this.flushIntervalMs = options.flushIntervalMs ?? 5e3;
4746
- this.disableExport = options.disableExport ?? false;
4747
- if (!this.disableExport) {
4748
- this.flushTimer = setInterval(() => this.flush(), this.flushIntervalMs);
4749
- if (this.flushTimer.unref) {
4750
- this.flushTimer.unref();
4751
- }
4752
- }
4753
- }
4754
- /** Add a span-like dict to the buffer. */
4755
- export(spanData) {
4756
- if (this._shutdown || this.disableExport) return;
4757
- this.buffer.push(spanData);
4758
- if (this.buffer.length >= this.batchSize) {
4759
- this.flush().catch((err) => {
4760
- logger10.warn(`Failed to flush batch: ${err}`);
4761
- });
4762
- }
4763
- }
4764
- /** Flush all buffered spans to the API. */
4765
- async flush() {
4766
- if (this.disableExport || this.buffer.length === 0) return;
4767
- const batch = this.buffer.splice(0, this.buffer.length);
4768
- try {
4769
- const url = `${this.baseUrl}/api/data/v4/batch`;
4770
- const response = await fetch(url, {
4771
- method: "POST",
4772
- headers: {
4773
- "Content-Type": "application/json",
4774
- "x-api-key": this.apiKey
4775
- },
4776
- body: JSON.stringify({ spans: batch })
4777
- });
4778
- if (!response.ok) {
4779
- logger10.warn(
4780
- `Failed to export batch: ${response.status} ${response.statusText}`
4781
- );
4782
- this._requeueBatch(batch);
4783
- } else {
4784
- logger10.debug(`Exported ${batch.length} log spans`);
4785
- }
4786
- } catch (err) {
4787
- logger10.warn(`Failed to export batch: ${err}`);
4788
- this._requeueBatch(batch);
4789
- }
4790
- }
4791
- /** Re-insert a failed batch into the buffer for retry, up to a limit. */
4792
- _requeueBatch(batch) {
4793
- if (this.buffer.length < this.batchSize * 3) {
4794
- this.buffer.unshift(...batch);
4795
- }
4796
- }
4797
- /** Shutdown the exporter, flushing remaining items. */
4798
- async shutdown() {
4799
- this._shutdown = true;
4800
- if (this.flushTimer) {
4801
- clearInterval(this.flushTimer);
4802
- this.flushTimer = null;
4803
- }
4804
- await this.flush();
4805
- }
4806
- };
4807
-
4808
- // src/core/log-exporter.ts
4809
- import * as crypto from "crypto";
4810
- import * as fs2 from "fs";
4811
- import * as path2 from "path";
4812
-
4813
- // node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
4814
- import { createContextKey as createContextKey2 } from "@opentelemetry/api";
4815
- var SUPPRESS_TRACING_KEY = createContextKey2("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
4816
- function suppressTracing(context3) {
4817
- return context3.setValue(SUPPRESS_TRACING_KEY, true);
4818
- }
4819
-
4820
- // node_modules/@opentelemetry/core/build/esm/ExportResult.js
4821
- var ExportResultCode;
4822
- (function(ExportResultCode2) {
4823
- ExportResultCode2[ExportResultCode2["SUCCESS"] = 0] = "SUCCESS";
4824
- ExportResultCode2[ExportResultCode2["FAILED"] = 1] = "FAILED";
4825
- })(ExportResultCode || (ExportResultCode = {}));
4826
-
4827
- // src/core/log-exporter.ts
4828
- var logger11 = getLogger();
4829
- var NeatlogsLogExporter = class {
4830
- exporter;
4831
- logFileHandle = null;
4832
- logEnabled;
4833
- constructor(exporter) {
4834
- this.exporter = exporter;
4835
- this.logEnabled = ["1", "true", "yes"].includes(
4836
- (process.env.NEATLOGS_LOG_LOGS ?? "").toLowerCase()
4837
- );
4838
- const logFile = process.env.NEATLOGS_LOG_LOGS_FILE ?? "";
4839
- if (this.logEnabled && logFile) {
4840
- const filePath = path2.resolve(process.cwd(), logFile);
4841
- try {
4842
- this.logFileHandle = fs2.openSync(filePath, "a");
4843
- logger11.info(`Log record logging enabled: ${filePath}`);
4844
- } catch (err) {
4845
- logger11.warn(`Failed to open log file ${filePath}: ${err}`);
4846
- }
4847
- }
4848
- }
4849
- export(logRecords, resultCallback) {
4850
- try {
4851
- for (const record of logRecords) {
4852
- const spanDict = this._convertLogRecord(record);
4853
- this.exporter.export(spanDict);
4854
- this._writeToFile(record, spanDict);
4855
- }
4856
- resultCallback({ code: ExportResultCode.SUCCESS });
4857
- } catch (err) {
4858
- logger11.warn(`Failed to export log records: ${err}`);
4859
- resultCallback({ code: ExportResultCode.FAILED });
4860
- }
4861
- }
4862
- async shutdown() {
4863
- if (this.logFileHandle !== null) {
4864
- fs2.closeSync(this.logFileHandle);
4865
- this.logFileHandle = null;
4866
- }
4867
- }
4868
- async forceFlush() {
4869
- await this.exporter.flush();
4870
- }
4871
- _writeToFile(record, spanDict) {
4872
- if (!this.logEnabled || this.logFileHandle === null) return;
4873
- const entry = {
4874
- trace_id: spanDict.trace_id || "",
4875
- span_id: spanDict.span_id || "",
4876
- body: spanDict.attributes?.["log.message"] ?? "",
4877
- severity: record.severityText ?? "",
4878
- template: spanDict.attributes?.["log.template"] ?? "",
4879
- timestamp: spanDict.start_time
4880
- };
4881
- fs2.writeSync(this.logFileHandle, JSON.stringify(entry) + "\n");
4882
- }
4883
- _convertLogRecord(record) {
4884
- const attributes = { ...record.attributes ?? {} };
4885
- if (record.body !== void 0 && record.body !== null) {
4886
- attributes["log.message"] = String(record.body);
4887
- }
4888
- attributes["openinference.span.kind"] = "LOG";
4889
- attributes["neatlogs.span.kind"] = "log";
4890
- return {
4891
- name: attributes["log.template"] ?? "log",
4892
- kind: "LOG",
4893
- trace_id: record.spanContext?.traceId ?? "",
4894
- span_id: crypto.randomBytes(8).toString("hex"),
4895
- parent_span_id: record.spanContext?.spanId ?? "",
4896
- start_time: record.hrTime ? this._hrTimeToIso(record.hrTime) : (/* @__PURE__ */ new Date()).toISOString(),
4897
- end_time: record.hrTime ? this._hrTimeToIso(record.hrTime) : (/* @__PURE__ */ new Date()).toISOString(),
4898
- status: "OK",
4899
- attributes
4900
- };
4901
- }
4902
- _hrTimeToIso(hrTime) {
4903
- const ms = hrTime[0] * 1e3 + hrTime[1] / 1e6;
4904
- return new Date(ms).toISOString();
4905
- }
4906
- };
4907
-
4908
4774
  // src/core/log.ts
4909
4775
  import { context, trace as trace3 } from "@opentelemetry/api";
4910
- var logger12 = getLogger();
4776
+ var logger11 = getLogger();
4911
4777
  var _otelLogger = null;
4912
4778
  var _debugMode = false;
4913
4779
  function _setOtelLogger(otelLogger, debug) {
@@ -4940,7 +4806,7 @@ function log(msgTemplate, options) {
4940
4806
  ...spanContext ? { spanContext } : {}
4941
4807
  });
4942
4808
  } catch (err) {
4943
- logger12.warn(`Failed to emit log record: ${err}`);
4809
+ logger11.warn(`Failed to emit log record: ${err}`);
4944
4810
  }
4945
4811
  }
4946
4812
  }
@@ -5369,7 +5235,7 @@ function getLibraryInfo(library) {
5369
5235
  }
5370
5236
 
5371
5237
  // src/instrumentation/manager.ts
5372
- var logger13 = getLogger();
5238
+ var logger12 = getLogger();
5373
5239
  var InstrumentationManager = class {
5374
5240
  provider;
5375
5241
  _instrumented = [];
@@ -5388,7 +5254,7 @@ var InstrumentationManager = class {
5388
5254
  for (const lib of libraries) {
5389
5255
  const info = getLibraryInfo(lib);
5390
5256
  if (!info) {
5391
- logger13.warn(
5257
+ logger12.warn(
5392
5258
  `Unknown library '${lib}' \u2014 not in instrumentation registry. Skipping.`
5393
5259
  );
5394
5260
  continue;
@@ -5404,7 +5270,7 @@ var InstrumentationManager = class {
5404
5270
  if (typeof instrumentor.instrument === "function") {
5405
5271
  instrumentor.instrument({ tracerProvider: this.provider });
5406
5272
  this._instrumented.push(lib);
5407
- logger13.debug(
5273
+ logger12.debug(
5408
5274
  `Instrumented '${lib}' via neatlogs custom instrumentor`
5409
5275
  );
5410
5276
  continue;
@@ -5417,23 +5283,23 @@ var InstrumentationManager = class {
5417
5283
  const targetMod = await import(info.npm_package);
5418
5284
  instrumentor.patchEager(targetMod);
5419
5285
  } catch (e) {
5420
- logger13.debug(
5286
+ logger12.debug(
5421
5287
  `Eager patch for '${lib}' skipped \u2014 ${info.npm_package} not available: ${e}`
5422
5288
  );
5423
5289
  }
5424
5290
  }
5425
5291
  this._instrumented.push(lib);
5426
- logger13.debug(
5292
+ logger12.debug(
5427
5293
  `Instrumented '${lib}' via neatlogs OTel instrumentor`
5428
5294
  );
5429
5295
  continue;
5430
5296
  }
5431
5297
  }
5432
- logger13.debug(
5298
+ logger12.debug(
5433
5299
  `neatlogs instrumentor for '${lib}' loaded but has no instrument() method \u2014 trying OpenInference`
5434
5300
  );
5435
5301
  } catch (err) {
5436
- logger13.debug(
5302
+ logger12.debug(
5437
5303
  `neatlogs instrumentor for '${lib}' failed to load: ${err} \u2014 trying OpenInference`
5438
5304
  );
5439
5305
  }
@@ -5449,7 +5315,7 @@ var InstrumentationManager = class {
5449
5315
  if (typeof instrumentor.instrument === "function") {
5450
5316
  instrumentor.instrument({ tracerProvider: this.provider });
5451
5317
  this._instrumented.push(lib);
5452
- logger13.debug(`Instrumented '${lib}' via OpenInference`);
5318
+ logger12.debug(`Instrumented '${lib}' via OpenInference`);
5453
5319
  continue;
5454
5320
  }
5455
5321
  if (typeof instrumentor.setTracerProvider === "function" && typeof instrumentor.manuallyInstrument === "function") {
@@ -5459,16 +5325,16 @@ var InstrumentationManager = class {
5459
5325
  const targetMod = await import(info.npm_package);
5460
5326
  instrumentor.manuallyInstrument(targetMod);
5461
5327
  this._instrumented.push(lib);
5462
- logger13.debug(`Instrumented '${lib}' via OpenInference (manual patch)`);
5328
+ logger12.debug(`Instrumented '${lib}' via OpenInference (manual patch)`);
5463
5329
  continue;
5464
5330
  } catch (importErr) {
5465
- logger13.debug(
5331
+ logger12.debug(
5466
5332
  `Could not import '${info.npm_package}' for manual instrumentation of '${lib}': ${importErr}`
5467
5333
  );
5468
5334
  }
5469
5335
  }
5470
5336
  this._instrumented.push(lib);
5471
- logger13.debug(`Instrumented '${lib}' via OpenInference (tracer set, awaiting module hook)`);
5337
+ logger12.debug(`Instrumented '${lib}' via OpenInference (tracer set, awaiting module hook)`);
5472
5338
  continue;
5473
5339
  }
5474
5340
  }
@@ -5477,32 +5343,41 @@ var InstrumentationManager = class {
5477
5343
  tracerProvider: this.provider
5478
5344
  });
5479
5345
  this._instrumented.push(lib);
5480
- logger13.debug(`Instrumented '${lib}' via OpenInference`);
5346
+ logger12.debug(`Instrumented '${lib}' via OpenInference`);
5481
5347
  continue;
5482
5348
  }
5483
- logger13.warn(
5349
+ logger12.warn(
5484
5350
  `OpenInference package for '${lib}' loaded but could not find instrumentor class`
5485
5351
  );
5486
5352
  } catch (err) {
5487
- logger13.debug(
5353
+ logger12.debug(
5488
5354
  `OpenInference instrumentor for '${lib}' not available: ${err}`
5489
5355
  );
5490
5356
  }
5491
5357
  }
5492
5358
  if (!info.openinference && !info.neatlogs) {
5493
- logger13.debug(
5359
+ logger12.debug(
5494
5360
  `'${lib}' instrumentation not yet available for TypeScript \u2014 skipping`
5495
5361
  );
5496
5362
  }
5497
5363
  }
5498
5364
  if (this._instrumented.length > 0) {
5499
- logger13.info(`Instrumented: ${this._instrumented.join(", ")}`);
5365
+ logger12.info(`Instrumented: ${this._instrumented.join(", ")}`);
5500
5366
  }
5501
5367
  }
5502
5368
  };
5503
5369
 
5504
5370
  // src/prompt/client.ts
5505
5371
  import { context as context2 } from "@opentelemetry/api";
5372
+
5373
+ // node_modules/@opentelemetry/core/build/esm/trace/suppress-tracing.js
5374
+ import { createContextKey as createContextKey2 } from "@opentelemetry/api";
5375
+ var SUPPRESS_TRACING_KEY = createContextKey2("OpenTelemetry SDK Context Key SUPPRESS_TRACING");
5376
+ function suppressTracing(context3) {
5377
+ return context3.setValue(SUPPRESS_TRACING_KEY, true);
5378
+ }
5379
+
5380
+ // src/prompt/client.ts
5506
5381
  var PromptClientError = class extends Error {
5507
5382
  constructor(message) {
5508
5383
  super(message);
@@ -5691,8 +5566,8 @@ var PromptClient = class {
5691
5566
  const version = options?.version;
5692
5567
  const label = options?.label;
5693
5568
  if (label != null) {
5694
- const path4 = `/api/v1/prompts/${encodeURIComponent(name)}/fetch`;
5695
- const url = `${path4}?label=${encodeURIComponent(label)}`;
5569
+ const path3 = `/api/v1/prompts/${encodeURIComponent(name)}/fetch`;
5570
+ const url = `${path3}?label=${encodeURIComponent(label)}`;
5696
5571
  const payload = await this._request(url);
5697
5572
  return new PromptHandle(normalizePromptObject(payload));
5698
5573
  }
@@ -5796,8 +5671,8 @@ var PromptClient = class {
5796
5671
  /**
5797
5672
  * Internal fetch wrapper with auth headers and OTel suppression.
5798
5673
  */
5799
- async _request(path4, options) {
5800
- const url = `${this.baseUrl}${path4}`;
5674
+ async _request(path3, options) {
5675
+ const url = `${this.baseUrl}${path3}`;
5801
5676
  const headers = {
5802
5677
  Accept: "application/json",
5803
5678
  "Content-Type": "application/json",
@@ -5820,13 +5695,13 @@ var PromptClient = class {
5820
5695
  if (!response.ok) {
5821
5696
  const body = await response.text().catch(() => "<unavailable>");
5822
5697
  throw new PromptApiError(
5823
- `${fetchOptions.method} ${path4} failed (${response.status}): ${body.slice(0, 400)}`
5698
+ `${fetchOptions.method} ${path3} failed (${response.status}): ${body.slice(0, 400)}`
5824
5699
  );
5825
5700
  }
5826
5701
  try {
5827
5702
  return await response.json();
5828
5703
  } catch {
5829
- throw new PromptApiError(`${fetchOptions.method} ${path4} returned non-JSON response`);
5704
+ throw new PromptApiError(`${fetchOptions.method} ${path3} returned non-JSON response`);
5830
5705
  }
5831
5706
  }
5832
5707
  };
@@ -5868,15 +5743,14 @@ async function removeTag(name, tag) {
5868
5743
  }
5869
5744
 
5870
5745
  // src/version.ts
5871
- var __version__ = "1.1.0";
5746
+ var __version__ = "1.1.2";
5872
5747
 
5873
5748
  // src/init.ts
5874
- var logger14 = getLogger();
5749
+ var logger13 = getLogger();
5875
5750
  var _initialized = false;
5876
5751
  var _tracerProvider = null;
5877
5752
  var _meterProvider = null;
5878
5753
  var _logProvider = null;
5879
- var _logSpanExporter = null;
5880
5754
  var _spanProcessor = null;
5881
5755
  var _debugMode2 = false;
5882
5756
  var _sigHandlersRegistered = false;
@@ -5888,19 +5762,16 @@ function _resolveWorkflowName(workflowName) {
5888
5762
  const provided = (workflowName ?? "").trim();
5889
5763
  if (provided) return provided;
5890
5764
  const argv1 = process.argv[1] ?? "";
5891
- const base = path3.basename(argv1, path3.extname(argv1));
5765
+ const base = path2.basename(argv1, path2.extname(argv1));
5892
5766
  const slug = base.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase();
5893
5767
  if (slug && !["node", "ts-node", "tsx", "npx", "-e"].includes(slug)) {
5894
5768
  return slug;
5895
5769
  }
5896
5770
  return "neatlogs-app";
5897
5771
  }
5898
- function _randomHex(bytes) {
5899
- return randomBytes2(bytes).toString("hex");
5900
- }
5901
5772
  async function init(options = {}) {
5902
5773
  if (_initialized) {
5903
- logger14.warn("Neatlogs already initialized, skipping re-initialization");
5774
+ logger13.warn("Neatlogs already initialized, skipping re-initialization");
5904
5775
  return;
5905
5776
  }
5906
5777
  let resolvedKey;
@@ -5916,7 +5787,7 @@ async function init(options = {}) {
5916
5787
  disableExportResolved = true;
5917
5788
  resolvedKey = "disabled";
5918
5789
  if (options.debug) {
5919
- logger14.warn(
5790
+ logger13.warn(
5920
5791
  "No NEATLOGS_API_KEY set; HTTP export disabled. Set NEATLOGS_API_KEY (or pass apiKey) to send spans to the backend."
5921
5792
  );
5922
5793
  }
@@ -5926,17 +5797,9 @@ async function init(options = {}) {
5926
5797
  }
5927
5798
  _debugMode2 = options.debug ?? false;
5928
5799
  const resolvedWorkflowName = _resolveWorkflowName(options.workflowName);
5929
- let sessionId = options.sessionId;
5930
- if (!sessionId && options.autoSession) {
5931
- sessionId = `session_${Date.now()}_${_randomHex(4)}`;
5932
- if (options.debug) {
5933
- logger14.debug(`Auto-generated session_id: ${sessionId}`);
5934
- }
5935
- }
5936
- const endpoint = options.endpoint ?? "https://staging-cloud.neatlogs.com";
5800
+ const endpoint = options.endpoint ?? "https://ingest.neatlogs.com";
5937
5801
  const baseUrl = new URL(endpoint).origin;
5938
5802
  _setSessionConfig({
5939
- sessionId,
5940
5803
  userId: options.userId,
5941
5804
  workflowName: resolvedWorkflowName,
5942
5805
  _apiKey: resolvedKey,
@@ -5950,15 +5813,7 @@ async function init(options = {}) {
5950
5813
  "service.version": __version__,
5951
5814
  "neatlogs.workflow_name": resolvedWorkflowName
5952
5815
  };
5953
- if (sessionId) resourceAttrs["session.id"] = sessionId;
5954
5816
  if (options.userId) resourceAttrs["user.id"] = options.userId;
5955
- if (options.endUserId) {
5956
- resourceAttrs[END_USER_ID_KEY] = String(options.endUserId);
5957
- }
5958
- if (options.endUserMetadata) {
5959
- const euMeta = normalizeEndUserMetadata(options.endUserMetadata);
5960
- if (euMeta) resourceAttrs[END_USER_METADATA_KEY] = euMeta;
5961
- }
5962
5817
  const tags = options.tags;
5963
5818
  if (tags !== void 0) {
5964
5819
  if (!Array.isArray(tags) || !tags.every((t) => typeof t === "string")) {
@@ -5997,40 +5852,30 @@ async function init(options = {}) {
5997
5852
  });
5998
5853
  provider.addSpanProcessor(batchProcessor);
5999
5854
  if (options.debug) {
6000
- logger14.debug(`OTLP trace exporter configured: ${tracesEndpoint}`);
5855
+ logger13.debug(`OTLP trace exporter configured: ${tracesEndpoint}`);
6001
5856
  }
6002
5857
  } else if (options.debug) {
6003
- logger14.debug("Export disabled \u2014 spans will not be sent to backend");
5858
+ logger13.debug("Export disabled \u2014 spans will not be sent to backend");
6004
5859
  }
6005
5860
  provider.register();
6006
5861
  _tracerProvider = provider;
6007
5862
  if (options.debug) {
6008
- logger14.debug("Neatlogs tracer provider initialized");
5863
+ logger13.debug("Neatlogs tracer provider initialized");
6009
5864
  }
6010
5865
  try {
6011
5866
  _meterProvider = new MeterProvider({ resource });
6012
5867
  metrics.setGlobalMeterProvider(_meterProvider);
6013
5868
  if (options.debug) {
6014
- logger14.debug("Neatlogs meter provider initialized");
5869
+ logger13.debug("Neatlogs meter provider initialized");
6015
5870
  }
6016
5871
  } catch {
6017
5872
  if (options.debug) {
6018
- logger14.debug("MeterProvider not available \u2014 skipping");
5873
+ logger13.debug("MeterProvider not available \u2014 skipping");
6019
5874
  }
6020
5875
  }
6021
5876
  const captureLogs = options.captureLogs ?? false;
6022
5877
  if (captureLogs) {
6023
- _logSpanExporter = new NeatlogsExporter({
6024
- baseUrl,
6025
- apiKey: resolvedKey,
6026
- batchSize: options.batchSize ?? 100,
6027
- flushIntervalMs: (options.flushInterval ?? 5) * 1e3,
6028
- disableExport: disableExportResolved
6029
- });
6030
5878
  _logProvider = new LoggerProvider({ resource });
6031
- _logProvider.addLogRecordProcessor(
6032
- new SimpleLogRecordProcessor(new NeatlogsLogExporter(_logSpanExporter))
6033
- );
6034
5879
  if (!disableExportResolved) {
6035
5880
  const logsEndpoint = endpoint.endsWith("/v1/logs") ? endpoint : `${baseUrl}/v1/logs`;
6036
5881
  const otlpLogExporter = new OTLPLogExporter({
@@ -6038,20 +5883,23 @@ async function init(options = {}) {
6038
5883
  headers: resolvedKey ? { "x-api-key": resolvedKey } : void 0
6039
5884
  });
6040
5885
  _logProvider.addLogRecordProcessor(
6041
- new BatchLogRecordProcessor(otlpLogExporter)
5886
+ new BatchLogRecordProcessor(otlpLogExporter, {
5887
+ maxExportBatchSize: options.batchSize ?? 100,
5888
+ scheduledDelayMillis: (options.flushInterval ?? 5) * 1e3
5889
+ })
6042
5890
  );
6043
5891
  if (options.debug) {
6044
- logger14.debug(`OTLP log exporter configured: ${logsEndpoint}`);
5892
+ logger13.debug(`OTLP log exporter configured: ${logsEndpoint}`);
6045
5893
  }
6046
5894
  }
6047
5895
  logs.setGlobalLoggerProvider(_logProvider);
6048
5896
  const otelLogger = _logProvider.getLogger("neatlogs");
6049
5897
  _setOtelLogger(otelLogger, options.debug ?? false);
6050
5898
  if (options.debug) {
6051
- logger14.debug(`Neatlogs log capture enabled (endpoint: ${baseUrl}/v1/logs)`);
5899
+ logger13.debug(`Neatlogs log capture enabled (endpoint: ${baseUrl}/v1/logs)`);
6052
5900
  }
6053
5901
  } else if (options.debug) {
6054
- logger14.debug("Log capture disabled (pass captureLogs: true to enable)");
5902
+ logger13.debug("Log capture disabled (pass captureLogs: true to enable)");
6055
5903
  }
6056
5904
  const manager = new InstrumentationManager({
6057
5905
  provider,
@@ -6060,7 +5908,7 @@ async function init(options = {}) {
6060
5908
  if (options.instrumentations?.length) {
6061
5909
  await manager.instrument(options.instrumentations);
6062
5910
  if (options.debug) {
6063
- logger14.debug(`Instrumented libraries: ${manager.instrumented.join(", ")}`);
5911
+ logger13.debug(`Instrumented libraries: ${manager.instrumented.join(", ")}`);
6064
5912
  }
6065
5913
  }
6066
5914
  if (!_sigHandlersRegistered) {
@@ -6071,45 +5919,44 @@ async function init(options = {}) {
6071
5919
  }
6072
5920
  _initialized = true;
6073
5921
  if (options.debug) {
6074
- logger14.info("Neatlogs SDK initialized successfully");
6075
- logger14.info(`Endpoint: ${endpoint}`);
6076
- logger14.info(`Workflow: ${resolvedWorkflowName}`);
6077
- logger14.info(`Session: ${sessionId ?? "(none)"}`);
6078
- logger14.info(`User: ${options.userId ?? "(none)"}`);
6079
- logger14.info(`Tags: ${tags ?? []}`);
6080
- logger14.info(`Instrumentations: ${manager.instrumented.join(", ") || "(none)"}`);
6081
- logger14.info(`Sample Rate: ${options.sampleRate ?? 1}`);
5922
+ logger13.info("Neatlogs SDK initialized successfully");
5923
+ logger13.info(`Endpoint: ${endpoint}`);
5924
+ logger13.info(`Workflow: ${resolvedWorkflowName}`);
5925
+ logger13.info(`User: ${options.userId ?? "(none)"}`);
5926
+ logger13.info(`Tags: ${tags ?? []}`);
5927
+ logger13.info(`Instrumentations: ${manager.instrumented.join(", ") || "(none)"}`);
5928
+ logger13.info(`Sample Rate: ${options.sampleRate ?? 1}`);
6082
5929
  }
6083
5930
  }
6084
5931
  async function flush() {
6085
5932
  let success = true;
6086
5933
  if (_tracerProvider) {
6087
5934
  try {
6088
- logger14.debug("Flushing tracer provider...");
5935
+ logger13.debug("Flushing tracer provider...");
6089
5936
  await _tracerProvider.forceFlush();
6090
- logger14.debug("Tracer provider flushed successfully");
5937
+ logger13.debug("Tracer provider flushed successfully");
6091
5938
  } catch (e) {
6092
- logger14.error(`Error flushing spans: ${e}`);
5939
+ logger13.error(`Error flushing spans: ${e}`);
6093
5940
  success = false;
6094
5941
  }
6095
5942
  }
6096
5943
  if (_meterProvider) {
6097
5944
  try {
6098
- logger14.debug("Flushing meter provider...");
5945
+ logger13.debug("Flushing meter provider...");
6099
5946
  await _meterProvider.forceFlush();
6100
- logger14.debug("Meter provider flushed successfully");
5947
+ logger13.debug("Meter provider flushed successfully");
6101
5948
  } catch (e) {
6102
- logger14.error(`Error flushing metrics: ${e}`);
5949
+ logger13.error(`Error flushing metrics: ${e}`);
6103
5950
  success = false;
6104
5951
  }
6105
5952
  }
6106
- if (_logSpanExporter) {
5953
+ if (_logProvider) {
6107
5954
  try {
6108
- logger14.debug("Flushing log span exporter...");
6109
- await _logSpanExporter.flush();
6110
- logger14.debug("Log span exporter flushed successfully");
5955
+ logger13.debug("Flushing log provider...");
5956
+ await _logProvider.forceFlush();
5957
+ logger13.debug("Log provider flushed successfully");
6111
5958
  } catch (e) {
6112
- logger14.error(`Error flushing logs: ${e}`);
5959
+ logger13.error(`Error flushing logs: ${e}`);
6113
5960
  success = false;
6114
5961
  }
6115
5962
  }
@@ -6125,41 +5972,31 @@ async function shutdown() {
6125
5972
  let success = true;
6126
5973
  if (_tracerProvider) {
6127
5974
  try {
6128
- logger14.debug("Shutting down tracer provider...");
5975
+ logger13.debug("Shutting down tracer provider...");
6129
5976
  await _tracerProvider.shutdown();
6130
- logger14.debug("Tracer provider shut down successfully");
5977
+ logger13.debug("Tracer provider shut down successfully");
6131
5978
  } catch (e) {
6132
- logger14.error(`Error shutting down tracer provider: ${e}`);
5979
+ logger13.error(`Error shutting down tracer provider: ${e}`);
6133
5980
  success = false;
6134
5981
  }
6135
5982
  }
6136
5983
  if (_meterProvider) {
6137
5984
  try {
6138
- logger14.debug("Shutting down meter provider...");
5985
+ logger13.debug("Shutting down meter provider...");
6139
5986
  await _meterProvider.shutdown();
6140
- logger14.debug("Meter provider shut down successfully");
5987
+ logger13.debug("Meter provider shut down successfully");
6141
5988
  } catch (e) {
6142
- logger14.error(`Error shutting down meter provider: ${e}`);
5989
+ logger13.error(`Error shutting down meter provider: ${e}`);
6143
5990
  success = false;
6144
5991
  }
6145
5992
  }
6146
5993
  if (_logProvider) {
6147
5994
  try {
6148
- logger14.debug("Shutting down log provider...");
5995
+ logger13.debug("Shutting down log provider...");
6149
5996
  await _logProvider.shutdown();
6150
- logger14.debug("Log provider shut down successfully");
6151
- } catch (e) {
6152
- logger14.error(`Error shutting down log provider: ${e}`);
6153
- success = false;
6154
- }
6155
- }
6156
- if (_logSpanExporter) {
6157
- try {
6158
- logger14.debug("Shutting down log span exporter...");
6159
- await _logSpanExporter.shutdown();
6160
- logger14.debug("Log span exporter shut down successfully");
5997
+ logger13.debug("Log provider shut down successfully");
6161
5998
  } catch (e) {
6162
- logger14.error(`Error shutting down log span exporter: ${e}`);
5999
+ logger13.error(`Error shutting down log provider: ${e}`);
6163
6000
  success = false;
6164
6001
  }
6165
6002
  }
@@ -6167,11 +6004,10 @@ async function shutdown() {
6167
6004
  _tracerProvider = null;
6168
6005
  _meterProvider = null;
6169
6006
  _logProvider = null;
6170
- _logSpanExporter = null;
6171
6007
  _spanProcessor = null;
6172
6008
  _debugMode2 = false;
6173
6009
  _setSessionConfig({});
6174
- logger14.info("Neatlogs SDK shutdown complete");
6010
+ logger13.info("Neatlogs SDK shutdown complete");
6175
6011
  return success;
6176
6012
  }
6177
6013
  function getTracerProvider() {
@@ -6187,7 +6023,7 @@ function isDebugEnabled() {
6187
6023
  }
6188
6024
 
6189
6025
  // src/decorators/orchestration.ts
6190
- var logger15 = getLogger();
6026
+ var logger14 = getLogger();
6191
6027
  function span(options, fn) {
6192
6028
  if (!VALID_SPAN_KINDS.has(options.kind)) {
6193
6029
  throw new Error(
@@ -6528,6 +6364,10 @@ function resolveRootWorkflowName() {
6528
6364
  }
6529
6365
  return "workflow";
6530
6366
  }
6367
+ function stampAutoRootIdentity(root) {
6368
+ applySessionAttributes(root, void 0, true);
6369
+ applyEndUserAttributes(root, void 0, void 0, true);
6370
+ }
6531
6371
  function wrapSpanWithRoot(child, root) {
6532
6372
  let ended = false;
6533
6373
  return new Proxy(child, {
@@ -6562,6 +6402,7 @@ function maybeOpenAutoRoot(tracer, kind, baseCtx) {
6562
6402
  { attributes: { "neatlogs.span.kind": "workflow", "neatlogs.auto_root": true } },
6563
6403
  baseCtx
6564
6404
  );
6405
+ stampAutoRootIdentity(root);
6565
6406
  return { root, ctx: otelTrace4.setSpan(baseCtx, root) };
6566
6407
  }
6567
6408
  function endAutoRoot(root) {
@@ -6591,6 +6432,7 @@ var AutoRootTracer = class {
6591
6432
  { attributes: { "neatlogs.span.kind": "workflow", "neatlogs.auto_root": true } },
6592
6433
  ctx
6593
6434
  );
6435
+ stampAutoRootIdentity(root);
6594
6436
  const childCtx = otelTrace4.setSpan(ctx, root);
6595
6437
  const child = this._tracer.startSpan(name, options, childCtx);
6596
6438
  return wrapSpanWithRoot(child, root);
@@ -6639,12 +6481,12 @@ function traceTool(name, fn) {
6639
6481
  );
6640
6482
  };
6641
6483
  }
6642
- function wrapNamespace(target, path4) {
6484
+ function wrapNamespace(target, path3) {
6643
6485
  return new Proxy(target, {
6644
6486
  get(obj, prop, receiver) {
6645
6487
  const value = Reflect.get(obj, prop, receiver);
6646
6488
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
6647
- const currentPath = [...path4, String(prop)];
6489
+ const currentPath = [...path3, String(prop)];
6648
6490
  const pathStr = currentPath.join(".");
6649
6491
  if (pathStr === "chat.completions.create" && typeof value === "function") {
6650
6492
  return tracedChatCompletionsCreate(value.bind(obj));
@@ -6659,9 +6501,9 @@ function wrapNamespace(target, path4) {
6659
6501
  }
6660
6502
  });
6661
6503
  }
6662
- function isNamespace(path4) {
6663
- if (path4.length > 3) return false;
6664
- const key = path4[path4.length - 1];
6504
+ function isNamespace(path3) {
6505
+ if (path3.length > 3) return false;
6506
+ const key = path3[path3.length - 1];
6665
6507
  return ["chat", "completions", "responses", "beta"].includes(key);
6666
6508
  }
6667
6509
  function tracedChatCompletionsCreate(original) {
@@ -6951,12 +6793,12 @@ function traceTool2(name, fn) {
6951
6793
  );
6952
6794
  };
6953
6795
  }
6954
- function wrapNamespace2(target, path4) {
6796
+ function wrapNamespace2(target, path3) {
6955
6797
  return new Proxy(target, {
6956
6798
  get(obj, prop, receiver) {
6957
6799
  const value = Reflect.get(obj, prop, receiver);
6958
6800
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
6959
- const currentPath = [...path4, String(prop)];
6801
+ const currentPath = [...path3, String(prop)];
6960
6802
  const pathStr = currentPath.join(".");
6961
6803
  if (pathStr === "messages.create" && typeof value === "function") {
6962
6804
  return tracedMessagesCreate(value.bind(obj));
@@ -6971,9 +6813,9 @@ function wrapNamespace2(target, path4) {
6971
6813
  }
6972
6814
  });
6973
6815
  }
6974
- function isNamespace2(path4) {
6975
- if (path4.length > 3) return false;
6976
- const key = path4[path4.length - 1];
6816
+ function isNamespace2(path3) {
6817
+ if (path3.length > 3) return false;
6818
+ const key = path3[path3.length - 1];
6977
6819
  return ["messages", "beta"].includes(key);
6978
6820
  }
6979
6821
  function tracedMessagesCreate(original) {
@@ -7296,12 +7138,12 @@ function traceTool3(name, fn) {
7296
7138
  );
7297
7139
  };
7298
7140
  }
7299
- function wrapNamespace3(target, path4) {
7141
+ function wrapNamespace3(target, path3) {
7300
7142
  return new Proxy(target, {
7301
7143
  get(obj, prop, receiver) {
7302
7144
  const value = Reflect.get(obj, prop, receiver);
7303
7145
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
7304
- const currentPath = [...path4, String(prop)];
7146
+ const currentPath = [...path3, String(prop)];
7305
7147
  const pathStr = currentPath.join(".");
7306
7148
  if (pathStr === "chat.completions.create" && typeof value === "function") {
7307
7149
  return tracedChatCompletionsCreate2(value.bind(obj));
@@ -7316,9 +7158,9 @@ function wrapNamespace3(target, path4) {
7316
7158
  }
7317
7159
  });
7318
7160
  }
7319
- function isNamespace3(path4) {
7320
- if (path4.length > 3) return false;
7321
- const key = path4[path4.length - 1];
7161
+ function isNamespace3(path3) {
7162
+ if (path3.length > 3) return false;
7163
+ const key = path3[path3.length - 1];
7322
7164
  return ["chat", "completions", "responses", "beta"].includes(key);
7323
7165
  }
7324
7166
  function tracedChatCompletionsCreate2(original) {
@@ -7610,12 +7452,12 @@ function traceTool4(name, fn) {
7610
7452
  );
7611
7453
  };
7612
7454
  }
7613
- function wrapNamespace4(target, path4) {
7455
+ function wrapNamespace4(target, path3) {
7614
7456
  return new Proxy(target, {
7615
7457
  get(obj, prop, receiver) {
7616
7458
  const value = Reflect.get(obj, prop, receiver);
7617
7459
  if (typeof prop === "symbol" || String(prop).startsWith("_")) return value;
7618
- const currentPath = [...path4, String(prop)];
7460
+ const currentPath = [...path3, String(prop)];
7619
7461
  const pathStr = currentPath.join(".");
7620
7462
  if (pathStr === "models.generateContent" && typeof value === "function") {
7621
7463
  return tracedGenerateContent(value.bind(obj), false);
@@ -7636,9 +7478,9 @@ function wrapNamespace4(target, path4) {
7636
7478
  }
7637
7479
  });
7638
7480
  }
7639
- function isNamespace4(path4) {
7640
- if (path4.length > 2) return false;
7641
- return ["models", "chats"].includes(path4[path4.length - 1]);
7481
+ function isNamespace4(path3) {
7482
+ if (path3.length > 2) return false;
7483
+ return ["models", "chats"].includes(path3[path3.length - 1]);
7642
7484
  }
7643
7485
  function wrapVertexAIChat(chat) {
7644
7486
  const c = chat;
@@ -10593,21 +10435,21 @@ var ExportTraceServiceRequest = protoRoot.lookupType(
10593
10435
  "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"
10594
10436
  );
10595
10437
  var SpanStatusCode16 = { UNSET: 0, OK: 1, ERROR: 2 };
10596
- function randomBytes3(length) {
10438
+ function randomBytes(length) {
10597
10439
  const out = new Uint8Array(length);
10598
- const crypto2 = globalThis.crypto;
10599
- if (crypto2 && typeof crypto2.getRandomValues === "function") {
10600
- crypto2.getRandomValues(out);
10440
+ const crypto = globalThis.crypto;
10441
+ if (crypto && typeof crypto.getRandomValues === "function") {
10442
+ crypto.getRandomValues(out);
10601
10443
  return out;
10602
10444
  }
10603
10445
  for (let i = 0; i < out.length; i++) out[i] = Math.floor(Math.random() * 256);
10604
10446
  return out;
10605
10447
  }
10606
10448
  function generateTraceId() {
10607
- return randomBytes3(16);
10449
+ return randomBytes(16);
10608
10450
  }
10609
10451
  function generateSpanId() {
10610
- return randomBytes3(8);
10452
+ return randomBytes(8);
10611
10453
  }
10612
10454
  function nowNanoString() {
10613
10455
  return (BigInt(Date.now()) * 1000000n).toString();
@@ -10749,7 +10591,7 @@ function nanoToLong(nanoStr) {
10749
10591
  }
10750
10592
 
10751
10593
  // src/opencode-plugin.ts
10752
- var DEFAULT_ENDPOINT = "https://staging-cloud.neatlogs.com";
10594
+ var DEFAULT_ENDPOINT = "https://ingest.neatlogs.com";
10753
10595
  var NeatlogsOpencodePlugin = async (_ctx) => {
10754
10596
  const apiKey = (process.env.NEATLOGS_API_KEY ?? "").trim();
10755
10597
  const endpoint = (process.env.NEATLOGS_ENDPOINT ?? DEFAULT_ENDPOINT).trim();
@@ -11073,7 +10915,7 @@ function safeStringify15(value) {
11073
10915
  }
11074
10916
 
11075
10917
  // src/core/llm-binder.ts
11076
- var logger16 = getLogger();
10918
+ var logger15 = getLogger();
11077
10919
  function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11078
10920
  const systemStr = String(systemTpl.template);
11079
10921
  const userStr = userTpl ? String(userTpl.template) : null;
@@ -11085,7 +10927,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11085
10927
  llmCopy = structuredClone(llm);
11086
10928
  } catch {
11087
10929
  llmCopy = llm;
11088
- logger16.debug(
10930
+ logger15.debug(
11089
10931
  `LLM type ${llm?.constructor?.name ?? "unknown"} is not copyable \u2014 binding in place.`
11090
10932
  );
11091
10933
  }
@@ -11096,7 +10938,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11096
10938
  } else if (typeof llmCopy.call === "function") {
11097
10939
  methodName = "call";
11098
10940
  } else {
11099
- logger16.warn(
10941
+ logger15.warn(
11100
10942
  `LLM type ${llm?.constructor?.name ?? "unknown"} has neither invoke() nor call() \u2014 prompt templates will not be captured on spans.`
11101
10943
  );
11102
10944
  return llmCopy;
@@ -11116,7 +10958,7 @@ function bindTemplates(llm, systemTpl, userTpl, compiledVars) {
11116
10958
  }
11117
10959
  }
11118
10960
  };
11119
- logger16.debug(
10961
+ logger15.debug(
11120
10962
  `Wrapped ${llm?.constructor?.name ?? "unknown"}.${methodName}() with template injection.`
11121
10963
  );
11122
10964
  return llmCopy;
@@ -11141,6 +10983,7 @@ export {
11141
10983
  getMastraObservability,
11142
10984
  getPrompt,
11143
10985
  getSessionConfig,
10986
+ identify,
11144
10987
  init,
11145
10988
  isDebugEnabled,
11146
10989
  langchainHandler,