@mastra/libsql 0.11.0-alpha.3 → 0.11.1-alpha.0

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,23 +1,23 @@
1
1
 
2
- > @mastra/libsql@0.11.0-alpha.3 build /home/runner/work/mastra/mastra/stores/libsql
2
+ > @mastra/libsql@0.11.1-alpha.0 build /home/runner/work/mastra/mastra/stores/libsql
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.5.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 12207ms
9
+ TSC ⚡️ Build success in 11368ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/libsql/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/libsql/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 13745ms
16
+ DTS ⚡️ Build success in 13487ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- ESM dist/index.js 72.42 KB
21
- ESM ⚡️ Build success in 2002ms
22
- CJS dist/index.cjs 73.39 KB
23
- CJS ⚡️ Build success in 2005ms
20
+ ESM dist/index.js 87.14 KB
21
+ ESM ⚡️ Build success in 2070ms
22
+ CJS dist/index.cjs 88.20 KB
23
+ CJS ⚡️ Build success in 2070ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 0.11.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7ba91fa: Throw mastra errors methods not implemented yet
8
+ - da168a4: increase the peer deps range
9
+ - Updated dependencies [f248d53]
10
+ - Updated dependencies [2affc57]
11
+ - Updated dependencies [66e13e3]
12
+ - Updated dependencies [edd9482]
13
+ - Updated dependencies [18344d7]
14
+ - Updated dependencies [9d372c2]
15
+ - Updated dependencies [40c2525]
16
+ - Updated dependencies [e473f27]
17
+ - Updated dependencies [032cb66]
18
+ - Updated dependencies [703ac71]
19
+ - Updated dependencies [a723d69]
20
+ - Updated dependencies [5889a31]
21
+ - Updated dependencies [65e3395]
22
+ - Updated dependencies [4933192]
23
+ - Updated dependencies [d1c77a4]
24
+ - Updated dependencies [bea9dd1]
25
+ - Updated dependencies [dcd4802]
26
+ - Updated dependencies [7ba91fa]
27
+ - @mastra/core@0.11.0-alpha.2
28
+
29
+ ## 0.11.0
30
+
31
+ ### Minor Changes
32
+
33
+ - 8a3bfd2: Update peerdeps to latest core
34
+
35
+ ### Patch Changes
36
+
37
+ - 15e9d26: Added per-resource working memory for LibSQL, Upstash, and PG
38
+ - d8f2d19: Add updateMessages API to storage classes (only support for PG and LibSQL for now) and to memory class. Additionally allow for metadata to be saved in the content field of a message.
39
+ - 0fb9d64: [MASTRA-4018] Update saveMessages in storage adapters to upsert messages
40
+ - 2097952: [MASTRA-4021] Fix PG getMessages and update messageLimit for all storage adapters
41
+ - 144eb0b: [MASTRA-3669] Metadata Filter Types
42
+ - f0150c4: Fix LibSQLStore and PgStore getMessagesPaginated implementation
43
+ - 0e17048: Throw mastra errors in storage packages
44
+ - Updated dependencies [15e9d26]
45
+ - Updated dependencies [d1baedb]
46
+ - Updated dependencies [d8f2d19]
47
+ - Updated dependencies [4d21bf2]
48
+ - Updated dependencies [07d6d88]
49
+ - Updated dependencies [9d52b17]
50
+ - Updated dependencies [2097952]
51
+ - Updated dependencies [792c4c0]
52
+ - Updated dependencies [5d74aab]
53
+ - Updated dependencies [a8b194f]
54
+ - Updated dependencies [4fb0cc2]
55
+ - Updated dependencies [d2a7a31]
56
+ - Updated dependencies [502fe05]
57
+ - Updated dependencies [144eb0b]
58
+ - Updated dependencies [8ba1b51]
59
+ - Updated dependencies [4efcfa0]
60
+ - Updated dependencies [0e17048]
61
+ - @mastra/core@0.10.7
62
+
3
63
  ## 0.11.0-alpha.3
4
64
 
5
65
  ### Minor Changes
package/LICENSE.md CHANGED
@@ -1,7 +1,15 @@
1
- Copyright 2025 Mastra AI, Inc.
1
+ # Apache License 2.0
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
6
8
 
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -1,42 +1,81 @@
1
1
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
2
+ import type { Client } from '@libsql/client';
2
3
  import type { CreateIndexParams } from '@mastra/core/vector';
