@mastra/core
Version:
73 lines (71 loc) • 2 kB
JavaScript
'use strict';
// src/stream/aisdk/v5/output-helpers.ts
var DefaultStepResult = class {
content;
finishReason;
usage;
warnings;
request;
response;
providerMetadata;
/** Tripwire data if this step was rejected by a processor */
tripwire;
constructor({
content,
finishReason,
usage,
warnings,
request,
response,
providerMetadata,
tripwire
}) {
this.content = content;
this.finishReason = finishReason;
this.usage = usage;
this.warnings = warnings;
this.request = request;
this.response = response;
this.providerMetadata = providerMetadata;
this.tripwire = tripwire;
}
get text() {
if (this.tripwire) {
return "";
}
return this.content.filter((part) => part.type === "text").map((part) => part.text).join("");
}
get reasoning() {
return this.content.filter((part) => part.type === "reasoning");
}
get reasoningText() {
return this.reasoning.length === 0 ? void 0 : this.reasoning.map((part) => part.text).join("");
}
get files() {
return this.content.filter((part) => part.type === "file").map((part) => part.file);
}
get sources() {
return this.content.filter((part) => part.type === "source");
}
get toolCalls() {
return this.content.filter((part) => part.type === "tool-call");
}
get staticToolCalls() {
return this.toolCalls.filter((toolCall) => toolCall.dynamic === false);
}
get dynamicToolCalls() {
return this.toolCalls.filter((toolCall) => toolCall.dynamic === true);
}
get toolResults() {
return this.content.filter((part) => part.type === "tool-result");
}
get staticToolResults() {
return this.toolResults.filter((toolResult) => toolResult.dynamic === false);
}
get dynamicToolResults() {
return this.toolResults.filter((toolResult) => toolResult.dynamic === true);
}
};
exports.DefaultStepResult = DefaultStepResult;
//# sourceMappingURL=chunk-WXNUQC46.cjs.map
//# sourceMappingURL=chunk-WXNUQC46.cjs.map