@mastra/client-js 1.7.3-alpha.0 → 1.8.0-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 +50 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-server-auth-auth0.md +1 -1
- package/dist/docs/references/docs-server-auth-firebase.md +1 -1
- package/dist/docs/references/docs-server-mastra-client.md +1 -1
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v4-messages.md +1 -1
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-v5-messages.md +1 -1
- package/dist/docs/references/reference-client-js-mastra-client.md +1 -1
- package/dist/index.cjs +21 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -16
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +7 -4
- package/dist/resources/agent-builder.d.ts.map +1 -1
- package/dist/resources/agent.d.ts +14 -8
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/resources/run.d.ts +4 -4
- package/dist/resources/run.d.ts.map +1 -1
- package/dist/types.d.ts +19 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/process-mastra-stream.d.ts +2 -3
- package/dist/utils/process-mastra-stream.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
2
|
import { getErrorFromUnknown } from '@mastra/core/error';
|
|
3
|
+
import { standardSchemaToJSONSchema, toStandardSchema } from '@mastra/schema-compat/schema';
|
|
3
4
|
import { RequestContext } from '@mastra/core/request-context';
|
|
4
5
|
import { isVercelTool } from '@mastra/core/tools/is-vercel-tool';
|
|
5
6
|
import { zodToJsonSchema } from '@mastra/schema-compat/zod-to-json';
|
|
@@ -272,7 +273,7 @@ var customAlphabet = (alphabet, defaultSize = 21) => {
|
|
|
272
273
|
};
|
|
273
274
|
};
|
|
274
275
|
|
|
275
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@2.2.8_zod@3.
|
|
276
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@2.2.8_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
276
277
|
var import_secure_json_parse = __toESM(require_secure_json_parse());
|
|
277
278
|
var createIdGenerator = ({
|
|
278
279
|
prefix,
|
|
@@ -352,7 +353,7 @@ function safeParseJSON({
|
|
|
352
353
|
}
|
|
353
354
|
}
|
|
354
355
|
|
|
355
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.
|
|
356
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@4.3.6/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
356
357
|
new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
|
|
357
358
|
function fixJson(input) {
|
|
358
359
|
const stack = ["ROOT"];
|
|
@@ -1489,13 +1490,10 @@ var Agent = class extends BaseResource {
|
|
|
1489
1490
|
clientTools: processClientTools(params.clientTools)
|
|
1490
1491
|
};
|
|
1491
1492
|
const { resourceId, threadId, requestContext } = processedParams;
|
|
1492
|
-
const response = await this.request(
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
body: processedParams
|
|
1497
|
-
}
|
|
1498
|
-
);
|
|
1493
|
+
const response = await this.request(`/agents/${this.agentId}/generate-legacy`, {
|
|
1494
|
+
method: "POST",
|
|
1495
|
+
body: processedParams
|
|
1496
|
+
});
|
|
1499
1497
|
if (response.finishReason === "tool-calls") {
|
|
1500
1498
|
const toolCalls = response.toolCalls;
|
|
1501
1499
|
if (!toolCalls || !Array.isArray(toolCalls)) {
|
|
@@ -1530,7 +1528,7 @@ var Agent = class extends BaseResource {
|
|
|
1530
1528
|
]
|
|
1531
1529
|
}
|
|
1532
1530
|
];
|
|
1533
|
-
return this.
|
|
1531
|
+
return this.generateLegacy({
|
|
1534
1532
|
...params,
|
|
1535
1533
|
messages: updatedMessages
|
|
1536
1534
|
});
|
|
@@ -1550,7 +1548,7 @@ var Agent = class extends BaseResource {
|
|
|
1550
1548
|
clientTools: processClientTools(params.clientTools),
|
|
1551
1549
|
structuredOutput: params.structuredOutput ? {
|
|
1552
1550
|
...params.structuredOutput,
|
|
1553
|
-
schema:
|
|
1551
|
+
schema: standardSchemaToJSONSchema(toStandardSchema(params.structuredOutput.schema))
|
|
1554
1552
|
} : void 0
|
|
1555
1553
|
};
|
|
1556
1554
|
const { memory, requestContext } = processedParams;
|
|
@@ -2348,14 +2346,18 @@ var Agent = class extends BaseResource {
|
|
|
2348
2346
|
messages: messagesOrParams,
|
|
2349
2347
|
...options
|
|
2350
2348
|
};
|
|
2349
|
+
let structuredOutput = void 0;
|
|
2350
|
+
if (params.structuredOutput?.schema) {
|
|
2351
|
+
structuredOutput = {
|
|
2352
|
+
...params.structuredOutput,
|
|
2353
|
+
schema: standardSchemaToJSONSchema(toStandardSchema(params.structuredOutput.schema))
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2351
2356
|
const processedParams = {
|
|
2352
2357
|
...params,
|
|
2353
2358
|
requestContext: parseClientRequestContext(params.requestContext),
|
|
2354
2359
|
clientTools: processClientTools(params.clientTools),
|
|
2355
|
-
structuredOutput
|
|
2356
|
-
...params.structuredOutput,
|
|
2357
|
-
schema: zodToJsonSchema2(params.structuredOutput.schema)
|
|
2358
|
-
} : void 0
|
|
2360
|
+
structuredOutput
|
|
2359
2361
|
};
|
|
2360
2362
|
let readableController;
|
|
2361
2363
|
const readable = new ReadableStream({
|
|
@@ -3224,7 +3226,10 @@ var Run = class extends BaseResource {
|
|
|
3224
3226
|
* @param params - Object containing the step, inputData, resumeData, initialState, context, nestedStepsContext, requestContext and tracingOptions
|
|
3225
3227
|
* @returns Promise containing the workflow execution results
|
|
3226
3228
|
*/
|
|
3227
|
-
async timeTravelStream({
|
|
3229
|
+
async timeTravelStream({
|
|
3230
|
+
requestContext: paramsRequestContext,
|
|
3231
|
+
...params
|
|
3232
|
+
}) {
|
|
3228
3233
|
const requestContext = parseClientRequestContext(paramsRequestContext);
|
|
3229
3234
|
const response = await this.request(
|
|
3230
3235
|
`/workflows/${this.workflowId}/time-travel-stream?runId=${this.runId}`,
|