| Memories.sys.mjs |
This module defines functions to generate, deduplicate, and filter memories.
The primary method in this module is `generateMemories`, which orchestrates the entire pipeline:
1. Generates initial memories from a specified user data user
2. Filters out low-quality (generic/ephemeral) AND sensitive memories
3. Deduplicates the newly generated memories against all existing memories
4. Returns the final list of memories objects
`generateMemories` requires 3 arguments:
1. `engine`: an instance of `openAIEngine` to call the LLM API
2. `sources`: an object mapping user data source types to aggregated records (i.e., {history: [domainItems, titleItems, searchItems]})
3. `existingMemoriesList`: an array of existing memory summary strings to deduplicate against
Example Usage:
const ctx = await loadCallContext(MODEL_FEATURES.MEMORIES_INITIAL_GENERATION_SYSTEM);
const engine = await openAIEngine.build({ model: ctx.model, serviceType: ctx.serviceType, purpose: ctx.purpose, flowId: null, feature: MODEL_FEATURES.MEMORIES_INITIAL_GENERATION_SYSTEM });
const sources = {history: [domainItems, titleItems, searchItems]};
const existingMemoriesList = [...]; // Array of existing memory summary strings; this should be fetched from memory storage
const newMemories = await generateMemories(engine, sources, existingMemoriesList);
|
15871 |
- |
| MemoriesChatSource.sys.mjs |
This module handles the user message extraction from chat store
|
4430 |
- |
| MemoriesConstants.sys.mjs |
Memory categories
|
3320 |
- |
| MemoriesConversationScheduler.sys.mjs |
Schedules periodic generation of conversation-based memories.
Triggers memories generation when number of user messages exceeds the configured threshold ({@link MEMORIES_SCHEDULER_MESSAGES_THRESHOLD})
E.g. Usage: MemoriesConversationScheduler.maybeInit()
|
6633 |
- |
| MemoriesDriftDetector.sys.mjs |
@typedef {object} SessionMetric
@property {string|number} sessionId Unique identifier for the session
@property {number} jsScore Jensen–Shannon divergence for the session
@property {number} avgSurprisal Average surprisal for the session
@property {number} [timestampMs] Optional timestamp for debugging
|
13079 |
- |
| MemoriesHistoryScheduler.sys.mjs |
Schedules periodic generation of browsing history based memories.
This decides based on the #pagesVisited and periodically evaluates history drift metrics.
Triggers memories generation when drift exceeds a configured threshold.
E.g. Usage: MemoriesHistoryScheduler.maybeInit()
|
11479 |
- |
| MemoriesHistorySource.sys.mjs |
This module handles the visit extraction data from browsing history
|
28607 |
- |
| MemoriesManager.sys.mjs |
MemoriesManager class
|
29287 |
- |
| MemoriesSchedulers.sys.mjs |
/
export class MemoriesSchedulers {
/**
Entry point to be called when an AI window becomes active.
Starts (or reuses) schedulers. Each scheduler will still enforce its own cooldown.
Usage: MemoriesSchedulers.maybeRunAndSchedule()
|
1703 |
- |
| MemoriesSchemas.sys.mjs |
JSON Schema for initial memories generation
|
3615 |
- |
| MemoriesSessions.sys.mjs |
Cross-source sessionization for memory generation.
`buildSessions` merges history visits, searches, and chat messages into a
single timestamped event stream and groups them into sessions by gap and
maximum session length. A downstream LLM step processes one session at a
time, so the model sees browsing context and chat context that occurred
together in time as one bundle.
Source IDs are tracked separately by sources (`history_source_ids` for
`url_hash` values, `conversation_source_ids` for `convId` values) so a
revocation hook can match the right kind of ID when the user deletes
history or a conversation.
This function is pure: it does not read prefs. Callers gate via
`MemoriesManager.shouldEnableMemoriesFromSchedulers` and pass `[]` for
any disabled source:
- both enabled → cross-source sessions
- history only → history-only sessions
- chat only → chat-only sessions, time-bucketed by message timestamp
- neither → caller short-circuits before calling
|
6199 |
- |
| moz.build |
|
713 |
- |
| SensitiveInfoDetector.sys.mjs |
Detects and filters sensitive personal information from text
Detects:
- Government IDs (SSN, SIN)
- Financual information (credit cards, bank accounts, routing numbers)
- Contact information (email, phone number)
- Network Identifiers (IP addresses, MAC addresses)
- Physical addresses
|
8132 |
- |