@mastra/libsql 1.14.3 → 1.15.0-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.
- package/CHANGELOG.md +26 -0
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agent-builder-deploying.md +2 -0
- package/dist/docs/references/docs-agent-builder-overview.md +2 -0
- package/dist/docs/references/docs-agents-agent-approval.md +2 -0
- package/dist/docs/references/docs-agents-networks.md +2 -0
- package/dist/docs/references/docs-memory-memory-processors.md +4 -0
- package/dist/docs/references/docs-memory-message-history.md +2 -0
- package/dist/docs/references/docs-memory-multi-user-threads.md +2 -0
- package/dist/docs/references/docs-memory-overview.md +5 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +8 -0
- package/dist/docs/references/docs-memory-storage.md +6 -0
- package/dist/docs/references/docs-memory-working-memory.md +2 -0
- package/dist/docs/references/docs-rag-retrieval.md +2 -0
- package/dist/docs/references/docs-workflows-snapshots.md +2 -0
- package/dist/docs/references/guides-agent-frameworks-ai-sdk.md +2 -0
- package/dist/docs/references/reference-core-getMemory.md +2 -0
- package/dist/docs/references/reference-core-listMemory.md +2 -0
- package/dist/docs/references/reference-core-mastra-class.md +2 -0
- package/dist/docs/references/reference-memory-memory-class.md +3 -0
- package/dist/docs/references/reference-storage-composite.md +2 -0
- package/dist/docs/references/reference-storage-dynamodb.md +2 -0
- package/dist/docs/references/reference-storage-libsql.md +2 -0
- package/dist/docs/references/reference-storage-retention.md +180 -0
- package/dist/docs/references/reference-vectors-libsql.md +2 -0
- package/dist/index.cjs +430 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +431 -11
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +51 -0
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +9 -0
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts +20 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/dist/storage/domains/harness/index.d.ts +5 -1
- package/dist/storage/domains/harness/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +15 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/notifications/index.d.ts +5 -1
- package/dist/storage/domains/notifications/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +8 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/schedules/index.d.ts +9 -1
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +7 -1
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/thread-state/index.d.ts +9 -0
- package/dist/storage/domains/thread-state/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +8 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +8 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/retention.d.ts +77 -0
- package/dist/storage/retention.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -329,5 +329,56 @@ export declare class LibSQLDB extends MastraBase {
|
|
|
329
329
|
deleteData({ tableName }: {
|
|
330
330
|
tableName: TABLE_NAMES;
|
|
331
331
|
}): Promise<void>;
|
|
332
|
+
/**
|
|
333
|
+
* Delete up to `limit` of the oldest rows whose `column` timestamp is strictly
|
|
334
|
+
* before `cutoffMs`, in a single bounded statement. Returns the number of rows
|
|
335
|
+
* removed so the caller can decide whether more batches remain.
|
|
336
|
+
*
|
|
337
|
+
* Deletes by `rowid` so the range scan is bounded by LIMIT and the write set
|
|
338
|
+
* stays small — short locks, bounded WAL growth. Requires an index on
|
|
339
|
+
* `column` to be fast at scale (see ensureIndex).
|
|
340
|
+
*/
|
|
341
|
+
pruneBatch({ tableName, column, cutoff, limit, }: {
|
|
342
|
+
tableName: TABLE_NAMES;
|
|
343
|
+
column: string;
|
|
344
|
+
/**
|
|
345
|
+
* Exclusive upper bound for the anchor column. Must match the column's
|
|
346
|
+
* stored type — the memory/observability timestamp anchors are stored as
|
|
347
|
+
* ISO-8601 strings, which sort lexicographically in chronological order, so
|
|
348
|
+
* the caller passes an ISO string cutoff.
|
|
349
|
+
*/
|
|
350
|
+
cutoff: string | number;
|
|
351
|
+
limit: number;
|
|
352
|
+
}): Promise<number>;
|
|
353
|
+
/**
|
|
354
|
+
* Delete up to `limit` aged parent rows *and* their child rows together, in a
|
|
355
|
+
* single transaction. Used for whole-unit (parent-driven) pruning where
|
|
356
|
+
* children must die with their parent (e.g. an aged experiment and its
|
|
357
|
+
* experiment_results) — deleting per unit means a bound or abort between
|
|
358
|
+
* batches never leaves a parent hollow (kept, but with its children gone) or
|
|
359
|
+
* children orphaned.
|
|
360
|
+
*
|
|
361
|
+
* Both deletes target the same parent set via an identical deterministic
|
|
362
|
+
* subquery (`ORDER BY rowid LIMIT ?`); the batch runs as one write
|
|
363
|
+
* transaction, so the set cannot change between the two statements.
|
|
364
|
+
*/
|
|
365
|
+
pruneUnitsBatch({ parentTable, parentKey, parentColumn, childTable, childForeignKey, cutoff, limit, }: {
|
|
366
|
+
parentTable: TABLE_NAMES;
|
|
367
|
+
parentKey: string;
|
|
368
|
+
parentColumn: string;
|
|
369
|
+
childTable: TABLE_NAMES;
|
|
370
|
+
childForeignKey: string;
|
|
371
|
+
cutoff: string | number;
|
|
372
|
+
limit: number;
|
|
373
|
+
}): Promise<{
|
|
374
|
+
parents: number;
|
|
375
|
+
children: number;
|
|
376
|
+
}>;
|
|
377
|
+
/** Create an index if it does not already exist. */
|
|
378
|
+
ensureIndex({ indexName, tableName, column, }: {
|
|
379
|
+
indexName: string;
|
|
380
|
+
tableName: TABLE_NAMES;
|
|
381
|
+
column: string;
|
|
382
|
+
}): Promise<void>;
|
|
332
383
|
}
|
|
333
384
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAWvE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,CAAC,sBAAsB,GAAG;IACxB,2FAA2F;IAC3F,GAAG,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,GACF,CAAC,sBAAsB,GAAG;IACxB,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEP;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAahE;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAWvE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,U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EAAE;QACD,SAAS,EAAE,WAAW,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf;;;;;WAKG;QACH,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,MAAM,CAAC;IAYnB;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,EACpB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACV,eAAe,EACf,MAAM,EACN,KAAK,GACN,EAAE;QACD,WAAW,EAAE,WAAW,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,WAAW,CAAC;QACxB,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAmClD,oDAAoD;IAC9C,WAAW,CAAC,EAChB,SAAS,EACT,SAAS,EACT,MAAM,GACP,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,WAAW,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,IAAI,CAAC;CAMlB"}
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import type { BackgroundTask, TaskFilter, TaskListResult, UpdateBackgroundTask } from '@mastra/core/background-tasks';
|
|
2
2
|
import { BackgroundTasksStorage } from '@mastra/core/storage';
|
|
3
|
+
import type { PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
3
4
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
5
|
export declare class BackgroundTasksLibSQL extends BackgroundTasksStorage {
|
|
5
6
|
#private;
|
|
7
|
+
/**
|
|
8
|
+
* Completed/failed task records accumulate. Anchored on `completedAt`, which
|
|
9
|
+
* is NULL while a task is in-flight (pending/running/suspended) — so `completedAt
|
|
10
|
+
* < cutoff` never prunes a live task, no explicit status filter needed.
|
|
11
|
+
*/
|
|
12
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
6
13
|
constructor(config: LibSQLDomainConfig);
|
|
7
14
|
init(): Promise<void>;
|
|
8
15
|
dangerouslyClearAll(): Promise<void>;
|
|
16
|
+
/** Delete completed tasks older than the `backgroundTasks` policy's `maxAge`, batched. */
|
|
17
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
9
18
|
createTask(task: BackgroundTask): Promise<void>;
|
|
10
19
|
updateTask(taskId: string, update: UpdateBackgroundTask): Promise<void>;
|
|
11
20
|
getTask(taskId: string): Promise<BackgroundTask | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/background-tasks/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAEd,UAAU,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAyC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/background-tasks/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAEd,UAAU,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAyC,MAAM,sBAAsB,CAAC;AACrG,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEvH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA6CnD,qBAAa,qBAAsB,SAAQ,sBAAsB;;IAC/D;;;;OAIG;IACH,gBAAyB,eAAe,EAAE,yBAAyB,CAEjE;gBAKU,MAAM,EAAE,kBAAkB;IAOhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAarB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,0FAA0F;IACpF,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IASrG,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA4B/C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IA8CvE,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IASvD,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAqFtD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IA2C9C,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAQlC,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAO/D"}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import { ExperimentsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { Experiment, ExperimentResult, ExperimentReviewCounts, CreateExperimentInput, UpdateExperimentInput, AddExperimentResultInput, UpdateExperimentResultInput, ListExperimentsInput, ListExperimentsOutput, ListExperimentResultsInput, ListExperimentResultsOutput } from '@mastra/core/storage';
|
|
2
|
+
import type { Experiment, ExperimentResult, ExperimentReviewCounts, CreateExperimentInput, UpdateExperimentInput, AddExperimentResultInput, UpdateExperimentResultInput, ListExperimentsInput, ListExperimentsOutput, ListExperimentResultsInput, ListExperimentResultsOutput, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
3
3
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
4
|
export declare class ExperimentsLibSQL extends ExperimentsStorage {
|
|
5
5
|
#private;
|
|
6
|
+
/**
|
|
7
|
+
* An experiment is pruned as a whole unit: when `experiments.completedAt` is
|
|
8
|
+
* older than the policy, the run and all its `experiment_results` rows are
|
|
9
|
+
* deleted together (results cascade with their parent, matching
|
|
10
|
+
* `deleteExperiment`). Results are not an independent retention key. NULL
|
|
11
|
+
* `completedAt` (still running) is never pruned.
|
|
12
|
+
*/
|
|
13
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
6
14
|
constructor(config: LibSQLDomainConfig);
|
|
7
15
|
init(): Promise<void>;
|
|
8
16
|
dangerouslyClearAll(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Prune whole experiments older than the `experiments` policy's `maxAge`.
|
|
19
|
+
*
|
|
20
|
+
* Each batch selects up to `batchSize` aged experiments and deletes their
|
|
21
|
+
* `experiment_results` rows and the experiment rows in one transaction —
|
|
22
|
+
* mirroring `deleteExperiment` — so hitting `maxBatches`/`maxRows` or the
|
|
23
|
+
* abort signal between batches never leaves a run hollow (parent kept,
|
|
24
|
+
* results gone). NULL `completedAt` (still running) is excluded by the
|
|
25
|
+
* `< cutoff` predicate. Bounds count whole experiments, not rows.
|
|
26
|
+
*/
|
|
27
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
9
28
|
private transformExperimentRow;
|
|
10
29
|
private transformExperimentResultRow;
|
|
11
30
|
createExperiment(input: CreateExperimentInput): Promise<Experiment>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/experiments/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,kBAAkB,EAKnB,MA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E,iBAAiB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAmBnE,eAAe,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAuF3E,gBAAgB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBrD,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA8D/E,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAsErF,uBAAuB,CAAC,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAmB/E,qBAAqB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2E7F,uBAAuB,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBtE,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAgC5D"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { HarnessStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { SessionRecord } from '@mastra/core/storage';
|
|
2
|
+
import type { SessionRecord, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
3
3
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
4
|
export declare class HarnessLibSQL extends HarnessStorage {
|
|
5
5
|
#private;
|
|
6
|
+
/** Session records accumulate over time. Single table, anchored on `createdAt`. */
|
|
7
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
6
8
|
constructor(config: LibSQLDomainConfig);
|
|
7
9
|
init(): Promise<void>;
|
|
8
10
|
dangerouslyClearAll(): Promise<void>;
|
|
11
|
+
/** Delete harness sessions older than the `sessions` policy's `maxAge`, batched. */
|
|
12
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
9
13
|
loadSession(sessionId: string): Promise<SessionRecord | null>;
|
|
10
14
|
saveSession(record: SessionRecord): Promise<void>;
|
|
11
15
|
listSessions(): Promise<SessionRecord[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/harness/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAyC,MAAM,sBAAsB,CAAC;AAC7F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/harness/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAyC,MAAM,sBAAsB,CAAC;AAC7F,OAAO,KAAK,EAGV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAgHnD,qBAAa,aAAc,SAAQ,cAAc;;IAC/C,mFAAmF;IACnF,gBAAyB,eAAe,EAAE,yBAAyB,CAEjE;gBAIU,MAAM,EAAE,kBAAkB;IAMhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAOrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,oFAAoF;IAC9E,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IASrG,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAQ7D,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjD,YAAY,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;CAO/C"}
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
2
2
|
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
3
|
-
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesByResourceIdInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, ObservationalMemoryRecord, ObservationalMemoryHistoryOptions, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, SwapBufferedToActiveInput, SwapBufferedToActiveResult, UpdateBufferedReflectionInput, SwapBufferedReflectionToActiveInput, CreateReflectionGenerationInput, UpdateObservationalMemoryConfigInput } from '@mastra/core/storage';
|
|
3
|
+
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesByResourceIdInput, StorageListMessagesOutput, StorageListThreadsInput, StorageListThreadsOutput, StorageCloneThreadInput, StorageCloneThreadOutput, ObservationalMemoryRecord, ObservationalMemoryHistoryOptions, CreateObservationalMemoryInput, UpdateActiveObservationsInput, UpdateBufferedObservationsInput, SwapBufferedToActiveInput, SwapBufferedToActiveResult, UpdateBufferedReflectionInput, SwapBufferedReflectionToActiveInput, CreateReflectionGenerationInput, UpdateObservationalMemoryConfigInput, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
4
4
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
5
5
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
6
6
|
export declare class MemoryLibSQL extends MemoryStorage {
|
|
7
7
|
#private;
|
|
8
8
|
readonly supportsObservationalMemory = true;
|
|
9
|
+
/**
|
|
10
|
+
* Retention-eligible tables. `threads`, `messages`, and `resources` all anchor
|
|
11
|
+
* on `createdAt` and are indexed for fast batched deletes. Cascade order is
|
|
12
|
+
* enforced in `prune()` (children before threads), not here.
|
|
13
|
+
*/
|
|
14
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
9
15
|
constructor(config: LibSQLDomainConfig);
|
|
10
16
|
init(): Promise<void>;
|
|
11
17
|
dangerouslyClearAll(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Delete rows older than each policy's `maxAge`, batched and cancellable.
|
|
20
|
+
*
|
|
21
|
+
* Deletes children before parents (messages/resources before threads) so a
|
|
22
|
+
* `threads` policy doesn't strand rows behind a deleted parent — there are no
|
|
23
|
+
* FKs in the LibSQL schema, so cascade ordering is explicit here.
|
|
24
|
+
*/
|
|
25
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
12
26
|
private parseRow;
|
|
13
27
|
private _sortMessages;
|
|
14
28
|
private _getIncludedMessages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,oCAAoC,EACpC,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EAExB,yBAAyB,EACzB,iCAAiC,EAEjC,8BAA8B,EAC9B,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,mCAAmC,EACnC,+BAA+B,EAC/B,oCAAoC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,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
import type { CreateNotificationInput, ListDueNotificationsInput, ListNotificationsInput, NotificationRecord, UpdateNotificationInput } from '@mastra/core/storage';
|
|
2
|
+
import type { CreateNotificationInput, ListDueNotificationsInput, ListNotificationsInput, NotificationRecord, UpdateNotificationInput, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
3
3
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
4
|
export declare class NotificationsLibSQL extends NotificationsStorage {
|
|
5
5
|
#private;
|
|
6
|
+
/** The notification feed grows unbounded. Single table, anchored on `createdAt`. */
|
|
7
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
6
8
|
constructor(config: LibSQLDomainConfig);
|
|
7
9
|
init(): Promise<void>;
|
|
8
10
|
dangerouslyClearAll(): Promise<void>;
|
|
11
|
+
/** Delete notifications older than the `notifications` policy's `maxAge`, batched. */
|
|
12
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
9
13
|
createNotification(input: CreateNotificationInput): Promise<NotificationRecord>;
|
|
10
14
|
listNotifications(input: ListNotificationsInput): Promise<NotificationRecord[]>;
|
|
11
15
|
listDueNotifications(input: ListDueNotificationsInput): Promise<NotificationRecord[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/notifications/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAsC,MAAM,sBAAsB,CAAC;AAChG,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EAEtB,kBAAkB,EAGlB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/notifications/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAsC,MAAM,sBAAsB,CAAC;AAChG,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EAEtB,kBAAkB,EAGlB,uBAAuB,EACvB,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA2EnD,qBAAa,mBAAoB,SAAQ,oBAAoB;;IAC3D,oFAAoF;IACpF,gBAAyB,eAAe,EAAE,yBAAyB,CAEjE;gBAKU,MAAM,EAAE,kBAAkB;IAOhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,sFAAsF;IAChF,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IASrG,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+E/E,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAoC/E,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA4BrF,eAAe,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAS5F,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAiCvE,eAAe;CA6B9B"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { ObservabilityStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { ListTracesArgs, ListTracesResponse, TracingStorageStrategy, UpdateSpanArgs, BatchDeleteTracesArgs, BatchUpdateSpansArgs, BatchCreateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse, GetTraceLightResponse } from '@mastra/core/storage';
|
|
2
|
+
import type { ListTracesArgs, ListTracesResponse, TracingStorageStrategy, UpdateSpanArgs, BatchDeleteTracesArgs, BatchUpdateSpansArgs, BatchCreateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse, GetTraceLightResponse, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
3
3
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
4
|
export declare class ObservabilityLibSQL extends ObservabilityStorage {
|
|
5
5
|
#private;
|
|
6
|
+
/**
|
|
7
|
+
* Spans are the only physical table; traces are derived from them. Spans
|
|
8
|
+
* anchor on `startedAt` (not `createdAt`), stored as an ISO-8601 string.
|
|
9
|
+
*/
|
|
10
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
6
11
|
constructor(config: LibSQLDomainConfig);
|
|
7
12
|
init(): Promise<void>;
|
|
8
13
|
dangerouslyClearAll(): Promise<void>;
|
|
14
|
+
/** Delete spans older than the `spans` policy's `maxAge`, batched. */
|
|
15
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
9
16
|
/**
|
|
10
17
|
* Manually run the spans migration to deduplicate and add the unique constraint.
|
|
11
18
|
* This is intended to be called from the CLI when duplicates are detected.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EAKrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EAKrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EAErB,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,qBAAa,mBAAoB,SAAQ,oBAAoB;;IAC3D;;;OAGG;IACH,gBAAyB,eAAe,EAAE,yBAAyB,CAEjE;gBAIU,MAAM,EAAE,kBAAkB;IAMhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,sEAAsE;IAChE,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAS3G;;;;;OAKG;IACG,YAAY,IAAI,OAAO,CAAC;QAC5B,OAAO,EAAE,OAAO,CAAC;QACjB,eAAe,EAAE,OAAO,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAIF;;;OAGG;IACG,yBAAyB,IAAI,OAAO,CAAC;QACzC,cAAc,EAAE,OAAO,CAAC;QACxB,aAAa,EAAE,OAAO,CAAC;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAIF,IAAoB,eAAe,IAAI;QACrC,SAAS,EAAE,sBAAsB,CAAC;QAClC,SAAS,EAAE,sBAAsB,EAAE,CAAC;KACrC,CAKA;IAEK,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC/C,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IA6B3D,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA6BvE,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAgC9D,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAoCxE,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC/C,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAuP7D,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC3D,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC3D,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBpE"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type { Schedule, ScheduleFilter, ScheduleTrigger, ScheduleTriggerListOptions, ScheduleUpdate } from '@mastra/core/storage';
|
|
1
|
+
import type { Schedule, ScheduleFilter, ScheduleTrigger, ScheduleTriggerListOptions, ScheduleUpdate, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
2
2
|
import { SchedulesStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
4
|
export declare class SchedulesLibSQL extends SchedulesStorage {
|
|
5
5
|
#private;
|
|
6
|
+
/**
|
|
7
|
+
* The fire/run history (`schedule_triggers`, one row per fire) is the growth
|
|
8
|
+
* table; schedule definitions are config and excluded. Anchored on
|
|
9
|
+
* `actual_fire_at`, a bigint epoch-ms column (numeric comparison, not ISO).
|
|
10
|
+
*/
|
|
11
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
6
12
|
constructor(config: LibSQLDomainConfig);
|
|
7
13
|
init(): Promise<void>;
|
|
8
14
|
dangerouslyClearAll(): Promise<void>;
|
|
15
|
+
/** Delete schedule fire history older than the `triggers` policy's `maxAge`, batched. */
|
|
16
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
9
17
|
createSchedule(schedule: Schedule): Promise<Schedule>;
|
|
10
18
|
getSchedule(id: string): Promise<Schedule | null>;
|
|
11
19
|
listSchedules(filter?: ScheduleFilter): Promise<Schedule[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/schedules/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,0BAA0B,EAG1B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/schedules/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,0BAA0B,EAG1B,cAAc,EACd,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAA2D,MAAM,sBAAsB,CAAC;AAEjH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAA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
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
2
2
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
3
|
-
import type { StoragePagination } from '@mastra/core/storage';
|
|
3
|
+
import type { StoragePagination, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
4
4
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
5
5
|
export declare class ScoresLibSQL extends ScoresStorage {
|
|
6
6
|
#private;
|
|
7
|
+
/**
|
|
8
|
+
* Scorer results accumulate as evals run. Single table, anchored on `createdAt`.
|
|
9
|
+
*/
|
|
10
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
7
11
|
constructor(config: LibSQLDomainConfig);
|
|
8
12
|
init(): Promise<void>;
|
|
9
13
|
dangerouslyClearAll(): Promise<void>;
|
|
14
|
+
/** Delete scorer results older than the `scorers` policy's `maxAge`, batched. */
|
|
15
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
10
16
|
listScoresByRunId({ runId, pagination, }: {
|
|
11
17
|
runId: string;
|
|
12
18
|
pagination: StoragePagination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAIL,aAAa,EAId,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB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E,gBAAgB,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;IAiDpE,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;IAwDzB,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;CA2ChC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ThreadStateStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
2
3
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
3
4
|
/**
|
|
4
5
|
* LibSQL implementation of {@link ThreadStateStorage}.
|
|
@@ -9,8 +10,16 @@ import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class ThreadStateLibSQL extends ThreadStateStorage {
|
|
11
12
|
#private;
|
|
13
|
+
/**
|
|
14
|
+
* `thread_state` grows as a side effect of thread activity (one row per
|
|
15
|
+
* thread per state type). It anchors on `updatedAt` (last activity), so state
|
|
16
|
+
* for a thread that is still being appended to is not pruned by creation age.
|
|
17
|
+
*/
|
|
18
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
12
19
|
constructor(config: LibSQLDomainConfig);
|
|
13
20
|
init(): Promise<void>;
|
|
21
|
+
/** Delete thread state older than the `threadState` policy's `maxAge`, batched. */
|
|
22
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
14
23
|
dangerouslyClearAll(): Promise<void>;
|
|
15
24
|
getState<T = unknown>({ threadId, type }: {
|
|
16
25
|
threadId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/thread-state/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAInB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/thread-state/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAInB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGvH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,kBAAkB;;IACvD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,yBAAyB,CAExD;gBAKU,MAAM,EAAE,kBAAkB;IAOhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B,mFAAmF;IAC7E,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IASrG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAepC,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAsBrG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB7G,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBzF"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import type { WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
1
|
+
import type { WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions, PruneOptions, PruneResult, RetentionTablesDescriptor, TableRetentionPolicy } from '@mastra/core/storage';
|
|
2
2
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
3
3
|
import type { WorkflowRunState, StepResult } from '@mastra/core/workflows';
|
|
4
4
|
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
5
5
|
export declare class WorkflowsLibSQL extends WorkflowsStorage {
|
|
6
6
|
#private;
|
|
7
|
+
/**
|
|
8
|
+
* Workflow run snapshots accumulate as runs execute. Anchored on `updatedAt`
|
|
9
|
+
* (last activity) so suspended/long-running runs are not pruned by start age.
|
|
10
|
+
*/
|
|
11
|
+
static readonly retentionTables: RetentionTablesDescriptor;
|
|
7
12
|
private readonly executeWithRetry;
|
|
8
13
|
constructor(config: LibSQLDomainConfig);
|
|
9
14
|
supportsConcurrentUpdates(): boolean;
|
|
10
15
|
private parseWorkflowRun;
|
|
11
16
|
init(): Promise<void>;
|
|
12
17
|
dangerouslyClearAll(): Promise<void>;
|
|
18
|
+
/** Delete workflow snapshots older than the `workflowSnapshot` policy's `maxAge`, batched. */
|
|
19
|
+
prune(policies: Record<string, TableRetentionPolicy>, options?: PruneOptions): Promise<PruneResult[]>;
|
|
13
20
|
private setupPragmaSettings;
|
|
14
21
|
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
15
22
|
workflowName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC1B,YAAY,EACZ,WAAW,EACX,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAML,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAKnD,qBAAa,eAAgB,SAAQ,gBAAgB;;IACnD;;;OAGG;IACH,gBAAyB,eAAe,EAAE,yBAAyB,CAEjE;IAIF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAiF;gBAEtG,MAAM,EAAE,kBAAkB;IAqBtC,yBAAyB,IAAI,OAAO;IAIpC,OAAO,CAAC,gBAAgB;IAmBlB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,8FAA8F;IACxF,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;YAS7F,mBAAmB;IA0B3B,qBAAqB,CAAC,EAC1B,YAAY,EACZ,KAAK,EAC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AAI,CAAC;IAuCzB,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAqBtG,gBAAgB,CAAC,EACrB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,OAAO,EACP,UAAU,EACV,MAAM,GACP,GAAE,4BAAiC,GAAG,OAAO,CAAC,YAAY,CAAC;CAuE7D"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Client } from '@libsql/client';
|
|
2
|
-
import type { StorageDomains } from '@mastra/core/storage';
|
|
2
|
+
import type { RetentionConfig, StorageDomains } from '@mastra/core/storage';
|
|
3
3
|
import { MastraCompositeStore } from '@mastra/core/storage';
|
|
4
4
|
import { AgentsLibSQL } from './domains/agents/index.js';
|
|
5
5
|
import { BackgroundTasksLibSQL } from './domains/background-tasks/index.js';
|
|
@@ -93,6 +93,13 @@ export type LibSQLBaseConfig = {
|
|
|
93
93
|
* // No auto-init, tables must already exist
|
|
94
94
|
*/
|
|
95
95
|
disableInit?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Opt-in, table-granular, age-based retention policies. Declare per-table
|
|
98
|
+
* `maxAge` per domain (e.g. `{ memory: { messages: { maxAge: '30d' } } }`);
|
|
99
|
+
* unset tables are kept forever. Wire `storage.prune()` to your own cron to
|
|
100
|
+
* apply them. See {@link RetentionConfig}.
|
|
101
|
+
*/
|
|
102
|
+
retention?: RetentionConfig;
|
|
96
103
|
};
|
|
97
104
|
export type LibSQLConfig = (LibSQLBaseConfig & {
|
|
98
105
|
url: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AA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,GACpB,CAAC,gBAAgB,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,GACF,CAAC,gBAAgB,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAAC;AAEP;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,WAAY,SAAQ,oBAAoB;IACnD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;IAC7C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqC;IAElE,MAAM,EAAE,cAAc,CAAC;gBAEX,MAAM,EAAE,YAAY;YA2FlB,iBAAiB;IAsB/B,OAAO,CAAC,eAAe;YAIT,uBAAuB;YAOvB,qBAAqB;IAKpB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAkCpC;;;;;;;;;;;;OAYG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAqB7B;AAED,OAAO,EAAE,WAAW,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { TABLE_NAMES, PruneOptions, PruneResult, TableRetentionPolicy } from '@mastra/core/storage';
|
|
2
|
+
import type { LibSQLDB } from './db/index.js';
|
|
3
|
+
/** One table to prune, resolved from a policy + the domain's descriptor. */
|
|
4
|
+
export interface PruneTarget {
|
|
5
|
+
/** Physical table name. */
|
|
6
|
+
table: TABLE_NAMES;
|
|
7
|
+
/** Timestamp anchor column for the age comparison. */
|
|
8
|
+
column: string;
|
|
9
|
+
/**
|
|
10
|
+
* How the anchor column stores time, which decides how the cutoff is bound:
|
|
11
|
+
* - `timestamp` (default): ISO-8601 string comparison.
|
|
12
|
+
* - `epoch-ms`: raw millisecond number comparison (e.g. `schedules.triggers`).
|
|
13
|
+
*/
|
|
14
|
+
anchorType: 'timestamp' | 'epoch-ms';
|
|
15
|
+
/** Whether the anchor column should get a supporting index before pruning. */
|
|
16
|
+
indexed: boolean;
|
|
17
|
+
/** Retention policy (maxAge + optional batchSize). */
|
|
18
|
+
policy: TableRetentionPolicy;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Runs the bounded, batched, cancellable delete loop for a set of tables in the
|
|
22
|
+
* given order (callers pass children before parents for cascade-safe pruning),
|
|
23
|
+
* and returns one {@link PruneResult} per table.
|
|
24
|
+
*
|
|
25
|
+
* The loop:
|
|
26
|
+
* - deletes in chunks of `batchSize` (default 1000), each its own statement;
|
|
27
|
+
* - stops a table's loop when a batch deletes fewer rows than requested (drained),
|
|
28
|
+
* or when `maxBatches`/`maxRows` is hit, or the `signal` aborts — the latter
|
|
29
|
+
* three leave `done: false` so the caller can resume;
|
|
30
|
+
* - pauses `pauseMs` between batches when set, to avoid starving live traffic.
|
|
31
|
+
*
|
|
32
|
+
* `prune()` only deletes rows; it never reclaims disk. Freed pages are reused
|
|
33
|
+
* by future writes so the file stops growing. Handing disk back to the OS is
|
|
34
|
+
* left to the underlying database and the operator to manage.
|
|
35
|
+
*/
|
|
36
|
+
/** Convert a policy's `maxAge` into a cutoff bound matching the anchor's storage type. */
|
|
37
|
+
export declare function cutoffFor(policy: TableRetentionPolicy, anchorType: 'timestamp' | 'epoch-ms', now?: number): string | number;
|
|
38
|
+
/**
|
|
39
|
+
* Run the bounded/cancellable batched-delete loop for a single logical target,
|
|
40
|
+
* delegating the actual delete of up to `limit` rows to `deleteBatch`. Returns
|
|
41
|
+
* `{ deleted, done }`; `done: false` means the loop stopped on a bound or the
|
|
42
|
+
* abort signal and eligible rows may remain.
|
|
43
|
+
*/
|
|
44
|
+
export declare function runBatchedDelete({ deleteBatch, batchSize, options, }: {
|
|
45
|
+
deleteBatch: (limit: number) => Promise<number>;
|
|
46
|
+
batchSize: number;
|
|
47
|
+
options?: PruneOptions;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
deleted: number;
|
|
50
|
+
done: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function runPrune({ db, domain, targets, options, logger, }: {
|
|
53
|
+
db: LibSQLDB;
|
|
54
|
+
domain: string;
|
|
55
|
+
targets: PruneTarget[];
|
|
56
|
+
options?: PruneOptions;
|
|
57
|
+
logger?: {
|
|
58
|
+
warn?: (msg: string, err?: unknown) => void;
|
|
59
|
+
};
|
|
60
|
+
}): Promise<PruneResult[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Resolve a domain's `{ tableKey: policy }` map plus its descriptor into an
|
|
63
|
+
* ordered list of {@link PruneTarget}s. `order` lists table keys children-first
|
|
64
|
+
* so cascade-dependent rows are removed before their parents. Table keys not in
|
|
65
|
+
* `policies` are skipped (unset = keep forever).
|
|
66
|
+
*/
|
|
67
|
+
export declare function resolveTargets({ policies, descriptor, order, }: {
|
|
68
|
+
policies: Record<string, TableRetentionPolicy>;
|
|
69
|
+
descriptor: Record<string, {
|
|
70
|
+
table: string;
|
|
71
|
+
column: string;
|
|
72
|
+
anchorType?: 'timestamp' | 'epoch-ms';
|
|
73
|
+
indexed?: boolean;
|
|
74
|
+
}>;
|
|
75
|
+
order: string[];
|
|
76
|
+
}): PruneTarget[];
|
|
77
|
+
//# sourceMappingURL=retention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/storage/retention.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAIrC,4EAA4E;AAC5E,MAAM,WAAW,WAAW;IAC1B,2BAA2B;IAC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AAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC/C,UAAU,EAAE,MAAM,CAChB,MAAM,EACN;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAC5F,CAAC;IACF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,GAAG,WAAW,EAAE,CAehB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/libsql",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0-alpha.0",
|
|
4
4
|
"description": "Libsql provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"typescript": "^6.0.3",
|
|
33
33
|
"vitest": "4.1.8",
|
|
34
34
|
"@internal/storage-test-utils": "0.0.106",
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@internal/
|
|
35
|
+
"@mastra/core": "1.49.0-alpha.3",
|
|
36
|
+
"@internal/types-builder": "0.0.85",
|
|
37
|
+
"@internal/lint": "0.0.110"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@mastra/core": ">=1.42.1-0 <2.0.0-0"
|