3
4
  import type { DeleteIndexParams } from '@mastra/core/vector';
4
5
  import type { DeleteVectorParams } from '@mastra/core/vector';
5
6
  import type { DescribeIndexParams } from '@mastra/core/vector';
6
7
  import type { EvalRow } from '@mastra/core/storage';
8
+ import type { IMastraLogger } from '@mastra/core/logger';
7
9
  import type { IndexStats } from '@mastra/core/vector';
8
10
  import type { InValue } from '@libsql/client';
11
+ import { LegacyEvalsStorage } from '@mastra/core/storage';
9
12
  import type { MastraMessageContentV2 } from '@mastra/core/agent';
10
13
  import type { MastraMessageV1 } from '@mastra/core/memory';
11
14
  import type { MastraMessageV2 } from '@mastra/core/agent';
15
+ import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
12
16
  import { MastraStorage } from '@mastra/core/storage';
13
17
  import { MastraVector } from '@mastra/core/vector';
18
+ import { MemoryStorage } from '@mastra/core/storage';
14
19
  import type { OperatorSupport } from '@mastra/core/vector/filter';
15
20
  import type { OperatorValueMap } from '@mastra/core/vector/filter';
16
21
  import type { PaginationArgs } from '@mastra/core/storage';
17
22
  import type { PaginationInfo } from '@mastra/core/storage';
18
23
  import type { QueryResult } from '@mastra/core/vector';
19
24
  import type { QueryVectorParams } from '@mastra/core/vector';
25
+ import type { ScoreRowData } from '@mastra/core/scores';
26
+ import { ScoresStorage } from '@mastra/core/storage';
20
27
  import type { StorageColumn } from '@mastra/core/storage';
28
+ import type { StorageDomains } from '@mastra/core/storage';
21
29
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
30
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
31
+ import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
32
+ import type { StoragePagination } from '@mastra/core/storage';
22
33
  import type { StorageResourceType } from '@mastra/core/storage';
23
34
  import type { StorageThreadType } from '@mastra/core/memory';
35
+ import { StoreOperations } from '@mastra/core/storage';
24
36
  import type { TABLE_NAMES } from '@mastra/core/storage';
25
37
  import type { Trace } from '@mastra/core/telemetry';
38
+ import { TracesStorage } from '@mastra/core/storage';
26
39
  import type { UpdateVectorParams } from '@mastra/core/vector';
27
40
  import type { UpsertVectorParams } from '@mastra/core/vector';
28
41
  import type { VectorFieldValue } from '@mastra/core/vector/filter';
29
42
  import type { VectorFilter } from '@mastra/core/vector/filter';
30
43
  import type { WorkflowRun } from '@mastra/core/storage';
44
+ import type { WorkflowRun as WorkflowRun_2 } from '@mastra/core';
31
45
  import type { WorkflowRuns } from '@mastra/core/storage';
46
+ import type { WorkflowRuns as WorkflowRuns_2 } from '@mastra/core';
47
+ import type { WorkflowRunState } from '@mastra/core/workflows';
48
+ import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
49
+ import { WorkflowsStorage } from '@mastra/core/storage';
32
50
 
33
51
  export declare function buildFilterQuery(filter: LibSQLVectorFilter): FilterResult;
34
52
 
53
+ export declare function createExecuteWriteOperationWithRetry({ logger, maxRetries, initialBackoffMs, }: {
54
+ logger: IMastraLogger;
55
+ maxRetries: number;
56
+ initialBackoffMs: number;
57
+ }): <T>(operationFn: () => Promise<T>, operationDescription: string) => Promise<T>;
58
+
35
59
  declare interface FilterResult {
36
60
  sql: string;
37
61
  values: InValue[];
38
62
  }
39
63
 
