@mastra/client-js 0.0.0-ai-v5-20250813235735 → 0.0.0-ai-telementry-ui-20250908100313

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +400 -4
  2. package/README.md +5 -3
  3. package/dist/client.d.ts +16 -6
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/index.cjs +1170 -407
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +1169 -406
  10. package/dist/index.js.map +1 -1
  11. package/dist/resources/agent-builder.d.ts +161 -0
  12. package/dist/resources/agent-builder.d.ts.map +1 -0
  13. package/dist/resources/agent.d.ts +44 -12
  14. package/dist/resources/agent.d.ts.map +1 -1
  15. package/dist/resources/index.d.ts +2 -0
  16. package/dist/resources/index.d.ts.map +1 -1
  17. package/dist/resources/memory-thread.d.ts +1 -1
  18. package/dist/resources/memory-thread.d.ts.map +1 -1
  19. package/dist/resources/network-memory-thread.d.ts +1 -1
  20. package/dist/resources/network-memory-thread.d.ts.map +1 -1
  21. package/dist/resources/network.d.ts +2 -2
  22. package/dist/resources/network.d.ts.map +1 -1
  23. package/dist/resources/observability.d.ts +19 -0
  24. package/dist/resources/observability.d.ts.map +1 -0
  25. package/dist/resources/tool.d.ts.map +1 -1
  26. package/dist/resources/vNextNetwork.d.ts +1 -1
  27. package/dist/resources/vNextNetwork.d.ts.map +1 -1
  28. package/dist/types.d.ts +44 -10
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/utils/process-client-tools.d.ts.map +1 -1
  31. package/dist/utils/process-mastra-stream.d.ts +7 -0
  32. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  33. package/dist/utils/zod-to-json-schema.d.ts +2 -104
  34. package/dist/utils/zod-to-json-schema.d.ts.map +1 -1
  35. package/package.json +24 -16
  36. package/.turbo/turbo-build.log +0 -18
  37. package/dist/adapters/agui.d.ts +0 -22
  38. package/dist/adapters/agui.d.ts.map +0 -1
  39. package/eslint.config.js +0 -6
  40. package/integration-tests/agui-adapter.test.ts +0 -122
  41. package/integration-tests/package.json +0 -17
  42. package/integration-tests/src/mastra/index.ts +0 -38
  43. package/integration-tests/vitest.config.ts +0 -9
  44. package/src/adapters/agui.test.ts +0 -322
  45. package/src/adapters/agui.ts +0 -263
  46. package/src/client.ts +0 -631
  47. package/src/example.ts +0 -95
  48. package/src/index.test.ts +0 -1226
  49. package/src/index.ts +0 -2
  50. package/src/resources/a2a.ts +0 -98
  51. package/src/resources/agent.ts +0 -793
  52. package/src/resources/base.ts +0 -77
  53. package/src/resources/index.ts +0 -10
  54. package/src/resources/legacy-workflow.ts +0 -242
  55. package/src/resources/mcp-tool.ts +0 -48
  56. package/src/resources/memory-thread.test.ts +0 -285
  57. package/src/resources/memory-thread.ts +0 -100
  58. package/src/resources/network-memory-thread.test.ts +0 -269
  59. package/src/resources/network-memory-thread.ts +0 -81
  60. package/src/resources/network.ts +0 -86
  61. package/src/resources/tool.ts +0 -45
  62. package/src/resources/vNextNetwork.ts +0 -194
  63. package/src/resources/vector.ts +0 -83
  64. package/src/resources/workflow.ts +0 -410
  65. package/src/types.ts +0 -506
  66. package/src/utils/index.ts +0 -11
  67. package/src/utils/process-client-tools.ts +0 -32
  68. package/src/utils/zod-to-json-schema.ts +0 -10
  69. package/src/v2-messages.test.ts +0 -180
  70. package/tsconfig.build.json +0 -9
  71. package/tsconfig.json +0 -5
  72. package/tsup.config.ts +0 -17
  73. package/vitest.config.js +0 -8
