@mastra/memory 1.28.1-alpha.0 → 1.28.1

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 1.28.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Add an optional bounded description field to knowledge nodes across storage adapters, written through a dedicated curator tool. Part of an unreleased experimental memory feature. ([#21830](https://github.com/mastra-ai/mastra/pull/21830))
8
+
9
+ - Knowledge curation no longer fails on Gemini models: the curator's `knowledge_update_node` tool schema was rejected by Google's API ("required only allowed for OBJECT type"), causing every curation attempt with a Gemini curator to fail before the model ran. The tool now accepts the same inputs with `name`/`kind` as optional properties (at least one required). ([#22337](https://github.com/mastra-ai/mastra/pull/22337))
10
+
11
+ - Improve the reliability and capacity of experimental memory processing. ([#22178](https://github.com/mastra-ai/mastra/pull/22178))
12
+
13
+ - Updated dependencies [[`bae1502`](https://github.com/mastra-ai/mastra/commit/bae150254b06a4da6964d7c137af97f336362359), [`0885364`](https://github.com/mastra-ai/mastra/commit/0885364c2fc7fa31febcfc444fc1ba5231ac1257), [`b8cb683`](https://github.com/mastra-ai/mastra/commit/b8cb683ba66499df254ddd1f7edd8cae3f89d2e7), [`078affd`](https://github.com/mastra-ai/mastra/commit/078affdaea57ac5e95a77e9e7b197d1878190684), [`9e3403e`](https://github.com/mastra-ai/mastra/commit/9e3403e9868240cb18841898e84cf008ebd7a87e), [`791bf5e`](https://github.com/mastra-ai/mastra/commit/791bf5e81cd27e2e1cff66122f1380ab8a3dda41)]:
14
+ - @mastra/core@1.63.1
15
+
16
+ ## 1.28.1-alpha.1
17
+
18
+ ### Patch Changes
19
+
20
+ - Add an optional bounded description field to knowledge nodes across storage adapters, written through a dedicated curator tool. Part of an unreleased experimental memory feature. ([#21830](https://github.com/mastra-ai/mastra/pull/21830))
21
+
22
+ - Updated dependencies [[`0885364`](https://github.com/mastra-ai/mastra/commit/0885364c2fc7fa31febcfc444fc1ba5231ac1257)]:
23
+ - @mastra/core@1.63.1-alpha.2
24
+
3
25
  ## 1.28.1-alpha.0
4
26
 
5
27
  ### Patch Changes
@@ -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.1-alpha.0"
6
+ version: "1.28.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.28.1-alpha.0",
2
+ "version": "1.28.1",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {},
5
5
  "modules": {
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-BWo0fcaP.cjs");
2
+ const require_src = require("./src-Br56ncef.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-BsEVZAdq.js";
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-BNtoxIHL.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-BWo0fcaP.cjs");
2
+ const require_src = require("../src-Br56ncef.cjs");
3
3
  exports.Extractor = require_src.Extractor;
4
4
  exports.KnowledgeSemanticIndexCoordinator = require_src.KnowledgeSemanticIndexCoordinator;
5
5
  exports.ModelByInputTokens = require_src.ModelByInputTokens;
@@ -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-BsEVZAdq.js";
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-BNtoxIHL.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 };
@@ -1 +1 @@
1
- {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAElG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAA2B,MAAM,cAAc,CAAC;AAIzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAA8B,MAAM,SAAS,CAAC;AAMhH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;iBAgBpC,CAAC;AA6EH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,KAAK,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,CAAC;CACpF;AAED,qBAAa,4BAA6B,SAAQ,SAAS,CAAC,yBAAyB,CAAC;gBACxE,OAAO,EAAE,uBAAuB;CAwH7C;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,2BAA2B,CAAC,yBAAyB,CAAC,EAC/D,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,GAC/C,OAAO,CAAC,IAAI,CAAC,CAGf"}
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAElG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAA2B,MAAM,cAAc,CAAC;AAIzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,yBAAyB,EAA8B,MAAM,SAAS,CAAC;AAMhH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;iBAgBpC,CAAC;AA8EH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,yBAAyB,CAAC;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,KAAK,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,OAAO,CAAA;KAAE,CAAC;CACpF;AAED,qBAAa,4BAA6B,SAAQ,SAAS,CAAC,yBAAyB,CAAC;gBACxE,OAAO,EAAE,uBAAuB;CAwH7C;AAED,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,2BAA2B,CAAC,yBAAyB,CAAC,EAC/D,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,GAC/C,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -1 +1 @@
1
- {"version":3,"file":"curate.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/curate.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAOrF,OAAO,KAAK,EAA6B,0BAA0B,EAAE,MAAM,SAAS,CAAC;AASrF,eAAO,MAAM,mBAAmB,mlBAAmlB,CAAC;AAqCpnB,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,0BAA0B,EACxC,aAAa,SAAS,EACtB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,wBAAwB,CAAA;CAAE,GAC/C,CAAC,OAAO,EAAE,0BAA0B,KAAK,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,CAoEnE"}
1
+ {"version":3,"file":"curate.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/curate.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAOrF,OAAO,KAAK,EAA6B,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAWrF,eAAO,MAAM,mBAAmB,mlBAAmlB,CAAC;AAqCpnB,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,0BAA0B,EACxC,aAAa,SAAS,EACtB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,wBAAwB,CAAA;CAAE,GAC/C,CAAC,OAAO,EAAE,0BAA0B,KAAK,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,CAoEnE"}
@@ -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;AAOlG,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,CA0L3C"}
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,CA+N3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"semantic-index.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/semantic-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAGd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKtG,qBAAa,gCAAiC,SAAQ,KAAK;gBAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,MAAM,WAAW,uCAAuC;IACtD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD,qBAAa,iCAAiC;;gBAShC,MAAM,EAAE,uCAAuC;IASrD,KAAK,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,SAAK;CA0L9D"}
1
+ {"version":3,"file":"semantic-index.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/semantic-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAGd,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKtG,qBAAa,gCAAiC,SAAQ,KAAK;gBAC7C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD;AAED,MAAM,WAAW,uCAAuC;IACtD,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,CAAC,EAAE,sBAAsB,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD,qBAAa,iCAAiC;;gBAShC,MAAM,EAAE,uCAAuC;IASrD,KAAK,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,SAAK;CA4L9D"}
@@ -11,7 +11,7 @@ import { isStandardSchemaWithJSON, standardSchemaToJSONSchema, toStandardSchema
11
11
  import { Mutex } from "async-mutex";
12
12
  import { LRUCache } from "lru-cache";
13
13
  import xxhash from "xxhash-wasm";
14
- import { InMemoryStore, assertKnowledgeScopeWithinCeiling, canonicalizeKnowledgeScope, createKnowledgeNodeCursor, expandKnowledgeScope, isKnowledgeScopeVisible, knowledgeScopeKey } from "@mastra/core/storage";
14
+ import { InMemoryStore, MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH, assertKnowledgeScopeWithinCeiling, canonicalizeKnowledgeScope, createKnowledgeNodeCursor, expandKnowledgeScope, isKnowledgeScopeVisible, knowledgeScopeKey } from "@mastra/core/storage";
15
15
  import { createHash, randomBytes, randomUUID } from "crypto";
16
16
  import { createTool } from "@mastra/core/tools";
17
17
  import { modelSupportsAttachments, resolveModelConfig } from "@mastra/core/llm";
@@ -206,7 +206,7 @@ let customAlphabet = (alphabet, defaultSize = 21) => {
206
206
  return (size = defaultSize) => {
207
207
  let id = "";
208
208
  let i = size | 0;
209
- while (i--) id += alphabet[Math.random() * alphabet.length | 0];
209
+ while (i-- > 0) id += alphabet[Math.random() * alphabet.length | 0];
210
210
  return id;
211
211
  };
212
212
  };
@@ -3713,7 +3713,7 @@ function trimStartOfStream() {
3713
3713
  };
3714
3714
  }
3715
3715
  //#endregion
3716
- //#region ../_vendored/ai_v5/dist/dist-nVfjvSbw.js
3716
+ //#region ../_vendored/ai_v5/dist/dist-Dqv4QeJJ.js
3717
3717
  var marker$1$4 = "vercel.ai.error";
3718
3718
  var symbol$1$3 = Symbol.for(marker$1$4);
3719
3719
  var _a$1$3;
@@ -8602,7 +8602,7 @@ var object$1 = ({ schema: inputSchema }) => {
8602
8602
  };
8603
8603
  };
8604
8604
  //#endregion
8605
- //#region ../_vendored/ai_v6/dist/dist-Gd4EIxPM.js
8605
+ //#region ../_vendored/ai_v6/dist/dist-Cx98_f-i.js
8606
8606
  var marker$1 = "vercel.ai.error";
8607
8607
  var symbol$1$1 = Symbol.for(marker$1);
8608
8608
  var _a$1$1;
@@ -10755,7 +10755,7 @@ function withoutTrailingSlash(url) {
10755
10755
  return url == null ? void 0 : url.replace(/\/$/, "");
10756
10756
  }
10757
10757
  //#endregion
10758
- //#region ../_vendored/ai_v6/dist/dist-BoeKQsDe.js
10758
+ //#region ../_vendored/ai_v6/dist/dist-pa8X6y1Z.js
10759
10759
  function getContext() {
10760
10760
  return { headers: {} };
10761
10761
  }
@@ -15273,6 +15273,7 @@ Return nodes with short stable names, a freeform kind, and knowledge records nes
15273
15273
  Use common kinds such as person, task, event, project, organization, or document when they fit.
15274
15274
  Set node scope to the narrowest level where that identity and content should be shared. Omit it to use the configured default scope.
15275
15275
  Knowledge records must be grounded in the conversation, concise, and written as prose. Do not infer unstated information.
15276
+ When the conversation states a canonical identifier or URL for an entity, preserve it verbatim in the record text.
15276
15277
  Wrap every named node mentioned in record text in [[wikilinks]].
15277
15278
  Set a record scope only when the conversation establishes where it applies. Use org for organization-wide records, resource for records shared across this resource's conversations, and thread for conversation-private records.
15278
15279
  Omit scope when uncertain; omitted record scopes stay private to the current thread.
@@ -16248,6 +16249,48 @@ function createKnowledgeWriteTools(memory, options) {
16248
16249
  });
16249
16250
  }
16250
16251
  }),
16252
+ knowledge_write_node_description: createTool({
16253
+ id: "knowledge_write_node_description",
16254
+ description: `Write the bounded synopsis (max ${MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH} UTF-16 code units) on an existing visible node using optimistic concurrency. Pass an empty string to clear it. Does not create nodes.`,
16255
+ inputSchema: {
16256
+ type: "object",
16257
+ properties: {
16258
+ node: {
16259
+ type: "string",
16260
+ minLength: 1
16261
+ },
16262
+ expectedVersion: {
16263
+ type: "integer",
16264
+ minimum: 1
16265
+ },
16266
+ description: {
16267
+ type: "string",
16268
+ minLength: 0,
16269
+ maxLength: MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH,
16270
+ description: `One or two plain-text sentences describing the node, targeting 40-75 tokens. Hard limit ${MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH} UTF-16 code units, enforced by storage on every write; the length check on execution is authoritative. Long-form detail belongs in node content, not here. An empty string clears the description.`
16271
+ }
16272
+ },
16273
+ required: [
16274
+ "node",
16275
+ "expectedVersion",
16276
+ "description"
16277
+ ],
16278
+ additionalProperties: false
16279
+ },
16280
+ execute: async (input) => {
16281
+ const value = input;
16282
+ if (value.description.length > MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH) throw new Error(`Node descriptions are limited to ${MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH} UTF-16 code units. Shorten the description and retry.`);
16283
+ const store = await getStore(memory);
16284
+ const node = await store.getNode(value.node);
16285
+ if (!node || node.mergedInto) throw new Error(`Knowledge node not found: ${value.node}`);
16286
+ requireVisible(node.scope, options, "Knowledge node");
16287
+ return store.updateNode({
16288
+ id: node.id,
16289
+ version: value.expectedVersion,
16290
+ description: value.description
16291
+ });
16292
+ }
16293
+ }),
16251
16294
  knowledge_write_node_content: createTool({
16252
16295
  id: "knowledge_write_node_content",
16253
16296
  description: "Create or replace long-form content on a scoped knowledge node. Existing nodes require expectedVersion.",
@@ -16456,7 +16499,7 @@ var KnowledgeSemanticIndexCoordinator = class {
16456
16499
  const node = await this.#knowledge.getNode(entry.documentId.slice(15));
16457
16500
  if (!node || node.mergedInto) return null;
16458
16501
  return {
16459
- text: `${node.name}\n${node.content ?? ""}`,
16502
+ text: node.description ? `${node.name}\n${node.description}\n${node.content ?? ""}` : `${node.name}\n${node.content ?? ""}`,
16460
16503
  name: node.name,
16461
16504
  scope: node.scope,
16462
16505
  recordId: node.id,
@@ -16682,6 +16725,8 @@ const DEFAULT_INSTRUCTIONS$1 = `Maintain durable scoped knowledge from the commi
16682
16725
 
16683
16726
  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.
16684
16727
 
16728
+ 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.
16729
+
16685
16730
  Process the worklist in ID order. Every time you finish processing a KnowledgeRecord, include <curation-complete through="RECORD_ID" /> in your next text response with that record's ID. The latest marker is your acknowledged cursor, so progress survives if you run out of steps mid-batch. Your final response must end with the marker for the last KnowledgeRecord you fully processed. If you cannot finish the batch, acknowledge only the last KnowledgeRecord you did finish. Do not emit a completion marker when no KnowledgeRecord was fully processed.`;
16686
16731
  const PINNED_INSTRUCTIONS = `Maintain the pin set with knowledge_pin, knowledge_edit_pin, and knowledge_unpin. Pinned entries are delivered to the main agent on every turn, so they cost tokens permanently and must stay short. Pin only knowledge that should apply without being asked for, such as standing instructions, durable preferences, and hard constraints. Pin only knowledge that is BOTH costly to rediscover AND not the kind of thing a future agent would think to search for; anything a reminder can surface on demand does not belong in the pin set. Unpin an entry as soon as it stops being unconditionally true.`;
16687
16732
  function resolveScope$1(context) {
@@ -31510,4 +31555,4 @@ Notes:
31510
31555
  //#endregion
31511
31556
  export { formatMessagesForObserver as A, OBSERVATION_CONTINUATION_HINT as B, SUMMARIZE_THREAD_DEFAULTS as C, buildObserverPrompt as D, OBSERVER_SYSTEM_PROMPT as E, parseAnchorId as F, ModelByInputTokens as G, KnowledgeSemanticIndexCoordinator as H, stripEphemeralAnchorIds as I, SUBCONSCIOUS_ACTIVITY_STATE_ID as J, SubconsciousCaptureExtractor as K, OBSERVATIONAL_MEMORY_DEFAULTS as L, optimizeObservationsForContext as M, parseObserverOutput as N, buildObserverSystemPrompt as O, injectAnchorIds as P, Extractor as Q, OBSERVATION_CONTEXT_INSTRUCTIONS as R, WorkingMemoryExtractor as S, TokenCounter as T, StaleKnowledgeSemanticIndexError as U, Subconscious as V, SubconsciousRemindExtractor as W, publishSubconsciousActivity as X, buildSubconsciousActivitySnapshot as Y, renderSubconsciousActivity as Z, wrapInObservationGroup as _, extractWorkingMemoryContent as a, WorkingMemoryStateProcessor as b, getObservationsAsOf as c, combineObservationGroupRanges as d, deriveObservationGroupProvenance as f, stripObservationGroups as g, renderObservationGroupsForReflection as h, WorkingMemory as i, hasCurrentTaskSection as j, extractCurrentTask as k, ObservationalMemoryProcessor as l, reconcileObservationGroupsFromReflection as m, MessageHistory$1 as n, extractWorkingMemoryTags as o, parseObservationGroups as p, subconsciousCaptureSchema as q, SemanticRecall as r, removeWorkingMemoryTags as s, Memory as t, ObservationalMemory as u, WORKING_MEMORY_STATE_ID as v, summarizeConversation as w, deepMergeWorkingMemory as x, WORKING_MEMORY_STATE_PROCESSOR_ID as y, OBSERVATION_CONTEXT_PROMPT as z };
31512
31557
 
31513
- //# sourceMappingURL=src-BsEVZAdq.js.map
31558
+ //# sourceMappingURL=src-BNtoxIHL.js.map