@llmops/app 1.0.0-beta.14 → 1.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -14182,13 +14182,6 @@ function createBatchWriter(deps, config$1 = {}) {
14182
14182
  function enqueue(request) {
14183
14183
  queue.push(request);
14184
14184
  log(`[BatchWriter] Enqueued request ${request.requestId}, queue size: ${queue.length}`);
14185
- if (typeof globalThis.process === "undefined" || !globalThis.process?.versions?.node) {
14186
- flush().catch((err) => {
14187
- const errorMsg = err instanceof Error ? err.message : String(err);
14188
- __llmops_core.logger.error(`[BatchWriter] Edge flush error: ${errorMsg}`);
14189
- });
14190
- return;
14191
- }
14192
14185
  if (!running) start();
14193
14186
  if (queue.length >= maxBatchSize) {
14194
14187
  log(`[BatchWriter] Max batch size reached, forcing flush`);
@@ -14388,13 +14381,6 @@ function createTraceBatchWriter(deps, config$1 = {}) {
14388
14381
  function enqueue(item) {
14389
14382
  queue.push(item);
14390
14383
  log(`[TraceBatchWriter] Enqueued span ${item.span.spanId}, queue size: ${queue.length}`);
14391
- if (typeof globalThis.process === "undefined" || !globalThis.process?.versions?.node) {
14392
- flush().catch((err) => {
14393
- const errorMsg = err instanceof Error ? err.message : String(err);
14394
- __llmops_core.logger.error(`[TraceBatchWriter] Edge flush error: ${errorMsg}`);
14395
- });
14396
- return;
14397
- }
14398
14384
  if (!running) start();
14399
14385
  if (queue.length >= maxBatchSize) {
14400
14386
  log(`[TraceBatchWriter] Max batch size reached, forcing flush`);
@@ -14565,6 +14551,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14565
14551
  log(`Skipping cost tracking - no telemetry store configured`);
14566
14552
  return;
14567
14553
  }
14554
+ const waitUntil = c.get("llmopsConfig")?.waitUntil;
14568
14555
  const batchWriter = getGlobalBatchWriter({ batchInsertRequests: (requests) => db.batchInsertRequests(requests) }, {
14569
14556
  flushIntervalMs,
14570
14557
  debug
@@ -14608,6 +14595,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14608
14595
  traceContext,
14609
14596
  batchWriter,
14610
14597
  traceBatchWriter,
14598
+ waitUntil,
14611
14599
  trackErrors,
14612
14600
  log
14613
14601
  });
@@ -14673,6 +14661,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14673
14661
  traceContext,
14674
14662
  batchWriter,
14675
14663
  traceBatchWriter,
14664
+ waitUntil,
14676
14665
  trackErrors,
14677
14666
  log
14678
14667
  });
@@ -14683,7 +14672,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14683
14672
  * Process usage data and log to batch writer
14684
14673
  */
14685
14674
  async function processUsageAndLog(params) {
14686
- const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, trackErrors, log } = params;
14675
+ const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, waitUntil, trackErrors, log } = params;
14687
14676
  if (!trackErrors && statusCode >= 400) {
14688
14677
  log(`Skipping error response (${statusCode})`);
14689
14678
  return;
@@ -14828,6 +14817,7 @@ async function processUsageAndLog(params) {
14828
14817
  });
14829
14818
  log(`Enqueued trace span ${traceContext.spanId} for trace ${traceContext.traceId}`);
14830
14819
  }
14820
+ if (waitUntil) waitUntil(Promise.all([batchWriter.flush(), traceBatchWriter ? traceBatchWriter.flush() : Promise.resolve()]));
14831
14821
  }
14832
14822
 
14833
14823
  //#endregion
