@mastra/client-js 0.11.3-alpha.3 → 0.11.3-alpha.4
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 +16 -0
- package/dist/client.d.ts +12 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +398 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +398 -4
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +148 -0
- package/dist/resources/agent-builder.d.ts.map +1 -0
- package/dist/resources/agent.d.ts +25 -0
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/types.d.ts +33 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -4
- package/.turbo/turbo-build.log +0 -18
- package/eslint.config.js +0 -11
- package/integration-tests/agui-adapter.test.ts +0 -122
- package/integration-tests/package.json +0 -18
- package/integration-tests/src/mastra/index.ts +0 -35
- package/integration-tests/vitest.config.ts +0 -9
- package/src/adapters/agui.test.ts +0 -293
- package/src/adapters/agui.ts +0 -257
- package/src/client.ts +0 -644
- package/src/example.ts +0 -95
- package/src/index.test.ts +0 -1253
- package/src/index.ts +0 -3
- package/src/resources/a2a.ts +0 -98
- package/src/resources/agent.ts +0 -1460
- package/src/resources/base.ts +0 -77
- package/src/resources/index.ts +0 -11
- package/src/resources/legacy-workflow.ts +0 -242
- package/src/resources/mcp-tool.ts +0 -48
- package/src/resources/memory-thread.test.ts +0 -285
- package/src/resources/memory-thread.ts +0 -99
- package/src/resources/network-memory-thread.test.ts +0 -269
- package/src/resources/network-memory-thread.ts +0 -81
- package/src/resources/network.ts +0 -86
- package/src/resources/observability.ts +0 -53
- package/src/resources/tool.ts +0 -45
- package/src/resources/vNextNetwork.ts +0 -194
- package/src/resources/vector.ts +0 -83
- package/src/resources/workflow.ts +0 -410
- package/src/types.ts +0 -534
- package/src/utils/index.ts +0 -11
- package/src/utils/process-client-tools.ts +0 -32
- package/src/utils/process-mastra-stream.test.ts +0 -353
- package/src/utils/process-mastra-stream.ts +0 -49
- package/src/utils/zod-to-json-schema.ts +0 -30
- package/src/v2-messages.test.ts +0 -180
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- package/vitest.config.js +0 -8
package/src/example.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import z from 'zod';
|
|
2
|
-
import { MastraClient } from './client';
|
|
3
|
-
// import type { WorkflowRunResult } from './types';
|
|
4
|
-
|
|
5
|
-
// Agent
|
|
6
|
-
(async () => {
|
|
7
|
-
const client = new MastraClient({
|
|
8
|
-
baseUrl: 'http://localhost:4111',
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
console.log('Starting agent...');
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const agent = client.getAgent('weatherAgent');
|
|
15
|
-
const response = await agent.stream({
|
|
16
|
-
messages: 'what is the weather in new york?',
|
|
17
|
-
output: z.object({
|
|
18
|
-
weather: z.string(),
|
|
19
|
-
temperature: z.number(),
|
|
20
|
-
humidity: z.number(),
|
|
21
|
-
windSpeed: z.number(),
|
|
22
|
-
windDirection: z.string(),
|
|
23
|
-
windGust: z.number(),
|
|
24
|
-
windChill: z.number(),
|
|
25
|
-
}),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
// Process data stream - unstructured output
|
|
29
|
-
|
|
30
|
-
// response.processDataStream({
|
|
31
|
-
// onTextPart: text => {
|
|
32
|
-
// process.stdout.write(text);
|
|
33
|
-
// },
|
|
34
|
-
// onFilePart: file => {
|
|
35
|
-
// console.log(file);
|
|
36
|
-
// },
|
|
37
|
-
// onDataPart: data => {
|
|
38
|
-
// console.log(data);
|
|
39
|
-
// },
|
|
40
|
-
// onErrorPart: error => {
|
|
41
|
-
// console.error(error);
|
|
42
|
-
// },
|
|
43
|
-
// onToolCallPart(streamPart) {
|
|
44
|
-
// console.log(streamPart);
|
|
45
|
-
// },
|
|
46
|
-
// });
|
|
47
|
-
|
|
48
|
-
// Process text stream - structured output
|
|
49
|
-
|
|
50
|
-
// response.processTextStream({
|
|
51
|
-
// onTextPart: text => {
|
|
52
|
-
// process.stdout.write(text);
|
|
53
|
-
// },
|
|
54
|
-
// });
|
|
55
|
-
|
|
56
|
-
// read the response body directly
|
|
57
|
-
|
|
58
|
-
// const reader = response.body!.getReader();
|
|
59
|
-
// while (true) {
|
|
60
|
-
// const { done, value } = await reader.read();
|
|
61
|
-
// if (done) break;
|
|
62
|
-
// console.log(new TextDecoder().decode(value));
|
|
63
|
-
// }
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.error(error);
|
|
66
|
-
}
|
|
67
|
-
})();
|
|
68
|
-
|
|
69
|
-
// Workflow
|
|
70
|
-
// (async () => {
|
|
71
|
-
// const client = new MastraClient({
|
|
72
|
-
// baseUrl: 'http://localhost:4111',
|
|
73
|
-
// });
|
|
74
|
-
|
|
75
|
-
// try {
|
|
76
|
-
// const workflowId = 'myWorkflow';
|
|
77
|
-
// const workflow = client.getWorkflow(workflowId);
|
|
78
|
-
|
|
79
|
-
// const { runId } = await workflow.createRun();
|
|
80
|
-
|
|
81
|
-
// workflow.watch({ runId }, record => {
|
|
82
|
-
// console.log(new Date().toTimeString(), record);
|
|
83
|
-
// });
|
|
84
|
-
|
|
85
|
-
// await workflow.start({
|
|
86
|
-
// runId,
|
|
87
|
-
// triggerData: {
|
|
88
|
-
// city: 'New York',
|
|
89
|
-
// },
|
|
90
|
-
// });
|
|
91
|
-
|
|
92
|
-
// } catch (e) {
|
|
93
|
-
// console.error('Workflow error:', e);
|
|
94
|
-
// }
|
|
95
|
-
// })();
|