@mastra/ai-sdk 0.0.0-dynamic-model-router-20251009231604 → 0.0.0-dynamic-model-router-20251010230835
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 +40 -3
- package/dist/chat-route.d.ts.map +1 -1
- package/dist/helpers.d.ts +11 -1
- package/dist/helpers.d.ts.map +1 -1
- package/dist/index.cjs +259 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +259 -70
- package/dist/index.js.map +1 -1
- package/dist/to-ai-sdk-format.d.ts +2 -30
- package/dist/to-ai-sdk-format.d.ts.map +1 -1
- package/dist/transformers.d.ts +86 -0
- package/dist/transformers.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -1,33 +1,5 @@
|
|
|
1
|
-
import type { MastraModelOutput,
|
|
2
|
-
import type { WorkflowRunStatus, WorkflowStepStatus } from '@mastra/core/workflows';
|
|
1
|
+
import type { MastraModelOutput, OutputSchema } from '@mastra/core/stream';
|
|
3
2
|
import type { InferUIMessageChunk, UIMessage } from 'ai';
|
|
4
|
-
|
|
5
|
-
type StepResult = {
|
|
6
|
-
name: string;
|
|
7
|
-
status: WorkflowStepStatus;
|
|
8
|
-
input: Record<string, unknown> | null;
|
|
9
|
-
output: Record<string, unknown> | null;
|
|
10
|
-
};
|
|
11
|
-
export type WorkflowAiSDKType = {
|
|
12
|
-
type: 'data-workflow';
|
|
13
|
-
id: string;
|
|
14
|
-
data: {
|
|
15
|
-
name: string;
|
|
16
|
-
status: WorkflowRunStatus;
|
|
17
|
-
steps: Record<string, StepResult>;
|
|
18
|
-
output: {
|
|
19
|
-
usage: {
|
|
20
|
-
inputTokens: number;
|
|
21
|
-
outputTokens: number;
|
|
22
|
-
totalTokens: number;
|
|
23
|
-
};
|
|
24
|
-
} | null;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export declare function WorkflowStreamToAISDKTransformer(): import("stream/web").TransformStream<AgentChunkType, {
|
|
28
|
-
data: string;
|
|
29
|
-
}>;
|
|
30
|
-
export declare function AgentStreamToAISDKTransformer<TOutput extends ZodType<any>>(): import("stream/web").TransformStream<AgentChunkType<TOutput>, object>;
|
|
3
|
+
export type { WorkflowAiSDKType } from './transformers.js';
|
|
31
4
|
export declare function toAISdkFormat<TOutput extends OutputSchema>(stream: MastraModelOutput<TOutput>): ReadableStream<InferUIMessageChunk<UIMessage>>;
|
|
32
|
-
export {};
|
|
33
5
|
//# sourceMappingURL=to-ai-sdk-format.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-ai-sdk-format.d.ts","sourceRoot":"","sources":["../src/to-ai-sdk-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"to-ai-sdk-format.d.ts","sourceRoot":"","sources":["../src/to-ai-sdk-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAGzD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,wBAAgB,aAAa,CAAC,OAAO,SAAS,YAAY,EACxD,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GACjC,cAAc,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAIhD"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ChunkType, NetworkChunkType } from '@mastra/core/stream';
|
|
2
|
+
import type { WorkflowRunStatus, WorkflowStepStatus } from '@mastra/core/workflows';
|
|
3
|
+
import type { ZodType } from 'zod';
|
|
4
|
+
type StepResult = {
|
|
5
|
+
name: string;
|
|
6
|
+
status: WorkflowStepStatus;
|
|
7
|
+
input: Record<string, unknown> | null;
|
|
8
|
+
output: Record<string, unknown> | null;
|
|
9
|
+
};
|
|
10
|
+
export type WorkflowAiSDKType = {
|
|
11
|
+
type: 'data-workflow';
|
|
12
|
+
id: string;
|
|
13
|
+
data: {
|
|
14
|
+
name: string;
|
|
15
|
+
status: WorkflowRunStatus;
|
|
16
|
+
steps: Record<string, StepResult>;
|
|
17
|
+
output: {
|
|
18
|
+
usage: {
|
|
19
|
+
inputTokens: number;
|
|
20
|
+
outputTokens: number;
|
|
21
|
+
totalTokens: number;
|
|
22
|
+
};
|
|
23
|
+
} | null;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare function WorkflowStreamToAISDKTransformer(): import("stream/web").TransformStream<ChunkType, WorkflowAiSDKType | {
|
|
27
|
+
data: string;
|
|
28
|
+
}>;
|
|
29
|
+
export declare function AgentStreamToAISDKTransformer<TOutput extends ZodType<any>>(): import("stream/web").TransformStream<ChunkType<TOutput>, object>;
|
|
30
|
+
export declare function transformAgent<TOutput extends ZodType<any>>(payload: ChunkType<TOutput>, bufferedSteps: Map<string, any>): {
|
|
31
|
+
readonly type: "data-tool-agent";
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly data: any;
|
|
34
|
+
} | null;
|
|
35
|
+
export declare function transformWorkflow<TOutput extends ZodType<any>>(payload: ChunkType<TOutput>, bufferedWorkflows: Map<string, {
|
|
36
|
+
name: string;
|
|
37
|
+
steps: Record<string, StepResult>;
|
|
38
|
+
}>): {
|
|
39
|
+
readonly type: "data-workflow";
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly data: {
|
|
42
|
+
readonly name: string;
|
|
43
|
+
readonly status: "running";
|
|
44
|
+
readonly steps: Record<string, StepResult>;
|
|
45
|
+
readonly output: null;
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
readonly type: "data-workflow";
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly data: {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly steps: Record<string, StepResult>;
|
|
53
|
+
readonly output: {
|
|
54
|
+
usage: {
|
|
55
|
+
inputTokens: number;
|
|
56
|
+
outputTokens: number;
|
|
57
|
+
totalTokens: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly status: WorkflowRunStatus;
|
|
61
|
+
};
|
|
62
|
+
} | null;
|
|
63
|
+
export declare function transformNetwork(payload: NetworkChunkType, bufferedNetworks: Map<string, {
|
|
64
|
+
name: string;
|
|
65
|
+
steps: StepResult[];
|
|
66
|
+
}>): {
|
|
67
|
+
readonly type: "data-network";
|
|
68
|
+
readonly id: string;
|
|
69
|
+
readonly data: {
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly status: "running";
|
|
72
|
+
readonly steps: StepResult[];
|
|
73
|
+
readonly output: null;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
readonly type: "data-network";
|
|
77
|
+
readonly id: string;
|
|
78
|
+
readonly data: {
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly status: "finished";
|
|
81
|
+
readonly steps: StepResult[];
|
|
82
|
+
readonly output: string;
|
|
83
|
+
};
|
|
84
|
+
} | null;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=transformers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","sourceRoot":"","sources":["../src/transformers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAGnC,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAA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;;;;;;;;;;;;;;;;;SAyJrE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/ai-sdk",
|
|
3
|
-
"version": "0.0.0-dynamic-model-router-
|
|
3
|
+
"version": "0.0.0-dynamic-model-router-20251010230835",
|
|
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",
|
|
@@ -23,18 +23,18 @@
|
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"zod": "^3.25.0 || ^4.0.0",
|
|
26
|
-
"@mastra/core": "0.0.0-dynamic-model-router-
|
|
26
|
+
"@mastra/core": "0.0.0-dynamic-model-router-20251010230835"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/json-schema": "^7.0.15",
|
|
30
|
-
"eslint": "^9.
|
|
30
|
+
"eslint": "^9.36.0",
|
|
31
31
|
"tsup": "^8.5.0",
|
|
32
32
|
"typescript": "^5.8.3",
|
|
33
33
|
"vitest": "^3.2.4",
|
|
34
34
|
"zod": "^3.25.76",
|
|
35
|
-
"@internal/lint": "0.0.0-dynamic-model-router-
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
35
|
+
"@internal/lint": "0.0.0-dynamic-model-router-20251010230835",
|
|
36
|
+
"@mastra/core": "0.0.0-dynamic-model-router-20251010230835",
|
|
37
|
+
"@internal/types-builder": "0.0.0-dynamic-model-router-20251010230835"
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"mastra",
|