@mastra/client-js 1.0.0-beta.3 → 1.0.0-beta.5
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 +20 -0
- package/dist/index.cjs +137 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +137 -1
- package/dist/index.js.map +1 -1
- package/dist/resources/workflow.d.ts +57 -1
- package/dist/resources/workflow.d.ts.map +1 -1
- package/dist/types.d.ts +14 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add timeTravel APIs and add timeTravel feature to studio ([#10361](https://github.com/mastra-ai/mastra/pull/10361))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`21a15de`](https://github.com/mastra-ai/mastra/commit/21a15de369fe82aac26bb642ed7be73505475e8b), [`feb7ee4`](https://github.com/mastra-ai/mastra/commit/feb7ee4d09a75edb46c6669a3beaceec78811747), [`b0e2ea5`](https://github.com/mastra-ai/mastra/commit/b0e2ea5b52c40fae438b9e2f7baee6f0f89c5442), [`c456e01`](https://github.com/mastra-ai/mastra/commit/c456e0149e3c176afcefdbd9bb1d2c5917723725), [`ab035c2`](https://github.com/mastra-ai/mastra/commit/ab035c2ef6d8cc7bb25f06f1a38508bd9e6f126b), [`1a46a56`](https://github.com/mastra-ai/mastra/commit/1a46a566f45a3fcbadc1cf36bf86d351f264bfa3), [`3cf540b`](https://github.com/mastra-ai/mastra/commit/3cf540b9fbfea8f4fc8d3a2319a4e6c0b0cbfd52), [`1c6ce51`](https://github.com/mastra-ai/mastra/commit/1c6ce51f875915ab57fd36873623013699a2a65d), [`898a972`](https://github.com/mastra-ai/mastra/commit/898a9727d286c2510d6b702dfd367e6aaf5c6b0f), [`a97003a`](https://github.com/mastra-ai/mastra/commit/a97003aa1cf2f4022a41912324a1e77263b326b8), [`ccc141e`](https://github.com/mastra-ai/mastra/commit/ccc141ed27da0abc3a3fc28e9e5128152e8e37f4), [`fe3b897`](https://github.com/mastra-ai/mastra/commit/fe3b897c2ccbcd2b10e81b099438c7337feddf89), [`00123ba`](https://github.com/mastra-ai/mastra/commit/00123ba96dc9e5cd0b110420ebdba56d8f237b25), [`29c4309`](https://github.com/mastra-ai/mastra/commit/29c4309f818b24304c041bcb4a8f19b5f13f6b62), [`16785ce`](https://github.com/mastra-ai/mastra/commit/16785ced928f6f22638f4488cf8a125d99211799), [`de8239b`](https://github.com/mastra-ai/mastra/commit/de8239bdcb1d8c0cfa06da21f1569912a66bbc8a), [`b5e6cd7`](https://github.com/mastra-ai/mastra/commit/b5e6cd77fc8c8e64e0494c1d06cee3d84e795d1e), [`3759cb0`](https://github.com/mastra-ai/mastra/commit/3759cb064935b5f74c65ac2f52a1145f7352899d), [`651e772`](https://github.com/mastra-ai/mastra/commit/651e772eb1475fb13e126d3fcc01751297a88214), [`b61b93f`](https://github.com/mastra-ai/mastra/commit/b61b93f9e058b11dd2eec169853175d31dbdd567), [`bae33d9`](https://github.com/mastra-ai/mastra/commit/bae33d91a63fbb64d1e80519e1fc1acaed1e9013), [`c0b731f`](https://github.com/mastra-ai/mastra/commit/c0b731fb27d712dc8582e846df5c0332a6a0c5ba), [`43ca8f2`](https://github.com/mastra-ai/mastra/commit/43ca8f2c7334851cc7b4d3d2f037d8784bfbdd5f), [`2ca67cc`](https://github.com/mastra-ai/mastra/commit/2ca67cc3bb1f6a617353fdcab197d9efebe60d6f), [`9e67002`](https://github.com/mastra-ai/mastra/commit/9e67002b52c9be19936c420a489dbee9c5fd6a78), [`35edc49`](https://github.com/mastra-ai/mastra/commit/35edc49ac0556db609189641d6341e76771b81fc)]:
|
|
10
|
+
- @mastra/core@1.0.0-beta.5
|
|
11
|
+
|
|
12
|
+
## 1.0.0-beta.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Include agentId parameter in listMessages API call ([#10270](https://github.com/mastra-ai/mastra/pull/10270))
|
|
17
|
+
|
|
18
|
+
- Added optional `description` field to `GetAgentResponse` to support richer agent metadata ([#10300](https://github.com/mastra-ai/mastra/pull/10300))
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`352a5d6`](https://github.com/mastra-ai/mastra/commit/352a5d625cfe09849b21e8f52a24c9f0366759d5), [`a0a5b4b`](https://github.com/mastra-ai/mastra/commit/a0a5b4bbebe6c701ebbadf744873aa0d5ca01371), [`69ea758`](https://github.com/mastra-ai/mastra/commit/69ea758358edd7117f191c2e69c8bb5fc79e7a1a), [`993ad98`](https://github.com/mastra-ai/mastra/commit/993ad98d7ad3bebda9ecef5fec5c94349a0d04bc), [`3ff2c17`](https://github.com/mastra-ai/mastra/commit/3ff2c17a58e312fad5ea37377262c12d92ca0908)]:
|
|
21
|
+
- @mastra/core@1.0.0-beta.4
|
|
22
|
+
|
|
3
23
|
## 1.0.0-beta.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1458,7 +1458,7 @@ var MemoryThread = class extends BaseResource {
|
|
|
1458
1458
|
if (include) queryParams.include = JSON.stringify(include);
|
|
1459
1459
|
const query = new URLSearchParams(queryParams);
|
|
1460
1460
|
const queryString = query.toString();
|
|
1461
|
-
const url = `/api/memory/threads/${this.threadId}/messages${queryString ?
|
|
1461
|
+
const url = `/api/memory/threads/${this.threadId}/messages?agentId=${this.agentId}${queryString ? `&${queryString}` : ""}${requestContextQueryString(requestContext, "&")}`;
|
|
1462
1462
|
return this.request(url);
|
|
1463
1463
|
}
|
|
1464
1464
|
/**
|
|
@@ -2081,6 +2081,142 @@ var Workflow = class extends BaseResource {
|
|
|
2081
2081
|
}
|
|
2082
2082
|
});
|
|
2083
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Restarts an active workflow run synchronously without waiting for the workflow to complete
|
|
2086
|
+
* @param params - Object containing the runId and requestContext
|
|
2087
|
+
* @returns Promise containing success message
|
|
2088
|
+
*/
|
|
2089
|
+
restart(params) {
|
|
2090
|
+
const requestContext = parseClientRequestContext(params.requestContext);
|
|
2091
|
+
return this.request(`/api/workflows/${this.workflowId}/restart?runId=${params.runId}`, {
|
|
2092
|
+
method: "POST",
|
|
2093
|
+
body: {
|
|
2094
|
+
requestContext,
|
|
2095
|
+
tracingOptions: params.tracingOptions
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
/**
|
|
2100
|
+
* Restarts an active workflow run asynchronously
|
|
2101
|
+
* @param params - Object containing the runId and requestContext
|
|
2102
|
+
* @returns Promise containing the workflow restart results
|
|
2103
|
+
*/
|
|
2104
|
+
restartAsync(params) {
|
|
2105
|
+
const requestContext = parseClientRequestContext(params.requestContext);
|
|
2106
|
+
return this.request(`/api/workflows/${this.workflowId}/restart-async?runId=${params.runId}`, {
|
|
2107
|
+
method: "POST",
|
|
2108
|
+
body: {
|
|
2109
|
+
requestContext,
|
|
2110
|
+
tracingOptions: params.tracingOptions
|
|
2111
|
+
}
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* Restart all active workflow runs synchronously without waiting for the workflow to complete
|
|
2116
|
+
* @returns Promise containing success message
|
|
2117
|
+
*/
|
|
2118
|
+
restartAllActiveWorkflowRuns() {
|
|
2119
|
+
return this.request(`/api/workflows/${this.workflowId}/restart-all-active-workflow-runs`, {
|
|
2120
|
+
method: "POST"
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Restart all active workflow runs asynchronously
|
|
2125
|
+
* @returns Promise containing success message
|
|
2126
|
+
*/
|
|
2127
|
+
restartAllActiveWorkflowRunsAsync() {
|
|
2128
|
+
return this.request(`/api/workflows/${this.workflowId}/restart-all-active-workflow-runs-async`, {
|
|
2129
|
+
method: "POST"
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* Time travels a workflow run synchronously without waiting for the workflow to complete
|
|
2134
|
+
* @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
2135
|
+
* @returns Promise containing success message
|
|
2136
|
+
*/
|
|
2137
|
+
timeTravel({
|
|
2138
|
+
runId,
|
|
2139
|
+
requestContext: paramsRequestContext,
|
|
2140
|
+
...params
|
|
2141
|
+
}) {
|
|
2142
|
+
const requestContext = parseClientRequestContext(paramsRequestContext);
|
|
2143
|
+
return this.request(`/api/workflows/${this.workflowId}/time-travel?runId=${runId}`, {
|
|
2144
|
+
method: "POST",
|
|
2145
|
+
body: {
|
|
2146
|
+
...params,
|
|
2147
|
+
requestContext
|
|
2148
|
+
}
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
/**
|
|
2152
|
+
* Time travels a workflow run asynchronously
|
|
2153
|
+
* @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
2154
|
+
* @returns Promise containing the workflow time travel results
|
|
2155
|
+
*/
|
|
2156
|
+
timeTravelAsync({
|
|
2157
|
+
runId,
|
|
2158
|
+
requestContext: paramsRequestContext,
|
|
2159
|
+
...params
|
|
2160
|
+
}) {
|
|
2161
|
+
const requestContext = parseClientRequestContext(paramsRequestContext);
|
|
2162
|
+
return this.request(`/api/workflows/${this.workflowId}/time-travel-async?runId=${runId}`, {
|
|
2163
|
+
method: "POST",
|
|
2164
|
+
body: {
|
|
2165
|
+
...params,
|
|
2166
|
+
requestContext
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
/**
|
|
2171
|
+
* Time travels a workflow run and returns a stream
|
|
2172
|
+
* @param params - Object containing the runId, step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
2173
|
+
* @returns Promise containing the workflow execution results
|
|
2174
|
+
*/
|
|
2175
|
+
async timeTravelStream({ runId, requestContext: paramsRequestContext, ...params }) {
|
|
2176
|
+
const requestContext = parseClientRequestContext(paramsRequestContext);
|
|
2177
|
+
const response = await this.request(
|
|
2178
|
+
`/api/workflows/${this.workflowId}/time-travel-stream?runId=${runId}`,
|
|
2179
|
+
{
|
|
2180
|
+
method: "POST",
|
|
2181
|
+
body: {
|
|
2182
|
+
...params,
|
|
2183
|
+
requestContext
|
|
2184
|
+
},
|
|
2185
|
+
stream: true
|
|
2186
|
+
}
|
|
2187
|
+
);
|
|
2188
|
+
if (!response.ok) {
|
|
2189
|
+
throw new Error(`Failed to time travel workflow: ${response.statusText}`);
|
|
2190
|
+
}
|
|
2191
|
+
if (!response.body) {
|
|
2192
|
+
throw new Error("Response body is null");
|
|
2193
|
+
}
|
|
2194
|
+
let failedChunk = void 0;
|
|
2195
|
+
const transformStream = new TransformStream({
|
|
2196
|
+
start() {
|
|
2197
|
+
},
|
|
2198
|
+
async transform(chunk, controller) {
|
|
2199
|
+
try {
|
|
2200
|
+
const decoded = new TextDecoder().decode(chunk);
|
|
2201
|
+
const chunks = decoded.split(RECORD_SEPARATOR);
|
|
2202
|
+
for (const chunk2 of chunks) {
|
|
2203
|
+
if (chunk2) {
|
|
2204
|
+
const newChunk = failedChunk ? failedChunk + chunk2 : chunk2;
|
|
2205
|
+
try {
|
|
2206
|
+
const parsedChunk = JSON.parse(newChunk);
|
|
2207
|
+
controller.enqueue(parsedChunk);
|
|
2208
|
+
failedChunk = void 0;
|
|
2209
|
+
} catch {
|
|
2210
|
+
failedChunk = newChunk;
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
} catch {
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
});
|
|
2218
|
+
return response.body.pipeThrough(transformStream);
|
|
2219
|
+
}
|
|
2084
2220
|
};
|
|
2085
2221
|
|
|
2086
2222
|
// src/resources/a2a.ts
|