@mastra/client-js 0.0.0-fix-model-router-machine-cache-20251021232825 → 0.0.0-fix-memory-search-fetch-20251027160505
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 +57 -3
- package/dist/client.d.ts +8 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +75 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +75 -49
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts +21 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/types.d.ts +31 -51
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/process-mastra-stream.d.ts.map +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,65 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-memory-search-fetch-20251027160505
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Add search memory in client-js ([`121efc8`](https://github.com/mastra-ai/mastra/commit/121efc8af2e65def86434748a158cb086132a0e3))
|
|
12
|
+
|
|
13
|
+
- Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
|
|
14
|
+
|
|
15
|
+
- Fix error handling and serialization in agent streaming to ensure errors are consistently exposed and preserved. ([#9144](https://github.com/mastra-ai/mastra/pull/9144))
|
|
16
|
+
|
|
17
|
+
- Move the enhance instruction fetch call to client-js ([#9302](https://github.com/mastra-ai/mastra/pull/9302))
|
|
18
|
+
|
|
19
|
+
- Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
|
|
20
|
+
- @mastra/core@0.0.0-fix-memory-search-fetch-20251027160505
|
|
21
|
+
|
|
22
|
+
## 0.16.4
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`2b031e2`](https://github.com/mastra-ai/mastra/commit/2b031e25ca10cd3e4d63e6a27f909cba26d91405)]:
|
|
27
|
+
- @mastra/core@0.22.2
|
|
28
|
+
|
|
29
|
+
## 0.16.4-alpha.0
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`2b031e2`](https://github.com/mastra-ai/mastra/commit/2b031e25ca10cd3e4d63e6a27f909cba26d91405)]:
|
|
34
|
+
- @mastra/core@0.22.2-alpha.0
|
|
35
|
+
|
|
36
|
+
## 0.16.3
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies []:
|
|
41
|
+
- @mastra/core@0.22.1
|
|
42
|
+
|
|
43
|
+
## 0.16.3-alpha.0
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies []:
|
|
48
|
+
- @mastra/core@0.22.1-alpha.0
|
|
49
|
+
|
|
50
|
+
## 0.16.2
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Updated dependencies [[`c67ca32`](https://github.com/mastra-ai/mastra/commit/c67ca32e3c2cf69bfc146580770c720220ca44ac), [`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec), [`dbc9e12`](https://github.com/mastra-ai/mastra/commit/dbc9e1216ba575ba59ead4afb727a01215f7de4f), [`99e41b9`](https://github.com/mastra-ai/mastra/commit/99e41b94957cdd25137d3ac12e94e8b21aa01b68), [`c28833c`](https://github.com/mastra-ai/mastra/commit/c28833c5b6d8e10eeffd7f7d39129d53b8bca240), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`ba201b8`](https://github.com/mastra-ai/mastra/commit/ba201b8f8feac4c72350f2dbd52c13c7297ba7b0), [`f053e89`](https://github.com/mastra-ai/mastra/commit/f053e89160dbd0bd3333fc3492f68231b5c7c349), [`4fc4136`](https://github.com/mastra-ai/mastra/commit/4fc413652866a8d2240694fddb2562e9edbb70df), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`d10baf5`](https://github.com/mastra-ai/mastra/commit/d10baf5a3c924f2a6654e23a3e318ed03f189b76), [`038c55a`](https://github.com/mastra-ai/mastra/commit/038c55a7090fc1b1513a966386d3072617f836ac), [`182f045`](https://github.com/mastra-ai/mastra/commit/182f0458f25bd70aa774e64fd923c8a483eddbf1), [`9a1a485`](https://github.com/mastra-ai/mastra/commit/9a1a4859b855e37239f652bf14b1ecd1029b8c4e), [`9257233`](https://github.com/mastra-ai/mastra/commit/9257233c4ffce09b2bedc2a9adbd70d7a83fa8e2), [`7620d2b`](https://github.com/mastra-ai/mastra/commit/7620d2bddeb4fae4c3c0a0b4e672969795fca11a), [`b2365f0`](https://github.com/mastra-ai/mastra/commit/b2365f038dd4c5f06400428b224af963f399ad50), [`0f1a4c9`](https://github.com/mastra-ai/mastra/commit/0f1a4c984fb4b104b2f0b63ba18c9fa77f567700), [`9029ba3`](https://github.com/mastra-ai/mastra/commit/9029ba34459c8859fed4c6b73efd8e2d0021e7ba), [`426cc56`](https://github.com/mastra-ai/mastra/commit/426cc561c85ae76a112ded2385532a91f9f9f074), [`00931fb`](https://github.com/mastra-ai/mastra/commit/00931fb1a21aa42c4fbc20c2c40dd62466b8fc8f), [`e473bfe`](https://github.com/mastra-ai/mastra/commit/e473bfe416c0b8e876973c2b6a6f13c394b7a93f), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`2db6160`](https://github.com/mastra-ai/mastra/commit/2db6160e2022ff8827c15d30157e684683b934b5), [`8aeea37`](https://github.com/mastra-ai/mastra/commit/8aeea37efdde347c635a67fed56794943b7f74ec), [`02fe153`](https://github.com/mastra-ai/mastra/commit/02fe15351d6021d214da48ec982a0e9e4150bcee), [`648e2ca`](https://github.com/mastra-ai/mastra/commit/648e2ca42da54838c6ccbdaadc6fadd808fa6b86), [`74567b3`](https://github.com/mastra-ai/mastra/commit/74567b3d237ae3915cd0bca3cf55fa0a64e4e4a4), [`b65c5e0`](https://github.com/mastra-ai/mastra/commit/b65c5e0fe6f3c390a9a8bbcf69304d972c3a4afb), [`15a1733`](https://github.com/mastra-ai/mastra/commit/15a1733074cee8bd37370e1af34cd818e89fa7ac), [`fc2a774`](https://github.com/mastra-ai/mastra/commit/fc2a77468981aaddc3e77f83f0c4ad4a4af140da), [`4e08933`](https://github.com/mastra-ai/mastra/commit/4e08933625464dfde178347af5b6278fcf34188e)]:
|
|
55
|
+
- @mastra/core@0.22.0
|
|
56
|
+
|
|
57
|
+
## 0.16.2-alpha.1
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
|
6
60
|
|
|
7
|
-
- Updated dependencies [[`
|
|
8
|
-
- @mastra/core@0.
|
|
61
|
+
- Updated dependencies [[`efb5ed9`](https://github.com/mastra-ai/mastra/commit/efb5ed946ae7f410bc68c9430beb4b010afd25ec), [`8ea07b4`](https://github.com/mastra-ai/mastra/commit/8ea07b4bdc73e4218437dbb6dcb0f4b23e745a44), [`ba201b8`](https://github.com/mastra-ai/mastra/commit/ba201b8f8feac4c72350f2dbd52c13c7297ba7b0), [`4fc4136`](https://github.com/mastra-ai/mastra/commit/4fc413652866a8d2240694fddb2562e9edbb70df), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`d10baf5`](https://github.com/mastra-ai/mastra/commit/d10baf5a3c924f2a6654e23a3e318ed03f189b76), [`038c55a`](https://github.com/mastra-ai/mastra/commit/038c55a7090fc1b1513a966386d3072617f836ac), [`182f045`](https://github.com/mastra-ai/mastra/commit/182f0458f25bd70aa774e64fd923c8a483eddbf1), [`7620d2b`](https://github.com/mastra-ai/mastra/commit/7620d2bddeb4fae4c3c0a0b4e672969795fca11a), [`b2365f0`](https://github.com/mastra-ai/mastra/commit/b2365f038dd4c5f06400428b224af963f399ad50), [`9029ba3`](https://github.com/mastra-ai/mastra/commit/9029ba34459c8859fed4c6b73efd8e2d0021e7ba), [`426cc56`](https://github.com/mastra-ai/mastra/commit/426cc561c85ae76a112ded2385532a91f9f9f074), [`00931fb`](https://github.com/mastra-ai/mastra/commit/00931fb1a21aa42c4fbc20c2c40dd62466b8fc8f), [`e473bfe`](https://github.com/mastra-ai/mastra/commit/e473bfe416c0b8e876973c2b6a6f13c394b7a93f), [`b78e04d`](https://github.com/mastra-ai/mastra/commit/b78e04d935a16ecb1e59c5c96e564903527edddd), [`648e2ca`](https://github.com/mastra-ai/mastra/commit/648e2ca42da54838c6ccbdaadc6fadd808fa6b86), [`b65c5e0`](https://github.com/mastra-ai/mastra/commit/b65c5e0fe6f3c390a9a8bbcf69304d972c3a4afb)]:
|
|
62
|
+
- @mastra/core@0.22.0-alpha.1
|
|
9
63
|
|
|
10
64
|
## 0.16.2-alpha.0
|
|
11
65
|
|
package/dist/client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
|
3
3
|
import type { RuntimeContext } from '@mastra/core/runtime-context';
|
|
4
4
|
import { Agent, MemoryThread, Tool, Workflow, Vector, BaseResource, A2A, MCPTool, AgentBuilder } from './resources/index.js';
|
|
5
5
|
import { NetworkMemoryThread } from './resources/network-memory-thread.js';
|
|
6
|
-
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetMemoryThreadParams, GetMemoryThreadResponse,
|
|
6
|
+
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetMemoryThreadParams, GetMemoryThreadResponse, GetToolResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetNetworkMemoryThreadParams, CreateNetworkMemoryThreadParams, SaveNetworkMessageToMemoryParams, GetScorerResponse, GetScoresByScorerIdParams, GetScoresResponse, GetScoresByRunIdParams, GetScoresByEntityIdParams, GetScoresBySpanParams, SaveScoreParams, SaveScoreResponse, GetAITracesResponse, GetMemoryConfigParams, GetMemoryConfigResponse, GetMemoryThreadMessagesResponse, MemorySearchResponse } from './types.js';
|
|
7
7
|
export declare class MastraClient extends BaseResource {
|
|
8
8
|
private observability;
|
|
9
9
|
constructor(options: ClientOptions);
|
|
@@ -157,12 +157,6 @@ export declare class MastraClient extends BaseResource {
|
|
|
157
157
|
getLogTransports(): Promise<{
|
|
158
158
|
transports: string[];
|
|
159
159
|
}>;
|
|
160
|
-
/**
|
|
161
|
-
* List of all traces (paged)
|
|
162
|
-
* @param params - Parameters for filtering traces
|
|
163
|
-
* @returns Promise containing telemetry data
|
|
164
|
-
*/
|
|
165
|
-
getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse>;
|
|
166
160
|
/**
|
|
167
161
|
* Retrieves a list of available MCP servers.
|
|
168
162
|
* @param params - Optional parameters for pagination (limit, offset).
|
|
@@ -213,6 +207,13 @@ export declare class MastraClient extends BaseResource {
|
|
|
213
207
|
threadId: string;
|
|
214
208
|
resourceId?: string;
|
|
215
209
|
}): Promise<unknown>;
|
|
210
|
+
searchMemory({ agentId, resourceId, threadId, searchQuery, memoryConfig, }: {
|
|
211
|
+
agentId: string;
|
|
212
|
+
resourceId: string;
|
|
213
|
+
threadId?: string;
|
|
214
|
+
searchQuery: string;
|
|
215
|
+
memoryConfig?: any;
|
|
216
|
+
}): Promise<MemorySearchResponse>;
|
|
216
217
|
/**
|
|
217
218
|
* Updates the working memory for a specific thread (optionally resource-scoped).
|
|
218
219
|
* @param agentId - ID of the agent.
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAA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,OAAO,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACtD,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAGjD"}
|
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var uiUtils = require('@ai-sdk/ui-utils');
|
|
4
4
|
var uuid = require('@lukeed/uuid');
|
|
5
|
+
var error = require('@mastra/core/error');
|
|
5
6
|
var runtimeContext = require('@mastra/core/runtime-context');
|
|
6
7
|
var isVercelTool = require('@mastra/core/tools/is-vercel-tool');
|
|
7
8
|
var zod = require('zod');
|
|
@@ -100,11 +101,15 @@ async function sharedProcessMastraStream({
|
|
|
100
101
|
console.info("\u{1F3C1} Stream finished");
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
104
|
+
let json;
|
|
103
105
|
try {
|
|
104
|
-
|
|
105
|
-
await onChunk(json);
|
|
106
|
+
json = JSON.parse(data);
|
|
106
107
|
} catch (error) {
|
|
107
108
|
console.error("\u274C JSON parse error:", error, "Data:", data);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (json) {
|
|
112
|
+
await onChunk(json);
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
}
|
|
@@ -323,6 +328,12 @@ var Agent = class extends BaseResource {
|
|
|
323
328
|
details(runtimeContext) {
|
|
324
329
|
return this.request(`/api/agents/${this.agentId}${runtimeContextQueryString(runtimeContext)}`);
|
|
325
330
|
}
|
|
331
|
+
enhanceInstructions(instructions, comment) {
|
|
332
|
+
return this.request(`/api/agents/${this.agentId}/instructions/enhance`, {
|
|
333
|
+
method: "POST",
|
|
334
|
+
body: { instructions, comment }
|
|
335
|
+
});
|
|
336
|
+
}
|
|
326
337
|
async generateLegacy(params) {
|
|
327
338
|
const processedParams = {
|
|
328
339
|
...params,
|
|
@@ -398,7 +409,6 @@ var Agent = class extends BaseResource {
|
|
|
398
409
|
}
|
|
399
410
|
const processedParams = {
|
|
400
411
|
...params,
|
|
401
|
-
output: params.output ? zodToJsonSchema(params.output) : void 0,
|
|
402
412
|
runtimeContext: parseClientRuntimeContext(params.runtimeContext),
|
|
403
413
|
clientTools: processClientTools(params.clientTools),
|
|
404
414
|
structuredOutput: params.structuredOutput ? {
|
|
@@ -951,7 +961,10 @@ var Agent = class extends BaseResource {
|
|
|
951
961
|
break;
|
|
952
962
|
}
|
|
953
963
|
case "error": {
|
|
954
|
-
throw
|
|
964
|
+
throw error.getErrorFromUnknown(chunk.payload.error, {
|
|
965
|
+
fallbackMessage: "Unknown error in stream",
|
|
966
|
+
supportSerialization: false
|
|
967
|
+
});
|
|
955
968
|
}
|
|
956
969
|
case "data": {
|
|
957
970
|
data.push(...chunk.payload.data);
|
|
@@ -978,8 +991,8 @@ var Agent = class extends BaseResource {
|
|
|
978
991
|
});
|
|
979
992
|
onFinish?.({ message, finishReason, usage });
|
|
980
993
|
}
|
|
981
|
-
async processStreamResponse(processedParams, writable) {
|
|
982
|
-
const response = await this.request(`/api/agents/${this.agentId}
|
|
994
|
+
async processStreamResponse(processedParams, writable, route = "stream") {
|
|
995
|
+
const response = await this.request(`/api/agents/${this.agentId}/${route}`, {
|
|
983
996
|
method: "POST",
|
|
984
997
|
body: processedParams,
|
|
985
998
|
stream: true
|
|
@@ -1139,7 +1152,6 @@ var Agent = class extends BaseResource {
|
|
|
1139
1152
|
}
|
|
1140
1153
|
const processedParams = {
|
|
1141
1154
|
...params,
|
|
1142
|
-
output: params.output ? zodToJsonSchema(params.output) : void 0,
|
|
1143
1155
|
runtimeContext: parseClientRuntimeContext(params.runtimeContext),
|
|
1144
1156
|
clientTools: processClientTools(params.clientTools),
|
|
1145
1157
|
structuredOutput: params.structuredOutput ? {
|
|
@@ -1164,6 +1176,42 @@ var Agent = class extends BaseResource {
|
|
|
1164
1176
|
};
|
|
1165
1177
|
return streamResponse;
|
|
1166
1178
|
}
|
|
1179
|
+
async approveToolCall(params) {
|
|
1180
|
+
const { readable, writable } = new TransformStream();
|
|
1181
|
+
const response = await this.processStreamResponse(params, writable, "approve-tool-call");
|
|
1182
|
+
const streamResponse = new Response(readable, {
|
|
1183
|
+
status: response.status,
|
|
1184
|
+
statusText: response.statusText,
|
|
1185
|
+
headers: response.headers
|
|
1186
|
+
});
|
|
1187
|
+
streamResponse.processDataStream = async ({
|
|
1188
|
+
onChunk
|
|
1189
|
+
}) => {
|
|
1190
|
+
await processMastraStream({
|
|
1191
|
+
stream: streamResponse.body,
|
|
1192
|
+
onChunk
|
|
1193
|
+
});
|
|
1194
|
+
};
|
|
1195
|
+
return streamResponse;
|
|
1196
|
+
}
|
|
1197
|
+
async declineToolCall(params) {
|
|
1198
|
+
const { readable, writable } = new TransformStream();
|
|
1199
|
+
const response = await this.processStreamResponse(params, writable, "decline-tool-call");
|
|
1200
|
+
const streamResponse = new Response(readable, {
|
|
1201
|
+
status: response.status,
|
|
1202
|
+
statusText: response.statusText,
|
|
1203
|
+
headers: response.headers
|
|
1204
|
+
});
|
|
1205
|
+
streamResponse.processDataStream = async ({
|
|
1206
|
+
onChunk
|
|
1207
|
+
}) => {
|
|
1208
|
+
await processMastraStream({
|
|
1209
|
+
stream: streamResponse.body,
|
|
1210
|
+
onChunk
|
|
1211
|
+
});
|
|
1212
|
+
};
|
|
1213
|
+
return streamResponse;
|
|
1214
|
+
}
|
|
1167
1215
|
/**
|
|
1168
1216
|
* Processes the stream response and handles tool calls
|
|
1169
1217
|
*/
|
|
@@ -3043,48 +3091,6 @@ var MastraClient = class extends BaseResource {
|
|
|
3043
3091
|
getLogTransports() {
|
|
3044
3092
|
return this.request("/api/logs/transports");
|
|
3045
3093
|
}
|
|
3046
|
-
/**
|
|
3047
|
-
* List of all traces (paged)
|
|
3048
|
-
* @param params - Parameters for filtering traces
|
|
3049
|
-
* @returns Promise containing telemetry data
|
|
3050
|
-
*/
|
|
3051
|
-
getTelemetry(params) {
|
|
3052
|
-
const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
|
|
3053
|
-
const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
|
|
3054
|
-
const searchParams = new URLSearchParams();
|
|
3055
|
-
if (name) {
|
|
3056
|
-
searchParams.set("name", name);
|
|
3057
|
-
}
|
|
3058
|
-
if (scope) {
|
|
3059
|
-
searchParams.set("scope", scope);
|
|
3060
|
-
}
|
|
3061
|
-
if (page) {
|
|
3062
|
-
searchParams.set("page", String(page));
|
|
3063
|
-
}
|
|
3064
|
-
if (perPage) {
|
|
3065
|
-
searchParams.set("perPage", String(perPage));
|
|
3066
|
-
}
|
|
3067
|
-
if (_attribute) {
|
|
3068
|
-
if (Array.isArray(_attribute)) {
|
|
3069
|
-
for (const attr of _attribute) {
|
|
3070
|
-
searchParams.append("attribute", attr);
|
|
3071
|
-
}
|
|
3072
|
-
} else {
|
|
3073
|
-
searchParams.set("attribute", _attribute);
|
|
3074
|
-
}
|
|
3075
|
-
}
|
|
3076
|
-
if (fromDate) {
|
|
3077
|
-
searchParams.set("fromDate", fromDate.toISOString());
|
|
3078
|
-
}
|
|
3079
|
-
if (toDate) {
|
|
3080
|
-
searchParams.set("toDate", toDate.toISOString());
|
|
3081
|
-
}
|
|
3082
|
-
if (searchParams.size) {
|
|
3083
|
-
return this.request(`/api/telemetry?${searchParams}`);
|
|
3084
|
-
} else {
|
|
3085
|
-
return this.request(`/api/telemetry`);
|
|
3086
|
-
}
|
|
3087
|
-
}
|
|
3088
3094
|
/**
|
|
3089
3095
|
* Retrieves a list of available MCP servers.
|
|
3090
3096
|
* @param params - Optional parameters for pagination (limit, offset).
|
|
@@ -3155,6 +3161,26 @@ var MastraClient = class extends BaseResource {
|
|
|
3155
3161
|
}) {
|
|
3156
3162
|
return this.request(`/api/memory/threads/${threadId}/working-memory?agentId=${agentId}&resourceId=${resourceId}`);
|
|
3157
3163
|
}
|
|
3164
|
+
searchMemory({
|
|
3165
|
+
agentId,
|
|
3166
|
+
resourceId,
|
|
3167
|
+
threadId,
|
|
3168
|
+
searchQuery,
|
|
3169
|
+
memoryConfig
|
|
3170
|
+
}) {
|
|
3171
|
+
const params = new URLSearchParams({
|
|
3172
|
+
searchQuery,
|
|
3173
|
+
resourceId,
|
|
3174
|
+
agentId
|
|
3175
|
+
});
|
|
3176
|
+
if (threadId) {
|
|
3177
|
+
params.append("threadId", threadId);
|
|
3178
|
+
}
|
|
3179
|
+
if (memoryConfig) {
|
|
3180
|
+
params.append("memoryConfig", JSON.stringify(memoryConfig));
|
|
3181
|
+
}
|
|
3182
|
+
return this.request(`/api/memory/search?${params}`);
|
|
3183
|
+
}
|
|
3158
3184
|
/**
|
|
3159
3185
|
* Updates the working memory for a specific thread (optionally resource-scoped).
|
|
3160
3186
|
* @param agentId - ID of the agent.
|