@mastra/lance 0.0.0-vector-query-tool-provider-options-20250828222356 → 0.0.0-vnext-20251104230439
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/CHANGELOG.md +392 -3
- package/dist/index.cjs +336 -553
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +337 -554
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +18 -39
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/operations/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +12 -4
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +6 -12
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +33 -83
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +21 -8
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -25
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
- package/dist/storage/domains/traces/index.d.ts +0 -34
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
- package/eslint.config.js +0 -6
- package/src/index.ts +0 -2
- package/src/storage/domains/legacy-evals/index.ts +0 -156
- package/src/storage/domains/memory/index.ts +0 -1000
- package/src/storage/domains/operations/index.ts +0 -489
- package/src/storage/domains/scores/index.ts +0 -243
- package/src/storage/domains/traces/index.ts +0 -212
- package/src/storage/domains/utils.ts +0 -158
- package/src/storage/domains/workflows/index.ts +0 -245
- package/src/storage/index.test.ts +0 -10
- package/src/storage/index.ts +0 -494
- package/src/vector/filter.test.ts +0 -295
- package/src/vector/filter.ts +0 -443
- package/src/vector/index.test.ts +0 -1493
- package/src/vector/index.ts +0 -941
- package/src/vector/types.ts +0 -16
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- package/vitest.config.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -1,132 +1,17 @@
|
|
|
1
1
|
import { connect, Index } from '@lancedb/lancedb';
|
|
2
2
|
import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
|
|
3
|
-
import { MastraStorage, StoreOperations,
|
|
3
|
+
import { MastraStorage, StoreOperations, MemoryStorage, TABLE_THREADS, TABLE_MESSAGES, resolveMessageLimit, normalizePerPage, calculatePagination, TABLE_RESOURCES, ScoresStorage, TABLE_SCORERS, WorkflowsStorage, TABLE_WORKFLOW_SNAPSHOT, ensureDate } from '@mastra/core/storage';
|
|
4
4
|
import { MessageList } from '@mastra/core/agent';
|
|
5
5
|
import { Utf8, Float64, Binary, Float32, Int32, Field, Schema } from 'apache-arrow';
|
|
6
|
+
import { saveScorePayloadSchema } from '@mastra/core/evals';
|
|
6
7
|
import { MastraVector } from '@mastra/core/vector';
|
|
7
8
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
8
9
|
|
|
9
10
|
// src/storage/index.ts
|
|
10
|
-
var StoreLegacyEvalsLance = class extends LegacyEvalsStorage {
|
|
11
|
-
client;
|
|
12
|
-
constructor({ client }) {
|
|
13
|
-
super();
|
|
14
|
-
this.client = client;
|
|
15
|
-
}
|
|
16
|
-
async getEvalsByAgentName(agentName, type) {
|
|
17
|
-
try {
|
|
18
|
-
const table = await this.client.openTable(TABLE_EVALS);
|
|
19
|
-
const query = table.query().where(`agent_name = '${agentName}'`);
|
|
20
|
-
const records = await query.toArray();
|
|
21
|
-
let filteredRecords = records;
|
|
22
|
-
if (type === "live") {
|
|
23
|
-
filteredRecords = records.filter((record) => record.test_info === null);
|
|
24
|
-
} else if (type === "test") {
|
|
25
|
-
filteredRecords = records.filter((record) => record.test_info !== null);
|
|
26
|
-
}
|
|
27
|
-
return filteredRecords.map((record) => {
|
|
28
|
-
return {
|
|
29
|
-
id: record.id,
|
|
30
|
-
input: record.input,
|
|
31
|
-
output: record.output,
|
|
32
|
-
agentName: record.agent_name,
|
|
33
|
-
metricName: record.metric_name,
|
|
34
|
-
result: JSON.parse(record.result),
|
|
35
|
-
instructions: record.instructions,
|
|
36
|
-
testInfo: record.test_info ? JSON.parse(record.test_info) : null,
|
|
37
|
-
globalRunId: record.global_run_id,
|
|
38
|
-
runId: record.run_id,
|
|
39
|
-
createdAt: new Date(record.created_at).toString()
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
throw new MastraError(
|
|
44
|
-
{
|
|
45
|
-
id: "LANCE_STORE_GET_EVALS_BY_AGENT_NAME_FAILED",
|
|
46
|
-
domain: ErrorDomain.STORAGE,
|
|
47
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
48
|
-
details: { agentName }
|
|
49
|
-
},
|
|
50
|
-
error
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async getEvals(options) {
|
|
55
|
-
try {
|
|
56
|
-
const table = await this.client.openTable(TABLE_EVALS);
|
|
57
|
-
const conditions = [];
|
|
58
|
-
if (options.agentName) {
|
|
59
|
-
conditions.push(`agent_name = '${options.agentName}'`);
|
|
60
|
-
}
|
|
61
|
-
if (options.type === "live") {
|
|
62
|
-
conditions.push("length(test_info) = 0");
|
|
63
|
-
} else if (options.type === "test") {
|
|
64
|
-
conditions.push("length(test_info) > 0");
|
|
65
|
-
}
|
|
66
|
-
const startDate = options.dateRange?.start || options.fromDate;
|
|
67
|
-
const endDate = options.dateRange?.end || options.toDate;
|
|
68
|
-
if (startDate) {
|
|
69
|
-
conditions.push(`\`created_at\` >= ${startDate.getTime()}`);
|
|
70
|
-
}
|
|
71
|
-
if (endDate) {
|
|
72
|
-
conditions.push(`\`created_at\` <= ${endDate.getTime()}`);
|
|
73
|
-
}
|
|
74
|
-
let total = 0;
|
|
75
|
-
if (conditions.length > 0) {
|
|
76
|
-
total = await table.countRows(conditions.join(" AND "));
|
|
77
|
-
} else {
|
|
78
|
-
total = await table.countRows();
|
|
79
|
-
}
|
|
80
|
-
const query = table.query();
|
|
81
|
-
if (conditions.length > 0) {
|
|
82
|
-
const whereClause = conditions.join(" AND ");
|
|
83
|
-
query.where(whereClause);
|
|
84
|
-
}
|
|
85
|
-
const records = await query.toArray();
|
|
86
|
-
const evals = records.sort((a, b) => b.created_at - a.created_at).map((record) => {
|
|
87
|
-
return {
|
|
88
|
-
id: record.id,
|
|
89
|
-
input: record.input,
|
|
90
|
-
output: record.output,
|
|
91
|
-
agentName: record.agent_name,
|
|
92
|
-
metricName: record.metric_name,
|
|
93
|
-
result: JSON.parse(record.result),
|
|
94
|
-
instructions: record.instructions,
|
|
95
|
-
testInfo: record.test_info ? JSON.parse(record.test_info) : null,
|
|
96
|
-
globalRunId: record.global_run_id,
|
|
97
|
-
runId: record.run_id,
|
|
98
|
-
createdAt: new Date(record.created_at).toISOString()
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
const page = options.page || 0;
|
|
102
|
-
const perPage = options.perPage || 10;
|
|
103
|
-
const pagedEvals = evals.slice(page * perPage, (page + 1) * perPage);
|
|
104
|
-
return {
|
|
105
|
-
evals: pagedEvals,
|
|
106
|
-
total,
|
|
107
|
-
page,
|
|
108
|
-
perPage,
|
|
109
|
-
hasMore: total > (page + 1) * perPage
|
|
110
|
-
};
|
|
111
|
-
} catch (error) {
|
|
112
|
-
throw new MastraError(
|
|
113
|
-
{
|
|
114
|
-
id: "LANCE_STORE_GET_EVALS_FAILED",
|
|
115
|
-
domain: ErrorDomain.STORAGE,
|
|
116
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
117
|
-
details: { agentName: options.agentName ?? "" }
|
|
118
|
-
},
|
|
119
|
-
error
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
11
|
function getPrimaryKeys(tableName) {
|
|
125
12
|
let primaryId = ["id"];
|
|
126
13
|
if (tableName === TABLE_WORKFLOW_SNAPSHOT) {
|
|
127
14
|
primaryId = ["workflow_name", "run_id"];
|
|
128
|
-
} else if (tableName === TABLE_EVALS) {
|
|
129
|
-
primaryId = ["agent_name", "metric_name", "run_id"];
|
|
130
15
|
}
|
|
131
16
|
return primaryId;
|
|
132
17
|
}
|
|
@@ -187,7 +72,6 @@ function processResultWithTypeConversion(rawResult, tableSchema) {
|
|
|
187
72
|
} else if (fieldTypeStr.includes("float64") && ["createdAt", "updatedAt"].includes(key)) {
|
|
188
73
|
processedResult[key] = new Date(processedResult[key]);
|
|
189
74
|
}
|
|
190
|
-
console.log(key, "processedResult", processedResult);
|
|
191
75
|
}
|
|
192
76
|
return processedResult;
|
|
193
77
|
}
|
|
@@ -247,6 +131,10 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
247
131
|
this.client = client;
|
|
248
132
|
this.operations = operations;
|
|
249
133
|
}
|
|
134
|
+
// Utility to escape single quotes in SQL strings
|
|
135
|
+
escapeSql(str) {
|
|
136
|
+
return str.replace(/'/g, "''");
|
|
137
|
+
}
|
|
250
138
|
async getThreadById({ threadId }) {
|
|
251
139
|
try {
|
|
252
140
|
const thread = await this.operations.load({ tableName: TABLE_THREADS, keys: { id: threadId } });
|
|
@@ -269,26 +157,6 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
269
157
|
);
|
|
270
158
|
}
|
|
271
159
|
}
|
|
272
|
-
async getThreadsByResourceId({ resourceId }) {
|
|
273
|
-
try {
|
|
274
|
-
const table = await this.client.openTable(TABLE_THREADS);
|
|
275
|
-
const query = table.query().where(`\`resourceId\` = '${resourceId}'`);
|
|
276
|
-
const records = await query.toArray();
|
|
277
|
-
return processResultWithTypeConversion(
|
|
278
|
-
records,
|
|
279
|
-
await getTableSchema({ tableName: TABLE_THREADS, client: this.client })
|
|
280
|
-
);
|
|
281
|
-
} catch (error) {
|
|
282
|
-
throw new MastraError(
|
|
283
|
-
{
|
|
284
|
-
id: "LANCE_STORE_GET_THREADS_BY_RESOURCE_ID_FAILED",
|
|
285
|
-
domain: ErrorDomain.STORAGE,
|
|
286
|
-
category: ErrorCategory.THIRD_PARTY
|
|
287
|
-
},
|
|
288
|
-
error
|
|
289
|
-
);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
160
|
/**
|
|
293
161
|
* Saves a thread to the database. This function doesn't overwrite existing threads.
|
|
294
162
|
* @param thread - The thread to save
|
|
@@ -397,10 +265,10 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
397
265
|
threadId,
|
|
398
266
|
resourceId,
|
|
399
267
|
selectBy,
|
|
400
|
-
format,
|
|
401
268
|
threadConfig
|
|
402
269
|
}) {
|
|
403
270
|
try {
|
|
271
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
404
272
|
if (threadConfig) {
|
|
405
273
|
throw new Error("ThreadConfig is not supported by LanceDB storage");
|
|
406
274
|
}
|
|
@@ -433,25 +301,28 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
433
301
|
allRecords,
|
|
434
302
|
await getTableSchema({ tableName: TABLE_MESSAGES, client: this.client })
|
|
435
303
|
);
|
|
436
|
-
const list = new MessageList({ threadId, resourceId }).add(
|
|
437
|
-
|
|
438
|
-
|
|
304
|
+
const list = new MessageList({ threadId, resourceId }).add(
|
|
305
|
+
messages.map(this.normalizeMessage),
|
|
306
|
+
"memory"
|
|
307
|
+
);
|
|
308
|
+
return { messages: list.get.all.db() };
|
|
439
309
|
} catch (error) {
|
|
440
310
|
throw new MastraError(
|
|
441
311
|
{
|
|
442
312
|
id: "LANCE_STORE_GET_MESSAGES_FAILED",
|
|
443
313
|
domain: ErrorDomain.STORAGE,
|
|
444
|
-
category: ErrorCategory.THIRD_PARTY
|
|
314
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
315
|
+
details: {
|
|
316
|
+
threadId,
|
|
317
|
+
resourceId: resourceId ?? ""
|
|
318
|
+
}
|
|
445
319
|
},
|
|
446
320
|
error
|
|
447
321
|
);
|
|
448
322
|
}
|
|
449
323
|
}
|
|
450
|
-
async
|
|
451
|
-
messageIds
|
|
452
|
-
format
|
|
453
|
-
}) {
|
|
454
|
-
if (messageIds.length === 0) return [];
|
|
324
|
+
async listMessagesById({ messageIds }) {
|
|
325
|
+
if (messageIds.length === 0) return { messages: [] };
|
|
455
326
|
try {
|
|
456
327
|
const table = await this.client.openTable(TABLE_MESSAGES);
|
|
457
328
|
const quotedIds = messageIds.map((id) => `'${id}'`).join(", ");
|
|
@@ -460,13 +331,15 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
460
331
|
allRecords,
|
|
461
332
|
await getTableSchema({ tableName: TABLE_MESSAGES, client: this.client })
|
|
462
333
|
);
|
|
463
|
-
const list = new MessageList().add(
|
|
464
|
-
|
|
465
|
-
|
|
334
|
+
const list = new MessageList().add(
|
|
335
|
+
messages.map(this.normalizeMessage),
|
|
336
|
+
"memory"
|
|
337
|
+
);
|
|
338
|
+
return { messages: list.get.all.db() };
|
|
466
339
|
} catch (error) {
|
|
467
340
|
throw new MastraError(
|
|
468
341
|
{
|
|
469
|
-
id: "
|
|
342
|
+
id: "LANCE_STORE_LIST_MESSAGES_BY_ID_FAILED",
|
|
470
343
|
domain: ErrorDomain.STORAGE,
|
|
471
344
|
category: ErrorCategory.THIRD_PARTY,
|
|
472
345
|
details: {
|
|
@@ -477,11 +350,145 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
477
350
|
);
|
|
478
351
|
}
|
|
479
352
|
}
|
|
353
|
+
async listMessages(args) {
|
|
354
|
+
const { threadId, resourceId, include, filter, perPage: perPageInput, page = 0, orderBy } = args;
|
|
355
|
+
if (!threadId.trim()) {
|
|
356
|
+
throw new MastraError(
|
|
357
|
+
{
|
|
358
|
+
id: "STORAGE_LANCE_LIST_MESSAGES_INVALID_THREAD_ID",
|
|
359
|
+
domain: ErrorDomain.STORAGE,
|
|
360
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
361
|
+
details: { threadId }
|
|
362
|
+
},
|
|
363
|
+
new Error("threadId must be a non-empty string")
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
const perPage = normalizePerPage(perPageInput, 40);
|
|
367
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
368
|
+
try {
|
|
369
|
+
if (page < 0) {
|
|
370
|
+
throw new MastraError(
|
|
371
|
+
{
|
|
372
|
+
id: "STORAGE_LANCE_LIST_MESSAGES_INVALID_PAGE",
|
|
373
|
+
domain: ErrorDomain.STORAGE,
|
|
374
|
+
category: ErrorCategory.USER,
|
|
375
|
+
details: { page }
|
|
376
|
+
},
|
|
377
|
+
new Error("page must be >= 0")
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
const { field, direction } = this.parseOrderBy(orderBy);
|
|
381
|
+
const table = await this.client.openTable(TABLE_MESSAGES);
|
|
382
|
+
const conditions = [`thread_id = '${this.escapeSql(threadId)}'`];
|
|
383
|
+
if (resourceId) {
|
|
384
|
+
conditions.push(`\`resourceId\` = '${this.escapeSql(resourceId)}'`);
|
|
385
|
+
}
|
|
386
|
+
if (filter?.dateRange?.start) {
|
|
387
|
+
const startTime = filter.dateRange.start instanceof Date ? filter.dateRange.start.getTime() : new Date(filter.dateRange.start).getTime();
|
|
388
|
+
conditions.push(`\`createdAt\` >= ${startTime}`);
|
|
389
|
+
}
|
|
390
|
+
if (filter?.dateRange?.end) {
|
|
391
|
+
const endTime = filter.dateRange.end instanceof Date ? filter.dateRange.end.getTime() : new Date(filter.dateRange.end).getTime();
|
|
392
|
+
conditions.push(`\`createdAt\` <= ${endTime}`);
|
|
393
|
+
}
|
|
394
|
+
const whereClause = conditions.join(" AND ");
|
|
395
|
+
const total = await table.countRows(whereClause);
|
|
396
|
+
const query = table.query().where(whereClause);
|
|
397
|
+
let allRecords = await query.toArray();
|
|
398
|
+
allRecords.sort((a, b) => {
|
|
399
|
+
const aValue = field === "createdAt" ? a.createdAt : a[field];
|
|
400
|
+
const bValue = field === "createdAt" ? b.createdAt : b[field];
|
|
401
|
+
if (aValue == null && bValue == null) return 0;
|
|
402
|
+
if (aValue == null) return direction === "ASC" ? -1 : 1;
|
|
403
|
+
if (bValue == null) return direction === "ASC" ? 1 : -1;
|
|
404
|
+
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
405
|
+
return direction === "ASC" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
|
|
406
|
+
}
|
|
407
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
408
|
+
});
|
|
409
|
+
const paginatedRecords = allRecords.slice(offset, offset + perPage);
|
|
410
|
+
const messages = paginatedRecords.map((row) => this.normalizeMessage(row));
|
|
411
|
+
if (total === 0 && messages.length === 0 && (!include || include.length === 0)) {
|
|
412
|
+
return {
|
|
413
|
+
messages: [],
|
|
414
|
+
total: 0,
|
|
415
|
+
page,
|
|
416
|
+
perPage: perPageForResponse,
|
|
417
|
+
hasMore: false
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
const messageIds = new Set(messages.map((m) => m.id));
|
|
421
|
+
if (include && include.length > 0) {
|
|
422
|
+
const threadIds = [...new Set(include.map((item) => item.threadId || threadId))];
|
|
423
|
+
const allThreadMessages = [];
|
|
424
|
+
for (const tid of threadIds) {
|
|
425
|
+
const threadQuery = table.query().where(`thread_id = '${tid}'`);
|
|
426
|
+
let threadRecords = await threadQuery.toArray();
|
|
427
|
+
allThreadMessages.push(...threadRecords);
|
|
428
|
+
}
|
|
429
|
+
allThreadMessages.sort((a, b) => a.createdAt - b.createdAt);
|
|
430
|
+
const contextMessages = this.processMessagesWithContext(allThreadMessages, include);
|
|
431
|
+
const includedMessages = contextMessages.map((row) => this.normalizeMessage(row));
|
|
432
|
+
for (const includeMsg of includedMessages) {
|
|
433
|
+
if (!messageIds.has(includeMsg.id)) {
|
|
434
|
+
messages.push(includeMsg);
|
|
435
|
+
messageIds.add(includeMsg.id);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
const list = new MessageList().add(messages, "memory");
|
|
440
|
+
let finalMessages = list.get.all.db();
|
|
441
|
+
finalMessages = finalMessages.sort((a, b) => {
|
|
442
|
+
const aValue = field === "createdAt" ? new Date(a.createdAt).getTime() : a[field];
|
|
443
|
+
const bValue = field === "createdAt" ? new Date(b.createdAt).getTime() : b[field];
|
|
444
|
+
if (aValue == null && bValue == null) return 0;
|
|
445
|
+
if (aValue == null) return direction === "ASC" ? -1 : 1;
|
|
446
|
+
if (bValue == null) return direction === "ASC" ? 1 : -1;
|
|
447
|
+
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
448
|
+
return direction === "ASC" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
|
|
449
|
+
}
|
|
450
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
451
|
+
});
|
|
452
|
+
const returnedThreadMessageIds = new Set(finalMessages.filter((m) => m.threadId === threadId).map((m) => m.id));
|
|
453
|
+
const allThreadMessagesReturned = returnedThreadMessageIds.size >= total;
|
|
454
|
+
const fetchedAll = perPageInput === false || allThreadMessagesReturned;
|
|
455
|
+
const hasMore = !fetchedAll && offset + perPage < total;
|
|
456
|
+
return {
|
|
457
|
+
messages: finalMessages,
|
|
458
|
+
total,
|
|
459
|
+
page,
|
|
460
|
+
perPage: perPageForResponse,
|
|
461
|
+
hasMore
|
|
462
|
+
};
|
|
463
|
+
} catch (error) {
|
|
464
|
+
const mastraError = new MastraError(
|
|
465
|
+
{
|
|
466
|
+
id: "LANCE_STORE_LIST_MESSAGES_FAILED",
|
|
467
|
+
domain: ErrorDomain.STORAGE,
|
|
468
|
+
category: ErrorCategory.THIRD_PARTY,
|
|
469
|
+
details: {
|
|
470
|
+
threadId,
|
|
471
|
+
resourceId: resourceId ?? ""
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
error
|
|
475
|
+
);
|
|
476
|
+
this.logger?.error?.(mastraError.toString());
|
|
477
|
+
this.logger?.trackException?.(mastraError);
|
|
478
|
+
return {
|
|
479
|
+
messages: [],
|
|
480
|
+
total: 0,
|
|
481
|
+
page,
|
|
482
|
+
perPage: perPageForResponse,
|
|
483
|
+
hasMore: false
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
}
|
|
480
487
|
async saveMessages(args) {
|
|
481
488
|
try {
|
|
482
|
-
const { messages
|
|
489
|
+
const { messages } = args;
|
|
483
490
|
if (messages.length === 0) {
|
|
484
|
-
return [];
|
|
491
|
+
return { messages: [] };
|
|
485
492
|
}
|
|
486
493
|
const threadId = messages[0]?.threadId;
|
|
487
494
|
if (!threadId) {
|
|
@@ -517,8 +524,7 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
517
524
|
const updateRecord = { id: threadId, updatedAt: currentTime };
|
|
518
525
|
await threadsTable.mergeInsert("id").whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([updateRecord]);
|
|
519
526
|
const list = new MessageList().add(messages, "memory");
|
|
520
|
-
|
|
521
|
-
return list.get.all.v1();
|
|
527
|
+
return { messages: list.get.all.db() };
|
|
522
528
|
} catch (error) {
|
|
523
529
|
throw new MastraError(
|
|
524
530
|
{
|
|
@@ -530,32 +536,54 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
530
536
|
);
|
|
531
537
|
}
|
|
532
538
|
}
|
|
533
|
-
async
|
|
539
|
+
async listThreadsByResourceId(args) {
|
|
534
540
|
try {
|
|
535
|
-
const { resourceId, page = 0, perPage
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
const { resourceId, page = 0, perPage: perPageInput, orderBy } = args;
|
|
542
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
543
|
+
if (page < 0) {
|
|
544
|
+
throw new MastraError(
|
|
545
|
+
{
|
|
546
|
+
id: "STORAGE_LANCE_LIST_THREADS_BY_RESOURCE_ID_INVALID_PAGE",
|
|
547
|
+
domain: ErrorDomain.STORAGE,
|
|
548
|
+
category: ErrorCategory.USER,
|
|
549
|
+
details: { page }
|
|
550
|
+
},
|
|
551
|
+
new Error("page must be >= 0")
|
|
552
|
+
);
|
|
543
553
|
}
|
|
554
|
+
const { offset, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
555
|
+
const { field, direction } = this.parseOrderBy(orderBy);
|
|
556
|
+
const table = await this.client.openTable(TABLE_THREADS);
|
|
557
|
+
const total = await table.countRows(`\`resourceId\` = '${this.escapeSql(resourceId)}'`);
|
|
558
|
+
const query = table.query().where(`\`resourceId\` = '${this.escapeSql(resourceId)}'`);
|
|
544
559
|
const records = await query.toArray();
|
|
545
|
-
records.sort((a, b) =>
|
|
560
|
+
records.sort((a, b) => {
|
|
561
|
+
const aValue = ["createdAt", "updatedAt"].includes(field) ? new Date(a[field]).getTime() : a[field];
|
|
562
|
+
const bValue = ["createdAt", "updatedAt"].includes(field) ? new Date(b[field]).getTime() : b[field];
|
|
563
|
+
if (aValue == null && bValue == null) return 0;
|
|
564
|
+
if (aValue == null) return direction === "ASC" ? -1 : 1;
|
|
565
|
+
if (bValue == null) return direction === "ASC" ? 1 : -1;
|
|
566
|
+
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
567
|
+
return direction === "ASC" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
|
|
568
|
+
}
|
|
569
|
+
return direction === "ASC" ? aValue - bValue : bValue - aValue;
|
|
570
|
+
});
|
|
571
|
+
const paginatedRecords = records.slice(offset, offset + perPage);
|
|
546
572
|
const schema = await getTableSchema({ tableName: TABLE_THREADS, client: this.client });
|
|
547
|
-
const threads =
|
|
573
|
+
const threads = paginatedRecords.map(
|
|
574
|
+
(record) => processResultWithTypeConversion(record, schema)
|
|
575
|
+
);
|
|
548
576
|
return {
|
|
549
577
|
threads,
|
|
550
578
|
total,
|
|
551
579
|
page,
|
|
552
|
-
perPage,
|
|
553
|
-
hasMore:
|
|
580
|
+
perPage: perPageForResponse,
|
|
581
|
+
hasMore: offset + perPage < total
|
|
554
582
|
};
|
|
555
583
|
} catch (error) {
|
|
556
584
|
throw new MastraError(
|
|
557
585
|
{
|
|
558
|
-
id: "
|
|
586
|
+
id: "LANCE_STORE_LIST_THREADS_BY_RESOURCE_ID_FAILED",
|
|
559
587
|
domain: ErrorDomain.STORAGE,
|
|
560
588
|
category: ErrorCategory.THIRD_PARTY
|
|
561
589
|
},
|
|
@@ -611,127 +639,8 @@ var StoreMemoryLance = class extends MemoryStorage {
|
|
|
611
639
|
});
|
|
612
640
|
return Array.from(allIndices).sort((a, b) => a - b).map((index) => records[index]);
|
|
613
641
|
}
|
|
614
|
-
async getMessagesPaginated(args) {
|
|
615
|
-
try {
|
|
616
|
-
const { threadId, resourceId, selectBy, format = "v1" } = args;
|
|
617
|
-
if (!threadId) {
|
|
618
|
-
throw new Error("Thread ID is required for getMessagesPaginated");
|
|
619
|
-
}
|
|
620
|
-
const page = selectBy?.pagination?.page ?? 0;
|
|
621
|
-
const perPage = selectBy?.pagination?.perPage ?? 10;
|
|
622
|
-
const dateRange = selectBy?.pagination?.dateRange;
|
|
623
|
-
const fromDate = dateRange?.start;
|
|
624
|
-
const toDate = dateRange?.end;
|
|
625
|
-
const table = await this.client.openTable(TABLE_MESSAGES);
|
|
626
|
-
const messages = [];
|
|
627
|
-
if (selectBy?.include && Array.isArray(selectBy.include)) {
|
|
628
|
-
const threadIds = [...new Set(selectBy.include.map((item) => item.threadId))];
|
|
629
|
-
const allThreadMessages = [];
|
|
630
|
-
for (const threadId2 of threadIds) {
|
|
631
|
-
const threadQuery = table.query().where(`thread_id = '${threadId2}'`);
|
|
632
|
-
let threadRecords = await threadQuery.toArray();
|
|
633
|
-
if (fromDate) threadRecords = threadRecords.filter((m) => m.createdAt >= fromDate.getTime());
|
|
634
|
-
if (toDate) threadRecords = threadRecords.filter((m) => m.createdAt <= toDate.getTime());
|
|
635
|
-
allThreadMessages.push(...threadRecords);
|
|
636
|
-
}
|
|
637
|
-
allThreadMessages.sort((a, b) => a.createdAt - b.createdAt);
|
|
638
|
-
const contextMessages = this.processMessagesWithContext(allThreadMessages, selectBy.include);
|
|
639
|
-
messages.push(...contextMessages);
|
|
640
|
-
}
|
|
641
|
-
const conditions = [`thread_id = '${threadId}'`];
|
|
642
|
-
if (resourceId) {
|
|
643
|
-
conditions.push(`\`resourceId\` = '${resourceId}'`);
|
|
644
|
-
}
|
|
645
|
-
if (fromDate) {
|
|
646
|
-
conditions.push(`\`createdAt\` >= ${fromDate.getTime()}`);
|
|
647
|
-
}
|
|
648
|
-
if (toDate) {
|
|
649
|
-
conditions.push(`\`createdAt\` <= ${toDate.getTime()}`);
|
|
650
|
-
}
|
|
651
|
-
let total = 0;
|
|
652
|
-
if (conditions.length > 0) {
|
|
653
|
-
total = await table.countRows(conditions.join(" AND "));
|
|
654
|
-
} else {
|
|
655
|
-
total = await table.countRows();
|
|
656
|
-
}
|
|
657
|
-
if (total === 0 && messages.length === 0) {
|
|
658
|
-
return {
|
|
659
|
-
messages: [],
|
|
660
|
-
total: 0,
|
|
661
|
-
page,
|
|
662
|
-
perPage,
|
|
663
|
-
hasMore: false
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
const excludeIds = messages.map((m) => m.id);
|
|
667
|
-
let selectedMessages = [];
|
|
668
|
-
if (selectBy?.last && selectBy.last > 0) {
|
|
669
|
-
const query = table.query();
|
|
670
|
-
if (conditions.length > 0) {
|
|
671
|
-
query.where(conditions.join(" AND "));
|
|
672
|
-
}
|
|
673
|
-
let records = await query.toArray();
|
|
674
|
-
records = records.sort((a, b) => a.createdAt - b.createdAt);
|
|
675
|
-
if (excludeIds.length > 0) {
|
|
676
|
-
records = records.filter((m) => !excludeIds.includes(m.id));
|
|
677
|
-
}
|
|
678
|
-
selectedMessages = records.slice(-selectBy.last);
|
|
679
|
-
} else {
|
|
680
|
-
const query = table.query();
|
|
681
|
-
if (conditions.length > 0) {
|
|
682
|
-
query.where(conditions.join(" AND "));
|
|
683
|
-
}
|
|
684
|
-
let records = await query.toArray();
|
|
685
|
-
records = records.sort((a, b) => a.createdAt - b.createdAt);
|
|
686
|
-
if (excludeIds.length > 0) {
|
|
687
|
-
records = records.filter((m) => !excludeIds.includes(m.id));
|
|
688
|
-
}
|
|
689
|
-
selectedMessages = records.slice(page * perPage, (page + 1) * perPage);
|
|
690
|
-
}
|
|
691
|
-
const allMessages = [...messages, ...selectedMessages];
|
|
692
|
-
const seen = /* @__PURE__ */ new Set();
|
|
693
|
-
const dedupedMessages = allMessages.filter((m) => {
|
|
694
|
-
const key = `${m.id}:${m.thread_id}`;
|
|
695
|
-
if (seen.has(key)) return false;
|
|
696
|
-
seen.add(key);
|
|
697
|
-
return true;
|
|
698
|
-
});
|
|
699
|
-
const formattedMessages = dedupedMessages.map((msg) => {
|
|
700
|
-
const { thread_id, ...rest } = msg;
|
|
701
|
-
return {
|
|
702
|
-
...rest,
|
|
703
|
-
threadId: thread_id,
|
|
704
|
-
content: typeof msg.content === "string" ? (() => {
|
|
705
|
-
try {
|
|
706
|
-
return JSON.parse(msg.content);
|
|
707
|
-
} catch {
|
|
708
|
-
return msg.content;
|
|
709
|
-
}
|
|
710
|
-
})() : msg.content
|
|
711
|
-
};
|
|
712
|
-
});
|
|
713
|
-
const list = new MessageList().add(formattedMessages, "memory");
|
|
714
|
-
return {
|
|
715
|
-
messages: format === "v2" ? list.get.all.v2() : list.get.all.v1(),
|
|
716
|
-
total,
|
|
717
|
-
// Total should be the count of messages matching the filters
|
|
718
|
-
page,
|
|
719
|
-
perPage,
|
|
720
|
-
hasMore: total > (page + 1) * perPage
|
|
721
|
-
};
|
|
722
|
-
} catch (error) {
|
|
723
|
-
throw new MastraError(
|
|
724
|
-
{
|
|
725
|
-
id: "LANCE_STORE_GET_MESSAGES_PAGINATED_FAILED",
|
|
726
|
-
domain: ErrorDomain.STORAGE,
|
|
727
|
-
category: ErrorCategory.THIRD_PARTY
|
|
728
|
-
},
|
|
729
|
-
error
|
|
730
|
-
);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
642
|
/**
|
|
734
|
-
* Parse message data from LanceDB record format to
|
|
643
|
+
* Parse message data from LanceDB record format to MastraDBMessage format
|
|
735
644
|
*/
|
|
736
645
|
parseMessageData(data) {
|
|
737
646
|
const { thread_id, ...rest } = data;
|
|
@@ -1254,7 +1163,7 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1254
1163
|
processedRecord[key] = JSON.stringify(processedRecord[key]);
|
|
1255
1164
|
}
|
|
1256
1165
|
}
|
|
1257
|
-
console.
|
|
1166
|
+
console.info(await table.schema());
|
|
1258
1167
|
await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([processedRecord]);
|
|
1259
1168
|
} catch (error) {
|
|
1260
1169
|
throw new MastraError(
|
|
@@ -1304,7 +1213,6 @@ var StoreOperationsLance = class extends StoreOperations {
|
|
|
1304
1213
|
}
|
|
1305
1214
|
return processedRecord;
|
|
1306
1215
|
});
|
|
1307
|
-
console.log(processedRecords);
|
|
1308
1216
|
await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(processedRecords);
|
|
1309
1217
|
} catch (error) {
|
|
1310
1218
|
throw new MastraError(
|
|
@@ -1388,13 +1296,27 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1388
1296
|
this.client = client;
|
|
1389
1297
|
}
|
|
1390
1298
|
async saveScore(score) {
|
|
1299
|
+
let validatedScore;
|
|
1300
|
+
try {
|
|
1301
|
+
validatedScore = saveScorePayloadSchema.parse(score);
|
|
1302
|
+
} catch (error) {
|
|
1303
|
+
throw new MastraError(
|
|
1304
|
+
{
|
|
1305
|
+
id: "LANCE_STORAGE_SAVE_SCORE_FAILED",
|
|
1306
|
+
text: "Failed to save score in LanceStorage",
|
|
1307
|
+
domain: ErrorDomain.STORAGE,
|
|
1308
|
+
category: ErrorCategory.THIRD_PARTY
|
|
1309
|
+
},
|
|
1310
|
+
error
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1391
1313
|
try {
|
|
1392
1314
|
const id = crypto.randomUUID();
|
|
1393
1315
|
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1394
1316
|
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1395
1317
|
const allowedFields = new Set(schema.fields.map((f) => f.name));
|
|
1396
1318
|
const filteredScore = {};
|
|
1397
|
-
Object.keys(
|
|
1319
|
+
Object.keys(validatedScore).forEach((key) => {
|
|
1398
1320
|
if (allowedFields.has(key)) {
|
|
1399
1321
|
filteredScore[key] = score[key];
|
|
1400
1322
|
}
|
|
@@ -1441,7 +1363,7 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1441
1363
|
);
|
|
1442
1364
|
}
|
|
1443
1365
|
}
|
|
1444
|
-
async
|
|
1366
|
+
async listScoresByScorerId({
|
|
1445
1367
|
scorerId,
|
|
1446
1368
|
pagination,
|
|
1447
1369
|
entityId,
|
|
@@ -1449,9 +1371,10 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1449
1371
|
source
|
|
1450
1372
|
}) {
|
|
1451
1373
|
try {
|
|
1374
|
+
const { page, perPage: perPageInput } = pagination;
|
|
1375
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
1376
|
+
const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
1452
1377
|
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1453
|
-
const { page = 0, perPage = 10 } = pagination || {};
|
|
1454
|
-
const offset = page * perPage;
|
|
1455
1378
|
let query = table.query().where(`\`scorerId\` = '${scorerId}'`);
|
|
1456
1379
|
if (source) {
|
|
1457
1380
|
query = query.where(`\`source\` = '${source}'`);
|
|
@@ -1462,23 +1385,32 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1462
1385
|
if (entityType) {
|
|
1463
1386
|
query = query.where(`\`entityType\` = '${entityType}'`);
|
|
1464
1387
|
}
|
|
1465
|
-
query = query.limit(perPage);
|
|
1466
|
-
if (offset > 0) query.offset(offset);
|
|
1467
|
-
const records = await query.toArray();
|
|
1468
|
-
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1469
|
-
const scores = processResultWithTypeConversion(records, schema);
|
|
1470
1388
|
let totalQuery = table.query().where(`\`scorerId\` = '${scorerId}'`);
|
|
1471
1389
|
if (source) {
|
|
1472
1390
|
totalQuery = totalQuery.where(`\`source\` = '${source}'`);
|
|
1473
1391
|
}
|
|
1392
|
+
if (entityId) {
|
|
1393
|
+
totalQuery = totalQuery.where(`\`entityId\` = '${entityId}'`);
|
|
1394
|
+
}
|
|
1395
|
+
if (entityType) {
|
|
1396
|
+
totalQuery = totalQuery.where(`\`entityType\` = '${entityType}'`);
|
|
1397
|
+
}
|
|
1474
1398
|
const allRecords = await totalQuery.toArray();
|
|
1475
1399
|
const total = allRecords.length;
|
|
1400
|
+
const end = perPageInput === false ? total : start + perPage;
|
|
1401
|
+
if (perPageInput !== false) {
|
|
1402
|
+
query = query.limit(perPage);
|
|
1403
|
+
if (start > 0) query = query.offset(start);
|
|
1404
|
+
}
|
|
1405
|
+
const records = await query.toArray();
|
|
1406
|
+
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1407
|
+
const scores = processResultWithTypeConversion(records, schema);
|
|
1476
1408
|
return {
|
|
1477
1409
|
pagination: {
|
|
1478
1410
|
page,
|
|
1479
|
-
perPage,
|
|
1411
|
+
perPage: perPageForResponse,
|
|
1480
1412
|
total,
|
|
1481
|
-
hasMore:
|
|
1413
|
+
hasMore: end < total
|
|
1482
1414
|
},
|
|
1483
1415
|
scores
|
|
1484
1416
|
};
|
|
@@ -1495,27 +1427,32 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1495
1427
|
);
|
|
1496
1428
|
}
|
|
1497
1429
|
}
|
|
1498
|
-
async
|
|
1430
|
+
async listScoresByRunId({
|
|
1499
1431
|
runId,
|
|
1500
1432
|
pagination
|
|
1501
1433
|
}) {
|
|
1502
1434
|
try {
|
|
1435
|
+
const { page, perPage: perPageInput } = pagination;
|
|
1436
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
1437
|
+
const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
1503
1438
|
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1504
|
-
const
|
|
1505
|
-
const
|
|
1506
|
-
const
|
|
1507
|
-
|
|
1439
|
+
const allRecords = await table.query().where(`\`runId\` = '${runId}'`).toArray();
|
|
1440
|
+
const total = allRecords.length;
|
|
1441
|
+
const end = perPageInput === false ? total : start + perPage;
|
|
1442
|
+
let query = table.query().where(`\`runId\` = '${runId}'`);
|
|
1443
|
+
if (perPageInput !== false) {
|
|
1444
|
+
query = query.limit(perPage);
|
|
1445
|
+
if (start > 0) query = query.offset(start);
|
|
1446
|
+
}
|
|
1508
1447
|
const records = await query.toArray();
|
|
1509
1448
|
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1510
1449
|
const scores = processResultWithTypeConversion(records, schema);
|
|
1511
|
-
const allRecords = await table.query().where(`\`runId\` = '${runId}'`).toArray();
|
|
1512
|
-
const total = allRecords.length;
|
|
1513
1450
|
return {
|
|
1514
1451
|
pagination: {
|
|
1515
1452
|
page,
|
|
1516
|
-
perPage,
|
|
1453
|
+
perPage: perPageForResponse,
|
|
1517
1454
|
total,
|
|
1518
|
-
hasMore:
|
|
1455
|
+
hasMore: end < total
|
|
1519
1456
|
},
|
|
1520
1457
|
scores
|
|
1521
1458
|
};
|
|
@@ -1532,28 +1469,33 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1532
1469
|
);
|
|
1533
1470
|
}
|
|
1534
1471
|
}
|
|
1535
|
-
async
|
|
1472
|
+
async listScoresByEntityId({
|
|
1536
1473
|
entityId,
|
|
1537
1474
|
entityType,
|
|
1538
1475
|
pagination
|
|
1539
1476
|
}) {
|
|
1540
1477
|
try {
|
|
1478
|
+
const { page, perPage: perPageInput } = pagination;
|
|
1479
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
1480
|
+
const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
1541
1481
|
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1542
|
-
const
|
|
1543
|
-
const
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1482
|
+
const allRecords = await table.query().where(`\`entityId\` = '${entityId}' AND \`entityType\` = '${entityType}'`).toArray();
|
|
1483
|
+
const total = allRecords.length;
|
|
1484
|
+
const end = perPageInput === false ? total : start + perPage;
|
|
1485
|
+
let query = table.query().where(`\`entityId\` = '${entityId}' AND \`entityType\` = '${entityType}'`);
|
|
1486
|
+
if (perPageInput !== false) {
|
|
1487
|
+
query = query.limit(perPage);
|
|
1488
|
+
if (start > 0) query = query.offset(start);
|
|
1489
|
+
}
|
|
1546
1490
|
const records = await query.toArray();
|
|
1547
1491
|
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1548
1492
|
const scores = processResultWithTypeConversion(records, schema);
|
|
1549
|
-
const allRecords = await table.query().where(`\`entityId\` = '${entityId}' AND \`entityType\` = '${entityType}'`).toArray();
|
|
1550
|
-
const total = allRecords.length;
|
|
1551
1493
|
return {
|
|
1552
1494
|
pagination: {
|
|
1553
1495
|
page,
|
|
1554
|
-
perPage,
|
|
1496
|
+
perPage: perPageForResponse,
|
|
1555
1497
|
total,
|
|
1556
|
-
hasMore:
|
|
1498
|
+
hasMore: end < total
|
|
1557
1499
|
},
|
|
1558
1500
|
scores
|
|
1559
1501
|
};
|
|
@@ -1570,198 +1512,49 @@ var StoreScoresLance = class extends ScoresStorage {
|
|
|
1570
1512
|
);
|
|
1571
1513
|
}
|
|
1572
1514
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
constructor({ client, operations }) {
|
|
1578
|
-
super();
|
|
1579
|
-
this.client = client;
|
|
1580
|
-
this.operations = operations;
|
|
1581
|
-
}
|
|
1582
|
-
async saveTrace({ trace }) {
|
|
1583
|
-
try {
|
|
1584
|
-
const table = await this.client.openTable(TABLE_TRACES);
|
|
1585
|
-
const record = {
|
|
1586
|
-
...trace,
|
|
1587
|
-
attributes: JSON.stringify(trace.attributes),
|
|
1588
|
-
status: JSON.stringify(trace.status),
|
|
1589
|
-
events: JSON.stringify(trace.events),
|
|
1590
|
-
links: JSON.stringify(trace.links),
|
|
1591
|
-
other: JSON.stringify(trace.other)
|
|
1592
|
-
};
|
|
1593
|
-
await table.add([record], { mode: "append" });
|
|
1594
|
-
return trace;
|
|
1595
|
-
} catch (error) {
|
|
1596
|
-
throw new MastraError(
|
|
1597
|
-
{
|
|
1598
|
-
id: "LANCE_STORE_SAVE_TRACE_FAILED",
|
|
1599
|
-
domain: ErrorDomain.STORAGE,
|
|
1600
|
-
category: ErrorCategory.THIRD_PARTY
|
|
1601
|
-
},
|
|
1602
|
-
error
|
|
1603
|
-
);
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
async getTraceById({ traceId }) {
|
|
1607
|
-
try {
|
|
1608
|
-
const table = await this.client.openTable(TABLE_TRACES);
|
|
1609
|
-
const query = table.query().where(`id = '${traceId}'`);
|
|
1610
|
-
const records = await query.toArray();
|
|
1611
|
-
return records[0];
|
|
1612
|
-
} catch (error) {
|
|
1613
|
-
throw new MastraError(
|
|
1614
|
-
{
|
|
1615
|
-
id: "LANCE_STORE_GET_TRACE_BY_ID_FAILED",
|
|
1616
|
-
domain: ErrorDomain.STORAGE,
|
|
1617
|
-
category: ErrorCategory.THIRD_PARTY
|
|
1618
|
-
},
|
|
1619
|
-
error
|
|
1620
|
-
);
|
|
1621
|
-
}
|
|
1622
|
-
}
|
|
1623
|
-
async getTraces({
|
|
1624
|
-
name,
|
|
1625
|
-
scope,
|
|
1626
|
-
page = 1,
|
|
1627
|
-
perPage = 10,
|
|
1628
|
-
attributes
|
|
1515
|
+
async listScoresBySpan({
|
|
1516
|
+
traceId,
|
|
1517
|
+
spanId,
|
|
1518
|
+
pagination
|
|
1629
1519
|
}) {
|
|
1630
1520
|
try {
|
|
1631
|
-
const
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
}
|
|
1639
|
-
if (
|
|
1640
|
-
query
|
|
1641
|
-
|
|
1642
|
-
const offset = (page - 1) * perPage;
|
|
1643
|
-
query.limit(perPage);
|
|
1644
|
-
if (offset > 0) {
|
|
1645
|
-
query.offset(offset);
|
|
1646
|
-
}
|
|
1647
|
-
const records = await query.toArray();
|
|
1648
|
-
return records.map((record) => {
|
|
1649
|
-
const processed = {
|
|
1650
|
-
...record,
|
|
1651
|
-
attributes: record.attributes ? JSON.parse(record.attributes) : {},
|
|
1652
|
-
status: record.status ? JSON.parse(record.status) : {},
|
|
1653
|
-
events: record.events ? JSON.parse(record.events) : [],
|
|
1654
|
-
links: record.links ? JSON.parse(record.links) : [],
|
|
1655
|
-
other: record.other ? JSON.parse(record.other) : {},
|
|
1656
|
-
startTime: new Date(record.startTime),
|
|
1657
|
-
endTime: new Date(record.endTime),
|
|
1658
|
-
createdAt: new Date(record.createdAt)
|
|
1659
|
-
};
|
|
1660
|
-
if (processed.parentSpanId === null || processed.parentSpanId === void 0) {
|
|
1661
|
-
processed.parentSpanId = "";
|
|
1662
|
-
} else {
|
|
1663
|
-
processed.parentSpanId = String(processed.parentSpanId);
|
|
1664
|
-
}
|
|
1665
|
-
return processed;
|
|
1666
|
-
});
|
|
1667
|
-
} catch (error) {
|
|
1668
|
-
throw new MastraError(
|
|
1669
|
-
{
|
|
1670
|
-
id: "LANCE_STORE_GET_TRACES_FAILED",
|
|
1671
|
-
domain: ErrorDomain.STORAGE,
|
|
1672
|
-
category: ErrorCategory.THIRD_PARTY,
|
|
1673
|
-
details: { name: name ?? "", scope: scope ?? "" }
|
|
1674
|
-
},
|
|
1675
|
-
error
|
|
1676
|
-
);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
async getTracesPaginated(args) {
|
|
1680
|
-
try {
|
|
1681
|
-
const table = await this.client.openTable(TABLE_TRACES);
|
|
1682
|
-
const query = table.query();
|
|
1683
|
-
const conditions = [];
|
|
1684
|
-
if (args.name) {
|
|
1685
|
-
conditions.push(`name = '${args.name}'`);
|
|
1686
|
-
}
|
|
1687
|
-
if (args.scope) {
|
|
1688
|
-
conditions.push(`scope = '${args.scope}'`);
|
|
1689
|
-
}
|
|
1690
|
-
if (args.attributes) {
|
|
1691
|
-
const attributesStr = JSON.stringify(args.attributes);
|
|
1692
|
-
conditions.push(`attributes LIKE '%${attributesStr.replace(/"/g, '\\"')}%'`);
|
|
1693
|
-
}
|
|
1694
|
-
if (args.dateRange?.start) {
|
|
1695
|
-
conditions.push(`\`createdAt\` >= ${args.dateRange.start.getTime()}`);
|
|
1696
|
-
}
|
|
1697
|
-
if (args.dateRange?.end) {
|
|
1698
|
-
conditions.push(`\`createdAt\` <= ${args.dateRange.end.getTime()}`);
|
|
1699
|
-
}
|
|
1700
|
-
if (conditions.length > 0) {
|
|
1701
|
-
const whereClause = conditions.join(" AND ");
|
|
1702
|
-
query.where(whereClause);
|
|
1703
|
-
}
|
|
1704
|
-
let total = 0;
|
|
1705
|
-
if (conditions.length > 0) {
|
|
1706
|
-
const countQuery = table.query().where(conditions.join(" AND "));
|
|
1707
|
-
const allRecords = await countQuery.toArray();
|
|
1708
|
-
total = allRecords.length;
|
|
1709
|
-
} else {
|
|
1710
|
-
total = await table.countRows();
|
|
1711
|
-
}
|
|
1712
|
-
const page = args.page || 0;
|
|
1713
|
-
const perPage = args.perPage || 10;
|
|
1714
|
-
const offset = page * perPage;
|
|
1715
|
-
query.limit(perPage);
|
|
1716
|
-
if (offset > 0) {
|
|
1717
|
-
query.offset(offset);
|
|
1521
|
+
const { page, perPage: perPageInput } = pagination;
|
|
1522
|
+
const perPage = normalizePerPage(perPageInput, 100);
|
|
1523
|
+
const { offset: start, perPage: perPageForResponse } = calculatePagination(page, perPageInput, perPage);
|
|
1524
|
+
const table = await this.client.openTable(TABLE_SCORERS);
|
|
1525
|
+
const allRecords = await table.query().where(`\`traceId\` = '${traceId}' AND \`spanId\` = '${spanId}'`).toArray();
|
|
1526
|
+
const total = allRecords.length;
|
|
1527
|
+
const end = perPageInput === false ? total : start + perPage;
|
|
1528
|
+
let query = table.query().where(`\`traceId\` = '${traceId}' AND \`spanId\` = '${spanId}'`);
|
|
1529
|
+
if (perPageInput !== false) {
|
|
1530
|
+
query = query.limit(perPage);
|
|
1531
|
+
if (start > 0) query = query.offset(start);
|
|
1718
1532
|
}
|
|
1719
1533
|
const records = await query.toArray();
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1722
|
-
...record,
|
|
1723
|
-
attributes: record.attributes ? JSON.parse(record.attributes) : {},
|
|
1724
|
-
status: record.status ? JSON.parse(record.status) : {},
|
|
1725
|
-
events: record.events ? JSON.parse(record.events) : [],
|
|
1726
|
-
links: record.links ? JSON.parse(record.links) : [],
|
|
1727
|
-
other: record.other ? JSON.parse(record.other) : {},
|
|
1728
|
-
startTime: new Date(record.startTime),
|
|
1729
|
-
endTime: new Date(record.endTime),
|
|
1730
|
-
createdAt: new Date(record.createdAt)
|
|
1731
|
-
};
|
|
1732
|
-
if (processed.parentSpanId === null || processed.parentSpanId === void 0) {
|
|
1733
|
-
processed.parentSpanId = "";
|
|
1734
|
-
} else {
|
|
1735
|
-
processed.parentSpanId = String(processed.parentSpanId);
|
|
1736
|
-
}
|
|
1737
|
-
return processed;
|
|
1738
|
-
});
|
|
1534
|
+
const schema = await getTableSchema({ tableName: TABLE_SCORERS, client: this.client });
|
|
1535
|
+
const scores = processResultWithTypeConversion(records, schema);
|
|
1739
1536
|
return {
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1537
|
+
pagination: {
|
|
1538
|
+
page,
|
|
1539
|
+
perPage: perPageForResponse,
|
|
1540
|
+
total,
|
|
1541
|
+
hasMore: end < total
|
|
1542
|
+
},
|
|
1543
|
+
scores
|
|
1745
1544
|
};
|
|
1746
1545
|
} catch (error) {
|
|
1747
1546
|
throw new MastraError(
|
|
1748
1547
|
{
|
|
1749
|
-
id: "
|
|
1548
|
+
id: "LANCE_STORAGE_GET_SCORES_BY_SPAN_FAILED",
|
|
1549
|
+
text: "Failed to get scores by traceId and spanId in LanceStorage",
|
|
1750
1550
|
domain: ErrorDomain.STORAGE,
|
|
1751
1551
|
category: ErrorCategory.THIRD_PARTY,
|
|
1752
|
-
details: {
|
|
1552
|
+
details: { error: error?.message }
|
|
1753
1553
|
},
|
|
1754
1554
|
error
|
|
1755
1555
|
);
|
|
1756
1556
|
}
|
|
1757
1557
|
}
|
|
1758
|
-
async batchTraceInsert({ records }) {
|
|
1759
|
-
this.logger.debug("Batch inserting traces", { count: records.length });
|
|
1760
|
-
await this.operations.batchInsert({
|
|
1761
|
-
tableName: TABLE_TRACES,
|
|
1762
|
-
records
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
1558
|
};
|
|
1766
1559
|
function parseWorkflowRun(row) {
|
|
1767
1560
|
let parsedSnapshot = row.snapshot;
|
|
@@ -1792,7 +1585,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1792
1585
|
// runId,
|
|
1793
1586
|
// stepId,
|
|
1794
1587
|
// result,
|
|
1795
|
-
//
|
|
1588
|
+
// requestContext,
|
|
1796
1589
|
}) {
|
|
1797
1590
|
throw new Error("Method not implemented.");
|
|
1798
1591
|
}
|
|
@@ -1806,6 +1599,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1806
1599
|
async persistWorkflowSnapshot({
|
|
1807
1600
|
workflowName,
|
|
1808
1601
|
runId,
|
|
1602
|
+
resourceId,
|
|
1809
1603
|
snapshot
|
|
1810
1604
|
}) {
|
|
1811
1605
|
try {
|
|
@@ -1822,6 +1616,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1822
1616
|
const record = {
|
|
1823
1617
|
workflow_name: workflowName,
|
|
1824
1618
|
run_id: runId,
|
|
1619
|
+
resourceId,
|
|
1825
1620
|
snapshot: JSON.stringify(snapshot),
|
|
1826
1621
|
createdAt,
|
|
1827
1622
|
updatedAt: now
|
|
@@ -1884,7 +1679,7 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1884
1679
|
);
|
|
1885
1680
|
}
|
|
1886
1681
|
}
|
|
1887
|
-
async
|
|
1682
|
+
async listWorkflowRuns(args) {
|
|
1888
1683
|
try {
|
|
1889
1684
|
const table = await this.client.openTable(TABLE_WORKFLOW_SNAPSHOT);
|
|
1890
1685
|
let query = table.query();
|
|
@@ -1908,11 +1703,22 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1908
1703
|
} else {
|
|
1909
1704
|
total = await table.countRows();
|
|
1910
1705
|
}
|
|
1911
|
-
if (args?.
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1706
|
+
if (args?.perPage !== void 0 && args?.page !== void 0) {
|
|
1707
|
+
const normalizedPerPage = normalizePerPage(args.perPage, Number.MAX_SAFE_INTEGER);
|
|
1708
|
+
if (args.page < 0 || !Number.isInteger(args.page)) {
|
|
1709
|
+
throw new MastraError(
|
|
1710
|
+
{
|
|
1711
|
+
id: "LANCE_STORE_INVALID_PAGINATION_PARAMS",
|
|
1712
|
+
domain: ErrorDomain.STORAGE,
|
|
1713
|
+
category: ErrorCategory.USER,
|
|
1714
|
+
details: { page: args.page, perPage: args.perPage }
|
|
1715
|
+
},
|
|
1716
|
+
new Error(`Invalid pagination parameters: page=${args.page}, perPage=${args.perPage}`)
|
|
1717
|
+
);
|
|
1718
|
+
}
|
|
1719
|
+
const offset = args.page * normalizedPerPage;
|
|
1720
|
+
query.limit(normalizedPerPage);
|
|
1721
|
+
query.offset(offset);
|
|
1916
1722
|
}
|
|
1917
1723
|
const records = await query.toArray();
|
|
1918
1724
|
return {
|
|
@@ -1922,10 +1728,10 @@ var StoreWorkflowsLance = class extends WorkflowsStorage {
|
|
|
1922
1728
|
} catch (error) {
|
|
1923
1729
|
throw new MastraError(
|
|
1924
1730
|
{
|
|
1925
|
-
id: "
|
|
1731
|
+
id: "LANCE_STORE_LIST_WORKFLOW_RUNS_FAILED",
|
|
1926
1732
|
domain: ErrorDomain.STORAGE,
|
|
1927
1733
|
category: ErrorCategory.THIRD_PARTY,
|
|
1928
|
-
details: {
|
|
1734
|
+
details: { resourceId: args?.resourceId ?? "", workflowName: args?.workflowName ?? "" }
|
|
1929
1735
|
},
|
|
1930
1736
|
error
|
|
1931
1737
|
);
|
|
@@ -1967,10 +1773,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1967
1773
|
instance.stores = {
|
|
1968
1774
|
operations: new StoreOperationsLance({ client: instance.lanceClient }),
|
|
1969
1775
|
workflows: new StoreWorkflowsLance({ client: instance.lanceClient }),
|
|
1970
|
-
traces: new StoreTracesLance({ client: instance.lanceClient, operations }),
|
|
1971
1776
|
scores: new StoreScoresLance({ client: instance.lanceClient }),
|
|
1972
|
-
memory: new StoreMemoryLance({ client: instance.lanceClient, operations })
|
|
1973
|
-
legacyEvals: new StoreLegacyEvalsLance({ client: instance.lanceClient })
|
|
1777
|
+
memory: new StoreMemoryLance({ client: instance.lanceClient, operations })
|
|
1974
1778
|
};
|
|
1975
1779
|
return instance;
|
|
1976
1780
|
} catch (e) {
|
|
@@ -1996,9 +1800,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
1996
1800
|
this.stores = {
|
|
1997
1801
|
operations: new StoreOperationsLance({ client: this.lanceClient }),
|
|
1998
1802
|
workflows: new StoreWorkflowsLance({ client: this.lanceClient }),
|
|
1999
|
-
traces: new StoreTracesLance({ client: this.lanceClient, operations }),
|
|
2000
1803
|
scores: new StoreScoresLance({ client: this.lanceClient }),
|
|
2001
|
-
legacyEvals: new StoreLegacyEvalsLance({ client: this.lanceClient }),
|
|
2002
1804
|
memory: new StoreMemoryLance({ client: this.lanceClient, operations })
|
|
2003
1805
|
};
|
|
2004
1806
|
}
|
|
@@ -2033,9 +1835,6 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
2033
1835
|
async getThreadById({ threadId }) {
|
|
2034
1836
|
return this.stores.memory.getThreadById({ threadId });
|
|
2035
1837
|
}
|
|
2036
|
-
async getThreadsByResourceId({ resourceId }) {
|
|
2037
|
-
return this.stores.memory.getThreadsByResourceId({ resourceId });
|
|
2038
|
-
}
|
|
2039
1838
|
/**
|
|
2040
1839
|
* Saves a thread to the database. This function doesn't overwrite existing threads.
|
|
2041
1840
|
* @param thread - The thread to save
|
|
@@ -2060,7 +1859,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
2060
1859
|
resourceWorkingMemory: true,
|
|
2061
1860
|
hasColumn: true,
|
|
2062
1861
|
createTable: true,
|
|
2063
|
-
deleteMessages: false
|
|
1862
|
+
deleteMessages: false,
|
|
1863
|
+
listScoresBySpan: true
|
|
2064
1864
|
};
|
|
2065
1865
|
}
|
|
2066
1866
|
async getResourceById({ resourceId }) {
|
|
@@ -2128,46 +1928,21 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
2128
1928
|
threadId,
|
|
2129
1929
|
resourceId,
|
|
2130
1930
|
selectBy,
|
|
2131
|
-
format,
|
|
2132
1931
|
threadConfig
|
|
2133
1932
|
}) {
|
|
2134
|
-
return this.stores.memory.getMessages({ threadId, resourceId, selectBy,
|
|
1933
|
+
return this.stores.memory.getMessages({ threadId, resourceId, selectBy, threadConfig });
|
|
2135
1934
|
}
|
|
2136
|
-
async
|
|
2137
|
-
messageIds
|
|
2138
|
-
format
|
|
2139
|
-
}) {
|
|
2140
|
-
return this.stores.memory.getMessagesById({ messageIds, format });
|
|
1935
|
+
async listMessagesById({ messageIds }) {
|
|
1936
|
+
return this.stores.memory.listMessagesById({ messageIds });
|
|
2141
1937
|
}
|
|
2142
1938
|
async saveMessages(args) {
|
|
2143
1939
|
return this.stores.memory.saveMessages(args);
|
|
2144
1940
|
}
|
|
2145
|
-
async getThreadsByResourceIdPaginated(args) {
|
|
2146
|
-
return this.stores.memory.getThreadsByResourceIdPaginated(args);
|
|
2147
|
-
}
|
|
2148
|
-
async getMessagesPaginated(args) {
|
|
2149
|
-
return this.stores.memory.getMessagesPaginated(args);
|
|
2150
|
-
}
|
|
2151
1941
|
async updateMessages(_args) {
|
|
2152
1942
|
return this.stores.memory.updateMessages(_args);
|
|
2153
1943
|
}
|
|
2154
|
-
async
|
|
2155
|
-
return this.stores.
|
|
2156
|
-
}
|
|
2157
|
-
async getTraces(args) {
|
|
2158
|
-
return this.stores.traces.getTraces(args);
|
|
2159
|
-
}
|
|
2160
|
-
async getTracesPaginated(args) {
|
|
2161
|
-
return this.stores.traces.getTracesPaginated(args);
|
|
2162
|
-
}
|
|
2163
|
-
async getEvalsByAgentName(agentName, type) {
|
|
2164
|
-
return this.stores.legacyEvals.getEvalsByAgentName(agentName, type);
|
|
2165
|
-
}
|
|
2166
|
-
async getEvals(options) {
|
|
2167
|
-
return this.stores.legacyEvals.getEvals(options);
|
|
2168
|
-
}
|
|
2169
|
-
async getWorkflowRuns(args) {
|
|
2170
|
-
return this.stores.workflows.getWorkflowRuns(args);
|
|
1944
|
+
async listWorkflowRuns(args) {
|
|
1945
|
+
return this.stores.workflows.listWorkflowRuns(args);
|
|
2171
1946
|
}
|
|
2172
1947
|
async getWorkflowRunById(args) {
|
|
2173
1948
|
return this.stores.workflows.getWorkflowRunById(args);
|
|
@@ -2177,9 +1952,9 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
2177
1952
|
runId,
|
|
2178
1953
|
stepId,
|
|
2179
1954
|
result,
|
|
2180
|
-
|
|
1955
|
+
requestContext
|
|
2181
1956
|
}) {
|
|
2182
|
-
return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result,
|
|
1957
|
+
return this.stores.workflows.updateWorkflowResults({ workflowName, runId, stepId, result, requestContext });
|
|
2183
1958
|
}
|
|
2184
1959
|
async updateWorkflowState({
|
|
2185
1960
|
workflowName,
|
|
@@ -2191,9 +1966,10 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
2191
1966
|
async persistWorkflowSnapshot({
|
|
2192
1967
|
workflowName,
|
|
2193
1968
|
runId,
|
|
1969
|
+
resourceId,
|
|
2194
1970
|
snapshot
|
|
2195
1971
|
}) {
|
|
2196
|
-
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
1972
|
+
return this.stores.workflows.persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot });
|
|
2197
1973
|
}
|
|
2198
1974
|
async loadWorkflowSnapshot({
|
|
2199
1975
|
workflowName,
|
|
@@ -2204,30 +1980,37 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
|
|
|
2204
1980
|
async getScoreById({ id: _id }) {
|
|
2205
1981
|
return this.stores.scores.getScoreById({ id: _id });
|
|
2206
1982
|
}
|
|
2207
|
-
async
|
|
1983
|
+
async listScoresByScorerId({
|
|
2208
1984
|
scorerId,
|
|
2209
1985
|
source,
|
|
2210
1986
|
entityId,
|
|
2211
1987
|
entityType,
|
|
2212
1988
|
pagination
|
|
2213
1989
|
}) {
|
|
2214
|
-
return this.stores.scores.
|
|
1990
|
+
return this.stores.scores.listScoresByScorerId({ scorerId, source, pagination, entityId, entityType });
|
|
2215
1991
|
}
|
|
2216
1992
|
async saveScore(_score) {
|
|
2217
1993
|
return this.stores.scores.saveScore(_score);
|
|
2218
1994
|
}
|
|
2219
|
-
async
|
|
1995
|
+
async listScoresByRunId({
|
|
2220
1996
|
runId,
|
|
2221
1997
|
pagination
|
|
2222
1998
|
}) {
|
|
2223
|
-
return this.stores.scores.
|
|
1999
|
+
return this.stores.scores.listScoresByRunId({ runId, pagination });
|
|
2224
2000
|
}
|
|
2225
|
-
async
|
|
2001
|
+
async listScoresByEntityId({
|
|
2226
2002
|
entityId,
|
|
2227
2003
|
entityType,
|
|
2228
2004
|
pagination
|
|
2229
2005
|
}) {
|
|
2230
|
-
return this.stores.scores.
|
|
2006
|
+
return this.stores.scores.listScoresByEntityId({ entityId, entityType, pagination });
|
|
2007
|
+
}
|
|
2008
|
+
async listScoresBySpan({
|
|
2009
|
+
traceId,
|
|
2010
|
+
spanId,
|
|
2011
|
+
pagination
|
|
2012
|
+
}) {
|
|
2013
|
+
return this.stores.scores.listScoresBySpan({ traceId, spanId, pagination });
|
|
2231
2014
|
}
|
|
2232
2015
|
};
|
|
2233
2016
|
var LanceFilterTranslator = class extends BaseFilterTranslator {
|