@mastra/server 1.75.0-alpha.5 → 1.75.0-alpha.6
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/dist/{dist-DWXEVDmb.js → dist-D6XjxNT7.js} +61 -22
- package/dist/dist-D6XjxNT7.js.map +1 -0
- package/dist/{dist-DRLe8Sd-.cjs → dist-Dz_c-SsY.cjs} +61 -22
- package/dist/dist-Dz_c-SsY.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/package.json +6 -6
- package/dist/dist-DRLe8Sd-.cjs.map +0 -1
- package/dist/dist-DWXEVDmb.js.map +0 -1
|
@@ -4637,7 +4637,7 @@ function splitLines(text) {
|
|
|
4637
4637
|
return result;
|
|
4638
4638
|
}
|
|
4639
4639
|
//#endregion
|
|
4640
|
-
//#region ../memory/dist/src-
|
|
4640
|
+
//#region ../memory/dist/src-BPHEGTkT.js
|
|
4641
4641
|
var __defProp$3 = Object.defineProperty;
|
|
4642
4642
|
var __exportAll = (all, no_symbols) => {
|
|
4643
4643
|
let target = {};
|
|
@@ -23310,8 +23310,38 @@ const TRANSIENT_MESSAGE_SUBSTRINGS = [
|
|
|
23310
23310
|
"request timed out",
|
|
23311
23311
|
"request timeout",
|
|
23312
23312
|
"connection reset",
|
|
23313
|
-
"connection closed"
|
|
23313
|
+
"connection closed",
|
|
23314
|
+
"finished with finishreason \"other\""
|
|
23314
23315
|
];
|
|
23316
|
+
const INCOMPLETE_FINISH_REASONS = /* @__PURE__ */ new Set(["other", "unknown"]);
|
|
23317
|
+
/**
|
|
23318
|
+
* A model reply that ended before the model finished. Carries the AI SDK's
|
|
23319
|
+
* `isRetryable` flag, which `isTransientLLMError` and core's error processors
|
|
23320
|
+
* already recognize.
|
|
23321
|
+
*
|
|
23322
|
+
* @internal
|
|
23323
|
+
*/
|
|
23324
|
+
var OmIncompleteResponseError = class extends Error {
|
|
23325
|
+
finishReason;
|
|
23326
|
+
isRetryable = true;
|
|
23327
|
+
constructor(label, finishReason) {
|
|
23328
|
+
super(`${label} response ended early (finishReason: ${finishReason})`);
|
|
23329
|
+
this.finishReason = finishReason;
|
|
23330
|
+
this.name = "OmIncompleteResponseError";
|
|
23331
|
+
}
|
|
23332
|
+
};
|
|
23333
|
+
/**
|
|
23334
|
+
* OM calls are single-step (`maxSteps: 1`). A step that ends with `other` or
|
|
23335
|
+
* `unknown` means the stream closed before the model finished, so its text is
|
|
23336
|
+
* partial. Throw a retryable error so `withRetry` re-runs the whole call
|
|
23337
|
+
* instead of saving it.
|
|
23338
|
+
*
|
|
23339
|
+
* @internal
|
|
23340
|
+
*/
|
|
23341
|
+
function assertCompleteModelResponse(output, label) {
|
|
23342
|
+
if (output.finishReason && INCOMPLETE_FINISH_REASONS.has(output.finishReason)) throw new OmIncompleteResponseError(label, output.finishReason);
|
|
23343
|
+
return output;
|
|
23344
|
+
}
|
|
23315
23345
|
function isRecord$5(value) {
|
|
23316
23346
|
return typeof value === "object" && value !== null;
|
|
23317
23347
|
}
|
|
@@ -25900,20 +25930,20 @@ function optimizeObservationsForContext(observations) {
|
|
|
25900
25930
|
return optimized.trim();
|
|
25901
25931
|
}
|
|
25902
25932
|
function createTemporaryOmMemoryContext(prefix) {
|
|
25903
|
-
const
|
|
25904
|
-
|
|
25905
|
-
|
|
25906
|
-
options: {
|
|
25907
|
-
lastMessages: 10,
|
|
25908
|
-
generateTitle: false
|
|
25909
|
-
}
|
|
25933
|
+
const memoryOptions = {
|
|
25934
|
+
lastMessages: 10,
|
|
25935
|
+
generateTitle: false
|
|
25910
25936
|
};
|
|
25911
25937
|
return {
|
|
25912
25938
|
memory: new Memory({
|
|
25913
25939
|
storage: new InMemoryStore(),
|
|
25914
|
-
options:
|
|
25940
|
+
options: memoryOptions
|
|
25915
25941
|
}),
|
|
25916
|
-
|
|
25942
|
+
newThread: () => ({
|
|
25943
|
+
thread: `${prefix}-${globalThis.crypto.randomUUID()}`,
|
|
25944
|
+
resource: prefix,
|
|
25945
|
+
options: memoryOptions
|
|
25946
|
+
})
|
|
25917
25947
|
};
|
|
25918
25948
|
}
|
|
25919
25949
|
const PHASE_CONFIG = {
|
|
@@ -26052,6 +26082,7 @@ var ObserverRunner = class {
|
|
|
26052
26082
|
id: isMultiThread ? "multi-thread-observer" : "observational-memory-observer",
|
|
26053
26083
|
name: isMultiThread ? "multi-thread-observer" : "Observer",
|
|
26054
26084
|
maxRetries: 0,
|
|
26085
|
+
errorProcessorDefaults: false,
|
|
26055
26086
|
instructions: buildObserverSystemPrompt(isMultiThread, this.observationConfig.instruction, this.observationConfig.threadTitle, extractors),
|
|
26056
26087
|
model: agentModel,
|
|
26057
26088
|
...memory ? { memory } : {},
|
|
@@ -26140,6 +26171,7 @@ var ObserverRunner = class {
|
|
|
26140
26171
|
const temporaryMemory = activeExtractors.filter((extractor) => extractor.mode === "structured").length > 0 ? await createTemporaryOmMemoryContext("structured-observer") : void 0;
|
|
26141
26172
|
const agent = temporaryMemory ? this.createAgent(resolvedModel.model, false, temporaryMemory.memory, activeExtractors) : this.createAgent(resolvedModel.model, false, void 0, activeExtractors);
|
|
26142
26173
|
const internalRequestContext = withOmInternalThreadId(options?.requestContext, agent.id);
|
|
26174
|
+
let attemptMemory;
|
|
26143
26175
|
const attachmentFilter = this.resolveAttachmentFilter(resolvedModel.model, options?.requestContext);
|
|
26144
26176
|
const observerMessages = [buildObserverRequestMessage(existingObservations, messagesToObserve, {
|
|
26145
26177
|
...options,
|
|
@@ -26167,14 +26199,16 @@ var ObserverRunner = class {
|
|
|
26167
26199
|
},
|
|
26168
26200
|
callback: (childObservabilityContext) => this.withAbortCheck(async () => {
|
|
26169
26201
|
try {
|
|
26170
|
-
|
|
26202
|
+
attemptMemory = temporaryMemory?.newThread();
|
|
26203
|
+
return assertCompleteModelResponse(await (await agent.stream(observerMessages, {
|
|
26204
|
+
maxSteps: 1,
|
|
26171
26205
|
modelSettings: { ...this.observationConfig.modelSettings },
|
|
26172
26206
|
providerOptions: this.observationConfig.providerOptions,
|
|
26173
|
-
...
|
|
26207
|
+
...attemptMemory ? { memory: attemptMemory } : {},
|
|
26174
26208
|
...abortSignal ? { abortSignal } : {},
|
|
26175
26209
|
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
26176
26210
|
...childObservabilityContext
|
|
26177
|
-
})).getFullOutput();
|
|
26211
|
+
})).getFullOutput(), "OM observer");
|
|
26178
26212
|
} catch (error) {
|
|
26179
26213
|
this.mastra?.getLogger?.().error("OM observer provider call failed", {
|
|
26180
26214
|
diagnostic: formatOmError(error),
|
|
@@ -26213,7 +26247,7 @@ var ObserverRunner = class {
|
|
|
26213
26247
|
agent,
|
|
26214
26248
|
source: "observer",
|
|
26215
26249
|
extractors: activeExtractors,
|
|
26216
|
-
memory:
|
|
26250
|
+
memory: attemptMemory,
|
|
26217
26251
|
priorExtractedValues: options?.priorExtractedValues,
|
|
26218
26252
|
requestContext: internalRequestContext,
|
|
26219
26253
|
observabilityContext: options?.observabilityContext,
|
|
@@ -26373,13 +26407,14 @@ var ObserverRunner = class {
|
|
|
26373
26407
|
},
|
|
26374
26408
|
callback: (childObservabilityContext) => this.withAbortCheck(async () => {
|
|
26375
26409
|
try {
|
|
26376
|
-
return await (await agent.stream(observerMessages, {
|
|
26410
|
+
return assertCompleteModelResponse(await (await agent.stream(observerMessages, {
|
|
26411
|
+
maxSteps: 1,
|
|
26377
26412
|
modelSettings: { ...this.observationConfig.modelSettings },
|
|
26378
26413
|
providerOptions: this.observationConfig.providerOptions,
|
|
26379
26414
|
...abortSignal ? { abortSignal } : {},
|
|
26380
26415
|
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
26381
26416
|
...childObservabilityContext
|
|
26382
|
-
})).getFullOutput();
|
|
26417
|
+
})).getFullOutput(), "OM multi-thread observer");
|
|
26383
26418
|
} catch (error) {
|
|
26384
26419
|
this.mastra?.getLogger?.().error("OM multi-thread observer provider call failed", {
|
|
26385
26420
|
diagnostic: formatOmError(error),
|
|
@@ -33323,6 +33358,7 @@ var ReflectorRunner = class {
|
|
|
33323
33358
|
instructions: buildReflectorSystemPrompt(this.reflectionConfig.instruction, extractors),
|
|
33324
33359
|
model: agentModel,
|
|
33325
33360
|
maxRetries: 0,
|
|
33361
|
+
errorProcessorDefaults: false,
|
|
33326
33362
|
...memory ? { memory } : {},
|
|
33327
33363
|
...this.mastra ? { mastra: this.mastra } : {}
|
|
33328
33364
|
});
|
|
@@ -33363,6 +33399,7 @@ var ReflectorRunner = class {
|
|
|
33363
33399
|
const temporaryMemory = activeExtractors.filter((extractor) => extractor.mode === "structured").length > 0 ? await createTemporaryOmMemoryContext("structured-reflector") : void 0;
|
|
33364
33400
|
const agent = temporaryMemory ? this.createAgent(resolvedModel.model, temporaryMemory.memory, activeExtractors) : this.createAgent(resolvedModel.model, void 0, activeExtractors);
|
|
33365
33401
|
const internalRequestContext = withOmInternalThreadId(requestContext, agent.id);
|
|
33402
|
+
let attemptMemory;
|
|
33366
33403
|
const targetThreshold = observationTokensThreshold ?? getMaxThreshold(this.reflectionConfig.observationTokens);
|
|
33367
33404
|
let totalUsage = {
|
|
33368
33405
|
inputTokens: 0,
|
|
@@ -33405,10 +33442,12 @@ var ReflectorRunner = class {
|
|
|
33405
33442
|
callback: (childObservabilityContext) => withAbortCheck(async () => {
|
|
33406
33443
|
chunkCount = 0;
|
|
33407
33444
|
try {
|
|
33408
|
-
|
|
33445
|
+
attemptMemory = temporaryMemory?.newThread();
|
|
33446
|
+
return assertCompleteModelResponse(await (await agent.stream(prompt, {
|
|
33447
|
+
maxSteps: 1,
|
|
33409
33448
|
modelSettings: { ...this.reflectionConfig.modelSettings },
|
|
33410
33449
|
providerOptions: this.reflectionConfig.providerOptions,
|
|
33411
|
-
...
|
|
33450
|
+
...attemptMemory ? { memory: attemptMemory } : {},
|
|
33412
33451
|
...abortSignal ? { abortSignal } : {},
|
|
33413
33452
|
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
33414
33453
|
...childObservabilityContext,
|
|
@@ -33430,7 +33469,7 @@ var ReflectorRunner = class {
|
|
|
33430
33469
|
omError(`[OM:callReflector] onError after ${chunkCount} chunks`, error);
|
|
33431
33470
|
}
|
|
33432
33471
|
} : {}
|
|
33433
|
-
})).getFullOutput();
|
|
33472
|
+
})).getFullOutput(), "OM reflector");
|
|
33434
33473
|
} catch (error) {
|
|
33435
33474
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
33436
33475
|
throw new OmModelExecutionError("reflector-model", error);
|
|
@@ -33504,7 +33543,7 @@ var ReflectorRunner = class {
|
|
|
33504
33543
|
agent,
|
|
33505
33544
|
source: "reflector",
|
|
33506
33545
|
extractors: activeExtractors,
|
|
33507
|
-
memory:
|
|
33546
|
+
memory: attemptMemory,
|
|
33508
33547
|
priorExtractedValues,
|
|
33509
33548
|
requestContext: internalRequestContext,
|
|
33510
33549
|
observabilityContext,
|
|
@@ -50484,4 +50523,4 @@ const agentBuilderWorkflows = {
|
|
|
50484
50523
|
//#endregion
|
|
50485
50524
|
export { agentBuilderWorkflows };
|
|
50486
50525
|
|
|
50487
|
-
//# sourceMappingURL=dist-
|
|
50526
|
+
//# sourceMappingURL=dist-D6XjxNT7.js.map
|