@llmops/sdk 1.0.0-beta.16 → 1.0.0-beta.19

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 (35) hide show
  1. package/dist/agents.d.cts +1 -1
  2. package/dist/agents.d.mts +1 -1
  3. package/dist/agents.mjs +1 -1
  4. package/dist/chunk-rZg9L66_.mjs +21 -0
  5. package/dist/express.d.cts +2 -2
  6. package/dist/express.d.mts +2 -2
  7. package/dist/hono.d.cts +2 -2
  8. package/dist/hono.d.mts +2 -2
  9. package/dist/{index-B5aeZ4Jb.d.mts → index-BpwfOQEm.d.cts} +1 -1
  10. package/dist/{index-sjRozlIk.d.cts → index-CniO6im-.d.mts} +1 -1
  11. package/dist/index.d.cts +3 -3
  12. package/dist/index.d.mts +3 -3
  13. package/dist/index.mjs +2 -2
  14. package/dist/nextjs.d.cts +2 -2
  15. package/dist/nextjs.d.mts +2 -2
  16. package/dist/store/d1.cjs +29 -8
  17. package/dist/store/d1.d.cts +1 -1
  18. package/dist/store/d1.d.mts +1 -1
  19. package/dist/store/d1.mjs +29 -8
  20. package/dist/store/pg.d.cts +1 -1
  21. package/dist/store/pg.d.mts +1 -1
  22. package/dist/store/pg.mjs +2 -20
  23. package/dist/store/sqlite.cjs +541 -0
  24. package/dist/store/sqlite.d.cts +50 -0
  25. package/dist/store/sqlite.d.mts +50 -0
  26. package/dist/store/sqlite.mjs +541 -0
  27. package/dist/types.d.cts +1 -1
  28. package/dist/types.d.mts +1 -1
  29. package/package.json +18 -4
  30. /package/dist/{agents-exporter-Cte-NArh.mjs → agents-exporter-BY7BXquG.mjs} +0 -0
  31. /package/dist/{agents-exporter-B3dyZc2j.d.mts → agents-exporter-CI29gyrT.d.mts} +0 -0
  32. /package/dist/{agents-exporter-vuQine9v.d.cts → agents-exporter-YNq4HFTK.d.cts} +0 -0
  33. /package/dist/{constants-B8e4mnT7.mjs → constants-BVeqLv6F.mjs} +0 -0
  34. /package/dist/{interface-B0KYptxO.d.cts → interface-BGkC9Ml4.d.mts} +0 -0
  35. /package/dist/{interface-DFchZZQP.d.mts → interface-Dix77UtO.d.cts} +0 -0
package/dist/agents.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-vuQine9v.cjs";
1
+ import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-YNq4HFTK.cjs";
2
2
  export { AgentsSpan, AgentsSpanData, AgentsSpanError, AgentsTrace, AgentsTracingExporter, LLMOpsAgentsExporterConfig, createLLMOpsAgentsExporter };
package/dist/agents.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-B3dyZc2j.mjs";
1
+ import { a as AgentsTracingExporter, i as AgentsTrace, n as AgentsSpanData, o as LLMOpsAgentsExporterConfig, r as AgentsSpanError, s as createLLMOpsAgentsExporter, t as AgentsSpan } from "./agents-exporter-CI29gyrT.mjs";
2
2
  export { AgentsSpan, AgentsSpanData, AgentsSpanError, AgentsTrace, AgentsTracingExporter, LLMOpsAgentsExporterConfig, createLLMOpsAgentsExporter };
package/dist/agents.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as createLLMOpsAgentsExporter } from "./agents-exporter-Cte-NArh.mjs";
1
+ import { t as createLLMOpsAgentsExporter } from "./agents-exporter-BY7BXquG.mjs";
2
2
 
3
3
  export { createLLMOpsAgentsExporter };
@@ -0,0 +1,21 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __defProp = Object.defineProperty;
5
+ var __export = (all, symbols) => {
6
+ let target = {};
7
+ for (var name in all) {
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ }
13
+ if (symbols) {
14
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
15
+ }
16
+ return target;
17
+ };
18
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
19
+
20
+ //#endregion
21
+ export { __require as n, __export as t };
@@ -1,5 +1,5 @@
1
- import "./agents-exporter-vuQine9v.cjs";
2
- import { t as LLMOpsClient } from "./index-sjRozlIk.cjs";
1
+ import "./agents-exporter-YNq4HFTK.cjs";
2
+ import { t as LLMOpsClient } from "./index-BpwfOQEm.cjs";
3
3
  import { NextFunction, Request, Response } from "express";
