@mastra/memory 1.28.1 → 1.28.2-alpha.0
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 +8 -0
- package/dist/docs/SKILL.md +48 -48
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-semantic-recall.md +0 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/message-utils.d.ts +7 -7
- package/dist/processors/observational-memory/observation-utils.d.ts +1 -0
- package/dist/processors/observational-memory/observation-utils.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/knowledge-write-tools.d.ts.map +1 -1
- package/dist/{src-Br56ncef.cjs → src-Bq1Ng-3M.cjs} +99 -20
- package/dist/{src-Br56ncef.cjs.map → src-Bq1Ng-3M.cjs.map} +1 -1
- package/dist/{src-BNtoxIHL.js → src-Br1yJXN1.js} +99 -20
- package/dist/{src-BNtoxIHL.js.map → src-Br1yJXN1.js.map} +1 -1
- package/package.json +16 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.28.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Improve tool schema compatibility with providers that validate tool definitions server-side. ([#22487](https://github.com/mastra-ai/mastra/pull/22487))
|
|
8
|
+
|
|
9
|
+
- Fixed observational memory prompts appearing in stored conversation history. ([#22324](https://github.com/mastra-ai/mastra/pull/22324))
|
|
10
|
+
|
|
3
11
|
## 1.28.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-memory
|
|
|
3
3
|
description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/memory"
|
|
6
|
-
version: "1.28.
|
|
6
|
+
version: "1.28.2-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -16,59 +16,59 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
16
16
|
|
|
17
17
|
### Docs
|
|
18
18
|
|
|
19
|
-
- [Human-in-the-loop](references/docs-agents-human-in-the-loop.md) -
|
|
20
|
-
- [Agent networks](references/docs-agents-networks.md) -
|
|
21
|
-
- [Evals with memory](references/docs-evals-evals-with-memory.md) - Run
|
|
22
|
-
- [Context engineering](references/docs-guides-context-engineering.md) -
|
|
23
|
-
- [Background tasks](references/docs-harness-background-tasks.md) -
|
|
24
|
-
- [Goals](references/docs-harness-goals.md) -
|
|
25
|
-
- [Memory processors](references/docs-memory-memory-processors.md) -
|
|
26
|
-
- [Message history](references/docs-memory-message-history.md) -
|
|
27
|
-
- [Multi-user threads](references/docs-memory-multi-user-threads.md) - Share one Mastra thread
|
|
28
|
-
- [Observational Memory](references/docs-memory-observational-memory.md) -
|
|
29
|
-
- [Memory](references/docs-memory-overview.md) -
|
|
30
|
-
- [Semantic recall](references/docs-memory-semantic-recall.md) -
|
|
31
|
-
- [Working memory](references/docs-memory-working-memory.md) -
|
|
32
|
-
- [Storage](references/docs-storage.md) - Configure storage
|
|
33
|
-
- [Subagents](references/docs-subagents.md) -
|
|
19
|
+
- [Human-in-the-loop](references/docs-agents-human-in-the-loop.md) - Add human-in-the-loop controls to Mastra agents with tool approval and suspended execution, so people can provide input before a run resumes or stops.
|
|
20
|
+
- [Agent networks](references/docs-agents-networks.md) - Understand deprecated Mastra agent networks, including multi-agent routing, structured output, tool approvals, and migration to supervisor agents.
|
|
21
|
+
- [Evals with memory](references/docs-evals-evals-with-memory.md) - Run Mastra evals against memory-enabled agents using shared or per-item threads, observational memory, runEvals, and dataset experiments.
|
|
22
|
+
- [Context engineering](references/docs-guides-context-engineering.md) - Engineer the context Mastra agents receive by combining instructions, inline data, tools, RAG, filesystems, memory, and observational memory.
|
|
23
|
+
- [Background tasks](references/docs-harness-background-tasks.md) - Run long-lived Mastra tool calls and subagents as background tasks while streams remain open, with configurable LLM behavior and completion events.
|
|
24
|
+
- [Goals](references/docs-harness-goals.md) - Set a durable goal for a Mastra agent so an execution loop evaluates progress and continues working until the objective completes or its run budget ends.
|
|
25
|
+
- [Memory processors](references/docs-memory-memory-processors.md) - Configure Mastra memory processors to filter, trim, transform, and deduplicate messages before they reach the model while managing context limits.
|
|
26
|
+
- [Message history](references/docs-memory-message-history.md) - Store and retrieve recent Mastra conversation messages, configure history limits and thread titles, and query threads for chat interfaces.
|
|
27
|
+
- [Multi-user threads](references/docs-memory-multi-user-threads.md) - Share one Mastra memory thread across multiple users by preserving speaker identity in messages and combining history with observational or working memory.
|
|
28
|
+
- [Observational Memory](references/docs-memory-observational-memory.md) - Configure Mastra Observational Memory to compress long conversations into durable observations while preserving context across threads and sessions.
|
|
29
|
+
- [Memory](references/docs-memory-overview.md) - Add memory to Mastra agents with message history, semantic recall, working memory, and observational memory across threads and multi-agent delegation.
|
|
30
|
+
- [Semantic recall](references/docs-memory-semantic-recall.md) - Retrieve relevant messages from past Mastra conversations with semantic recall, vector search, embeddings, metadata filters, and configurable storage.
|
|
31
|
+
- [Working memory](references/docs-memory-working-memory.md) - Persist user profiles, preferences, and application data with Mastra working memory using resource- or thread-scoped templates and storage adapters.
|
|
32
|
+
- [Storage](references/docs-storage.md) - Configure Mastra storage to persist memory, workflow state, observability data, evals, schedules, and long-running agent state across restarts.
|
|
33
|
+
- [Subagents](references/docs-subagents.md) - Build Mastra supervisor agents that delegate work to specialized subagents with hooks, request context, message filtering, and completion scoring.
|
|
34
34
|
|
|
35
35
|
### Integrations
|
|
36
36
|
|
|
37
|
-
- [GitHub](references/integrations-channels-github.md) -
|
|
38
|
-
- [Aurora DSQL](references/integrations-databases-aurora-dsql.md) -
|
|
39
|
-
- [DynamoDB](references/integrations-databases-dynamodb.md) -
|
|
40
|
-
- [Elasticsearch](references/integrations-databases-elasticsearch.md) -
|
|
41
|
-
- [libSQL](references/integrations-databases-libsql.md) -
|
|
42
|
-
- [MongoDB](references/integrations-databases-mongodb.md) -
|
|
43
|
-
- [OracleDB](references/integrations-databases-oracledb.md) -
|
|
44
|
-
- [PostgreSQL](references/integrations-databases-postgresql.md) -
|
|
45
|
-
- [Redis](references/integrations-databases-redis.md) -
|
|
46
|
-
- [Upstash](references/integrations-databases-upstash.md) -
|
|
47
|
-
- [Valkey](references/integrations-databases-valkey.md) -
|
|
37
|
+
- [GitHub](references/integrations-channels-github.md) - Subscribe Mastra agents to GitHub pull requests with @mastra/github-signals, polling modes, notification signals, and subscription management tools.
|
|
38
|
+
- [Aurora DSQL](references/integrations-databases-aurora-dsql.md) - Store Mastra application data in Amazon Aurora DSQL with IAM authentication, configurable credentials, schema initialization, and connection options.
|
|
39
|
+
- [DynamoDB](references/integrations-databases-dynamodb.md) - Persist Mastra data in Amazon DynamoDB with a single-table ElectroDB design, configurable indexes, TTL support, credentials, and table initialization.
|
|
40
|
+
- [Elasticsearch](references/integrations-databases-elasticsearch.md) - Store Mastra agent memory, workflow snapshots, and scores in Elasticsearch with URL, authentication, or shared client connection configuration.
|
|
41
|
+
- [libSQL](references/integrations-databases-libsql.md) - Persist Mastra messages, workflow snapshots, traces, and eval scores in local or remote libSQL with managed tables and initialization options.
|
|
42
|
+
- [MongoDB](references/integrations-databases-mongodb.md) - Store Mastra application data and vectors in MongoDB, configure connections and collections, initialize schemas, and add persistent agent memory.
|
|
43
|
+
- [OracleDB](references/integrations-databases-oracledb.md) - Persist Mastra memory, workflows, observability, scores, MCP metadata, and agent registry data in Oracle Database with OracleStore.
|
|
44
|
+
- [PostgreSQL](references/integrations-databases-postgresql.md) - Persist Mastra application data in PostgreSQL with PostgresStore, configure connections and pools, initialize schemas, and enable observability.
|
|
45
|
+
- [Redis](references/integrations-databases-redis.md) - Store Mastra application data in Redis using connection strings, host settings, or custom clients, including Sentinel and Cluster deployments.
|
|
46
|
+
- [Upstash](references/integrations-databases-upstash.md) - Use Upstash Redis as serverless Mastra storage with REST credentials, namespaced keys, durable persistence, and deployment-friendly connections.
|
|
47
|
+
- [Valkey](references/integrations-databases-valkey.md) - Configure Valkey storage and caching for Mastra through the GLIDE client, including authentication, connection options, persistence, and cleanup.
|
|
48
48
|
|
|
49
49
|
### Reference
|
|
50
50
|
|
|
51
|
-
- [Reference: Mastra.getMemory()](references/reference-core-getMemory.md) -
|
|
52
|
-
- [Reference: Mastra.listMemory()](references/reference-core-listMemory.md) -
|
|
53
|
-
- [Memory](references/reference-file-based-agents-memory.md) -
|
|
54
|
-
- [Reference: Cloned thread utilities](references/reference-memory-clone-utilities.md) -
|
|
55
|
-
- [Reference: Memory.cloneThread()](references/reference-memory-cloneThread.md) -
|
|
56
|
-
- [Reference: Memory.createThread()](references/reference-memory-createThread.md) -
|
|
57
|
-
- [Reference: Memory.getThreadById()](references/reference-memory-getThreadById.md) -
|
|
58
|
-
- [Reference: Memory.listThreads()](references/reference-memory-listThreads.md) -
|
|
59
|
-
- [Reference: Memory class](references/reference-memory-memory-class.md) -
|
|
60
|
-
- [Reference: Observational Memory](references/reference-memory-observational-memory.md) -
|
|
61
|
-
- [Reference: Memory.settled()](references/reference-memory-settled.md) -
|
|
62
|
-
- [Reference: summarizeConversation()](references/reference-memory-summarizeConversation.md) -
|
|
63
|
-
- [Reference: Memory.summarizeThread()](references/reference-memory-summarizeThread.md) -
|
|
64
|
-
- [Migration: AgentNetwork to .network()](references/reference-migrations-agentnetwork.md) -
|
|
65
|
-
- [Memory](references/reference-migrations-upgrade-to-v1-memory.md) -
|
|
66
|
-
- [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) -
|
|
67
|
-
- [Reference: libSQL vector store](references/reference-vectors-libsql.md) -
|
|
68
|
-
- [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) -
|
|
69
|
-
- [Reference: OracleDB vector store](references/reference-vectors-oracledb.md) -
|
|
70
|
-
- [Reference: PG vector store](references/reference-vectors-pg.md) -
|
|
71
|
-
- [Reference: Upstash vector store](references/reference-vectors-upstash.md) -
|
|
51
|
+
- [Reference: Mastra.getMemory()](references/reference-core-getMemory.md) - The .getMemory() method retrieves a memory instance from the Mastra registry by its key.
|
|
52
|
+
- [Reference: Mastra.listMemory()](references/reference-core-listMemory.md) - The .listMemory() method returns all memory instances registered with the Mastra instance.
|
|
53
|
+
- [Memory](references/reference-file-based-agents-memory.md) - A file-based agent gets memory from a memory.ts file that default-exports a Memory instance.
|
|
54
|
+
- [Reference: Cloned thread utilities](references/reference-memory-clone-utilities.md) - Use Mastra Memory clone utilities to create threads derived from an existing conversation, then inspect clone relationships and manage their messages.
|
|
55
|
+
- [Reference: Memory.cloneThread()](references/reference-memory-cloneThread.md) - The .cloneThread() method creates a copy of an existing conversation thread, including all its messages.
|
|
56
|
+
- [Reference: Memory.createThread()](references/reference-memory-createThread.md) - The .createThread() method creates a new conversation thread in the memory system. Each thread represents a distinct conversation or context and can contain multiple messages.
|
|
57
|
+
- [Reference: Memory.getThreadById()](references/reference-memory-getThreadById.md) - Use Memory.getThreadById() to retrieve a conversation thread by ID, including its resource association, metadata, and stored properties.
|
|
58
|
+
- [Reference: Memory.listThreads()](references/reference-memory-listThreads.md) - The listThreads() method retrieves threads with pagination support and optional filtering by resourceId, metadata, or both.
|
|
59
|
+
- [Reference: Memory class](references/reference-memory-memory-class.md) - The Memory class provides a reliable system for managing conversation history and thread-based message storage in Mastra.
|
|
60
|
+
- [Reference: Observational Memory](references/reference-memory-observational-memory.md) - Observational Memory (OM) is Mastra's memory system for long-context agentic memory. An Observer watches conversations and creates observations.
|
|
61
|
+
- [Reference: Memory.settled()](references/reference-memory-settled.md) - Use Memory.settled() to wait for asynchronous memory work, including working-memory updates and observational memory, before closing storage.
|
|
62
|
+
- [Reference: summarizeConversation()](references/reference-memory-summarizeConversation.md) - The standalone summarizeConversation() function summarizes a conversation in one shot.
|
|
63
|
+
- [Reference: Memory.summarizeThread()](references/reference-memory-summarizeThread.md) - Call Memory.summarizeThread() to produce a thread summary in one operation and extract configured structured values from its messages.
|
|
64
|
+
- [Migration: AgentNetwork to .network()](references/reference-migrations-agentnetwork.md) - Migrate deprecated AgentNetwork usage to supervisor agents and the standard Agent.generate() or Agent.stream() APIs in current Mastra releases.
|
|
65
|
+
- [Memory](references/reference-migrations-upgrade-to-v1-memory.md) - Memory configuration now requires explicit parameters, and default settings have been updated for better performance and predictability.
|
|
66
|
+
- [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) - Use TokenLimiterProcessor to constrain message tokens during input, per-step input, or output processing with configurable limits and strategies.
|
|
67
|
+
- [Reference: libSQL vector store](references/reference-vectors-libsql.md) - Configure LibSQLVector for similarity search and metadata filtering with local libSQL, SQLite-compatible vector extensions, or Turso databases.
|
|
68
|
+
- [Reference: MongoDB vector store](references/reference-vectors-mongodb.md) - The MongoDBVector class provides vector search using MongoDB Vector Search. It enables efficient similarity search and metadata filtering within your MongoDB collections.
|
|
69
|
+
- [Reference: OracleDB vector store](references/reference-vectors-oracledb.md) - OracleVector stores embeddings in Oracle Database VECTOR columns and exposes them through Mastra's vector interface.
|
|
70
|
+
- [Reference: PG vector store](references/reference-vectors-pg.md) - The PgVector class provides vector search using PostgreSQL with pgvector extension. It provides reliable vector similarity search capabilities within your existing PostgreSQL database.
|
|
71
|
+
- [Reference: Upstash vector store](references/reference-vectors-upstash.md) - Configure UpstashVector for serverless similarity and hybrid search, metadata filtering, index management, and vector operations with Upstash Vector.
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -14,8 +14,6 @@ Semantic recall is RAG-based search that helps agents maintain context across lo
|
|
|
14
14
|
|
|
15
15
|
It uses vector embeddings of messages for similarity search and integrates with vector stores, plus has configurable context windows around retrieved messages.
|
|
16
16
|
|
|
17
|
-

|
|
18
|
-
|
|
19
17
|
When it's enabled, new messages are used to query a vector DB for semantically similar messages.
|
|
20
18
|
|
|
21
19
|
After getting a response from the LLM, all new messages (user, assistant, and tool calls/results) are inserted into the vector DB to be recalled in later interactions.
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("./src-
|
|
2
|
+
const require_src = require("./src-Bq1Ng-3M.cjs");
|
|
3
3
|
let _mastra_core_processors = require("@mastra/core/processors");
|
|
4
4
|
exports.Extractor = require_src.Extractor;
|
|
5
5
|
exports.KnowledgeSemanticIndexCoordinator = require_src.KnowledgeSemanticIndexCoordinator;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as SUMMARIZE_THREAD_DEFAULTS, G as ModelByInputTokens, H as KnowledgeSemanticIndexCoordinator, Q as Extractor, S as WorkingMemoryExtractor, U as StaleKnowledgeSemanticIndexError, V as Subconscious, a as extractWorkingMemoryContent, b as WorkingMemoryStateProcessor, c as getObservationsAsOf, i as WorkingMemory, n as MessageHistory, o as extractWorkingMemoryTags, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, v as WORKING_MEMORY_STATE_ID, w as summarizeConversation, x as deepMergeWorkingMemory, y as WORKING_MEMORY_STATE_PROCESSOR_ID } from "./src-
|
|
1
|
+
import { C as SUMMARIZE_THREAD_DEFAULTS, G as ModelByInputTokens, H as KnowledgeSemanticIndexCoordinator, Q as Extractor, S as WorkingMemoryExtractor, U as StaleKnowledgeSemanticIndexError, V as Subconscious, a as extractWorkingMemoryContent, b as WorkingMemoryStateProcessor, c as getObservationsAsOf, i as WorkingMemory, n as MessageHistory, o as extractWorkingMemoryTags, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, v as WORKING_MEMORY_STATE_ID, w as summarizeConversation, x as deepMergeWorkingMemory, y as WORKING_MEMORY_STATE_PROCESSOR_ID } from "./src-Br1yJXN1.js";
|
|
2
2
|
export { Extractor, KnowledgeSemanticIndexCoordinator, Memory, MessageHistory, ModelByInputTokens, SUMMARIZE_THREAD_DEFAULTS, SemanticRecall, StaleKnowledgeSemanticIndexError, Subconscious, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemory, WorkingMemoryExtractor, WorkingMemoryStateProcessor, deepMergeWorkingMemory, extractWorkingMemoryContent, extractWorkingMemoryTags, getObservationsAsOf, removeWorkingMemoryTags, summarizeConversation };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("../src-
|
|
2
|
+
const require_src = require("../src-Bq1Ng-3M.cjs");
|
|
3
3
|
exports.Extractor = require_src.Extractor;
|
|
4
4
|
exports.KnowledgeSemanticIndexCoordinator = require_src.KnowledgeSemanticIndexCoordinator;
|
|
5
5
|
exports.ModelByInputTokens = require_src.ModelByInputTokens;
|
package/dist/processors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as formatMessagesForObserver, B as OBSERVATION_CONTINUATION_HINT, D as buildObserverPrompt, E as OBSERVER_SYSTEM_PROMPT, F as parseAnchorId, G as ModelByInputTokens, H as KnowledgeSemanticIndexCoordinator, I as stripEphemeralAnchorIds, J as SUBCONSCIOUS_ACTIVITY_STATE_ID, K as SubconsciousCaptureExtractor, L as OBSERVATIONAL_MEMORY_DEFAULTS, M as optimizeObservationsForContext, N as parseObserverOutput, O as buildObserverSystemPrompt, P as injectAnchorIds, Q as Extractor, R as OBSERVATION_CONTEXT_INSTRUCTIONS, S as WorkingMemoryExtractor, T as TokenCounter, U as StaleKnowledgeSemanticIndexError, V as Subconscious, W as SubconsciousRemindExtractor, X as publishSubconsciousActivity, Y as buildSubconsciousActivitySnapshot, Z as renderSubconsciousActivity, _ as wrapInObservationGroup, c as getObservationsAsOf, d as combineObservationGroupRanges, f as deriveObservationGroupProvenance, g as stripObservationGroups, h as renderObservationGroupsForReflection, j as hasCurrentTaskSection, k as extractCurrentTask, l as ObservationalMemoryProcessor, m as reconcileObservationGroupsFromReflection, p as parseObservationGroups, q as subconsciousCaptureSchema, u as ObservationalMemory, w as summarizeConversation, z as OBSERVATION_CONTEXT_PROMPT } from "../src-
|
|
1
|
+
import { A as formatMessagesForObserver, B as OBSERVATION_CONTINUATION_HINT, D as buildObserverPrompt, E as OBSERVER_SYSTEM_PROMPT, F as parseAnchorId, G as ModelByInputTokens, H as KnowledgeSemanticIndexCoordinator, I as stripEphemeralAnchorIds, J as SUBCONSCIOUS_ACTIVITY_STATE_ID, K as SubconsciousCaptureExtractor, L as OBSERVATIONAL_MEMORY_DEFAULTS, M as optimizeObservationsForContext, N as parseObserverOutput, O as buildObserverSystemPrompt, P as injectAnchorIds, Q as Extractor, R as OBSERVATION_CONTEXT_INSTRUCTIONS, S as WorkingMemoryExtractor, T as TokenCounter, U as StaleKnowledgeSemanticIndexError, V as Subconscious, W as SubconsciousRemindExtractor, X as publishSubconsciousActivity, Y as buildSubconsciousActivitySnapshot, Z as renderSubconsciousActivity, _ as wrapInObservationGroup, c as getObservationsAsOf, d as combineObservationGroupRanges, f as deriveObservationGroupProvenance, g as stripObservationGroups, h as renderObservationGroupsForReflection, j as hasCurrentTaskSection, k as extractCurrentTask, l as ObservationalMemoryProcessor, m as reconcileObservationGroupsFromReflection, p as parseObservationGroups, q as subconsciousCaptureSchema, u as ObservationalMemory, w as summarizeConversation, z as OBSERVATION_CONTEXT_PROMPT } from "../src-Br1yJXN1.js";
|
|
2
2
|
export { Extractor, KnowledgeSemanticIndexCoordinator, ModelByInputTokens, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, SUBCONSCIOUS_ACTIVITY_STATE_ID, StaleKnowledgeSemanticIndexError, Subconscious, SubconsciousCaptureExtractor, SubconsciousRemindExtractor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, buildSubconsciousActivitySnapshot, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, publishSubconsciousActivity, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, renderSubconsciousActivity, stripEphemeralAnchorIds, stripObservationGroups, subconsciousCaptureSchema, summarizeConversation, wrapInObservationGroup };
|
|
@@ -34,14 +34,14 @@ export declare function isMessageAtOrBeforeCursor(msg: MastraDBMessage, cursor:
|
|
|
34
34
|
/**
|
|
35
35
|
* Get the messages Observational Memory is allowed to work with.
|
|
36
36
|
*
|
|
37
|
-
* Messages supplied through the `context` option
|
|
38
|
-
* persistence contract already treats
|
|
39
|
-
*
|
|
37
|
+
* Messages supplied through the `context` option and the synthetic `om-continuation`
|
|
38
|
+
* message are prompt-only input. Core's persistence contract already treats context as
|
|
39
|
+
* never-persist, while the continuation remains memory-sourced so it can stay in the live
|
|
40
|
+
* actor prompt.
|
|
40
41
|
*
|
|
41
|
-
* OM builds its windows from `get.all.db()`, which includes
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* accounting consistent with that contract.
|
|
42
|
+
* OM builds its windows from `get.all.db()`, which includes both categories, and then seals
|
|
43
|
+
* and persists candidates directly. Excluding them here keeps OM's observation, buffering,
|
|
44
|
+
* persistence, and token accounting consistent with their ephemeral contract.
|
|
45
45
|
*/
|
|
46
46
|
export declare function getObservableMessages(messageList: MessageList): MastraDBMessage[];
|
|
47
47
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation-utils.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/observation-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"observation-utils.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/observation-utils.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,QAC2D,CAAC;AAE9F;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CA6BlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-write-tools.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/knowledge-write-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQlG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE;QACP,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,cAAc,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAoBD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,EACjC,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"knowledge-write-tools.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/knowledge-write-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQlG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE;QACP,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,cAAc,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAoBD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,EACjC,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAoR3C"}
|
|
@@ -16096,6 +16096,12 @@ function requireVisible(scope, options, label) {
|
|
|
16096
16096
|
if (!(0, _mastra_core_storage.isKnowledgeScopeVisible)(scope, options.scope)) throw new Error(`${label} is outside the curator's visible scope.`);
|
|
16097
16097
|
}
|
|
16098
16098
|
function createKnowledgeWriteTools(memory, options) {
|
|
16099
|
+
async function resolveWritableNode(id) {
|
|
16100
|
+
const node = await (await getStore(memory)).getNode(id);
|
|
16101
|
+
if (!node || node.mergedInto) throw new Error(`Knowledge node not found: ${id}`);
|
|
16102
|
+
requireVisible(node.scope, options, "Knowledge node");
|
|
16103
|
+
return node;
|
|
16104
|
+
}
|
|
16099
16105
|
return {
|
|
16100
16106
|
knowledge_append: (0, _mastra_core_tools.createTool)({
|
|
16101
16107
|
id: "knowledge_append",
|
|
@@ -16166,7 +16172,7 @@ function createKnowledgeWriteTools(memory, options) {
|
|
|
16166
16172
|
}),
|
|
16167
16173
|
knowledge_update_node: (0, _mastra_core_tools.createTool)({
|
|
16168
16174
|
id: "knowledge_update_node",
|
|
16169
|
-
description: "
|
|
16175
|
+
description: "Atomically rename and re-kind a visible node using optimistic concurrency.",
|
|
16170
16176
|
inputSchema: {
|
|
16171
16177
|
type: "object",
|
|
16172
16178
|
properties: {
|
|
@@ -16187,17 +16193,18 @@ function createKnowledgeWriteTools(memory, options) {
|
|
|
16187
16193
|
minLength: 1
|
|
16188
16194
|
}
|
|
16189
16195
|
},
|
|
16190
|
-
required: [
|
|
16196
|
+
required: [
|
|
16197
|
+
"node",
|
|
16198
|
+
"expectedVersion",
|
|
16199
|
+
"name",
|
|
16200
|
+
"kind"
|
|
16201
|
+
],
|
|
16191
16202
|
additionalProperties: false
|
|
16192
16203
|
},
|
|
16193
16204
|
execute: async (input) => {
|
|
16194
16205
|
const value = input;
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
const node = await store.getNode(value.node);
|
|
16198
|
-
if (!node || node.mergedInto) throw new Error(`Knowledge node not found: ${value.node}`);
|
|
16199
|
-
requireVisible(node.scope, options, "Knowledge node");
|
|
16200
|
-
return store.updateNode({
|
|
16206
|
+
const node = await resolveWritableNode(value.node);
|
|
16207
|
+
return (await getStore(memory)).updateNode({
|
|
16201
16208
|
id: node.id,
|
|
16202
16209
|
version: value.expectedVersion,
|
|
16203
16210
|
name: value.name,
|
|
@@ -16205,6 +16212,78 @@ function createKnowledgeWriteTools(memory, options) {
|
|
|
16205
16212
|
});
|
|
16206
16213
|
}
|
|
16207
16214
|
}),
|
|
16215
|
+
knowledge_rename_node: (0, _mastra_core_tools.createTool)({
|
|
16216
|
+
id: "knowledge_rename_node",
|
|
16217
|
+
description: "Rename a visible node using optimistic concurrency.",
|
|
16218
|
+
inputSchema: {
|
|
16219
|
+
type: "object",
|
|
16220
|
+
properties: {
|
|
16221
|
+
node: {
|
|
16222
|
+
type: "string",
|
|
16223
|
+
minLength: 1
|
|
16224
|
+
},
|
|
16225
|
+
expectedVersion: {
|
|
16226
|
+
type: "integer",
|
|
16227
|
+
minimum: 1
|
|
16228
|
+
},
|
|
16229
|
+
name: {
|
|
16230
|
+
type: "string",
|
|
16231
|
+
minLength: 1
|
|
16232
|
+
}
|
|
16233
|
+
},
|
|
16234
|
+
required: [
|
|
16235
|
+
"node",
|
|
16236
|
+
"expectedVersion",
|
|
16237
|
+
"name"
|
|
16238
|
+
],
|
|
16239
|
+
additionalProperties: false
|
|
16240
|
+
},
|
|
16241
|
+
execute: async (input) => {
|
|
16242
|
+
const value = input;
|
|
16243
|
+
const node = await resolveWritableNode(value.node);
|
|
16244
|
+
return (await getStore(memory)).updateNode({
|
|
16245
|
+
id: node.id,
|
|
16246
|
+
version: value.expectedVersion,
|
|
16247
|
+
name: value.name
|
|
16248
|
+
});
|
|
16249
|
+
}
|
|
16250
|
+
}),
|
|
16251
|
+
knowledge_set_node_kind: (0, _mastra_core_tools.createTool)({
|
|
16252
|
+
id: "knowledge_set_node_kind",
|
|
16253
|
+
description: "Change a visible node kind using optimistic concurrency.",
|
|
16254
|
+
inputSchema: {
|
|
16255
|
+
type: "object",
|
|
16256
|
+
properties: {
|
|
16257
|
+
node: {
|
|
16258
|
+
type: "string",
|
|
16259
|
+
minLength: 1
|
|
16260
|
+
},
|
|
16261
|
+
expectedVersion: {
|
|
16262
|
+
type: "integer",
|
|
16263
|
+
minimum: 1
|
|
16264
|
+
},
|
|
16265
|
+
kind: {
|
|
16266
|
+
type: "string",
|
|
16267
|
+
minLength: 1
|
|
16268
|
+
}
|
|
16269
|
+
},
|
|
16270
|
+
required: [
|
|
16271
|
+
"node",
|
|
16272
|
+
"expectedVersion",
|
|
16273
|
+
"kind"
|
|
16274
|
+
],
|
|
16275
|
+
additionalProperties: false
|
|
16276
|
+
},
|
|
16277
|
+
execute: async (input) => {
|
|
16278
|
+
const value = input;
|
|
16279
|
+
const node = await resolveWritableNode(value.node);
|
|
16280
|
+
return (await getStore(memory)).updateNode({
|
|
16281
|
+
id: node.id,
|
|
16282
|
+
version: value.expectedVersion,
|
|
16283
|
+
kind: value.kind
|
|
16284
|
+
});
|
|
16285
|
+
}
|
|
16286
|
+
}),
|
|
16208
16287
|
knowledge_merge_nodes: (0, _mastra_core_tools.createTool)({
|
|
16209
16288
|
id: "knowledge_merge_nodes",
|
|
16210
16289
|
description: "Merge a visible duplicate node into another visible node using source-version CAS.",
|
|
@@ -16744,7 +16823,7 @@ var Subconscious = class {
|
|
|
16744
16823
|
const CURATION_AGENT = "curate";
|
|
16745
16824
|
const DEFAULT_INSTRUCTIONS$1 = `Maintain durable scoped knowledge from the committed observation worklist.
|
|
16746
16825
|
|
|
16747
|
-
Use the read tools to inspect existing nodes, knowledge records, mentions, backlinks, and long-form node content. Use the write tools to merge true duplicates, repair names and links, soft-delete superseded knowledge records, rescope knowledge records only when justified and permitted by their ceilings, and synthesize useful node content. Never restore deleted knowledge records. Never invent provenance, capture timestamps, scopes, ceilings, IDs, or versions; those are enforced by code. Resolve optimistic-concurrency conflicts by reading the latest record and retrying the intended mutation. Keep the reserved capture-guidance node concise and update it only with durable guidance that will improve future capture.
|
|
16826
|
+
Use the read tools to inspect existing nodes, knowledge records, mentions, backlinks, and long-form node content. Use the write tools to merge true duplicates, repair names and links, soft-delete superseded knowledge records, rescope knowledge records only when justified and permitted by their ceilings, and synthesize useful node content. When both a node name and kind must change, use knowledge_update_node so they commit atomically under one expectedVersion; use the single-field tools only when changing one field. Never restore deleted knowledge records. Never invent provenance, capture timestamps, scopes, ceilings, IDs, or versions; those are enforced by code. Resolve optimistic-concurrency conflicts by reading the latest record and retrying the intended mutation. Keep the reserved capture-guidance node concise and update it only with durable guidance that will improve future capture.
|
|
16748
16827
|
|
|
16749
16828
|
For each significant entity node touched by a KnowledgeRecord in the current worklist, including people, projects, pull requests, issues, repositories, documents, and organizations, maintain a short entity description; do not walk nodes outside the worklist for this. Use the supplied record and read the named node once; do not search or browse unless its identity is ambiguous. Describe what the entity is, its current state, and links to its real-world object, then write it with knowledge_write_node_description, which always requires expectedVersion from the node you just read; after a version conflict, re-read the node and regenerate the description from its current state before retrying. If the node does not exist yet, create it first with knowledge_write_node_content, then re-read it for its fresh version before writing the description. Write one or two plain-text sentences, roughly 40 to 75 tokens; storage rejects any description over its hard length cap, so keep them tight and put long-form detail in node content instead. Include links only from the entity's own records or observations that explicitly associate the link with that entity; never invent a URL, identifier, file path, or provenance. Leave long-form node content alone unless you are synthesizing it deliberately; never shrink content into a synopsis. For entity-description maintenance only, skip low-signal nodes with only a trivial record, any system-kind node, and the reserved capture-guidance node.
|
|
16750
16829
|
|
|
@@ -23219,20 +23298,20 @@ function getUnobservedPartsPreservingToolCallPairs(message) {
|
|
|
23219
23298
|
/**
|
|
23220
23299
|
* Get the messages Observational Memory is allowed to work with.
|
|
23221
23300
|
*
|
|
23222
|
-
* Messages supplied through the `context` option
|
|
23223
|
-
* persistence contract already treats
|
|
23224
|
-
*
|
|
23301
|
+
* Messages supplied through the `context` option and the synthetic `om-continuation`
|
|
23302
|
+
* message are prompt-only input. Core's persistence contract already treats context as
|
|
23303
|
+
* never-persist, while the continuation remains memory-sourced so it can stay in the live
|
|
23304
|
+
* actor prompt.
|
|
23225
23305
|
*
|
|
23226
|
-
* OM builds its windows from `get.all.db()`, which includes
|
|
23227
|
-
*
|
|
23228
|
-
*
|
|
23229
|
-
* accounting consistent with that contract.
|
|
23306
|
+
* OM builds its windows from `get.all.db()`, which includes both categories, and then seals
|
|
23307
|
+
* and persists candidates directly. Excluding them here keeps OM's observation, buffering,
|
|
23308
|
+
* persistence, and token accounting consistent with their ephemeral contract.
|
|
23230
23309
|
*/
|
|
23231
23310
|
function getObservableMessages(messageList) {
|
|
23232
|
-
const allMessages = messageList.get.all.db();
|
|
23233
23311
|
const contextMessageIds = messageList.makeMessageSourceChecker().context;
|
|
23234
|
-
|
|
23235
|
-
|
|
23312
|
+
return messageList.get.all.db().filter((message) => {
|
|
23313
|
+
return message.id !== "om-continuation" && !contextMessageIds.has(message.id);
|
|
23314
|
+
});
|
|
23236
23315
|
}
|
|
23237
23316
|
/**
|
|
23238
23317
|
* Safely extract buffered observation chunks from a record.
|
|
@@ -31869,4 +31948,4 @@ Object.defineProperty(exports, "wrapInObservationGroup", {
|
|
|
31869
31948
|
}
|
|
31870
31949
|
});
|
|
31871
31950
|
|
|
31872
|
-
//# sourceMappingURL=src-
|
|
31951
|
+
//# sourceMappingURL=src-Bq1Ng-3M.cjs.map
|