@mastra/client-js 0.0.0-message-list-update-20250715150321 → 0.0.0-message-file-url-handling-fix-20250904234524

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 (81) hide show
  1. package/CHANGELOG.md +795 -3
  2. package/README.md +6 -3
  3. package/dist/client.d.ts +280 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/example.d.ts +2 -0
  6. package/dist/example.d.ts.map +1 -0
  7. package/dist/index.cjs +1627 -701
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.ts +4 -1194
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +1627 -701
  12. package/dist/index.js.map +1 -0
  13. package/dist/resources/a2a.d.ts +41 -0
  14. package/dist/resources/a2a.d.ts.map +1 -0
  15. package/dist/resources/agent-builder.d.ts +161 -0
  16. package/dist/resources/agent-builder.d.ts.map +1 -0
  17. package/dist/resources/agent.d.ts +155 -0
  18. package/dist/resources/agent.d.ts.map +1 -0
  19. package/dist/resources/base.d.ts +13 -0
  20. package/dist/resources/base.d.ts.map +1 -0
  21. package/dist/resources/index.d.ts +13 -0
  22. package/dist/resources/index.d.ts.map +1 -0
  23. package/dist/resources/legacy-workflow.d.ts +87 -0
  24. package/dist/resources/legacy-workflow.d.ts.map +1 -0
  25. package/dist/resources/mcp-tool.d.ts +27 -0
  26. package/dist/resources/mcp-tool.d.ts.map +1 -0
  27. package/dist/resources/memory-thread.d.ts +53 -0
  28. package/dist/resources/memory-thread.d.ts.map +1 -0
  29. package/dist/resources/network-memory-thread.d.ts +47 -0
  30. package/dist/resources/network-memory-thread.d.ts.map +1 -0
  31. package/dist/resources/network.d.ts +30 -0
  32. package/dist/resources/network.d.ts.map +1 -0
  33. package/dist/resources/observability.d.ts +19 -0
  34. package/dist/resources/observability.d.ts.map +1 -0
  35. package/dist/resources/tool.d.ts +23 -0
  36. package/dist/resources/tool.d.ts.map +1 -0
  37. package/dist/resources/vNextNetwork.d.ts +42 -0
  38. package/dist/resources/vNextNetwork.d.ts.map +1 -0
  39. package/dist/resources/vector.d.ts +48 -0
  40. package/dist/resources/vector.d.ts.map +1 -0
  41. package/dist/resources/workflow.d.ts +154 -0
  42. package/dist/resources/workflow.d.ts.map +1 -0
  43. package/dist/types.d.ts +461 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/utils/index.d.ts +3 -0
  46. package/dist/utils/index.d.ts.map +1 -0
  47. package/dist/utils/process-client-tools.d.ts +3 -0
  48. package/dist/utils/process-client-tools.d.ts.map +1 -0
  49. package/dist/utils/process-mastra-stream.d.ts +7 -0
  50. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  51. package/dist/utils/zod-to-json-schema.d.ts +3 -0
  52. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  53. package/package.json +26 -14
  54. package/.turbo/turbo-build.log +0 -19
  55. package/dist/index.d.cts +0 -1194
  56. package/eslint.config.js +0 -6
  57. package/src/adapters/agui.test.ts +0 -180
  58. package/src/adapters/agui.ts +0 -239
  59. package/src/client.ts +0 -526
  60. package/src/example.ts +0 -95
  61. package/src/index.test.ts +0 -830
  62. package/src/index.ts +0 -2
  63. package/src/resources/a2a.ts +0 -88
  64. package/src/resources/agent.ts +0 -800
  65. package/src/resources/base.ts +0 -72
  66. package/src/resources/index.ts +0 -10
  67. package/src/resources/legacy-workflow.ts +0 -242
  68. package/src/resources/mcp-tool.ts +0 -48
  69. package/src/resources/memory-thread.ts +0 -63
  70. package/src/resources/network-memory-thread.ts +0 -63
  71. package/src/resources/network.ts +0 -85
  72. package/src/resources/tool.ts +0 -45
  73. package/src/resources/vNextNetwork.ts +0 -194
  74. package/src/resources/vector.ts +0 -83
  75. package/src/resources/workflow.ts +0 -396
  76. package/src/types.ts +0 -428
  77. package/src/utils/index.ts +0 -11
  78. package/src/utils/process-client-tools.ts +0 -32
  79. package/src/utils/zod-to-json-schema.ts +0 -10
  80. package/tsconfig.json +0 -5
  81. package/vitest.config.js +0 -8