4
4
 
5
5
  //#region src/lib/express/index.d.ts
@@ -1,5 +1,5 @@
1
- import "./agents-exporter-B3dyZc2j.mjs";
2
- import { t as LLMOpsClient } from "./index-B5aeZ4Jb.mjs";
1
+ import "./agents-exporter-CI29gyrT.mjs";
2
+ import { t as LLMOpsClient } from "./index-CniO6im-.mjs";
3
3
  import { NextFunction, Request, Response } from "express";
4
4
 
5
5
  //#region src/lib/express/index.d.ts
package/dist/hono.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import "./agents-exporter-vuQine9v.cjs";
2
- import { t as LLMOpsClient } from "./index-sjRozlIk.cjs";
1
+ import "./agents-exporter-YNq4HFTK.cjs";
2
+ import { t as LLMOpsClient } from "./index-BpwfOQEm.cjs";
3
3
  import { MiddlewareHandler } from "hono";
4
4
 
5
5
  //#region src/lib/hono/index.d.ts
package/dist/hono.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import "./agents-exporter-B3dyZc2j.mjs";
2
- import { t as LLMOpsClient } from "./index-B5aeZ4Jb.mjs";
1
+ import "./agents-exporter-CI29gyrT.mjs";
2
+ import { t as LLMOpsClient } from "./index-CniO6im-.mjs";
3
3
  import { MiddlewareHandler } from "hono";
4
4
 
5
5
  //#region src/lib/hono/index.d.ts
@@ -1,4 +1,4 @@
1
- import { a as AgentsTracingExporter } from "./agents-exporter-B3dyZc2j.mjs";
1
+ import { a as AgentsTracingExporter } from "./agents-exporter-YNq4HFTK.cjs";
2
2
  import { LLMOpsConfig, ValidatedLLMOpsConfig } from "@llmops/core";
3
3
 
4
4
  //#region src/telemetry/langchain-client.d.ts
@@ -1,4 +1,4 @@
1
- import { a as AgentsTracingExporter } from "./agents-exporter-vuQine9v.cjs";
1
+ import { a as AgentsTracingExporter } from "./agents-exporter-CI29gyrT.mjs";
2
2
  import { LLMOpsConfig, ValidatedLLMOpsConfig } from "@llmops/core";
3
3
 
4
4
  //#region src/telemetry/langchain-client.d.ts
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-vuQine9v.cjs";
2
- import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-sjRozlIk.cjs";
3
- import { a as TraceUpsert, i as SpanInsert, n as LLMRequestInsert, o as COST_SUMMARY_GROUP_BY, r as SpanEventInsert, s as CostSummaryGroupBy, t as TelemetryStore } from "./interface-B0KYptxO.cjs";
1
+ import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-YNq4HFTK.cjs";
2
+ import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-BpwfOQEm.cjs";
3
+ import { a as TraceUpsert, i as SpanInsert, n as LLMRequestInsert, o as COST_SUMMARY_GROUP_BY, r as SpanEventInsert, s as CostSummaryGroupBy, t as TelemetryStore } from "./interface-Dix77UtO.cjs";
4
4
 
5
5
  //#region src/telemetry/exporter.d.ts
6
6
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-B3dyZc2j.mjs";
2
- import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-B5aeZ4Jb.mjs";
3
- import { a as TraceUpsert, i as SpanInsert, n as LLMRequestInsert, o as COST_SUMMARY_GROUP_BY, r as SpanEventInsert, s as CostSummaryGroupBy, t as TelemetryStore } from "./interface-DFchZZQP.mjs";
1
+ import { a as AgentsTracingExporter, o as LLMOpsAgentsExporterConfig, s as createLLMOpsAgentsExporter } from "./agents-exporter-CI29gyrT.mjs";
2
+ import { a as LLMOpsLangChainClientConfig, i as createLLMOps, n as ProviderOptions, o as LangChainTracingClient, r as TraceContext, s as createLLMOpsLangChainClient, t as LLMOpsClient } from "./index-CniO6im-.mjs";
3
+ import { a as TraceUpsert, i as SpanInsert, n as LLMRequestInsert, o as COST_SUMMARY_GROUP_BY, r as SpanEventInsert, s as CostSummaryGroupBy, t as TelemetryStore } from "./interface-BGkC9Ml4.mjs";
4
4
 
