@mastra/lance 0.0.0-remove-unused-model-providers-api-20251030210744 → 0.0.0-remove-ai-peer-dep-from-evals-20260105220639

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.
@@ -1,7 +1,26 @@
1
1
  import type { Connection } from '@lancedb/lancedb';
2
- import { StoreOperations } from '@mastra/core/storage';
2
+ import { MastraBase } from '@mastra/core/base';
3
3
  import type { TABLE_NAMES, StorageColumn } from '@mastra/core/storage';
4
- export declare class StoreOperationsLance extends StoreOperations {
4
+ /**
5
+ * Configuration for standalone domain usage.
6
+ * Accepts an existing LanceDB Connection.
7
+ *
8
+ * Note: Creating a new LanceDB connection requires async `connect()`,
9
+ * so for standalone domain usage, you must create the connection first
10
+ * and pass it to the domain constructor.
11
+ */
12
+ export type LanceDomainConfig = LanceDomainClientConfig;
13
+ /**
14
+ * Pass an existing LanceDB connection
15
+ */
16
+ export interface LanceDomainClientConfig {
17
+ client: Connection;
18
+ }
19
+ /**
20
+ * Resolves LanceDomainConfig to a LanceDB Connection.
21
+ */
22
+ export declare function resolveLanceConfig(config: LanceDomainConfig): Connection;
23
+ export declare class LanceDB extends MastraBase {
5
24
  client: Connection;
6
25
  constructor({ client }: {
7
26
  client: Connection;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAKvE;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,C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;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 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/db/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,22 +1,19 @@
1
- import type { Connection } from '@lancedb/lancedb';
2
1
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
- import type { MastraMessageV1, MastraMessageV2, StorageThreadType } from '@mastra/core/memory';
2
+ import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
4
3
  import { MemoryStorage } from '@mastra/core/storage';
5
- import type { PaginationInfo, StorageGetMessagesArg, StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
6
- import type { StoreOperationsLance } from '../operations/index.js';
4
+ import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
5
+ import type { LanceDomainConfig } from '../../db/index.js';
7
6
  export declare class StoreMemoryLance extends MemoryStorage {
7
+ #private;
8
8
  private client;
9
- private operations;
10
- constructor({ client, operations }: {
11
- client: Connection;
12
- operations: StoreOperationsLance;
13
- });
9
+ constructor(config: LanceDomainConfig);
10
+ init(): Promise<void>;
11
+ dangerouslyClearAll(): Promise<void>;
12
+ deleteMessages(messageIds: string[]): Promise<void>;
13
+ private escapeSql;
14
14
  getThreadById({ threadId }: {
15
15
  threadId: string;
16
16
  }): Promise<StorageThreadType | null>;
17
- getThreadsByResourceId({ resourceId }: {
18
- resourceId: string;
19
- }): Promise<StorageThreadType[]>;
20
17
  /**
21
18
  * Saves a thread to the database. This function doesn't overwrite existing threads.
22
19
  * @param thread - The thread to save
@@ -34,36 +31,18 @@ export declare class StoreMemoryLance extends MemoryStorage {
34
31
  threadId: string;
35
32
  }): Promise<void>;
36
33
  private normalizeMessage;
37
- getMessages(args: StorageGetMessagesArg & {
38
- format?: 'v1';
39
- }): Promise<MastraMessageV1[]>;
40
- getMessages(args: StorageGetMessagesArg & {
41
- format: 'v2';
42
- }): Promise<MastraMessageV2[]>;
43
34
  listMessagesById({ messageIds }: {
44
35
  messageIds: string[];
45
- }): Promise<MastraMessageV2[]>;
36
+ }): Promise<{
37
+ messages: MastraDBMessage[];
38
+ }>;
46
39
  listMessages(args: StorageListMessagesInput): Promise<StorageListMessagesOutput>;
47
- /**
48
- * @todo When migrating from getThreadsByResourceIdPaginated to this method,
49
- * implement orderBy and sortDirection support for full sorting capabilities
50
- */
51
- listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
52
40
  saveMessages(args: {
53
- messages: MastraMessageV1[];
54
- format?: undefined | 'v1';
55
- }): Promise<MastraMessageV1[]>;
56
- saveMessages(args: {
57
- messages: MastraMessageV2[];
58
- format: 'v2';
59
- }): Promise<MastraMessageV2[]>;
60
- getThreadsByResourceIdPaginated(args: {
61
- resourceId: string;
62
- page?: number;
63
- perPage?: number;
64
- }): Promise<PaginationInfo & {
65
- threads: StorageThreadType[];
41
+ messages: MastraDBMessage[];
42
+ }): Promise<{
43
+ messages: MastraDBMessage[];
66
44
  }>;
45
+ listThreadsByResourceId(args: StorageListThreadsByResourceIdInput): Promise<StorageListThreadsByResourceIdOutput>;
67
46
  /**
68
47
  * Processes messages to include context messages based on withPreviousMessages and withNextMessages
69
48
  * @param records - The sorted array of records to process
@@ -71,24 +50,19 @@ export declare class StoreMemoryLance extends MemoryStorage {
71
50
  * @returns The processed array with context messages included
72
51
  */
73
52
  private processMessagesWithContext;
74
- getMessagesPaginated(args: StorageGetMessagesArg & {
75
- format?: 'v1' | 'v2';
76
- }): Promise<PaginationInfo & {
77
- messages: MastraMessageV1[] | MastraMessageV2[];
78
- }>;
79
53
  /**
80
- * Parse message data from LanceDB record format to MastraMessageV2 format
54
+ * Parse message data from LanceDB record format to MastraDBMessage format
81
55
  */
82
56
  private parseMessageData;
83
57
  updateMessages(args: {
84
- messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
58
+ messages: Partial<Omit<MastraDBMessage, 'createdAt'>> & {
85
59
  id: string;
86
60
  content?: {
87
61
  metadata?: MastraMessageContentV2['metadata'];
88
62
  content?: MastraMessageContentV2['content'];
89
63
  };
90
64
  }[];
91
- }): Promise<MastraMessageV2[]>;
65
+ }): Promise<MastraDBMessage[]>;
92
66
  getResourceById({ resourceId }: {
93
67
  resourceId: string;
94
68
  }): 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,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC/F,OAAO,EACL,aAAa,EAKd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,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,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,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC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Q,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,50 +1,47 @@
1
- import type { Connection } from '@lancedb/lancedb';
2
- import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
1
+ import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
3
2
  import { ScoresStorage } from '@mastra/core/storage';
4
- import type { PaginationInfo, StoragePagination } from '@mastra/core/storage';
3
+ import type { StoragePagination } from '@mastra/core/storage';
4
+ import type { LanceDomainConfig } from '../../db/index.js';
5
5
  export declare class StoreScoresLance extends ScoresStorage {
6
+ #private;
6
7
  private client;
7
- constructor({ client }: {
8
- client: Connection;
9
- });
10
- saveScore(score: ScoreRowData): Promise<{
8
+ constructor(config: LanceDomainConfig);
9
+ init(): Promise<void>;
10
+ dangerouslyClearAll(): Promise<void>;
11
+ saveScore(score: SaveScorePayload): Promise<{
11
12
  score: ScoreRowData;
12
13
  }>;
13
14
  getScoreById({ id }: {
14
15
  id: string;
15
16
  }): Promise<ScoreRowData | null>;
16
- getScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
17
+ /**
18
+ * LanceDB-specific score row transformation.
19
+ *
20
+ * Note: This implementation does NOT use coreTransformScoreRow because:
21
+ * 1. LanceDB stores schema information in the table itself (requires async fetch)
22
+ * 2. Uses processResultWithTypeConversion utility for LanceDB-specific type handling
23
+ */
24
+ private transformScoreRow;
25
+ listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
17
26
  scorerId: string;
18
27
  pagination: StoragePagination;
19
28
  entityId?: string;
20
29
  entityType?: string;
21
30
  source?: ScoringSource;
22
- }): Promise<{
23
- pagination: PaginationInfo;
24
- scores: ScoreRowData[];
25
- }>;
26
- getScoresByRunId({ runId, pagination, }: {
31
+ }): Promise<ListScoresResponse>;
32
+ listScoresByRunId({ runId, pagination, }: {
27
33
  runId: string;
28
34
  pagination: StoragePagination;
29
- }): Promise<{
30
- pagination: PaginationInfo;
31
- scores: ScoreRowData[];
32
- }>;
33
- getScoresByEntityId({ entityId, entityType, pagination, }: {
35
+ }): Promise<ListScoresResponse>;
36
+ listScoresByEntityId({ entityId, entityType, pagination, }: {
34
37
  pagination: StoragePagination;
35
38
  entityId: string;
36
39
  entityType: string;
37
- }): Promise<{
38
- pagination: PaginationInfo;
39
- scores: ScoreRowData[];
40
- }>;
41
- getScoresBySpan({ traceId, spanId, pagination, }: {
40
+ }): Promise<ListScoresResponse>;
41
+ listScoresBySpan({ traceId, spanId, pagination, }: {
42
42
  traceId: string;
43
43
  spanId: string;
44
44
  pagination: StoragePagination;
45
- }): Promise<{
46
- pagination: PaginationInfo;
47
- scores: ScoreRowData[];
48
- }>;
45
+ }): Promise<ListScoresResponse>;
49
46
  }