package/src/client.ts DELETED
@@ -1,526 +0,0 @@
1
- import type { AbstractAgent } from '@ag-ui/client';
2
- import type { ServerDetailInfo } from '@mastra/core/mcp';
3
- import { AGUIAdapter } from './adapters/agui';
4
- import {
5
- Agent,
6
- MemoryThread,
7
- Tool,
8
- Workflow,
9
- Vector,
10
- BaseResource,
11
- Network,
12
- A2A,
13
- MCPTool,
14
- LegacyWorkflow,
15
- } from './resources';
16
- import { NetworkMemoryThread } from './resources/network-memory-thread';
17
- import { VNextNetwork } from './resources/vNextNetwork';
18
- import type {
19
- ClientOptions,
20
- CreateMemoryThreadParams,
21
- CreateMemoryThreadResponse,
22
- GetAgentResponse,
23
- GetLogParams,
24
- GetLogsParams,
25
- GetLogsResponse,
26
- GetMemoryThreadParams,
27
- GetMemoryThreadResponse,
28
- GetNetworkResponse,
29
- GetTelemetryParams,
30
- GetTelemetryResponse,
31
- GetToolResponse,
32
- GetWorkflowResponse,
33
- SaveMessageToMemoryParams,
34
- SaveMessageToMemoryResponse,
35
- McpServerListResponse,
36
- McpServerToolListResponse,
37
- GetLegacyWorkflowResponse,
38
- GetVNextNetworkResponse,
39
- GetNetworkMemoryThreadParams,
40
- CreateNetworkMemoryThreadParams,
41
- SaveNetworkMessageToMemoryParams,
42
- } from './types';
43
-
44
- export class MastraClient extends BaseResource {
45
- constructor(options: ClientOptions) {
46
- super(options);
47
- }
48
-
49
- /**
50
- * Retrieves all available agents
51
- * @returns Promise containing map of agent IDs to agent details
52
- */
53
- public getAgents(): Promise<Record<string, GetAgentResponse>> {
54
- return this.request('/api/agents');
55
- }
56
-
57
- public async getAGUI({ resourceId }: { resourceId: string }): Promise<Record<string, AbstractAgent>> {
58
- const agents = await this.getAgents();
59
-
60
- return Object.entries(agents).reduce(
61
- (acc, [agentId]) => {
62
- const agent = this.getAgent(agentId);
63
-
64
- acc[agentId] = new AGUIAdapter({
65
- agentId,
66
- agent,
67
- resourceId,
68
- });
69
-
70
- return acc;
71
- },
72
- {} as Record<string, AbstractAgent>,
73
- );
74
- }
75
-
76
- /**
77
- * Gets an agent instance by ID
78
- * @param agentId - ID of the agent to retrieve
79
- * @returns Agent instance
80
- */
81
- public getAgent(agentId: string) {
82
- return new Agent(this.options, agentId);
83
- }
84
-
85
- /**
86
- * Retrieves memory threads for a resource
87
- * @param params - Parameters containing the resource ID
88
- * @returns Promise containing array of memory threads
89
- */
90
- public getMemoryThreads(params: GetMemoryThreadParams): Promise<GetMemoryThreadResponse> {
91
- return this.request(`/api/memory/threads?resourceid=${params.resourceId}&agentId=${params.agentId}`);
92
- }
93
-
94
- /**
95
- * Creates a new memory thread
96
- * @param params - Parameters for creating the memory thread
97
- * @returns Promise containing the created memory thread
98
- */
99
- public createMemoryThread(params: CreateMemoryThreadParams): Promise<CreateMemoryThreadResponse> {
100
- return this.request(`/api/memory/threads?agentId=${params.agentId}`, { method: 'POST', body: params });
101
- }
102
-
103
- /**
104
- * Gets a memory thread instance by ID
105
- * @param threadId - ID of the memory thread to retrieve
106
- * @returns MemoryThread instance
107
- */
108
- public getMemoryThread(threadId: string, agentId: string) {
109
- return new MemoryThread(this.options, threadId, agentId);
110
- }
111
-
112
- /**
113
- * Saves messages to memory
114
- * @param params - Parameters containing messages to save
115
- * @returns Promise containing the saved messages
116
- */
117
- public saveMessageToMemory(params: SaveMessageToMemoryParams): Promise<SaveMessageToMemoryResponse> {
118
- return this.request(`/api/memory/save-messages?agentId=${params.agentId}`, {
119
- method: 'POST',
120
- body: params,
121
- });
122
- }
123
-
124
- /**
125
- * Gets the status of the memory system
126
- * @returns Promise containing memory system status
127
- */
128
- public getMemoryStatus(agentId: string): Promise<{ result: boolean }> {
129
- return this.request(`/api/memory/status?agentId=${agentId}`);
130
- }
131
-
132
- /**
133
- * Retrieves memory threads for a resource
134
- * @param params - Parameters containing the resource ID
135
- * @returns Promise containing array of memory threads
136
- */
137
- public getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse> {
138
- return this.request(`/api/memory/network/threads?resourceid=${params.resourceId}&networkId=${params.networkId}`);
139
- }
140
-
141
- /**
142
- * Creates a new memory thread
143
- * @param params - Parameters for creating the memory thread
144
- * @returns Promise containing the created memory thread
145
- */
146
- public createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse> {
147
- return this.request(`/api/memory/network/threads?networkId=${params.networkId}`, { method: 'POST', body: params });
148
- }
149
-
150
- /**
151
- * Gets a memory thread instance by ID
152
- * @param threadId - ID of the memory thread to retrieve
153
- * @returns MemoryThread instance
154
- */
155
- public getNetworkMemoryThread(threadId: string, networkId: string) {
156
- return new NetworkMemoryThread(this.options, threadId, networkId);
157
- }
158
-
159
- /**
160
- * Saves messages to memory
161
- * @param params - Parameters containing messages to save
162
- * @returns Promise containing the saved messages
163
- */
164
- public saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse> {
165
- return this.request(`/api/memory/network/save-messages?networkId=${params.networkId}`, {
166
- method: 'POST',
167
- body: params,
168
- });
169
- }
170
-
171
- /**
172
- * Gets the status of the memory system
173
- * @returns Promise containing memory system status
174
- */
175
- public getNetworkMemoryStatus(networkId: string): Promise<{ result: boolean }> {
176
- return this.request(`/api/memory/network/status?networkId=${networkId}`);
177
- }
178
-
179
- /**
180
- * Retrieves all available tools
181
- * @returns Promise containing map of tool IDs to tool details
182
- */
183
- public getTools(): Promise<Record<string, GetToolResponse>> {
184
- return this.request('/api/tools');
185
- }
186
-
187
- /**
188
- * Gets a tool instance by ID
189
- * @param toolId - ID of the tool to retrieve
190
- * @returns Tool instance
191
- */
192
- public getTool(toolId: string) {
193
- return new Tool(this.options, toolId);
194
- }
195
-
196
- /**
197
- * Retrieves all available legacy workflows
198
- * @returns Promise containing map of legacy workflow IDs to legacy workflow details
199
- */
200
- public getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>> {
201
- return this.request('/api/workflows/legacy');
202
- }
203
-
204
- /**
205
- * Gets a legacy workflow instance by ID
206
- * @param workflowId - ID of the legacy workflow to retrieve
207
- * @returns Legacy Workflow instance
208
- */
209
- public getLegacyWorkflow(workflowId: string) {
210
- return new LegacyWorkflow(this.options, workflowId);
211
- }
212
-
213
- /**
214
- * Retrieves all available workflows
215
- * @returns Promise containing map of workflow IDs to workflow details
216
- */
217
- public getWorkflows(): Promise<Record<string, GetWorkflowResponse>> {
218
- return this.request('/api/workflows');
219
- }
220
-
221
- /**
222
- * Gets a workflow instance by ID
223
- * @param workflowId - ID of the workflow to retrieve
224
- * @returns Workflow instance
225
- */
226
- public getWorkflow(workflowId: string) {
227
- return new Workflow(this.options, workflowId);
228
- }
229
-
230
- /**
231
- * Gets a vector instance by name
232
- * @param vectorName - Name of the vector to retrieve
233
- * @returns Vector instance
234
- */
235
- public getVector(vectorName: string) {
236
- return new Vector(this.options, vectorName);
237
- }
238
-
239
- /**
240
- * Retrieves logs
241
- * @param params - Parameters for filtering logs
242
- * @returns Promise containing array of log messages
243
- */
244
- public getLogs(params: GetLogsParams): Promise<GetLogsResponse> {
245
- const { transportId, fromDate, toDate, logLevel, filters, page, perPage } = params;
246
- const _filters = filters ? Object.entries(filters).map(([key, value]) => `${key}:${value}`) : [];
247
-
248
- const searchParams = new URLSearchParams();
249
- if (transportId) {
250
- searchParams.set('transportId', transportId);
251
- }
252
- if (fromDate) {
253
- searchParams.set('fromDate', fromDate.toISOString());
254
- }
255
- if (toDate) {
256
- searchParams.set('toDate', toDate.toISOString());
257
- }
258
- if (logLevel) {
259
- searchParams.set('logLevel', logLevel);
260
- }
261
- if (page) {
262
- searchParams.set('page', String(page));
263
- }
264
- if (perPage) {
265
- searchParams.set('perPage', String(perPage));
266
- }
267
- if (_filters) {
268
- if (Array.isArray(_filters)) {
269
- for (const filter of _filters) {
270
- searchParams.append('filters', filter);
271
- }
272
- } else {
273
- searchParams.set('filters', _filters);
274
- }
275
- }
276
-
277
- if (searchParams.size) {
278
- return this.request(`/api/logs?${searchParams}`);
279
- } else {
280
- return this.request(`/api/logs`);
281
- }
282
- }
283
-
284
- /**
285
- * Gets logs for a specific run
286
- * @param params - Parameters containing run ID to retrieve
287
- * @returns Promise containing array of log messages
288
- */
289
- public getLogForRun(params: GetLogParams): Promise<GetLogsResponse> {
290
- const { runId, transportId, fromDate, toDate, logLevel, filters, page, perPage } = params;
291
-
292
- const _filters = filters ? Object.entries(filters).map(([key, value]) => `${key}:${value}`) : [];
293
- const searchParams = new URLSearchParams();
294
- if (runId) {
295
- searchParams.set('runId', runId);
296
- }
297
- if (transportId) {
298
- searchParams.set('transportId', transportId);
299
- }
300
- if (fromDate) {
301
- searchParams.set('fromDate', fromDate.toISOString());
302
- }
303
- if (toDate) {
304
- searchParams.set('toDate', toDate.toISOString());
305
- }
306
- if (logLevel) {
307
- searchParams.set('logLevel', logLevel);
308
- }
309
- if (page) {
310
- searchParams.set('page', String(page));
311
- }
312
- if (perPage) {
313
- searchParams.set('perPage', String(perPage));
314
- }
315
-
316
- if (_filters) {
317
- if (Array.isArray(_filters)) {
318
- for (const filter of _filters) {
319
- searchParams.append('filters', filter);
320
- }
321
- } else {
322
- searchParams.set('filters', _filters);
323
- }
324
- }
325
-
326
- if (searchParams.size) {
327
- return this.request(`/api/logs/${runId}?${searchParams}`);
328
- } else {
329
- return this.request(`/api/logs/${runId}`);
330
- }
331
- }
332
-
333
- /**
334
- * List of all log transports
335
- * @returns Promise containing list of log transports
336
- */
337
- public getLogTransports(): Promise<{ transports: string[] }> {
338
- return this.request('/api/logs/transports');
339
- }
340
-
341
- /**
342
- * List of all traces (paged)
343
- * @param params - Parameters for filtering traces
344
- * @returns Promise containing telemetry data
345
- */
346
- public getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse> {
347
- const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
348
- const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
349
-
350
- const searchParams = new URLSearchParams();
351
- if (name) {
352
- searchParams.set('name', name);
353
- }
354
- if (scope) {
355
- searchParams.set('scope', scope);
356
- }
357
- if (page) {
358
- searchParams.set('page', String(page));
359
- }
360
- if (perPage) {
361
- searchParams.set('perPage', String(perPage));
362
- }
363
- if (_attribute) {
364
- if (Array.isArray(_attribute)) {
365
- for (const attr of _attribute) {
366
- searchParams.append('attribute', attr);
367
- }
368
- } else {
369
- searchParams.set('attribute', _attribute);
370
- }
371
- }
372
- if (fromDate) {
373
- searchParams.set('fromDate', fromDate.toISOString());
374
- }
375
- if (toDate) {
376
- searchParams.set('toDate', toDate.toISOString());
377
- }
378
-
379
- if (searchParams.size) {
380
- return this.request(`/api/telemetry?${searchParams}`);
381
- } else {
382
- return this.request(`/api/telemetry`);
383
- }
384
- }
385
-
386
- /**
387
- * Retrieves all available networks
388
- * @returns Promise containing map of network IDs to network details
389
- */
390
- public getNetworks(): Promise<Array<GetNetworkResponse>> {
391
- return this.request('/api/networks');
392
- }
393
-
394
- /**
395
- * Retrieves all available vNext networks
396
- * @returns Promise containing map of vNext network IDs to vNext network details
397
- */
398
- public getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>> {
399
- return this.request('/api/networks/v-next');
400
- }
401
-
402
- /**
403
- * Gets a network instance by ID
404
- * @param networkId - ID of the network to retrieve
405
- * @returns Network instance
406
- */
407
- public getNetwork(networkId: string) {
408
- return new Network(this.options, networkId);
409
- }
410
-
411
- /**
412
- * Gets a vNext network instance by ID
413
- * @param networkId - ID of the vNext network to retrieve
414
- * @returns vNext Network instance
415
- */
416
- public getVNextNetwork(networkId: string) {
417
- return new VNextNetwork(this.options, networkId);
418
- }
419
-
420
- /**
421
- * Retrieves a list of available MCP servers.
422
- * @param params - Optional parameters for pagination (limit, offset).
423
- * @returns Promise containing the list of MCP servers and pagination info.
424
- */
425
- public getMcpServers(params?: { limit?: number; offset?: number }): Promise<McpServerListResponse> {
426
- const searchParams = new URLSearchParams();
427
- if (params?.limit !== undefined) {
428
- searchParams.set('limit', String(params.limit));
429
- }
430
- if (params?.offset !== undefined) {
431
- searchParams.set('offset', String(params.offset));
432
- }
433
- const queryString = searchParams.toString();
434
- return this.request(`/api/mcp/v0/servers${queryString ? `?${queryString}` : ''}`);
435
- }
436
-
437
- /**
438
- * Retrieves detailed information for a specific MCP server.
439
- * @param serverId - The ID of the MCP server to retrieve.
440
- * @param params - Optional parameters, e.g., specific version.
441
- * @returns Promise containing the detailed MCP server information.
442
- */
443
- public getMcpServerDetails(serverId: string, params?: { version?: string }): Promise<ServerDetailInfo> {
444
- const searchParams = new URLSearchParams();
445
- if (params?.version) {
446
- searchParams.set('version', params.version);
447
- }
448
- const queryString = searchParams.toString();
449
- return this.request(`/api/mcp/v0/servers/${serverId}${queryString ? `?${queryString}` : ''}`);
450
- }
451
-
452
- /**
453
- * Retrieves a list of tools for a specific MCP server.
454
- * @param serverId - The ID of the MCP server.
455
- * @returns Promise containing the list of tools.
456
- */
457
- public getMcpServerTools(serverId: string): Promise<McpServerToolListResponse> {
458
- return this.request(`/api/mcp/${serverId}/tools`);
459
- }
460
-
461
- /**
462
- * Gets an MCPTool resource instance for a specific tool on an MCP server.
463
- * This instance can then be used to fetch details or execute the tool.
464
- * @param serverId - The ID of the MCP server.
465
- * @param toolId - The ID of the tool.
466
- * @returns MCPTool instance.
467
- */
468
- public getMcpServerTool(serverId: string, toolId: string): MCPTool {
469
- return new MCPTool(this.options, serverId, toolId);
470
- }
471
-
472
- /**
473
- * Gets an A2A client for interacting with an agent via the A2A protocol
474
- * @param agentId - ID of the agent to interact with
475
- * @returns A2A client instance
476
- */
477
- public getA2A(agentId: string) {
478
- return new A2A(this.options, agentId);
479
- }
480
-
481
- /**
482
- * Retrieves the working memory for a specific thread (optionally resource-scoped).
483
- * @param agentId - ID of the agent.
484
- * @param threadId - ID of the thread.
485
- * @param resourceId - Optional ID of the resource.
486
- * @returns Working memory for the specified thread or resource.
487
- */
488
- public getWorkingMemory({
489
- agentId,
490
- threadId,
491
- resourceId,
492
- }: {
493
- agentId: string;
494
- threadId: string;
495
- resourceId?: string;
496
- }) {
497
- return this.request(`/api/memory/threads/${threadId}/working-memory?agentId=${agentId}&resourceId=${resourceId}`);
498
- }
499
-
500
- /**
501
- * Updates the working memory for a specific thread (optionally resource-scoped).
502
- * @param agentId - ID of the agent.
503
- * @param threadId - ID of the thread.
504
- * @param workingMemory - The new working memory content.
505
- * @param resourceId - Optional ID of the resource.
506
- */
507
- public updateWorkingMemory({
508
- agentId,
509
- threadId,
510
- workingMemory,
511
- resourceId,
512
- }: {
513
- agentId: string;
514
- threadId: string;
515
- workingMemory: string;
516
- resourceId?: string;
517
- }) {
518
- return this.request(`/api/memory/threads/${threadId}/working-memory?agentId=${agentId}`, {
519
- method: 'POST',
520
- body: {
521
- workingMemory,
522
- resourceId,
523
- },
524
- });
525
- }
526
- }
package/src/example.ts DELETED
@@ -1,95 +0,0 @@
1
- import { MastraClient } from './client';
2
- import z from 'zod';
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
- // })();