@mastra/memory 1.40.0 → 1.41.0-alpha.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.
Files changed (60) hide show
  1. package/dist/docs/SKILL.md +1 -1
  2. package/dist/docs/assets/SOURCE_MAP.json +89 -109
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +7 -37
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +1 -1
  7. package/dist/processors/index.cjs +1 -9
  8. package/dist/processors/index.js +1 -1
  9. package/dist/processors/observational-memory/index.d.ts +0 -2
  10. package/dist/processors/observational-memory/index.d.ts.map +1 -1
  11. package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +1 -1
  12. package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
  13. package/dist/processors/observational-memory/observer-agent.d.ts.map +1 -1
  14. package/dist/processors/observational-memory/reflector-runner.d.ts +1 -4
  15. package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
  16. package/dist/processors/observational-memory/types.d.ts +2 -17
  17. package/dist/processors/observational-memory/types.d.ts.map +1 -1
  18. package/dist/removed-subconscious.d.ts +33 -0
  19. package/dist/removed-subconscious.d.ts.map +1 -0
  20. package/dist/{src-RKBjZOzr.js → src-CBYx0iwC.js} +545 -3535
  21. package/dist/src-CBYx0iwC.js.map +1 -0
  22. package/dist/{src-CaxT6Rpu.cjs → src-GDwZ0vzw.cjs} +544 -3564
  23. package/dist/src-GDwZ0vzw.cjs.map +1 -0
  24. package/package.json +6 -7
  25. package/dist/processors/observational-memory/subconscious/activity.d.ts +0 -39
  26. package/dist/processors/observational-memory/subconscious/activity.d.ts.map +0 -1
  27. package/dist/processors/observational-memory/subconscious/curate.d.ts +0 -20
  28. package/dist/processors/observational-memory/subconscious/curate.d.ts.map +0 -1
  29. package/dist/processors/observational-memory/subconscious/index.d.ts +0 -41
  30. package/dist/processors/observational-memory/subconscious/index.d.ts.map +0 -1
  31. package/dist/processors/observational-memory/subconscious/knowledge-tools.d.ts +0 -26
  32. package/dist/processors/observational-memory/subconscious/knowledge-tools.d.ts.map +0 -1
  33. package/dist/processors/observational-memory/subconscious/knowledge-write-tools.d.ts +0 -29
  34. package/dist/processors/observational-memory/subconscious/knowledge-write-tools.d.ts.map +0 -1
  35. package/dist/processors/observational-memory/subconscious/model.d.ts +0 -21
  36. package/dist/processors/observational-memory/subconscious/model.d.ts.map +0 -1
  37. package/dist/processors/observational-memory/subconscious/origin.d.ts +0 -4
  38. package/dist/processors/observational-memory/subconscious/origin.d.ts.map +0 -1
  39. package/dist/processors/observational-memory/subconscious/pinned-state-processor.d.ts +0 -47
  40. package/dist/processors/observational-memory/subconscious/pinned-state-processor.d.ts.map +0 -1
  41. package/dist/processors/observational-memory/subconscious/pinned.d.ts +0 -48
  42. package/dist/processors/observational-memory/subconscious/pinned.d.ts.map +0 -1
  43. package/dist/processors/observational-memory/subconscious/remind-agent.d.ts +0 -22
  44. package/dist/processors/observational-memory/subconscious/remind-agent.d.ts.map +0 -1
  45. package/dist/processors/observational-memory/subconscious/remind-continuation.d.ts +0 -21
  46. package/dist/processors/observational-memory/subconscious/remind-continuation.d.ts.map +0 -1
  47. package/dist/processors/observational-memory/subconscious/remind-protocol.d.ts +0 -28
  48. package/dist/processors/observational-memory/subconscious/remind-protocol.d.ts.map +0 -1
  49. package/dist/processors/observational-memory/subconscious/remind-questions.d.ts +0 -27
  50. package/dist/processors/observational-memory/subconscious/remind-questions.d.ts.map +0 -1
  51. package/dist/processors/observational-memory/subconscious/remind.d.ts +0 -7
  52. package/dist/processors/observational-memory/subconscious/remind.d.ts.map +0 -1
  53. package/dist/processors/observational-memory/subconscious/scope.d.ts +0 -14
  54. package/dist/processors/observational-memory/subconscious/scope.d.ts.map +0 -1
  55. package/dist/processors/observational-memory/subconscious/semantic-index.d.ts +0 -20
  56. package/dist/processors/observational-memory/subconscious/semantic-index.d.ts.map +0 -1
  57. package/dist/processors/observational-memory/subconscious/types.d.ts +0 -65
  58. package/dist/processors/observational-memory/subconscious/types.d.ts.map +0 -1
  59. package/dist/src-CaxT6Rpu.cjs.map +0 -1
  60. package/dist/src-RKBjZOzr.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/memory",
