@mastra/memory 1.19.1-alpha.0 → 1.20.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 +26 -0
- package/dist/{chunk-D4J4XPGM.cjs → chunk-3Q3LOVQP.cjs} +9 -2
- package/dist/chunk-3Q3LOVQP.cjs.map +1 -0
- package/dist/{chunk-BCYGTJF2.js → chunk-BCWFD5J7.js} +51 -9
- package/dist/chunk-BCWFD5J7.js.map +1 -0
- package/dist/{chunk-IRMLP4QH.cjs → chunk-SMKIROLC.cjs} +74 -32
- package/dist/chunk-SMKIROLC.cjs.map +1 -0
- package/dist/{chunk-LSJJAJAF.js → chunk-VKRZ3O5X.js} +9 -3
- package/dist/chunk-VKRZ3O5X.js.map +1 -0
- package/dist/{constants-PJXB7ZIS.cjs → constants-D6W7OWCP.cjs} +8 -8
- package/dist/{constants-PJXB7ZIS.cjs.map → constants-D6W7OWCP.cjs.map} +1 -1
- package/dist/constants-SPS7MR4D.js +3 -0
- package/dist/{constants-XEHPYRDJ.js.map → constants-SPS7MR4D.js.map} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +52 -52
- package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +2 -2
- package/dist/docs/references/docs-memory-storage.md +1 -1
- package/dist/docs/references/reference-memory-observational-memory.md +1 -1
- package/dist/docs/references/reference-storage-dsql.md +1 -1
- package/dist/docs/references/reference-storage-redis.md +1 -1
- package/dist/index.cjs +39246 -9273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39209 -9218
- package/dist/index.js.map +1 -1
- package/dist/{observational-memory-CSI3OZXQ.js → observational-memory-E6F7NKJP.js} +4 -4
- package/dist/{observational-memory-CSI3OZXQ.js.map → observational-memory-E6F7NKJP.js.map} +1 -1
- package/dist/{observational-memory-RWXMKXJP.cjs → observational-memory-LGCWMUEM.cjs} +31 -31
- package/dist/{observational-memory-RWXMKXJP.cjs.map → observational-memory-LGCWMUEM.cjs.map} +1 -1
- package/dist/processors/index.cjs +29 -29
- package/dist/processors/index.js +2 -2
- package/dist/processors/observational-memory/message-utils.d.ts +1 -0
- package/dist/processors/observational-memory/message-utils.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-runner.d.ts +11 -0
- package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
- package/dist/processors/observational-memory/types.d.ts +7 -3
- package/dist/processors/observational-memory/types.d.ts.map +1 -1
- package/dist/tools/om-tools.d.ts +1 -12
- package/dist/tools/om-tools.d.ts.map +1 -1
- package/dist/tools/working-memory.d.ts +2 -8
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/package.json +7 -8
- package/dist/chunk-BCYGTJF2.js.map +0 -1
- package/dist/chunk-D4J4XPGM.cjs.map +0 -1
- package/dist/chunk-IRMLP4QH.cjs.map +0 -1
- package/dist/chunk-LSJJAJAF.js.map +0 -1
- package/dist/constants-XEHPYRDJ.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.20.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Removed zod as a required peer dependency. Internal schemas now use plain JSON Schema objects instead of zod runtime. ([#16726](https://github.com/mastra-ai/mastra/pull/16726))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`c35b962`](https://github.com/mastra-ai/mastra/commit/c35b9625c7e854fcfdeee226a3338a750d0ff211), [`4084113`](https://github.com/mastra-ai/mastra/commit/408411370fc48a822e8b616b3b63f9409774e0e9)]:
|
|
10
|
+
- @mastra/core@1.37.0-alpha.8
|
|
11
|
+
|
|
12
|
+
## 1.20.0-alpha.1
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- Add per-provider capability files and `auto` mode for `observeAttachments` ([#16922](https://github.com/mastra-ai/mastra/pull/16922))
|
|
17
|
+
- Generate per-provider capability files (e.g. `capabilities/openai.json`) alongside the model router registry, sourced from models.dev API
|
|
18
|
+
- Export `modelSupportsAttachments(modelRouterId)` from `@mastra/core/llm` to check whether a model supports image/file attachments
|
|
19
|
+
- Extend `observeAttachments` config to accept `'auto'` in addition to `boolean | string[]`
|
|
20
|
+
- When set to `'auto'`, the observer resolves the model (including function-based models) and checks the capability registry before deciding to forward or drop attachment parts
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Fixed observational memory so in-progress messages are not removed during observation cleanup. ([#16913](https://github.com/mastra-ai/mastra/pull/16913))
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`ac442a4`](https://github.com/mastra-ai/mastra/commit/ac442a42fda0354ac2bcea772bf6691cb3e9dbb3), [`1e5c067`](https://github.com/mastra-ai/mastra/commit/1e5c067d2e20a781af670578180d1ee249806d41), [`008baaf`](https://github.com/mastra-ai/mastra/commit/008baafd8d851f831407045aebead5a2e3342eff), [`8116436`](https://github.com/mastra-ai/mastra/commit/81164363eb225d774e41ff27da6a5ea611406688), [`c27c4b9`](https://github.com/mastra-ai/mastra/commit/c27c4b9f137df5414fca4e45896aceccff6b0ed5), [`08b3b59`](https://github.com/mastra-ai/mastra/commit/08b3b590dd960dee6c9a6e39272f8927d803db6e)]:
|
|
27
|
+
- @mastra/core@1.37.0-alpha.3
|
|
28
|
+
|
|
3
29
|
## 1.19.1-alpha.0
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __export = (target, all) => {
|
|
5
|
+
for (var name in all)
|
|
6
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
+
};
|
|
8
|
+
|
|
3
9
|
// src/processors/observational-memory/constants.ts
|
|
4
10
|
var OBSERVATIONAL_MEMORY_DEFAULTS = {
|
|
5
11
|
observation: {
|
|
@@ -107,5 +113,6 @@ exports.OBSERVATION_CONTEXT_INSTRUCTIONS = OBSERVATION_CONTEXT_INSTRUCTIONS;
|
|
|
107
113
|
exports.OBSERVATION_CONTEXT_PROMPT = OBSERVATION_CONTEXT_PROMPT;
|
|
108
114
|
exports.OBSERVATION_CONTINUATION_HINT = OBSERVATION_CONTINUATION_HINT;
|
|
109
115
|
exports.OBSERVATION_RETRIEVAL_INSTRUCTIONS = OBSERVATION_RETRIEVAL_INSTRUCTIONS;
|
|
110
|
-
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
116
|
+
exports.__export = __export;
|
|
117
|
+
//# sourceMappingURL=chunk-3Q3LOVQP.cjs.map
|
|
118
|
+
//# sourceMappingURL=chunk-3Q3LOVQP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/processors/observational-memory/constants.ts"],"names":[],"mappings":";;;;;;;;;AAGO,IAAM,6BAAA,GAAgC;AAAA,EAC3C,WAAA,EAAa;AAAA,IACX,KAAA,EAAO,yBAAA;AAAA,IACP,aAAA,EAAe,GAAA;AAAA,IACf,aAAA,EAAe;AAAA,MACb,WAAA,EAAa,GAAA;AAAA,MACb,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AAAA,IACA,iBAAA,EAAmB,GAAA;AAAA;AAAA,IAEnB,YAAA,EAAc,GAAA;AAAA;AAAA,IACd,gBAAA,EAAkB;AAAA;AAAA,GACpB;AAAA,EACA,UAAA,EAAY;AAAA,IACV,KAAA,EAAO,yBAAA;AAAA,IACP,iBAAA,EAAmB,GAAA;AAAA,IACnB,aAAA,EAAe;AAAA,MACb,WAAA,EAAa,CAAA;AAAA;AAAA,MACb,eAAA,EAAiB;AAAA,KACnB;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,MAAA,EAAQ;AAAA,QACN,cAAA,EAAgB;AAAA,UACd,cAAA,EAAgB;AAAA;AAClB;AACF,KACF;AAAA;AAAA,IAEA,gBAAA,EAAkB;AAAA;AAAA;AAEtB;AAOO,IAAM,6BAAA,GAAgC,CAAA;;AAAA;;AAAA;;AAAA,wEAAA;AAatC,IAAM,0BAAA,GAA6B,CAAA,2FAAA;AAMnC,IAAM,gCAAA,GAAmC,CAAA;;AAAA;;AAAA;;AAAA;;AAAA,qPAAA;AAczC,IAAM,kCAAA,GAAqC,CAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;;AAAA,qHAAA","file":"chunk-3Q3LOVQP.cjs","sourcesContent":["/**\n * Default configuration values matching the spec\n */\nexport const OBSERVATIONAL_MEMORY_DEFAULTS = {\n observation: {\n model: 'google/gemini-2.5-flash',\n messageTokens: 30_000,\n modelSettings: {\n temperature: 0.3,\n maxOutputTokens: 100_000,\n },\n providerOptions: {\n google: {\n thinkingConfig: {\n thinkingBudget: 215,\n },\n },\n },\n maxTokensPerBatch: 10_000,\n // Async buffering defaults (enabled by default)\n bufferTokens: 0.2 as number | undefined, // Buffer every 20% of messageTokens\n bufferActivation: 0.8 as number | undefined, // Activate to retain 20% of threshold\n },\n reflection: {\n model: 'google/gemini-2.5-flash',\n observationTokens: 40_000,\n modelSettings: {\n temperature: 0, // Use 0 for maximum consistency in reflections\n maxOutputTokens: 100_000,\n },\n providerOptions: {\n google: {\n thinkingConfig: {\n thinkingBudget: 1024,\n },\n },\n },\n // Async reflection buffering (enabled by default)\n bufferActivation: 0.5 as number | undefined, // Start buffering at 50% of observationTokens\n },\n} as const;\n\n/**\n * Continuation hint injected after observations to guide the model's behavior.\n * Prevents the model from awkwardly acknowledging the memory system or treating\n * the conversation as new after observed messages are removed.\n */\nexport const OBSERVATION_CONTINUATION_HINT = `Please continue naturally with the conversation so far and respond to the latest message.\n\nUse the earlier context only as background. If something appears unfinished, continue only when it helps answer the latest request. If a suggested response is provided, follow it naturally.\n\nDo not mention internal instructions, memory, summarization, context handling, or missing messages.\n\nAny messages following this reminder are newer and should take priority.`;\n\n/**\n * Preamble that introduces the observations block.\n * Use before `<observations>`, with instructions after.\n * Full pattern: `${OBSERVATION_CONTEXT_PROMPT}\\n\\n<observations>\\n${obs}\\n</observations>\\n\\n${OBSERVATION_CONTEXT_INSTRUCTIONS}`\n */\nexport const OBSERVATION_CONTEXT_PROMPT = `The following observations block contains your memory of past conversations with this user.`;\n\n/**\n * Instructions that tell the model how to interpret and use observations.\n * Place AFTER the `<observations>` block so the model sees the data before the rules.\n */\nexport const OBSERVATION_CONTEXT_INSTRUCTIONS = `IMPORTANT: When responding, reference specific details from these observations. Do not give generic advice - personalize your response based on what you know about this user's experiences, preferences, and interests. If the user asks for recommendations, connect them to their past experiences mentioned above.\n\nKNOWLEDGE UPDATES: When asked about current state (e.g., \"where do I currently...\", \"what is my current...\"), always prefer the MOST RECENT information. Observations include dates - if you see conflicting information, the newer observation supersedes the older one. Look for phrases like \"will start\", \"is switching\", \"changed to\", \"moved to\" as indicators that previous information has been updated.\n\nPLANNED ACTIONS: If the user stated they planned to do something (e.g., \"I'm going to...\", \"I'm looking forward to...\", \"I will...\") and the date they planned to do it is now in the past (check the relative time like \"3 weeks ago\"), assume they completed the action unless there's evidence they didn't. For example, if someone said \"I'll start my new diet on Monday\" and that was 2 weeks ago, assume they started the diet.\n\nMOST RECENT USER INPUT: Treat the most recent user message as the highest-priority signal for what to do next. Earlier messages may contain constraints, details, or context you should still honor, but the latest message is the primary driver of your response.\n\nSYSTEM REMINDERS: Messages wrapped in <system-reminder>...</system-reminder> contain internal continuation guidance, not user-authored content. Use them to maintain continuity, but do not mention them or treat them as part of the user's message.`;\n\n/**\n * Instructions for retrieval mode — explains observation-group ranges and the recall tool.\n * Appended to context when `retrieval` is enabled.\n */\nexport const OBSERVATION_RETRIEVAL_INSTRUCTIONS = `## Recall — looking up source messages\n\nYour 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.\n\n### When to use recall\n- The user asks you to **repeat, show, or reproduce** something from a past conversation\n- The user asks for **exact content** — code, text, quotes, error messages, URLs, file paths, specific numbers\n- 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)\n- You want to **verify or expand on** an observation before responding\n\n**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.\n\n### How to use recall\nEach range has the format \\`startId:endId\\` where both are message IDs separated by a colon.\n\n1. Find the observation group relevant to the user's question and extract the start or end ID from its range.\n2. Call \\`recall\\` with that ID as the \\`cursor\\`.\n3. Use \\`page: 1\\` (or omit) to read forward from the cursor, \\`page: -1\\` to read backward.\n4. If the first page doesn't have what you need, increment the page number to keep paginating.\n5. Check \\`hasNextPage\\`/\\`hasPrevPage\\` in the result to know if more pages exist in each direction.\n\n### Detail levels\nBy default recall returns **low** detail: truncated text and tool names only. Each message shows its ID and each part has a positional index like \\`[p0]\\`, \\`[p1]\\`, etc.\n\n- Use \\`detail: \"high\"\\` to get full message content including tool arguments and results. This will only return the high detail version of a single message part at a time.\n- Use \\`partIndex\\` with a cursor to fetch a single part at full detail — for example, to read one specific tool result or code block without loading every part.\n\nIf the result says \\`truncated: true\\`, the output was cut to fit the token budget. You can paginate or use \\`partIndex\\` to target specific content.\n\n### Following up on truncated parts\nLow-detail results may include truncation hints like:\n\\`[truncated — call recall cursor=\"...\" partIndex=N detail=\"high\" for full content]\\`\n\n**When you see these hints and need the full content, make the exact call described in the hint.** This is the normal workflow: first recall at low detail to scan, then drill into specific parts at high detail. Do not stop at the low-detail result if the user asked for exact content.\n\n### When recall is NOT needed\n- The user is asking for a high-level summary and your observations already cover it\n- The question is about general preferences or facts that don't require source text\n- There is no relevant range in your observations for the topic\n\nObservation groups with range IDs and your recall tool allows you to think back and remember details you're fuzzy on.`;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_RETRIEVAL_INSTRUCTIONS, OBSERVATION_CONTINUATION_HINT } from './chunk-
|
|
1
|
+
import { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_RETRIEVAL_INSTRUCTIONS, OBSERVATION_CONTINUATION_HINT } from './chunk-VKRZ3O5X.js';
|
|
2
2
|
import { coreFeatures } from '@mastra/core/features';
|
|
3
|
-
import { resolveModelConfig } from '@mastra/core/llm';
|
|
3
|
+
import { resolveModelConfig, modelSupportsAttachments } from '@mastra/core/llm';
|
|
4
4
|
import { getThreadOMMetadata, setThreadOMMetadata, parseMemoryRequestContext } from '@mastra/core/memory';
|
|
5
5
|
import { MessageHistory } from '@mastra/core/processors';
|
|
6
6
|
import xxhash from 'xxhash-wasm';
|
|
@@ -669,6 +669,7 @@ function filterObservedMessages(opts) {
|
|
|
669
669
|
const { messageList, record } = opts;
|
|
670
670
|
const allMessages = messageList.get.all.db();
|
|
671
671
|
const useMarkerBoundaryPruning = opts.useMarkerBoundaryPruning ?? true;
|
|
672
|
+
const preserveMessageIds = opts.preserveMessageIds ?? /* @__PURE__ */ new Set();
|
|
672
673
|
let markerMessageIndex = -1;
|
|
673
674
|
let markerMessage = null;
|
|
674
675
|
for (let i = allMessages.length - 1; i >= 0; i--) {
|
|
@@ -684,7 +685,7 @@ function filterObservedMessages(opts) {
|
|
|
684
685
|
const messagesToRemove = [];
|
|
685
686
|
for (let i = 0; i < markerMessageIndex; i++) {
|
|
686
687
|
const msg = allMessages[i];
|
|
687
|
-
if (msg?.id && msg.id !== "om-continuation") {
|
|
688
|
+
if (msg?.id && msg.id !== "om-continuation" && !preserveMessageIds.has(msg.id)) {
|
|
688
689
|
messagesToRemove.push(msg.id);
|
|
689
690
|
}
|
|
690
691
|
}
|
|
@@ -703,7 +704,7 @@ function filterObservedMessages(opts) {
|
|
|
703
704
|
const lastObservedAt = record.lastObservedAt;
|
|
704
705
|
const messagesToRemove = [];
|
|
705
706
|
for (const msg of allMessages) {
|
|
706
|
-
if (!msg?.id || msg.id === "om-continuation") continue;
|
|
707
|
+
if (!msg?.id || msg.id === "om-continuation" || preserveMessageIds.has(msg.id)) continue;
|
|
707
708
|
if (observedIds.has(msg.id)) {
|
|
708
709
|
messagesToRemove.push(msg.id);
|
|
709
710
|
continue;
|
|
@@ -2269,11 +2270,15 @@ var ObservationStep = class {
|
|
|
2269
2270
|
});
|
|
2270
2271
|
if (!didThresholdCleanup) {
|
|
2271
2272
|
const fallbackCursor = this.turn.record.threadId ? getThreadOMMetadata((await om.getStorage().getThreadById({ threadId: this.turn.record.threadId }))?.metadata)?.lastObservedMessageCursor : void 0;
|
|
2273
|
+
const pendingMessageIds = new Set(
|
|
2274
|
+
[...messageList.get.input.db(), ...messageList.get.response.db()].map((msg) => msg.id).filter(Boolean)
|
|
2275
|
+
);
|
|
2272
2276
|
filterObservedMessages({
|
|
2273
2277
|
messageList,
|
|
2274
2278
|
record: this.turn.record,
|
|
2275
2279
|
useMarkerBoundaryPruning: this.stepNumber === 0,
|
|
2276
|
-
fallbackCursor
|
|
2280
|
+
fallbackCursor,
|
|
2281
|
+
preserveMessageIds: pendingMessageIds
|
|
2277
2282
|
});
|
|
2278
2283
|
}
|
|
2279
2284
|
this._context = {
|
|
@@ -4101,6 +4106,41 @@ var ObserverRunner = class {
|
|
|
4101
4106
|
}
|
|
4102
4107
|
return agent;
|
|
4103
4108
|
}
|
|
4109
|
+
/**
|
|
4110
|
+
* Extract a router-style model ID (`provider/model`) from a model config.
|
|
4111
|
+
* Handles strings, LanguageModel objects, and function-based models.
|
|
4112
|
+
*/
|
|
4113
|
+
extractModelRouterId(model, requestContext) {
|
|
4114
|
+
if (typeof model === "string") return model;
|
|
4115
|
+
if (typeof model === "function") {
|
|
4116
|
+
if (!requestContext) return void 0;
|
|
4117
|
+
try {
|
|
4118
|
+
const resolved = model({ requestContext });
|
|
4119
|
+
if (resolved instanceof Promise) return void 0;
|
|
4120
|
+
return this.extractModelRouterId(resolved);
|
|
4121
|
+
} catch {
|
|
4122
|
+
return void 0;
|
|
4123
|
+
}
|
|
4124
|
+
}
|
|
4125
|
+
const obj = model;
|
|
4126
|
+
if (typeof obj.provider === "string" && typeof obj.modelId === "string") {
|
|
4127
|
+
return `${obj.provider}/${obj.modelId}`;
|
|
4128
|
+
}
|
|
4129
|
+
return void 0;
|
|
4130
|
+
}
|
|
4131
|
+
/**
|
|
4132
|
+
* Resolve the attachment filter for a given model. When set to `'auto'`,
|
|
4133
|
+
* the provider capabilities registry is consulted to decide whether the
|
|
4134
|
+
* model accepts multimodal input.
|
|
4135
|
+
*/
|
|
4136
|
+
resolveAttachmentFilter(model, requestContext) {
|
|
4137
|
+
const raw = this.observationConfig.observeAttachments;
|
|
4138
|
+
if (raw !== "auto") return raw;
|
|
4139
|
+
const routerId = this.extractModelRouterId(model, requestContext);
|
|
4140
|
+
if (!routerId) return true;
|
|
4141
|
+
const supports = modelSupportsAttachments(routerId);
|
|
4142
|
+
return supports ?? true;
|
|
4143
|
+
}
|
|
4104
4144
|
async withAbortCheck(fn, abortSignal) {
|
|
4105
4145
|
if (abortSignal?.aborted) {
|
|
4106
4146
|
throw new Error("The operation was aborted.");
|
|
@@ -4118,6 +4158,7 @@ var ObserverRunner = class {
|
|
|
4118
4158
|
const inputTokens = this.tokenCounter.countMessages(messagesToObserve);
|
|
4119
4159
|
const resolvedModel = options?.model ? { model: options.model } : this.resolveModel(inputTokens);
|
|
4120
4160
|
const agent = this.createAgent(resolvedModel.model);
|
|
4161
|
+
const attachmentFilter = this.resolveAttachmentFilter(resolvedModel.model, options?.requestContext);
|
|
4121
4162
|
const observerMessages = [
|
|
4122
4163
|
{
|
|
4123
4164
|
role: "user",
|
|
@@ -4127,7 +4168,7 @@ var ObserverRunner = class {
|
|
|
4127
4168
|
})
|
|
4128
4169
|
},
|
|
4129
4170
|
buildObserverHistoryMessage(messagesToObserve, {
|
|
4130
|
-
attachmentFilter
|
|
4171
|
+
attachmentFilter
|
|
4131
4172
|
})
|
|
4132
4173
|
];
|
|
4133
4174
|
const doGenerate = async () => {
|
|
@@ -4214,6 +4255,7 @@ var ObserverRunner = class {
|
|
|
4214
4255
|
);
|
|
4215
4256
|
const resolvedModel = model ? { model } : this.resolveModel(inputTokens);
|
|
4216
4257
|
const agent = this.createAgent(resolvedModel.model, true);
|
|
4258
|
+
const multiThreadAttachmentFilter = this.resolveAttachmentFilter(resolvedModel.model, requestContext);
|
|
4217
4259
|
const observerMessages = [
|
|
4218
4260
|
{
|
|
4219
4261
|
role: "user",
|
|
@@ -4226,7 +4268,7 @@ var ObserverRunner = class {
|
|
|
4226
4268
|
)
|
|
4227
4269
|
},
|
|
4228
4270
|
buildMultiThreadObserverHistoryMessage(messagesByThread, threadOrder, {
|
|
4229
|
-
attachmentFilter:
|
|
4271
|
+
attachmentFilter: multiThreadAttachmentFilter
|
|
4230
4272
|
})
|
|
4231
4273
|
];
|
|
4232
4274
|
for (const msgs of messagesByThread.values()) {
|
|
@@ -9809,5 +9851,5 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
9809
9851
|
}
|
|
9810
9852
|
|
|
9811
9853
|
export { ModelByInputTokens, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, formatToolResultForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, resolveToolResultValue, stripEphemeralAnchorIds, stripObservationGroups, truncateStringByTokens, wrapInObservationGroup };
|
|
9812
|
-
//# sourceMappingURL=chunk-
|
|
9813
|
-
//# sourceMappingURL=chunk-
|
|
9854
|
+
//# sourceMappingURL=chunk-BCWFD5J7.js.map
|
|
9855
|
+
//# sourceMappingURL=chunk-BCWFD5J7.js.map
|