package/dist/index.mjs CHANGED
@@ -14156,13 +14156,6 @@ function createBatchWriter(deps, config$1 = {}) {
14156
14156
  function enqueue(request) {
14157
14157
  queue.push(request);
14158
14158
  log(`[BatchWriter] Enqueued request ${request.requestId}, queue size: ${queue.length}`);
14159
- if (typeof globalThis.process === "undefined" || !globalThis.process?.versions?.node) {
14160
- flush().catch((err) => {
14161
- const errorMsg = err instanceof Error ? err.message : String(err);
14162
- logger.error(`[BatchWriter] Edge flush error: ${errorMsg}`);
14163
- });
14164
- return;
14165
- }
14166
14159
  if (!running) start();
14167
14160
  if (queue.length >= maxBatchSize) {
14168
14161
  log(`[BatchWriter] Max batch size reached, forcing flush`);
@@ -14362,13 +14355,6 @@ function createTraceBatchWriter(deps, config$1 = {}) {
14362
14355
  function enqueue(item) {
14363
14356
  queue.push(item);
14364
14357
  log(`[TraceBatchWriter] Enqueued span ${item.span.spanId}, queue size: ${queue.length}`);
14365
- if (typeof globalThis.process === "undefined" || !globalThis.process?.versions?.node) {
14366
- flush().catch((err) => {
14367
- const errorMsg = err instanceof Error ? err.message : String(err);
14368
- logger.error(`[TraceBatchWriter] Edge flush error: ${errorMsg}`);
14369
- });
14370
- return;
14371
- }
14372
14358
  if (!running) start();
14373
14359
  if (queue.length >= maxBatchSize) {
14374
14360
  log(`[TraceBatchWriter] Max batch size reached, forcing flush`);
@@ -14539,6 +14525,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14539
14525
  log(`Skipping cost tracking - no telemetry store configured`);
14540
14526
  return;
14541
14527
  }
14528
+ const waitUntil = c.get("llmopsConfig")?.waitUntil;
14542
14529
  const batchWriter = getGlobalBatchWriter({ batchInsertRequests: (requests) => db.batchInsertRequests(requests) }, {
14543
14530
  flushIntervalMs,
14544
14531
  debug
@@ -14582,6 +14569,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14582
14569
  traceContext,
14583
14570
  batchWriter,
14584
14571
  traceBatchWriter,
14572
+ waitUntil,
14585
14573
  trackErrors,
14586
14574
  log
14587
14575
  });
@@ -14647,6 +14635,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14647
14635
  traceContext,
14648
14636
  batchWriter,
14649
14637
  traceBatchWriter,
14638
+ waitUntil,
14650
14639
  trackErrors,
14651
14640
  log
14652
14641
  });
@@ -14657,7 +14646,7 @@ function createCostTrackingMiddleware(config$1 = {}) {
14657
14646
  * Process usage data and log to batch writer
14658
14647
  */
14659
14648
  async function processUsageAndLog(params) {
14660
- const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, trackErrors, log } = params;
14649
+ const { requestId, provider, model, configId, variantId, environmentId, providerConfigId, endpoint, statusCode, latencyMs, isStreaming, usage, guardrailResults, tags = {}, input, output, traceContext, batchWriter, traceBatchWriter, waitUntil, trackErrors, log } = params;
14661
14650
  if (!trackErrors && statusCode >= 400) {
14662
14651
  log(`Skipping error response (${statusCode})`);
14663
14652
  return;
@@ -14802,6 +14791,7 @@ async function processUsageAndLog(params) {
14802
14791
  });
14803
14792
  log(`Enqueued trace span ${traceContext.spanId} for trace ${traceContext.traceId}`);
14804
14793
  }
14794
+ if (waitUntil) waitUntil(Promise.all([batchWriter.flush(), traceBatchWriter ? traceBatchWriter.flush() : Promise.resolve()]));
14805
14795
  }
14806
14796
 
14807
14797
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/app",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.16",
4
4
  "description": "LLMOps application with server and client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -75,9 +75,9 @@
75
75
  "react-hook-form": "^7.68.0",
76
76
  "recharts": "^3.6.0",
77
77
  "uuid": "^13.0.0",
78
- "@llmops/gateway": "^1.0.0-beta.14",
79
- "@llmops/sdk": "^1.0.0-beta.14",
80
- "@llmops/core": "^1.0.0-beta.14"
78
+ "@llmops/core": "^1.0.0-beta.16",
79
+ "@llmops/sdk": "^1.0.0-beta.16",
80
+ "@llmops/gateway": "^1.0.0-beta.16"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": "^19.2.1",