3
- "version": "1.40.0",
3
+ "version": "1.41.0-alpha.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "license": "Apache-2.0",
47
47
  "dependencies": {
48
48
  "async-mutex": "^0.5.0",
49
- "diff": "^8.0.4",
49
+ "diff": "^9.0.0",
50
50
  "json-schema": "^0.4.0",
51
51
  "lru-cache": "^11.5.3",
52
52
  "probe-image-size": "^7.4.0",
@@ -67,12 +67,12 @@
67
67
  "typescript": "^6.0.3",
68
68
  "vitest": "4.1.12",
69
69
  "@internal/ai-sdk-v4": "0.0.94",
70
- "@internal/ai-v6": "0.0.94",
71
70
  "@internal/ai-sdk-v5": "0.0.94",
72
- "@internal/ai-v7": "0.0.94",
73
71
  "@internal/lint": "0.0.147",
72
+ "@internal/ai-v6": "0.0.94",
74
73
  "@internal/types-builder": "0.0.122",
75
- "@mastra/core": "1.81.0"
74
+ "@internal/ai-v7": "0.0.94",
75
+ "@mastra/core": "1.82.0-alpha.1"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@mastra/core": ">=1.80.0-0 <2.0.0-0"
@@ -102,7 +102,6 @@
102
102
  "lint:fix": "oxlint --type-aware --fix .",
103
103
  "analyze:om-repro": "node ./scripts/analyze-om-repro.mjs",
104
104
  "sanitize:om-repro": "node ./scripts/sanitize-om-repro.mjs",
105
- "simulate:extract": "tsx ./scripts/simulate/extract.ts",
106
- "simulate:replay": "tsx ./scripts/simulate/replay.ts"
105
+ "simulate:extract": "tsx ./scripts/simulate/extract.ts"
107
106
  }
108
107
  }
