@mastra/lance 0.0.0-share-agent-metadata-with-cloud-20250718123411 → 0.0.0-sidebar-window-undefined-fix-20251029233656

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 (43) hide show
  1. package/CHANGELOG.md +526 -2
  2. package/README.md +3 -3
  3. package/dist/index.cjs +1813 -870
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +3 -2
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +1814 -871
  8. package/dist/index.js.map +1 -0
  9. package/dist/storage/domains/legacy-evals/index.d.ts +25 -0
  10. package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
  11. package/dist/storage/domains/memory/index.d.ts +103 -0
  12. package/dist/storage/domains/memory/index.d.ts.map +1 -0
  13. package/dist/storage/domains/operations/index.d.ts +40 -0
  14. package/dist/storage/domains/operations/index.d.ts.map +1 -0
  15. package/dist/storage/domains/scores/index.d.ts +50 -0
  16. package/dist/storage/domains/scores/index.d.ts.map +1 -0
  17. package/dist/storage/domains/utils.d.ts +10 -0
  18. package/dist/storage/domains/utils.d.ts.map +1 -0
  19. package/dist/storage/domains/workflows/index.d.ts +57 -0
  20. package/dist/storage/domains/workflows/index.d.ts.map +1 -0
  21. package/dist/storage/index.d.ts +258 -0
  22. package/dist/storage/index.d.ts.map +1 -0
  23. package/dist/vector/filter.d.ts +41 -0
  24. package/dist/vector/filter.d.ts.map +1 -0
  25. package/dist/vector/index.d.ts +85 -0
  26. package/dist/vector/index.d.ts.map +1 -0
  27. package/dist/vector/types.d.ts +15 -0
  28. package/dist/vector/types.d.ts.map +1 -0
  29. package/package.json +24 -10
  30. package/dist/_tsup-dts-rollup.d.cts +0 -409
  31. package/dist/_tsup-dts-rollup.d.ts +0 -409
  32. package/dist/index.d.cts +0 -2
  33. package/eslint.config.js +0 -6
  34. package/src/index.ts +0 -2
  35. package/src/storage/index.test.ts +0 -1336
  36. package/src/storage/index.ts +0 -1447
  37. package/src/vector/filter.test.ts +0 -295
  38. package/src/vector/filter.ts +0 -443
  39. package/src/vector/index.test.ts +0 -1493
  40. package/src/vector/index.ts +0 -941
  41. package/src/vector/types.ts +0 -16
  42. package/tsconfig.json +0 -5
  43. package/vitest.config.ts +0 -11
