@mastra/lance 0.0.0-scorers-api-v2-20250801171841 → 0.0.0-scorers-logs-20251208093427
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 +982 -3
- package/README.md +64 -7
- package/dist/index.cjs +725 -720
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +726 -721
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +18 -33
- 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 +24 -5
- 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 +23 -11
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +87 -81
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/vector/filter.d.ts +5 -5
- package/dist/vector/index.d.ts +8 -5
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +29 -10
- 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 -947
- package/src/storage/domains/operations/index.ts +0 -489
- package/src/storage/domains/scores/index.ts +0 -221
- 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 -207
- package/src/storage/index.test.ts +0 -10
- package/src/storage/index.ts +0 -442
- 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 -22
- package/vitest.config.ts +0 -11
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Connection } from '@lancedb/lancedb';
|
|
2
2
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
4
4
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
6
|
-
import type { StoreOperationsLance } from '../operations';
|
|
5
|
+
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
|
|
6
|
+
import type { StoreOperationsLance } from '../operations/index.js';
|
|
7
7
|
export declare class StoreMemoryLance extends MemoryStorage {
|
|
8
8
|
private client;
|
|
9
9
|
private operations;
|
|
@@ -11,12 +11,10 @@ export declare class StoreMemoryLance extends MemoryStorage {
|
|
|
11
11
|
client: Connection;
|
|
12
12
|
operations: StoreOperationsLance;
|
|
13
13
|
});
|
|
14
|
+
private escapeSql;
|
|
14
15
|
getThreadById({ threadId }: {
|
|
15
16
|
threadId: string;
|
|
16
17
|
}): Promise<StorageThreadType | null>;
|
|
17
|
-
getThreadsByResourceId({ resourceId }: {
|
|
18
|
-
resourceId: string;
|
|
19
|
-
}): Promise<StorageThreadType[]>;
|
|
20
18
|
/**
|
|
21
19
|
* Saves a thread to the database. This function doesn't overwrite existing threads.
|
|
22
20
|
* @param thread - The thread to save
|
|
@@ -33,27 +31,19 @@ export declare class StoreMemoryLance extends MemoryStorage {
|
|
|
33
31
|
deleteThread({ threadId }: {
|
|
34
32
|
threadId: string;
|
|
35
33
|
}): Promise<void>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
messages: MastraMessageV1[];
|
|
44
|
-
format?: undefined | 'v1';
|
|
45
|
-
}): Promise<MastraMessageV1[]>;
|
|
34
|
+
private normalizeMessage;
|
|
35
|
+
listMessagesById({ messageIds }: {
|
|
36
|
+
messageIds: string[];
|
|
37
|
+
}): Promise<{
|
|
38
|
+
messages: MastraDBMessage[];
|
|
39
|
+
}>;
|
|
40
|
+
listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
|
|
46
41
|
saveMessages(args: {
|
|
47
|
-
messages:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
getThreadsByResourceIdPaginated(args: {
|
|
51
|
-
resourceId: string;
|
|
52
|
-
page?: number;
|
|
53
|
-
perPage?: number;
|
|
54
|
-
}): Promise<PaginationInfo & {
|
|
55
|
-
threads: StorageThreadType[];
|
|
42
|
+
messages: MastraDBMessage[];
|
|
43
|
+
}): Promise<{
|
|
44
|
+
messages: MastraDBMessage[];
|
|
56
45
|
}>;
|
|
46
|
+
listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
|
|
57
47
|
/**
|
|
58
48
|
* Processes messages to include context messages based on withPreviousMessages and withNextMessages
|
|
59
49
|
* @param records - The sorted array of records to process
|
|
@@ -61,24 +51,19 @@ export declare class StoreMemoryLance extends MemoryStorage {
|
|
|
61
51
|
* @returns The processed array with context messages included
|
|
62
52
|
*/
|
|
63
53
|
private processMessagesWithContext;
|
|
64
|
-
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
65
|
-
format?: 'v1' | 'v2';
|
|
66
|
-
}): Promise<PaginationInfo & {
|
|
67
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
68
|
-
}>;
|
|
69
54
|
/**
|
|
70
|
-
* Parse message data from LanceDB record format to
|
|
55
|
+
* Parse message data from LanceDB record format to MastraDBMessage format
|
|
71
56
|
*/
|
|
72
57
|
private parseMessageData;
|
|
73
58
|
updateMessages(args: {
|
|
74
|
-
messages: Partial<Omit<
|
|
59
|
+
messages: Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
75
60
|
id: string;
|
|
76
61
|
content?: {
|
|
77
62
|
metadata?: MastraMessageContentV2['metadata'];
|
|
78
63
|
content?: MastraMessageContentV2['content'];
|
|
79
64
|
};
|
|
80
65
|
}[];
|
|
81
|
-
}): Promise<
|
|
66
|
+
}): Promise<MastraDBMessage[]>;
|
|
82
67
|
getResourceById({ resourceId }: {
|
|
83
68
|
resourceId: string;
|
|
84
69
|
}): Promise<StorageResourceType | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAmB,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EAEL,aAAa,EAMd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAuB;gBAC7B,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;QAAE,MAAM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B;IAoBlB,cAAc,CAAC,IAAI,EAAE;QACzB,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,GACnD;YACE,EAAE,EAAE,MAAM,CAAC;YACX,OAAO,CAAC,EAAE;gBAAE,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;gBAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAA;aAAE,CAAC;SAC1G,EAAE,CAAC;KACP,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAgGxB,eAAe,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAiG5F,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,mBAAmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAyB3F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CA+DjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAwB,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAA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E,OAAO,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA+DzG,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;CA8ErG"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Connection } from '@lancedb/lancedb';
|
|
2
|
-
import type { ScoreRowData } from '@mastra/core/
|
|
2
|
+
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
3
3
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
4
4
|
import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
|
|
5
5
|
export declare class StoreScoresLance extends ScoresStorage {
|
|
@@ -7,27 +7,38 @@ export declare class StoreScoresLance extends ScoresStorage {
|
|
|
7
7
|
constructor({ client }: {
|
|
8
8
|
client: Connection;
|
|
9
9
|
});
|
|
10
|
-
saveScore(score:
|
|
10
|
+
saveScore(score: SaveScorePayload): Promise<{
|
|
11
11
|
score: ScoreRowData;
|
|
12
12
|
}>;
|
|
13
13
|
getScoreById({ id }: {
|
|
14
14
|
id: string;
|
|
15
15
|
}): Promise<ScoreRowData | null>;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* LanceDB-specific score row transformation.
|
|
18
|
+
*
|
|
19
|
+
* Note: This implementation does NOT use coreTransformScoreRow because:
|
|
20
|
+
* 1. LanceDB stores schema information in the table itself (requires async fetch)
|
|
21
|
+
* 2. Uses processResultWithTypeConversion utility for LanceDB-specific type handling
|
|
22
|
+
*/
|
|
23
|
+
private transformScoreRow;
|
|
24
|
+
listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
17
25
|
scorerId: string;
|
|
18
26
|
pagination: StoragePagination;
|
|
27
|
+
entityId?: string;
|
|
28
|
+
entityType?: string;
|
|
29
|
+
source?: ScoringSource;
|
|
19
30
|
}): Promise<{
|
|
20
31
|
pagination: PaginationInfo;
|
|
21
32
|
scores: ScoreRowData[];
|
|
22
33
|
}>;
|
|
23
|
-
|
|
34
|
+
listScoresByRunId({ runId, pagination, }: {
|
|
24
35
|
runId: string;
|
|
25
36
|
pagination: StoragePagination;
|
|
26
37
|
}): Promise<{
|
|
27
38
|
pagination: PaginationInfo;
|
|
28
39
|
scores: ScoreRowData[];
|
|
29
40
|
}>;
|
|
30
|
-
|
|
41
|
+
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
31
42
|
pagination: StoragePagination;
|
|
32
43
|
entityId: string;
|
|
33
44
|
entityType: string;
|
|
@@ -35,5 +46,13 @@ export declare class StoreScoresLance extends ScoresStorage {
|
|
|
35
46
|
pagination: PaginationInfo;
|
|
36
47
|
scores: ScoreRowData[];
|
|
37
48
|
}>;
|
|
49
|
+
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
50
|
+
traceId: string;
|
|
51
|
+
spanId: string;
|
|
52
|
+
pagination: StoragePagination;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
pagination: PaginationInfo;
|
|
55
|
+
scores: ScoreRowData[];
|
|
56
|
+
}>;
|
|
38
57
|
}
|
|
39
58
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UA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AC,EACzB,QAAQ,EACR,UAAU,EACV,UAAU,GACX,EAAE;QACD,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAoD7D,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAgDpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,wBAAgB,cAAc,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/domains/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAa,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,wBAAgB,cAAc,CAAC,SAAS,EAAE,WAAW,GAAG,MAAM,EAAE,CAO/D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,UAAU,GAAG,IAAI,CA4BzF;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EACtD,WAAW,EAAE,UAAU,GACtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAqD7C;AAED,wBAAsB,cAAc,CAAC,EACnC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;CACpB,GAAG,OAAO,CAAC,UAAU,CAAC,CA6CtB"}
|
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
import type { Connection } from '@lancedb/lancedb';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StorageListWorkflowRunsInput, WorkflowRuns } from '@mastra/core/storage';
|
|
3
3
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
4
|
+
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
5
|
export declare class StoreWorkflowsLance extends WorkflowsStorage {
|
|
5
6
|
client: Connection;
|
|
6
7
|
constructor({ client }: {
|
|
7
8
|
client: Connection;
|
|
8
9
|
});
|
|
9
|
-
|
|
10
|
+
updateWorkflowResults({}: {
|
|
10
11
|
workflowName: string;
|
|
11
12
|
runId: string;
|
|
13
|
+
stepId: string;
|
|
14
|
+
result: StepResult<any, any, any, any>;
|
|
15
|
+
requestContext: Record<string, any>;
|
|
16
|
+
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
17
|
+
updateWorkflowState({}: {
|
|
18
|
+
workflowName: string;
|
|
19
|
+
runId: string;
|
|
20
|
+
opts: {
|
|
21
|
+
status: string;
|
|
22
|
+
result?: StepResult<any, any, any, any>;
|
|
23
|
+
error?: string;
|
|
24
|
+
suspendedPaths?: Record<string, number[]>;
|
|
25
|
+
waitingPaths?: Record<string, number[]>;
|
|
26
|
+
};
|
|
27
|
+
}): Promise<WorkflowRunState | undefined>;
|
|
28
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
29
|
+
workflowName: string;
|
|
30
|
+
runId: string;
|
|
31
|
+
resourceId?: string;
|
|
12
32
|
snapshot: WorkflowRunState;
|
|
13
33
|
}): Promise<void>;
|
|
14
34
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
@@ -25,14 +45,6 @@ export declare class StoreWorkflowsLance extends WorkflowsStorage {
|
|
|
25
45
|
createdAt: Date;
|
|
26
46
|
updatedAt: Date;
|
|
27
47
|
} | null>;
|
|
28
|
-
|
|
29
|
-
namespace?: string;
|
|
30
|
-
resourceId?: string;
|
|
31
|
-
workflowName?: string;
|
|
32
|
-
fromDate?: Date;
|
|
33
|
-
toDate?: Date;
|
|
34
|
-
limit?: number;
|
|
35
|
-
offset?: number;
|
|
36
|
-
}): Promise<WorkflowRuns>;
|
|
48
|
+
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
37
49
|
}
|
|
38
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,EAAe,4BAA4B,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAKL,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAuB3E,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,MAAM,EAAE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E;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAmB9B,kBAAkB,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAChF,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,GAAG,CAAC;QACd,SAAS,EAAE,IAAI,CAAC;QAChB,SAAS,EAAE,IAAI,CAAC;KACjB,GAAG,IAAI,CAAC;IAyBH,gBAAgB,CAAC,IAAI,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,YAAY,CAAC;CAkFnF"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,37 +1,66 @@
|
|
|
1
1
|
import type { ConnectionOptions } from '@lancedb/lancedb';
|
|
2
2
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
4
|
+
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
5
5
|
import { MastraStorage } from '@mastra/core/storage';
|
|
6
|
-
import type { TABLE_NAMES, PaginationInfo,
|
|
7
|
-
import type {
|
|
8
|
-
|
|
6
|
+
import type { TABLE_NAMES, PaginationInfo, StorageColumn, WorkflowRuns, StoragePagination, StorageDomains, StorageResourceType, StorageListWorkflowRunsInput } from '@mastra/core/storage';
|
|
7
|
+
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
8
|
+
export interface LanceStorageOptions {
|
|
9
|
+
/**
|
|
10
|
+
* When true, automatic initialization (table creation/migrations) is disabled.
|
|
11
|
+
* This is useful for CI/CD pipelines where you want to:
|
|
12
|
+
* 1. Run migrations explicitly during deployment (not at runtime)
|
|
13
|
+
* 2. Use different credentials for schema changes vs runtime operations
|
|
14
|
+
*
|
|
15
|
+
* When disableInit is true:
|
|
16
|
+
* - The storage will not automatically create/alter tables on first use
|
|
17
|
+
* - You must call `storage.init()` explicitly in your CI/CD scripts
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // In CI/CD script:
|
|
21
|
+
* const storage = await LanceStorage.create('id', 'name', '/path/to/db', undefined, { disableInit: false });
|
|
22
|
+
* await storage.init(); // Explicitly run migrations
|
|
23
|
+
*
|
|
24
|
+
* // In runtime application:
|
|
25
|
+
* const storage = await LanceStorage.create('id', 'name', '/path/to/db', undefined, { disableInit: true });
|
|
26
|
+
* // No auto-init, tables must already exist
|
|
27
|
+
*/
|
|
28
|
+
disableInit?: boolean;
|
|
29
|
+
}
|
|
9
30
|
export declare class LanceStorage extends MastraStorage {
|
|
10
31
|
stores: StorageDomains;
|
|
11
32
|
private lanceClient;
|
|
12
33
|
/**
|
|
13
34
|
* Creates a new instance of LanceStorage
|
|
35
|
+
* @param id The unique identifier for this storage instance
|
|
36
|
+
* @param name The name for this storage instance
|
|
14
37
|
* @param uri The URI to connect to LanceDB
|
|
15
|
-
* @param
|
|
38
|
+
* @param connectionOptions connection options for LanceDB
|
|
39
|
+
* @param storageOptions storage options including disableInit
|
|
16
40
|
*
|
|
17
41
|
* Usage:
|
|
18
42
|
*
|
|
19
43
|
* Connect to a local database
|
|
20
44
|
* ```ts
|
|
21
|
-
* const store = await LanceStorage.create('/path/to/db');
|
|
45
|
+
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', '/path/to/db');
|
|
22
46
|
* ```
|
|
23
47
|
*
|
|
24
48
|
* Connect to a LanceDB cloud database
|
|
25
49
|
* ```ts
|
|
26
|
-
* const store = await LanceStorage.create('db://host:port');
|
|
50
|
+
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', 'db://host:port');
|
|
27
51
|
* ```
|
|
28
52
|
*
|
|
29
53
|
* Connect to a cloud database
|
|
30
54
|
* ```ts
|
|
31
|
-
* const store = await LanceStorage.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
55
|
+
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', 's3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Disable auto-init for runtime (after CI/CD has run migrations)
|
|
59
|
+
* ```ts
|
|
60
|
+
* const store = await LanceStorage.create('my-storage-id', 'MyStorage', '/path/to/db', undefined, { disableInit: true });
|
|
32
61
|
* ```
|
|
33
62
|
*/
|
|
34
|
-
static create(name: string, uri: string,
|
|
63
|
+
static create(id: string, name: string, uri: string, connectionOptions?: ConnectionOptions, storageOptions?: LanceStorageOptions): Promise<LanceStorage>;
|
|
35
64
|
/**
|
|
36
65
|
* @internal
|
|
37
66
|
* Private constructor to enforce using the create factory method
|
|
@@ -67,9 +96,6 @@ export declare class LanceStorage extends MastraStorage {
|
|
|
67
96
|
getThreadById({ threadId }: {
|
|
68
97
|
threadId: string;
|
|
69
98
|
}): Promise<StorageThreadType | null>;
|
|
70
|
-
getThreadsByResourceId({ resourceId }: {
|
|
71
|
-
resourceId: string;
|
|
72
|
-
}): Promise<StorageThreadType[]>;
|
|
73
99
|
/**
|
|
74
100
|
* Saves a thread to the database. This function doesn't overwrite existing threads.
|
|
75
101
|
* @param thread - The thread to save
|
|
@@ -92,6 +118,7 @@ export declare class LanceStorage extends MastraStorage {
|
|
|
92
118
|
hasColumn: boolean;
|
|
93
119
|
createTable: boolean;
|
|
94
120
|
deleteMessages: boolean;
|
|
121
|
+
listScoresBySpan: boolean;
|
|
95
122
|
};
|
|
96
123
|
getResourceById({ resourceId }: {
|
|
97
124
|
resourceId: string;
|
|
@@ -111,77 +138,26 @@ export declare class LanceStorage extends MastraStorage {
|
|
|
111
138
|
* @returns The processed array with context messages included
|
|
112
139
|
*/
|
|
113
140
|
private processMessagesWithContext;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}): Promise<
|
|
117
|
-
|
|
118
|
-
format: 'v2';
|
|
119
|
-
}): Promise<MastraMessageV2[]>;
|
|
120
|
-
saveMessages(args: {
|
|
121
|
-
messages: MastraMessageV1[];
|
|
122
|
-
format?: undefined | 'v1';
|
|
123
|
-
}): Promise<MastraMessageV1[]>;
|
|
124
|
-
saveMessages(args: {
|
|
125
|
-
messages: MastraMessageV2[];
|
|
126
|
-
format: 'v2';
|
|
127
|
-
}): Promise<MastraMessageV2[]>;
|
|
128
|
-
getThreadsByResourceIdPaginated(args: {
|
|
129
|
-
resourceId: string;
|
|
130
|
-
page: number;
|
|
131
|
-
perPage: number;
|
|
132
|
-
}): Promise<PaginationInfo & {
|
|
133
|
-
threads: StorageThreadType[];
|
|
141
|
+
listMessagesById({ messageIds }: {
|
|
142
|
+
messageIds: string[];
|
|
143
|
+
}): Promise<{
|
|
144
|
+
messages: MastraDBMessage[];
|
|
134
145
|
}>;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}): Promise<
|
|
138
|
-
messages:
|
|
146
|
+
saveMessages(args: {
|
|
147
|
+
messages: MastraDBMessage[];
|
|
148
|
+
}): Promise<{
|
|
149
|
+
messages: MastraDBMessage[];
|
|
139
150
|
}>;
|
|
140
151
|
updateMessages(_args: {
|
|
141
|
-
messages: Partial<Omit<
|
|
152
|
+
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
142
153
|
id: string;
|
|
143
154
|
content?: {
|
|
144
155
|
metadata?: MastraMessageContentV2['metadata'];
|
|
145
156
|
content?: MastraMessageContentV2['content'];
|
|
146
157
|
};
|
|
147
|
-
}[];
|
|
148
|
-
}): Promise<
|
|
149
|
-
|
|
150
|
-
traceId: string;
|
|
151
|
-
}): Promise<TraceType>;
|
|
152
|
-
getTraces(args: {
|
|
153
|
-
name?: string;
|
|
154
|
-
scope?: string;
|
|
155
|
-
page: number;
|
|
156
|
-
perPage: number;
|
|
157
|
-
attributes?: Record<string, string>;
|
|
158
|
-
}): Promise<Trace[]>;
|
|
159
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
160
|
-
traces: Trace[];
|
|
161
|
-
}>;
|
|
162
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
163
|
-
getEvals(options: {
|
|
164
|
-
agentName?: string;
|
|
165
|
-
type?: 'test' | 'live';
|
|
166
|
-
page?: number;
|
|
167
|
-
perPage?: number;
|
|
168
|
-
fromDate?: Date;
|
|
169
|
-
toDate?: Date;
|
|
170
|
-
dateRange?: {
|
|
171
|
-
start?: Date;
|
|
172
|
-
end?: Date;
|
|
173
|
-
};
|
|
174
|
-
}): Promise<PaginationInfo & {
|
|
175
|
-
evals: EvalRow[];
|
|
176
|
-
}>;
|
|
177
|
-
getWorkflowRuns(args?: {
|
|
178
|
-
namespace?: string;
|
|
179
|
-
workflowName?: string;
|
|
180
|
-
fromDate?: Date;
|
|
181
|
-
toDate?: Date;
|
|
182
|
-
limit?: number;
|
|
183
|
-
offset?: number;
|
|
184
|
-
}): Promise<WorkflowRuns>;
|
|
158
|
+
})[];
|
|
159
|
+
}): Promise<MastraDBMessage[]>;
|
|
160
|
+
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
185
161
|
getWorkflowRunById(args: {
|
|
186
162
|
runId: string;
|
|
187
163
|
workflowName?: string;
|
|
@@ -192,9 +168,28 @@ export declare class LanceStorage extends MastraStorage {
|
|
|
192
168
|
createdAt: Date;
|
|
193
169
|
updatedAt: Date;
|
|
194
170
|
} | null>;
|
|
195
|
-
|
|
171
|
+
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
172
|
+
workflowName: string;
|
|
173
|
+
runId: string;
|
|
174
|
+
stepId: string;
|
|
175
|
+
result: StepResult<any, any, any, any>;
|
|
176
|
+
requestContext: Record<string, any>;
|
|
177
|
+
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
178
|
+
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
179
|
+
workflowName: string;
|
|
180
|
+
runId: string;
|
|
181
|
+
opts: {
|
|
182
|
+
status: string;
|
|
183
|
+
result?: StepResult<any, any, any, any>;
|
|
184
|
+
error?: string;
|
|
185
|
+
suspendedPaths?: Record<string, number[]>;
|
|
186
|
+
waitingPaths?: Record<string, number[]>;
|
|
187
|
+
};
|
|
188
|
+
}): Promise<WorkflowRunState | undefined>;
|
|
189
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
196
190
|
workflowName: string;
|
|
197
191
|
runId: string;
|
|
192
|
+
resourceId?: string;
|
|
198
193
|
snapshot: WorkflowRunState;
|
|
199
194
|
}): Promise<void>;
|
|
200
195
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
@@ -204,24 +199,27 @@ export declare class LanceStorage extends MastraStorage {
|
|
|
204
199
|
getScoreById({ id: _id }: {
|
|
205
200
|
id: string;
|
|
206
201
|
}): Promise<ScoreRowData | null>;
|
|
207
|
-
|
|
202
|
+
listScoresByScorerId({ scorerId, source, entityId, entityType, pagination, }: {
|
|
208
203
|
scorerId: string;
|
|
209
204
|
pagination: StoragePagination;
|
|
205
|
+
source?: ScoringSource;
|
|
206
|
+
entityId?: string;
|
|
207
|
+
entityType?: string;
|
|
210
208
|
}): Promise<{
|
|
211
209
|
pagination: PaginationInfo;
|
|
212
210
|
scores: ScoreRowData[];
|
|
213
211
|
}>;
|
|
214
|
-
saveScore(
|
|
212
|
+
saveScore(score: SaveScorePayload): Promise<{
|
|
215
213
|
score: ScoreRowData;
|
|
216
214
|
}>;
|
|
217
|
-
|
|
215
|
+
listScoresByRunId({ runId, pagination, }: {
|
|
218
216
|
runId: string;
|
|
219
217
|
pagination: StoragePagination;
|
|
220
218
|
}): Promise<{
|
|
221
219
|
pagination: PaginationInfo;
|
|
222
220
|
scores: ScoreRowData[];
|
|
223
221
|
}>;
|
|
224
|
-
|
|
222
|
+
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
225
223
|
pagination: StoragePagination;
|
|
226
224
|
entityId: string;
|
|
227
225
|
entityType: string;
|
|
@@ -229,5 +227,13 @@ export declare class LanceStorage extends MastraStorage {
|
|
|
229
227
|
pagination: PaginationInfo;
|
|
230
228
|
scores: ScoreRowData[];
|
|
231
229
|
}>;
|
|
230
|
+
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
231
|
+
traceId: string;
|
|
232
|
+
spanId: string;
|
|
233
|
+
pagination: StoragePagination;
|
|
234
|
+
}): Promise<{
|
|
235
|
+
pagination: PaginationInfo;
|
|
236
|
+
scores: ScoreRowData[];
|
|
237
|
+
}>;
|
|
232
238
|
}
|
|
233
239
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAwB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,4BAA4B,EAC7B,MAAM,sBAAsB,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AAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAGpE"}
|
package/dist/vector/filter.d.ts
CHANGED
|
@@ -29,12 +29,12 @@ export declare class LanceFilterTranslator extends BaseFilterTranslator<LanceVec
|
|
|
29
29
|
*/
|
|
30
30
|
protected getSupportedOperators(): {
|
|
31
31
|
custom: string[];
|
|
32
|
-
logical: import("@mastra/core/vector
|
|
33
|
-
basic: import("@mastra/core/vector
|
|
34
|
-
numeric: import("@mastra/core/vector
|
|
35
|
-
array: import("@mastra/core/vector
|
|
32
|
+
logical: import("@mastra/core/vector").LogicalOperator[];
|
|
33
|
+
basic: import("@mastra/core/vector").BasicOperator[];
|
|
34
|
+
numeric: import("@mastra/core/vector").NumericOperator[];
|
|
35
|
+
array: import("@mastra/core/vector").ArrayOperator[];
|
|
36
36
|
element: "$exists"[];
|
|
37
|
-
regex: import("@mastra/core/vector
|
|
37
|
+
regex: import("@mastra/core/vector").RegexOperator[];
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
export {};
|
package/dist/vector/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ConnectionOptions, CreateTableOptions, Table, TableLike } from '@lancedb/lancedb';
|
|
2
|
-
import type { CreateIndexParams, DeleteIndexParams, DeleteVectorParams, DescribeIndexParams, IndexStats, QueryResult, QueryVectorParams, UpdateVectorParams, UpsertVectorParams } from '@mastra/core';
|
|
2
|
+
import type { CreateIndexParams, DeleteIndexParams, DeleteVectorParams, DescribeIndexParams, IndexStats, QueryResult, QueryVectorParams, UpdateVectorParams, UpsertVectorParams, DeleteVectorsParams } from '@mastra/core/vector';
|
|
3
3
|
import { MastraVector } from '@mastra/core/vector';
|
|
4
|
-
import type { LanceVectorFilter } from './filter';
|
|
5
|
-
import type { IndexConfig } from './types';
|
|
4
|
+
import type { LanceVectorFilter } from './filter.js';
|
|
5
|
+
import type { IndexConfig } from './types.js';
|
|
6
6
|
interface LanceCreateIndexParams extends CreateIndexParams {
|
|
7
7
|
indexConfig?: LanceIndexConfig;
|
|
8
8
|
tableName?: string;
|
|
@@ -43,7 +43,9 @@ export declare class LanceVectorStore extends MastraVector<LanceVectorFilter> {
|
|
|
43
43
|
* const store = await LanceVectorStore.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
|
|
44
44
|
* ```
|
|
45
45
|
*/
|
|
46
|
-
static create(uri: string, options?: ConnectionOptions
|
|
46
|
+
static create(uri: string, options?: ConnectionOptions & {
|
|
47
|
+
id: string;
|
|
48
|
+
}): Promise<LanceVectorStore>;
|
|
47
49
|
/**
|
|
48
50
|
* @internal
|
|
49
51
|
* Private constructor to enforce using the create factory method
|
|
@@ -73,13 +75,14 @@ export declare class LanceVectorStore extends MastraVector<LanceVectorFilter> {
|
|
|
73
75
|
*/
|
|
74
76
|
deleteAllTables(): Promise<void>;
|
|
75
77
|
deleteTable(tableName: string): Promise<void>;
|
|
76
|
-
updateVector(
|
|
78
|
+
updateVector(params: UpdateVectorParams<LanceVectorFilter>): Promise<void>;
|
|
77
79
|
deleteVector({ indexName, id }: DeleteVectorParams): Promise<void>;
|
|
78
80
|
/**
|
|
79
81
|
* Converts a flattened object with keys using underscore notation back to a nested object.
|
|
80
82
|
* Example: { name: 'test', details_text: 'test' } → { name: 'test', details: { text: 'test' } }
|
|
81
83
|
*/
|
|
82
84
|
private unflattenObject;
|
|
85
|
+
deleteVectors({ indexName, filter, ids }: DeleteVectorsParams<LanceVectorFilter>): Promise<void>;
|
|
83
86
|
}
|
|
84
87
|
export {};
|
|
85
88
|
//# sourceMappingURL=index.d.ts.map
|