@mastra/lance 1.0.5 → 1.0.6-alpha.1

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,33 @@
1
1
  # @mastra/lance
2
2
 
3
+ ## 1.0.6-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Respect optional `resourceId` in `getThreadById` so scoped thread lookups return `null` when the thread belongs to a different resource. ([#14237](https://github.com/mastra-ai/mastra/pull/14237))
8
+
9
+ Example:
10
+
11
+ ```typescript
12
+ const thread = await memory.getThreadById({
13
+ threadId: 'my-thread-id',
14
+ resourceId: 'my-user-id',
15
+ });
16
+ // Returns null if the thread does not belong to 'my-user-id'.
17
+ ```
18
+
19
+ - Updated dependencies [[`7c275a8`](https://github.com/mastra-ai/mastra/commit/7c275a810595e1a6c41ccc39720531ab65734700), [`890b24c`](https://github.com/mastra-ai/mastra/commit/890b24cc7d32ed6aa4dfe253e54dc6bf4099f690), [`0f48ebf`](https://github.com/mastra-ai/mastra/commit/0f48ebfc7ac7897b2092a189f45751924cf56d1c), [`f180e49`](https://github.com/mastra-ai/mastra/commit/f180e4990e71b04c9a475b523584071712f0048f), [`9260e01`](https://github.com/mastra-ai/mastra/commit/9260e015276fb1b500f7878ee452b47476bf1583), [`2f6c54e`](https://github.com/mastra-ai/mastra/commit/2f6c54e17c041cac1def54baaa6b771647836414), [`e06a159`](https://github.com/mastra-ai/mastra/commit/e06a1598ca07a6c3778aefc2a2d288363c6294ff), [`db34bc6`](https://github.com/mastra-ai/mastra/commit/db34bc6fb36cf125bda0c46be4d3fdc774b70cc4)]:
20
+ - @mastra/core@1.33.0-alpha.8
21
+
22
+ ## 1.0.6-alpha.0
23
+
24
+ ### Patch Changes
25
+
26
+ - 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))
27
+
28
+ - 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)]:
29
+ - @mastra/core@1.33.0-alpha.4
30
+
3
31
  ## 1.0.5
4
32
 
5
33
  ### Patch Changes
@@ -3,7 +3,7 @@ name: mastra-lance
3
3
  description: Documentation for @mastra/lance. Use when working with @mastra/lance APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/lance"
6
- version: "1.0.5"
6
+ version: "1.0.6-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.5",
2
+ "version": "1.0.6-alpha.1",
3
3
  "package": "@mastra/lance",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -607,11 +607,13 @@ function toRecord(task) {
607
607
  args: serializeJson(task.args),
608
608
  result: serializeJson(task.result),
609
609
  error: serializeJson(task.error),
610
+ suspend_payload: serializeJson(task.suspendPayload),
610
611
  retry_count: task.retryCount,
611
612
  max_retries: task.maxRetries,
612
613
  timeout_ms: task.timeoutMs,
613
614
  createdAt: task.createdAt,
614
615
  startedAt: task.startedAt ?? /* @__PURE__ */ new Date(0),
616
+ suspendedAt: task.suspendedAt ?? /* @__PURE__ */ new Date(0),
615
617
  completedAt: task.completedAt ?? /* @__PURE__ */ new Date(0)
616
618
  };
617
619
  }
@@ -628,6 +630,7 @@ function fromRecord(row) {
628
630
  return val;
629
631
  };
630
632
  const startedAt = row.startedAt instanceof Date ? row.startedAt : row.startedAt ? new Date(row.startedAt) : void 0;
633
+ const suspendedAt = row.suspendedAt instanceof Date ? row.suspendedAt : row.suspendedAt ? new Date(row.suspendedAt) : void 0;
631
634
  const completedAt = row.completedAt instanceof Date ? row.completedAt : row.completedAt ? new Date(row.completedAt) : void 0;
