Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(activity): share AI picker and restore Today range (#6445)

Louis Beaumontfbfe591f2553
diff --git a/COVERAGE.md b/COVERAGE.md
index 52380e181..49a64b4cb 100644
--- a/COVERAGE.md
+++ b/COVERAGE.md
@@ -19,14 +19,14 @@ results and `cargo llvm-cov` data on top when judging release confidence.
### Tauri E2E
- Mapped specs: 117
-- Declared test blocks: 336
-- Weighted coverage points: 263.3
+- Declared test blocks: 337
+- Weighted coverage points: 263.7
| Platform | Specs | Declared tests | Weighted points | Layers | Features | Critical score |
| --- | --- | --- | --- | --- | --- | --- |
-| windows | 89 | 290 | 237.3 | 15 | 94 | 92% |
-| macos | 113 | 299 | 234.1 | 17 | 100 | 90% |
-| linux | 79 | 250 | 208.0 | 14 | 90 | 88% |
+| windows | 89 | 291 | 237.8 | 15 | 94 | 92% |
+| macos | 113 | 300 | 234.5 | 17 | 100 | 90% |
+| linux | 79 | 251 | 208.5 | 14 | 90 | 88% |
### Core Engine
diff --git a/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx b/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx
index 3f6bd0660..5dfe7850a 100644
--- a/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx
+++ b/apps/screenpipe-app-tauri/components/activity-ledger.test.tsx
@@ -86,6 +86,43 @@ vi.mock("@/lib/hooks/use-timeline-store", () => ({
useTimelineStore: (selector: (state: unknown) => unknown) =>
selector({ setPendingNavigation: mocks.setPendingNavigation }),
}));
+vi.mock("@/components/rewind/ai-presets-selector", async () => {
+ const React = await import("react");
+ return {
+ AIPresetsSelector: ({
+ controlledPresetId,
+ onControlledSelect,
+ triggerAriaLabel,
+ }: {
+ controlledPresetId: string | null;
+ onControlledSelect: (
+ preset: (typeof mocks.settings.aiPresets)[number],
+ ) => void;
+ triggerAriaLabel?: string;
+ }) =>
+ React.createElement(
+ "select",
+ {
+ "aria-label": triggerAriaLabel,
+ "data-testid": "shared-ai-preset-selector",
+ value: controlledPresetId ?? "",
+ onChange: (event: React.ChangeEvent<HTMLSelectElement>) => {
+ const preset = mocks.settings.aiPresets.find(
+ (candidate) => candidate.id === event.target.value,
+ );
+ if (preset) onControlledSelect(preset);
+ },
+ },
+ mocks.settings.aiPresets.map((preset) =>
+ React.createElement(
+ "option",
+ { key: preset.id, value: preset.id },
+ preset.model,
+ ),
+ ),
+ ),
+ };
+});
import {
ActivityLedger,
@@ -625,8 +662,9 @@ describe("ActivityLedger", () => {
const generate = await screen.findByRole("button", {
name: "Generate activities",
});
+ expect(screen.getByTestId("shared-ai-preset-selector")).toBeVisible();
expect(screen.getByLabelText("AI preset")).toHaveTextContent(
- "chat · gpt-5.6-terra",
+ "gpt-5.6-terra",
);
expect(mocks.runDailySummaryWithPi).not.toHaveBeenCalled();
@@ -647,7 +685,11 @@ describe("ActivityLedger", () => {
await screen.findByRole("button", { name: "Generate activities" });
expect(screen.queryByRole("heading", { name: "Activity" })).toBeNull();
- expect(screen.getByLabelText("Time range")).toBeVisible();
+ const timeRange = screen.getByRole("combobox", {
+ name: "Time range: Today",
+ });
+ expect(timeRange).toBeVisible();
+ expect(timeRange).toHaveTextContent("Today");
expect(screen.getByLabelText("AI preset")).toBeVisible();
});
@@ -655,7 +697,9 @@ describe("ActivityLedger", () => {
render(<ActivityLedger />);
await screen.findByRole("button", { name: "Generate activities" });
- fireEvent.click(screen.getByLabelText("Time range"));
+ fireEvent.click(
+ screen.getByRole("combobox", { name: "Time range: Today" }),
+ );
fireEvent.click(
await screen.findByRole("option", { name: "Custom range" }),
);
@@ -668,6 +712,45 @@ describe("ActivityLedger", () => {
).toHaveAttribute("aria-haspopup", "dialog");
});
+ it("returns from Custom range to Today", async () => {
+ render(<ActivityLedger />);
+
+ await screen.findByRole("button", { name: "Generate activities" });
+ fireEvent.click(
+ screen.getByRole("combobox", { name: "Time range: Today" }),
+ );
+ fireEvent.click(
+ await screen.findByRole("option", { name: "Custom range" }),
+ );
+ fireEvent.click(
+ screen.getByRole("button", { name: "Choose custom date range" }),
+ );
+
+ expect(
+ screen.getByRole("button", { name: "Choose custom date range" }),
+ ).toHaveAttribute("aria-expanded", "true");
+ fireEvent.click(
+ screen.getByRole("gridcell", { name: "16", exact: true }),
+ );
+ await waitFor(() =>
+ expect(
+ screen.getByRole("button", { name: "Choose custom date range" }),
+ ).toHaveAttribute("aria-expanded", "false"),
+ );
+
+ fireEvent.click(
+ screen.getByRole("combobox", { name: "Time range: Custom range" }),
+ );
+ fireEvent.click(await screen.findByRole("option", { name: "Today" }));
+
+ expect(
+ screen.getByRole("combobox", { name: "Time range: Today" }),
+ ).toBeVisible();
+ expect(
+ screen.queryByRole("button", { name: "Choose custom date range" }),
+ ).toBeNull();
+ });
+
it("generates through click time when capture starts after Activity opens", async () => {
let summaryCalls = 0;
mocks.localFetch.mockImplementation((path: string) =>
@@ -746,12 +829,9 @@ describe("ActivityLedger", () => {
render(<ActivityLedger />);
await screen.findByText("Fixed a capture reliability regression");
- fireEvent.click(screen.getByLabelText("AI preset"));
- fireEvent.click(
- await screen.findByRole("option", {
- name: "pipes · claude-sonnet-5",
- }),
- );
+ fireEvent.change(screen.getByLabelText("AI preset"), {
+ target: { value: "pipes" },
+ });
const refresh = screen.getByRole("button", { name: "Refresh history" });
await waitFor(() => expect(refresh).toBeEnabled());
fireEvent.click(refresh);
@@ -1177,7 +1257,9 @@ describe("ActivityLedger", () => {
expect(
screen.getByRole("button", { name: "Refresh history" }),
).toBeVisible();
- expect(screen.getByLabelText("Time range")).toBeVisible();
+ expect(
+ screen.getByRole("combobox", { name: "Time range: Today" }),
+ ).toBeVisible();
});
it("opens app and transcript artifacts at their exact timeline moments", async () => {
diff --git a/apps/screenpipe-app-tauri/components/activity-ledger.tsx b/apps/screenpipe-app-tauri/components/activity-ledger.tsx
index 6a5ac4e02..6f6c0129b 100644
--- a/apps/screenpipe-app-tauri/components/activity-ledger.tsx
+++ b/apps/screenpipe-app-tauri/components/activity-ledger.tsx
@@ -17,6 +17,7 @@ import {
AppWindow,
AudioLines,
CalendarDays,
+ CalendarRange,
RefreshCw,
Users,
} from "lucide-react";
@@ -32,12 +33,12 @@ import {
} from "@/components/ui/popover";
import { Skeleton } from "@/components/ui/skeleton";
import { faviconUrl } from "@/components/settings/capture-filters/icon-urls";
+import { AIPresetsSelector } from "@/components/rewind/ai-presets-selector";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
- SelectValue,
} from "@/components/ui/select";
import {
ACTIVITY_REVIEW_AGENT_SYSTEM_PROMPT,
@@ -149,6 +150,13 @@ const RANGE_COPY: Record<RangePreset, string> = {
custom: "Custom range",
};
+const RANGE_SHORT_COPY: Record<RangePreset, string> = {
+ today: "Today",
+ "24h": "24h",
+ "7d": "7d",
+ custom: "Custom",
+};
+
function readStoredRangePreset(): RangePreset {
if (typeof window === "undefined") return "today";
const stored = window.localStorage.getItem(ACTIVITY_RANGE_STORAGE_KEY);
@@ -1302,6 +1310,7 @@ Re-query Screenpipe only inside the cited time range and use the cited frames an
value={preset}
onValueChange={(value) => {
const nextPreset = value as RangePreset;
+ setCustomCalendarOpen(false);
setPreset(nextPreset);
posthog.capture("activity_range_changed", {
range: nextPreset,
@@ -1309,11 +1318,13 @@ Re-query Screenpipe only inside the cited time range and use the cited frames an
}}
>
<SelectTrigger
- className="h-9 w-[150px] rounded-none text-xs"
+ className="h-9 w-auto min-w-0 shrink-0 justify-center gap-1.5 rounded-none px-2 text-xs [&>svg:last-child]:hidden"
data-testid="activity-range"
- aria-label="Time range"
+ aria-label={`Time range: ${RANGE_COPY[preset]}`}
+ title={`Time range: ${RANGE_COPY[preset]}`}
>
- <SelectValue />
+ <CalendarRange className="h-4 w-4" aria-hidden="true" />
+ <span aria-hidden="true">{RANGE_SHORT_COPY[preset]}</span>
</SelectTrigger>
<SelectContent>
{(
@@ -1325,24 +1336,30 @@ Re-query Screenpipe only inside the cited time range and use the cited frames an
))}
</SelectContent>
</Select>
- <Select
- value={reviewPreset.id}
- onValueChange={setSelectedReviewPresetId}
- >
- <SelectTrigger
- className="h-9 w-[190px] max-w-[36vw] text-xs"
+ {reviewPresets.length > 0 ? (
+ <AIPresetsSelector
+ compact
+ showModelOnly
+ includeAgentPresets={false}
+ triggerAriaLabel="AI preset"
+ containerClassName="w-[190px] max-w-[36vw] min-w-[132px] shrink-0 gap-0"
+ triggerClassName="h-9 rounded-none text-xs"
+ controlledPresetId={reviewPreset.id}
+ onControlledSelect={(nextPreset) => {
+ if (nextPreset) setSelectedReviewPresetId(nextPreset.id);
+ }}
+ />
+ ) : (
+ <Button
+ type="button"
+ variant="outline"
+ disabled
aria-label="AI preset"
+ className="h-9 w-[190px] max-w-[36vw] justify-start rounded-none text-xs"
>
- <SelectValue />
- </SelectTrigger>
- <SelectContent align="end">
- {selectableReviewPresets.map((candidate) => (
- <SelectItem key={candidate.id} value={candidate.id}>
- {candidate.id} · {candidate.model || "default"}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ {reviewPreset.model || "auto"}
+ </Button>
+ )}
<Button
variant="ghost"
size="icon"
@@ -1401,6 +1418,7 @@ Re-query Screenpipe only inside the cited time range and use the cited frames an
setCustomEnd(
toLocalInputValue(endOfSelectedDay(nextRange.to, now)),
);
+ setCustomCalendarOpen(false);
}}
defaultMonth={customDateRange?.from}
disabled={{ after: new Date() }}
diff --git a/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.test.tsx b/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.test.tsx
index 7e2668beb..9f027e475 100644
--- a/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.test.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.test.tsx
@@ -164,4 +164,18 @@ describe("AIPresetsSelector controlled preset creation", () => {
"/images/gemini.svg",
);
});
+
+ it("accepts a surface-specific accessible label", () => {
+ render(
+ <AIPresetsSelector
+ compact
+ showModelOnly
+ triggerAriaLabel="AI preset"
+ />,
+ );
+
+ expect(
+ screen.getByRole("combobox", { name: "AI preset" }),
+ ).toHaveTextContent("old-model");
+ });
});
diff --git a/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx b/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx
index b6d91e8b4..9465a81b8 100644
--- a/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/ai-presets-selector.tsx
@@ -1263,6 +1263,8 @@ interface AIPresetsSelectorProps {
containerClassName?: string;
/** Class applied to the trigger button. */
triggerClassName?: string;
+ /** Accessible label for surfaces where the visible model name needs context. */
+ triggerAriaLabel?: string;
/** For tight composer UIs, show the active model instead of preset details. */
showModelOnly?: boolean;
/** Notify parent surfaces when the preset popover opens or closes. */
@@ -1363,6 +1365,7 @@ export const AIPresetsSelector = ({
compact = false,
containerClassName,
triggerClassName,
+ triggerAriaLabel,
showModelOnly = false,
onOpenChange,
includeAgentPresets = true,
@@ -1768,6 +1771,7 @@ export const AIPresetsSelector = ({
type="button"
variant="outline"
role="combobox"
+ aria-label={triggerAriaLabel}
aria-expanded={open}
className={cn(
"w-full justify-between hover:bg-accent hover:text-accent-foreground",
diff --git a/apps/screenpipe-app-tauri/docs/assets/pr/activity-shared-ai-selector.png b/apps/screenpipe-app-tauri/docs/assets/pr/activity-shared-ai-selector.png
new file mode 100644
index 000000000..02662e89e
Binary files /dev/null and b/apps/screenpipe-app-tauri/docs/assets/pr/activity-shared-ai-selector.png differ
diff --git a/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-24h.png b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-24h.png
new file mode 100644
index 000000000..9759a5053
Binary files /dev/null and b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-24h.png differ
diff --git a/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-custom-open.png b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-custom-open.png
new file mode 100644
index 000000000..0aff141d0
Binary files /dev/null and b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-custom-open.png differ
diff --git a/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-custom-selected.png b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-custom-selected.png
new file mode 100644
index 000000000..def8f287b
Binary files /dev/null and b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-custom-selected.png differ
diff --git a/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-today.png b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-today.png
new file mode 100644
index 000000000..6df516ca8
Binary files /dev/null and b/apps/screenpipe-app-tauri/docs/assets/pr/activity-time-range-today.png differ
diff --git a/apps/screenpipe-app-tauri/e2e/COVERAGE.md b/apps/screenpipe-app-tauri/e2e/COVERAGE.md
index 0905f95bb..e30942882 100644
--- a/apps/screenpipe-app-tauri/e2e/COVERAGE.md
+++ b/apps/screenpipe-app-tauri/e2e/COVERAGE.md
@@ -7,8 +7,8 @@ and layer declared in the manifest, weighted by confidence and criticality.
- Manifest: `e2e/coverage-map.json`
- Specs directory: `e2e/specs`
- Mapped specs: 117
-- Declared test blocks: 336
-- Weighted coverage points: 263.3
+- Declared test blocks: 337
+- Weighted coverage points: 263.7
Confidence weights: strong=1.0, partial=0.7, conditional=0.4, smoke=0.3.
Criticality weights: high=1.0, medium=0.7, low=0.4.
@@ -19,9 +19,9 @@ can execute more runtime cases than this number shows.
| Platform | Specs | Declared tests | Weighted points | Layers | Features | Critical score |
| --- | --- | --- | --- | --- | --- | --- |
-| windows | 89 | 290 | 237.3 | 15 | 94 | 92% |
-| macos | 113 | 299 | 234.1 | 17 | 100 | 90% |
-| linux | 79 | 250 | 208.0 | 14 | 90 | 88% |
+| windows | 89 | 291 | 237.8 | 15 | 94 | 92% |
+| macos | 113 | 300 | 234.5 | 17 | 100 | 90% |
+| linux | 79 | 251 | 208.5 | 14 | 90 | 88% |
## Runtime Results
@@ -37,7 +37,7 @@ pass/fail/skip counts.
| auth | - | 1 specs / 1 tests / 1.0 pts | - |
| billing | 4 specs / 6 tests / 5.7 pts | 4 specs / 6 tests / 5.7 pts | 4 specs / 6 tests / 5.7 pts |
| capture-ocr | 2 specs / 16 tests / 6.4 pts | 8 specs / 12 tests / 4.8 pts | 1 specs / 3 tests / 1.2 pts |
-| chat-ai | 25 specs / 52 tests / 38.6 pts | 37 specs / 74 tests / 52.7 pts | 24 specs / 51 tests / 38.1 pts |
+| chat-ai | 25 specs / 53 tests / 39.1 pts | 37 specs / 75 tests / 53.2 pts | 24 specs / 52 tests / 38.6 pts |
| entitlement | - | 1 specs / 1 tests / 1.0 pts | - |
| local-api | 25 specs / 114 tests / 95.0 pts | 32 specs / 101 tests / 84.5 pts | 20 specs / 82 tests / 73.2 pts |
| notifications | 4 specs / 25 tests / 16.3 pts | 3 specs / 5 tests / 3.4 pts | 2 specs / 4 tests / 3.1 pts |
@@ -45,7 +45,7 @@ pass/fail/skip counts.
| os-integration | 7 specs / 30 tests / 25.5 pts | 14 specs / 27 tests / 16.0 pts | 2 specs / 13 tests / 9.4 pts |
| performance | 2 specs / 44 tests / 44.0 pts | 4 specs / 34 tests / 30.5 pts | 1 specs / 29 tests / 29.0 pts |
| pipes | 6 specs / 19 tests / 19.0 pts | 8 specs / 25 tests / 25.0 pts | 6 specs / 19 tests / 19.0 pts |
-| real-ui-e2e | 63 specs / 191 tests / 158.0 pts | 76 specs / 196 tests / 161.2 pts | 59 specs / 169 tests / 145.3 pts |
+| real-ui-e2e | 63 specs / 192 tests / 158.5 pts | 76 specs / 197 tests / 161.7 pts | 59 specs / 170 tests / 145.8 pts |
| settings | 14 specs / 39 tests / 36.0 pts | 16 specs / 34 tests / 29.7 pts | 13 specs / 31 tests / 28.0 pts |
| storage-privacy | 9 specs / 41 tests / 32.3 pts | 9 specs / 27 tests / 26.1 pts | 6 specs / 20 tests / 19.1 pts |
| tauri-command | 18 specs / 50 tests / 39.1 pts | 26 specs / 61 tests / 46.6 pts | 18 specs / 52 tests / 40.2 pts |
@@ -128,7 +128,7 @@ pass/fail/skip counts.
| chat-new-chat-first-message-ux.spec.ts | macos | chat-ai, real-ui-e2e | chat, chat-first-message-ux, chat-turn-status | medium | partial | real-user-flow | 1 | Real + new chat through the first assistant token over a cold Pi start: pins that the message and cleared composer land in the send frame, that only one status element is ever mounted, and that the pane never snaps alignment. Opt-in (SCREENPIPE_E2E_LOCAL_AI_GATEWAY). |
| chat-new-session-stale-save.spec.ts | windows, macos, linux | chat-ai, real-ui-e2e, storage-privacy | chat, chat-drafts | high | strong | synthetic | 1 | Switching to a new Pi session binds its echoed user turn to the new conversation file and leaves the previous chat intact. |
| chat-newchat-duplicate.spec.ts | windows, macos, linux | chat-ai | chat, chat-sidebar-dedupe | medium | partial | synthetic | 1 | Synthetic chat event regression for duplicate sidebar rows. |
-| chat-newchat-fresh.spec.ts | windows, macos, linux | chat-ai, real-ui-e2e | chat, chat-drafts | medium | partial | real-user-flow | 2 | The real new-chat shortcut opens a fresh chat from non-empty conversations and reuses one blank chat when pressed repeatedly. |
+| chat-newchat-fresh.spec.ts | windows, macos, linux | chat-ai, real-ui-e2e | chat, chat-drafts | medium | partial | real-user-flow | 3 | The real new-chat shortcut opens a fresh chat from non-empty conversations and reuses one blank chat when pressed repeatedly. |
| chat-parallel-jobs-duplicate.spec.ts | windows, macos, linux | chat-ai | chat, chat-sidebar-dedupe | medium | partial | synthetic | 1 | Parallel auto-send prefill dedupe regression. |
| chat-prefill-context-leak.spec.ts | windows, macos, linux | chat-ai | chat, chat-prefill | medium | partial | synthetic | 1 | Pending auto-send prefill must render only the clean prompt, not the internal model context, as the user message. |
| chat-prefill-duplicate.spec.ts | macos | chat-ai | chat, chat-prefill | medium | partial | synthetic | 1 | QUARANTINED (#4610): cross-window prefill duplicate regression. The autoSend persist precondition is racy in CI — times out with 0 conversations (not the duplicate=2 it guards) ~100% Linux + ~33% macOS. Re-enable once it seeds the persisted conversation deterministically. |