@mastra/server 1.56.0-alpha.5 → 1.56.0-alpha.7
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 +23 -0
- package/dist/_types/@internal_core/dist/storage/index.d.ts +8 -0
- package/dist/{a2a-Dmw3AD3r.cjs → a2a-CE7HKP5V.cjs} +3 -3
- package/dist/{a2a-Dmw3AD3r.cjs.map → a2a-CE7HKP5V.cjs.map} +1 -1
- package/dist/{a2a-BHqh8DdO.js → a2a-_3LYIc9y.js} +3 -3
- package/dist/{a2a-BHqh8DdO.js.map → a2a-_3LYIc9y.js.map} +1 -1
- package/dist/{api-schema-manifest-BD9sVZgj.cjs → api-schema-manifest-Ba-Ssw4H.cjs} +3 -3
- package/dist/{api-schema-manifest-BD9sVZgj.cjs.map → api-schema-manifest-Ba-Ssw4H.cjs.map} +1 -1
- package/dist/{api-schema-manifest-DOHg_30B.js → api-schema-manifest-DbTP-DpV.js} +3 -3
- package/dist/{api-schema-manifest-DOHg_30B.js.map → api-schema-manifest-DbTP-DpV.js.map} +1 -1
- package/dist/{background-tasks-BuRJRi1i.cjs → background-tasks-CYgzzUnb.cjs} +2 -2
- package/dist/{background-tasks-BuRJRi1i.cjs.map → background-tasks-CYgzzUnb.cjs.map} +1 -1
- package/dist/{background-tasks-BdcOtHq3.js → background-tasks-DnmhLalp.js} +2 -2
- package/dist/{background-tasks-BdcOtHq3.js.map → background-tasks-DnmhLalp.js.map} +1 -1
- package/dist/{builder-registry-NmiGAW1q.cjs → builder-registry-C_PysvMI.cjs} +3 -3
- package/dist/{builder-registry-NmiGAW1q.cjs.map → builder-registry-C_PysvMI.cjs.map} +1 -1
- package/dist/{builder-registry-dh22nXUR.js → builder-registry-DaPvPspl.js} +3 -3
- package/dist/{builder-registry-dh22nXUR.js.map → builder-registry-DaPvPspl.js.map} +1 -1
- package/dist/{channels-Cv5RlwiT.cjs → channels-BonQBJT0.cjs} +2 -2
- package/dist/{channels-Cv5RlwiT.cjs.map → channels-BonQBJT0.cjs.map} +1 -1
- package/dist/{channels-Do3L4evC.js → channels-BqkOxxEk.js} +2 -2
- package/dist/{channels-Do3L4evC.js.map → channels-BqkOxxEk.js.map} +1 -1
- package/dist/{datasets-7yYpHm7l.cjs → datasets-Cvix7Rms.cjs} +6 -1
- package/dist/datasets-Cvix7Rms.cjs.map +1 -0
- package/dist/{datasets-CopqHYDy.js → datasets-dhXnHLAL.js} +6 -1
- package/dist/datasets-dhXnHLAL.js.map +1 -0
- package/dist/{dist-D9hQEsv9.cjs → dist-CpDWlJbf.cjs} +69 -16
- package/dist/dist-CpDWlJbf.cjs.map +1 -0
- package/dist/{dist-BlHxui7N.js → dist-Epz-mpJn.js} +65 -12
- package/dist/dist-Epz-mpJn.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{editor-builder-Dn6ru5DU.cjs → editor-builder-ByNr3nc9.cjs} +2 -2
- package/dist/{editor-builder-Dn6ru5DU.cjs.map → editor-builder-ByNr3nc9.cjs.map} +1 -1
- package/dist/{editor-builder-DkGLV2Gj.js → editor-builder-CW9Tcqg1.js} +2 -2
- package/dist/{editor-builder-DkGLV2Gj.js.map → editor-builder-CW9Tcqg1.js.map} +1 -1
- package/dist/{observability-new-endpoints-C1g-Gvjz.js → observability-new-endpoints-CCyqX1Ra.js} +3 -2
- package/dist/observability-new-endpoints-CCyqX1Ra.js.map +1 -0
- package/dist/{observability-new-endpoints-Dp2vQgwB.cjs → observability-new-endpoints-DFBDedGH.cjs} +3 -2
- package/dist/observability-new-endpoints-DFBDedGH.cjs.map +1 -0
- package/dist/{route-builder-CXe0EI1P.js → route-builder-CIk5k35M.js} +2 -2
- package/dist/{route-builder-CXe0EI1P.js.map → route-builder-CIk5k35M.js.map} +1 -1
- package/dist/{route-builder-BZaWjoDk.cjs → route-builder-CgLVYL1c.cjs} +4 -4
- package/dist/{route-builder-BZaWjoDk.cjs.map → route-builder-CgLVYL1c.cjs.map} +1 -1
- package/dist/{routes-Bmt4vUom.cjs → routes-2WgTU1wN.cjs} +10 -10
- package/dist/{routes-Bmt4vUom.cjs.map → routes-2WgTU1wN.cjs.map} +1 -1
- package/dist/{routes-YeBVxmmg.js → routes-CN8wYsyr.js} +10 -10
- package/dist/{routes-YeBVxmmg.js.map → routes-CN8wYsyr.js.map} +1 -1
- package/dist/{schedules-Dury8Ely.cjs → schedules-CK3-IE0h.cjs} +2 -2
- package/dist/{schedules-Dury8Ely.cjs.map → schedules-CK3-IE0h.cjs.map} +1 -1
- package/dist/{schedules-ziUJUmzR.js → schedules-qxFoU-Tb.js} +2 -2
- package/dist/{schedules-ziUJUmzR.js.map → schedules-qxFoU-Tb.js.map} +1 -1
- package/dist/schema-B8-5YCsA.js +2 -0
- package/dist/schema-BieM1qrc.cjs +1 -0
- package/dist/{schema-Ba6HLBWs-29iOFPqZ.cjs → schema-Bv9OdW1f-BY6u3u8K.cjs} +22 -4
- package/dist/schema-Bv9OdW1f-BY6u3u8K.cjs.map +1 -0
- package/dist/{schema-Ba6HLBWs-C2m5ORpo.js → schema-Bv9OdW1f-CIOfv-3w.js} +22 -4
- package/dist/schema-Bv9OdW1f-CIOfv-3w.js.map +1 -0
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +3 -3
- package/dist/server/handlers/agent-builder.js +3 -3
- package/dist/server/handlers/agent-controller.cjs +1 -1
- package/dist/server/handlers/agent-controller.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +2 -2
- package/dist/server/handlers/agent-versions.js +2 -2
- package/dist/server/handlers/agents.cjs +5 -5
- package/dist/server/handlers/agents.js +4 -4
- package/dist/server/handlers/auth.cjs +1 -1
- package/dist/server/handlers/auth.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/builder-registry.cjs +1 -1
- package/dist/server/handlers/builder-registry.js +1 -1
- package/dist/server/handlers/channels.cjs +1 -1
- package/dist/server/handlers/channels.js +1 -1
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/datasets.cjs +8 -6
- package/dist/server/handlers/datasets.cjs.map +1 -1
- package/dist/server/handlers/datasets.d.ts +20 -0
- package/dist/server/handlers/datasets.d.ts.map +1 -1
- package/dist/server/handlers/datasets.js +8 -6
- package/dist/server/handlers/datasets.js.map +1 -1
- package/dist/server/handlers/editor-builder.cjs +1 -1
- package/dist/server/handlers/editor-builder.js +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/mcp-client-versions.cjs +2 -2
- package/dist/server/handlers/mcp-client-versions.js +2 -2
- package/dist/server/handlers/mcp.cjs +1 -1
- package/dist/server/handlers/mcp.js +1 -1
- package/dist/server/handlers/memory.cjs +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability-new-endpoints.cjs +1 -1
- package/dist/server/handlers/observability-new-endpoints.d.ts +16 -0
- package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
- package/dist/server/handlers/observability-new-endpoints.js +1 -1
- package/dist/server/handlers/observability-shared.cjs +1 -1
- package/dist/server/handlers/observability-shared.js +1 -1
- package/dist/server/handlers/observability.cjs +2 -2
- package/dist/server/handlers/observability.js +2 -2
- package/dist/server/handlers/processor-providers.cjs +1 -1
- package/dist/server/handlers/processor-providers.js +1 -1
- package/dist/server/handlers/processors.cjs +1 -1
- package/dist/server/handlers/processors.js +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +2 -2
- package/dist/server/handlers/prompt-block-versions.js +2 -2
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/schedules.cjs +1 -1
- package/dist/server/handlers/schedules.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +2 -2
- package/dist/server/handlers/scorer-versions.js +2 -2
- package/dist/server/handlers/scores.cjs +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +3 -3
- package/dist/server/handlers/stored-agent-favorites.js +3 -3
- package/dist/server/handlers/stored-agents.cjs +3 -3
- package/dist/server/handlers/stored-agents.js +3 -3
- package/dist/server/handlers/stored-mcp-clients.cjs +2 -2
- package/dist/server/handlers/stored-mcp-clients.js +2 -2
- package/dist/server/handlers/stored-prompt-blocks.cjs +2 -2
- package/dist/server/handlers/stored-prompt-blocks.js +2 -2
- package/dist/server/handlers/stored-scorers.cjs +2 -2
- package/dist/server/handlers/stored-scorers.js +2 -2
- package/dist/server/handlers/stored-skill-favorites.cjs +3 -3
- package/dist/server/handlers/stored-skill-favorites.js +3 -3
- package/dist/server/handlers/stored-skills.cjs +3 -3
- package/dist/server/handlers/stored-skills.js +3 -3
- package/dist/server/handlers/stored-workflows.cjs +1 -1
- package/dist/server/handlers/stored-workflows.js +1 -1
- package/dist/server/handlers/stored-workspaces.cjs +2 -2
- package/dist/server/handlers/stored-workspaces.js +2 -2
- package/dist/server/handlers/system.cjs +2 -2
- package/dist/server/handlers/system.js +2 -2
- package/dist/server/handlers/tool-providers.cjs +1 -1
- package/dist/server/handlers/tool-providers.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +4 -4
- package/dist/server/handlers/vector.cjs +1 -1
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/workflows.cjs +2 -2
- package/dist/server/handlers/workflows.js +2 -2
- package/dist/server/handlers/workspace.cjs +1 -1
- package/dist/server/handlers/workspace.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +2 -2
- package/dist/server/schemas/datasets.d.ts +8 -0
- package/dist/server/schemas/datasets.d.ts.map +1 -1
- package/dist/server/schemas/index.cjs +1 -1
- package/dist/server/schemas/index.js +1 -1
- package/dist/server/server-adapter/index.cjs +3 -3
- package/dist/server/server-adapter/index.js +3 -3
- package/dist/server/server-adapter/routes/datasets.d.ts +20 -0
- package/dist/server/server-adapter/routes/datasets.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/observability.d.ts +8 -0
- package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
- package/dist/{stored-workflows-B3zZJg8e.js → stored-workflows-OanG0TmB.js} +2 -2
- package/dist/{stored-workflows-B3zZJg8e.js.map → stored-workflows-OanG0TmB.js.map} +1 -1
- package/dist/{stored-workflows-RgQKpn7N.cjs → stored-workflows-pCiWK305.cjs} +2 -2
- package/dist/{stored-workflows-RgQKpn7N.cjs.map → stored-workflows-pCiWK305.cjs.map} +1 -1
- package/dist/{utils-DVelcVp5.js → utils-qxLrCsRx.js} +3 -3
- package/dist/{utils-DVelcVp5.js.map → utils-qxLrCsRx.js.map} +1 -1
- package/dist/{utils-5wLvbOLW.cjs → utils-xsPNtHk8.cjs} +5 -5
- package/dist/{utils-5wLvbOLW.cjs.map → utils-xsPNtHk8.cjs.map} +1 -1
- package/package.json +5 -5
- package/dist/datasets-7yYpHm7l.cjs.map +0 -1
- package/dist/datasets-CopqHYDy.js.map +0 -1
- package/dist/dist-BlHxui7N.js.map +0 -1
- package/dist/dist-D9hQEsv9.cjs.map +0 -1
- package/dist/observability-new-endpoints-C1g-Gvjz.js.map +0 -1
- package/dist/observability-new-endpoints-Dp2vQgwB.cjs.map +0 -1
- package/dist/schema-BXx4ex7A.cjs +0 -1
- package/dist/schema-Ba6HLBWs-29iOFPqZ.cjs.map +0 -1
- package/dist/schema-Ba6HLBWs-C2m5ORpo.js.map +0 -1
- package/dist/schema-CcKMuta9.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __toESM$1, r as __require, t as __commonJSMin$1 } from "./rolldown-runtime-DuvcJU0W.js";
|
|
2
|
-
import { n as standardSchemaToJSONSchema, r as toStandardSchema$1, t as isStandardSchemaWithJSON$1 } from "./schema-
|
|
3
|
-
import "./schema-
|
|
2
|
+
import { n as standardSchemaToJSONSchema, r as toStandardSchema$1, t as isStandardSchemaWithJSON$1 } from "./schema-Bv9OdW1f-CIOfv-3w.js";
|
|
3
|
+
import "./schema-B8-5YCsA.js";
|
|
4
4
|
import { openai } from "./dist-DyBO3IVt.js";
|
|
5
5
|
import { createRequire } from "module";
|
|
6
6
|
import * as z4 from "zod/v4";
|
|
@@ -5958,7 +5958,7 @@ function splitLines(text) {
|
|
|
5958
5958
|
return result;
|
|
5959
5959
|
}
|
|
5960
5960
|
//#endregion
|
|
5961
|
-
//#region ../memory/dist/src-
|
|
5961
|
+
//#region ../memory/dist/src-BgdYYHLc.js
|
|
5962
5962
|
var __defProp$4 = Object.defineProperty;
|
|
5963
5963
|
var __exportAll = (all, no_symbols) => {
|
|
5964
5964
|
let target = {};
|
|
@@ -20498,7 +20498,7 @@ var constants_exports = /* @__PURE__ */ __exportAll({
|
|
|
20498
20498
|
OBSERVATION_CONTEXT_INSTRUCTIONS: () => OBSERVATION_CONTEXT_INSTRUCTIONS,
|
|
20499
20499
|
OBSERVATION_CONTEXT_PROMPT: () => OBSERVATION_CONTEXT_PROMPT,
|
|
20500
20500
|
OBSERVATION_CONTINUATION_HINT: () => OBSERVATION_CONTINUATION_HINT,
|
|
20501
|
-
|
|
20501
|
+
getRetrievalInstructions: () => getRetrievalInstructions
|
|
20502
20502
|
});
|
|
20503
20503
|
/**
|
|
20504
20504
|
* Default configuration values matching the spec
|
|
@@ -20561,8 +20561,22 @@ SYSTEM REMINDERS: Messages wrapped in <system-reminder>...</system-reminder> con
|
|
|
20561
20561
|
/**
|
|
20562
20562
|
* Instructions for retrieval mode — explains observation-group ranges and the recall tool.
|
|
20563
20563
|
* Appended to context when `retrieval` is enabled.
|
|
20564
|
+
*
|
|
20565
|
+
* The content adapts to the retrieval scope:
|
|
20566
|
+
* - `'resource'`: covers routing between `search`, `threads`, and `messages` across
|
|
20567
|
+
* all of the user's threads, including fallback when search results are unsuitable.
|
|
20568
|
+
* - `'thread'`: covers cursor-based browsing and search within the current thread.
|
|
20569
|
+
*
|
|
20570
|
+
* @param scope - The retrieval scope the recall tool was registered with.
|
|
20571
|
+
* @param customInstructions - Optional application-provided guidance appended after
|
|
20572
|
+
* the native instructions. Never replaces them.
|
|
20573
|
+
* @param searchEnabled - Whether semantic search (`retrieval: { vector: true }`) is
|
|
20574
|
+
* available. When false, the guidance only covers \`threads\`/\`messages\` browsing so
|
|
20575
|
+
* the agent is not steered toward a mode that cannot work.
|
|
20564
20576
|
*/
|
|
20565
|
-
|
|
20577
|
+
function getRetrievalInstructions(scope = "resource", customInstructions, searchEnabled = true) {
|
|
20578
|
+
const isResource = scope === "resource";
|
|
20579
|
+
const base = `## Recall — looking up source messages
|
|
20566
20580
|
|
|
20567
20581
|
Your memory is comprised of observations which are sometimes wrapped in <observation-group> xml tags containing ranges like <observation-group range="startId:endId">. These ranges point back to the raw messages that each observation group was derived from. The original messages are still available — use the **recall** tool to retrieve them.
|
|
20568
20582
|
|
|
@@ -20570,11 +20584,32 @@ Your memory is comprised of observations which are sometimes wrapped in <observa
|
|
|
20570
20584
|
- The user asks you to **repeat, show, or reproduce** something from a past conversation
|
|
20571
20585
|
- The user asks for **exact content** — code, text, quotes, error messages, URLs, file paths, specific numbers
|
|
20572
20586
|
- Your observations mention something but your memory lacks the detail needed to fully answer (e.g. you know a blog post was shared but only have a summary of it)
|
|
20573
|
-
- You want to **verify or expand on** an observation before responding
|
|
20587
|
+
- You want to **verify or expand on** an observation before responding${isResource ? `
|
|
20588
|
+
- The user references another conversation that your observations don't cover — even if you have no observations yet, their other threads may contain it` : ""}
|
|
20574
20589
|
|
|
20575
20590
|
**Default to using recall when the user references specific past content.** Your observations capture the gist, not the details. If there's any doubt whether your memory is complete enough, use recall.
|
|
20576
20591
|
|
|
20577
|
-
|
|
20592
|
+
${isResource ? searchEnabled ? `### Choosing a mode
|
|
20593
|
+
The recall tool works across ALL of this user's conversation threads, not just the current one.
|
|
20594
|
+
|
|
20595
|
+
- Use \`mode: "search"\` with a \`query\` when you don't know which thread contains the answer. Each result includes its thread ID and the raw message IDs it came from, which you can use as a \`cursor\`.
|
|
20596
|
+
- Use \`mode: "messages"\` when you already know the thread — pass \`threadId\` to read another thread, or a \`cursor\` from an observation-group range or a search result.
|
|
20597
|
+
- Use \`mode: "threads"\` to list the user's threads (IDs, titles, dates) when you need to discover where something was discussed. Use \`before\`/\`after\` to narrow by date.
|
|
20598
|
+
|
|
20599
|
+
**If search results look irrelevant, do not give up.** Search only covers content that has been indexed — a short or recent conversation may exist in raw message history before any observation of it was created. When search returns nothing suitable but the user is clearly referring to a past conversation, call \`mode: "threads"\` to find candidate threads (titles and dates are strong clues), then read them with \`mode: "messages"\`. If a search result already gives you a thread ID, go straight to \`mode: "messages"\`.` : `### Choosing a mode
|
|
20600
|
+
The recall tool works across ALL of this user's conversation threads, not just the current one.
|
|
20601
|
+
|
|
20602
|
+
- Use \`mode: "threads"\` to list the user's threads (IDs, titles, dates) when you need to discover where something was discussed. Use \`before\`/\`after\` to narrow by date.
|
|
20603
|
+
- Use \`mode: "messages"\` when you know the thread — pass \`threadId\` to read another thread, or a \`cursor\` from an observation-group range.
|
|
20604
|
+
|
|
20605
|
+
When the user refers to a past conversation you don't have a cursor for, call \`mode: "threads"\` to find candidate threads (titles and dates are strong clues), then read them with \`mode: "messages"\`. Raw history may exist for threads that have no observations yet.` : `### Choosing a mode
|
|
20606
|
+
The recall tool is limited to the current conversation thread.
|
|
20607
|
+
|
|
20608
|
+
- Use \`mode: "messages"\` (default) to page through this thread's message history near a cursor.${searchEnabled ? `
|
|
20609
|
+
- Use \`mode: "search"\` with a \`query\` to find messages by content within this thread.` : ""}
|
|
20610
|
+
- Use \`mode: "threads"\` to get the current thread's ID, title, and dates.`}
|
|
20611
|
+
|
|
20612
|
+
### How to use recall with a cursor
|
|
20578
20613
|
Each range has the format \`startId:endId\` where both are message IDs separated by a colon.
|
|
20579
20614
|
|
|
20580
20615
|
1. Find the observation group relevant to the user's question and extract the start or end ID from its range.
|
|
@@ -20600,9 +20635,16 @@ Low-detail results may include truncation hints like:
|
|
|
20600
20635
|
### When recall is NOT needed
|
|
20601
20636
|
- The user is asking for a high-level summary and your observations already cover it
|
|
20602
20637
|
- The question is about general preferences or facts that don't require source text
|
|
20603
|
-
|
|
20638
|
+
${isResource ? `- No relevant observation range exists AND ${searchEnabled ? "`search`/`threads`" : "`threads`"} turned up nothing — but remember that raw history may exist for threads that have no observations yet, so check before concluding the information is unavailable` : `- There is no relevant range in your observations for the topic`}
|
|
20604
20639
|
|
|
20605
20640
|
Observation groups with range IDs and your recall tool allows you to think back and remember details you're fuzzy on.`;
|
|
20641
|
+
const custom = customInstructions?.trim();
|
|
20642
|
+
if (!custom) return base;
|
|
20643
|
+
return `${base}
|
|
20644
|
+
|
|
20645
|
+
### Additional recall guidance
|
|
20646
|
+
${custom}`;
|
|
20647
|
+
}
|
|
20606
20648
|
const BUILT_IN_SLUGS = /* @__PURE__ */ new Set([
|
|
20607
20649
|
"current-task",
|
|
20608
20650
|
"suggested-response",
|
|
@@ -29544,6 +29586,11 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
29544
29586
|
scope;
|
|
29545
29587
|
/** Whether retrieval-mode observation groups are enabled. */
|
|
29546
29588
|
retrieval;
|
|
29589
|
+
/** Scope the recall tool was registered with — controls which retrieval instructions are injected. */
|
|
29590
|
+
retrievalScope;
|
|
29591
|
+
/** Application-provided guidance appended after the native retrieval instructions. */
|
|
29592
|
+
retrievalInstructions;
|
|
29593
|
+
retrievalSearch;
|
|
29547
29594
|
observationConfig;
|
|
29548
29595
|
reflectionConfig;
|
|
29549
29596
|
onDebugEvent;
|
|
@@ -29609,6 +29656,9 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
29609
29656
|
this.storage = config.storage;
|
|
29610
29657
|
this.scope = config.scope ?? "thread";
|
|
29611
29658
|
this.retrieval = Boolean(config.retrieval);
|
|
29659
|
+
this.retrievalScope = typeof config.retrieval === "object" ? config.retrieval.scope ?? "resource" : "resource";
|
|
29660
|
+
this.retrievalInstructions = typeof config.retrieval === "object" ? config.retrieval.instructions : void 0;
|
|
29661
|
+
this.retrievalSearch = typeof config.retrieval === "object" && Boolean(config.retrieval.vector);
|
|
29612
29662
|
this.onIndexObservations = config.onIndexObservations;
|
|
29613
29663
|
this.hooks = config.hooks;
|
|
29614
29664
|
this.mastra = config.mastra;
|
|
@@ -30257,7 +30307,7 @@ var ObservationalMemory = class ObservationalMemory {
|
|
|
30257
30307
|
formatObservationsForContext(observations, currentTask, suggestedResponse, extractedValues, unobservedContextBlocks, currentDate, retrieval = false) {
|
|
30258
30308
|
let optimized = retrieval ? renderObservationGroupsForReflection(observations) ?? optimizeObservationsForContext(observations) : optimizeObservationsForContext(observations);
|
|
30259
30309
|
if (currentDate) optimized = addRelativeTimeToObservations(optimized, currentDate);
|
|
30260
|
-
const messages = [`${OBSERVATION_CONTEXT_PROMPT}\n\n${OBSERVATION_CONTEXT_INSTRUCTIONS}${retrieval ? `\n\n${
|
|
30310
|
+
const messages = [`${OBSERVATION_CONTEXT_PROMPT}\n\n${OBSERVATION_CONTEXT_INSTRUCTIONS}${retrieval ? `\n\n${getRetrievalInstructions(this.retrievalScope, this.retrievalInstructions, this.retrievalSearch)}` : ""}`];
|
|
30261
30311
|
if (unobservedContextBlocks) messages.push(`The following content is from OTHER conversations different from the current conversation, they're here for reference, but they're not necessarily your focus:\nSTART_OTHER_CONVERSATIONS_BLOCK\n${unobservedContextBlocks}\nEND_OTHER_CONVERSATIONS_BLOCK`);
|
|
30262
30312
|
const observationChunks = this.splitObservationContextChunks(optimized);
|
|
30263
30313
|
if (observationChunks.length > 0) messages.push("<observations>", ...observationChunks);
|
|
@@ -30759,7 +30809,10 @@ ${formattedMessages}
|
|
|
30759
30809
|
async buildContextSystemMessages(opts) {
|
|
30760
30810
|
const { threadId, resourceId, unobservedContextBlocks } = opts;
|
|
30761
30811
|
const record = opts.record ?? await this.getOrCreateRecord(threadId, resourceId);
|
|
30762
|
-
if (!record.activeObservations)
|
|
30812
|
+
if (!record.activeObservations) {
|
|
30813
|
+
if (this.retrieval && this.retrievalScope === "resource") return [getRetrievalInstructions(this.retrievalScope, this.retrievalInstructions, this.retrievalSearch)];
|
|
30814
|
+
return;
|
|
30815
|
+
}
|
|
30763
30816
|
const omMetadata = getThreadOMMetadata((await this.storage.getThreadById({ threadId }))?.metadata);
|
|
30764
30817
|
const currentTask = omMetadata?.currentTask;
|
|
30765
30818
|
const suggestedResponse = omMetadata?.suggestedResponse;
|
|
@@ -31887,7 +31940,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
31887
31940
|
threadId,
|
|
31888
31941
|
resourceId
|
|
31889
31942
|
});
|
|
31890
|
-
const systemMessages = ctx.
|
|
31943
|
+
const systemMessages = ctx.omRecord ? await this.engine.buildContextSystemMessages({
|
|
31891
31944
|
threadId,
|
|
31892
31945
|
resourceId,
|
|
31893
31946
|
record: ctx.omRecord,
|
|
@@ -44432,4 +44485,4 @@ const agentBuilderWorkflows = {
|
|
|
44432
44485
|
//#endregion
|
|
44433
44486
|
export { agentBuilderWorkflows };
|
|
44434
44487
|
|
|
44435
|
-
//# sourceMappingURL=dist-
|
|
44488
|
+
//# sourceMappingURL=dist-Epz-mpJn.js.map
|