632
635
  return {
633
636
  id: String(row.id),
@@ -641,11 +644,13 @@ function fromRecord(row) {
641
644
  runId: row.run_id ?? "",
642
645
  result: parseJson(row.result),
643
646
  error: parseJson(row.error),
647
+ suspendPayload: parseJson(row.suspend_payload),
644
648
  retryCount: Number(row.retry_count ?? 0),
645
649
  maxRetries: Number(row.max_retries ?? 0),
646
650
  timeoutMs: Number(row.timeout_ms ?? 3e5),
647
651
  createdAt: row.createdAt instanceof Date ? row.createdAt : new Date(row.createdAt),
648
652
  startedAt: startedAt && startedAt.getTime() > 0 ? startedAt : void 0,
653
+ suspendedAt: suspendedAt && suspendedAt.getTime() > 0 ? suspendedAt : void 0,
649
654
  completedAt: completedAt && completedAt.getTime() > 0 ? completedAt : void 0
650
655
  };
651
656
  }
@@ -666,6 +671,11 @@ var StoreBackgroundTasksLance = class extends storage.BackgroundTasksStorage {
666
671
  tableName: storage.TABLE_BACKGROUND_TASKS,
667
672
  schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS]
668
673
  });
674
+ await this.#db.alterTable({
675
+ tableName: storage.TABLE_BACKGROUND_TASKS,
676
+ schema: storage.TABLE_SCHEMAS[storage.TABLE_BACKGROUND_TASKS],
677
+ ifNotExists: ["suspend_payload", "suspendedAt"]
678
+ });
669
679
  }
670
680
  async dangerouslyClearAll() {
671
681
  await this.#db.clearTable({ tableName: storage.TABLE_BACKGROUND_TASKS });
@@ -681,8 +691,10 @@ var StoreBackgroundTasksLance = class extends storage.BackgroundTasksStorage {
681
691
  if ("status" in update) merged.status = update.status;
682
692
  if ("result" in update) merged.result = update.result;
683
693
  if ("error" in update) merged.error = update.error;
694
+ if ("suspendPayload" in update) merged.suspendPayload = update.suspendPayload;
684
695
  if ("retryCount" in update) merged.retryCount = update.retryCount;
685
696
  if ("startedAt" in update) merged.startedAt = update.startedAt;
697
+ if ("suspendedAt" in update) merged.suspendedAt = update.suspendedAt;
686
698
  if ("completedAt" in update) merged.completedAt = update.completedAt;
687
699
  const table = await this.client.openTable(storage.TABLE_BACKGROUND_TASKS);
688
700
  await table.delete(`id = '${escapeStr(taskId)}'`);
@@ -712,6 +724,7 @@ var StoreBackgroundTasksLance = class extends storage.BackgroundTasksStorage {
712
724
  if (filter.resourceId) conditions.push(`resource_id = '${escapeStr(filter.resourceId)}'`);
713
725
  if (filter.runId) conditions.push(`run_id = '${escapeStr(filter.runId)}'`);
714
726
  if (filter.toolName) conditions.push(`tool_name = '${escapeStr(filter.toolName)}'`);
727
+ if (filter.toolCallId) conditions.push(`tool_call_id = '${escapeStr(filter.toolCallId)}'`);
715
728
  let query = table.query();
716
729
  if (conditions.length > 0) {
717
730
  query = query.where(conditions.join(" AND "));
@@ -843,10 +856,13 @@ var StoreMemoryLance = class extends storage.MemoryStorage {
843
856
  escapeSql(str) {
844
857
  return str.replace(/'/g, "''");
845
858
  }
846
- async getThreadById({ threadId }) {
859
+ async getThreadById({
860
+ threadId,
861
+ resourceId
862
+ }) {
847
863
  try {
848
864
  const thread = await this.#db.load({ tableName: storage.TABLE_THREADS, keys: { id: threadId } });
849
- if (!thread) {
865
+ if (!thread || resourceId !== void 0 && thread.resourceId !== resourceId) {
850
866
  return null;
851
867
  }
852
868
  return {