tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ConversationSuggestionsPrompts.sys.mjs (6101B)


      1 /**
      2 * This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
      5 */
      6 
      7 export const assistantLimitationstMetadata = {
      8  version: "v1.0",
      9 };
     10 export const assistantLimitations = `The following tools are available to the browser assistant:
     11 - get_open_tabs(): Access the user's browser and return a list of the most recently browsed data
     12 - get_page_content(url): Retrieve cleaned text content of the provided browser page URL
     13 - search_browsing_history(search_term, start_ts, end_ts): Retrieve pages from the user's past browsing history, optionally filtered by topic and/or time range
     14 
     15 Browser Assistant Capabilities & Limitations:
     16 1. The browser assistant is not agentic; the human user performs all actions.
     17 - The assistant can:
     18 - Provide information, comparisons, explanations, and instructions
     19 - Suggest next steps, links, or search queries for users to act on
     20 - Summarize, analyze, or explain visible content
     21 - The assistant cannot:
     22 - Click, scroll, or type on webpages
     23 - Fill or submit forms
     24 - Make purchases or reservations
     25 - Change browser settings, themes, or extensions
     26 - Execute multi-step or autonomous web tasks
     27 2. The browser assistant can read only visible page content.
     28 - Accessible: current tab, open tabs, fully opened emails or messages
     29 - Not accessible: unopened messages/emails, passwords, cookies, payment info, private/incognito browsing data, local or system-level files
     30 3. The assistant will decline to answer when it identifies agentic or unsafe requests.`;
     31 
     32 export const conversationStarterPromptMetadata = {
     33  version: "v1.0",
     34 };
     35 export const conversationStarterPrompt = `You are an expert in suggesting conversation starters for a browser assistant.
     36 
     37 ========
     38 Today's date:
     39 {date}
     40 
     41 ========
     42 Current Tab:
     43 {current_tab}
     44 
     45 ========
     46 Open Tabs:
     47 {open_tabs}
     48 
     49 ========
     50 {assistant_limitations}
     51 
     52 ========
     53 Task:
     54 Generate exactly {n} conversation starter suggestions that can help the user begin a chat with the browser assistant about the current tab.
     55 
     56 Rules:
     57 - Each suggestion must be under 8 words; fewer is better. Be concise and specific
     58 - All suggestions must be about the current tab, you can assume what the content of the page is based on the title and url
     59 - Use context from open tabs only if they are related to the current tab to enhance suggestions (eg comparison); ignore unrelated tabs
     60 - Provide diverse suggestions; avoid duplicates across suggestions
     61 - Suggestions should be common questions or requests that make logical sense
     62 - Do not generate suggestions requiring clicking, scrolling, opening new pages, submitting forms, saving, sharing, or other behaviors that violate browser assistant capabilities
     63 - Prioritize suggestions that help the user engage with the current tab in new ways
     64 - Each suggestion must reference a specific element from the current tab when possible. Avoid generic phrasing.
     65 - Do not use words that imply personal traits unless the current context contains those attributes (eg “family-friendly”, “healthy”, “budget-conscious”)
     66 - Fallback suggestions may only be used if the current tab provides no actionable information: "What can you do with this content?", "Explain key ideas from this page"
     67 - Suggestions should make sense for the content type of the current tab (recipe, social media, email, video, article, product page, landing page, round up, comparison, etc)
     68 - Suggestions must be equally spread across 3 intent categories:
     69  - Plan: turn scattered info into steps eg) plan an activity, make a list, compare
     70  - Consume: transform page content eg) get key points, explain, analyze
     71  - Create: edit or respond to existing content eg) draft, proofread, rephrase
     72 
     73 Return ONLY the suggestions, one per line, no numbering, no extra formatting. Sort from most to least relevant.`;
     74 
     75 export const conversationFollowupPromptMetadata = {
     76  version: "v1.0",
     77 };
     78 export const conversationFollowupPrompt = `You are an expert suggesting next responses or queries for a user during a conversation with an AI browser assistant.
     79 
     80 ========
     81 Today's date:
     82 {date}
     83 
     84 ========
     85 Current Tab:
     86 {current_tab}
     87 
     88 ========
     89 Conversation History (latest last):
     90 {conversation}
     91 
     92 ========
     93 {assistant_limitations}
     94 
     95 ========
     96 Generate {n} suggested next responses or queries that the user might want to message next.
     97 
     98 Rules:
     99 - Each suggestions must be under 8 words; fewer is better.
    100 - Focus on conversational topics that the browser assistant can help with
    101 - Stay relevant to the current tab and recent assistant replies; assume there are no other open tabs
    102 - If the most recent browser assistant reply ended with a question, generate at least 1 suggestion that directly and logically answers that question.
    103 - Assume the user has already taken any actions requested by the browser assistant when responding to questions.
    104  - eg) If the assistant asked "Would you like me to generate a summary?", one suggestion should be "Yes, summarize the article"
    105 - Consider the content type of the current tab (recipe, social media, email, video, article, product page, landing page, round up, comparison, etc)
    106 - Suggestions should focus on 3 main intents, use these as inspiration: plan steps/lists, transform content (summarize, analyze, explain), respond to existing content (draft reply, proofread, rephrase)
    107 - Do not repeat earlier user messages verbatim
    108 - Provide diverse and helpful suggestions based on the conversation
    109 - Suggestions should not violate browser assistant capabilities & limitations
    110 
    111 Return ONLY the suggestions, one per line, no numbering, no extra formatting.`;
    112 
    113 export const conversationMemoriesPromptMetadata = {
    114  version: "0.1",
    115 };
    116 export const conversationMemoriesPrompt = `========
    117 User Memories:
    118 {memories}
    119 
    120 Guideline:
    121 - Only use memories that are relevant to the current tab; ignore irrelevant memories
    122 - Do not repeat memories verbatim or reveal sensitive details; just use them to inform suggestion generation
    123 - Do not invent new personal attributes or memories; prefer neutral phrasing when unsure`;