Name Description Size Coverage
Chat.sys.mjs @import { ChatConversation } from "moz-src:///browser/components/aiwindow/ui/modules/ChatConversation.sys.mjs" 17491 -
ChatUtils.sys.mjs Truncates and spotlights untrusted metadata text to guard against prompt injection by adding an (Untrusted webpage data) tag. Important! Changing this function requires a security review. Metadata such as page titles and page descriptions are untrusted content from the web and could contain prompt injections to try and change the behavior of language model conversations. Typically untrusted content gets flagged in a conversation, and subsequent tool calls can be restricted if they have access to private information as well. By truncating the length of this text, we limit (but do not remove) the ability for these pieces of text to be used as prompt injections. In this case we have chosen to relax the security flags to NOT mark these as untrusted when the text is truncated. This is useful since page titles are used very frequently in chat conversations. In addition, spotlighting this text helps the model to identify webpage data is untrusted. We note that the spotlighting tokens added are are only a part of the delimiting. Prompts have also been updated to include instructions about how to treat untrusted data. @param {string} text @param {boolean} truncateOnly @returns {string} 9581 -
CitationParser.sys.mjs Extract link destination from text starting at given position. Handles balanced parentheses and stops at optional title. @param {string} text - Text to parse @param {number} start - Position to start parsing from @returns {string} Extracted URL 4109 -
ConversationSuggestions.sys.mjs Helper to trim conversation history to recent messages, dropping empty messages, tool calls and responses @param {Array} messages - Array of chat messages @param {number} maxMessages - Max number of messages to keep (default 15) @returns {Array} Trimmed array of user/assistant messages 12041 -
IntentClassifier.sys.mjs Intent Classifier Engine 5404 -
memories -
moz.build 868 -
PromptOptimizer.sys.mjs =================================================================== ARCHITECTURE ROADMAP: The Compaction Waterfall =================================================================== This module prevents LLM context window collapse and reduces TTFT (Time-To-First-Token) latency by deterministically compacting massive background tool payloads before they are dispatched to the API. * Planned Stages: - Stage 1 (Active): ID-Based Upsert. Deduplicates repetitive get_page_content reads. - Stage 2 (Planned): Proportional Bottom-Up Shave. Truncates old page content/Search payloads. - Stage 3 (Planned): Copy-Paste Tax. Truncates massive old user queries. - Stage 4 (Planned): LRU Eviction. Drops oldest conversation turns as a failsafe. =================================================================== 5105 -
SearchBrowsingHistory.sys.mjs Convert ISO timestamp string to microseconds (moz_places format). @param {string|null} iso @returns {number|null} 13127 -
SearchBrowsingHistoryDomainBoost.sys.mjs SearchBrowsingHistoryDomainBoost Temporary heuristic for general-category queries (games, movies, news, etc.) when semantic embeddings over title/description are insufficient. Safe to remove once richer embeddings or better intent classification lands. 8827 -
SecurityProperties.sys.mjs Sticky security-flag container. A flag that has been set to `true` can never be cleared back to `false`, preventing a later tool call from accidentally downgrading a flag raised by an earlier one. Flags are written to a staging area and only become visible after `commit()` is called. This ensures that parallel tool calls requested in the same conversation turn all see the same committed flags. 2803 -
tests -
TitleGeneration.sys.mjs Generate a default title from the first four words of a message. @param {string} message - The user's message @returns {string} The default title 2955 -
Tools.sys.mjs This file contains LLM tool abstractions and tool definitions. 27910 -
Utils.sys.mjs This module defines utility functions and classes needed for invoking LLMs such as: - Creating and running OpenAI engine instances - Rendering prompts from files 28122 -