@mastra/client-js 1.18.0-alpha.9 → 1.18.1-alpha.0
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 +292 -0
- package/dist/_types/@internal_ai-sdk-v5/dist/index.d.ts +9 -12
- package/dist/client.d.ts +7 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-signals.md +151 -0
- package/dist/docs/references/reference-client-js-agents.md +89 -0
- package/dist/index.cjs +117 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +116 -73
- package/dist/index.js.map +1 -1
- package/dist/resources/a2a.d.ts +1 -1
- package/dist/resources/a2a.d.ts.map +1 -1
- package/dist/resources/agent-builder.d.ts +1 -1
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +16 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/mcp-tool.d.ts.map +1 -1
- package/dist/resources/memory-thread.d.ts +27 -7
- package/dist/resources/memory-thread.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +2154 -778
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +31 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/process-a2a-stream.d.ts +1 -1
- package/dist/utils/process-a2a-stream.d.ts.map +1 -1
- package/dist/utils/process-mastra-stream.d.ts +4 -2
- package/dist/utils/process-mastra-stream.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { standardSchemaToJSONSchema, toStandardSchema } from '@mastra/schema-com
|
|
|
5
5
|
import { RequestContext } from '@mastra/core/request-context';
|
|
6
6
|
export { RequestContext } from '@mastra/core/request-context';
|
|
7
7
|
import { zodToJsonSchema as zodToJsonSchema$1 } from '@mastra/schema-compat/zod-to-json';
|
|
8
|
-
import { MastraA2AError } from '@mastra/core/a2a';
|
|
8
|
+
import { MastraA2AError } from '@mastra/core/a2a/client';
|
|
9
9
|
import canonicalize from 'canonicalize';
|
|
10
10
|
import { base64url, decodeProtectedHeader, compactVerify, importX509, importSPKI, importJWK } from 'jose';
|
|
11
11
|
|
|
@@ -130,11 +130,15 @@ function processClientTools(clientTools) {
|
|
|
130
130
|
// src/utils/process-mastra-stream.ts
|
|
131
131
|
async function sharedProcessMastraStream({
|
|
132
132
|
stream,
|
|
133
|
-
onChunk
|
|
133
|
+
onChunk,
|
|
134
|
+
signal
|
|
134
135
|
}) {
|
|
135
136
|
const reader = stream.getReader();
|
|
136
137
|
const decoder = new TextDecoder();
|
|
137
138
|
let buffer = "";
|
|
139
|
+
const abort = () => void reader.cancel();
|
|
140
|
+
if (signal?.aborted) abort();
|
|
141
|
+
else signal?.addEventListener("abort", abort, { once: true });
|
|
138
142
|
try {
|
|
139
143
|
while (true) {
|
|
140
144
|
const { done, value } = await reader.read();
|
|
@@ -162,25 +166,30 @@ async function sharedProcessMastraStream({
|
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
} finally {
|
|
169
|
+
signal?.removeEventListener("abort", abort);
|
|
165
170
|
reader.releaseLock();
|
|
166
171
|
}
|
|
167
172
|
}
|
|
168
173
|
async function processMastraNetworkStream({
|
|
169
174
|
stream,
|
|
170
|
-
onChunk
|
|
175
|
+
onChunk,
|
|
176
|
+
signal
|
|
171
177
|
}) {
|
|
172
178
|
return sharedProcessMastraStream({
|
|
173
179
|
stream,
|
|
174
|
-
onChunk
|
|
180
|
+
onChunk,
|
|
181
|
+
signal
|
|
175
182
|
});
|
|
176
183
|
}
|
|
177
184
|
async function processMastraStream({
|
|
178
185
|
stream,
|
|
179
|
-
onChunk
|
|
186
|
+
onChunk,
|
|
187
|
+
signal
|
|
180
188
|
}) {
|
|
181
189
|
return sharedProcessMastraStream({
|
|
182
190
|
stream,
|
|
183
|
-
onChunk
|
|
191
|
+
onChunk,
|
|
192
|
+
signal
|
|
184
193
|
});
|
|
185
194
|
}
|
|
186
195
|
|
|
@@ -343,8 +352,6 @@ var AgentVoice = class extends BaseResource {
|
|
|
343
352
|
this.version = version;
|
|
344
353
|
this.agentId = agentId;
|
|
345
354
|
}
|
|
346
|
-
agentId;
|
|
347
|
-
version;
|
|
348
355
|
getQueryString(requestContext, delimiter = "?") {
|
|
349
356
|
const searchParams = new URLSearchParams(requestContextQueryString(requestContext).slice(1));
|
|
350
357
|
if (this.version) {
|
|
@@ -414,8 +421,6 @@ var Agent = class extends BaseResource {
|
|
|
414
421
|
this.version = version;
|
|
415
422
|
this.voice = new AgentVoice(options, this.agentId, this.version);
|
|
416
423
|
}
|
|
417
|
-
agentId;
|
|
418
|
-
version;
|
|
419
424
|
voice;
|
|
420
425
|
getQueryString(requestContext, delimiter = "?") {
|
|
421
426
|
const searchParams = new URLSearchParams(requestContextQueryString(requestContext).slice(1));
|
|
@@ -441,6 +446,38 @@ var Agent = class extends BaseResource {
|
|
|
441
446
|
body: { instructions, comment }
|
|
442
447
|
});
|
|
443
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* @experimental Agent signals are experimental and may change in a future release.
|
|
451
|
+
*/
|
|
452
|
+
sendSignal(params) {
|
|
453
|
+
return this.request(`/agents/${this.agentId}/signals`, {
|
|
454
|
+
method: "POST",
|
|
455
|
+
body: params
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* @experimental Agent signals are experimental and may change in a future release.
|
|
460
|
+
*/
|
|
461
|
+
async subscribeToThread(params) {
|
|
462
|
+
const streamResponse = await this.request(`/agents/${this.agentId}/threads/subscribe`, {
|
|
463
|
+
method: "POST",
|
|
464
|
+
body: params,
|
|
465
|
+
stream: true
|
|
466
|
+
});
|
|
467
|
+
if (!streamResponse.body) {
|
|
468
|
+
throw new Error("No response body");
|
|
469
|
+
}
|
|
470
|
+
streamResponse.processDataStream = async ({
|
|
471
|
+
onChunk
|
|
472
|
+
}) => {
|
|
473
|
+
await processMastraStream({
|
|
474
|
+
stream: streamResponse.body,
|
|
475
|
+
onChunk,
|
|
476
|
+
signal: this.options.abortSignal
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
return streamResponse;
|
|
480
|
+
}
|
|
444
481
|
/**
|
|
445
482
|
* Clones this agent to a new stored agent in the database
|
|
446
483
|
* @param params - Clone parameters including optional newId, newName, metadata, authorId, and requestContext
|
|
@@ -1900,13 +1937,25 @@ var MemoryThread = class extends BaseResource {
|
|
|
1900
1937
|
this.threadId = threadId;
|
|
1901
1938
|
this.agentId = agentId;
|
|
1902
1939
|
}
|
|
1903
|
-
threadId;
|
|
1904
|
-
agentId;
|
|
1905
1940
|
/**
|
|
1906
1941
|
* Builds the query string for agentId (if provided)
|
|
1907
1942
|
*/
|
|
1908
|
-
getAgentIdQueryParam(prefix = "?") {
|
|
1909
|
-
|
|
1943
|
+
getAgentIdQueryParam(prefix = "?", overrideAgentId) {
|
|
1944
|
+
const agentId = overrideAgentId ?? this.agentId;
|
|
1945
|
+
return agentId ? `${prefix}agentId=${agentId}` : "";
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Resolves the agentId to use for a write request. Prefers the per-call value, falls back
|
|
1949
|
+
* to the constructor value, and throws if neither is set.
|
|
1950
|
+
*/
|
|
1951
|
+
requireAgentId(perCallAgentId, methodName) {
|
|
1952
|
+
const agentId = perCallAgentId ?? this.agentId;
|
|
1953
|
+
if (!agentId) {
|
|
1954
|
+
throw new Error(
|
|
1955
|
+
`MemoryThread.${methodName}() requires an agentId. Pass it via getMemoryThread({ threadId, agentId }) or as a parameter to ${methodName}().`
|
|
1956
|
+
);
|
|
1957
|
+
}
|
|
1958
|
+
return agentId;
|
|
1910
1959
|
}
|
|
1911
1960
|
/**
|
|
1912
1961
|
* Retrieves the memory thread details
|
|
@@ -1920,25 +1969,30 @@ var MemoryThread = class extends BaseResource {
|
|
|
1920
1969
|
}
|
|
1921
1970
|
/**
|
|
1922
1971
|
* Updates the memory thread properties
|
|
1923
|
-
* @param params - Update parameters including title, metadata, and optional request context
|
|
1972
|
+
* @param params - Update parameters including title, metadata, and optional request context.
|
|
1973
|
+
* `agentId` is required by the server; pass it here if not supplied on the constructor.
|
|
1924
1974
|
* @returns Promise containing updated thread details
|
|
1925
1975
|
*/
|
|
1926
1976
|
update(params) {
|
|
1927
|
-
const
|
|
1928
|
-
const
|
|
1977
|
+
const agentId = this.requireAgentId(params.agentId, "update");
|
|
1978
|
+
const { agentId: _omitAgentId, requestContext, ...body } = params;
|
|
1979
|
+
const agentIdParam = `?agentId=${agentId}`;
|
|
1980
|
+
const contextParam = requestContextQueryString(requestContext, "&");
|
|
1929
1981
|
return this.request(`/memory/threads/${this.threadId}${agentIdParam}${contextParam}`, {
|
|
1930
1982
|
method: "PATCH",
|
|
1931
|
-
body
|
|
1983
|
+
body
|
|
1932
1984
|
});
|
|
1933
1985
|
}
|
|
1934
1986
|
/**
|
|
1935
1987
|
* Deletes the memory thread
|
|
1936
|
-
* @param
|
|
1988
|
+
* @param opts - Optional `agentId` (required by the server when not supplied on the constructor)
|
|
1989
|
+
* and request context.
|
|
1937
1990
|
* @returns Promise containing deletion result
|
|
1938
1991
|
*/
|
|
1939
|
-
delete(
|
|
1940
|
-
const
|
|
1941
|
-
const
|
|
1992
|
+
delete(opts = {}) {
|
|
1993
|
+
const agentId = this.requireAgentId(opts.agentId, "delete");
|
|
1994
|
+
const agentIdParam = `?agentId=${agentId}`;
|
|
1995
|
+
const contextParam = requestContextQueryString(opts.requestContext, "&");
|
|
1942
1996
|
return this.request(`/memory/threads/${this.threadId}${agentIdParam}${contextParam}`, {
|
|
1943
1997
|
method: "DELETE"
|
|
1944
1998
|
});
|
|
@@ -1968,37 +2022,46 @@ var MemoryThread = class extends BaseResource {
|
|
|
1968
2022
|
* Deletes one or more messages from the thread
|
|
1969
2023
|
* @param messageIds - Can be a single message ID (string), array of message IDs,
|
|
1970
2024
|
* message object with id property, or array of message objects
|
|
1971
|
-
* @param
|
|
2025
|
+
* @param opts - Optional `agentId` (required by the server when not supplied on the constructor)
|
|
2026
|
+
* and request context. For backwards compatibility a `RequestContext` may also be
|
|
2027
|
+
* passed directly as the second argument.
|
|
1972
2028
|
* @returns Promise containing deletion result
|
|
1973
2029
|
*/
|
|
1974
|
-
deleteMessages(messageIds,
|
|
1975
|
-
const
|
|
1976
|
-
|
|
1977
|
-
const
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
method: "POST",
|
|
1983
|
-
body: { messageIds }
|
|
1984
|
-
}
|
|
1985
|
-
);
|
|
2030
|
+
deleteMessages(messageIds, opts = {}) {
|
|
2031
|
+
const { agentId: explicitAgentId, requestContext } = normalizeWriteOpts(opts);
|
|
2032
|
+
const agentId = this.requireAgentId(explicitAgentId, "deleteMessages");
|
|
2033
|
+
const queryString = `agentId=${agentId}`;
|
|
2034
|
+
return this.request(`/memory/messages/delete?${queryString}${requestContextQueryString(requestContext, "&")}`, {
|
|
2035
|
+
method: "POST",
|
|
2036
|
+
body: { messageIds }
|
|
2037
|
+
});
|
|
1986
2038
|
}
|
|
1987
2039
|
/**
|
|
1988
2040
|
* Clones the thread with all its messages to a new thread
|
|
1989
|
-
* @param params - Clone parameters including optional new thread ID, title, metadata, and message filters
|
|
2041
|
+
* @param params - Clone parameters including optional new thread ID, title, metadata, and message filters.
|
|
2042
|
+
* `agentId` is required by the server; pass it here if not supplied on the constructor.
|
|
1990
2043
|
* @returns Promise containing the cloned thread and copied messages
|
|
1991
2044
|
*/
|
|
1992
2045
|
clone(params = {}) {
|
|
1993
|
-
const
|
|
1994
|
-
const
|
|
1995
|
-
const
|
|
2046
|
+
const agentId = this.requireAgentId(params.agentId, "clone");
|
|
2047
|
+
const { agentId: _omitAgentId, requestContext, ...body } = params;
|
|
2048
|
+
const agentIdParam = `?agentId=${agentId}`;
|
|
2049
|
+
const contextParam = requestContextQueryString(requestContext, "&");
|
|
1996
2050
|
return this.request(`/memory/threads/${this.threadId}/clone${agentIdParam}${contextParam}`, {
|
|
1997
2051
|
method: "POST",
|
|
1998
2052
|
body
|
|
1999
2053
|
});
|
|
2000
2054
|
}
|
|
2001
2055
|
};
|
|
2056
|
+
function normalizeWriteOpts(opts) {
|
|
2057
|
+
if (!opts || typeof opts !== "object") return {};
|
|
2058
|
+
if ("agentId" in opts || "requestContext" in opts) {
|
|
2059
|
+
const o = opts;
|
|
2060
|
+
return { agentId: o.agentId, requestContext: o.requestContext };
|
|
2061
|
+
}
|
|
2062
|
+
if (Object.keys(opts).length === 0) return {};
|
|
2063
|
+
return { requestContext: opts };
|
|
2064
|
+
}
|
|
2002
2065
|
|
|
2003
2066
|
// src/resources/vector.ts
|
|
2004
2067
|
var Vector = class extends BaseResource {
|
|
@@ -2006,7 +2069,6 @@ var Vector = class extends BaseResource {
|
|
|
2006
2069
|
super(options);
|
|
2007
2070
|
this.vectorName = vectorName;
|
|
2008
2071
|
}
|
|
2009
|
-
vectorName;
|
|
2010
2072
|
/**
|
|
2011
2073
|
* Retrieves details about a specific vector index
|
|
2012
2074
|
* @param indexName - Name of the index to get details for
|
|
@@ -2079,7 +2141,6 @@ var Tool = class extends BaseResource {
|
|
|
2079
2141
|
super(options);
|
|
2080
2142
|
this.toolId = toolId;
|
|
2081
2143
|
}
|
|
2082
|
-
toolId;
|
|
2083
2144
|
/**
|
|
2084
2145
|
* Retrieves details about the tool
|
|
2085
2146
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -2115,7 +2176,6 @@ var Processor = class extends BaseResource {
|
|
|
2115
2176
|
super(options);
|
|
2116
2177
|
this.processorId = processorId;
|
|
2117
2178
|
}
|
|
2118
|
-
processorId;
|
|
2119
2179
|
/**
|
|
2120
2180
|
* Retrieves details about the processor
|
|
2121
2181
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -2197,8 +2257,6 @@ var Run = class extends BaseResource {
|
|
|
2197
2257
|
this.workflowId = workflowId;
|
|
2198
2258
|
this.runId = runId;
|
|
2199
2259
|
}
|
|
2200
|
-
workflowId;
|
|
2201
|
-
runId;
|
|
2202
2260
|
/**
|
|
2203
2261
|
* Creates a transform stream that parses RECORD_SEPARATOR-delimited JSON chunks
|
|
2204
2262
|
*/
|
|
@@ -2591,7 +2649,6 @@ var Workflow = class extends BaseResource {
|
|
|
2591
2649
|
super(options);
|
|
2592
2650
|
this.workflowId = workflowId;
|
|
2593
2651
|
}
|
|
2594
|
-
workflowId;
|
|
2595
2652
|
/**
|
|
2596
2653
|
* Retrieves details about the workflow
|
|
2597
2654
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -2954,7 +3011,6 @@ var A2A = class extends BaseResource {
|
|
|
2954
3011
|
super(options);
|
|
2955
3012
|
this.agentId = agentId;
|
|
2956
3013
|
}
|
|
2957
|
-
agentId;
|
|
2958
3014
|
/**
|
|
2959
3015
|
* Get the agent card with metadata about the agent.
|
|
2960
3016
|
* @param options - Optional Agent Card verification settings
|
|
@@ -3186,12 +3242,10 @@ var MCPTool = class extends BaseResource {
|
|
|
3186
3242
|
execute(params) {
|
|
3187
3243
|
const body = {};
|
|
3188
3244
|
if (params.data !== void 0) body.data = params.data;
|
|
3189
|
-
if (params.requestContext !== void 0)
|
|
3190
|
-
body.requestContext = params.requestContext;
|
|
3191
|
-
}
|
|
3245
|
+
if (params.requestContext !== void 0) body.requestContext = params.requestContext;
|
|
3192
3246
|
return this.request(`/mcp/${encodeURIComponent(this.serverId)}/tools/${encodeURIComponent(this.toolId)}/execute`, {
|
|
3193
3247
|
method: "POST",
|
|
3194
|
-
body
|
|
3248
|
+
body
|
|
3195
3249
|
});
|
|
3196
3250
|
}
|
|
3197
3251
|
};
|
|
@@ -3203,7 +3257,6 @@ var AgentBuilder = class extends BaseResource {
|
|
|
3203
3257
|
super(options);
|
|
3204
3258
|
this.actionId = actionId;
|
|
3205
3259
|
}
|
|
3206
|
-
actionId;
|
|
3207
3260
|
// Helper function to transform workflow result to action result
|
|
3208
3261
|
transformWorkflowResult(result) {
|
|
3209
3262
|
if (result.status === "success") {
|
|
@@ -3390,13 +3443,14 @@ var AgentBuilder = class extends BaseResource {
|
|
|
3390
3443
|
* This calls `/agent-builder/:actionId/stream`.
|
|
3391
3444
|
*/
|
|
3392
3445
|
async stream(params, runId) {
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
searchParams.set("runId", runId);
|
|
3446
|
+
if (!runId) {
|
|
3447
|
+
throw new Error("runId is required to stream an agent builder action");
|
|
3396
3448
|
}
|
|
3449
|
+
const searchParams = new URLSearchParams();
|
|
3450
|
+
searchParams.set("runId", runId);
|
|
3397
3451
|
const requestContext = parseClientRequestContext(params.requestContext);
|
|
3398
3452
|
const { requestContext: _, ...actionParams } = params;
|
|
3399
|
-
const url = `/agent-builder/${this.actionId}/stream
|
|
3453
|
+
const url = `/agent-builder/${this.actionId}/stream?${searchParams.toString()}`;
|
|
3400
3454
|
const response = await this.request(url, {
|
|
3401
3455
|
method: "POST",
|
|
3402
3456
|
body: { ...actionParams, requestContext },
|
|
@@ -3930,7 +3984,6 @@ var StoredAgent = class extends BaseResource {
|
|
|
3930
3984
|
super(options);
|
|
3931
3985
|
this.storedAgentId = storedAgentId;
|
|
3932
3986
|
}
|
|
3933
|
-
storedAgentId;
|
|
3934
3987
|
/**
|
|
3935
3988
|
* Retrieves details about the stored agent
|
|
3936
3989
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -4090,7 +4143,6 @@ var StoredPromptBlock = class extends BaseResource {
|
|
|
4090
4143
|
super(options);
|
|
4091
4144
|
this.storedPromptBlockId = storedPromptBlockId;
|
|
4092
4145
|
}
|
|
4093
|
-
storedPromptBlockId;
|
|
4094
4146
|
/**
|
|
4095
4147
|
* Retrieves details about the stored prompt block
|
|
4096
4148
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -4250,7 +4302,6 @@ var StoredMCPClient = class extends BaseResource {
|
|
|
4250
4302
|
super(options);
|
|
4251
4303
|
this.storedMCPClientId = storedMCPClientId;
|
|
4252
4304
|
}
|
|
4253
|
-
storedMCPClientId;
|
|
4254
4305
|
/**
|
|
4255
4306
|
* Retrieves details about the stored MCP client
|
|
4256
4307
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -4297,7 +4348,6 @@ var StoredScorer = class extends BaseResource {
|
|
|
4297
4348
|
super(options);
|
|
4298
4349
|
this.storedScorerId = storedScorerId;
|
|
4299
4350
|
}
|
|
4300
|
-
storedScorerId;
|
|
4301
4351
|
/**
|
|
4302
4352
|
* Retrieves details about the stored scorer definition
|
|
4303
4353
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -4458,7 +4508,6 @@ var ToolProvider = class extends BaseResource {
|
|
|
4458
4508
|
super(options);
|
|
4459
4509
|
this.providerId = providerId;
|
|
4460
4510
|
}
|
|
4461
|
-
providerId;
|
|
4462
4511
|
/**
|
|
4463
4512
|
* Lists available toolkits from this provider
|
|
4464
4513
|
* @returns Promise containing list of toolkits
|
|
@@ -4508,7 +4557,6 @@ var ProcessorProvider = class extends BaseResource {
|
|
|
4508
4557
|
super(options);
|
|
4509
4558
|
this.providerId = providerId;
|
|
4510
4559
|
}
|
|
4511
|
-
providerId;
|
|
4512
4560
|
/**
|
|
4513
4561
|
* Gets details about this processor provider and its available processors
|
|
4514
4562
|
* @returns Promise containing provider info and processor list
|
|
@@ -4528,9 +4576,6 @@ var WorkspaceSkillResource = class extends BaseResource {
|
|
|
4528
4576
|
this.basePath = `/workspaces/${encodeURIComponent(this.workspaceId)}/skills/${encodeURIComponent(this.skillName)}`;
|
|
4529
4577
|
this.pathQuery = this.skillPath ? `?path=${encodeURIComponent(this.skillPath)}` : "";
|
|
4530
4578
|
}
|
|
4531
|
-
workspaceId;
|
|
4532
|
-
skillName;
|
|
4533
|
-
skillPath;
|
|
4534
4579
|
basePath;
|
|
4535
4580
|
pathQuery;
|
|
4536
4581
|
/**
|
|
@@ -4750,7 +4795,6 @@ var StoredSkill = class extends BaseResource {
|
|
|
4750
4795
|
super(options);
|
|
4751
4796
|
this.storedSkillId = storedSkillId;
|
|
4752
4797
|
}
|
|
4753
|
-
storedSkillId;
|
|
4754
4798
|
/**
|
|
4755
4799
|
* Retrieves details about the stored skill
|
|
4756
4800
|
* @param requestContext - Optional request context to pass as query parameter
|
|
@@ -4847,7 +4891,6 @@ var ResponsesStream = class {
|
|
|
4847
4891
|
constructor(response) {
|
|
4848
4892
|
this.response = response;
|
|
4849
4893
|
}
|
|
4850
|
-
response;
|
|
4851
4894
|
asResponse() {
|
|
4852
4895
|
return this.response;
|
|
4853
4896
|
}
|
|
@@ -5107,13 +5150,13 @@ var MastraClient = class extends BaseResource {
|
|
|
5107
5150
|
}
|
|
5108
5151
|
return this.request(url);
|
|
5109
5152
|
}
|
|
5110
|
-
deleteThread(threadId, opts
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
url = `/memory/network/threads/${threadId}?networkId=${opts.networkId}${requestContextQueryString(opts.requestContext, "&")}`;
|
|
5153
|
+
deleteThread(threadId, opts) {
|
|
5154
|
+
if (!opts || !!opts.agentId === !!opts.networkId) {
|
|
5155
|
+
throw new Error(
|
|
5156
|
+
"MastraClient.deleteThread() requires exactly one of agentId or networkId. The server cannot resolve which memory store owns the thread without one, and passing both is ambiguous."
|
|
5157
|
+
);
|
|
5116
5158
|
}
|
|
5159
|
+
const url = opts.agentId ? `/memory/threads/${threadId}?agentId=${opts.agentId}${requestContextQueryString(opts.requestContext, "&")}` : `/memory/network/threads/${threadId}?networkId=${opts.networkId}${requestContextQueryString(opts.requestContext, "&")}`;
|
|
5117
5160
|
return this.request(url, { method: "DELETE" });
|
|
5118
5161
|
}
|
|
5119
5162
|
/**
|
|
@@ -5257,7 +5300,7 @@ var MastraClient = class extends BaseResource {
|
|
|
5257
5300
|
* @returns Promise containing map of action IDs to action details
|
|
5258
5301
|
*/
|
|
5259
5302
|
getAgentBuilderActions() {
|
|
5260
|
-
return this.request("/agent-builder
|
|
5303
|
+
return this.request("/agent-builder");
|
|
5261
5304
|
}
|
|
5262
5305
|
/**
|
|
5263
5306
|
* Gets an agent builder instance for executing agent-builder workflows
|