@mastra/ai-sdk 1.12.0-alpha.0 → 1.12.0-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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +14 -14
- package/dist/docs/references/reference-streaming-agents-stream.md +1 -1
- package/dist/helpers.d.ts +2 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.cjs +9 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.12.0-alpha.
|
|
2
|
+
"version": "1.12.0-alpha.1",
|
|
3
3
|
"package": "@mastra/ai-sdk",
|
|
4
4
|
"exports": {
|
|
5
5
|
"assertValidHeartbeatMs": {
|
|
6
6
|
"types": "dist/sse-heartbeat.d.ts",
|
|
7
7
|
"implementation": "dist/index.js",
|
|
8
|
-
"line":
|
|
8
|
+
"line": 11768
|
|
9
9
|
},
|
|
10
10
|
"chatRoute": {
|
|
11
11
|
"types": "dist/chat-route.d.ts",
|
|
12
12
|
"implementation": "dist/index.js",
|
|
13
|
-
"line":
|
|
13
|
+
"line": 12176
|
|
14
14
|
},
|
|
15
15
|
"handleChatStream": {
|
|
16
16
|
"types": "dist/chat-route.d.ts",
|
|
17
17
|
"implementation": "dist/index.js",
|
|
18
|
-
"line":
|
|
18
|
+
"line": 12097
|
|
19
19
|
},
|
|
20
20
|
"handleNetworkStream": {
|
|
21
21
|
"types": "dist/network-route.d.ts",
|
|
22
22
|
"implementation": "dist/index.js",
|
|
23
|
-
"line":
|
|
23
|
+
"line": 12571
|
|
24
24
|
},
|
|
25
25
|
"handleWorkflowStream": {
|
|
26
26
|
"types": "dist/workflow-route.d.ts",
|
|
27
27
|
"implementation": "dist/index.js",
|
|
28
|
-
"line":
|
|
28
|
+
"line": 12419
|
|
29
29
|
},
|
|
30
30
|
"networkRoute": {
|
|
31
31
|
"types": "dist/network-route.d.ts",
|
|
32
32
|
"implementation": "dist/index.js",
|
|
33
|
-
"line":
|
|
33
|
+
"line": 12642
|
|
34
34
|
},
|
|
35
35
|
"smoothStream": {
|
|
36
36
|
"types": "dist/smooth-stream.d.ts",
|
|
@@ -40,37 +40,37 @@
|
|
|
40
40
|
"toAISdkFormat": {
|
|
41
41
|
"types": "dist/to-ai-sdk-format.d.ts",
|
|
42
42
|
"implementation": "dist/index.js",
|
|
43
|
-
"line":
|
|
43
|
+
"line": 13496
|
|
44
44
|
},
|
|
45
45
|
"toAISdkStream": {
|
|
46
46
|
"types": "dist/convert-streams.d.ts",
|
|
47
47
|
"implementation": "dist/index.js",
|
|
48
|
-
"line":
|
|
48
|
+
"line": 11715
|
|
49
49
|
},
|
|
50
50
|
"toAISdkV5Stream": {
|
|
51
51
|
"types": "dist/convert-streams.d.ts",
|
|
52
52
|
"implementation": "dist/index.js",
|
|
53
|
-
"line":
|
|
53
|
+
"line": 11689
|
|
54
54
|
},
|
|
55
55
|
"withMastra": {
|
|
56
56
|
"types": "dist/middleware.d.ts",
|
|
57
57
|
"implementation": "dist/index.js",
|
|
58
|
-
"line":
|
|
58
|
+
"line": 12839
|
|
59
59
|
},
|
|
60
60
|
"withSseHeartbeat": {
|
|
61
61
|
"types": "dist/sse-heartbeat.d.ts",
|
|
62
62
|
"implementation": "dist/index.js",
|
|
63
|
-
"line":
|
|
63
|
+
"line": 11781
|
|
64
64
|
},
|
|
65
65
|
"workflowRoute": {
|
|
66
66
|
"types": "dist/workflow-route.d.ts",
|
|
67
67
|
"implementation": "dist/index.js",
|
|
68
|
-
"line":
|
|
68
|
+
"line": 12489
|
|
69
69
|
},
|
|
70
70
|
"workflowSnapshotToStream": {
|
|
71
71
|
"types": "dist/convert-snapshot.d.ts",
|
|
72
72
|
"implementation": "dist/index.js",
|
|
73
|
-
"line":
|
|
73
|
+
"line": 12784
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"modules": {}
|
|
@@ -172,7 +172,7 @@ const stream = await agent.stream('message for agent')
|
|
|
172
172
|
|
|
173
173
|
**options.clientTools** (`ToolsInput`): Tools that are executed on the 'client' side of the request. These tools do not have execute functions in the definition.
|
|
174
174
|
|
|
175
|
-
**options.hooks** (`ToolHooks`): Per-execution hooks that run before and after tool calls.
|
|
175
|
+
**options.hooks** (`ToolHooks`): Per-execution hooks that run before and after tool calls, for example to log or save audit records. afterToolCall: (context) => void | Promise\<void> receives toolName, input, and output or error. beforeToolCall can return { proceed: false, output } to skip the tool call. Overrides matching agent-level hooks for this execution. See Run logic around tool calls.
|
|
176
176
|
|
|
177
177
|
**options.savePerStep** (`boolean`): Save messages incrementally after each stream step completes (default: false).
|
|
178
178
|
|
package/dist/helpers.d.ts
CHANGED
|
@@ -50,8 +50,9 @@ type ConvertMastraChunkToAISDKOptions<OUTPUT> = {
|
|
|
50
50
|
normalizeUsage: (usage: any) => any;
|
|
51
51
|
normalizeFinishReason: (reason: MastraFinishReason) => string;
|
|
52
52
|
includeRawFinishReason?: boolean;
|
|
53
|
+
includeToolTitle?: boolean;
|
|
53
54
|
};
|
|
54
|
-
export declare function convertMastraChunkToAISDKBase<OUTPUT = undefined>({ chunk, mode, normalizeWarnings, normalizeUsage, normalizeFinishReason, includeRawFinishReason, }: ConvertMastraChunkToAISDKOptions<OUTPUT>): OutputChunkType<OUTPUT>;
|
|
55
|
+
export declare function convertMastraChunkToAISDKBase<OUTPUT = undefined>({ chunk, mode, normalizeWarnings, normalizeUsage, normalizeFinishReason, includeRawFinishReason, includeToolTitle, }: ConvertMastraChunkToAISDKOptions<OUTPUT>): OutputChunkType<OUTPUT>;
|
|
55
56
|
export declare function convertMastraChunkToAISDKv5<OUTPUT = undefined>({ chunk, mode, }: {
|
|
56
57
|
chunk: ChunkType<OUTPUT>;
|
|
57
58
|
mode?: 'generate' | 'stream';
|
package/dist/helpers.d.ts.map
C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SAAS,SAAS,EAAE,EACpF,IAAI,EACJ,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,OAAO,EACP,SAAS,EACT,UAAU,EACV,iBAAiB,GAClB,EAAE;IAED,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,qBAAqB,GAAG,aAAa,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;IAClH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GACG,mBAAmB,CAAC,UAAU,CAAC,GAC/B,qBAAqB,CAAC,WAAW,CAAC,GAClC,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,SAAS,CAgTZ"}
|
package/dist/index.cjs
CHANGED
|
@@ -10061,7 +10061,7 @@ function convertBackgroundTaskChunkToDataChunk(chunk) {
|
|
|
10061
10061
|
}
|
|
10062
10062
|
};
|
|
10063
10063
|
}
|
|
10064
|
-
function convertMastraChunkToAISDKBase({ chunk, mode = "stream", normalizeWarnings, normalizeUsage, normalizeFinishReason, includeRawFinishReason = false }) {
|
|
10064
|
+
function convertMastraChunkToAISDKBase({ chunk, mode = "stream", normalizeWarnings, normalizeUsage, normalizeFinishReason, includeRawFinishReason = false, includeToolTitle = false }) {
|
|
10065
10065
|
const displayInputTransform = getTransformedToolPayload(chunk.metadata, "display", "input-available");
|
|
10066
10066
|
const displayInputDeltaTransform = getTransformedToolPayload(chunk.metadata, "display", "input-delta");
|
|
10067
10067
|
const displayOutputTransform = getTransformedToolPayload(chunk.metadata, "display", "output-available");
|
|
@@ -10148,6 +10148,7 @@ function convertMastraChunkToAISDKBase({ chunk, mode = "stream", normalizeWarnin
|
|
|
10148
10148
|
providerMetadata: chunk.payload.providerMetadata,
|
|
10149
10149
|
providerExecuted: chunk.payload.providerExecuted,
|
|
10150
10150
|
toolName: chunk.payload.toolName,
|
|
10151
|
+
...includeToolTitle && chunk.payload.title != null ? { title: chunk.payload.title } : {},
|
|
10151
10152
|
input: hasTransformedToolPayload(displayInputTransform) ? displayInputTransform.transformed : chunk.payload.args,
|
|
10152
10153
|
...chunk.payload.observability ? { observability: chunk.payload.observability } : {},
|
|
10153
10154
|
...chunk.payload.toolMetadata ? { toolMetadata: chunk.payload.toolMetadata } : {}
|
|
@@ -10215,6 +10216,7 @@ function convertMastraChunkToAISDKBase({ chunk, mode = "stream", normalizeWarnin
|
|
|
10215
10216
|
type: "tool-input-start",
|
|
10216
10217
|
id: chunk.payload.toolCallId,
|
|
10217
10218
|
toolName: chunk.payload.toolName,
|
|
10219
|
+
...includeToolTitle && chunk.payload.title != null ? { title: chunk.payload.title } : {},
|
|
10218
10220
|
dynamic: !!chunk.payload.dynamic,
|
|
10219
10221
|
providerMetadata: chunk.payload.providerMetadata,
|
|
10220
10222
|
providerExecuted: chunk.payload.providerExecuted,
|
|
@@ -10407,7 +10409,8 @@ function convertMastraChunkToAISDKv6({ chunk, mode = "stream" }) {
|
|
|
10407
10409
|
normalizeWarnings: normalizeV6Warnings,
|
|
10408
10410
|
normalizeUsage: normalizeV6Usage,
|
|
10409
10411
|
normalizeFinishReason: toAISDKFinishReasonV6,
|
|
10410
|
-
includeRawFinishReason: true
|
|
10412
|
+
includeRawFinishReason: true,
|
|
10413
|
+
includeToolTitle: true
|
|
10411
10414
|
});
|
|
10412
10415
|
}
|
|
10413
10416
|
function createToolOutputAncestryEntry(toolCallId, toolName) {
|
|
@@ -10518,10 +10521,12 @@ function convertFullStreamChunkToUIMessageStream({ part, messageMetadataValue, s
|
|
|
10518
10521
|
return;
|
|
10519
10522
|
case "tool-input-start": {
|
|
10520
10523
|
const toolMetadata = part.toolMetadata;
|
|
10524
|
+
const title = part.title;
|
|
10521
10525
|
return {
|
|
10522
10526
|
type: "tool-input-start",
|
|
10523
10527
|
toolCallId: part.id,
|
|
10524
10528
|
toolName: part.toolName,
|
|
10529
|
+
...title != null ? { title } : {},
|
|
10525
10530
|
...part.providerExecuted != null ? { providerExecuted: part.providerExecuted } : {},
|
|
10526
10531
|
...part.dynamic != null ? { dynamic: part.dynamic } : {},
|
|
10527
10532
|
...toolMetadata != null ? { toolMetadata } : {}
|
|
@@ -10535,10 +10540,12 @@ function convertFullStreamChunkToUIMessageStream({ part, messageMetadataValue, s
|
|
|
10535
10540
|
case "tool-call": {
|
|
10536
10541
|
const observability = part.observability;
|
|
10537
10542
|
const toolMetadata = part.toolMetadata;
|
|
10543
|
+
const title = part.title;
|
|
10538
10544
|
return {
|
|
10539
10545
|
type: "tool-input-available",
|
|
10540
10546
|
toolCallId: part.toolCallId,
|
|
10541
10547
|
toolName: part.toolName,
|
|
10548
|
+
...title != null ? { title } : {},
|
|
10542
10549
|
input: part.input,
|
|
10543
10550
|
...part.providerExecuted != null ? { providerExecuted: part.providerExecuted } : {},
|
|
10544
10551
|
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {},
|