@mastra/client-js 0.0.0-transpile-packages-20250724123433 → 0.0.0-transpile-packages-20250730132657
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 +64 -2
- package/dist/index.cjs +304 -248
- package/dist/index.d.cts +93 -18
- package/dist/index.d.ts +93 -18
- package/dist/index.js +304 -248
- package/package.json +3 -3
- package/src/client.ts +97 -0
- package/src/index.test.ts +241 -1
- package/src/resources/agent.ts +272 -297
- package/src/resources/base.ts +3 -1
- package/src/resources/network.ts +4 -3
- package/src/types.ts +55 -0
- package/src/utils/process-client-tools.ts +1 -1
- package/.turbo/turbo-build.log +0 -19
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/resources/network.ts
CHANGED
|
@@ -28,9 +28,10 @@ export class Network extends BaseResource {
|
|
|
28
28
|
* @param params - Generation parameters including prompt
|
|
29
29
|
* @returns Promise containing the generated response
|
|
30
30
|
*/
|
|
31
|
-
generate<
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
generate<
|
|
32
|
+
Output extends JSONSchema7 | ZodSchema | undefined = undefined,
|
|
33
|
+
StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined,
|
|
34
|
+
>(params: GenerateParams<Output>): Promise<GenerateReturn<any, Output, StructuredOutput>> {
|
|
34
35
|
const processedParams = {
|
|
35
36
|
...params,
|
|
36
37
|
output: zodToJsonSchema(params.output),
|
package/src/types.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type { BaseLogMessage, LogLevel } from '@mastra/core/logger';
|
|
|
16
16
|
|
|
17
17
|
import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
|
|
18
18
|
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
19
|
+
import type { MastraScorer, MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
|
|
19
20
|
import type { Workflow, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
|
|
20
21
|
import type {
|
|
21
22
|
StepAction,
|
|
@@ -445,3 +446,57 @@ export interface McpToolInfo {
|
|
|
445
446
|
export interface McpServerToolListResponse {
|
|
446
447
|
tools: McpToolInfo[];
|
|
447
448
|
}
|
|
449
|
+
|
|
450
|
+
export type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
|
|
451
|
+
createdAt: string;
|
|
452
|
+
updatedAt: string;
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
// Scores-related types
|
|
456
|
+
export interface GetScoresByRunIdParams {
|
|
457
|
+
runId: string;
|
|
458
|
+
page?: number;
|
|
459
|
+
perPage?: number;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface GetScoresByScorerIdParams {
|
|
463
|
+
scorerId: string;
|
|
464
|
+
entityId?: string;
|
|
465
|
+
entityType?: string;
|
|
466
|
+
page?: number;
|
|
467
|
+
perPage?: number;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export interface GetScoresByEntityIdParams {
|
|
471
|
+
entityId: string;
|
|
472
|
+
entityType: string;
|
|
473
|
+
page?: number;
|
|
474
|
+
perPage?: number;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export interface SaveScoreParams {
|
|
478
|
+
score: ScoreRowData;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export interface GetScoresResponse {
|
|
482
|
+
pagination: {
|
|
483
|
+
total: number;
|
|
484
|
+
page: number;
|
|
485
|
+
perPage: number;
|
|
486
|
+
hasMore: boolean;
|
|
487
|
+
};
|
|
488
|
+
scores: ClientScoreRowData[];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface SaveScoreResponse {
|
|
492
|
+
score: ClientScoreRowData;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export type GetScorerResponse = MastraScorerEntry & {
|
|
496
|
+
agentIds: string[];
|
|
497
|
+
workflowIds: string[];
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
export interface GetScorersResponse {
|
|
501
|
+
scorers: Array<GetScorerResponse>;
|
|
502
|
+
}
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @mastra/client-js@0.10.15-alpha.1 build /home/runner/work/mastra/mastra/client-sdks/client-js
|
|
3
|
-
> tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting
|
|
4
|
-
|
|
5
|
-
[34mCLI[39m Building entry: src/index.ts
|
|
6
|
-
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.5.0
|
|
8
|
-
[34mCLI[39m Target: es2022
|
|
9
|
-
[34mCLI[39m Cleaning output folder
|
|
10
|
-
[34mESM[39m Build start
|
|
11
|
-
[34mCJS[39m Build start
|
|
12
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m72.52 KB[39m
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in 2114ms
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m72.22 KB[39m
|
|
15
|
-
[32mESM[39m ⚡️ Build success in 2121ms
|
|
16
|
-
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in 18228ms
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m43.48 KB[39m
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m43.48 KB[39m
|