@mastra/ai-sdk 1.12.2-alpha.0 → 1.12.2-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.
@@ -3,7 +3,7 @@ name: mastra-ai-sdk
3
3
  description: Documentation for @mastra/ai-sdk. Use when working with @mastra/ai-sdk APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/ai-sdk"
6
- version: "1.12.2-alpha.0"
6
+ version: "1.12.2-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.12.2-alpha.0",
2
+ "version": "1.12.2-alpha.1",
3
3
  "package": "@mastra/ai-sdk",
4
4
  "exports": {
5
5
  "assertValidHeartbeatMs": {
package/dist/index.cjs CHANGED
@@ -3283,7 +3283,7 @@ function createUIMessageStream$2({ execute, onError = () => "An error occurred."
3283
3283
  getOutcome: () => outcome
3284
3284
  });
3285
3285
  }
3286
- // ../../packages/_vendored/ai_v6/dist/dist-BoOIE3nE.js
3286
+ // ../../packages/_vendored/ai_v6/dist/dist-BHXUQYEB.js
3287
3287
  var marker$1$2 = "vercel.ai.error";
3288
3288
  var symbol$1$2 = Symbol.for(marker$1$2);
3289
3289
  var _a$1;
@@ -4398,7 +4398,7 @@ function standardSchema$1(standardSchema2) {
4398
4398
  return addAdditionalPropertiesToJsonSchema$1(standardSchema2["~standard"].jsonSchema.input({ target: "draft-07" }));
4399
4399
  }, { validate: async (value) => {
4400
4400
  const result = await standardSchema2["~standard"].validate(value);
4401
- return "value" in result ? {
4401
+ return result.issues === void 0 && "value" in result ? {
4402
4402
  success: true,
4403
4403
  value: result.value
4404
4404
  } : {
package/dist/index.js CHANGED
@@ -3260,7 +3260,7 @@ function createUIMessageStream$2({ execute, onError = () => "An error occurred."
3260
3260
  getOutcome: () => outcome
3261
3261
  });
3262
3262
  }
3263
- // ../../packages/_vendored/ai_v6/dist/dist-BoOIE3nE.js
3263
+ // ../../packages/_vendored/ai_v6/dist/dist-BHXUQYEB.js
3264
3264
  var marker$1$2 = "vercel.ai.error";
3265
3265
  var symbol$1$2 = Symbol.for(marker$1$2);
3266
3266
  var _a$1;
@@ -4375,7 +4375,7 @@ function standardSchema$1(standardSchema2) {
4375
4375
  return addAdditionalPropertiesToJsonSchema$1(standardSchema2["~standard"].jsonSchema.input({ target: "draft-07" }));
4376
4376
  }, { validate: async (value) => {
4377
4377
  const result = await standardSchema2["~standard"].validate(value);
4378
- return "value" in result ? {
4378
+ return result.issues === void 0 && "value" in result ? {
4379
4379
  success: true,
4380
4380
  value: result.value
4381
4381
  } : {
package/dist/ui.cjs CHANGED
@@ -4,8 +4,32 @@ let _mastra_core_agent_message_list = require("@mastra/core/agent/message-list")
4
4
  function isSystemReminderUIMessage(message) {
5
5
  if (message.metadata?.systemReminder || message.metadata?.dynamicAgentsMdReminder) return true;
6
6
  if (message.role !== "user") return false;
7
- if (Array.isArray(message.parts)) return message.parts.some((part) => part.type === "text" && typeof part.text === "string" && part.text.includes("<system-reminder"));
8
- return typeof message.content === "string" && message.content.includes("<system-reminder");
7
+ if (Array.isArray(message.parts)) return isSystemReminderElement(message.parts.find((part) => part.type === "text")?.text);
8
+ return isSystemReminderElement(message.content);
9
+ }
10
+ const SYSTEM_REMINDER_OPEN = "<system-reminder";
11
+ const SYSTEM_REMINDER_ATTRIBUTE = / ([A-Za-z_][A-Za-z0-9_.-]*)="(?:[^"<>&]|&(?:amp|lt|gt|quot);)*"/y;
12
+ const SYSTEM_REMINDER_SELF_CLOSE = " />";
13
+ const SYSTEM_REMINDER_CLOSE = "</system-reminder>";
14
+ const SYSTEM_REMINDER_CLOSING_TAG = /<\/system-reminder\s*>/i;
15
+ function isSystemReminderElement(text) {
16
+ if (typeof text !== "string") return false;
17
+ const trimmed = text.trim();
18
+ if (!trimmed.startsWith(SYSTEM_REMINDER_OPEN)) return false;
19
+ const names = /* @__PURE__ */ new Set();
20
+ let index = 16;
21
+ for (;;) {
22
+ SYSTEM_REMINDER_ATTRIBUTE.lastIndex = index;
23
+ const attribute = SYSTEM_REMINDER_ATTRIBUTE.exec(trimmed);
24
+ if (!attribute) break;
25
+ if (names.has(attribute[1])) return false;
26
+ names.add(attribute[1]);
27
+ index = SYSTEM_REMINDER_ATTRIBUTE.lastIndex;
28
+ }
29
+ if (trimmed.startsWith(SYSTEM_REMINDER_SELF_CLOSE, index)) return index + 3 === trimmed.length;
30
+ if (trimmed[index] !== ">") return false;
31
+ const body = trimmed.slice(index + 1, -18);
32
+ return body.length > 0 && trimmed.endsWith(SYSTEM_REMINDER_CLOSE) && !SYSTEM_REMINDER_CLOSING_TAG.test(body);
9
33
  }
10
34
  function filterSystemReminderUIMessages(messages) {
11
35
  return messages.filter((message) => !isSystemReminderUIMessage(message));
package/dist/ui.js CHANGED
@@ -3,8 +3,32 @@ import { MessageList } from "@mastra/core/agent/message-list";
3
3
  function isSystemReminderUIMessage(message) {
4
4
  if (message.metadata?.systemReminder || message.metadata?.dynamicAgentsMdReminder) return true;
5
5
  if (message.role !== "user") return false;
6
- if (Array.isArray(message.parts)) return message.parts.some((part) => part.type === "text" && typeof part.text === "string" && part.text.includes("<system-reminder"));
7
- return typeof message.content === "string" && message.content.includes("<system-reminder");
6
+ if (Array.isArray(message.parts)) return isSystemReminderElement(message.parts.find((part) => part.type === "text")?.text);
7
+ return isSystemReminderElement(message.content);
8
+ }
9
+ const SYSTEM_REMINDER_OPEN = "<system-reminder";
10
+ const SYSTEM_REMINDER_ATTRIBUTE = / ([A-Za-z_][A-Za-z0-9_.-]*)="(?:[^"<>&]|&(?:amp|lt|gt|quot);)*"/y;
11
+ const SYSTEM_REMINDER_SELF_CLOSE = " />";
12
+ const SYSTEM_REMINDER_CLOSE = "</system-reminder>";
13
+ const SYSTEM_REMINDER_CLOSING_TAG = /<\/system-reminder\s*>/i;
14
+ function isSystemReminderElement(text) {
15
+ if (typeof text !== "string") return false;
16
+ const trimmed = text.trim();
17
+ if (!trimmed.startsWith(SYSTEM_REMINDER_OPEN)) return false;
18
+ const names = /* @__PURE__ */ new Set();
19
+ let index = 16;
20
+ for (;;) {
21
+ SYSTEM_REMINDER_ATTRIBUTE.lastIndex = index;
22
+ const attribute = SYSTEM_REMINDER_ATTRIBUTE.exec(trimmed);
23
+ if (!attribute) break;
24
+ if (names.has(attribute[1])) return false;
25
+ names.add(attribute[1]);
26
+ index = SYSTEM_REMINDER_ATTRIBUTE.lastIndex;
27
+ }
28
+ if (trimmed.startsWith(SYSTEM_REMINDER_SELF_CLOSE, index)) return index + 3 === trimmed.length;
29
+ if (trimmed[index] !== ">") return false;
30
+ const body = trimmed.slice(index + 1, -18);
31
+ return body.length > 0 && trimmed.endsWith(SYSTEM_REMINDER_CLOSE) && !SYSTEM_REMINDER_CLOSING_TAG.test(body);
8
32
  }
9
33
  function filterSystemReminderUIMessages(messages) {
10
34
  return messages.filter((message) => !isSystemReminderUIMessage(message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/ai-sdk",
3
- "version": "1.12.2-alpha.0",
3
+ "version": "1.12.2-alpha.1",
4
4
  "description": "Adds custom API routes to be compatible with the AI SDK UI parts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,15 +48,15 @@
48
48
  "typescript": "^7.0.2",
49
49
  "vitest": "5.1.0",
50
50
  "zod": "^4.6.7",
51
- "@internal/ai-sdk-v4": "0.0.99",
52
51
  "@internal/ai-sdk-v5": "0.0.99",
53
- "@internal/ai-v6": "0.0.99",
54
52
  "@internal/ai-v7": "0.0.99",
55
53
  "@internal/lint": "0.0.152",
54
+ "@internal/ai-v6": "0.0.99",
55
+ "@internal/ai-sdk-v4": "0.0.99",
56
56
  "@internal/llm-recorder": "0.0.88",
57
57
  "@internal/test-utils": "0.0.88",
58
58
  "@internal/types-builder": "0.0.127",
59
- "@mastra/core": "1.87.0-alpha.0",
59
+ "@mastra/core": "1.87.0-alpha.2",
60
60
  "@mastra/libsql": "1.33.0-alpha.0",
61
61
  "@mastra/memory": "1.41.3"
62
62
  },