5
5
  //#region src/telemetry/exporter.d.ts
6
6
 
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as createLLMOpsAgentsExporter } from "./agents-exporter-Cte-NArh.mjs";
2
- import { t as COST_SUMMARY_GROUP_BY } from "./constants-B8e4mnT7.mjs";
1
+ import { t as createLLMOpsAgentsExporter } from "./agents-exporter-BY7BXquG.mjs";
2
+ import { t as COST_SUMMARY_GROUP_BY } from "./constants-BVeqLv6F.mjs";
3
3
  import { LLMOPS_INTERNAL_HEADER, LLMOPS_SPAN_NAME_HEADER, LLMOPS_TRACE_ID_HEADER, LLMOPS_TRACE_NAME_HEADER } from "@llmops/core";
4
4
  import { createApp } from "@llmops/app";
5
5
 
package/dist/nextjs.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import "./agents-exporter-vuQine9v.cjs";
2
- import { t as LLMOpsClient } from "./index-sjRozlIk.cjs";
1
+ import "./agents-exporter-YNq4HFTK.cjs";
2
+ import { t as LLMOpsClient } from "./index-BpwfOQEm.cjs";
3
3
 
4
4
  //#region src/lib/nextjs/index.d.ts
5
5
  declare function toNextJsHandler(client: LLMOpsClient): {
package/dist/nextjs.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import "./agents-exporter-B3dyZc2j.mjs";
2
- import { t as LLMOpsClient } from "./index-B5aeZ4Jb.mjs";
1
+ import "./agents-exporter-CI29gyrT.mjs";
2
+ import { t as LLMOpsClient } from "./index-CniO6im-.mjs";
3
3
 
4
4
  //#region src/lib/nextjs/index.d.ts
5
5
  declare function toNextJsHandler(client: LLMOpsClient): {
package/dist/store/d1.cjs CHANGED
@@ -1,6 +1,26 @@
1
1
  let node_crypto = require("node:crypto");
2
2
 
3
3
  //#region src/store/d1/d1-store.ts
4
+ /** JSON columns stored as TEXT in D1 — parse them back to objects on read */
5
+ const JSON_COLUMNS = new Set([
6
+ "tags",
7
+ "metadata",
8
+ "attributes",
9
+ "guardrailResults",
10
+ "input",
11
+ "output"
12
+ ]);
13
+ function parseJsonColumns(row) {
14
+ if (!row || typeof row !== "object") return row;
15
+ const parsed = { ...row };
16
+ for (const key of Object.keys(parsed)) if (JSON_COLUMNS.has(key) && typeof parsed[key] === "string") try {
17
+ parsed[key] = JSON.parse(parsed[key]);
18
+ } catch {}
19
+ return parsed;
20
+ }
21
+ function parseJsonRows(rows) {
22
+ return rows.map(parseJsonColumns);
23
+ }
4
24
  function buildTagFilters(tags) {
5
25
  const conditions = [];
6
26
  const params = [];
@@ -100,16 +120,17 @@ function createD1LLMRequestsStore(db) {
100
120
  queryParams.push(...tagFilter.params);
101
121
  const where = conditions.join(" AND ");
102
122
  const total = (await db.prepare(`SELECT COUNT(*) AS "total" FROM "llm_requests" WHERE ${where}`).bind(...queryParams).first())?.total ?? 0;
103
- const { results: data } = await db.prepare(`SELECT * FROM "llm_requests" WHERE ${where} ORDER BY "createdAt" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
123
+ const { results } = await db.prepare(`SELECT * FROM "llm_requests" WHERE ${where} ORDER BY "createdAt" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
104
124
  return {
105
- data,
125
+ data: parseJsonRows(results),
106
126
  total,
107
127
  limit,
108
128
  offset
109
129
  };
110
130
  },
111
131
  getRequestByRequestId: async (requestId) => {
112
- return db.prepare(`SELECT * FROM "llm_requests" WHERE "requestId" = ?`).bind(requestId).first();
132
+ const row = await db.prepare(`SELECT * FROM "llm_requests" WHERE "requestId" = ?`).bind(requestId).first();
133
+ return row ? parseJsonColumns(row) : void 0;
113
134
  },
114
135
  getTotalCost: async (params) => {
115
136
  const conditions = [`"createdAt" >= ?`, `"createdAt" <= ?`];
@@ -386,9 +407,9 @@ function createD1TracesStore(db) {
386
407
  queryParams.push(...tagFilter.params);
387
408
  const where = conditions.join(" AND ");
388
409
  const total = (await db.prepare(`SELECT COUNT(*) AS "total" FROM "traces" WHERE ${where}`).bind(...queryParams).first())?.total ?? 0;
389
- const { results: data } = await db.prepare(`SELECT * FROM "traces" WHERE ${where} ORDER BY "startTime" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
410
+ const { results } = await db.prepare(`SELECT * FROM "traces" WHERE ${where} ORDER BY "startTime" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
390
411
  return {
391
- data,
412
+ data: parseJsonRows(results),
392
413
  total,
393
414
  limit,
394
415
  offset
@@ -399,9 +420,9 @@ function createD1TracesStore(db) {
399
420
  if (!trace) return void 0;
400
421
  const [spanResult, eventResult] = await db.batch([db.prepare(`SELECT * FROM "spans" WHERE "traceId" = ? ORDER BY "startTime" ASC`).bind(traceId), db.prepare(`SELECT * FROM "span_events" WHERE "traceId" = ? ORDER BY "timestamp" ASC`).bind(traceId)]);
401
422
  return {
402
- trace,
403
- spans: spanResult.results ?? [],
404
- events: eventResult.results ?? []
423
+ trace: parseJsonColumns(trace),
424
+ spans: parseJsonRows(spanResult.results ?? []),
425
+ events: parseJsonRows(eventResult.results ?? [])
405
426
  };
406
427
  },
407
428
  getTraceStats: async (params) => {
@@ -1,4 +1,4 @@
1
- import { t as TelemetryStore } from "../interface-B0KYptxO.cjs";
1
+ import { t as TelemetryStore } from "../interface-Dix77UtO.cjs";
2
2
 
3
3
  //#region src/store/d1/types.d.ts
4
4
 
@@ -1,4 +1,4 @@
1
- import { t as TelemetryStore } from "../interface-DFchZZQP.mjs";
1
+ import { t as TelemetryStore } from "../interface-BGkC9Ml4.mjs";
2
2
 
3
3
  //#region src/store/d1/types.d.ts
4
4
 
package/dist/store/d1.mjs CHANGED
@@ -1,6 +1,26 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
 
3
3
  //#region src/store/d1/d1-store.ts
4
+ /** JSON columns stored as TEXT in D1 — parse them back to objects on read */
5
+ const JSON_COLUMNS = new Set([
6
+ "tags",
7
+ "metadata",
8
+ "attributes",
9
+ "guardrailResults",
10
+ "input",
11
+ "output"
12
+ ]);
13
+ function parseJsonColumns(row) {
14
+ if (!row || typeof row !== "object") return row;
15
+ const parsed = { ...row };
16
+ for (const key of Object.keys(parsed)) if (JSON_COLUMNS.has(key) && typeof parsed[key] === "string") try {
17
+ parsed[key] = JSON.parse(parsed[key]);
18
+ } catch {}
19
+ return parsed;
20
+ }
21
+ function parseJsonRows(rows) {
22
+ return rows.map(parseJsonColumns);
23
+ }
4
24
  function buildTagFilters(tags) {
5
25
  const conditions = [];
6
26
  const params = [];
@@ -100,16 +120,17 @@ function createD1LLMRequestsStore(db) {
100
120
  queryParams.push(...tagFilter.params);
101
121
  const where = conditions.join(" AND ");
102
122
  const total = (await db.prepare(`SELECT COUNT(*) AS "total" FROM "llm_requests" WHERE ${where}`).bind(...queryParams).first())?.total ?? 0;
103
- const { results: data } = await db.prepare(`SELECT * FROM "llm_requests" WHERE ${where} ORDER BY "createdAt" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
123
+ const { results } = await db.prepare(`SELECT * FROM "llm_requests" WHERE ${where} ORDER BY "createdAt" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
104
124
  return {
105
- data,
125
+ data: parseJsonRows(results),
106
126
  total,
107
127
  limit,
108
128
  offset
109
129
  };
110
130
  },
111
131
  getRequestByRequestId: async (requestId) => {
112
- return db.prepare(`SELECT * FROM "llm_requests" WHERE "requestId" = ?`).bind(requestId).first();
132
+ const row = await db.prepare(`SELECT * FROM "llm_requests" WHERE "requestId" = ?`).bind(requestId).first();
133
+ return row ? parseJsonColumns(row) : void 0;
113
134
  },
114
135
  getTotalCost: async (params) => {
115
136
  const conditions = [`"createdAt" >= ?`, `"createdAt" <= ?`];
@@ -386,9 +407,9 @@ function createD1TracesStore(db) {
386
407
  queryParams.push(...tagFilter.params);
387
408
  const where = conditions.join(" AND ");
388
409
  const total = (await db.prepare(`SELECT COUNT(*) AS "total" FROM "traces" WHERE ${where}`).bind(...queryParams).first())?.total ?? 0;
389
- const { results: data } = await db.prepare(`SELECT * FROM "traces" WHERE ${where} ORDER BY "startTime" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
410
+ const { results } = await db.prepare(`SELECT * FROM "traces" WHERE ${where} ORDER BY "startTime" DESC LIMIT ? OFFSET ?`).bind(...queryParams, limit, offset).all();
390
411
  return {
391
- data,
412
+ data: parseJsonRows(results),
392
413
  total,
393
414
  limit,
394
415
  offset
@@ -399,9 +420,9 @@ function createD1TracesStore(db) {
399
420
  if (!trace) return void 0;
400
421
  const [spanResult, eventResult] = await db.batch([db.prepare(`SELECT * FROM "spans" WHERE "traceId" = ? ORDER BY "startTime" ASC`).bind(traceId), db.prepare(`SELECT * FROM "span_events" WHERE "traceId" = ? ORDER BY "timestamp" ASC`).bind(traceId)]);
401
422
  return {
402
- trace,
403
- spans: spanResult.results ?? [],
404
- events: eventResult.results ?? []
423
+ trace: parseJsonColumns(trace),
424
+ spans: parseJsonRows(spanResult.results ?? []),
425
+ events: parseJsonRows(eventResult.results ?? [])
405
426
  };
406
427
  },
407
428
  getTraceStats: async (params) => {
@@ -1,4 +1,4 @@
1
- import { t as TelemetryStore } from "../interface-B0KYptxO.cjs";
1
+ import { t as TelemetryStore } from "../interface-Dix77UtO.cjs";
2
2
  import { Pool } from "pg";
3
3
 
4
4
  //#region src/telemetry/pg-store.d.ts
@@ -1,4 +1,4 @@
1
- import { t as TelemetryStore } from "../interface-DFchZZQP.mjs";
1
+ import { t as TelemetryStore } from "../interface-BGkC9Ml4.mjs";
2
2
  import { Pool } from "pg";
3
3
 
4
4
  //#region src/telemetry/pg-store.d.ts
package/dist/store/pg.mjs CHANGED
@@ -1,26 +1,8 @@
1
- import "../constants-B8e4mnT7.mjs";
2
- import { createRequire } from "node:module";
1
+ import { n as __require, t as __export } from "../chunk-rZg9L66_.mjs";
2
+ import "../constants-BVeqLv6F.mjs";
3
3
  import { logger } from "@llmops/core";
4
4
  import { randomUUID } from "node:crypto";
5
5
 
6
- //#region rolldown:runtime
7
- var __defProp = Object.defineProperty;
8
- var __export = (all, symbols) => {
9
- let target = {};
10
- for (var name in all) {
11
- __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- }
16
- if (symbols) {
17
- __defProp(target, Symbol.toStringTag, { value: "Module" });
18
- }
19
- return target;
20
- };
21
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
22
-
23
- //#endregion
24
6
  //#region ../../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/core.js
25
7
  /** A special constant with type `never` */
26
8
  const NEVER = Object.freeze({ status: "aborted" });