@mastra/clickhouse 1.27.0-alpha.1 → 1.27.0-alpha.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.
package/dist/index.js CHANGED
@@ -8566,7 +8566,7 @@ async function queryThreadRows(client, plan, timeoutMs, strategy = "auto") {
8566
8566
  traceId, spanId, startedAt, endedAt) IN {roots:Array(Tuple(UInt8, String, UInt8, String, String, String, DateTime64(3, 'UTC'), DateTime64(3, 'UTC')))}`;
8567
8567
  const stored = [];
8568
8568
  for (const batch of batches([...roots.values()])) stored.push(...await run({
8569
- query: `SELECT organizationId, traceId, spanId, startedAt, endedAt, spanType,
8569
+ query: `SELECT organizationId, traceId, spanId, startedAt, endedAt,
8570
8570
  ${contextFields.join(", ")}, if(spanType = 'agent_run', timeToFirstChunkMs, NULL) AS timeToFirstChunkMs,
8571
8571
  if(isNull(error), 'success', 'error') AS status, ${PREVIEW_COLUMNS.join(", ")}
8572
8572
  FROM ${TABLE_TRACE_ROOTS} WHERE ${rootWhere}
@@ -8586,31 +8586,10 @@ async function queryThreadRows(client, plan, timeoutMs, strategy = "auto") {
8586
8586
  if (row) Object.assign(row, resolveStoredPreviews(row, payload));
8587
8587
  }
8588
8588
  }
8589
- const firstRoots = page.map((row) => representative(row, "first")).filter((root) => byRoot.get(rootKey(root))?.spanType === "agent_run");
8590
- const models = [];
8591
- for (const batch of batches(firstRoots)) models.push(...await run({
8592
- query: `SELECT organizationId, traceId,
8593
- if(JSONType(attributes, 'model') = 'String', JSONExtractString(attributes, 'model'), NULL) AS model,
8594
- if(JSONType(attributes, 'provider') = 'String', JSONExtractString(attributes, 'provider'), NULL) AS provider
8595
- FROM ${TABLE_SPAN_EVENTS} WHERE spanType = 'model_generation' AND
8596
- tuple(isNull(organizationId), ifNull(organizationId, ''), isNull(resourceId), ifNull(resourceId, ''), traceId, parentSpanId)
8597
- IN {agents:Array(Tuple(UInt8, String, UInt8, String, String, String))}
8598
- ORDER BY organizationId, traceId, startedAt, spanId LIMIT 1 BY organizationId, traceId`,
8599
- query_params: { agents: batch.map((root) => new TupleParam([
8600
- root.organizationId === null ? 1 : 0,
8601
- root.organizationId ?? "",
8602
- root.resourceId === null ? 1 : 0,
8603
- root.resourceId ?? "",
8604
- root.traceId,
8605
- root.spanId
8606
- ])) }
8607
- }));
8608
- const byTrace = new Map(models.map((row) => [JSON.stringify([row.organizationId, row.traceId]), row]));
8609
8589
  const threads = page.flatMap((row) => {
8610
8590
  const first = byRoot.get(rootKey(representative(row, "first")));
8611
8591
  const last = byRoot.get(rootKey(representative(row, "last")));
8612
8592
  if (!first || !last) return [];
8613
- const model = byTrace.get(JSON.stringify([row.organizationId, row.firstTraceId]));
8614
8593
  return [coreStorage.threadQueryRowSchema.parse({
8615
8594
  organizationId: row.organizationId,
8616
8595
  threadId: row.threadId,
@@ -8622,8 +8601,6 @@ async function queryThreadRows(client, plan, timeoutMs, strategy = "auto") {
8622
8601
  endedAt: iso(row.endedAt),
8623
8602
  traceCount: Number(row.traceCount),
8624
8603
  timeToFirstChunkMs: first.timeToFirstChunkMs,
8625
- model: model?.model ?? null,
8626
- provider: model?.provider ?? null,
8627
8604
  inputPreview: resolveStoredPreviews(first).inputPreview,
8628
8605
  outputPreview: resolveStoredPreviews(last).outputPreview,
8629
8606
  errorPreview: resolveStoredPreviews(last).errorPreview