@mastra/client-js 0.10.16 → 0.10.17-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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +28 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/resources/base.ts +3 -1
- package/src/types.ts +4 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/client-js@0.10.
|
|
2
|
+
> @mastra/client-js@0.10.17-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
[34mCLI[39m Cleaning output folder
|
|
10
10
|
[34mESM[39m Build start
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m74.04 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 2302ms
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m73.73 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 2304ms
|
|
12
16
|
[34mDTS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in 2160ms
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in 18246ms
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m46.04 KB[39m
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m46.04 KB[39m
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 19056ms
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m46.21 KB[39m
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m46.21 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.10.17-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cda801d: Added the ability to pass in metadata for UIMessage and MastraMessageV2 in client-js and agent.stream/generate
|
|
8
|
+
- Updated dependencies [e0f73c6]
|
|
9
|
+
- Updated dependencies [cda801d]
|
|
10
|
+
- Updated dependencies [a77c823]
|
|
11
|
+
- @mastra/core@0.12.0-alpha.1
|
|
12
|
+
|
|
13
|
+
## 0.10.17-alpha.0
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 6bd354c: Should not send content type if body instance of FormData
|
|
18
|
+
- b641ba3: fix: save score params
|
|
19
|
+
- Updated dependencies [510e2c8]
|
|
20
|
+
- Updated dependencies [2f72fb2]
|
|
21
|
+
- Updated dependencies [3f89307]
|
|
22
|
+
- Updated dependencies [9eda7d4]
|
|
23
|
+
- Updated dependencies [9d49408]
|
|
24
|
+
- Updated dependencies [2ecf658]
|
|
25
|
+
- Updated dependencies [7a7754f]
|
|
26
|
+
- Updated dependencies [fc92d80]
|
|
27
|
+
- Updated dependencies [23a6a7c]
|
|
28
|
+
- Updated dependencies [09bca64]
|
|
29
|
+
- @mastra/core@0.12.0-alpha.0
|
|
30
|
+
|
|
3
31
|
## 0.10.16
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -253,7 +253,7 @@ var BaseResource = class {
|
|
|
253
253
|
const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
|
|
254
254
|
...options,
|
|
255
255
|
headers: {
|
|
256
|
-
...options.body && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
|
|
256
|
+
...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
|
|
257
257
|
...headers,
|
|
258
258
|
...options.headers
|
|
259
259
|
// TODO: Bring this back once we figure out what we/users need to do to make this work with cross-origin requests
|
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,8 @@ import { GenerateReturn } from '@mastra/core/llm';
|
|
|
5
5
|
import { JSONSchema7 } from 'json-schema';
|
|
6
6
|
import { ZodSchema } from 'zod';
|
|
7
7
|
import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn as GenerateReturn$1 } from '@mastra/core';
|
|
8
|
-
import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
|
|
8
|
+
import { AgentGenerateOptions, AgentStreamOptions, UIMessageWithMetadata, ToolsInput } from '@mastra/core/agent';
|
|
9
|
+
export { UIMessageWithMetadata } from '@mastra/core/agent';
|
|
9
10
|
import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
|
|
10
11
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
11
12
|
import { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
|
|
@@ -50,14 +51,14 @@ interface GetAgentResponse {
|
|
|
50
51
|
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
51
52
|
}
|
|
52
53
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
53
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
54
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
54
55
|
output?: T;
|
|
55
56
|
experimental_output?: T;
|
|
56
57
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
57
58
|
clientTools?: ToolsInput;
|
|
58
59
|
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
59
60
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
60
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
61
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
61
62
|
output?: T;
|
|
62
63
|
experimental_output?: T;
|
|
63
64
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
@@ -403,7 +404,7 @@ interface GetScoresByEntityIdParams {
|
|
|
403
404
|
perPage?: number;
|
|
404
405
|
}
|
|
405
406
|
interface SaveScoreParams {
|
|
406
|
-
score: ScoreRowData
|
|
407
|
+
score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
|
|
407
408
|
}
|
|
408
409
|
interface GetScoresResponse {
|
|
409
410
|
pagination: {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { GenerateReturn } from '@mastra/core/llm';
|
|
|
5
5
|
import { JSONSchema7 } from 'json-schema';
|
|
6
6
|
import { ZodSchema } from 'zod';
|
|
7
7
|
import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn as GenerateReturn$1 } from '@mastra/core';
|
|
8
|
-
import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
|
|
8
|
+
import { AgentGenerateOptions, AgentStreamOptions, UIMessageWithMetadata, ToolsInput } from '@mastra/core/agent';
|
|
9
|
+
export { UIMessageWithMetadata } from '@mastra/core/agent';
|
|
9
10
|
import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
|
|
10
11
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
11
12
|
import { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
|
|
@@ -50,14 +51,14 @@ interface GetAgentResponse {
|
|
|
50
51
|
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
51
52
|
}
|
|
52
53
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
53
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
54
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
54
55
|
output?: T;
|
|
55
56
|
experimental_output?: T;
|
|
56
57
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
57
58
|
clientTools?: ToolsInput;
|
|
58
59
|
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
59
60
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
60
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
61
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
61
62
|
output?: T;
|
|
62
63
|
experimental_output?: T;
|
|
63
64
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
@@ -403,7 +404,7 @@ interface GetScoresByEntityIdParams {
|
|
|
403
404
|
perPage?: number;
|
|
404
405
|
}
|
|
405
406
|
interface SaveScoreParams {
|
|
406
|
-
score: ScoreRowData
|
|
407
|
+
score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
|
|
407
408
|
}
|
|
408
409
|
interface GetScoresResponse {
|
|
409
410
|
pagination: {
|
package/dist/index.js
CHANGED
|
@@ -247,7 +247,7 @@ var BaseResource = class {
|
|
|
247
247
|
const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
|
|
248
248
|
...options,
|
|
249
249
|
headers: {
|
|
250
|
-
...options.body && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
|
|
250
|
+
...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
|
|
251
251
|
...headers,
|
|
252
252
|
...options.headers
|
|
253
253
|
// TODO: Bring this back once we figure out what we/users need to do to make this work with cross-origin requests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.17-alpha.1",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"rxjs": "7.8.1",
|
|
35
35
|
"zod": "^3.25.67",
|
|
36
36
|
"zod-to-json-schema": "^3.24.5",
|
|
37
|
-
"@mastra/core": "0.
|
|
37
|
+
"@mastra/core": "0.12.0-alpha.1"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"zod": "^3.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@babel/preset-env": "^7.
|
|
43
|
+
"@babel/preset-env": "^7.28.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.1",
|
|
45
45
|
"@tsconfig/recommended": "^1.0.9",
|
|
46
46
|
"@types/json-schema": "^7.0.15",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"tsup": "^8.5.0",
|
|
49
49
|
"typescript": "^5.8.3",
|
|
50
50
|
"vitest": "^3.2.4",
|
|
51
|
-
"@internal/lint": "0.0.
|
|
51
|
+
"@internal/lint": "0.0.23"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting",
|
package/src/index.ts
CHANGED
package/src/resources/base.ts
CHANGED
|
@@ -24,7 +24,9 @@ export class BaseResource {
|
|
|
24
24
|
const response = await fetch(`${baseUrl.replace(/\/$/, '')}${path}`, {
|
|
25
25
|
...options,
|
|
26
26
|
headers: {
|
|
27
|
-
...(options.body &&
|
|
27
|
+
...(options.body &&
|
|
28
|
+
!(options.body instanceof FormData) &&
|
|
29
|
+
(options.method === 'POST' || options.method === 'PUT')
|
|
28
30
|
? { 'content-type': 'application/json' }
|
|
29
31
|
: {}),
|
|
30
32
|
...headers,
|
package/src/types.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
PaginationInfo,
|
|
12
12
|
MastraMessageV2,
|
|
13
13
|
} from '@mastra/core';
|
|
14
|
-
import type { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
|
|
14
|
+
import type { AgentGenerateOptions, AgentStreamOptions, ToolsInput, UIMessageWithMetadata } from '@mastra/core/agent';
|
|
15
15
|
import type { BaseLogMessage, LogLevel } from '@mastra/core/logger';
|
|
16
16
|
|
|
17
17
|
import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
|
|
@@ -70,7 +70,7 @@ export interface GetAgentResponse {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
73
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
73
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
74
74
|
output?: T;
|
|
75
75
|
experimental_output?: T;
|
|
76
76
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
@@ -80,7 +80,7 @@ export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undef
|
|
|
80
80
|
>;
|
|
81
81
|
|
|
82
82
|
export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
83
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
83
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
84
84
|
output?: T;
|
|
85
85
|
experimental_output?: T;
|
|
86
86
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
@@ -475,7 +475,7 @@ export interface GetScoresByEntityIdParams {
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
export interface SaveScoreParams {
|
|
478
|
-
score: ScoreRowData
|
|
478
|
+
score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
export interface GetScoresResponse {
|