@mastra/server 1.33.0-alpha.0 → 1.33.0-alpha.2
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 +14 -0
- package/dist/{chunk-F35U36E2.cjs → chunk-44K6EWHN.cjs} +20 -20
- package/dist/{chunk-F35U36E2.cjs.map → chunk-44K6EWHN.cjs.map} +1 -1
- package/dist/{chunk-ZW7DMFEG.cjs → chunk-BBX7Q7UG.cjs} +79 -4
- package/dist/chunk-BBX7Q7UG.cjs.map +1 -0
- package/dist/{chunk-MQVBXOMA.js → chunk-DTCRA7JS.js} +5 -5
- package/dist/{chunk-MQVBXOMA.js.map → chunk-DTCRA7JS.js.map} +1 -1
- package/dist/{chunk-4HRTLLE6.js → chunk-S65AMBAF.js} +79 -4
- package/dist/chunk-S65AMBAF.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{observational-memory-FBBKXNO5-I7J47ELO.js → observational-memory-KH7G7Y6B-QKEOJZME.js} +3 -3
- package/dist/{observational-memory-FBBKXNO5-I7J47ELO.js.map → observational-memory-KH7G7Y6B-QKEOJZME.js.map} +1 -1
- package/dist/{observational-memory-FBBKXNO5-3V6BP5K3.cjs → observational-memory-KH7G7Y6B-Y3XQXW3K.cjs} +26 -26
- package/dist/{observational-memory-FBBKXNO5-3V6BP5K3.cjs.map → observational-memory-KH7G7Y6B-Y3XQXW3K.cjs.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/server-adapter/index.cjs +16 -16
- package/dist/server/server-adapter/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-4HRTLLE6.js.map +0 -1
- package/dist/chunk-ZW7DMFEG.cjs.map +0 -1
|
@@ -1042,7 +1042,7 @@ function imageSize(input) {
|
|
|
1042
1042
|
throw new TypeError(`unsupported file type: ${type}`);
|
|
1043
1043
|
}
|
|
1044
1044
|
|
|
1045
|
-
// ../memory/dist/chunk-
|
|
1045
|
+
// ../memory/dist/chunk-NUYSX3DD.js
|
|
1046
1046
|
var OM_DEBUG_LOG = process.env.OM_DEBUG ? path.join(process.cwd(), "om-debug.log") : null;
|
|
1047
1047
|
function omDebug(msg) {
|
|
1048
1048
|
if (!OM_DEBUG_LOG) return;
|
|
@@ -4159,6 +4159,71 @@ function formatObserverAttachmentPlaceholder(part, counter) {
|
|
|
4159
4159
|
const label = resolveObserverAttachmentLabel(part);
|
|
4160
4160
|
return label ? `[${attachmentType} #${attachmentId}: ${label}]` : `[${attachmentType} #${attachmentId}]`;
|
|
4161
4161
|
}
|
|
4162
|
+
function isRecord(value) {
|
|
4163
|
+
return !!value && typeof value === "object";
|
|
4164
|
+
}
|
|
4165
|
+
function mapToolResultBlockToAttachment(block) {
|
|
4166
|
+
if (!isRecord(block) || typeof block.type !== "string") {
|
|
4167
|
+
return void 0;
|
|
4168
|
+
}
|
|
4169
|
+
const mediaType = typeof block.mediaType === "string" ? block.mediaType : void 0;
|
|
4170
|
+
const filename = typeof block.filename === "string" ? block.filename : void 0;
|
|
4171
|
+
switch (block.type) {
|
|
4172
|
+
case "image-data": {
|
|
4173
|
+
const data = block.data;
|
|
4174
|
+
if (typeof data !== "string") return void 0;
|
|
4175
|
+
const image = mediaType ? `data:${mediaType};base64,${data}` : data;
|
|
4176
|
+
return { type: "image", image, mimeType: mediaType };
|
|
4177
|
+
}
|
|
4178
|
+
case "image-url": {
|
|
4179
|
+
const url = block.url;
|
|
4180
|
+
if (typeof url !== "string") return void 0;
|
|
4181
|
+
return { type: "image", image: url, mimeType: mediaType };
|
|
4182
|
+
}
|
|
4183
|
+
case "media": {
|
|
4184
|
+
const data = block.data;
|
|
4185
|
+
if (typeof data !== "string" || !mediaType) return void 0;
|
|
4186
|
+
const dataUri = `data:${mediaType};base64,${data}`;
|
|
4187
|
+
if (mediaType.toLowerCase().startsWith("image/")) {
|
|
4188
|
+
return { type: "image", image: dataUri, mimeType: mediaType };
|
|
4189
|
+
}
|
|
4190
|
+
return { type: "file", data: dataUri, mimeType: mediaType };
|
|
4191
|
+
}
|
|
4192
|
+
case "file-data": {
|
|
4193
|
+
const data = block.data;
|
|
4194
|
+
if (typeof data !== "string") return void 0;
|
|
4195
|
+
const dataUri = mediaType ? `data:${mediaType};base64,${data}` : data;
|
|
4196
|
+
return { type: "file", data: dataUri, mimeType: mediaType, filename };
|
|
4197
|
+
}
|
|
4198
|
+
case "file-url": {
|
|
4199
|
+
const url = block.url;
|
|
4200
|
+
if (typeof url !== "string") return void 0;
|
|
4201
|
+
return { type: "file", data: url, mimeType: mediaType, filename };
|
|
4202
|
+
}
|
|
4203
|
+
default:
|
|
4204
|
+
return void 0;
|
|
4205
|
+
}
|
|
4206
|
+
}
|
|
4207
|
+
function extractToolResultAttachments(result, counter) {
|
|
4208
|
+
if (!isRecord(result) || result.type !== "content" || !Array.isArray(result.value)) {
|
|
4209
|
+
return { resultWithoutAttachments: result, attachments: [] };
|
|
4210
|
+
}
|
|
4211
|
+
const record = result;
|
|
4212
|
+
const attachments = [];
|
|
4213
|
+
const newValue = record.value.map((block) => {
|
|
4214
|
+
const attachment = mapToolResultBlockToAttachment(block);
|
|
4215
|
+
if (!attachment) {
|
|
4216
|
+
return block;
|
|
4217
|
+
}
|
|
4218
|
+
attachments.push(toObserverInputAttachmentPart(attachment));
|
|
4219
|
+
const placeholder = formatObserverAttachmentPlaceholder(attachment, counter);
|
|
4220
|
+
return { type: isRecord(block) ? block.type : void 0, placeholder };
|
|
4221
|
+
});
|
|
4222
|
+
if (attachments.length === 0) {
|
|
4223
|
+
return { resultWithoutAttachments: result, attachments };
|
|
4224
|
+
}
|
|
4225
|
+
return { resultWithoutAttachments: { ...record, value: newValue }, attachments };
|
|
4226
|
+
}
|
|
4162
4227
|
function formatObserverPartLine(title, body, time, previousTime) {
|
|
4163
4228
|
const timeLabel = time && time !== previousTime ? `(${time})` : "";
|
|
4164
4229
|
if (!title) {
|
|
@@ -4248,9 +4313,19 @@ function formatObserverMessage(msg, counter, options) {
|
|
|
4248
4313
|
part,
|
|
4249
4314
|
inv.result
|
|
4250
4315
|
);
|
|
4316
|
+
const { resultWithoutAttachments, attachments: extractedAttachments } = extractToolResultAttachments(
|
|
4317
|
+
resultForObserver,
|
|
4318
|
+
counter
|
|
4319
|
+
);
|
|
4320
|
+
if (extractedAttachments.length > 0) {
|
|
4321
|
+
attachments.push(...extractedAttachments);
|
|
4322
|
+
}
|
|
4251
4323
|
pushLine(
|
|
4252
4324
|
`Tool Result ${inv.toolName}`,
|
|
4253
|
-
maybeTruncate(
|
|
4325
|
+
maybeTruncate(
|
|
4326
|
+
formatToolResultForObserver(resultWithoutAttachments, { maxTokens: maxToolResultTokens }),
|
|
4327
|
+
maxLen
|
|
4328
|
+
),
|
|
4254
4329
|
partCreatedAt
|
|
4255
4330
|
);
|
|
4256
4331
|
return;
|
|
@@ -10380,5 +10455,5 @@ exports.stripEphemeralAnchorIds = stripEphemeralAnchorIds;
|
|
|
10380
10455
|
exports.stripObservationGroups = stripObservationGroups;
|
|
10381
10456
|
exports.truncateStringByTokens = truncateStringByTokens;
|
|
10382
10457
|
exports.wrapInObservationGroup = wrapInObservationGroup;
|
|
10383
|
-
//# sourceMappingURL=chunk-
|
|
10384
|
-
//# sourceMappingURL=chunk-
|
|
10458
|
+
//# sourceMappingURL=chunk-BBX7Q7UG.cjs.map
|
|
10459
|
+
//# sourceMappingURL=chunk-BBX7Q7UG.cjs.map
|