Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions experiments/smartwindow/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,7 @@ async function collectSmartWindowData({ notes = "", bugzillaUrls = [], tags = []
title: tab.label ?? null,
isActiveTab: tab.selected,
lastAccessed: tab.lastAccessed,
groupId: tab.group?.id ?? null,
}));

// Gather all stored SmartWindow memories
Expand Down Expand Up @@ -2063,6 +2064,7 @@ async function collectSmartWindowData({ notes = "", bugzillaUrls = [], tags = []
// Context for the browser like tabs, SmartWindow memories, and browsing history if the user specified at least a startDate
browserContext: {
tabs,
tabGroups: getTabGroups(),
memories,
browsingHistory: {
datetimeRange: { start: startDate, end: endDate },
Expand Down Expand Up @@ -2647,6 +2649,22 @@ function getOpenTabs() {
}));
}

// Snapshot of the active window's tab group definitions. Tab -> group
// membership lives on browserContext.tabs[].groupId (null = ungrouped, so don't
// collapse those into one cluster when evaluating). Unnamed groups have title "".
function getTabGroups() {
const win = windowMediator.getMostRecentWindow("navigator:browser");
if (!win?.gBrowser) {
return [];
}
return Array.from(win.gBrowser.tabGroups).map(group => ({
id: group.id,
title: group.label ?? "",
color: group.color,
collapsed: group.collapsed,
}));
}

/**
* Get the compacted SmartWindow conversation messages with auto-injected
* system/user messages (system prompt, real-time-context, relevant-memories)
Expand Down