@@ -1,39 +0,0 @@
1
- import type { ProcessorContext, ProcessorStreamWriter } from '@mastra/core/processors';
2
- import type { KnowledgeActivityEvent, KnowledgeScope, KnowledgeSemanticDocumentType, KnowledgeStorage } from '@mastra/core/storage';
3
- export declare const SUBCONSCIOUS_ACTIVITY_STATE_ID = "subconscious-activity";
4
- export interface SubconsciousActivityUpdate {
5
- action: KnowledgeActivityEvent['action'];
6
- type: KnowledgeSemanticDocumentType;
7
- name?: string;
8
- createdAt: string;
9
- }
10
- export interface SubconsciousActivitySnapshot {
11
- updates: SubconsciousActivityUpdate[];
12
- hot: Array<{
13
- type: 'node';
14
- name: string;
15
- updates: number;
16
- }>;
17
- errors?: string[];
18
- }
19
- export declare function buildSubconsciousActivitySnapshot(input: {
20
- store: KnowledgeStorage;
21
- scope: KnowledgeScope;
22
- recentUpdates: number;
23
- errors?: string[];
24
- }): Promise<SubconsciousActivitySnapshot>;
25
- export declare function renderSubconsciousActivity(snapshot: SubconsciousActivitySnapshot): string;
26
- export declare function publishSubconsciousError(input: {
27
- error: string;
28
- agent?: string;
29
- sendStateSignal?: ProcessorContext['sendStateSignal'];
30
- writer?: ProcessorStreamWriter;
31
- }): Promise<void>;
32
- export declare function publishSubconsciousActivity(input: {
33
- store: KnowledgeStorage;
34
- scope: KnowledgeScope;
35
- recentUpdates: number;
36
- sendStateSignal?: ProcessorContext['sendStateSignal'];
37
- errors?: string[];
38
- }): Promise<SubconsciousActivitySnapshot | undefined>;
39
- //# sourceMappingURL=activity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EACV,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAG9B,eAAO,MAAM,8BAA8B,0BAA0B,CAAC;AAOtE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,sBA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,0 @@
1
- import { Agent } from '@mastra/core/agent';
2
- import type { KnowledgeScope } from '@mastra/core/storage';
3
- import type { Memory } from '../../../index.js';
4
- import { Extractor } from '../extractor.js';
5
- import type { ExtractorOnExtractedContext } from '../extractor.js';
6
- import type { ObservationalMemoryModel } from '../types.js';
7
- import type { ResolvedSubconsciousAgent, ResolvedSubconsciousConfig } from './types.js';
8
- export declare const CURATION_AGENT = "curate";
9
- export declare 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.";
10
- type CuratorContext = Pick<ExtractorOnExtractedContext, 'abortSignal' | 'mainAgent' | 'requestContext' | 'resourceId' | 'threadId'>;
11
- export declare function resolveCuratorScope(context: CuratorContext): KnowledgeScope;
12
- export declare class SubconsciousCurateExtractor extends Extractor<unknown> {
13
- constructor(config: ResolvedSubconsciousAgent, subconscious: ResolvedSubconsciousConfig, getCuratorMemory: () => Memory, omModel?: ObservationalMemoryModel, trackCuration?: (work: Promise<void>) => void);
14
- }
15
- /** ISO 8601 with the host's local UTC offset, so "today" matches the user's evening rather than UTC's next day. */
16
- export declare function formatLocalTimestamp(date: Date): string;
17
- export declare function dispatchCuratorObservation(agent: Agent, context: CuratorContext, config: ResolvedSubconsciousAgent, observations: string): import("@mastra/core/agent").SendAgentMessageResult<undefined>;
18
- export declare function createCuratorAgent(memory: Memory, curatorMemory: Memory, context: CuratorContext, scope: KnowledgeScope, config: ResolvedSubconsciousAgent, subconscious: ResolvedSubconsciousConfig, omModel?: ObservationalMemoryModel): Promise<Agent>;
19
- export {};
20
- //# sourceMappingURL=curate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"curate.d.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,CACtC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,yBAAyB,EACjC,YAAY,EAAE,0BAA0B,EACxC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,KAAK,CAAC,CAuChB"}
@@ -1,41 +0,0 @@
1
- import type { Memory } from '../../../index.js';
2
- import { Extractor } from '../extractor.js';
3
- import type { ObservationalMemoryModel } from '../types.js';
4
- import type { ResolvedSubconsciousConfig, SubconsciousConfig } from './types.js';
5
- /**
6
- * Configures experimental observation-time knowledge reminders and curation.
7
- *
8
- * @experimental This API may change without notice.
9
- */
10
- export declare class Subconscious {
11
- #private;
12
- readonly config: Readonly<SubconsciousConfig>;
13
- readonly resolved: Readonly<ResolvedSubconsciousConfig>;
14
- constructor(config?: SubconsciousConfig);
15
- /**
16
- * Resolve once every curator run this Subconscious dispatched has finished, including runs
17
- * dispatched while waiting. Curation runs detached from the observation turn, so await this
18
- * (after `memory.settled()`) before closing storage the curator writes to.
19
- *
20
- * ```ts
21
- * await memory.settled();
22
- * await subconscious.settled();
23
- * await store.close();
24
- * ```
25
- */
26
- settled(): Promise<void>;
27
- createObservationExtractors(omModel: ObservationalMemoryModel | undefined, getCuratorMemory: () => Memory): Extractor<any>[];
28
- }
29
- export { buildSubconsciousActivitySnapshot, publishSubconsciousActivity, publishSubconsciousError, renderSubconsciousActivity, SUBCONSCIOUS_ACTIVITY_STATE_ID, } from './activity.js';
30
- export type { SubconsciousActivitySnapshot, SubconsciousActivityUpdate } from './activity.js';
31
- export { SubconsciousRemindExtractor } from './remind.js';
32
- export { createPinnedTools, listPinnedKnowledge, DEFAULT_MAX_PINS, DEFAULT_PINNED_MAX_CHARACTERS, MAX_PINNED_MAX_CHARACTERS, PINNED_NODE_NAME, PINNED_NODE_KIND, PINNED_NODE_SCOPE_LEVEL, PINNED_SNAPSHOT_TAG, PINNED_DELTA_TAG, SUBCONSCIOUS_PINS_STATE_ID, } from './pinned.js';
33
- export type { PinnedKnowledgeSet, PinnedToolsOptions } from './pinned.js';
34
- export { PinnedStateProcessor, applyPinOps, diffPins, effectivePriorPins, stablePinsCacheKey, } from './pinned-state-processor.js';
35
- export type { PinDeltaOp, PinEntry, PinnedStateProcessorDeps } from './pinned-state-processor.js';
36
- export { createKnowledgeWriteTools } from './knowledge-write-tools.js';
37
- export type { KnowledgeWriteToolsOptions } from './knowledge-write-tools.js';
38
- export { KnowledgeSemanticIndexCoordinator, StaleKnowledgeSemanticIndexError } from './semantic-index.js';
39
- export type { KnowledgeSemanticIndexCoordinatorConfig } from './semantic-index.js';
40
- export type { ResolvedSubconsciousAgent, ResolvedSubconsciousConfig, SubconsciousBuiltInObservationAgent, SubconsciousBuiltInObservationConfig, SubconsciousConfig, SubconsciousCustomObservationConfig, SubconsciousObservationEntry, } from './types.js';
41
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAIzD,OAAO,KAAK,EAEV,0BAA0B,EAC1B,kBAAkB,EAGnB,MAAM,SAAS,CAAC;AA2DjB;;;;GAIG;AACH,qBAAa,YAAY;;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC9C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IAGxD,YAAY,MAAM,GAAE,kBAAuB,EAmD1C;IAED;;;;;;;;;;OAUG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAI7B;IAUD,2BAA2B,CACzB,OAAO,EAA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astra/core/tools';
3
- import type { KnowledgeSemanticIndexCoordinator } from './semantic-index.js';
4
- export type KnowledgeStoreMemory = {
5
- getKnowledgeStore?: () => Promise<KnowledgeStorage>;
6
- storage?: {
7
- getStore(name: 'knowledge'): Promise<KnowledgeStorage | undefined>;
8
- };
9
- };
10
- type KnowledgeToolsMemory = KnowledgeStoreMemory & {
11
- getKnowledgeSemanticIndex(): Promise<KnowledgeSemanticIndexCoordinator | undefined>;
12
- };
13
- export type KnowledgeToolContext = {
14
- agent?: {
15
- threadId?: string;
16
- resourceId?: string;
17
- };
18
- requestContext?: {
19
- get(key: string): unknown;
20
- };
21
- };
22
- export declare function resolveKnowledgeToolScope(context: KnowledgeToolContext | undefined): KnowledgeScope;
23
- export declare function getKnowledgeStore(memory: KnowledgeStoreMemory): Promise<KnowledgeStorage>;
24
- export declare function createKnowledgeTools(memory: KnowledgeToolsMemory, fixedScope?: KnowledgeScope): Record<string, ToolAction<any, any, any>>;
25
- export {};
26
- //# sourceMappingURL=knowledge-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"knowledge-tools.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/knowledge-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,cAAc,EACd,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AAK1E,MAAM,MAAM,oBAAoB,GAAG;IACjC,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpD,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;KACpE,CAAC;CACH,CAAC;AAEF,KAAK,oBAAoB,GAAG,oBAAoB,GAAG;IACjD,yBAAyB,IAAI,OAAO,CAAC,iCAAiC,GAAG,SAAS,CAAC,CAAC;CACrF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,cAAc,CAAC,EAAE;QAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;CAChD,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,GAAG,cAAc,CAUnG;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAK/F;AAmGD,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,oBAAoB,EAC5B,UAAU,CAAC,EAAE,cAAc,GAC1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAqJ3C"}
@@ -1,29 +0,0 @@
1
- import type { KnowledgeScope, KnowledgeScopeLevel, KnowledgeStorage } from '@mastra/core/storage';
2
- import type { ToolAction } from '@mastra/core/tools';
3
- type KnowledgeWriteToolsMemory = {
4
- getKnowledgeStore?: () => Promise<KnowledgeStorage>;
5
- getKnowledgeInstance?: () => {
6
- __getVisibleStructureScopes(scope: KnowledgeScope): Promise<Array<{
7
- address: string;
8
- name: string;
9
- description?: string;
10
- heldAncestors?: string[];
11
- }>>;
12
- materializeScope?(input: {
13
- address: string;
14
- contextualScopeAddress: string;
15
- parentAddresses?: string[];
16
- }): Promise<unknown>;
17
- } | undefined;
18
- storage?: {
19
- getStore(name: 'knowledge'): Promise<KnowledgeStorage | undefined>;
20
- };
21
- };
22
- export interface KnowledgeWriteToolsOptions {
23
- scope: KnowledgeScope;
24
- sourceThreadId: string;
25
- defaultScope: KnowledgeScopeLevel;
26
- }
27
- export declare function createKnowledgeWriteTools(memory: KnowledgeWriteToolsMemory, options: KnowledgeWriteToolsOptions): Record<string, ToolAction<any, any, any>>;
28
- export {};
29
- //# sourceMappingURL=knowledge-write-tools.d.ts.map
@@ -1 +0,0 @@
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,EAAiB,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQjH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAmCrD,KAAK,yBAAyB,GAAG;IAC/B,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpD,oBAAoB,CAAC,EAAE,MACnB;QACE,2BAA2B,CACzB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,KAAK,CAAC;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAC;YAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAC,CAAC;QACrG,gBAAgB,CAAC,CAAC,KAAK,EAAE;YACvB,OAAO,EAAE,MAAM,CAAC;YAChB,sBAAsB,EAAE,MAAM,CAAC;YAC/B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;SAC5B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;KACtB,GACD,SAAS,CAAC;IACd,OAAO,CAAC,EAAE;QACR,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;CACnC;AAgKD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,yBAAyB,EACjC,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAyW3C"}
@@ -1,21 +0,0 @@
1
- import type { RequestContext } from '@mastra/core/request-context';
2
- import type { ObservationalMemoryModel, ReflectionCommittedContext } from '../types.js';
3
- import type { ResolvedSubconsciousAgent, SubconsciousModel } from './types.js';
4
- /**
5
- * Normalize an observational memory model config into something an Agent can consume directly.
6
- * Returns undefined when the OM model cannot stand alone: the 'default' sentinel and
7
- * token-routed models (ModelByInputTokens) both require engine context to resolve.
8
- */
9
- export declare function usableObservationalMemoryModel(model: ObservationalMemoryModel | undefined): SubconsciousModel | undefined;
10
- /**
11
- * Resolve the model a subconscious agent runs on. Precedence: the per-agent config model,
12
- * then the observational memory model, then the main agent's model. Returns undefined when
13
- * no source is available so callers keep their existing throw/silent-return behavior.
14
- */
15
- export declare function resolveSubconsciousAgentModel(options: {
16
- config: ResolvedSubconsciousAgent;
17
- omModel?: ObservationalMemoryModel;
18
- mainAgent?: ReflectionCommittedContext['mainAgent'];
19
- requestContext?: RequestContext;
20
- }): Promise<SubconsciousModel | undefined>;
21
- //# sourceMappingURL=model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5E;;;;GAIG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,wBAAwB,GAAG,SAAS,GAC1C,iBAAiB,GAAG,SAAS,CAW/B;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CAAC,OAAO,EAAE;IAC3D,MAAM,EAAE,yBAAyB,CAAC;IAClC,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,SAAS,CAAC,EAAE,0BAA0B,CAAC,WAAW,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAYzC"}
@@ -1,4 +0,0 @@
1
- import type { MastraDBMessage } from '@mastra/core/agent';
2
- export declare const SUBCONSCIOUS_ORIGIN = "subconscious";
3
- export declare function stripSubconsciousSignals(messages: MastraDBMessage[]): MastraDBMessage[];
4
- //# sourceMappingURL=origin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/origin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAiClD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CASvF"}
@@ -1,47 +0,0 @@
1
- /**
2
- * PinnedStateProcessor
3
- *
4
- * Projects the Subconscious pin set onto the agent state-signal lane. Delivery
5
- * follows the lane's contract: when no snapshot is in the visible context
6
- * (state never emitted, or observational memory evicted it) emit a full
7
- * snapshot; otherwise emit a small delta carrying only this turn's changes;
8
- * when nothing changed and the base snapshot is still visible, emit nothing so
9
- * the cached prompt prefix stays stable.
10
- *
11
- * Pins are KnowledgeRecords on a reserved node (see ./pinned), so each entry
12
- * has a stable id and a delta can say exactly which pin appeared or left.
13
- * There is no `update` op: editing a pin is remove-plus-append in storage, so
14
- * an edit arrives as a `remove` of the old id and an `add` of the new one.
15
- */
16
- import type { ComputeStateSignalArgs, ComputeStateSignalResult, Processor, ProcessInputArgs, ProcessInputResult } from '@mastra/core/processors';
17
- import type { KnowledgeStorage } from '@mastra/core/storage';
18
- import { SUBCONSCIOUS_PINS_STATE_ID } from './pinned.js';
19
- export interface PinEntry {
20
- id: string;
21
- text: string;
22
- }
23
- export type PinDeltaOp = {
24
- op: 'add';
25
- pin: PinEntry;
26
- } | {
27
- op: 'remove';
28
- id: string;
29
- };
30
- export declare function stablePinsCacheKey(pins: PinEntry[]): string;
31
- export declare function applyPinOps(pins: PinEntry[], ops: PinDeltaOp[]): PinEntry[];
32
- export declare function effectivePriorPins(args: ComputeStateSignalArgs): PinEntry[];
33
- export declare function diffPins(prior: PinEntry[], current: PinEntry[]): PinDeltaOp[];
34
- export interface PinnedStateProcessorDeps {
35
- getKnowledgeStore(): Promise<KnowledgeStorage | undefined>;
36
- }
37
- export declare class PinnedStateProcessor implements Processor<typeof SUBCONSCIOUS_PINS_STATE_ID> {
38
- private readonly deps;
39
- readonly id = "subconscious-pins";
40
- readonly stateId = "subconscious-pins";
41
- constructor(deps: PinnedStateProcessorDeps);
42
- processInput(args: ProcessInputArgs): ProcessInputResult;
43
- private resolveScope;
44
- private readPins;
45
- computeStateSignal(args: ComputeStateSignalArgs): Promise<ComputeStateSignalResult>;
46
- }
47
- //# sourceMappingURL=pinned-state-processor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinned-state-processor.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/pinned-state-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,SAAS,EAET,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAkB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAA8D,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAGlH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,UAAU,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAYrF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CAE3D;AAcD,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,QAAQ,EAAE,CAa3E;AAID,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,QAAQ,EAAE,CAM3E;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,CAW7E;AAcD,MAAM,WAAW,wBAAwB;IACvC,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;CAC5D;AAID,qBAAa,oBAAqB,YAAW,SAAS,CAAC,OAAO,0BAA0B,CAAC;IAI3E,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,QAAQ,CAAC,EAAE,uBAA8B;IACzC,QAAQ,CAAC,OAAO,uBAA8B;IAE9C,YAA6B,IAAI,EAAE,wBAAwB,EAAI;IAE/D,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,CAWvD;IAMD,OAAO,CAAC,YAAY;YAYN,QAAQ;IAkBhB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA0DxF;CACF"}
@@ -1,48 +0,0 @@
1
- import type { KnowledgeRecord, KnowledgeScope, KnowledgeScopeLevel, KnowledgeStorage } from '@mastra/core/storage';
2
- import type { ToolAction } from '@mastra/core/tools';
3
- import type { KnowledgeStoreMemory } from './knowledge-tools.js';
4
- /** Processor id and state-signal id for the pinned-knowledge lane. */
5
- export declare const SUBCONSCIOUS_PINS_STATE_ID = "subconscious-pins";
6
- /** Snapshot tag the model sees; the delta tag appends `-update`. */
7
- export declare const PINNED_SNAPSHOT_TAG = "pinned-knowledge";
8
- export declare const PINNED_DELTA_TAG = "pinned-knowledge-update";
9
- /** Reserved node holding the pin set. One record, at one fixed scope level. */
10
- export declare const PINNED_NODE_NAME = "pinned";
11
- export declare const PINNED_NODE_KIND = "system";
12
- export declare const PINNED_NODE_SCOPE_LEVEL: KnowledgeScopeLevel;
13
- /** Budget defaults. A pin costs context every turn, so both bounds are enforced in the tool. */
14
- export declare const DEFAULT_MAX_PINS = 20;
15
- export declare const DEFAULT_PINNED_MAX_CHARACTERS = 2000;
16
- export declare const MAX_PINNED_MAX_CHARACTERS = 8000;
17
- export interface PinnedKnowledgeSet {
18
- nodeId?: string;
19
- pins: KnowledgeRecord[];
20
- }
21
- type PinnedMemory = KnowledgeStoreMemory;
22
- export interface PinnedToolsOptions {
23
- /** Full visible scope context for the conversation (org + resource + thread entries). */
24
- scope: KnowledgeScope;
25
- sourceThreadId: string;
26
- defaultScope: KnowledgeScopeLevel;
27
- maxPins: number;
28
- maxCharacters: number;
29
- }
30
- /**
31
- * Assembles the current pin set.
32
- *
33
- * Reads use the FULL visible scope context, never a level-narrowed write scope: visibility is
34
- * subset containment, so querying at the node's level would drop pins written at narrower
35
- * levels. Deleted records are excluded explicitly.
36
- */
37
- export declare function listPinnedKnowledge(input: {
38
- store: KnowledgeStorage;
39
- scope: KnowledgeScope;
40
- }): Promise<PinnedKnowledgeSet>;
41
- /**
42
- * Pin lifecycle tools. Pin appends a record on the reserved node; unpin soft-deletes it
43
- * (auditable, restorable); edit is remove plus append because knowledge records are immutable,
44
- * so an edited pin carries a new record id.
45
- */
46
- export declare function createPinnedTools(memory: PinnedMemory, options: PinnedToolsOptions): Record<string, ToolAction<any, any, any>>;
47
- export {};
48
- //# sourceMappingURL=pinned.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinned.d.ts","sourceRoot":"","sources":["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iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAmF3C"}
@@ -1,22 +0,0 @@
1
- import { Agent } from '@mastra/core/agent';
2
- import type { ProcessorContext } from '@mastra/core/processors';
3
- import type { KnowledgeScope } from '@mastra/core/storage';
4
- import type { ToolAction } from '@mastra/core/tools';
5
- import type { Memory } from '../../../index.js';
6
- import type { SubconsciousModel } from './types.js';
7
- type SendSignal = NonNullable<ProcessorContext['sendSignal']>;
8
- export declare function createReminderAgent(options: {
9
- model: SubconsciousModel;
10
- memory: Memory;
11
- scope: KnowledgeScope;
12
- threadId: string;
13
- resourceId: string;
14
- parentThreadId: string;
15
- parentAgent?: ProcessorContext['agent'];
16
- fallbackSendSignal: SendSignal;
17
- additionalTools?: Record<string, ToolAction<any, any, any>>;
18
- instructions?: string;
19
- maxSteps?: number;
20
- }): Agent<string, import("@mastra/core/agent").ToolsInput, undefined, any, import("@mastra/core/agent").AgentEditorConfig | undefined>;
21
- export {};
22
- //# sourceMappingURL=remind-agent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remind-agent.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/remind-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQjD,KAAK,UAAU,GAAG,WAAW,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;AAqF9D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC,kBAAkB,EAAE,UAAU,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,sIA4HA"}
@@ -1,21 +0,0 @@
1
- import type { Agent, MastraDBMessage } from '@mastra/core/agent';
2
- import type { ProcessOutputResultArgs, ProcessOutputStepArgs, Processor } from '@mastra/core/processors';
3
- export declare class RemindContinuationProcessor implements Processor<'remind-continuation'> {
4
- private readonly options;
5
- readonly id = "remind-continuation";
6
- readonly name = "Reminder Continuation Processor";
7
- private readonly deliveredTerminalReplies;
8
- constructor(options: {
9
- threadId: string;
10
- resourceId: string;
11
- parentThreadId: string;
12
- parentAgent: Agent;
13
- maxSteps: number;
14
- getReminderAgent(): Agent;
15
- });
16
- processOutputStep(args: ProcessOutputStepArgs): Promise<MastraDBMessage[]>;
17
- processOutputResult(args: ProcessOutputResultArgs): Promise<MastraDBMessage[]>;
18
- private dispatchContinuation;
19
- private deliverUnableToAnswer;
20
- }
21
- //# sourceMappingURL=remind-continuation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remind-continuation.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/remind-continuation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,EAEV,MAAM,yBAAyB,CAAC;AAgGjC,qBAAa,2BAA4B,YAAW,SAAS,CAAC,qBAAqB,CAAC;IAMhF,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL1B,QAAQ,CAAC,EAAE,yBAAyB;IACpC,QAAQ,CAAC,IAAI,qCAAqC;IAClD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAqB;IAE9D,YACmB,OAAO,EAAE;QACxB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,KAAK,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,IAAI,KAAK,CAAC;KAC3B,EACC;IAEE,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAiC/E;IAEK,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA4BnF;YAEa,oBAAoB;YAgCpB,qBAAqB;CA4DpC"}
@@ -1,28 +0,0 @@
1
- import type { MastraDBMessage } from '@mastra/core/agent';
2
- import type { StorageThreadType } from '@mastra/core/memory';
3
- import type { Memory } from '../../../index.js';
4
- export declare const REMIND_PARENT_THREAD_METADATA_KEY = "subconsciousRemindParentThreadId";
5
- export declare const REMIND_MESSAGE_METADATA_KEY = "subconsciousRemind";
6
- export type RemindMessageMetadata = {
7
- type: 'passive-check';
8
- eventId: string;
9
- candidateIds: string[];
10
- } | {
11
- type: 'question';
12
- replyId: string;
13
- askedAt: number;
14
- } | {
15
- type: 'continuation';
16
- replyIds: string[];
17
- attempt: number;
18
- };
19
- export declare function getRemindThreadId(parentThreadId: string): string;
20
- export declare function isOwnedRemindThread(thread: StorageThreadType | null | undefined, parentThreadId: string, resourceId: string): thread is StorageThreadType;
21
- export declare function ensureOwnedRemindThread(options: {
22
- memory: Memory;
23
- parentThreadId: string;
24
- resourceId: string;
25
- }): Promise<StorageThreadType>;
26
- export declare function getRemindMessageMetadata(message: MastraDBMessage): RemindMessageMetadata | undefined;
27
- export declare function getRemindMessageText(message: MastraDBMessage): string;
28
- //# sourceMappingURL=remind-protocol.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remind-protocol.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/remind-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,iCAAiC,qCAAqC,CAAC;AACpF,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAC7B;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,GACD;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,GACjB,MAAM,IAAI,iBAAiB,CAE7B;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqB7B;AA8BD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,eAAe,GAAG,qBAAqB,GAAG,SAAS,CAGpG;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAKrE"}
@@ -1,27 +0,0 @@
1
- import type { Agent } from '@mastra/core/agent';
2
- import type { ToolAction } from '@mastra/core/tools';
3
- import type { Memory } from '../../../index.js';
4
- import type { ObservationalMemoryModel } from '../types.js';
5
- import type { ResolvedSubconsciousAgent } from './types.js';
6
- export type AskMemoryResult = {
7
- accepted: true;
8
- replyId: string;
9
- status: 'pending';
10
- } | {
11
- accepted: false;
12
- replyId?: string;
13
- status: 'rejected';
14
- error: string;
15
- };
16
- export declare function createAskMemoryTool(options: {
17
- memory: Memory;
18
- config: ResolvedSubconsciousAgent;
19
- omModel?: ObservationalMemoryModel;
20
- getParentAgent(agentId: string): Agent | undefined;
21
- }): ToolAction<any, any, any>;
22
- export declare function createReplyToMemoryQuestionTool(options: {
23
- parentAgent: Agent;
24
- parentThreadId: string;
25
- resourceId: string;
26
- }): ToolAction<any, any, any>;
27
- //# sourceMappingURL=remind-questions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remind-questions.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/remind-questions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAWzD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAezD,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,GACtD;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAyG7E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,yBAAyB,CAAC;IAClC,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;CACpD,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CA4G5B;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE;IACvD,WAAW,EAAE,KAAK,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAmF5B"}
@@ -1,7 +0,0 @@
1
- import { Extractor } from '../extractor.js';
2
- import type { ObservationalMemoryModel } from '../types.js';
3
- import type { ResolvedSubconsciousAgent } from './types.js';
4
- export declare class SubconsciousRemindExtractor extends Extractor<string> {
5
- constructor(config: ResolvedSubconsciousAgent, omModel?: ObservationalMemoryModel);
6
- }
7
- //# sourceMappingURL=remind.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remind.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/remind.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAOzD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAsFzD,qBAAa,2BAA4B,SAAQ,SAAS,CAAC,MAAM,CAAC;IAChE,YAAY,MAAM,EAAE,yBAAyB,EAAE,OAAO,CAAC,EAAE,wBAAwB,EA+GhF;CACF"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Resolves the resource rung of a subconscious knowledge scope.
3
- *
4
- * When the request context carries a `knowledgeResourceId` override, every
5
- * scope resolver anchors the resource rung on it instead of the run's
6
- * resourceId. This lets a host (for example, the factory) share one knowledge
7
- * graph across many runs of the same project while leaving thread identity and
8
- * observational memory untouched. Without the override, behavior is unchanged:
9
- * the fallback (the run's resourceId) is used as-is.
10
- */
11
- export declare function resolveKnowledgeResourceId(requestContext: {
12
- get?(key: string): unknown;
13
- } | undefined, fallback: string | undefined): string | undefined;
14
- //# sourceMappingURL=scope.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../../src/processors/observational-memory/subconscious/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE;IAAE,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,GAAG,SAAS,EAC1D,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAIpB"}
@@ -1,20 +0,0 @@
1
- import type { KnowledgeScope, KnowledgeStorage } from '@mastra/core/storage';
2
- import type { MastraEmbeddingModel, MastraEmbeddingOptions, MastraVector } from '@mastra/core/vector';
3
- export declare class StaleKnowledgeSemanticIndexError extends Error {
4
- constructor(message: string, options?: ErrorOptions);
5
- }
6
- export interface KnowledgeSemanticIndexCoordinatorConfig {
7
- knowledge: KnowledgeStorage;
8
- vector: MastraVector;
9
- embedder: MastraEmbeddingModel<string>;
10
- embedderOptions?: MastraEmbeddingOptions;
11
- workerId?: string;
12
- batchSize?: number;
13
- }
14
- export declare class KnowledgeSemanticIndexCoordinator {
15
- #private;
16
- constructor(config: KnowledgeSemanticIndexCoordinatorConfig);
17
- drain(scope?: KnowledgeScope): Promise<number>;
18
- search(query: string, scope: KnowledgeScope, limit?: number): Promise<import("@mastra/core/vector").QueryResult[]>;
19
- }
20
- //# sourceMappingURL=semantic-index.d.ts.map
@@ -1 +0,0 @@
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;AAO9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKtG,qBAAa,gCAAiC,SAAQ,KAAK;IACzD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGlD;CACF;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;;IAS5C,YAAY,MAAM,EAAE,uCAAuC,EAO1D;IAEK,KAAK,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CASnD;IAEK,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,SAAK,wDAuC5D;CAgJF"}
@@ -1,65 +0,0 @@
1
- import type { AgentConfig } from '@mastra/core/agent';
2
- import type { KnowledgeScopeLevel } from '@mastra/core/storage';
3
- import type { z } from 'zod';
4
- import type { ExtractorOnExtractedContext } from '../extractor.js';
5
- export type SubconsciousBuiltInObservationAgent = 'remind' | 'curate';
6
- export type SubconsciousModel = Exclude<AgentConfig['model'], undefined>;
7
- export interface SubconsciousRemindConfig {
8
- name: 'remind';
9
- instructions?: string;
10
- model?: SubconsciousModel;
11
- maxSteps?: number;
12
- }
13
- export interface SubconsciousCurateConfig {
14
- name: 'curate';
15
- instructions?: string;
16
- model?: SubconsciousModel;
17
- maxSteps?: number;
18
- }
19
- export type SubconsciousBuiltInObservationConfig = SubconsciousRemindConfig | SubconsciousCurateConfig;
20
- export interface SubconsciousCustomObservationConfig<T = unknown> {
21
- name: string;
22
- instructions?: string;
23
- schema: z.ZodType<T>;
24
- onExtracted: (context: ExtractorOnExtractedContext<T>) => Promise<T | void | undefined> | T | void | undefined;
25
- }
26
- export type SubconsciousObservationEntry = SubconsciousBuiltInObservationAgent | SubconsciousBuiltInObservationConfig | SubconsciousCustomObservationConfig;
27
- /** @experimental This API may change without notice. */
28
- export interface SubconsciousConfig {
29
- observation?: SubconsciousObservationEntry[];
30
- model?: SubconsciousModel;
31
- defaultScope?: KnowledgeScopeLevel;
32
- tools?: boolean;
33
- activity?: false | {
34
- recentUpdates?: number;
35
- };
36
- /**
37
- * Opt in to a curator-maintained pinned knowledge page that is delivered on every turn.
38
- * Off by default: the cost of a pin is per turn and permanent.
39
- */
40
- pins?: boolean | {
41
- maxPins?: number;
42
- maxCharacters?: number;
43
- };
44
- maxSteps?: number;
45
- }
46
- export interface ResolvedSubconsciousAgent {
47
- name: string;
48
- instructions?: string;
49
- model?: SubconsciousModel;
50
- maxSteps?: number;
51
- builtIn: boolean;
52
- }
53
- export interface ResolvedSubconsciousConfig {
54
- observation: ResolvedSubconsciousAgent[];
55
- defaultScope: KnowledgeScopeLevel;
56
- tools: boolean;
57
- activity: false | {
58
- recentUpdates: number;
59
- };
60
- pins: false | {
61
- maxPins: number;
62
- maxCharacters: number;
63
- };
64
- }
65
- //# sourceMappingURL=types.d.ts.map