@mastra/client-js 1.23.2 → 1.24.0-alpha.1
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 +37 -0
- package/dist/client.d.ts +14 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-signals.md +64 -190
- package/dist/docs/references/reference-client-js-agents.md +4 -0
- package/dist/index.cjs +50 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +50 -13
- package/dist/index.js.map +1 -1
- package/dist/resources/agent.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +63 -0
- package/dist/route-types.generated.d.ts.map +1 -1
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -978,25 +978,49 @@ var Agent = class extends BaseResource {
|
|
|
978
978
|
type: "tool-result",
|
|
979
979
|
toolCallId: toolCall.toolCallId,
|
|
980
980
|
toolName: toolCall.toolName,
|
|
981
|
-
|
|
981
|
+
args: toolCall.args,
|
|
982
|
+
result,
|
|
983
|
+
...observability ? { __mastraObservability: observability } : {}
|
|
982
984
|
};
|
|
983
|
-
if (observability) {
|
|
984
|
-
toolResultContent.__mastraObservability = observability;
|
|
985
|
-
}
|
|
986
985
|
await onChunk({
|
|
987
986
|
type: "tool-result",
|
|
988
987
|
runId,
|
|
989
988
|
payload: toolResultContent
|
|
990
989
|
});
|
|
990
|
+
const continuationToolCall = {
|
|
991
|
+
type: "tool-call",
|
|
992
|
+
toolCallId: toolCall.toolCallId,
|
|
993
|
+
toolName: toolCall.toolName,
|
|
994
|
+
input: toolCall.args
|
|
995
|
+
};
|
|
996
|
+
const continuationToolResult = {
|
|
997
|
+
type: "tool-result",
|
|
998
|
+
toolCallId: toolCall.toolCallId,
|
|
999
|
+
toolName: toolCall.toolName,
|
|
1000
|
+
output: { type: "json", value: result },
|
|
1001
|
+
...observability ? { __mastraObservability: observability } : {}
|
|
1002
|
+
};
|
|
991
1003
|
toolResultMessages.push({
|
|
992
|
-
role: "
|
|
993
|
-
content: [
|
|
1004
|
+
role: "assistant",
|
|
1005
|
+
content: [continuationToolCall, continuationToolResult]
|
|
994
1006
|
});
|
|
995
1007
|
}
|
|
996
1008
|
if (toolResultMessages.length === 0) {
|
|
997
1009
|
agent.deleteSignalRuntimeOptions(runId);
|
|
998
1010
|
return;
|
|
999
1011
|
}
|
|
1012
|
+
const continuationStreamOptions = {
|
|
1013
|
+
...activeRuntimeOptions,
|
|
1014
|
+
requestContext: processedRequestContext,
|
|
1015
|
+
memory: threadId ? { thread: threadId, resource: resourceId } : void 0,
|
|
1016
|
+
clientTools: processedClientTools
|
|
1017
|
+
};
|
|
1018
|
+
agent.setSignalRuntimeOptions({
|
|
1019
|
+
resourceId,
|
|
1020
|
+
threadId,
|
|
1021
|
+
streamOptions: continuationStreamOptions
|
|
1022
|
+
});
|
|
1023
|
+
const continuationMessages = threadId ? toolResultMessages : [...finishPayload.payload?.messages?.nonUser ?? [], ...toolResultMessages];
|
|
1000
1024
|
try {
|
|
1001
1025
|
await agent.sendToolApproval({
|
|
1002
1026
|
resourceId: resourceId || agent.agentId,
|
|
@@ -1004,15 +1028,11 @@ var Agent = class extends BaseResource {
|
|
|
1004
1028
|
toolCallId: pendingToolCalls[0].toolCallId,
|
|
1005
1029
|
approved: true,
|
|
1006
1030
|
requestContext: processedRequestContext,
|
|
1007
|
-
messages:
|
|
1008
|
-
streamOptions:
|
|
1009
|
-
...activeRuntimeOptions,
|
|
1010
|
-
requestContext: processedRequestContext,
|
|
1011
|
-
memory: threadId ? { thread: threadId, resource: resourceId } : void 0,
|
|
1012
|
-
clientTools: processedClientTools
|
|
1013
|
-
}
|
|
1031
|
+
messages: continuationMessages,
|
|
1032
|
+
streamOptions: continuationStreamOptions
|
|
1014
1033
|
});
|
|
1015
1034
|
} catch (error) {
|
|
1035
|
+
agent.deleteLatestSignalRuntimeOptions({ resourceId, threadId });
|
|
1016
1036
|
console.error("Error running client-tool continuation:", error);
|
|
1017
1037
|
} finally {
|
|
1018
1038
|
agent.deleteSignalRuntimeOptions(runId);
|
|
@@ -7134,6 +7154,23 @@ var MastraClient = class extends BaseResource {
|
|
|
7134
7154
|
getBuilderSettings() {
|
|
7135
7155
|
return this.request("/editor/builder/settings");
|
|
7136
7156
|
}
|
|
7157
|
+
/**
|
|
7158
|
+
* Retrieves the AI providers/models available under the active builder model
|
|
7159
|
+
* policy. The server applies the EE allowlist, so the result can be rendered
|
|
7160
|
+
* directly in the model picker.
|
|
7161
|
+
* @returns Promise containing the policy-filtered providers/models
|
|
7162
|
+
*/
|
|
7163
|
+
getBuilderAvailableModels() {
|
|
7164
|
+
return this.request("/editor/builder/models/available");
|
|
7165
|
+
}
|
|
7166
|
+
/**
|
|
7167
|
+
* Retrieves the authoritative list of valid permission-pattern strings.
|
|
7168
|
+
* Used by Studio to validate route→permission literals and gate the sidebar.
|
|
7169
|
+
* @returns Promise containing the permission patterns
|
|
7170
|
+
*/
|
|
7171
|
+
getPermissionPatterns() {
|
|
7172
|
+
return this.request("/auth/permission-patterns");
|
|
7173
|
+
}
|
|
7137
7174
|
/**
|
|
7138
7175
|
* Retrieves Agent Builder infrastructure configuration and resolution status.
|
|
7139
7176
|
* Requires `infrastructure:read` permission.
|