@@ -1,105 +1,3 @@
1
- import { ZodSchema } from 'zod';
2
- export declare function zodToJsonSchema<T extends ZodSchema | any>(zodSchema: T): T | ({
3
- anyOf: import("zod-to-json-schema").JsonSchema7DateType[];
4
- } & {
5
- title?: string;
6
- default?: any;
7
- description?: string;
8
- markdownDescription?: string;
9
- } & {
10
- $schema?: string | undefined;
11
- definitions?: {
12
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
13
- } | undefined;
14
- }) | ({
15
- type: "object" | "array";
16
- } & {
17
- title?: string;
18
- default?: any;
19
- description?: string;
20
- markdownDescription?: string;
21
- } & {
22
- $schema?: string | undefined;
23
- definitions?: {
24
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
25
- } | undefined;
26
- }) | ({
27
- type: ("string" | "number" | "boolean" | "integer" | "null") | ("string" | "number" | "boolean" | "integer" | "null")[];
28
- } & {
29
- title?: string;
30
- default?: any;
31
- description?: string;
32
- markdownDescription?: string;
33
- } & {
34
- $schema?: string | undefined;
35
- definitions?: {
36
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
37
- } | undefined;
38
- }) | ({
39
- anyOf: import("zod-to-json-schema").JsonSchema7Type[];
40
- } & {
41
- title?: string;
42
- default?: any;
43
- description?: string;
44
- markdownDescription?: string;
45
- } & {
46
- $schema?: string | undefined;
47
- definitions?: {
48
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
49
- } | undefined;
50
- }) | (import("zod-to-json-schema").JsonSchema7UndefinedType & {
51
- title?: string;
52
- default?: any;
53
- description?: string;
54
- markdownDescription?: string;
55
- } & {
56
- $schema?: string | undefined;
57
- definitions?: {
58
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
59
- } | undefined;
60
- }) | (import("zod-to-json-schema").JsonSchema7AnyType & {
61
- title?: string;
62
- default?: any;
63
- description?: string;
64
- markdownDescription?: string;
65
- } & {
66
- $schema?: string | undefined;
67
- definitions?: {
68
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
69
- } | undefined;
70
- }) | ({
71
- anyOf: [import("zod-to-json-schema").JsonSchema7Type, import("zod-to-json-schema").JsonSchema7NullType];
72
- } & {
73
- title?: string;
74
- default?: any;
75
- description?: string;
76
- markdownDescription?: string;
77
- } & {
78
- $schema?: string | undefined;
79
- definitions?: {
80
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
81
- } | undefined;
82
- }) | ({
83
- type: [string, "null"];
84
- } & {
85
- title?: string;
86
- default?: any;
87
- description?: string;
88
- markdownDescription?: string;
89
- } & {
90
- $schema?: string | undefined;
91
- definitions?: {
92
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
93
- } | undefined;
94
- }) | (import("zod-to-json-schema").JsonSchema7AllOfType & {
95
- title?: string;
96
- default?: any;
97
- description?: string;
98
- markdownDescription?: string;
99
- } & {
100
- $schema?: string | undefined;
101
- definitions?: {
102
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
103
- } | undefined;
104
- });
1
+ import type { ZodType } from 'zod';
2
+ export declare function zodToJsonSchema<T extends ZodType | any>(zodSchema: T): any;
105
3
  //# sourceMappingURL=zod-to-json-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../src/utils/zod-to-json-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGhC,wBAAgB,eAAe,CAAC,CAAC,SAAS,SAAS,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMtE"}
