@mastra/client-js 0.1.22-alpha.2 → 0.1.22-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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +21 -0
- package/dist/index.cjs +7 -2
- package/dist/index.d.cts +16 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +7 -2
- package/package.json +2 -2
- package/src/index.test.ts +30 -0
- package/src/resources/agent.ts +1 -1
- package/src/resources/memory-thread.ts +13 -3
- package/src/types.ts +10 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/client-js@0.1.22-alpha.
|
|
2
|
+
> @mastra/client-js@0.1.22-alpha.4 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[32m38.
|
|
13
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m38.
|
|
15
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m38.52 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 1179ms
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m38.25 KB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 1199ms
|
|
16
16
|
[34mDTS[39m Build start
|
|
17
|
-
[32mDTS[39m ⚡️ Build success in
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m27.
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[32m27.
|
|
17
|
+
[32mDTS[39m ⚡️ Build success in 13527ms
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m27.63 KB[39m
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m27.63 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 0.1.22-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5c70b8a: [MASTRA-3234] added limit for client-js getMessages
|
|
8
|
+
- Updated dependencies [3e9c131]
|
|
9
|
+
- @mastra/core@0.9.4-alpha.4
|
|
10
|
+
|
|
11
|
+
## 0.1.22-alpha.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- c2f9e60: Resolves type issue and listen response string wrapped in text object twice
|
|
16
|
+
- 0c3d117: Add workflows to agent server handlers
|
|
17
|
+
- a5810ce: Add support for experimental_generateMessageId and remove it from client-js types since it's not serializable
|
|
18
|
+
- Updated dependencies [396be50]
|
|
19
|
+
- Updated dependencies [c3bd795]
|
|
20
|
+
- Updated dependencies [da082f8]
|
|
21
|
+
- Updated dependencies [a5810ce]
|
|
22
|
+
- @mastra/core@0.9.4-alpha.3
|
|
23
|
+
|
|
3
24
|
## 0.1.22-alpha.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -500,10 +500,15 @@ var MemoryThread = class extends BaseResource {
|
|
|
500
500
|
}
|
|
501
501
|
/**
|
|
502
502
|
* Retrieves messages associated with the thread
|
|
503
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
503
504
|
* @returns Promise containing thread messages and UI messages
|
|
504
505
|
*/
|
|
505
|
-
getMessages() {
|
|
506
|
-
|
|
506
|
+
getMessages(params) {
|
|
507
|
+
const query = new URLSearchParams({
|
|
508
|
+
agentId: this.agentId,
|
|
509
|
+
...params?.limit ? { limit: params.limit.toString() } : {}
|
|
510
|
+
});
|
|
511
|
+
return this.request(`/api/memory/threads/${this.threadId}/messages?${query.toString()}`);
|
|
507
512
|
}
|
|
508
513
|
};
|
|
509
514
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
4
4
|
import { JSONSchema7 } from 'json-schema';
|
|
5
5
|
import { ZodSchema } from 'zod';
|
|
6
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
@@ -32,15 +32,16 @@ interface GetAgentResponse {
|
|
|
32
32
|
name: string;
|
|
33
33
|
instructions: string;
|
|
34
34
|
tools: Record<string, GetToolResponse>;
|
|
35
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
35
36
|
provider: string;
|
|
36
37
|
modelId: string;
|
|
37
38
|
}
|
|
38
39
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
39
40
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
40
|
-
} & Partial<AgentGenerateOptions<T>>;
|
|
41
|
+
} & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
|
|
41
42
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
42
43
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
43
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
44
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
|
|
44
45
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
45
46
|
evals: any[];
|
|
46
47
|
instructions: string;
|
|
@@ -148,6 +149,12 @@ interface UpdateMemoryThreadParams {
|
|
|
148
149
|
metadata: Record<string, any>;
|
|
149
150
|
resourceId: string;
|
|
150
151
|
}
|
|
152
|
+
interface GetMemoryThreadMessagesParams {
|
|
153
|
+
/**
|
|
154
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
155
|
+
*/
|
|
156
|
+
limit?: number;
|
|
157
|
+
}
|
|
151
158
|
interface GetMemoryThreadMessagesResponse {
|
|
152
159
|
messages: CoreMessage[];
|
|
153
160
|
uiMessages: AiMessageType[];
|
|
@@ -256,7 +263,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
256
263
|
* @param options - Optional provider-specific options
|
|
257
264
|
* @returns Promise containing the transcribed text
|
|
258
265
|
*/
|
|
259
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
266
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
267
|
+
text: string;
|
|
268
|
+
}>;
|
|
260
269
|
/**
|
|
261
270
|
* Get available speakers for the agent's voice provider
|
|
262
271
|
* @returns Promise containing list of available speakers
|
|
@@ -365,9 +374,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
365
374
|
}>;
|
|
366
375
|
/**
|
|
367
376
|
* Retrieves messages associated with the thread
|
|
377
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
368
378
|
* @returns Promise containing thread messages and UI messages
|
|
369
379
|
*/
|
|
370
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
380
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
371
381
|
}
|
|
372
382
|
|
|
373
383
|
declare class Vector extends BaseResource {
|
|
@@ -787,4 +797,4 @@ declare class MastraClient extends BaseResource {
|
|
|
787
797
|
getA2A(agentId: string): A2A;
|
|
788
798
|
}
|
|
789
799
|
|
|
790
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
|
800
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
4
4
|
import { JSONSchema7 } from 'json-schema';
|
|
5
5
|
import { ZodSchema } from 'zod';
|
|
6
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
@@ -32,15 +32,16 @@ interface GetAgentResponse {
|
|
|
32
32
|
name: string;
|
|
33
33
|
instructions: string;
|
|
34
34
|
tools: Record<string, GetToolResponse>;
|
|
35
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
35
36
|
provider: string;
|
|
36
37
|
modelId: string;
|
|
37
38
|
}
|
|
38
39
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
39
40
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
40
|
-
} & Partial<AgentGenerateOptions<T>>;
|
|
41
|
+
} & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
|
|
41
42
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
42
43
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
43
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
44
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
|
|
44
45
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
45
46
|
evals: any[];
|
|
46
47
|
instructions: string;
|
|
@@ -148,6 +149,12 @@ interface UpdateMemoryThreadParams {
|
|
|
148
149
|
metadata: Record<string, any>;
|
|
149
150
|
resourceId: string;
|
|
150
151
|
}
|
|
152
|
+
interface GetMemoryThreadMessagesParams {
|
|
153
|
+
/**
|
|
154
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
155
|
+
*/
|
|
156
|
+
limit?: number;
|
|
157
|
+
}
|
|
151
158
|
interface GetMemoryThreadMessagesResponse {
|
|
152
159
|
messages: CoreMessage[];
|
|
153
160
|
uiMessages: AiMessageType[];
|
|
@@ -256,7 +263,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
256
263
|
* @param options - Optional provider-specific options
|
|
257
264
|
* @returns Promise containing the transcribed text
|
|
258
265
|
*/
|
|
259
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
266
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
267
|
+
text: string;
|
|
268
|
+
}>;
|
|
260
269
|
/**
|
|
261
270
|
* Get available speakers for the agent's voice provider
|
|
262
271
|
* @returns Promise containing list of available speakers
|
|
@@ -365,9 +374,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
365
374
|
}>;
|
|
366
375
|
/**
|
|
367
376
|
* Retrieves messages associated with the thread
|
|
377
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
368
378
|
* @returns Promise containing thread messages and UI messages
|
|
369
379
|
*/
|
|
370
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
380
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
371
381
|
}
|
|
372
382
|
|
|
373
383
|
declare class Vector extends BaseResource {
|
|
@@ -787,4 +797,4 @@ declare class MastraClient extends BaseResource {
|
|
|
787
797
|
getA2A(agentId: string): A2A;
|
|
788
798
|
}
|
|
789
799
|
|
|
790
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
|
800
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|
package/dist/index.js
CHANGED
|
@@ -494,10 +494,15 @@ var MemoryThread = class extends BaseResource {
|
|
|
494
494
|
}
|
|
495
495
|
/**
|
|
496
496
|
* Retrieves messages associated with the thread
|
|
497
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
497
498
|
* @returns Promise containing thread messages and UI messages
|
|
498
499
|
*/
|
|
499
|
-
getMessages() {
|
|
500
|
-
|
|
500
|
+
getMessages(params) {
|
|
501
|
+
const query = new URLSearchParams({
|
|
502
|
+
agentId: this.agentId,
|
|
503
|
+
...params?.limit ? { limit: params.limit.toString() } : {}
|
|
504
|
+
});
|
|
505
|
+
return this.request(`/api/memory/threads/${this.threadId}/messages?${query.toString()}`);
|
|
501
506
|
}
|
|
502
507
|
};
|
|
503
508
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/client-js",
|
|
3
|
-
"version": "0.1.22-alpha.
|
|
3
|
+
"version": "0.1.22-alpha.4",
|
|
4
4
|
"description": "The official TypeScript library for the Mastra Client API",
|
|
5
5
|
"author": "",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"rxjs": "7.8.1",
|
|
29
29
|
"zod": "^3.24.3",
|
|
30
30
|
"zod-to-json-schema": "^3.24.5",
|
|
31
|
-
"@mastra/core": "^0.9.4-alpha.
|
|
31
|
+
"@mastra/core": "^0.9.4-alpha.4"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"zod": "^3.0.0"
|
package/src/index.test.ts
CHANGED
|
@@ -236,6 +236,7 @@ describe('MastraClient Resources', () => {
|
|
|
236
236
|
model: 'gpt-4',
|
|
237
237
|
instructions: 'Test instructions',
|
|
238
238
|
tools: {},
|
|
239
|
+
workflows: {},
|
|
239
240
|
};
|
|
240
241
|
mockFetchResponse(mockResponse);
|
|
241
242
|
|
|
@@ -552,6 +553,35 @@ describe('MastraClient Resources', () => {
|
|
|
552
553
|
}),
|
|
553
554
|
);
|
|
554
555
|
});
|
|
556
|
+
|
|
557
|
+
it('should get thread messages with limit', async () => {
|
|
558
|
+
const mockResponse = {
|
|
559
|
+
messages: [
|
|
560
|
+
{
|
|
561
|
+
id: '1',
|
|
562
|
+
content: 'test',
|
|
563
|
+
threadId,
|
|
564
|
+
role: 'user',
|
|
565
|
+
type: 'text',
|
|
566
|
+
resourceId: 'test-resource',
|
|
567
|
+
createdAt: new Date(),
|
|
568
|
+
},
|
|
569
|
+
],
|
|
570
|
+
uiMessages: [],
|
|
571
|
+
};
|
|
572
|
+
mockFetchResponse(mockResponse);
|
|
573
|
+
|
|
574
|
+
const limit = 5;
|
|
575
|
+
const result = await memoryThread.getMessages({ limit });
|
|
576
|
+
|
|
577
|
+
expect(result).toEqual(mockResponse);
|
|
578
|
+
expect(global.fetch).toHaveBeenCalledWith(
|
|
579
|
+
`${clientOptions.baseUrl}/api/memory/threads/${threadId}/messages?agentId=${agentId}&limit=${limit}`,
|
|
580
|
+
expect.objectContaining({
|
|
581
|
+
headers: expect.objectContaining(clientOptions.headers),
|
|
582
|
+
}),
|
|
583
|
+
);
|
|
584
|
+
});
|
|
555
585
|
});
|
|
556
586
|
|
|
557
587
|
describe('Tool Resource', () => {
|
package/src/resources/agent.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class AgentVoice extends BaseResource {
|
|
|
48
48
|
* @param options - Optional provider-specific options
|
|
49
49
|
* @returns Promise containing the transcribed text
|
|
50
50
|
*/
|
|
51
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
51
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{ text: string }> {
|
|
52
52
|
const formData = new FormData();
|
|
53
53
|
formData.append('audio', audio);
|
|
54
54
|
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { StorageThreadType } from '@mastra/core';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
GetMemoryThreadMessagesResponse,
|
|
5
|
+
ClientOptions,
|
|
6
|
+
UpdateMemoryThreadParams,
|
|
7
|
+
GetMemoryThreadMessagesParams,
|
|
8
|
+
} from '../types';
|
|
4
9
|
|
|
5
10
|
import { BaseResource } from './base';
|
|
6
11
|
|
|
@@ -45,9 +50,14 @@ export class MemoryThread extends BaseResource {
|
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* Retrieves messages associated with the thread
|
|
53
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
48
54
|
* @returns Promise containing thread messages and UI messages
|
|
49
55
|
*/
|
|
50
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse> {
|
|
51
|
-
|
|
56
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse> {
|
|
57
|
+
const query = new URLSearchParams({
|
|
58
|
+
agentId: this.agentId,
|
|
59
|
+
...(params?.limit ? { limit: params.limit.toString() } : {}),
|
|
60
|
+
});
|
|
61
|
+
return this.request(`/api/memory/threads/${this.threadId}/messages?${query.toString()}`);
|
|
52
62
|
}
|
|
53
63
|
}
|
package/src/types.ts
CHANGED
|
@@ -42,17 +42,18 @@ export interface GetAgentResponse {
|
|
|
42
42
|
name: string;
|
|
43
43
|
instructions: string;
|
|
44
44
|
tools: Record<string, GetToolResponse>;
|
|
45
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
45
46
|
provider: string;
|
|
46
47
|
modelId: string;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
50
51
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
51
|
-
} & Partial<AgentGenerateOptions<T>>;
|
|
52
|
+
} & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
|
|
52
53
|
|
|
53
54
|
export type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
54
55
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
55
|
-
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
|
|
56
|
+
} & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
|
|
56
57
|
|
|
57
58
|
export interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
58
59
|
evals: any[];
|
|
@@ -174,6 +175,13 @@ export interface UpdateMemoryThreadParams {
|
|
|
174
175
|
resourceId: string;
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
export interface GetMemoryThreadMessagesParams {
|
|
179
|
+
/**
|
|
180
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
181
|
+
*/
|
|
182
|
+
limit?: number;
|
|
183
|
+
}
|
|
184
|
+
|
|
177
185
|
export interface GetMemoryThreadMessagesResponse {
|
|
178
186
|
messages: CoreMessage[];
|
|
179
187
|
uiMessages: AiMessageType[];
|