@mastra/libsql 1.27.1-alpha.1 → 1.28.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/README.md +1 -1
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-human-in-the-loop.md +26 -1
- package/dist/docs/references/docs-memory-memory-processors.md +49 -3
- package/dist/docs/references/docs-memory-semantic-recall.md +24 -22
- package/dist/docs/references/integrations-databases-libsql.md +1 -1
- package/dist/docs/references/{reference-vectors-libsql.md → integrations-vectors-libsql.md} +16 -0
- package/dist/docs/references/reference-core-mastra-class.md +3 -1
- package/dist/docs/references/reference-memory-memory-class.md +85 -6
- package/dist/index.cjs +32 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +32 -7
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +1 -0
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/dist/vector/sql-builder.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -500,7 +500,7 @@ const createNumericOperator = (symbol) => {
|
|
|
500
500
|
sql: `CAST(json_extract(metadata, ${jsonPath}) AS NUMERIC) ${symbol} ?`,
|
|
501
501
|
needsValue: true
|
|
502
502
|
};
|
|
503
|
-
|
|
503
|
+
return {
|
|
504
504
|
sql: `CAST(json_extract(metadata, ${jsonPath}) AS TEXT) ${symbol} ?`,
|
|
505
505
|
needsValue: true
|
|
506
506
|
};
|
|
@@ -527,7 +527,8 @@ function buildElemMatchConditions(value) {
|
|
|
527
527
|
sql: sql.replace(pattern, `json_extract(elem.value, '$.${jsonPath}')`),
|
|
528
528
|
values
|
|
529
529
|
};
|
|
530
|
-
}
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
531
532
|
sql: `json_extract(elem.value, '$.${parseJsonPathKey(field)}') = ?`,
|
|
532
533
|
values: [fieldValue]
|
|
533
534
|
};
|
|
@@ -3424,10 +3425,13 @@ function rowToTask(row) {
|
|
|
3424
3425
|
suspendedAt: row.suspendedAt ? new Date(String(row.suspendedAt)) : void 0,
|
|
3425
3426
|
completedAt: row.completedAt ? new Date(String(row.completedAt)) : void 0,
|
|
3426
3427
|
ownerId: row.ownerId != null ? String(row.ownerId) : void 0,
|
|
3427
|
-
leaseExpiresAt: row.leaseExpiresAt ? new Date(String(row.leaseExpiresAt)) : void 0
|
|
3428
|
+
leaseExpiresAt: row.leaseExpiresAt ? new Date(String(row.leaseExpiresAt)) : void 0,
|
|
3429
|
+
expiresAt: row.expiresAt ? new Date(String(row.expiresAt)) : void 0,
|
|
3430
|
+
metadata: parseJson$4(row.metadata)
|
|
3428
3431
|
};
|
|
3429
3432
|
}
|
|
3430
3433
|
var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksStorage {
|
|
3434
|
+
supportsTaskExpiry = true;
|
|
3431
3435
|
/**
|
|
3432
3436
|
* Completed/failed task records accumulate. Anchored on `completedAt`, which
|
|
3433
3437
|
* is NULL while a task is in-flight (pending/running/suspended) — so `completedAt
|
|
@@ -3462,7 +3466,9 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3462
3466
|
"suspend_payload",
|
|
3463
3467
|
"suspendedAt",
|
|
3464
3468
|
"ownerId",
|
|
3465
|
-
"leaseExpiresAt"
|
|
3469
|
+
"leaseExpiresAt",
|
|
3470
|
+
"expiresAt",
|
|
3471
|
+
"metadata"
|
|
3466
3472
|
]
|
|
3467
3473
|
});
|
|
3468
3474
|
}
|
|
@@ -3508,7 +3514,9 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3508
3514
|
suspendedAt: task.suspendedAt?.toISOString() ?? null,
|
|
3509
3515
|
completedAt: task.completedAt?.toISOString() ?? null,
|
|
3510
3516
|
ownerId: task.ownerId ?? null,
|
|
3511
|
-
leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null
|
|
3517
|
+
leaseExpiresAt: task.leaseExpiresAt?.toISOString() ?? null,
|
|
3518
|
+
expiresAt: task.expiresAt?.toISOString() ?? null,
|
|
3519
|
+
metadata: task.metadata ?? null
|
|
3512
3520
|
}
|
|
3513
3521
|
});
|
|
3514
3522
|
}
|
|
@@ -3555,6 +3563,14 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3555
3563
|
setClauses.push("leaseExpiresAt = ?");
|
|
3556
3564
|
params.push(update.leaseExpiresAt?.toISOString() ?? null);
|
|
3557
3565
|
}
|
|
3566
|
+
if ("expiresAt" in update) {
|
|
3567
|
+
setClauses.push("expiresAt = ?");
|
|
3568
|
+
params.push(update.expiresAt?.toISOString() ?? null);
|
|
3569
|
+
}
|
|
3570
|
+
if ("metadata" in update) {
|
|
3571
|
+
setClauses.push("metadata = jsonb(?)");
|
|
3572
|
+
params.push(serializeJson(update.metadata));
|
|
3573
|
+
}
|
|
3558
3574
|
if (setClauses.length === 0) return false;
|
|
3559
3575
|
params.push(taskId);
|
|
3560
3576
|
let where = "id = ?";
|
|
@@ -3576,6 +3592,13 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3576
3592
|
params.push(options.expectedLeaseExpiresAt.toISOString());
|
|
3577
3593
|
}
|
|
3578
3594
|
}
|
|
3595
|
+
if (options?.expectedSuspendedAt !== void 0) {
|
|
3596
|
+
if (options.expectedSuspendedAt === null) where += " AND suspendedAt IS NULL";
|
|
3597
|
+
else {
|
|
3598
|
+
where += " AND suspendedAt = ?";
|
|
3599
|
+
params.push(options.expectedSuspendedAt.toISOString());
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3579
3602
|
return (await this.#client.execute({
|
|
3580
3603
|
sql: `UPDATE ${TABLE_BACKGROUND_TASKS} SET ${setClauses.join(", ")} WHERE ${where}`,
|
|
3581
3604
|
args: params
|
|
@@ -3620,7 +3643,8 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3620
3643
|
conditions.push("tool_call_id = ?");
|
|
3621
3644
|
params.push(filter.toolCallId);
|
|
3622
3645
|
}
|
|
3623
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
|
|
3646
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : filter.dateFilterBy === "expiresAt" ? "expiresAt" : "createdAt";
|
|
3647
|
+
if (filter.hasExpiresAt !== void 0) conditions.push(filter.hasExpiresAt ? "expiresAt IS NOT NULL" : "expiresAt IS NULL");
|
|
3624
3648
|
if (filter.fromDate) {
|
|
3625
3649
|
conditions.push(`${dateCol} >= ?`);
|
|
3626
3650
|
params.push(filter.fromDate.toISOString());
|
|
@@ -3668,7 +3692,8 @@ var BackgroundTasksLibSQL = class BackgroundTasksLibSQL extends BackgroundTasksS
|
|
|
3668
3692
|
conditions.push(`status IN (${statuses.map(() => "?").join(", ")})`);
|
|
3669
3693
|
params.push(...statuses);
|
|
3670
3694
|
}
|
|
3671
|
-
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
|
|
3695
|
+
const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : filter.dateFilterBy === "expiresAt" ? "expiresAt" : "createdAt";
|
|
3696
|
+
if (filter.hasExpiresAt !== void 0) conditions.push(filter.hasExpiresAt ? "expiresAt IS NOT NULL" : "expiresAt IS NULL");
|
|
3672
3697
|
if (filter.fromDate) {
|
|
3673
3698
|
conditions.push(`${dateCol} >= ?`);
|
|
3674
3699
|
params.push(filter.fromDate.toISOString());
|