@mastra/libsql 1.10.0 → 1.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 1.10.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Track `suspendedAt` and `suspendPayload` on background tasks. SQL adapters auto-migrate the new columns via `alterTable`. ([#16260](https://github.com/mastra-ai/mastra/pull/16260))
8
+
9
+ - Updated dependencies [[`9f17410`](https://github.com/mastra-ai/mastra/commit/9f1741080def23d42ee50b39887a385ae316a3c6), [`c6eb39e`](https://github.com/mastra-ai/mastra/commit/c6eb39ea6dca381c6563cb240237fbe608e02f93), [`900d086`](https://github.com/mastra-ai/mastra/commit/900d086bb737b9cf2fcf68f11b0389b801a2738c), [`4c0e286`](https://github.com/mastra-ai/mastra/commit/4c0e28637c9cfb4f416549b55e97ebfa13319dfc), [`25184ff`](https://github.com/mastra-ai/mastra/commit/25184ffaf1293ec95119426eb1a1f8d38831b96c), [`aebde9c`](https://github.com/mastra-ai/mastra/commit/aebde9cfacf56592c6b6350cae721740fe090b8a)]:
10
+ - @mastra/core@1.33.0-alpha.4
11
+
3
12
  ## 1.10.0
4
13
 
5
14
  ### Minor Changes
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.10.0"
6
+ version: "1.10.1-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.0",
2
+ "version": "1.10.1-alpha.0",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -237,4 +237,5 @@ export const memoryAgent = new Agent({
237
237
 
238
238
  - [`Memory` reference](https://mastra.ai/reference/memory/memory-class)
239
239
  - [Tracing](https://mastra.ai/docs/observability/tracing/overview)
240
- - [Request Context](https://mastra.ai/docs/server/request-context)
240
+ - [Request Context](https://mastra.ai/docs/server/request-context)
241
+ - [Mastra Code](https://code.mastra.ai/): A coding agent using Mastra's memory system
package/dist/index.cjs CHANGED
@@ -2993,11 +2993,13 @@ function rowToTask(row) {
2993
2993
  runId: String(row.run_id),
2994
2994
  result: parseJson(row.result),
2995
2995
  error: parseJson(row.error),
2996
+ suspendPayload: parseJson(row.suspend_payload),
2996
2997
  retryCount: Number(row.retry_count),
2997
2998
  maxRetries: Number(row.max_retries),
2998
2999
  timeoutMs: Number(row.timeout_ms),
2999
3000
  createdAt: new Date(String(row.createdAt)),
3000
3001
  startedAt: row.startedAt ? new Date(String(row.startedAt)) : void 0,
3002
+ suspendedAt: row.suspendedAt ? new Date(String(row.suspendedAt)) : void 0,
3001
3003
  completedAt: row.completedAt ? new Date(String(row.completedAt)) : void 0
3002
3004
  };
3003
3005
  }
@@ -3015,6 +3017,11 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3015
3017
  tableName: storage.TABLE_BACKGROUND_TASKS,
3016
3018
  schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS]
3017
3019
  });
3020
+ await this.#db.alterTable({
3021
+ tableName: storage.TABLE_BACKGROUND_TASKS,
3022
+ schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS],
3023
+ ifNotExists: ["suspend_payload", "suspendedAt"]
3024
+ });
3018
3025
  }
3019
3026
  async dangerouslyClearAll() {
3020
3027
  await this.#db.deleteData({ tableName: storage.TABLE_BACKGROUND_TASKS });
@@ -3034,11 +3041,13 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3034
3041
  args: task.args,
3035
3042
  result: task.result ?? null,
3036
3043
  error: task.error ?? null,
3044
+ suspend_payload: task.suspendPayload ?? null,
3037
3045
  retry_count: task.retryCount,
3038
3046
  max_retries: task.maxRetries,
3039
3047
  timeout_ms: task.timeoutMs,
3040
3048
  createdAt: task.createdAt.toISOString(),
3041
3049
  startedAt: task.startedAt?.toISOString() ?? null,
3050
+ suspendedAt: task.suspendedAt?.toISOString() ?? null,
3042
3051
  completedAt: task.completedAt?.toISOString() ?? null
3043
3052
  }
3044
3053
  });
@@ -3058,6 +3067,10 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3058
3067
  setClauses.push("error = jsonb(?)");
3059
3068
  params.push(serializeJson(update.error));
3060
3069
  }
3070
+ if ("suspendPayload" in update) {
3071
+ setClauses.push("suspend_payload = jsonb(?)");
3072
+ params.push(serializeJson(update.suspendPayload));
3073
+ }
3061
3074
  if ("retryCount" in update) {
3062
3075
  setClauses.push("retry_count = ?");
3063
3076
  params.push(update.retryCount);
@@ -3066,6 +3079,10 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3066
3079
  setClauses.push("startedAt = ?");
3067
3080
  params.push(update.startedAt?.toISOString() ?? null);
3068
3081
  }
3082
+ if ("suspendedAt" in update) {
3083
+ setClauses.push("suspendedAt = ?");
3084
+ params.push(update.suspendedAt?.toISOString() ?? null);
3085
+ }
3069
3086
  if ("completedAt" in update) {
3070
3087
  setClauses.push("completedAt = ?");
3071
3088
  params.push(update.completedAt?.toISOString() ?? null);
@@ -3113,7 +3130,11 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3113
3130
  conditions.push("tool_name = ?");
3114
3131
  params.push(filter.toolName);
3115
3132
  }
3116
- const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
3133
+ if (filter.toolCallId) {
3134
+ conditions.push("tool_call_id = ?");
3135
+ params.push(filter.toolCallId);
3136
+ }
3137
+ const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
3117
3138
  if (filter.fromDate) {
3118
3139
  conditions.push(`${dateCol} >= ?`);
3119
3140
  params.push(filter.fromDate.toISOString());
@@ -3128,7 +3149,7 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3128
3149
  args: [...params]
3129
3150
  });
3130
3151
  const total = Number(countResult.rows[0]?.count ?? 0);
3131
- const orderCol = filter.orderBy === "startedAt" ? "startedAt" : filter.orderBy === "completedAt" ? "completedAt" : "createdAt";
3152
+ const orderCol = filter.orderBy === "startedAt" ? "startedAt" : filter.orderBy === "suspendedAt" ? "suspendedAt" : filter.orderBy === "completedAt" ? "completedAt" : "createdAt";
3132
3153
  const direction = filter.orderDirection === "desc" ? "DESC" : "ASC";
3133
3154
  let sql = `SELECT ${buildSelectColumns(storage.TABLE_BACKGROUND_TASKS)} FROM ${storage.TABLE_BACKGROUND_TASKS} ${where} ORDER BY ${orderCol} ${direction}`;
3134
3155
  if (filter.perPage != null) {
@@ -3156,7 +3177,7 @@ var BackgroundTasksLibSQL = class extends storage.BackgroundTasksStorage {
3156
3177
  conditions.push(`status IN (${statuses.map(() => "?").join(", ")})`);
3157
3178
  params.push(...statuses);
3158
3179
  }
3159
- const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
3180
+ const dateCol = filter.dateFilterBy === "startedAt" ? "startedAt" : filter.dateFilterBy === "suspendedAt" ? "suspendedAt" : filter.dateFilterBy === "completedAt" ? "completedAt" : "createdAt";
3160
3181
  if (filter.fromDate) {
3161
3182
  conditions.push(`${dateCol} >= ?`);
3162
3183
  params.push(filter.fromDate.toISOString());