64
+ export declare class LegacyEvalsLibSQL extends LegacyEvalsStorage {
65
+ private client;
66
+ constructor({ client }: {
67
+ client: Client;
68
+ });
69
+ /** @deprecated use getEvals instead */
70
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
71
+ getEvals(options?: {
72
+ agentName?: string;
73
+ type?: 'test' | 'live';
74
+ } & PaginationArgs): Promise<PaginationInfo & {
75
+ evals: EvalRow[];
76
+ }>;
77
+ }
78
+
40
79
  /**
41
80
  * Vector store specific prompt that details supported operators and examples.
42
81
  * This prompt helps users construct valid filters for LibSQL Vector.
@@ -45,7 +84,7 @@ declare const LIBSQL_PROMPT = "When querying LibSQL Vector, you can ONLY use the
45
84
  export { LIBSQL_PROMPT }
46
85
  export { LIBSQL_PROMPT as LIBSQL_PROMPT_alias_1 }
47
86
 
48
- declare interface LibSQLConfig {
87
+ declare type LibSQLConfig = {
49
88
  url: string;
50
89
  authToken?: string;
51
90
  /**
@@ -59,7 +98,11 @@ declare interface LibSQLConfig {
59
98
  * @default 100
60
99
  */
61
100
  initialBackoffMs?: number;
62
- }
101
+ } | {
102
+ client: Client;
103
+ maxRetries?: number;
104
+ initialBackoffMs?: number;
105
+ };
63
106
  export { LibSQLConfig }
64
107
  export { LibSQLConfig as LibSQLConfig_alias_1 }
65
108
 
@@ -97,17 +140,18 @@ declare class LibSQLStore extends MastraStorage {
97
140
  private client;
98
141
  private readonly maxRetries;
99
142
  private readonly initialBackoffMs;
143
+ stores: StorageDomains;
100
144
  constructor(config: LibSQLConfig);
101
145
  get supports(): {
102
146
  selectByIncludeResourceScope: boolean;
103
147
  resourceWorkingMemory: boolean;
148
+ hasColumn: boolean;
149
+ createTable: boolean;
104
150
  };
105
- private getCreateTableSQL;
106
151
  createTable({ tableName, schema, }: {
107
152
  tableName: TABLE_NAMES;
108
153
  schema: Record<string, StorageColumn>;
109
154
  }): Promise<void>;
110
- protected getSqlType(type: StorageColumn['type']): string;
111
155
  /**
112
156
  * Alters table schema to add columns if they don't exist
113
157
  * @param tableName Name of the table
@@ -122,18 +166,17 @@ declare class LibSQLStore extends MastraStorage {
122
166
  clearTable({ tableName }: {
123
167
  tableName: TABLE_NAMES;
124
168
  }): Promise<void>;
125
- private prepareStatement;
126
- private executeWriteOperationWithRetry;
169
+ dropTable({ tableName }: {
170
+ tableName: TABLE_NAMES;
171
+ }): Promise<void>;
127
172
  insert(args: {
128
173
  tableName: TABLE_NAMES;
129
174
  record: Record<string, any>;
130
175
  }): Promise<void>;
131
- private doInsert;
132
176
  batchInsert(args: {
133
177
  tableName: TABLE_NAMES;
134
178
  records: Record<string, any>[];
135
179
  }): Promise<void>;
136
- private doBatchInsert;
137
180
  load<R>({ tableName, keys }: {
138
181
  tableName: TABLE_NAMES;
139
182
  keys: Record<string, string>;
@@ -149,7 +192,9 @@ declare class LibSQLStore extends MastraStorage {
149
192
  }): Promise<StorageThreadType[]>;
150
193
  getThreadsByResourceIdPaginated(args: {
151
194
  resourceId: string;
152
- } & PaginationArgs): Promise<PaginationInfo & {
195
+ page: number;
196
+ perPage: number;
197
+ }): Promise<PaginationInfo & {
153
198
  threads: StorageThreadType[];
154
199
  }>;
155
200
  saveThread({ thread }: {
@@ -163,8 +208,6 @@ declare class LibSQLStore extends MastraStorage {
163
208
  deleteThread({ threadId }: {
164
209
  threadId: string;
165
210
  }): Promise<void>;
166
- private parseRow;
167
- private _getIncludedMessages;
168
211
  /**
169
212
  * @deprecated use getMessagesPaginated instead for paginated results.
170
213
  */
@@ -196,7 +239,6 @@ declare class LibSQLStore extends MastraStorage {
196
239
  };
197
240
  })[];
