@mastra/server 1.80.0-alpha.4 → 1.80.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/{a2a-BUOtgjP-.cjs → a2a-3ykajvdu.cjs} +2 -2
- package/dist/{a2a-BUOtgjP-.cjs.map → a2a-3ykajvdu.cjs.map} +1 -1
- package/dist/{a2a-B2K45wEY.js → a2a-D6ajBqAA.js} +2 -2
- package/dist/{a2a-B2K45wEY.js.map → a2a-D6ajBqAA.js.map} +1 -1
- package/dist/{agent-builder-BEhoRLS_.js → agent-builder-BDHi4NOZ.js} +4 -4
- package/dist/{agent-builder-BEhoRLS_.js.map → agent-builder-BDHi4NOZ.js.map} +1 -1
- package/dist/{agent-builder-CTHPsm8d.cjs → agent-builder-D3WRvBAH.cjs} +4 -4
- package/dist/{agent-builder-CTHPsm8d.cjs.map → agent-builder-D3WRvBAH.cjs.map} +1 -1
- package/dist/{agents-vFpMvK3w.cjs → agents-Bs1GFnXz.cjs} +5 -2
- package/dist/{agents-vFpMvK3w.cjs.map → agents-Bs1GFnXz.cjs.map} +1 -1
- package/dist/{agents-DSZgApzs.js → agents-CiUW6yvl.js} +105 -14
- package/dist/agents-CiUW6yvl.js.map +1 -0
- package/dist/{agents-A-ahR0eQ.js → agents-Cl3KTHU4.js} +5 -2
- package/dist/{agents-A-ahR0eQ.js.map → agents-Cl3KTHU4.js.map} +1 -1
- package/dist/{agents-I0TVb_TM.cjs → agents-DBsmIR4c.cjs} +105 -14
- package/dist/agents-DBsmIR4c.cjs.map +1 -0
- package/dist/{api-schema-manifest-j2xurBb0.js → api-schema-manifest-C6MbIQch.js} +2 -2
- package/dist/{api-schema-manifest-j2xurBb0.js.map → api-schema-manifest-C6MbIQch.js.map} +1 -1
- package/dist/{api-schema-manifest-DCuGBEO0.cjs → api-schema-manifest-COH6PAvQ.cjs} +2 -2
- package/dist/{api-schema-manifest-DCuGBEO0.cjs.map → api-schema-manifest-COH6PAvQ.cjs.map} +1 -1
- package/dist/{background-tasks-BMVUFtVh.cjs → background-tasks-BMp9Q6SB.cjs} +2 -2
- package/dist/{background-tasks-BMVUFtVh.cjs.map → background-tasks-BMp9Q6SB.cjs.map} +1 -1
- package/dist/{background-tasks-CFkXHgyQ.js → background-tasks-DIpPsqVy.js} +2 -2
- package/dist/{background-tasks-CFkXHgyQ.js.map → background-tasks-DIpPsqVy.js.map} +1 -1
- package/dist/{conversations-BfBS1UwQ.js → conversations-Ce0dCZ23.js} +3 -3
- package/dist/{conversations-BfBS1UwQ.js.map → conversations-Ce0dCZ23.js.map} +1 -1
- package/dist/{conversations-BSYZlASE.cjs → conversations-RVdtAQEv.cjs} +3 -3
- package/dist/{conversations-BSYZlASE.cjs.map → conversations-RVdtAQEv.cjs.map} +1 -1
- package/dist/dist-C-L2kyKZ.js +1 -0
- package/dist/{dist-Cci9RRWj.cjs → dist-Clj7hRKz.cjs} +47 -69
- package/dist/dist-Clj7hRKz.cjs.map +1 -0
- package/dist/{dist-DJ3281Ve.cjs → dist-D6oS7RF1.cjs} +1 -1
- package/dist/{dist-bAoX6ick.js → dist-PlsLrwz8.js} +48 -70
- package/dist/dist-PlsLrwz8.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{editor-builder-8li-nXor.cjs → editor-builder-9T1aGM2f.cjs} +2 -2
- package/dist/{editor-builder-8li-nXor.cjs.map → editor-builder-9T1aGM2f.cjs.map} +1 -1
- package/dist/{editor-builder-BXT6F3Hl.cjs → editor-builder-Bj_or9-c.cjs} +3 -3
- package/dist/{editor-builder-BXT6F3Hl.cjs.map → editor-builder-Bj_or9-c.cjs.map} +1 -1
- package/dist/{editor-builder-Bywazgj1.js → editor-builder-Cc0zrTC1.js} +3 -3
- package/dist/{editor-builder-Bywazgj1.js.map → editor-builder-Cc0zrTC1.js.map} +1 -1
- package/dist/{editor-builder-BCZy1ZH1.js → editor-builder-lzO2zecA.js} +2 -2
- package/dist/{editor-builder-BCZy1ZH1.js.map → editor-builder-lzO2zecA.js.map} +1 -1
- package/dist/{logs-Cbq2PiQG.js → logs-DIBh_xCk.js} +2 -2
- package/dist/{logs-Cbq2PiQG.js.map → logs-DIBh_xCk.js.map} +1 -1
- package/dist/{logs-BqHVVZBm.cjs → logs-NNur5jkf.cjs} +2 -2
- package/dist/{logs-BqHVVZBm.cjs.map → logs-NNur5jkf.cjs.map} +1 -1
- package/dist/{memory-CtSwODLV.js → memory-DeZ1je-b.js} +5 -6
- package/dist/memory-DeZ1je-b.js.map +1 -0
- package/dist/{memory-dujCippo.cjs → memory-Pj9P9vsl.cjs} +5 -6
- package/dist/memory-Pj9P9vsl.cjs.map +1 -0
- package/dist/{plans-CSLB_JKn.cjs → plans-Cu3zbWP_.cjs} +4 -4
- package/dist/{plans-CSLB_JKn.cjs.map → plans-Cu3zbWP_.cjs.map} +1 -1
- package/dist/{plans-DToC_H5z.js → plans-DVErlJoO.js} +4 -4
- package/dist/{plans-DToC_H5z.js.map → plans-DVErlJoO.js.map} +1 -1
- package/dist/{probe-image-size-CTKFNI9H.cjs → probe-image-size-C0psF6WM.cjs} +2 -2
- package/dist/{probe-image-size-CTKFNI9H.cjs.map → probe-image-size-C0psF6WM.cjs.map} +1 -1
- package/dist/{probe-image-size-DnRk0ecb.js → probe-image-size-CpV7slsd.js} +2 -2
- package/dist/{probe-image-size-DnRk0ecb.js.map → probe-image-size-CpV7slsd.js.map} +1 -1
- package/dist/{responses-w6B0iv_t.js → responses-DOqM_drh.js} +3 -3
- package/dist/{responses-w6B0iv_t.js.map → responses-DOqM_drh.js.map} +1 -1
- package/dist/{responses-OoIIZ1g6.cjs → responses-DniqbL1B.cjs} +3 -3
- package/dist/{responses-OoIIZ1g6.cjs.map → responses-DniqbL1B.cjs.map} +1 -1
- package/dist/{routes-KTxoRutQ.cjs → routes-B_-KRQOi.cjs} +16 -16
- package/dist/{routes-KTxoRutQ.cjs.map → routes-B_-KRQOi.cjs.map} +1 -1
- package/dist/{routes-CIjXlRu7.js → routes-BfQBQbwB.js} +16 -16
- package/dist/{routes-CIjXlRu7.js.map → routes-BfQBQbwB.js.map} +1 -1
- package/dist/{schedules-CSkQFQwy.cjs → schedules-CL4IU7kS.cjs} +2 -2
- package/dist/{schedules-CSkQFQwy.cjs.map → schedules-CL4IU7kS.cjs.map} +1 -1
- package/dist/{schedules-DfelziYe.js → schedules-CQPodXrR.js} +2 -2
- package/dist/{schedules-DfelziYe.js.map → schedules-CQPodXrR.js.map} +1 -1
- package/dist/{scores-FzL-bpCC.cjs → scores-BAZL_l3k.cjs} +2 -2
- package/dist/{scores-FzL-bpCC.cjs.map → scores-BAZL_l3k.cjs.map} +1 -1
- package/dist/{scores-PdRDQNaC.js → scores-BXrRHFvI.js} +2 -2
- package/dist/{scores-PdRDQNaC.js.map → scores-BXrRHFvI.js.map} +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-controller.cjs +14 -11
- package/dist/server/handlers/agent-controller.cjs.map +1 -1
- package/dist/server/handlers/agent-controller.d.ts +2 -0
- package/dist/server/handlers/agent-controller.d.ts.map +1 -1
- package/dist/server/handlers/agent-controller.js +14 -11
- package/dist/server/handlers/agent-controller.js.map +1 -1
- package/dist/server/handlers/agents.cjs +1 -1
- package/dist/server/handlers/agents.d.ts +2 -0
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/background-tasks.cjs +1 -1
- package/dist/server/handlers/background-tasks.js +1 -1
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +1 -1
- package/dist/server/handlers/error.cjs +1 -0
- package/dist/server/handlers/error.cjs.map +1 -1
- package/dist/server/handlers/error.d.ts.map +1 -1
- package/dist/server/handlers/error.js +1 -0
- package/dist/server/handlers/error.js.map +1 -1
- package/dist/server/handlers/favorites-enrichment.cjs +1 -1
- package/dist/server/handlers/favorites-enrichment.js +1 -1
- package/dist/server/handlers/logs.cjs +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +1 -1
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability-new-endpoints.d.ts +2 -10
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/plans.cjs +1 -1
- package/dist/server/handlers/plans.js +1 -1
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/responses.storage.cjs +1 -1
- package/dist/server/handlers/responses.storage.js +1 -1
- package/dist/server/handlers/schedules.cjs +1 -1
- package/dist/server/handlers/schedules.js +1 -1
- package/dist/server/handlers/scores.cjs +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +1 -1
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
- package/dist/server/handlers/stored-skill-favorites.js +1 -1
- package/dist/server/handlers/stored-skills.cjs +1 -1
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -1
- package/dist/server/handlers/utils.d.ts +17 -2
- package/dist/server/handlers/utils.d.ts.map +1 -1
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/workflow-builder.cjs +1 -1
- package/dist/server/handlers/workflow-builder.js +1 -1
- package/dist/server/handlers/workflows.cjs +1 -1
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers/workspace.d.ts +23 -23
- package/dist/server/handlers.cjs +11 -11
- package/dist/server/handlers.js +11 -11
- package/dist/server/schemas/agents.d.ts +1 -0
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +2 -2
- package/dist/server/schemas/index.js +2 -2
- package/dist/server/server-adapter/index.cjs +1 -1
- package/dist/server/server-adapter/index.js +1 -1
- package/dist/server/server-adapter/routes/observability.d.ts +1 -5
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/dist/server/utils/agent-stream-events.d.ts +23 -0
- package/dist/server/utils/agent-stream-events.d.ts.map +1 -0
- package/dist/{tools-tMPXGAUO.js → tools-Do1uV_07.js} +5 -5
- package/dist/tools-Do1uV_07.js.map +1 -0
- package/dist/{tools-CottqeCZ.cjs → tools-HYYytfMx.cjs} +5 -5
- package/dist/tools-HYYytfMx.cjs.map +1 -0
- package/dist/{utils-1UlUJRyC.cjs → utils-BbYUI6Yn.cjs} +32 -7
- package/dist/utils-BbYUI6Yn.cjs.map +1 -0
- package/dist/{utils-DEwjGOpJ.js → utils-DHxjw4Tn.js} +27 -8
- package/dist/utils-DHxjw4Tn.js.map +1 -0
- package/dist/{workflow-builder-CJEajbkw.cjs → workflow-builder-DJKziSOo.cjs} +4 -4
- package/dist/{workflow-builder-CJEajbkw.cjs.map → workflow-builder-DJKziSOo.cjs.map} +1 -1
- package/dist/{workflow-builder-BcVfkods.js → workflow-builder-ezo8ZG1K.js} +4 -4
- package/dist/{workflow-builder-BcVfkods.js.map → workflow-builder-ezo8ZG1K.js.map} +1 -1
- package/dist/{workflows-CxPsDCnW.cjs → workflows-BWLDlaL9.cjs} +28 -28
- package/dist/workflows-BWLDlaL9.cjs.map +1 -0
- package/dist/{workflows-BjLruwQB.js → workflows-Dm2iK1nq.js} +28 -28
- package/dist/workflows-Dm2iK1nq.js.map +1 -0
- package/package.json +6 -6
- package/dist/agents-DSZgApzs.js.map +0 -1
- package/dist/agents-I0TVb_TM.cjs.map +0 -1
- package/dist/dist-Cci9RRWj.cjs.map +0 -1
- package/dist/dist-bAoX6ick.js.map +0 -1
- package/dist/dist-t_05BTrR.js +0 -1
- package/dist/memory-CtSwODLV.js.map +0 -1
- package/dist/memory-dujCippo.cjs.map +0 -1
- package/dist/tools-CottqeCZ.cjs.map +0 -1
- package/dist/tools-tMPXGAUO.js.map +0 -1
- package/dist/utils-1UlUJRyC.cjs.map +0 -1
- package/dist/utils-DEwjGOpJ.js.map +0 -1
- package/dist/workflows-BjLruwQB.js.map +0 -1
- package/dist/workflows-CxPsDCnW.cjs.map +0 -1
|
@@ -10,7 +10,7 @@ import { ZodFirstPartyTypeKind } from "zod/v3";
|
|
|
10
10
|
import { z as z$2 } from "zod";
|
|
11
11
|
import { MastraMemory, getMemoryTokenBoundary, getThreadOMMetadata, isAfterMemoryTokenBoundary, isThreadTitlePinned, loadMessageHistory, normalizeMessageHistoryConfig, parseMemoryRequestContext, setThreadOMMetadata } from "@mastra/core/memory";
|
|
12
12
|
import { Agent, MessageList, isSupportedLanguageModel, tryGenerateWithJsonFallback, tryStreamWithJsonFallback } from "@mastra/core/agent";
|
|
13
|
-
import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
|
|
13
|
+
import { ErrorCategory, ErrorDomain, MastraError, classifyProviderError } from "@mastra/core/error";
|
|
14
14
|
import { ModelRouterLanguageModel, modelSupportsAttachments, modelSupportsTemperature, resolveModelConfig } from "@mastra/core/llm";
|
|
15
15
|
import { createTool } from "@mastra/core/tools";
|
|
16
16
|
import { inspect, promisify } from "util";
|
|
@@ -8582,7 +8582,7 @@ function splitLines(text) {
|
|
|
8582
8582
|
else result.push(result.pop().slice(0, -1));
|
|
8583
8583
|
return result;
|
|
8584
8584
|
}
|
|
8585
|
-
// ../memory/dist/src-
|
|
8585
|
+
// ../memory/dist/src-kIpEG6XZ.js
|
|
8586
8586
|
var __defProp$3 = Object.defineProperty;
|
|
8587
8587
|
var __exportAll = (all, no_symbols) => {
|
|
8588
8588
|
let target = {};
|
|
@@ -35628,15 +35628,16 @@ var OmIncompleteResponseError = class extends Error {
|
|
|
35628
35628
|
}
|
|
35629
35629
|
};
|
|
35630
35630
|
/**
|
|
35631
|
-
* A model reply that finished but
|
|
35631
|
+
* A model reply that finished but carries nothing usable: no text, only whitespace,
|
|
35632
|
+
* or text with no recognised Observer sections (e.g. a refusal).
|
|
35632
35633
|
* Retryable, so an empty reply is retried like a transport error.
|
|
35633
35634
|
*
|
|
35634
35635
|
* @internal
|
|
35635
35636
|
*/
|
|
35636
35637
|
var OmEmptyResponseError = class extends Error {
|
|
35637
35638
|
isRetryable = true;
|
|
35638
|
-
constructor(label) {
|
|
35639
|
-
super(`${label} returned
|
|
35639
|
+
constructor(label, what = "empty output") {
|
|
35640
|
+
super(`${label} returned ${what}`);
|
|
35640
35641
|
this.name = "OmEmptyResponseError";
|
|
35641
35642
|
}
|
|
35642
35643
|
};
|
|
@@ -38157,13 +38158,15 @@ function parseMemorySectionXml(content) {
|
|
|
38157
38158
|
suggestedResponse: "",
|
|
38158
38159
|
threadTitle: ""
|
|
38159
38160
|
};
|
|
38160
|
-
const observationsMatches = [...content.matchAll(/^[ \t]*<observations>([\s\S]*?)^[ \t]*<\/observations
|
|
38161
|
-
if (observationsMatches.length > 0) result.observations = observationsMatches.map((m) => m[1]?.trim() ?? "").filter(Boolean).join("\n");
|
|
38161
|
+
const observationsMatches = [...content.matchAll(/^[ \t]*<observations>(?:([^\r\n]*?)<\/observations>[ \t]*$|([\s\S]*?)^[ \t]*<\/observations>)/gim)];
|
|
38162
|
+
if (observationsMatches.length > 0) result.observations = observationsMatches.map((m) => (m[1] ?? m[2])?.trim() ?? "").filter(Boolean).join("\n");
|
|
38162
38163
|
else result.observations = extractListItemsOnly(content);
|
|
38163
|
-
const currentTaskMatch = content.match(/^[ \t]*<current-task>([\s\S]*?)^[ \t]*<\/current-task
|
|
38164
|
-
|
|
38165
|
-
|
|
38166
|
-
|
|
38164
|
+
const currentTaskMatch = content.match(/^[ \t]*<current-task>(?:([^\r\n]*?)<\/current-task>[ \t]*$|([\s\S]*?)^[ \t]*<\/current-task>)/im);
|
|
38165
|
+
const currentTask = currentTaskMatch?.[1] ?? currentTaskMatch?.[2];
|
|
38166
|
+
if (currentTask) result.currentTask = currentTask.trim();
|
|
38167
|
+
const suggestedResponseMatch = content.match(/^[ \t]*<suggested-response>(?:([^\r\n]*?)<\/suggested-response>[ \t]*$|([\s\S]*?)^[ \t]*<\/suggested-response>)/im);
|
|
38168
|
+
const suggestedResponse = suggestedResponseMatch?.[1] ?? suggestedResponseMatch?.[2];
|
|
38169
|
+
if (suggestedResponse) result.suggestedResponse = suggestedResponse.trim();
|
|
38167
38170
|
const threadTitleMatch = content.match(/^[ \t]*<thread-title>([\s\S]*?)<\/thread-title>/im);
|
|
38168
38171
|
if (threadTitleMatch?.[1]) result.threadTitle = threadTitleMatch[1].trim();
|
|
38169
38172
|
return result;
|
|
@@ -38732,7 +38735,7 @@ var ObserverRunner = class {
|
|
|
38732
38735
|
callback: (childObservabilityContext) => this.withAbortCheck(async () => {
|
|
38733
38736
|
try {
|
|
38734
38737
|
attemptMemory = temporaryMemory?.newThread();
|
|
38735
|
-
return assertNonEmptyObserverOutput(assertCompleteModelResponse(await (await agent.stream(observerMessages, {
|
|
38738
|
+
return assertRecognizedObserverOutput(assertNonEmptyObserverOutput(assertCompleteModelResponse(await (await agent.stream(observerMessages, {
|
|
38736
38739
|
maxSteps: 1,
|
|
38737
38740
|
modelSettings: { ...this.observationConfig.modelSettings },
|
|
38738
38741
|
providerOptions: this.observationConfig.providerOptions,
|
|
@@ -38741,7 +38744,7 @@ var ObserverRunner = class {
|
|
|
38741
38744
|
onChunk: onActivity,
|
|
38742
38745
|
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
38743
38746
|
...childObservabilityContext
|
|
38744
|
-
})).getFullOutput(), "OM observer"), "OM observer");
|
|
38747
|
+
})).getFullOutput(), "OM observer"), "OM observer"), "OM observer", (text) => hasSingleThreadObserverContent(text, activeExtractors));
|
|
38745
38748
|
} catch (error) {
|
|
38746
38749
|
this.mastra?.getLogger?.().error("OM observer provider call failed", {
|
|
38747
38750
|
diagnostic: formatOmError(error),
|
|
@@ -38844,7 +38847,7 @@ var ObserverRunner = class {
|
|
|
38844
38847
|
for (const threadId of allThreadOrder) {
|
|
38845
38848
|
const threadResult = output.results.get(threadId);
|
|
38846
38849
|
if (!threadResult) {
|
|
38847
|
-
output.results.set(threadId, { observations: "" });
|
|
38850
|
+
if (!messagesByThread.has(threadId)) output.results.set(threadId, { observations: "" });
|
|
38848
38851
|
continue;
|
|
38849
38852
|
}
|
|
38850
38853
|
threadResult.observations = await applyTextTransform(this.hooks, "afterObservation", threadResult.observations, contextFor(threadId));
|
|
@@ -38946,7 +38949,7 @@ var ObserverRunner = class {
|
|
|
38946
38949
|
},
|
|
38947
38950
|
callback: (childObservabilityContext) => this.withAbortCheck(async () => {
|
|
38948
38951
|
try {
|
|
38949
|
-
return assertNonEmptyObserverOutput(assertCompleteModelResponse(await (await agent.stream(observerMessages, {
|
|
38952
|
+
return assertRecognizedObserverOutput(assertNonEmptyObserverOutput(assertCompleteModelResponse(await (await agent.stream(observerMessages, {
|
|
38950
38953
|
maxSteps: 1,
|
|
38951
38954
|
modelSettings: { ...this.observationConfig.modelSettings },
|
|
38952
38955
|
providerOptions: this.observationConfig.providerOptions,
|
|
@@ -38954,7 +38957,7 @@ var ObserverRunner = class {
|
|
|
38954
38957
|
onChunk: onActivity,
|
|
38955
38958
|
...internalRequestContext ? { requestContext: internalRequestContext } : {},
|
|
38956
38959
|
...childObservabilityContext
|
|
38957
|
-
})).getFullOutput(), "OM multi-thread observer"), "OM multi-thread observer");
|
|
38960
|
+
})).getFullOutput(), "OM multi-thread observer"), "OM multi-thread observer"), "OM multi-thread observer", (text) => hasMultiThreadObserverContent(text, activeExtractors, threadOrder));
|
|
38958
38961
|
} catch (error) {
|
|
38959
38962
|
this.mastra?.getLogger?.().error("OM multi-thread observer provider call failed", {
|
|
38960
38963
|
diagnostic: formatOmError(error),
|
|
@@ -39031,8 +39034,7 @@ var ObserverRunner = class {
|
|
|
39031
39034
|
extractors: activeExtractors
|
|
39032
39035
|
});
|
|
39033
39036
|
}
|
|
39034
|
-
for (const threadId of
|
|
39035
|
-
for (const msgs of messagesByThread.values()) for (const msg of msgs) this.observedMessageIds.add(msg.id);
|
|
39037
|
+
for (const threadId of results.keys()) for (const msg of messagesByThread.get(threadId) ?? []) this.observedMessageIds.add(msg.id);
|
|
39036
39038
|
const usage = result.totalUsage ?? result.usage;
|
|
39037
39039
|
return {
|
|
39038
39040
|
results,
|
|
@@ -39056,6 +39058,29 @@ function assertNonEmptyObserverOutput(output, label) {
|
|
|
39056
39058
|
return output;
|
|
39057
39059
|
}
|
|
39058
39060
|
/**
|
|
39061
|
+
* A reply with text but nothing the parser recognises (e.g. a refusal like
|
|
39062
|
+
* "I can't help with that") parses to zero observations. Committing it would drop
|
|
39063
|
+
* the observed messages the same way an empty reply does, so it gets the same retry.
|
|
39064
|
+
* Degenerate replies pass through; the degenerate retry handles them.
|
|
39065
|
+
*/
|
|
39066
|
+
function assertRecognizedObserverOutput(output, label, isRecognized) {
|
|
39067
|
+
if (!isRecognized(output.text)) throw new OmEmptyResponseError(label, "no observations");
|
|
39068
|
+
return output;
|
|
39069
|
+
}
|
|
39070
|
+
function hasSingleThreadObserverContent(text, extractors) {
|
|
39071
|
+
if (/^[ \t]*<observations>/im.test(text)) return true;
|
|
39072
|
+
const parsed = parseObserverOutput(text, extractors);
|
|
39073
|
+
return Boolean(parsed.degenerate || parsed.observations || parsed.currentTask || parsed.suggestedContinuation || parsed.threadTitle || Object.keys(parsed.extractedValues ?? {}).length || parsed.extractionFailures?.length);
|
|
39074
|
+
}
|
|
39075
|
+
/**
|
|
39076
|
+
* Multi-thread replies carry every recognised section inside `<thread>` blocks, so a reply
|
|
39077
|
+
* with no block for any requested thread has nothing to record.
|
|
39078
|
+
*/
|
|
39079
|
+
function hasMultiThreadObserverContent(text, extractors, threadOrder) {
|
|
39080
|
+
const parsed = parseMultiThreadObserverOutput(text, extractors);
|
|
39081
|
+
return Boolean(parsed.degenerate || threadOrder.some((threadId) => parsed.threads.has(threadId)));
|
|
39082
|
+
}
|
|
39083
|
+
/**
|
|
39059
39084
|
* Synchronous image dimension lookup for in-memory image buffers.
|
|
39060
39085
|
*
|
|
39061
39086
|
* Uses `probe-image-size`'s sync parsers rather than `image-size`, which has unfixed
|
|
@@ -39366,7 +39391,7 @@ async function resolveImageDimensionsAsync(part) {
|
|
|
39366
39391
|
const url = resolveHttpAssetUrl(getObjectValue(part, "image") ?? getObjectValue(part, "data"));
|
|
39367
39392
|
if (!url) return existing;
|
|
39368
39393
|
try {
|
|
39369
|
-
const probeImageSize = (await import("./probe-image-size-
|
|
39394
|
+
const probeImageSize = (await import("./probe-image-size-CpV7slsd.js").then((m) => /* @__PURE__ */ __toESM$1(m.default, 1))).default;
|
|
39370
39395
|
const probed = await probeImageSize(url, {
|
|
39371
39396
|
open_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
39372
39397
|
response_timeout: REMOTE_IMAGE_PROBE_TIMEOUT_MS,
|
|
@@ -50553,53 +50578,6 @@ ${formattedMessages}
|
|
|
50553
50578
|
});
|
|
50554
50579
|
}
|
|
50555
50580
|
};
|
|
50556
|
-
/**
|
|
50557
|
-
* Detects provider errors that reject a request for exceeding the model's context window.
|
|
50558
|
-
*
|
|
50559
|
-
* Providers report this with different codes and wording, so this matches the known shapes
|
|
50560
|
-
* (OpenAI and OpenAI-compatible APIs, Anthropic, Google, Bedrock, xAI, Mistral, local servers)
|
|
50561
|
-
* against the error's message, code, response body and causes.
|
|
50562
|
-
*/
|
|
50563
|
-
const CONTEXT_OVERFLOW_PATTERNS = [
|
|
50564
|
-
/context[_ ]length[_ ]exceeded/i,
|
|
50565
|
-
/maximum context length/i,
|
|
50566
|
-
/maximum prompt length/i,
|
|
50567
|
-
/prompt is too long/i,
|
|
50568
|
-
/input is too long/i,
|
|
50569
|
-
/exceed\w*\b[^.]{0,40}\bcontext (?:window|length|limit|size)/i,
|
|
50570
|
-
/input token count[^.]{0,40}exceeds the maximum/i,
|
|
50571
|
-
/reduce the length of the (?:messages|prompt|input)/i
|
|
50572
|
-
];
|
|
50573
|
-
const MAX_CAUSE_DEPTH = 4;
|
|
50574
|
-
function collectErrorText(error, depth = 0) {
|
|
50575
|
-
if (depth > MAX_CAUSE_DEPTH || error == null) return [];
|
|
50576
|
-
if (typeof error === "string") return [error];
|
|
50577
|
-
if (typeof error !== "object") return [];
|
|
50578
|
-
const record = error;
|
|
50579
|
-
const texts = [];
|
|
50580
|
-
for (const key of [
|
|
50581
|
-
"message",
|
|
50582
|
-
"code",
|
|
50583
|
-
"type",
|
|
50584
|
-
"responseBody"
|
|
50585
|
-
]) {
|
|
50586
|
-
const value = record[key];
|
|
50587
|
-
if (typeof value === "string") texts.push(value);
|
|
50588
|
-
}
|
|
50589
|
-
if (record.data && typeof record.data === "object") texts.push(...collectErrorText(record.data.error ?? record.data, depth + 1));
|
|
50590
|
-
if (record.error && typeof record.error === "object") texts.push(...collectErrorText(record.error, depth + 1));
|
|
50591
|
-
texts.push(...collectErrorText(record.cause, depth + 1));
|
|
50592
|
-
return texts;
|
|
50593
|
-
}
|
|
50594
|
-
function isRateLimited(error, depth = 0) {
|
|
50595
|
-
if (depth > MAX_CAUSE_DEPTH || error == null || typeof error !== "object") return false;
|
|
50596
|
-
const record = error;
|
|
50597
|
-
return record.statusCode === 429 || isRateLimited(record.cause, depth + 1);
|
|
50598
|
-
}
|
|
50599
|
-
function isContextOverflowError(error) {
|
|
50600
|
-
if (isRateLimited(error)) return false;
|
|
50601
|
-
return collectErrorText(error).some((text) => CONTEXT_OVERFLOW_PATTERNS.some((pattern) => pattern.test(text)));
|
|
50602
|
-
}
|
|
50603
50581
|
const TEMPORAL_GAP_REMINDER_TYPE = "temporal-gap";
|
|
50604
50582
|
function getTemporalGapReminderText(gapText, timestamp) {
|
|
50605
50583
|
return `${gapText} — ${formatTemporalTimestamp(new Date(timestamp))}`;
|
|
@@ -50999,7 +50977,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
50999
50977
|
if (!this.engine.getObservationConfig().observeOnContextOverflow) return;
|
|
51000
50978
|
if (state[GATEWAY_STATE_KEY]) return;
|
|
51001
50979
|
if (state[CONTEXT_OVERFLOW_STEP_KEY] === stepNumber) return;
|
|
51002
|
-
if (
|
|
50980
|
+
if (classifyProviderError(error) !== "context_overflow") return;
|
|
51003
50981
|
const context = this.engine.getThreadContext(requestContext, messageList);
|
|
51004
50982
|
if (!context) return;
|
|
51005
50983
|
if (parseMemoryRequestContext(requestContext)?.memoryConfig?.readOnly) return;
|
|
@@ -54902,7 +54880,7 @@ const createModelInstance = async (provider, modelId, version = "v2") => {
|
|
|
54902
54880
|
try {
|
|
54903
54881
|
const providerFn = version === `v1` ? { v1: {
|
|
54904
54882
|
openai: async () => {
|
|
54905
|
-
const { openai } = await import("./dist-
|
|
54883
|
+
const { openai } = await import("./dist-C-L2kyKZ.js");
|
|
54906
54884
|
return openai(modelId);
|
|
54907
54885
|
},
|
|
54908
54886
|
anthropic: async () => {
|
|
@@ -57083,7 +57061,7 @@ export const mastra = new Mastra({
|
|
|
57083
57061
|
if (includeMetadata) {
|
|
57084
57062
|
item.size = stats.size;
|
|
57085
57063
|
item.lastModified = stats.mtime.toISOString();
|
|
57086
|
-
item.permissions = `0${(stats.mode &
|
|
57064
|
+
item.permissions = `0${(stats.mode & 511).toString(8)}`;
|
|
57087
57065
|
}
|
|
57088
57066
|
items.push(item);
|
|
57089
57067
|
if (recursive && type === "directory") await processDirectory(fullPath, currentDepth + 1);
|
|
@@ -62606,4 +62584,4 @@ const agentBuilderWorkflows = {
|
|
|
62606
62584
|
};
|
|
62607
62585
|
export { require_exif_utils as a, agentBuilderWorkflows, require_svg_header as i, openai as n, require_miaf_utils as o, require_sync as r, require_common as s, createOpenAI as t };
|
|
62608
62586
|
|
|
62609
|
-
//# sourceMappingURL=dist-
|
|
62587
|
+
//# sourceMappingURL=dist-PlsLrwz8.js.map
|