@mastra/lance 0.0.0-tool-call-parts-20250630193309 → 0.0.0-workflow-deno-20250616115451

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { connect, Index } from '@lancedb/lancedb';
2
2
  import { MessageList } from '@mastra/core/agent';
3
- import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
4
3
  import { MastraStorage, TABLE_THREADS, TABLE_MESSAGES, TABLE_TRACES, TABLE_EVALS, TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
5
4
  import { Utf8, Float64, Binary, Float32, Int32, Field, Schema } from 'apache-arrow';
6
5
  import { MastraVector } from '@mastra/core/vector';
@@ -37,26 +36,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
37
36
  instance.lanceClient = await connect(uri, options);
38
37
  return instance;
39
38
  } catch (e) {
40
- throw new MastraError(
41
- {
42
- id: "STORAGE_LANCE_STORAGE_CONNECT_FAILED",
43
- domain: ErrorDomain.STORAGE,
44
- category: ErrorCategory.THIRD_PARTY,
45
- text: `Failed to connect to LanceDB: ${e.message || e}`,
46
- details: { uri, optionsProvided: !!options }
47
- },
48
- e
49
- );
50
- }
51
- }
52
- getPrimaryKeys(tableName) {
53
- let primaryId = ["id"];
54
- if (tableName === TABLE_WORKFLOW_SNAPSHOT) {
55
- primaryId = ["workflow_name", "run_id"];
56
- } else if (tableName === TABLE_EVALS) {
57
- primaryId = ["agent_name", "metric_name", "run_id"];
39
+ throw new Error(`Failed to connect to LanceDB: ${e}`);
58
40
  }
59
- return primaryId;
60
41
  }
61
42
  /**
62
43
  * @internal
@@ -69,40 +50,11 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
69
50
  tableName,
70
51
  schema
71
52
  }) {
72
- try {
73
- if (!this.lanceClient) {
74
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
75
- }
76
- if (!tableName) {
77
- throw new Error("tableName is required for createTable.");
78
- }
79
- if (!schema) {
80
- throw new Error("schema is required for createTable.");
81
- }
82
- } catch (error) {
83
- throw new MastraError(
84
- {
85
- id: "STORAGE_LANCE_STORAGE_CREATE_TABLE_INVALID_ARGS",
86
- domain: ErrorDomain.STORAGE,
87
- category: ErrorCategory.USER,
88
- details: { tableName }
89
- },
90
- error
91
- );
92
- }
93
53
  try {
94
54
  const arrowSchema = this.translateSchema(schema);
95
55
  await this.lanceClient.createEmptyTable(tableName, arrowSchema);
96
56
  } catch (error) {
97
- throw new MastraError(
98
- {
99
- id: "STORAGE_LANCE_STORAGE_CREATE_TABLE_FAILED",
100
- domain: ErrorDomain.STORAGE,
101
- category: ErrorCategory.THIRD_PARTY,
102
- details: { tableName }
103
- },
104
- error
105
- );
57
+ throw new Error(`Failed to create table: ${error}`);
106
58
  }
107
59
  }
108
60
  translateSchema(schema) {
@@ -145,41 +97,14 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
145
97
  * @param tableName Name of the table to drop
146
98
  */
147
99
  async dropTable(tableName) {
148
- try {
149
- if (!this.lanceClient) {
150
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
151
- }
152
- if (!tableName) {
153
- throw new Error("tableName is required for dropTable.");
154
- }
155
- } catch (validationError) {
156
- throw new MastraError(
157
- {
158
- id: "STORAGE_LANCE_STORAGE_DROP_TABLE_INVALID_ARGS",
159
- domain: ErrorDomain.STORAGE,
160
- category: ErrorCategory.USER,
161
- text: validationError.message,
162
- details: { tableName }
163
- },
164
- validationError
165
- );
166
- }
167
100
  try {
168
101
  await this.lanceClient.dropTable(tableName);
169
102
  } catch (error) {
170
- if (error.toString().includes("was not found") || error.message?.includes("Table not found")) {
103
+ if (error.toString().includes("was not found")) {
171
104
  this.logger.debug(`Table '${tableName}' does not exist, skipping drop`);
172
105
  return;
173
106
  }
174
- throw new MastraError(
175
- {
176
- id: "STORAGE_LANCE_STORAGE_DROP_TABLE_FAILED",
177
- domain: ErrorDomain.STORAGE,
178
- category: ErrorCategory.THIRD_PARTY,
179
- details: { tableName }
180
- },
181
- error
182
- );
107
+ throw new Error(`Failed to drop table: ${error}`);
183
108
  }
184
109
  }
185
110
  /**
@@ -188,25 +113,6 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
188
113
  * @returns Table schema
189
114
  */
190
115
  async getTableSchema(tableName) {
191
- try {
192
- if (!this.lanceClient) {
193
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
194
- }
195
- if (!tableName) {
196
- throw new Error("tableName is required for getTableSchema.");
197
- }
198
- } catch (validationError) {
199
- throw new MastraError(
200
- {
201
- id: "STORAGE_LANCE_STORAGE_GET_TABLE_SCHEMA_INVALID_ARGS",
202
- domain: ErrorDomain.STORAGE,
203
- category: ErrorCategory.USER,
204
- text: validationError.message,
205
- details: { tableName }
206
- },
207
- validationError
208
- );
209
- }
210
116
  try {
211
117
  const table = await this.lanceClient.openTable(tableName);
212
118
  const rawSchema = await table.schema();
@@ -219,15 +125,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
219
125
  }
220
126
  };
221
127
  } catch (error) {
222
- throw new MastraError(
223
- {
224
- id: "STORAGE_LANCE_STORAGE_GET_TABLE_SCHEMA_FAILED",
225
- domain: ErrorDomain.STORAGE,
226
- category: ErrorCategory.THIRD_PARTY,
227
- details: { tableName }
228
- },
229
- error
230
- );
128
+ throw new Error(`Failed to get table schema: ${error}`);
231
129
  }
232
130
  }