198
241
  }): Promise<MastraMessageV2[]>;
199
- private transformEvalRow;
200
242
  /** @deprecated use getEvals instead */
201
243
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
202
244
  getEvals(options?: {
@@ -205,27 +247,61 @@ declare class LibSQLStore extends MastraStorage {
205
247
  } & PaginationArgs): Promise<PaginationInfo & {
206
248
  evals: EvalRow[];
207
249
  }>;
250
+ getScoreById({ id }: {
251
+ id: string;
252
+ }): Promise<ScoreRowData | null>;
253
+ saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
254
+ score: ScoreRowData;
255
+ }>;
256
+ getScoresByScorerId({ scorerId, entityId, entityType, pagination, }: {
257
+ scorerId: string;
258
+ entityId?: string;
259
+ entityType?: string;
260
+ pagination: StoragePagination;
261
+ }): Promise<{
262
+ pagination: PaginationInfo;
263
+ scores: ScoreRowData[];
264
+ }>;
265
+ getScoresByRunId({ runId, pagination, }: {
266
+ runId: string;
267
+ pagination: StoragePagination;
268
+ }): Promise<{
269
+ pagination: PaginationInfo;
270
+ scores: ScoreRowData[];
271
+ }>;
272
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
273
+ pagination: StoragePagination;
274
+ entityId: string;
275
+ entityType: string;
276
+ }): Promise<{
277
+ pagination: PaginationInfo;
278
+ scores: ScoreRowData[];
279
+ }>;
280
+ /**
281
+ * TRACES
282
+ */
208
283
  /**
209
284
  * @deprecated use getTracesPaginated instead.
210
285
  */
211
- getTraces(args: {
212
- name?: string;
213
- scope?: string;
214
- page: number;
215
- perPage: number;
216
- attributes?: Record<string, string>;
217
- filters?: Record<string, any>;
218
- fromDate?: Date;
219
- toDate?: Date;
220
- }): Promise<Trace[]>;
221
- getTracesPaginated(args: {
222
- name?: string;
223
- scope?: string;
224
- attributes?: Record<string, string>;
225
- filters?: Record<string, any>;
226
- } & PaginationArgs): Promise<PaginationInfo & {
286
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
287
+ getTracesPaginated(args: StorageGetTracesArg): Promise<PaginationInfo & {
227
288
  traces: Trace[];
228
289
  }>;
290
+ batchTraceInsert(args: {
291
+ records: Record<string, any>[];
292
+ }): Promise<void>;
293
+ /**
294
+ * WORKFLOWS
295
+ */
296
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
297
+ workflowName: string;
298
+ runId: string;
299
+ snapshot: WorkflowRunState;
300
+ }): Promise<void>;
301
+ loadWorkflowSnapshot({ workflowName, runId, }: {
302
+ workflowName: string;
303
+ runId: string;
304
+ }): Promise<WorkflowRunState | null>;
229
305
  getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
230
306
  workflowName?: string;
231
307
  fromDate?: Date;
@@ -249,8 +325,6 @@ declare class LibSQLStore extends MastraStorage {
249
325
  workingMemory?: string;
250
326
  metadata?: Record<string, unknown>;
251
327
  }): Promise<StorageResourceType>;
252
- private hasColumn;
253
- private parseWorkflowRun;
254
328
  }
255
329
  export { LibSQLStore as DefaultStorage }
256
330
  export { LibSQLStore as DefaultStorage_alias_1 }
@@ -329,4 +403,236 @@ export { LibSQLVectorConfig as LibSQLVectorConfig_alias_1 }
329
403
 
330
404
  export declare type LibSQLVectorFilter = VectorFilter<keyof LibSQLOperatorValueMap, LibSQLOperatorValueMap>;
331
405
 