1
+ {"version":3,"file":"zod-to-json-schema.d.ts","sourceRoot":"","sources":["../../src/utils/zod-to-json-schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAgBnC,wBAAgB,eAAe,CAAC,CAAC,SAAS,OAAO,GAAG,GAAG,EAAE,SAAS,EAAE,CAAC,OAYpE"}
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.0.0-ai-v5-20250813235735",
3
+ "version": "0.0.0-ai-telementry-ui-20250908100313",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
8
  "main": "dist/index.js",
9
+ "files": [
10
+ "dist",
11
+ "CHANGELOG.md"
12
+ ],
9
13
  "exports": {
10
14
  ".": {
11
15
  "import": {
@@ -21,42 +25,46 @@
21
25
  },
22
26
  "repository": {
23
27
  "type": "git",
24
- "url": "https://github.com/mastra-ai/mastra.git",
28
+ "url": "git+https://github.com/mastra-ai/mastra.git",
25
29
  "directory": "client-sdks/client-js"
26
30
  },
27
- "homepage": "https://github.com/mastra-ai/mastra/tree/main/client-sdks/client-js#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/mastra-ai/mastra/issues"
33
+ },
34
+ "homepage": "https://mastra.ai",
28
35
  "license": "Apache-2.0",
29
36
  "dependencies": {
30
- "@ag-ui/client": "^0.0.35",
37
+ "@ai-sdk/ui-utils": "^1.2.11",
31
38
  "@lukeed/uuid": "^2.0.1",
32
- "ai": "^4.3.19",
33
39
  "json-schema": "^0.4.0",
34
40
  "rxjs": "7.8.1",
35
- "zod": "^3.25.67",
36
- "zod-to-json-schema": "^3.24.5",
37
- "@mastra/core": "0.0.0-ai-v5-20250813235735"
41
+ "zod-to-json-schema": "^3.24.6",
42
+ "@mastra/core": "0.0.0-ai-telementry-ui-20250908100313"
38
43
  },
39
44
  "peerDependencies": {
40
- "zod": "^3.0.0"
45
+ "zod": "^3.25.0 || ^4.0.0"
41
46
  },
42
47
  "devDependencies": {
43
- "@babel/preset-env": "^7.28.0",
48
+ "@babel/preset-env": "^7.28.3",
44
49
  "@babel/preset-typescript": "^7.27.1",
45
- "@tsconfig/recommended": "^1.0.9",
50
+ "@tsconfig/recommended": "^1.0.10",
46
51
  "@types/json-schema": "^7.0.15",
47
52
  "@types/node": "^20.19.0",
53
+ "zod": "^3.25.76",
54
+ "ai": "^4.3.19",
55
+ "eslint": "^9.34.0",
48
56
  "globby": "^14.1.0",
49
57
  "tsup": "^8.5.0",
50
58
  "typescript": "^5.8.3",
51
59
  "vitest": "^3.2.4",
52
- "@internal/lint": "0.0.0-ai-v5-20250813235735",
53
- "@internal/types-builder": "0.0.0-ai-v5-20250813235735"
60
+ "@internal/lint": "0.0.0-ai-telementry-ui-20250908100313",
61
+ "@internal/types-builder": "0.0.0-ai-telementry-ui-20250908100313"
54
62
  },
55
63
  "scripts": {
64
+ "lint": "eslint .",
56
65
  "build": "tsup --config tsup.config.ts",
57
66
  "dev": "pnpm build --watch",
58
- "test": "vitest run && pnpm run test:integration",
59
- "test:unit": "vitest run",
60
- "test:integration": "cd integration-tests && pnpm test"
67
+ "test": "vitest",
68
+ "test:unit": "vitest run"
61
69
  }
62
70
  }
@@ -1,18 +0,0 @@
1
-
2
- > @mastra/client-js@0.10.22-alpha.0 build /home/runner/work/mastra/mastra/client-sdks/client-js
3
- > tsup --config tsup.config.ts
4
-
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.0
8
- CLI Using tsup config: /home/runner/work/mastra/mastra/client-sdks/client-js/tsup.config.ts
9
- CLI Target: es2022
10
- CLI Cleaning output folder
11
- ESM Build start
12
- CJS Build start
13
- ESM dist/index.js 76.67 KB
14
- ESM dist/index.js.map 164.37 KB
15
- ESM ⚡️ Build success in 2116ms
16
- CJS dist/index.cjs 76.97 KB
17
- CJS dist/index.cjs.map 164.54 KB
18
- CJS ⚡️ Build success in 2117ms
@@ -1,22 +0,0 @@
1
- import type { AgentConfig, BaseEvent, Message, RunAgentInput } from '@ag-ui/client';
2
- import { AbstractAgent } from '@ag-ui/client';
3
- import { Observable } from 'rxjs';
4
- import type { Agent } from '../resources/agent.js';
5
- interface MastraAgentConfig extends AgentConfig {
6
- agent: Agent;
7
- agentId: string;
8
- resourceId?: string;
9
- }
10
- export declare class AGUIAdapter extends AbstractAgent {
11
- agent: Agent;
12
- resourceId?: string;
13
- constructor({ agent, agentId, resourceId, ...rest }: MastraAgentConfig);
14
- protected run(input: RunAgentInput): Observable<BaseEvent>;
15
- }
16
- /**
17
- * Generates a UUID v4 that works in both browser and Node.js environments
18
- */
19
- export declare function generateUUID(): string;
20
- export declare function convertMessagesToMastraMessages(messages: Message[]): any[];
21
- export {};
22
- //# sourceMappingURL=agui.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agui.d.ts","sourceRoot":"","sources":["../../src/adapters/agui.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EASd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAa,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,UAAU,iBAAkB,SAAQ,WAAW;IAC7C,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,WAAY,SAAQ,aAAa;IAC5C,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;gBACR,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,iBAAiB;IAStE,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC;CA+G3D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAgCrC;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,GAAG,EAAE,CA2E1E"}
package/eslint.config.js DELETED
@@ -1,6 +0,0 @@
1
- import { createConfig } from '@internal/lint/eslint';
2
-
3
- const config = await createConfig();
4
-
5
- /** @type {import("eslint").Linter.Config[]} */
6
- export default [...config];
@@ -1,122 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { createServer } from 'node:net';
3
- import path from 'node:path';
4
- import type { BaseEvent } from '@ag-ui/client';
5
- import { describe, it, expect, beforeAll, afterAll } from 'vitest';
6
- import { AGUIAdapter } from '../src/adapters/agui';
7
-
8
- // Helper to find an available port
9
- async function getAvailablePort(): Promise<number> {
10
- return new Promise((resolve, reject) => {
11
- const server = createServer();
12
- server.listen(0, () => {
13
- const { port } = server.address() as { port: number };
14
- server.close(() => resolve(port));
15
- });
16
- server.on('error', reject);
17
- });
18
- }
19
-
20
- describe.skip('AGUIAdapter Integration Tests', () => {
21
- let mastraServer: ReturnType<typeof spawn>;
22
- let port: number;
23
-
24
- beforeAll(async () => {
25
- port = await getAvailablePort();
26
-
27
- // Run mastra dev from the integration tests directory using the built CLI
28
- const cliPath = path.resolve(import.meta.dirname, '..', '..', '..', 'packages', 'cli', 'dist', 'index.js');
29
- mastraServer = spawn('node', [cliPath, 'dev', '--port', port.toString()], {
30
- cwd: path.resolve(import.meta.dirname),
31
- stdio: 'pipe',
32
- detached: true, // Run in a new process group so we can kill it and children
33
- });
34
-
35
- // Wait for server to be ready
36
- await new Promise<void>((resolve, reject) => {
37
- let output = '';
38
- mastraServer.stdout?.on('data', data => {
39
- output += data.toString();
40
- console.log(output);
41
- if (output.includes('http://localhost:')) {
42
- resolve();
43
- }
44
- });
45
- mastraServer.stderr?.on('data', data => {
46
- console.error('Mastra server error:', data.toString());
47
- });
48
-
49
- setTimeout(() => reject(new Error('Mastra server failed to start')), 10000);
50
- });
51
- });
52
-
53
- afterAll(() => {
54
- // Kill the server and its process group
55
- if (mastraServer?.pid) {
56
- try {
57
- process.kill(-mastraServer.pid, 'SIGTERM');
58
- } catch (e) {
59
- console.error('Failed to kill Mastra server:', e);
60
- }
61
- }
62
- });
63
-
64
- it('should correctly pass parameters to agent stream method with real server', async () => {
65
- // Create a client agent that communicates with the real server
66
- const { Agent: ClientAgent } = await import('../src/resources/agent');
67
- const clientAgent = new ClientAgent(
68
- {
69
- baseUrl: `http://localhost:${port}`,
70
- apiKey: 'test-key',
71
- },
72
- 'test',
73
- );
74
-
75
- const adapter = new AGUIAdapter({
76
- agent: clientAgent,
77
- agentId: 'test',
78
- resourceId: 'testAgent',
79
- });
80
-
81
- const input = {
82
- threadId: 'test-thread-id',
83
- runId: 'test-run-id',
84
- messages: [
85
- {
86
- id: '1',
87
- role: 'user' as const,
88
- content: 'Hello',
89
- },
90
- ],
91
- tools: [],
92
- context: [],
93
- };
94
-
95
- const observable = adapter['run'](input);
96
- const events: BaseEvent[] = [];
97
-
98
- await new Promise<void>((resolve, reject) => {
99
- observable.subscribe({
100
- next: (event: BaseEvent) => events.push(event),
101
- complete: () => resolve(),
102
- error: (error: any) => reject(error),
103
- });
104
- });
105
-
106
- // Verify we received the expected events
107
- expect(events).toHaveLength(7); // RUN_STARTED, TEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT (x3), TEXT_MESSAGE_END, RUN_FINISHED
108
- expect(events[0].type).toBe('RUN_STARTED');
109
- expect(events[1].type).toBe('TEXT_MESSAGE_START');
110
- expect(events[2].type).toBe('TEXT_MESSAGE_CONTENT');
111
- expect(events[3].type).toBe('TEXT_MESSAGE_CONTENT');
112
- expect(events[4].type).toBe('TEXT_MESSAGE_CONTENT');
113
- expect(events[5].type).toBe('TEXT_MESSAGE_END');
114
- expect(events[6].type).toBe('RUN_FINISHED');
115
-
116
- // Verify the content was streamed correctly
117
- const contentEvents = events.filter(e => e.type === 'TEXT_MESSAGE_CONTENT') as any[];
118
- expect(contentEvents[0].delta).toBe('Hello');
119
- expect(contentEvents[1].delta).toBe(' from');
120
- expect(contentEvents[2].delta).toBe(' agent');
121
- });
122
- });
@@ -1,17 +0,0 @@
1
- {
2
- "name": "@mastra/client-js-integration-tests",
3
- "private": true,
4
- "version": "0.1.0",
5
- "scripts": {
6
- "test": "vitest run",
7
- "test:watch": "vitest"
8
- },
9
- "dependencies": {
10
- "@ag-ui/client": "^0.0.27",
11
- "@mastra/client-js": "workspace:*",
12
- "@mastra/core": "workspace:*"
13
- },
14
- "devDependencies": {
15
- "vitest": "^3.2.4"
16
- }
17
- }
@@ -1,38 +0,0 @@
1
- import { Mastra } from '@mastra/core';
2
- import { Agent } from '@mastra/core/agent';
3
- import { MockLanguageModelV2, simulateReadableStream } from '@mastra/core/test-utils';
4
-
5
- const mockModel = new MockLanguageModelV2({
6
- doStream: async () => ({
7
- stream: simulateReadableStream({
8
- chunks: [
9
- { type: 'text-delta', textDelta: 'Hello' },
10
- { type: 'text-delta', textDelta: ' from' },
11
- { type: 'text-delta', textDelta: ' agent' },
12
- {
13
- type: 'finish',
14
- finishReason: 'stop',
15
- logprobs: undefined,
16
- usage: { completionTokens: 3, promptTokens: 10 },
17
- },
18
- ],
19
- }),
20
- rawCall: { rawPrompt: null, rawSettings: {} },
21
- }),
22
- });
23
-
24
- const testAgent = new Agent({
25
- name: 'test',
26
- instructions: 'You are a test agent',
27
- model: mockModel,
28
- });
29
-
30
- export const mastra = new Mastra({
31
- agents: {
32
- test: testAgent,
33
- },
34
- systemHostname: 'localhost',
35
- aiSdkOptions: {
36
- v4Compat: true,
37
- },
38
- });
@@ -1,9 +0,0 @@
1
- import { defineConfig } from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- globals: true,
6
- testTimeout: 30000, // 30 seconds for integration tests
7
- hookTimeout: 20000, // 20 seconds for setup/teardown
8
- },
9
- });