50
47
  //# 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,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,MAA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,iBAAiB,CAAC,EACtB,KAAK,EACL,UAAU,GACX,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiDzB,oBAAoB,CAAC,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,kBAAkB,CAAC;IAoDzB,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,kBAAkB,CAAC;CAgDhC"}
@@ -1,35 +1,33 @@
1
1
  import type { Connection } from '@lancedb/lancedb';
2
- import type { StepResult, WorkflowRunState, WorkflowRuns } from '@mastra/core';
3
- import type { StorageListWorkflowRunsInput } from '@mastra/core/storage';
2
+ import type { StorageListWorkflowRunsInput, WorkflowRuns, UpdateWorkflowStateOptions } from '@mastra/core/storage';
4
3
  import { WorkflowsStorage } from '@mastra/core/storage';
4
+ import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
5
+ import type { LanceDomainConfig } from '../../db/index.js';
5
6
  export declare class StoreWorkflowsLance extends WorkflowsStorage {
7
+ #private;
6
8
  client: Connection;
7
- constructor({ client }: {
8
- client: Connection;
9
- });
10
- updateWorkflowResults({}: {
9
+ constructor(config: LanceDomainConfig);
10
+ init(): Promise<void>;
11
+ dangerouslyClearAll(): Promise<void>;
12
+ updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
11
13
  workflowName: string;
12
14
  runId: string;
13
15
  stepId: string;
14
16
  result: StepResult<any, any, any, any>;
15
17
  requestContext: Record<string, any>;
16
18
  }): Promise<Record<string, StepResult<any, any, any, any>>>;
17
- updateWorkflowState({}: {
19
+ updateWorkflowState({ workflowName, runId, opts, }: {
18
20
  workflowName: string;
19
21
  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
- };
22
+ opts: UpdateWorkflowStateOptions;
27
23
  }): Promise<WorkflowRunState | undefined>;
28
- persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
24
+ persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: {
29
25
  workflowName: string;
30
26
  runId: string;
31
27
  resourceId?: string;
32
28
  snapshot: WorkflowRunState;
29
+ createdAt?: Date;
30
+ updatedAt?: Date;
33
31
  }): Promise<void>;
34
32
  loadWorkflowSnapshot({ workflowName, runId, }: {
35
33
  workflowName: string;
@@ -45,6 +43,10 @@ export declare class StoreWorkflowsLance extends WorkflowsStorage {
45
43
  createdAt: Date;
46
44
  updatedAt: Date;
47
45
  } | null>;
46
+ deleteWorkflowRunById({ runId, workflowName }: {
47
+ runId: string;
48
+ workflowName: string;
49
+ }): Promise<void>;
48
50
  listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
49
51
  }
50
52
  //# 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;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,KAAK,EAAe,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAuC,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAuB7F,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,MAAM,EAA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AC;QACd,SAAS,EAAE,IAAI,CAAC;QAChB,SAAS,EAAE,IAAI,CAAC;KACjB,GAAG,IAAI,CAAC;IAyBH,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtG,gBAAgB,CAAC,IAAI,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,YAAY,CAAC;CAmFnF"}
@@ -1,228 +1,129 @@
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';
1
+ import type { Connection, ConnectionOptions } from '@lancedb/lancedb';
5
2
  import { MastraStorage } from '@mastra/core/storage';
6
- import type { TABLE_NAMES, PaginationInfo, StorageGetMessagesArg, StorageColumn, WorkflowRuns, StoragePagination, StorageDomains, StorageResourceType, StorageListWorkflowRunsInput } from '@mastra/core/storage';
7
- import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
3
+ import type { StorageDomains } from '@mastra/core/storage';
4
+ import { StoreMemoryLance } from './domains/memory/index.js';
5
+ import { StoreScoresLance } from './domains/scores/index.js';
6
+ import { StoreWorkflowsLance } from './domains/workflows/index.js';
7
+ export { StoreMemoryLance, StoreScoresLance, StoreWorkflowsLance };
8
+ export type { LanceDomainConfig } from './db/index.js';
9
+ export interface LanceStorageOptions {
10
+ /**
11
+ * When true, automatic initialization (table creation/migrations) is disabled.
12
+ * This is useful for CI/CD pipelines where you want to:
13
+ * 1. Run migrations explicitly during deployment (not at runtime)
14
+ * 2. Use different credentials for schema changes vs runtime operations
15
+ *
16
+ * When disableInit is true:
17
+ * - The storage will not automatically create/alter tables on first use
18
+ * - You must call `storage.init()` explicitly in your CI/CD scripts
19
+ *
20
+ * @example
21
+ * // In CI/CD script:
22
+ * const storage = await LanceStorage.create('id', 'name', '/path/to/db', undefined, { disableInit: false });
23
+ * await storage.init(); // Explicitly run migrations
24
+ *
25
+ * // In runtime application:
26
+ * const storage = await LanceStorage.create('id', 'name', '/path/to/db', undefined, { disableInit: true });
27
+ * // No auto-init, tables must already exist
28
+ */
29
+ disableInit?: boolean;
30
+ }
31
+ export interface LanceStorageClientOptions extends LanceStorageOptions {
32
+ /**
33
+ * Pre-configured LanceDB connection.
34
+ * Use this when you need to configure the connection before initialization.
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * import { connect } from '@lancedb/lancedb';
39
+ *
40
+ * const client = await connect('/path/to/db', {
41
+ * // Custom connection options
42
+ * });
43
+ *
44
+ * const store = await LanceStorage.fromClient('my-id', 'MyStorage', client);
45
+ * ```
46
+ */
47
+ client: Connection;
48
+ }
49
+ /**
50
+ * LanceDB storage adapter for Mastra.
51
+ *
52
+ * Access domain-specific storage via `getStore()`:
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const storage = await LanceStorage.create('my-id', 'MyStorage', '/path/to/db');
57
+ *
58
+ * // Access memory domain
59
+ * const memory = await storage.getStore('memory');
60
+ * await memory?.saveThread({ thread });
61
+ *
62
+ * // Access workflows domain
63
+ * const workflows = await storage.getStore('workflows');
64
+ * await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
65
+ * ```
66
+ */
8
67
  export declare class LanceStorage extends MastraStorage {
9
68
  stores: StorageDomains;
10
69
  private lanceClient;
11
70
  /**
12
71
  * Creates a new instance of LanceStorage
72
+ * @param id The unique identifier for this storage instance
73
+ * @param name The name for this storage instance
13
74
  * @param uri The URI to connect to LanceDB
14
- * @param options connection options
75
+ * @param connectionOptions connection options for LanceDB
76
+ * @param storageOptions storage options including disableInit
15
77
  *
16
78
  * Usage:
17
79
  *
18
80
  * Connect to a local database
19
81
  * ```ts
20
- * const store = await LanceStorage.create('/path/to/db');
82
+ * const store = await LanceStorage.create('my-storage-id', 'MyStorage', '/path/to/db');
21
83
  * ```
22
84
  *
23
85
  * Connect to a LanceDB cloud database
24
86
  * ```ts
25
- * const store = await LanceStorage.create('db://host:port');
87
+ * const store = await LanceStorage.create('my-storage-id', 'MyStorage', 'db://host:port');
26
88
  * ```
27
89
  *
28
90
  * Connect to a cloud database
29
91
  * ```ts
30
- * const store = await LanceStorage.create('s3://bucket/db', { storageOptions: { timeout: '60s' } });
92
+ * const store = await LanceStorage.create('my-storage-id', 'MyStorage', 's3://bucket/db', { storageOptions: { timeout: '60s' } });
93
+ * ```
94
+ *
95
+ * Disable auto-init for runtime (after CI/CD has run migrations)
96
+ * ```ts
97
+ * const store = await LanceStorage.create('my-storage-id', 'MyStorage', '/path/to/db', undefined, { disableInit: true });
31
98
  * ```
32
99
  */
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[]>;
100
+ static create(id: string, name: string, uri: string, connectionOptions?: ConnectionOptions, storageOptions?: LanceStorageOptions): Promise<LanceStorage>;
72
101
  /**
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
102
+ * Creates a new instance of LanceStorage from a pre-configured LanceDB connection.
103
+ * Use this when you need to configure the connection before initialization.
104
+ *
105
+ * @param id The unique identifier for this storage instance
106
+ * @param name The name for this storage instance
107
+ * @param client Pre-configured LanceDB connection
108
+ * @param options Storage options including disableInit
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * import { connect } from '@lancedb/lancedb';
113
+ *
114
+ * const client = await connect('/path/to/db', {
115
+ * // Custom connection options
116
+ * });
117
+ *
118
+ * const store = LanceStorage.fromClient('my-id', 'MyStorage', client);
119
+ * ```
76
120
  */
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>;
121
+ static fromClient(id: string, name: string, client: Connection, options?: LanceStorageOptions): LanceStorage;
107
122
  /**
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
123
+ * @internal
124
+ * Private constructor to enforce using the create factory method.
125
+ * Note: stores is initialized in create() after the lanceClient is connected.
112
126
  */
113
- private processMessagesWithContext;
114
- getMessages(args: StorageGetMessagesArg & {
115
- format?: 'v1';
116
- }): Promise<MastraMessageV1[]>;
117
- getMessages(args: StorageGetMessagesArg & {
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[];
134
- }>;
135
- getMessagesPaginated(args: StorageGetMessagesArg & {
136
- format?: 'v1' | 'v2';
137
- }): Promise<PaginationInfo & {
138
- messages: MastraMessageV1[] | MastraMessageV2[];
139
- }>;
140
- updateMessages(_args: {
141
- messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
142
- id: string;
143
- content?: {
144
- metadata?: MastraMessageContentV2['metadata'];
145
- content?: MastraMessageContentV2['content'];
146
- };
147
- }[];
148
- }): Promise<MastraMessageV2[]>;
149
- listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
150
- getWorkflowRunById(args: {
151
- runId: string;
152
- workflowName?: string;
153
- }): Promise<{
154
- workflowName: string;
155
- runId: string;
156
- snapshot: any;
157
- createdAt: Date;
158
- updatedAt: Date;
159
- } | null>;
160
- updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
161
- workflowName: string;
162
- runId: string;
163
- stepId: string;
164
- result: StepResult<any, any, any, any>;
165
- requestContext: Record<string, any>;
166
- }): Promise<Record<string, StepResult<any, any, any, any>>>;
167
- updateWorkflowState({ workflowName, runId, opts, }: {
168
- workflowName: string;
169
- runId: string;
170
- opts: {
171
- status: string;
172
- result?: StepResult<any, any, any, any>;
173
- error?: string;
174
- suspendedPaths?: Record<string, number[]>;
175
- waitingPaths?: Record<string, number[]>;
176
- };
177
- }): Promise<WorkflowRunState | undefined>;
178
- persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
179
- workflowName: string;
180
- runId: string;
181
- resourceId?: string;
182
- snapshot: WorkflowRunState;
183
- }): Promise<void>;
184
- loadWorkflowSnapshot({ workflowName, runId, }: {
185
- workflowName: string;
186
- runId: string;
187
- }): Promise<WorkflowRunState | null>;
188
- getScoreById({ id: _id }: {
189
- id: string;
190
- }): Promise<ScoreRowData | null>;
191
- getScoresByScorerId({ scorerId, source, entityId, entityType, pagination, }: {
192
- scorerId: string;
193
- pagination: StoragePagination;
194
- source?: ScoringSource;
195
- entityId?: string;
196
- entityType?: string;
197
- }): Promise<{
198
- pagination: PaginationInfo;
199
- scores: ScoreRowData[];
200
- }>;
201
- saveScore(_score: ScoreRowData): Promise<{
202
- score: ScoreRowData;
203
- }>;
204
- getScoresByRunId({ runId, pagination, }: {
205
- runId: string;
206
- pagination: StoragePagination;
207
- }): Promise<{
208
- pagination: PaginationInfo;
209
- scores: ScoreRowData[];
210
- }>;
211
- getScoresByEntityId({ entityId, entityType, pagination, }: {
212
- pagination: StoragePagination;
213
- entityId: string;
214
- entityType: string;
215
- }): Promise<{
216
- pagination: PaginationInfo;
217
- scores: ScoreRowData[];
218
- }>;
219
- getScoresBySpan({ traceId, spanId, pagination, }: {
220
- traceId: string;
221
- spanId: string;
222
- pagination: StoragePagination;
223
- }): Promise<{
224
- pagination: PaginationInfo;
225
- scores: ScoreRowData[];
226
- }>;
127
+ private constructor();
227
128
  }
228
129
  //# sourceMappingURL=index.d.ts.map