233
131
  getDefaultValue(type) {
@@ -258,101 +156,32 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
258
156
  schema,
259
157
  ifNotExists
260
158
  }) {
261
- try {
262
- if (!this.lanceClient) {
263
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
264
- }
265
- if (!tableName) {
266
- throw new Error("tableName is required for alterTable.");
267
- }
268
- if (!schema) {
269
- throw new Error("schema is required for alterTable.");
270
- }
271
- if (!ifNotExists || ifNotExists.length === 0) {
272
- this.logger.debug("No columns specified to add in alterTable, skipping.");
273
- return;
274
- }
275
- } catch (validationError) {
276
- throw new MastraError(
277
- {
278
- id: "STORAGE_LANCE_STORAGE_ALTER_TABLE_INVALID_ARGS",
279
- domain: ErrorDomain.STORAGE,
280
- category: ErrorCategory.USER,
281
- text: validationError.message,
282
- details: { tableName }
283
- },
284
- validationError
285
- );
286
- }
287
- try {
288
- const table = await this.lanceClient.openTable(tableName);
289
- const currentSchema = await table.schema();
290
- const existingFields = new Set(currentSchema.fields.map((f) => f.name));
291
- const typeMap = {
292
- text: "string",
293
- integer: "int",
294
- bigint: "bigint",
295
- timestamp: "timestamp",
296
- jsonb: "string",
297
- uuid: "string"
159
+ const table = await this.lanceClient.openTable(tableName);
160
+ const currentSchema = await table.schema();
161
+ const existingFields = new Set(currentSchema.fields.map((f) => f.name));
162
+ const typeMap = {
163
+ text: "string",
164
+ integer: "int",
165
+ bigint: "bigint",
166
+ timestamp: "timestamp",
167
+ jsonb: "string",
168
+ uuid: "string"
169
+ };
170
+ const columnsToAdd = ifNotExists.filter((col) => schema[col] && !existingFields.has(col)).map((col) => {
171
+ const colDef = schema[col];
172
+ return {
173
+ name: col,
174
+ valueSql: colDef?.nullable ? `cast(NULL as ${typeMap[colDef.type ?? "text"]})` : `cast(${this.getDefaultValue(colDef?.type ?? "text")} as ${typeMap[colDef?.type ?? "text"]})`
298
175
  };
299
- const columnsToAdd = ifNotExists.filter((col) => schema[col] && !existingFields.has(col)).map((col) => {
300
- const colDef = schema[col];
301
- return {
302
- name: col,
303
- valueSql: colDef?.nullable ? `cast(NULL as ${typeMap[colDef.type ?? "text"]})` : `cast(${this.getDefaultValue(colDef?.type ?? "text")} as ${typeMap[colDef?.type ?? "text"]})`
304
- };
305
- });
306
- if (columnsToAdd.length > 0) {
307
- await table.addColumns(columnsToAdd);
308
- this.logger?.info?.(`Added columns [${columnsToAdd.map((c) => c.name).join(", ")}] to table ${tableName}`);
309
- }
310
- } catch (error) {
311
- throw new MastraError(
312
- {
313
- id: "STORAGE_LANCE_STORAGE_ALTER_TABLE_FAILED",
314
- domain: ErrorDomain.STORAGE,
315
- category: ErrorCategory.THIRD_PARTY,
316
- details: { tableName }
317
- },
318
- error
319
- );
176
+ });
177
+ if (columnsToAdd.length > 0) {
178
+ await table.addColumns(columnsToAdd);
179
+ this.logger?.info?.(`Added columns [${columnsToAdd.map((c) => c.name).join(", ")}] to table ${tableName}`);
320
180
  }
321
181
  }
322
182
  async clearTable({ tableName }) {
323
- try {
324
- if (!this.lanceClient) {
325
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
326
- }
327
- if (!tableName) {
328
- throw new Error("tableName is required for clearTable.");
329
- }
330
- } catch (validationError) {
331
- throw new MastraError(
332
- {
333
- id: "STORAGE_LANCE_STORAGE_CLEAR_TABLE_INVALID_ARGS",
334
- domain: ErrorDomain.STORAGE,
335
- category: ErrorCategory.USER,
336
- text: validationError.message,
337
- details: { tableName }
338
- },
339
- validationError
340
- );
341
- }
342
- try {
343
- const table = await this.lanceClient.openTable(tableName);
344
- await table.delete("1=1");
345
- } catch (error) {
346
- throw new MastraError(
347
- {
348
- id: "STORAGE_LANCE_STORAGE_CLEAR_TABLE_FAILED",
349
- domain: ErrorDomain.STORAGE,
350
- category: ErrorCategory.THIRD_PARTY,
351
- details: { tableName }
352
- },
353
- error
354
- );
355
- }
183
+ const table = await this.lanceClient.openTable(tableName);
184
+ await table.delete("1=1");
356
185
  }
357
186
  /**
358
187
  * Insert a single record into a table. This function overwrites the existing record if it exists. Use this function for inserting records into tables with custom schemas.
@@ -360,31 +189,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
360
189
  * @param record The record to insert.
361
190
  */
362
191
  async insert({ tableName, record }) {
363
- try {
364
- if (!this.lanceClient) {
365
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
366
- }
367
- if (!tableName) {
368
- throw new Error("tableName is required for insert.");
369
- }
370
- if (!record || Object.keys(record).length === 0) {
371
- throw new Error("record is required and cannot be empty for insert.");
372
- }
373
- } catch (validationError) {
374
- throw new MastraError(
375
- {
376
- id: "STORAGE_LANCE_STORAGE_INSERT_INVALID_ARGS",
377
- domain: ErrorDomain.STORAGE,
378
- category: ErrorCategory.USER,
379
- text: validationError.message,
380
- details: { tableName }
381
- },
382
- validationError
383
- );
384
- }
385
192
  try {
386
193
  const table = await this.lanceClient.openTable(tableName);
387
- const primaryId = this.getPrimaryKeys(tableName);
388
194
  const processedRecord = { ...record };
389
195
  for (const key in processedRecord) {
390
196
  if (processedRecord[key] !== null && typeof processedRecord[key] === "object" && !(processedRecord[key] instanceof Date)) {
@@ -392,17 +198,9 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
392
198
  processedRecord[key] = JSON.stringify(processedRecord[key]);
393
199
  }
394
200
  }
395
- await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([processedRecord]);
201
+ await table.add([processedRecord], { mode: "overwrite" });
396
202
  } catch (error) {
397
- throw new MastraError(
398
- {
399
- id: "STORAGE_LANCE_STORAGE_INSERT_FAILED",
400
- domain: ErrorDomain.STORAGE,
401
- category: ErrorCategory.THIRD_PARTY,
402
- details: { tableName }
403
- },
404
- error
405
- );
203
+ throw new Error(`Failed to insert record: ${error}`);
406
204
  }
407
205
  }
408
206
  /**
@@ -411,31 +209,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
411
209
  * @param records The records to insert.
412
210
  */
413
211
  async batchInsert({ tableName, records }) {
414
- try {
415
- if (!this.lanceClient) {
416
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
417
- }
418
- if (!tableName) {
419
- throw new Error("tableName is required for batchInsert.");
420
- }
421
- if (!records || records.length === 0) {
422
- throw new Error("records array is required and cannot be empty for batchInsert.");
423
- }
424
- } catch (validationError) {
425
- throw new MastraError(
426
- {
427
- id: "STORAGE_LANCE_STORAGE_BATCH_INSERT_INVALID_ARGS",
428
- domain: ErrorDomain.STORAGE,
429
- category: ErrorCategory.USER,
430
- text: validationError.message,
431
- details: { tableName }
432
- },
433
- validationError
434
- );
435
- }
436
212
  try {
437
213
  const table = await this.lanceClient.openTable(tableName);
438
- const primaryId = this.getPrimaryKeys(tableName);
439
214
  const processedRecords = records.map((record) => {
440
215
  const processedRecord = { ...record };
441
216
  for (const key in processedRecord) {
@@ -446,17 +221,9 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
446
221
  }
447
222
  return processedRecord;
448
223
  });
449
- await table.mergeInsert(primaryId).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(processedRecords);
224
+ await table.add(processedRecords, { mode: "overwrite" });
450
225
  } catch (error) {
451
- throw new MastraError(
452
- {
453
- id: "STORAGE_LANCE_STORAGE_BATCH_INSERT_FAILED",
454
- domain: ErrorDomain.STORAGE,
455
- category: ErrorCategory.THIRD_PARTY,
456
- details: { tableName }
457
- },
458
- error
459
- );
226
+ throw new Error(`Failed to batch insert records: ${error}`);
460
227
  }
461
228
  }
462
229
  /**
@@ -467,28 +234,6 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
467
234
  * @returns The loaded record with proper type conversions, or null if not found
468
235
  */
469
236
  async load({ tableName, keys }) {
470
- try {
471
- if (!this.lanceClient) {
472
- throw new Error("LanceDB client not initialized. Call LanceStorage.create() first.");
473
- }
474
- if (!tableName) {
475
- throw new Error("tableName is required for load.");
476
- }
477
- if (!keys || Object.keys(keys).length === 0) {
478
- throw new Error("keys are required and cannot be empty for load.");
479
- }
480
- } catch (validationError) {
481
- throw new MastraError(
482
- {
483
- id: "STORAGE_LANCE_STORAGE_LOAD_INVALID_ARGS",
484
- domain: ErrorDomain.STORAGE,
485
- category: ErrorCategory.USER,
486
- text: validationError.message,
487
- details: { tableName }
488
- },
489
- validationError
490
- );
491
- }
492
237
  try {
493
238
  const table = await this.lanceClient.openTable(tableName);
494
239
  const tableSchema = await this.getTableSchema(tableName);
@@ -516,16 +261,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
516
261
  }
517
262
  return this.processResultWithTypeConversion(result[0], tableSchema);
518
263
  } catch (error) {
519
- if (error instanceof MastraError) throw error;
520
- throw new MastraError(
521
- {
522
- id: "STORAGE_LANCE_STORAGE_LOAD_FAILED",
523
- domain: ErrorDomain.STORAGE,
524
- category: ErrorCategory.THIRD_PARTY,
525
- details: { tableName, keyCount: Object.keys(keys).length, firstKey: Object.keys(keys)[0] ?? "" }
526
- },
527
- error
528
- );
264
+ throw new Error(`Failed to load record: ${error}`);
529
265
  }
530
266
  }
531
267
  /**
@@ -600,14 +336,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
600
336
  try {
601
337
  return this.load({ tableName: TABLE_THREADS, keys: { id: threadId } });
602
338
  } catch (error) {
603
- throw new MastraError(
604
- {
605
- id: "LANCE_STORE_GET_THREAD_BY_ID_FAILED",
606
- domain: ErrorDomain.STORAGE,
607
- category: ErrorCategory.THIRD_PARTY
608
- },
609
- error
610
- );
339
+ throw new Error(`Failed to get thread by ID: ${error}`);
611
340
  }
612
341
  }
613
342
  async getThreadsByResourceId({ resourceId }) {
@@ -620,14 +349,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
620
349
  await this.getTableSchema(TABLE_THREADS)
621
350
  );
622
351
  } catch (error) {
623
- throw new MastraError(
624
- {
625
- id: "LANCE_STORE_GET_THREADS_BY_RESOURCE_ID_FAILED",
626
- domain: ErrorDomain.STORAGE,
627
- category: ErrorCategory.THIRD_PARTY
628
- },
629
- error
630
- );
352
+ throw new Error(`Failed to get threads by resource ID: ${error}`);
631
353
  }
632
354
  }
633
355
  /**
@@ -642,14 +364,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
642
364
  await table.add([record], { mode: "append" });
643
365
  return thread;
644
366
  } catch (error) {
645
- throw new MastraError(
646
- {
647
- id: "LANCE_STORE_SAVE_THREAD_FAILED",
648
- domain: ErrorDomain.STORAGE,
649
- category: ErrorCategory.THIRD_PARTY
650
- },
651
- error
652
- );
367
+ throw new Error(`Failed to save thread: ${error}`);
653
368
  }
654
369
  }
655
370
  async updateThread({
@@ -660,7 +375,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
660
375
  try {
661
376
  const record = { id, title, metadata: JSON.stringify(metadata) };
662
377
  const table = await this.lanceClient.openTable(TABLE_THREADS);
663
- await table.mergeInsert("id").whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([record]);
378
+ await table.add([record], { mode: "overwrite" });
664
379
  const query = table.query().where(`id = '${id}'`);
665
380
  const records = await query.toArray();
666
381
  return this.processResultWithTypeConversion(
@@ -668,14 +383,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
668
383
  await this.getTableSchema(TABLE_THREADS)
669
384
  );
670
385
  } catch (error) {
671
- throw new MastraError(
672
- {
673
- id: "LANCE_STORE_UPDATE_THREAD_FAILED",
674
- domain: ErrorDomain.STORAGE,
675
- category: ErrorCategory.THIRD_PARTY
676
- },
677
- error
678
- );
386
+ throw new Error(`Failed to update thread: ${error}`);
679
387
  }
680
388
  }
681
389
  async deleteThread({ threadId }) {
@@ -683,14 +391,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
683
391
  const table = await this.lanceClient.openTable(TABLE_THREADS);
684
392
  await table.delete(`id = '${threadId}'`);
685
393
  } catch (error) {
686
- throw new MastraError(
687
- {
688
- id: "LANCE_STORE_DELETE_THREAD_FAILED",
689
- domain: ErrorDomain.STORAGE,
690
- category: ErrorCategory.THIRD_PARTY
691
- },
692
- error
693
- );
394
+ throw new Error(`Failed to delete thread: ${error}`);
694
395
  }
695
396
  }
696
397
  /**
@@ -752,7 +453,6 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
752
453
  if (threadConfig) {
753
454
  throw new Error("ThreadConfig is not supported by LanceDB storage");
754
455
  }
755
- const limit = this.resolveMessageLimit({ last: selectBy?.last, defaultLimit: Number.MAX_SAFE_INTEGER });
756
456
  const table = await this.lanceClient.openTable(TABLE_MESSAGES);
757
457
  let query = table.query().where(`\`threadId\` = '${threadId}'`);
758
458
  if (selectBy) {
@@ -771,8 +471,8 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
771
471
  if (selectBy?.include && selectBy.include.length > 0) {
772
472
  records = this.processMessagesWithContext(records, selectBy.include);
773
473
  }
774
- if (limit !== Number.MAX_SAFE_INTEGER) {
775
- records = records.slice(-limit);
474
+ if (selectBy?.last !== void 0 && selectBy.last !== false) {
475
+ records = records.slice(-selectBy.last);
776
476
  }
777
477
  const messages = this.processResultWithTypeConversion(records, await this.getTableSchema(TABLE_MESSAGES));
778
478
  const normalized = messages.map((msg) => ({
@@ -789,14 +489,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
789
489
  if (format === "v2") return list.get.all.v2();
790
490
  return list.get.all.v1();
791
491
  } catch (error) {
792
- throw new MastraError(
793
- {
794
- id: "LANCE_STORE_GET_MESSAGES_FAILED",
795
- domain: ErrorDomain.STORAGE,
796
- category: ErrorCategory.THIRD_PARTY
797
- },
798
- error
799
- );
492
+ throw new Error(`Failed to get messages: ${error}`);
800
493
  }
801
494
  }
802
495
  async saveMessages(args) {
@@ -814,19 +507,12 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
814
507
  content: JSON.stringify(message.content)
815
508
  }));
816
509
  const table = await this.lanceClient.openTable(TABLE_MESSAGES);
817
- await table.mergeInsert("id").whenMatchedUpdateAll().whenNotMatchedInsertAll().execute(transformedMessages);
510
+ await table.add(transformedMessages, { mode: "overwrite" });
818
511
  const list = new MessageList().add(messages, "memory");
819
512
  if (format === `v2`) return list.get.all.v2();
820
513
  return list.get.all.v1();
821
514
  } catch (error) {
822
- throw new MastraError(
823
- {
824
- id: "LANCE_STORE_SAVE_MESSAGES_FAILED",
825
- domain: ErrorDomain.STORAGE,
826
- category: ErrorCategory.THIRD_PARTY
827
- },
828
- error
829
- );
515
+ throw new Error(`Failed to save messages: ${error}`);
830
516
  }
831
517
  }
832
518
  async saveTrace({ trace }) {
@@ -843,14 +529,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
843
529
  await table.add([record], { mode: "append" });
844
530
  return trace;
845
531
  } catch (error) {
846
- throw new MastraError(
847
- {
848
- id: "LANCE_STORE_SAVE_TRACE_FAILED",
849
- domain: ErrorDomain.STORAGE,
850
- category: ErrorCategory.THIRD_PARTY
851
- },
852
- error
853
- );
532
+ throw new Error(`Failed to save trace: ${error}`);
854
533
  }
855
534
  }
856
535
  async getTraceById({ traceId }) {
@@ -860,14 +539,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
860
539
  const records = await query.toArray();
861
540
  return this.processResultWithTypeConversion(records[0], await this.getTableSchema(TABLE_TRACES));
862
541
  } catch (error) {
863
- throw new MastraError(
864
- {
865
- id: "LANCE_STORE_GET_TRACE_BY_ID_FAILED",
866
- domain: ErrorDomain.STORAGE,
867
- category: ErrorCategory.THIRD_PARTY
868
- },
869
- error
870
- );
542
+ throw new Error(`Failed to get trace by ID: ${error}`);
871
543
  }
872
544
  }
873
545
  async getTraces({
@@ -909,15 +581,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
909
581
  };
910
582
  });
911
583
  } catch (error) {
912
- throw new MastraError(
913
- {
914
- id: "LANCE_STORE_GET_TRACES_FAILED",
915
- domain: ErrorDomain.STORAGE,
916
- category: ErrorCategory.THIRD_PARTY,
917
- details: { name: name ?? "", scope: scope ?? "" }
918
- },
919
- error
920
- );
584
+ throw new Error(`Failed to get traces: ${error}`);
921
585
  }
922
586
  }
923
587
  async saveEvals({ evals }) {
@@ -938,14 +602,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
938
602
  await table.add(transformedEvals, { mode: "append" });
939
603
  return evals;
940
604
  } catch (error) {
941
- throw new MastraError(
942
- {
943
- id: "LANCE_STORE_SAVE_EVALS_FAILED",
944
- domain: ErrorDomain.STORAGE,
945
- category: ErrorCategory.THIRD_PARTY
946
- },
947
- error
948
- );
605
+ throw new Error(`Failed to save evals: ${error}`);
949
606
  }
950
607
  }
951
608
  async getEvalsByAgentName(agentName, type) {
@@ -972,15 +629,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
972
629
  };
973
630
  });
974
631
  } catch (error) {
975
- throw new MastraError(
976
- {
977
- id: "LANCE_STORE_GET_EVALS_BY_AGENT_NAME_FAILED",
978
- domain: ErrorDomain.STORAGE,
979
- category: ErrorCategory.THIRD_PARTY,
980
- details: { agentName }
981
- },
982
- error
983
- );
632
+ throw new Error(`Failed to get evals by agent name: ${error}`);
984
633
  }
985
634
  }
986
635
  parseWorkflowRun(row) {
@@ -1026,15 +675,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
1026
675
  total: records.length
1027
676
  };
1028
677
  } catch (error) {
1029
- throw new MastraError(
1030
- {
1031
- id: "LANCE_STORE_GET_WORKFLOW_RUNS_FAILED",
1032
- domain: ErrorDomain.STORAGE,
1033
- category: ErrorCategory.THIRD_PARTY,
1034
- details: { namespace: args?.namespace ?? "", workflowName: args?.workflowName ?? "" }
1035
- },
1036
- error
1037
- );
678
+ throw new Error(`Failed to get workflow runs: ${error}`);
1038
679
  }
1039
680
  }
1040
681
  /**
@@ -1055,15 +696,7 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
1055
696
  const record = records[0];
1056
697
  return this.parseWorkflowRun(record);
1057
698
  } catch (error) {
1058
- throw new MastraError(
1059
- {
1060
- id: "LANCE_STORE_GET_WORKFLOW_RUN_BY_ID_FAILED",
1061
- domain: ErrorDomain.STORAGE,
1062
- category: ErrorCategory.THIRD_PARTY,
1063
- details: { runId: args.runId, workflowName: args.workflowName ?? "" }
1064
- },
1065
- error
1066
- );
699
+ throw new Error(`Failed to get workflow run by id: ${error}`);
1067
700
  }
1068
701
  }
1069
702
  async persistWorkflowSnapshot({
@@ -1077,8 +710,10 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
1077
710
  const records = await query.toArray();
1078
711
  let createdAt;
1079
712
  const now = Date.now();
713
+ let mode = "append";
1080
714
  if (records.length > 0) {
1081
715
  createdAt = records[0].createdAt ?? now;
716
+ mode = "overwrite";
1082
717
  } else {
1083
718
  createdAt = now;
1084
719
  }
@@ -1089,17 +724,9 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
1089
724
  createdAt,
1090
725
  updatedAt: now
1091
726
  };
1092
- await table.mergeInsert(["workflow_name", "run_id"]).whenMatchedUpdateAll().whenNotMatchedInsertAll().execute([record]);
727
+ await table.add([record], { mode });
1093
728
  } catch (error) {
1094
- throw new MastraError(
1095
- {
1096
- id: "LANCE_STORE_PERSIST_WORKFLOW_SNAPSHOT_FAILED",
1097
- domain: ErrorDomain.STORAGE,
1098
- category: ErrorCategory.THIRD_PARTY,
1099
- details: { workflowName, runId }
1100
- },
1101
- error
1102
- );
729
+ throw new Error(`Failed to persist workflow snapshot: ${error}`);
1103
730
  }
1104
731
  }
1105
732
  async loadWorkflowSnapshot({
@@ -1112,50 +739,17 @@ var LanceStorage = class _LanceStorage extends MastraStorage {
1112
739
  const records = await query.toArray();
1113
740
  return records.length > 0 ? JSON.parse(records[0].snapshot) : null;
1114
741
  } catch (error) {
1115
- throw new MastraError(
1116
- {
1117
- id: "LANCE_STORE_LOAD_WORKFLOW_SNAPSHOT_FAILED",
1118
- domain: ErrorDomain.STORAGE,
1119
- category: ErrorCategory.THIRD_PARTY,
1120
- details: { workflowName, runId }
1121
- },
1122
- error
1123
- );
742
+ throw new Error(`Failed to load workflow snapshot: ${error}`);
1124
743
  }
1125
744
  }
1126
745
  async getTracesPaginated(_args) {
1127
- throw new MastraError(
1128
- {
1129
- id: "LANCE_STORE_GET_TRACES_PAGINATED_FAILED",
1130
- domain: ErrorDomain.STORAGE,
1131
- category: ErrorCategory.THIRD_PARTY
1132
- },
1133
- "Method not implemented."
1134
- );
746
+ throw new Error("Method not implemented.");
1135
747
  }
1136
748
  async getThreadsByResourceIdPaginated(_args) {
1137
- throw new MastraError(
1138
- {
1139
- id: "LANCE_STORE_GET_THREADS_BY_RESOURCE_ID_PAGINATED_FAILED",
1140
- domain: ErrorDomain.STORAGE,
1141
- category: ErrorCategory.THIRD_PARTY
1142
- },
1143
- "Method not implemented."
1144
- );
749
+ throw new Error("Method not implemented.");
1145
750
  }
1146
751
  async getMessagesPaginated(_args) {
1147
- throw new MastraError(
1148
- {
1149
- id: "LANCE_STORE_GET_MESSAGES_PAGINATED_FAILED",
1150
- domain: ErrorDomain.STORAGE,
1151
- category: ErrorCategory.THIRD_PARTY
1152
- },
1153
- "Method not implemented."
1154
- );
1155
- }
1156
- async updateMessages(_args) {
1157
- this.logger.error("updateMessages is not yet implemented in LanceStore");
1158
- throw new Error("Method not implemented");
752
+ throw new Error("Method not implemented.");
1159
753
  }
1160
754
  };
1161
755
  var LanceFilterTranslator = class extends BaseFilterTranslator {
@@ -1509,15 +1103,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1509
1103
  instance.lanceClient = await connect(uri, options);
1510
1104
  return instance;
1511
1105
  } catch (e) {
1512
- throw new MastraError(
1513
- {
1514
- id: "STORAGE_LANCE_VECTOR_CONNECT_FAILED",
1515
- domain: ErrorDomain.STORAGE,
1516
- category: ErrorCategory.THIRD_PARTY,
1517
- details: { uri }
1518
- },
1519
- e
1520
- );
1106
+ throw new Error(`Failed to connect to LanceDB: ${e}`);
1521
1107
  }
1522
1108
  }
1523
1109
  /**
@@ -1541,27 +1127,14 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1541
1127
  columns = [],
1542
1128
  includeAllColumns = false
1543
1129
  }) {
1544
- try {
1545
- if (!this.lanceClient) {
1546
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1547
- }
1548
- if (!tableName) {
1549
- throw new Error("tableName is required");
1550
- }
1551
- if (!queryVector) {
1552
- throw new Error("queryVector is required");
1553
- }
1554
- } catch (error) {
1555
- throw new MastraError(
1556
- {
1557
- id: "STORAGE_LANCE_VECTOR_QUERY_FAILED_INVALID_ARGS",
1558
- domain: ErrorDomain.STORAGE,
1559
- category: ErrorCategory.USER,
1560
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
1561
- details: { tableName }
1562
- },
1563
- error
1564
- );
1130
+ if (!this.lanceClient) {
1131
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1132
+ }
1133
+ if (!tableName) {
1134
+ throw new Error("tableName is required");
1135
+ }
1136
+ if (!queryVector) {
1137
+ throw new Error("queryVector is required");
1565
1138
  }
1566
1139
  try {
1567
1140
  const table = await this.lanceClient.openTable(tableName);
@@ -1600,15 +1173,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1600
1173
  };
1601
1174
  });
1602
1175
  } catch (error) {
1603
- throw new MastraError(
1604
- {
1605
- id: "STORAGE_LANCE_VECTOR_QUERY_FAILED",
1606
- domain: ErrorDomain.STORAGE,
1607
- category: ErrorCategory.THIRD_PARTY,
1608
- details: { tableName, includeVector, columnsCount: columns?.length, includeAllColumns }
1609
- },
1610
- error
1611
- );
1176
+ throw new Error(`Failed to query vectors: ${error.message}`);
1612
1177
  }
1613
1178
  }
1614
1179
  filterTranslator(filter) {
@@ -1641,27 +1206,14 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1641
1206
  return translator.translate(prefixedFilter);
1642
1207
  }
1643
1208
  async upsert({ tableName, vectors, metadata = [], ids = [] }) {
1644
- try {
1645
- if (!this.lanceClient) {
1646
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1647
- }
1648
- if (!tableName) {
1649
- throw new Error("tableName is required");
1650
- }
1651
- if (!vectors || !Array.isArray(vectors) || vectors.length === 0) {
1652
- throw new Error("vectors array is required and must not be empty");
1653
- }
1654
- } catch (error) {
1655
- throw new MastraError(
1656
- {
1657
- id: "STORAGE_LANCE_VECTOR_UPSERT_FAILED_INVALID_ARGS",
1658
- domain: ErrorDomain.STORAGE,
1659
- category: ErrorCategory.USER,
1660
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
1661
- details: { tableName }
1662
- },
1663
- error
1664
- );
1209
+ if (!this.lanceClient) {
1210
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1211
+ }
1212
+ if (!tableName) {
1213
+ throw new Error("tableName is required");
1214
+ }
1215
+ if (!vectors || !Array.isArray(vectors) || vectors.length === 0) {
1216
+ throw new Error("vectors array is required and must not be empty");
1665
1217
  }
1666
1218
  try {
1667
1219
  const tables = await this.lanceClient.tableNames();
@@ -1688,15 +1240,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1688
1240
  await table.add(data, { mode: "overwrite" });
1689
1241
  return vectorIds;
1690
1242
  } catch (error) {
1691
- throw new MastraError(
1692
- {
1693
- id: "STORAGE_LANCE_VECTOR_UPSERT_FAILED",
1694
- domain: ErrorDomain.STORAGE,
1695
- category: ErrorCategory.THIRD_PARTY,
1696
- details: { tableName, vectorCount: vectors.length, metadataCount: metadata.length, idsCount: ids.length }
1697
- },
1698
- error
1699
- );
1243
+ throw new Error(`Failed to upsert vectors: ${error.message}`);
1700
1244
  }
1701
1245
  }
1702
1246
  /**
@@ -1716,78 +1260,29 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1716
1260
  }
1717
1261
  async createTable(tableName, data, options) {
1718
1262
  if (!this.lanceClient) {
1719
- throw new MastraError({
1720
- id: "STORAGE_LANCE_VECTOR_CREATE_TABLE_FAILED_INVALID_ARGS",
1721
- domain: ErrorDomain.STORAGE,
1722
- category: ErrorCategory.USER,
1723
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
1724
- details: { tableName }
1725
- });
1726
- }
1727
- if (Array.isArray(data)) {
1728
- data = data.map((record) => this.flattenObject(record));
1263
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1729
1264
  }
1730
1265
  try {
1266
+ if (Array.isArray(data)) {
1267
+ data = data.map((record) => this.flattenObject(record));
1268
+ }
1731
1269
  return await this.lanceClient.createTable(tableName, data, options);
1732
1270
  } catch (error) {
1733
- throw new MastraError(
1734
- {
1735
- id: "STORAGE_LANCE_VECTOR_CREATE_TABLE_FAILED",
1736
- domain: ErrorDomain.STORAGE,
1737
- category: ErrorCategory.THIRD_PARTY,
1738
- details: { tableName }
1739
- },
1740
- error
1741
- );
1271
+ throw new Error(`Failed to create table: ${error.message}`);
1742
1272
  }
1743
1273
  }
1744
1274
  async listTables() {
1745
1275
  if (!this.lanceClient) {
1746
- throw new MastraError({
1747
- id: "STORAGE_LANCE_VECTOR_LIST_TABLES_FAILED_INVALID_ARGS",
1748
- domain: ErrorDomain.STORAGE,
1749
- category: ErrorCategory.USER,
1750
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
1751
- details: { methodName: "listTables" }
1752
- });
1753
- }
1754
- try {
1755
- return await this.lanceClient.tableNames();
1756
- } catch (error) {
1757
- throw new MastraError(
1758
- {
1759
- id: "STORAGE_LANCE_VECTOR_LIST_TABLES_FAILED",
1760
- domain: ErrorDomain.STORAGE,
1761
- category: ErrorCategory.THIRD_PARTY
1762
- },
1763
- error
1764
- );
1276
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1765
1277
  }
1278
+ return await this.lanceClient.tableNames();
1766
1279
  }
1767
1280
  async getTableSchema(tableName) {
1768
1281
  if (!this.lanceClient) {
1769
- throw new MastraError({
1770
- id: "STORAGE_LANCE_VECTOR_GET_TABLE_SCHEMA_FAILED_INVALID_ARGS",
1771
- domain: ErrorDomain.STORAGE,
1772
- category: ErrorCategory.USER,
1773
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
1774
- details: { tableName }
1775
- });
1776
- }
1777
- try {
1778
- const table = await this.lanceClient.openTable(tableName);
1779
- return await table.schema();
1780
- } catch (error) {
1781
- throw new MastraError(
1782
- {
1783
- id: "STORAGE_LANCE_VECTOR_GET_TABLE_SCHEMA_FAILED",
1784
- domain: ErrorDomain.STORAGE,
1785
- category: ErrorCategory.THIRD_PARTY,
1786
- details: { tableName }
1787
- },
1788
- error
1789
- );
1282
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1790
1283
  }
1284
+ const table = await this.lanceClient.openTable(tableName);
1285
+ return await table.schema();
1791
1286
  }
1792
1287
  /**
1793
1288
  * indexName is actually a column name in a table in lanceDB
@@ -1799,10 +1294,10 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1799
1294
  metric = "cosine",
1800
1295
  indexConfig = {}
1801
1296
  }) {
1297
+ if (!this.lanceClient) {
1298
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1299
+ }
1802
1300
  try {
1803
- if (!this.lanceClient) {
1804
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1805
- }
1806
1301
  if (!tableName) {
1807
1302
  throw new Error("tableName is required");
1808
1303
  }
@@ -1812,18 +1307,6 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1812
1307
  if (typeof dimension !== "number" || dimension <= 0) {
1813
1308
  throw new Error("dimension must be a positive number");
1814
1309
  }
1815
- } catch (err) {
1816
- throw new MastraError(
1817
- {
1818
- id: "STORAGE_LANCE_VECTOR_CREATE_INDEX_FAILED_INVALID_ARGS",
1819
- domain: ErrorDomain.STORAGE,
1820
- category: ErrorCategory.USER,
1821
- details: { tableName: tableName || "", indexName, dimension, metric }
1822
- },
1823
- err
1824
- );
1825
- }
1826
- try {
1827
1310
  const tables = await this.lanceClient.tableNames();
1828
1311
  if (!tables.includes(tableName)) {
1829
1312
  throw new Error(
@@ -1858,26 +1341,12 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1858
1341
  });
1859
1342
  }
1860
1343
  } catch (error) {
1861
- throw new MastraError(
1862
- {
1863
- id: "STORAGE_LANCE_VECTOR_CREATE_INDEX_FAILED",
1864
- domain: ErrorDomain.STORAGE,
1865
- category: ErrorCategory.THIRD_PARTY,
1866
- details: { tableName: tableName || "", indexName, dimension }
1867
- },
1868
- error
1869
- );
1344
+ throw new Error(`Failed to create index: ${error.message}`);
1870
1345
  }
1871
1346
  }
1872
1347
  async listIndexes() {
1873
1348
  if (!this.lanceClient) {
1874
- throw new MastraError({
1875
- id: "STORAGE_LANCE_VECTOR_LIST_INDEXES_FAILED_INVALID_ARGS",
1876
- domain: ErrorDomain.STORAGE,
1877
- category: ErrorCategory.USER,
1878
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance",
1879
- details: { methodName: "listIndexes" }
1880
- });
1349
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1881
1350
  }
1882
1351
  try {
1883
1352
  const tables = await this.lanceClient.tableNames();
@@ -1889,34 +1358,15 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1889
1358
  }
1890
1359
  return allIndices;
1891
1360
  } catch (error) {
1892
- throw new MastraError(
1893
- {
1894
- id: "STORAGE_LANCE_VECTOR_LIST_INDEXES_FAILED",
1895
- domain: ErrorDomain.STORAGE,
1896
- category: ErrorCategory.THIRD_PARTY
1897
- },
1898
- error
1899
- );
1361
+ throw new Error(`Failed to list indexes: ${error.message}`);
1900
1362
  }
1901
1363
  }
1902
1364
  async describeIndex({ indexName }) {
1903
- try {
1904
- if (!this.lanceClient) {
1905
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1906
- }
1907
- if (!indexName) {
1908
- throw new Error("indexName is required");
1909
- }
1910
- } catch (err) {
1911
- throw new MastraError(
1912
- {
1913
- id: "STORAGE_LANCE_VECTOR_DESCRIBE_INDEX_FAILED_INVALID_ARGS",
1914
- domain: ErrorDomain.STORAGE,
1915
- category: ErrorCategory.USER,
1916
- details: { indexName }
1917
- },
1918
- err
1919
- );
1365
+ if (!this.lanceClient) {
1366
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1367
+ }
1368
+ if (!indexName) {
1369
+ throw new Error("indexName is required");
1920
1370
  }
1921
1371
  try {
1922
1372
  const tables = await this.lanceClient.tableNames();
@@ -1943,35 +1393,15 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1943
1393
  }
1944
1394
  throw new Error(`IndexName: ${indexName} not found`);
1945
1395
  } catch (error) {
1946
- throw new MastraError(
1947
- {
1948
- id: "STORAGE_LANCE_VECTOR_DESCRIBE_INDEX_FAILED",
1949
- domain: ErrorDomain.STORAGE,
1950
- category: ErrorCategory.THIRD_PARTY,
1951
- details: { indexName }
1952
- },
1953
- error
1954
- );
1396
+ throw new Error(`Failed to describe index: ${error.message}`);
1955
1397
  }
1956
1398
  }
1957
1399
  async deleteIndex({ indexName }) {
1958
- try {
1959
- if (!this.lanceClient) {
1960
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1961
- }
1962
- if (!indexName) {
1963
- throw new Error("indexName is required");
1964
- }
1965
- } catch (err) {
1966
- throw new MastraError(
1967
- {
1968
- id: "STORAGE_LANCE_VECTOR_DELETE_INDEX_FAILED_INVALID_ARGS",
1969
- domain: ErrorDomain.STORAGE,
1970
- category: ErrorCategory.USER,
1971
- details: { indexName }
1972
- },
1973
- err
1974
- );
1400
+ if (!this.lanceClient) {
1401
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1402
+ }
1403
+ if (!indexName) {
1404
+ throw new Error("indexName is required");
1975
1405
  }
1976
1406
  try {
1977
1407
  const tables = await this.lanceClient.tableNames();
@@ -1986,15 +1416,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
1986
1416
  }
1987
1417
  throw new Error(`Index ${indexName} not found`);
1988
1418
  } catch (error) {
1989
- throw new MastraError(
1990
- {
1991
- id: "STORAGE_LANCE_VECTOR_DELETE_INDEX_FAILED",
1992
- domain: ErrorDomain.STORAGE,
1993
- category: ErrorCategory.THIRD_PARTY,
1994
- details: { indexName }
1995
- },
1996
- error
1997
- );
1419
+ throw new Error(`Failed to delete index: ${error.message}`);
1998
1420
  }
1999
1421
  }
2000
1422
  /**
@@ -2002,73 +1424,33 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
2002
1424
  */
2003
1425
  async deleteAllTables() {
2004
1426
  if (!this.lanceClient) {
2005
- throw new MastraError({
2006
- id: "STORAGE_LANCE_VECTOR_DELETE_ALL_TABLES_FAILED_INVALID_ARGS",
2007
- domain: ErrorDomain.STORAGE,
2008
- category: ErrorCategory.USER,
2009
- details: { methodName: "deleteAllTables" },
2010
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance"
2011
- });
1427
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
2012
1428
  }
2013
1429
  try {
2014
1430
  await this.lanceClient.dropAllTables();
2015
1431
  } catch (error) {
2016
- throw new MastraError(
2017
- {
2018
- id: "STORAGE_LANCE_VECTOR_DELETE_ALL_TABLES_FAILED",
2019
- domain: ErrorDomain.STORAGE,
2020
- category: ErrorCategory.THIRD_PARTY,
2021
- details: { methodName: "deleteAllTables" }
2022
- },
2023
- error
2024
- );
1432
+ throw new Error(`Failed to delete tables: ${error.message}`);
2025
1433
  }
2026
1434
  }
2027
1435
  async deleteTable(tableName) {
2028
1436
  if (!this.lanceClient) {
2029
- throw new MastraError({
2030
- id: "STORAGE_LANCE_VECTOR_DELETE_TABLE_FAILED_INVALID_ARGS",
2031
- domain: ErrorDomain.STORAGE,
2032
- category: ErrorCategory.USER,
2033
- details: { tableName },
2034
- text: "LanceDB client not initialized. Use LanceVectorStore.create() to create an instance"
2035
- });
1437
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
2036
1438
  }
2037
1439
  try {
2038
1440
  await this.lanceClient.dropTable(tableName);
2039
1441
  } catch (error) {
2040
- throw new MastraError(
2041
- {
2042
- id: "STORAGE_LANCE_VECTOR_DELETE_TABLE_FAILED",
2043
- domain: ErrorDomain.STORAGE,
2044
- category: ErrorCategory.THIRD_PARTY,
2045
- details: { tableName }
2046
- },
2047
- error
2048
- );
1442
+ throw new Error(`Failed to delete tables: ${error.message}`);
2049
1443
  }
2050
1444
  }
2051
1445
  async updateVector({ indexName, id, update }) {
2052
- try {
2053
- if (!this.lanceClient) {
2054
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
2055
- }
2056
- if (!indexName) {
2057
- throw new Error("indexName is required");
2058
- }
2059
- if (!id) {
2060
- throw new Error("id is required");
2061
- }
2062
- } catch (err) {
2063
- throw new MastraError(
2064
- {
2065
- id: "STORAGE_LANCE_VECTOR_UPDATE_VECTOR_FAILED_INVALID_ARGS",
2066
- domain: ErrorDomain.STORAGE,
2067
- category: ErrorCategory.USER,
2068
- details: { indexName, id }
2069
- },
2070
- err
2071
- );
1446
+ if (!this.lanceClient) {
1447
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1448
+ }
1449
+ if (!indexName) {
1450
+ throw new Error("indexName is required");
1451
+ }
1452
+ if (!id) {
1453
+ throw new Error("id is required");
2072
1454
  }
2073
1455
  try {
2074
1456
  const tables = await this.lanceClient.tableNames();
@@ -2122,38 +1504,18 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
2122
1504
  }
2123
1505
  throw new Error(`No table found with column/index '${indexName}'`);
2124
1506
  } catch (error) {
2125
- throw new MastraError(
2126
- {
2127
- id: "STORAGE_LANCE_VECTOR_UPDATE_VECTOR_FAILED",
2128
- domain: ErrorDomain.STORAGE,
2129
- category: ErrorCategory.THIRD_PARTY,
2130
- details: { indexName, id, hasVector: !!update.vector, hasMetadata: !!update.metadata }
2131
- },
2132
- error
2133
- );
1507
+ throw new Error(`Failed to update index: ${error.message}`);
2134
1508
  }
2135
1509
  }
2136
1510
  async deleteVector({ indexName, id }) {
2137
- try {
2138
- if (!this.lanceClient) {
2139
- throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
2140
- }
2141
- if (!indexName) {
2142
- throw new Error("indexName is required");
2143
- }
2144
- if (!id) {
2145
- throw new Error("id is required");
2146
- }
2147
- } catch (err) {
2148
- throw new MastraError(
2149
- {
2150
- id: "STORAGE_LANCE_VECTOR_DELETE_VECTOR_FAILED_INVALID_ARGS",
2151
- domain: ErrorDomain.STORAGE,
2152
- category: ErrorCategory.USER,
2153
- details: { indexName, id }
2154
- },
2155
- err
2156
- );
1511
+ if (!this.lanceClient) {
1512
+ throw new Error("LanceDB client not initialized. Use LanceVectorStore.create() to create an instance");
1513
+ }
1514
+ if (!indexName) {
1515
+ throw new Error("indexName is required");
1516
+ }
1517
+ if (!id) {
1518
+ throw new Error("id is required");
2157
1519
  }
2158
1520
  try {
2159
1521
  const tables = await this.lanceClient.tableNames();
@@ -2175,15 +1537,7 @@ var LanceVectorStore = class _LanceVectorStore extends MastraVector {
2175
1537
  }
2176
1538
  throw new Error(`No table found with column/index '${indexName}'`);
2177
1539
  } catch (error) {
2178
- throw new MastraError(
2179
- {
2180
- id: "STORAGE_LANCE_VECTOR_DELETE_VECTOR_FAILED",
2181
- domain: ErrorDomain.STORAGE,
2182
- category: ErrorCategory.THIRD_PARTY,
2183
- details: { indexName, id }
2184
- },
2185
- error
2186
- );
1540
+ throw new Error(`Failed to delete index: ${error.message}`);
2187
1541
  }
2188
1542
  }
2189
1543
  /**