@@ -0,0 +1,25 @@
1
+ import type { Connection } from '@lancedb/lancedb';
2
+ import { LegacyEvalsStorage } from '@mastra/core/storage';
3
+ import type { EvalRow, PaginationInfo } from '@mastra/core/storage';
4
+ export declare class StoreLegacyEvalsLance extends LegacyEvalsStorage {
5
+ private client;
6
+ constructor({ client }: {
7
+ client: Connection;
8
+ });
9
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
10
+ getEvals(options: {
11
+ agentName?: string;
12
+ type?: 'test' | 'live';
13
+ page?: number;
14
+ perPage?: number;
15
+ fromDate?: Date;
16
+ toDate?: Date;
17
+ dateRange?: {
18
+ start?: Date;
19
+ end?: Date;
20
+ };
21
+ }): Promise<PaginationInfo & {
22
+ evals: EvalRow[];
23
+ }>;
24
+ }
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/legacy-evals/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,kBAAkB,EAAe,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEpE,qBAAa,qBAAsB,SAAQ,kBAAkB;IAC3D,OAAO,CAAC,MAAM,CAAa;gBACf,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAKxC,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA4ClF,QAAQ,CAAC,OAAO,EAAE;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,SAAS,CAAC,EAAE;YAAE,KAAK,CAAC,EAAE,IAAI,CAAC;YAAC,GAAG,CAAC,EAAE,IAAI,CAAA;SAAE,CAAC;KAC1C,GAAG,OAAO,CAAC,cAAc,GAAG;QAAE,KAAK,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;CA2FnD"}
@@ -0,0 +1,103 @@
1
+ import type { Connection } from '@lancedb/lancedb';
2
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
+ import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
4
+ import { MemoryStorage } from '@mastra/core/storage';
5
+ import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType } from '@mastra/core/storage';
6
+ import type { StoreOperationsLance } from '../operations/index.js';
7
+ export declare class StoreMemoryLance extends MemoryStorage {
8
+ private client;
9
+ private operations;
10
+ constructor({ client, operations }: {
11
+ client: Connection;
12
+ operations: StoreOperationsLance;
13
+ });
14
+ getThreadById({ threadId }: {
15
+ threadId: string;
16
+ }): Promise<StorageThreadType | null>;
17
+ getThreadsByResourceId({ resourceId }: {
18
+ resourceId: string;
19
+ }): Promise<StorageThreadType[]>;
20
+ /**
21
+ * Saves a thread to the database. This function doesn't overwrite existing threads.
22
+ * @param thread - The thread to save
23
+ * @returns The saved thread
24
+ */
25
+ saveThread({ thread }: {
26
+ thread: StorageThreadType;
27
+ }): Promise<StorageThreadType>;
28
+ updateThread({ id, title, metadata, }: {
29
+ id: string;
30
+ title: string;
31
+ metadata: Record<string, unknown>;
32
+ }): Promise<StorageThreadType>;
33
+ deleteThread({ threadId }: {
34
+ threadId: string;
35
+ }): Promise<void>;
36
+ private normalizeMessage;
37
+ getMessages(args: StorageGetMessagesArg & {
38
+ format?: 'v1';
39
+ }): Promise<MastraMessageV1[]>;
40
+ getMessages(args: StorageGetMessagesArg & {
41
+ format: 'v2';
42
+ }): Promise<MastraMessageV2[]>;
43
+ getMessagesById({ messageIds, format, }: {
44
+ messageIds: string[];
45
+ format: 'v1';
46
+ }): Promise<MastraMessageV1[]>;
47
+ getMessagesById({ messageIds, format, }: {
48
+ messageIds: string[];
49
+ format?: 'v2';
50
+ }): Promise<MastraMessageV2[]>;
51
+ saveMessages(args: {
52
+ messages: MastraMessageV1[];
53
+ format?: undefined | 'v1';
54
+ }): Promise<MastraMessageV1[]>;
55
+ saveMessages(args: {
56
+ messages: MastraMessageV2[];
57
+ format: 'v2';
58
+ }): Promise<MastraMessageV2[]>;
59
+ getThreadsByResourceIdPaginated(args: {
60
+ resourceId: string;
61
+ page?: number;
62
+ perPage?: number;
63
+ }): Promise<PaginationInfo & {
64
+ threads: StorageThreadType[];
65
+ }>;
66
+ /**
67
+ * Processes messages to include context messages based on withPreviousMessages and withNextMessages
68
+ * @param records - The sorted array of records to process
69
+ * @param include - The array of include specifications with context parameters
70
+ * @returns The processed array with context messages included
71
+ */
72
+ private processMessagesWithContext;
73
+ getMessagesPaginated(args: StorageGetMessagesArg & {
74
+ format?: 'v1' | 'v2';
75
+ }): Promise<PaginationInfo & {
76
+ messages: MastraMessageV1[] | MastraMessageV2[];
77
+ }>;
78
+ /**
79
+ * Parse message data from LanceDB record format to MastraMessageV2 format
80
+ */
81
+ private parseMessageData;
82
+ updateMessages(args: {
83
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
84
+ id: string;
85
+ content?: {
86
+ metadata?: MastraMessageContentV2['metadata'];
87
+ content?: MastraMessageContentV2['content'];
88
+ };
89
+ }[];
90
+ }): Promise<MastraMessageV2[]>;
91
+ getResourceById({ resourceId }: {
92
+ resourceId: string;
93
+ }): Promise<StorageResourceType | null>;
94
+ saveResource({ resource }: {
95
+ resource: StorageResourceType;
96
+ }): Promise<StorageResourceType>;
97
+ updateResource({ resourceId, workingMemory, metadata, }: {
98
+ resourceId: string;
99
+ workingMemory?: string;
100
+ metadata?: Record<string, unknown>;
101
+ }): Promise<StorageResourceType>;
102
+ }
103
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EACL,aAAa,EAKd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACvG,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,EAAE,UAAU,CAAC;QAAC,UAAU,EAAE,oBAAoB,CAAA;KAAE;IAMtF,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAyBpF,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAuBlG;;;;OAIG;IACG,UAAU,CAAC,E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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"}
@@ -0,0 +1,40 @@
1
+ import type { Connection } from '@lancedb/lancedb';
2
+ import { StoreOperations } from '@mastra/core/storage';
3
+ import type { TABLE_NAMES, StorageColumn } from '@mastra/core/storage';
4
+ export declare class StoreOperationsLance extends StoreOperations {
5
+ client: Connection;
6
+ constructor({ client }: {
7
+ client: Connection;
8
+ });
9
+ protected getDefaultValue(type: StorageColumn['type']): string;
10
+ hasColumn(tableName: TABLE_NAMES, columnName: string): Promise<boolean>;
11
+ private translateSchema;
12
+ createTable({ tableName, schema, }: {
13
+ tableName: TABLE_NAMES;
14
+ schema: Record<string, StorageColumn>;
15
+ }): Promise<void>;
16
+ dropTable({ tableName }: {
17
+ tableName: TABLE_NAMES;
18
+ }): Promise<void>;
19
+ alterTable({ tableName, schema, ifNotExists, }: {
20
+ tableName: string;
21
+ schema: Record<string, StorageColumn>;
22
+ ifNotExists: string[];
23
+ }): Promise<void>;
24
+ clearTable({ tableName }: {
25
+ tableName: TABLE_NAMES;
26
+ }): Promise<void>;
27
+ insert({ tableName, record }: {
28
+ tableName: string;
29
+ record: Record<string, any>;
30
+ }): Promise<void>;
31
+ batchInsert({ tableName, records }: {
32
+ tableName: string;
33
+ records: Record<string, any>[];
34
+ }): Promise<void>;
35
+ load({ tableName, keys }: {
36
+ tableName: TABLE_NAMES;
37
+ keys: Record<string, any>;
38
+ }): Promise<any>;
39
+ }
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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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AAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAyDhG,WAAW,CAAC,EAAE,SAAS,EAAE,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"}
@@ -0,0 +1,50 @@
1
+ import type { Connection } from '@lancedb/lancedb';
2
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
3
+ import { ScoresStorage } from '@mastra/core/storage';
4
+ import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
5
+ export declare class StoreScoresLance extends ScoresStorage {
6
+ private client;
7
+ constructor({ client }: {
8
+ client: Connection;
9
+ });
10
+ saveScore(score: ScoreRowData): Promise<{
11
+ score: ScoreRowData;
12
+ }>;
13
+ getScoreById({ id }: {
14
+ id: string;
15
+ }): Promise<ScoreRowData | null>;
16
+ getScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
17
+ scorerId: string;
18
+ pagination: StoragePagination;
19
+ entityId?: string;
20
+ entityType?: string;
21
+ source?: ScoringSource;
22
+ }): Promise<{
23
+ pagination: PaginationInfo;
24
+ scores: ScoreRowData[];
25
+ }>;
26
+ getScoresByRunId({ runId, pagination, }: {
27
+ runId: string;
28
+ pagination: StoragePagination;
29
+ }): Promise<{
30
+ pagination: PaginationInfo;
31
+ scores: ScoreRowData[];
32
+ }>;
33
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
34
+ pagination: StoragePagination;
35
+ entityId: string;
36
+ entityType: string;
37
+ }): Promise<{
38
+ pagination: PaginationInfo;
39
+ scores: ScoreRowData[];
40
+ }>;
41
+ getScoresBySpan({ traceId, spanId, pagination, }: {
42
+ traceId: string;
43
+ spanId: string;
44
+ pagination: StoragePagination;
45
+ }): Promise<{
46
+ pagination: PaginationInfo;
47
+ scores: ScoreRowData[];
48
+ }>;
49
+ }
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,aAAa,EAA6B,MAAM,qBAAqB,CAAC;AAElG,OAAO,EAAE,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,OAAO,CAAC,MAAM,CAAa;gBACf,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAKxC,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAwDhE,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAyBlE,mBAAmB,CAAC,EACxB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,GACP,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAwD7D,gBAAgB,CAAC,EACrB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAqC7D,mBAAmB,CAAC,EACxB,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;IA2C7D,eAAe,CAAC,EACpB,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;CAuCpE"}
@@ -0,0 +1,10 @@
1
+ import type { Connection, SchemaLike } from '@lancedb/lancedb';
2
+ import type { TABLE_NAMES } from '@mastra/core/storage';
3
+ export declare function getPrimaryKeys(tableName: TABLE_NAMES): string[];
4
+ export declare function validateKeyTypes(keys: Record<string, any>, tableSchema: SchemaLike): void;
5
+ export declare function processResultWithTypeConversion(rawResult: Record<string, any> | Record<string, any>[], tableSchema: SchemaLike): Record<string, any> | Record<string, any>[];
6
+ export declare function getTableSchema({ tableName, client, }: {
7
+ tableName: TABLE_NAMES;
8
+ client: Connection;
9
+ }): Promise<SchemaLike>;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +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,CAS/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"}
@@ -0,0 +1,57 @@
1
+ import type { Connection } from '@lancedb/lancedb';
2
+ import type { StepResult, WorkflowRunState, WorkflowRuns } from '@mastra/core';
3
+ import { WorkflowsStorage } from '@mastra/core/storage';
4
+ export declare class StoreWorkflowsLance extends WorkflowsStorage {
5
+ client: Connection;
6
+ constructor({ client }: {
7
+ client: Connection;
8
+ });
9
+ updateWorkflowResults({}: {
10
+ workflowName: string;
11
+ runId: string;
12
+ stepId: string;
13
+ result: StepResult<any, any, any, any>;
14
+ runtimeContext: Record<string, any>;
15
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
16
+ updateWorkflowState({}: {
17
+ workflowName: string;
18
+ runId: string;
19
+ opts: {
20
+ status: string;
21
+ result?: StepResult<any, any, any, any>;
22
+ error?: string;
23
+ suspendedPaths?: Record<string, number[]>;
24
+ waitingPaths?: Record<string, number[]>;
25
+ };
26
+ }): Promise<WorkflowRunState | undefined>;
27
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
28
+ workflowName: string;
29
+ runId: string;
30
+ resourceId?: string;
31
+ snapshot: WorkflowRunState;
32
+ }): Promise<void>;
33
+ loadWorkflowSnapshot({ workflowName, runId, }: {
34
+ workflowName: string;
35
+ runId: string;
36
+ }): Promise<WorkflowRunState | null>;
37
+ getWorkflowRunById(args: {
38
+ runId: string;
39
+ workflowName?: string;
40
+ }): Promise<{
41
+ workflowName: string;
42
+ runId: string;
43
+ snapshot: any;
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
+ } | null>;
47
+ getWorkflowRuns(args?: {
48
+ namespace?: string;
49
+ resourceId?: string;
50
+ workflowName?: string;
51
+ fromDate?: Date;
52
+ toDate?: Date;
53
+ limit?: number;
54
+ offset?: number;
55
+ }): Promise<WorkflowRuns>;
56
+ }
57
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EAAuC,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAuB7F,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,MAAM,EAAE,UAAU,CAAC;gBACP,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,UAAU,CAAA;KAAE;IAK9C,qBAAqB,CACnB,EAMC,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM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;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,eAAe,CAAC,IAAI,CAAC,EAAE;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,IAAI,CAAC;QAChB,MAAM,CAAC,EAAE,IAAI,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,YAAY,CAAC;CA4D1B"}
@@ -0,0 +1,258 @@
1
+ import type { ConnectionOptions } from '@lancedb/lancedb';
2
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
+ import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
4
+ import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
5
+ import { MastraStorage } from '@mastra/core/storage';
6
+ import type { TABLE_NAMES, PaginationInfo, StorageGetMessagesArg, StorageColumn, EvalRow, WorkflowRuns, StoragePagination, StorageDomains, StorageResourceType } from '@mastra/core/storage';
7
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
8
+ export declare class LanceStorage extends MastraStorage {
9
+ stores: StorageDomains;
10
+ private lanceClient;
11
+ /**
12
+ * Creates a new instance of LanceStorage
13
+ * @param uri The URI to connect to LanceDB
14
+ * @param options connection options
15
+ *
16
+ * Usage:
17
+ *
18
+ * Connect to a local database
19
+ * ```ts
20
+ * const store = await LanceStorage.create('/path/to/db');
21
+ * ```
22
+ *
23
+ * Connect to a LanceDB cloud database
24
+ * ```ts
25
+ * const store = await LanceStorage.create('db://host:port');
26
+ * ```
27
+ *
28
+ * Connect to a cloud database
29
+ * ```ts
30
+ * const store = await LanceStorage.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
31
+ * ```
32
+ */
33
+ static create(name: string, uri: string, options?: ConnectionOptions): Promise<LanceStorage>;
34
+ /**
35
+ * @internal
36
+ * Private constructor to enforce using the create factory method
37
+ */
38
+ private constructor();
39
+ createTable({ tableName, schema, }: {
40
+ tableName: TABLE_NAMES;
41
+ schema: Record<string, StorageColumn>;
42
+ }): Promise<void>;
43
+ dropTable({ tableName }: {
44
+ tableName: TABLE_NAMES;
45
+ }): Promise<void>;
46
+ alterTable({ tableName, schema, ifNotExists, }: {
47
+ tableName: TABLE_NAMES;
48
+ schema: Record<string, StorageColumn>;
49
+ ifNotExists: string[];
50
+ }): Promise<void>;
51
+ clearTable({ tableName }: {
52
+ tableName: TABLE_NAMES;
53
+ }): Promise<void>;
54
+ insert({ tableName, record }: {
55
+ tableName: TABLE_NAMES;
56
+ record: Record<string, any>;
57
+ }): Promise<void>;
58
+ batchInsert({ tableName, records }: {
59
+ tableName: TABLE_NAMES;
60
+ records: Record<string, any>[];
61
+ }): Promise<void>;
62
+ load({ tableName, keys }: {
63
+ tableName: TABLE_NAMES;
64
+ keys: Record<string, any>;
65
+ }): Promise<any>;
66
+ getThreadById({ threadId }: {
67
+ threadId: string;
68
+ }): Promise<StorageThreadType | null>;
69
+ getThreadsByResourceId({ resourceId }: {
70
+ resourceId: string;
71
+ }): Promise<StorageThreadType[]>;
72
+ /**
73
+ * Saves a thread to the database. This function doesn't overwrite existing threads.
74
+ * @param thread - The thread to save
75
+ * @returns The saved thread
76
+ */
77
+ saveThread({ thread }: {
78
+ thread: StorageThreadType;
79
+ }): Promise<StorageThreadType>;
80
+ updateThread({ id, title, metadata, }: {
81
+ id: string;
82
+ title: string;
83
+ metadata: Record<string, unknown>;
84
+ }): Promise<StorageThreadType>;
85
+ deleteThread({ threadId }: {
86
+ threadId: string;
87
+ }): Promise<void>;
88
+ get supports(): {
89
+ selectByIncludeResourceScope: boolean;
90
+ resourceWorkingMemory: boolean;
91
+ hasColumn: boolean;
92
+ createTable: boolean;
93
+ deleteMessages: boolean;
94
+ getScoresBySpan: boolean;
95
+ };
96
+ getResourceById({ resourceId }: {
97
+ resourceId: string;
98
+ }): Promise<StorageResourceType | null>;
99
+ saveResource({ resource }: {
100
+ resource: StorageResourceType;
101
+ }): Promise<StorageResourceType>;
102
+ updateResource({ resourceId, workingMemory, metadata, }: {
103
+ resourceId: string;
104
+ workingMemory?: string;
105
+ metadata?: Record<string, unknown>;
106
+ }): Promise<StorageResourceType>;
107
+ /**
108
+ * Processes messages to include context messages based on withPreviousMessages and withNextMessages
109
+ * @param records - The sorted array of records to process
110
+ * @param include - The array of include specifications with context parameters
111
+ * @returns The processed array with context messages included
112
+ */
113
+ private processMessagesWithContext;
114
+ getMessages(args: StorageGetMessagesArg & {
115
+ format?: 'v1';
116
+ }): Promise<MastraMessageV1[]>;
117
+ getMessages(args: StorageGetMessagesArg & {
118
+ format: 'v2';
119
+ }): Promise<MastraMessageV2[]>;
120
+ getMessagesById({ messageIds, format }: {
121
+ messageIds: string[];
122
+ format: 'v1';
123
+ }): Promise<MastraMessageV1[]>;
124
+ getMessagesById({ messageIds, format }: {
125
+ messageIds: string[];
126
+ format?: 'v2';
127
+ }): Promise<MastraMessageV2[]>;
128
+ saveMessages(args: {
129
+ messages: MastraMessageV1[];
130
+ format?: undefined | 'v1';
131
+ }): Promise<MastraMessageV1[]>;
132
+ saveMessages(args: {
133
+ messages: MastraMessageV2[];
134
+ format: 'v2';
135
+ }): Promise<MastraMessageV2[]>;
136
+ getThreadsByResourceIdPaginated(args: {
137
+ resourceId: string;
138
+ page: number;
139
+ perPage: number;
140
+ }): Promise<PaginationInfo & {
141
+ threads: StorageThreadType[];
142
+ }>;
143
+ getMessagesPaginated(args: StorageGetMessagesArg & {
144
+ format?: 'v1' | 'v2';
145
+ }): Promise<PaginationInfo & {
146
+ messages: MastraMessageV1[] | MastraMessageV2[];
147
+ }>;
148
+ updateMessages(_args: {
149
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
150
+ id: string;
151
+ content?: {
152
+ metadata?: MastraMessageContentV2['metadata'];
153
+ content?: MastraMessageContentV2['content'];
154
+ };
155
+ }[];
156
+ }): Promise<MastraMessageV2[]>;
157
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
158
+ getEvals(options: {
159
+ agentName?: string;
160
+ type?: 'test' | 'live';
161
+ page?: number;
162
+ perPage?: number;
163
+ fromDate?: Date;
164
+ toDate?: Date;
165
+ dateRange?: {
166
+ start?: Date;
167
+ end?: Date;
168
+ };
169
+ }): Promise<PaginationInfo & {
170
+ evals: EvalRow[];
171
+ }>;
172
+ getWorkflowRuns(args?: {
173
+ namespace?: string;
174
+ workflowName?: string;
175
+ fromDate?: Date;
176
+ toDate?: Date;
177
+ limit?: number;
178
+ offset?: number;
179
+ }): Promise<WorkflowRuns>;
180
+ getWorkflowRunById(args: {
181
+ runId: string;
182
+ workflowName?: string;
183
+ }): Promise<{
184
+ workflowName: string;
185
+ runId: string;
186
+ snapshot: any;
187
+ createdAt: Date;
188
+ updatedAt: Date;
189
+ } | null>;
190
+ updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext, }: {
191
+ workflowName: string;
192
+ runId: string;
193
+ stepId: string;
194
+ result: StepResult<any, any, any, any>;
195
+ runtimeContext: Record<string, any>;
196
+ }): Promise<Record<string, StepResult<any, any, any, any>>>;
197
+ updateWorkflowState({ workflowName, runId, opts, }: {
198
+ workflowName: string;
199
+ runId: string;
200
+ opts: {
201
+ status: string;
202
+ result?: StepResult<any, any, any, any>;
203
+ error?: string;
204
+ suspendedPaths?: Record<string, number[]>;
205
+ waitingPaths?: Record<string, number[]>;
206
+ };
207
+ }): Promise<WorkflowRunState | undefined>;
208
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
209
+ workflowName: string;
210
+ runId: string;
211
+ resourceId?: string;
212
+ snapshot: WorkflowRunState;
213
+ }): Promise<void>;
214
+ loadWorkflowSnapshot({ workflowName, runId, }: {
215
+ workflowName: string;
216
+ runId: string;
217
+ }): Promise<WorkflowRunState | null>;
218
+ getScoreById({ id: _id }: {
219
+ id: string;
220
+ }): Promise<ScoreRowData | null>;
221
+ getScoresByScorerId({ scorerId, source, entityId, entityType, pagination, }: {
222
+ scorerId: string;
223
+ pagination: StoragePagination;
224
+ source?: ScoringSource;
225
+ entityId?: string;
226
+ entityType?: string;
227
+ }): Promise<{
228
+ pagination: PaginationInfo;
229
+ scores: ScoreRowData[];
230
+ }>;
231
+ saveScore(_score: ScoreRowData): Promise<{
232
+ score: ScoreRowData;
233
+ }>;
234
+ getScoresByRunId({ runId, pagination, }: {
235
+ runId: string;
236
+ pagination: StoragePagination;
237
+ }): Promise<{
238
+ pagination: PaginationInfo;
239
+ scores: ScoreRowData[];
240
+ }>;
241
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
242
+ pagination: StoragePagination;
243
+ entityId: string;
244
+ entityType: string;
245
+ }): Promise<{
246
+ pagination: PaginationInfo;
247
+ scores: ScoreRowData[];
248
+ }>;
249
+ getScoresBySpan({ traceId, spanId, pagination, }: {
250
+ traceId: string;
251
+ spanId: string;
252
+ pagination: StoragePagination;
253
+ }): Promise<{
254
+ pagination: PaginationInfo;
255
+ scores: ScoreRowData[];
256
+ }>;
257
+ }
258
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAA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EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,iBAAiB,CAAC;QAC9B,MAAM,CAAC,EAAE,aAAa,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAIjE,gBAAgB,CAAC,EACrB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,MAAM,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;IAI7D,mBAAmB,CAAC,EACxB,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;IAI7D,eAAe,CAAC,EACpB,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"}
@@ -0,0 +1,41 @@
1
+ import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { VectorFilter, OperatorValueMap, LogicalOperatorValueMap, BlacklistedRootOperators } from '@mastra/core/vector/filter';
3
+ type LanceOperatorValueMap = OperatorValueMap & {
4
+ $like: string;
5
+ $notLike: string;
6
+ $contains: string;
7
+ };
8
+ type LanceBlacklisted = BlacklistedRootOperators | '$like' | '$notLike' | '$contains';
9
+ export type LanceVectorFilter = VectorFilter<keyof LanceOperatorValueMap, LanceOperatorValueMap, LogicalOperatorValueMap, LanceBlacklisted>;
10
+ export declare class LanceFilterTranslator extends BaseFilterTranslator<LanceVectorFilter, string> {
11
+ translate(filter: LanceVectorFilter): string;
12
+ private processFilter;
13
+ private processLogicalOperator;
14
+ private processNestedObject;
15
+ private processField;
16
+ private processOperators;
17
+ private formatValue;
18
+ private formatArrayValues;
19
+ normalizeArrayValues(array: unknown[]): unknown[];
20
+ normalizeComparisonValue(value: unknown): unknown;
21
+ private isOperatorObject;
22
+ private isNestedObject;
23
+ private isNormalNestedField;
24
+ private escapeFieldName;
25
+ private isSqlKeyword;
26
+ private isDateObject;
27
+ /**
28
+ * Override getSupportedOperators to add custom operators for LanceDB
29
+ */
30
+ protected getSupportedOperators(): {
31
+ custom: string[];
32
+ logical: import("@mastra/core/vector/filter").LogicalOperator[];
33
+ basic: import("@mastra/core/vector/filter").BasicOperator[];
34
+ numeric: import("@mastra/core/vector/filter").NumericOperator[];
35
+ array: import("@mastra/core/vector/filter").ArrayOperator[];
36
+ element: "$exists"[];
37
+ regex: import("@mastra/core/vector/filter").RegexOperator[];
38
+ };
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../src/vector/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,KAAK,qBAAqB,GAAG,gBAAgB,GAAG;IAC9C,KAAK,EAAE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