406
+ export declare class MemoryLibSQL extends MemoryStorage {
407
+ private client;
408
+ private operations;
409
+ constructor({ client, operations }: {
410
+ client: Client;
411
+ operations: StoreOperationsLibSQL;
412
+ });
413
+ private parseRow;
414
+ private _getIncludedMessages;
415
+ /**
416
+ * @deprecated use getMessagesPaginated instead for paginated results.
417
+ */
418
+ getMessages(args: StorageGetMessagesArg & {
419
+ format?: 'v1';
420
+ }): Promise<MastraMessageV1[]>;
421
+ getMessages(args: StorageGetMessagesArg & {
422
+ format: 'v2';
423
+ }): Promise<MastraMessageV2_2[]>;
424
+ getMessagesPaginated(args: StorageGetMessagesArg & {
425
+ format?: 'v1' | 'v2';
426
+ }): Promise<PaginationInfo & {
427
+ messages: MastraMessageV1[] | MastraMessageV2_2[];
428
+ }>;
429
+ saveMessages(args: {
430
+ messages: MastraMessageV1[];
431
+ format?: undefined | 'v1';
432
+ }): Promise<MastraMessageV1[]>;
433
+ saveMessages(args: {
434
+ messages: MastraMessageV2_2[];
435
+ format: 'v2';
436
+ }): Promise<MastraMessageV2_2[]>;
437
+ updateMessages({ messages, }: {
438
+ messages: (Partial<Omit<MastraMessageV2_2, 'createdAt'>> & {
439
+ id: string;
440
+ content?: {
441
+ metadata?: MastraMessageContentV2['metadata'];
442
+ content?: MastraMessageContentV2['content'];
443
+ };
444
+ })[];
445
+ }): Promise<MastraMessageV2_2[]>;
446
+ getResourceById({ resourceId }: {
447
+ resourceId: string;
448
+ }): Promise<StorageResourceType | null>;
449
+ saveResource({ resource }: {
450
+ resource: StorageResourceType;
451
+ }): Promise<StorageResourceType>;
452
+ updateResource({ resourceId, workingMemory, metadata, }: {
453
+ resourceId: string;
454
+ workingMemory?: string;
455
+ metadata?: Record<string, unknown>;
456
+ }): Promise<StorageResourceType>;
457
+ getThreadById({ threadId }: {
458
+ threadId: string;
459
+ }): Promise<StorageThreadType | null>;
460
+ /**
461
+ * @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
462
+ */
463
+ getThreadsByResourceId(args: {
464
+ resourceId: string;
465
+ }): Promise<StorageThreadType[]>;
466
+ getThreadsByResourceIdPaginated(args: {
467
+ resourceId: string;
468
+ page: number;
469
+ perPage: number;
470
+ }): Promise<PaginationInfo & {
471
+ threads: StorageThreadType[];
472
+ }>;
473
+ saveThread({ thread }: {
474
+ thread: StorageThreadType;
475
+ }): Promise<StorageThreadType>;
476
+ updateThread({ id, title, metadata, }: {
477
+ id: string;
478
+ title: string;
479
+ metadata: Record<string, unknown>;
480
+ }): Promise<StorageThreadType>;
481
+ deleteThread({ threadId }: {
482
+ threadId: string;
483
+ }): Promise<void>;
484
+ }
485
+
486
+ export declare function prepareStatement({ tableName, record }: {
487
+ tableName: TABLE_NAMES;
488
+ record: Record<string, any>;
489
+ }): {
490
+ sql: string;
491
+ args: InValue[];
492
+ };
493
+
494
+ export declare class ScoresLibSQL extends ScoresStorage {
495
+ private operations;
496
+ private client;
497
+ constructor({ client, operations }: {
498
+ client: Client;
499
+ operations: StoreOperationsLibSQL;
500
+ });
501
+ getScoresByRunId({ runId, pagination, }: {
502
+ runId: string;
503
+ pagination: StoragePagination;
504
+ }): Promise<{
505
+ pagination: PaginationInfo;
506
+ scores: ScoreRowData[];
507
+ }>;
508
+ getScoresByScorerId({ scorerId, entityId, entityType, pagination, }: {
509
+ scorerId: string;
510
+ entityId?: string;
511
+ entityType?: string;
512
+ pagination: StoragePagination;
513
+ }): Promise<{
514
+ pagination: PaginationInfo;
515
+ scores: ScoreRowData[];
516
+ }>;
517
+ private transformScoreRow;
518
+ getScoreById({ id }: {
519
+ id: string;
520
+ }): Promise<ScoreRowData | null>;
521
+ saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
522
+ score: ScoreRowData;
523
+ }>;
524
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
525
+ pagination: StoragePagination;
526
+ entityId: string;
527
+ entityType: string;
528
+ }): Promise<{
529
+ pagination: PaginationInfo;
530
+ scores: ScoreRowData[];
531
+ }>;
532
+ }
533
+
534
+ export declare class StoreOperationsLibSQL extends StoreOperations {
535
+ private client;
536
+ /**
537
+ * Maximum number of retries for write operations if an SQLITE_BUSY error occurs.
538
+ * @default 5
539
+ */
540
+ maxRetries: number;
541
+ /**
542
+ * Initial backoff time in milliseconds for retrying write operations on SQLITE_BUSY.
543
+ * The backoff time will double with each retry (exponential backoff).
544
+ * @default 100
545
+ */
546
+ initialBackoffMs: number;
547
+ constructor({ client, maxRetries, initialBackoffMs, }: {
548
+ client: Client;
549
+ maxRetries?: number;
550
+ initialBackoffMs?: number;
551
+ });
552
+ hasColumn(table: string, column: string): Promise<boolean>;
553
+ private getCreateTableSQL;
554
+ createTable({ tableName, schema, }: {
555
+ tableName: TABLE_NAMES;
556
+ schema: Record<string, StorageColumn>;
557
+ }): Promise<void>;
558
+ protected getSqlType(type: StorageColumn['type']): string;
559
+ private doInsert;
560
+ insert(args: {
561
+ tableName: TABLE_NAMES;
562
+ record: Record<string, any>;
563
+ }): Promise<void>;
564
+ load<R>({ tableName, keys }: {
565
+ tableName: TABLE_NAMES;
566
+ keys: Record<string, string>;
567
+ }): Promise<R | null>;
568
+ private doBatchInsert;
569
+ batchInsert(args: {
570
+ tableName: TABLE_NAMES;
571
+ records: Record<string, any>[];
572
+ }): Promise<void>;
573
+ /**
574
+ * Alters table schema to add columns if they don't exist
575
+ * @param tableName Name of the table
576
+ * @param schema Schema of the table
577
+ * @param ifNotExists Array of column names to add if they don't exist
578
+ */
579
+ alterTable({ tableName, schema, ifNotExists, }: {
580
+ tableName: TABLE_NAMES;
581
+ schema: Record<string, StorageColumn>;
582
+ ifNotExists: string[];
583
+ }): Promise<void>;
584
+ clearTable({ tableName }: {
585
+ tableName: TABLE_NAMES;
586
+ }): Promise<void>;
587
+ dropTable({ tableName }: {
588
+ tableName: TABLE_NAMES;
589
+ }): Promise<void>;
590
+ }
591
+
592
+ export declare class TracesLibSQL extends TracesStorage {
593
+ private client;
594
+ private operations;
595
+ constructor({ client, operations }: {
596
+ client: Client;
597
+ operations: StoreOperationsLibSQL;
598
+ });
599
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
600
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
601
+ traces: Trace[];
602
+ }>;
603
+ batchTraceInsert({ records }: {
604
+ records: Record<string, any>[];
605
+ }): Promise<void>;
606
+ }
607
+
608
+ export declare class WorkflowsLibSQL extends WorkflowsStorage {
609
+ operations: StoreOperationsLibSQL;
610
+ client: Client;
611
+ constructor({ operations, client }: {
612
+ operations: StoreOperationsLibSQL;
613
+ client: Client;
614
+ });
615
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
616
+ workflowName: string;
617
+ runId: string;
618
+ snapshot: WorkflowRunState_2;
619
+ }): Promise<void>;
620
+ loadWorkflowSnapshot({ workflowName, runId, }: {
621
+ workflowName: string;
622
+ runId: string;
623
+ }): Promise<WorkflowRunState_2 | null>;
624
+ getWorkflowRunById({ runId, workflowName, }: {
625
+ runId: string;
626
+ workflowName?: string;
627
+ }): Promise<WorkflowRun_2 | null>;
628
+ getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
629
+ workflowName?: string;
630
+ fromDate?: Date;
631
+ toDate?: Date;
632
+ limit?: number;
633
+ offset?: number;
634
+ resourceId?: string;
635
+ }): Promise<WorkflowRuns_2>;
636
+ }
637
+
332
638
  export { }