Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(activity): add action graph and top entities (#5842)

teod481090d0888
diff --git a/.sqlx/query-5c3341265fb2a05418e502d92e81ca02d2c51f7e6b1f2b10db9eb21a21163501.json b/.sqlx/query-5c3341265fb2a05418e502d92e81ca02d2c51f7e6b1f2b10db9eb21a21163501.json
new file mode 100644
index 0000000000..699af747fb
--- /dev/null
+++ b/.sqlx/query-5c3341265fb2a05418e502d92e81ca02d2c51f7e6b1f2b10db9eb21a21163501.json
@@ -0,0 +1,39 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT entity_type, entity_id, count(*)::bigint AS \"n!\"\n FROM activity_events\n WHERE subject_id = $2\n AND occurred_at >= ($3::date::timestamp AT TIME ZONE $1)\n - INTERVAL '26 hours'\n AND occurred_at < ($4::date::timestamp AT TIME ZONE $1)\n AND (occurred_at AT TIME ZONE $1)::date >= $3::date\n AND (occurred_at AT TIME ZONE $1)::date < $4::date\n AND entity_type = ANY($5::text[])\n GROUP BY 1, 2\n ORDER BY count(*) DESC, entity_type ASC, entity_id ASC\n LIMIT $6\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "entity_type",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "entity_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "n!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Date",
+ "Date",
+ "TextArray",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ null
+ ]
+ },
+ "hash": "5c3341265fb2a05418e502d92e81ca02d2c51f7e6b1f2b10db9eb21a21163501"
+}
diff --git a/.sqlx/query-bd772154d590ed150779c016fc28ef225dd4ac8c678935a622be23febfbbe8ec.json b/.sqlx/query-bd772154d590ed150779c016fc28ef225dd4ac8c678935a622be23febfbbe8ec.json
new file mode 100644
index 0000000000..8fe59341cf
--- /dev/null
+++ b/.sqlx/query-bd772154d590ed150779c016fc28ef225dd4ac8c678935a622be23febfbbe8ec.json
@@ -0,0 +1,31 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT (occurred_at AT TIME ZONE $1)::date AS \"day!\",\n count(*)::bigint AS \"n!\"\n FROM activity_events\n WHERE subject_id = $2\n AND occurred_at >= ($3::date::timestamp AT TIME ZONE $1)\n - INTERVAL '26 hours'\n AND occurred_at < ($4::date::timestamp AT TIME ZONE $1)\n AND (occurred_at AT TIME ZONE $1)::date >= $3::date\n AND (occurred_at AT TIME ZONE $1)::date < $4::date\n GROUP BY 1\n ORDER BY 1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "day!",
+ "type_info": "Date"
+ },
+ {
+ "ordinal": 1,
+ "name": "n!",
+ "type_info": "Int8"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Date",
+ "Date"
+ ]
+ },
+ "nullable": [
+ null,
+ null
+ ]
+ },
+ "hash": "bd772154d590ed150779c016fc28ef225dd4ac8c678935a622be23febfbbe8ec"
+}
diff --git a/Cargo.lock b/Cargo.lock
index 484d66e5b0..e647eae34f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -16,6 +16,7 @@ dependencies = [
"async-trait",
"channel_sender",
"chrono",
+ "chrono-tz",
"kafka_util",
"macro_db_migrator",
"macro_event_broker",
@@ -6767,6 +6768,7 @@ dependencies = [
"activity",
"async-graphql",
"chrono",
+ "chrono-tz",
"futures",
"graphql_common",
"macro_user_id",
diff --git a/apps/web/src/features/activity/action-graph.tsx b/apps/web/src/features/activity/action-graph.tsx
new file mode 100644
index 0000000000..830e3aa48e
--- /dev/null
+++ b/apps/web/src/features/activity/action-graph.tsx
@@ -0,0 +1,245 @@
+import type { ActivityOverview } from '@queries/activity/graphql/overview';
+import { cn, Layer, Tooltip } from '@ui';
+import { format } from 'date-fns';
+import { createMemo, For, type JSX } from 'solid-js';
+import { OVERVIEW_TZ, parseOverviewDate } from './activity-dates';
+import {
+ type ActivityStats,
+ formatDayLabel,
+ formatMonthName,
+ formatStreak,
+ summarizeActivity,
+} from './activity-stats';
+import {
+ buildContributionGrid,
+ type ContributionDay,
+ type ContributionWeek,
+} from './contribution-grid';
+import { INTENSITY_CLASS } from './intensity';
+
+const WEEKDAY_LABELS = ['', 'M', '', 'W', '', 'F', ''];
+
+function dateLabel(date: string): string {
+ return format(parseOverviewDate(date), 'EEE, MMM d, yyyy', {
+ in: OVERVIEW_TZ,
+ });
+}
+
+function actionLabel(day: ContributionDay): string {
+ const noun = day.count === 1 ? 'action' : 'actions';
+ return `${day.count.toLocaleString()} ${noun} on ${dateLabel(day.date)}`;
+}
+
+function monthLetter(label: string): string {
+ return label.slice(0, 1);
+}
+
+function monthStat(yearMonth: string | null): string {
+ return yearMonth ? formatMonthName(yearMonth) : '—';
+}
+
+function dayStat(date: string | null): string {
+ return date ? formatDayLabel(date) : '—';
+}
+
+/**
+ * The actions heatmap as a side-panel-style card: a titled header row, the
+ * year of day cells, and a compact stats row, divided like `SidePanel.Card`
+ * so it reads as list chrome rather than a dashboard tile.
+ */
+export function ActionGraph(props: { overview: ActivityOverview }) {
+ const grid = createMemo(() => buildContributionGrid(props.overview));
+ const monthLabels = createMemo(
+ () =>
+ new Map(
+ grid().monthLabels.map(({ label, weekIndex }) => [
+ weekIndex,
+ monthLetter(label),
+ ])
+ )
+ );
+ const stats = createMemo(() => summarizeActivity(props.overview));
+
+ return (
+ <Layer depth={2}>
+ <section
+ class="overflow-hidden rounded-lg border border-edge-muted bg-surface"
+ aria-labelledby="activity-actions-heading"
+ >
+ <div class="divide-y divide-edge-muted text-xs">
+ <ActionGraphHeader total={props.overview.total} />
+ <ContributionHeatmap
+ weeks={grid().weeks}
+ monthLabels={monthLabels()}
+ />
+ <ActionGraphStats stats={stats()} />
+ </div>
+ </section>
+ </Layer>
+ );
+}
+
+function ActionGraphHeader(props: { total: number }) {
+ return (
+ <header class="flex min-h-7 items-center gap-2 px-4 py-2">
+ <h2
+ id="activity-actions-heading"
+ class="font-semibold text-ink-muted text-xs"
+ >
+ Actions{' '}
+ <span class="text-ink-extra-muted tabular-nums">
+ ({props.total.toLocaleString()})
+ </span>
+ </h2>
+ <IntensityLegend />
+ </header>
+ );
+}
+
+function IntensityLegend() {
+ return (
+ <div class="ml-auto flex shrink-0 items-center gap-1 text-ink-extra-muted">
+ <span>Fewer</span>
+ <For each={[0, 1, 2, 3, 4] as const}>
+ {(level) => (
+ <span class={`size-2.5 rounded-[3px] ${INTENSITY_CLASS[level]}`} />
+ )}
+ </For>
+ <span>More</span>
+ </div>
+ );
+}
+
+function ContributionHeatmap(props: {
+ weeks: ContributionWeek[];
+ monthLabels: Map<number, string>;
+}) {
+ return (
+ <div class="overflow-x-auto px-4 py-3 scrollbar-hidden">
+ <div class="w-max min-w-full">
+ <WeekRow class="mb-1 pl-5">
+ <For each={props.weeks}>
+ {(_, index) => (
+ <MonthLetter label={props.monthLabels.get(index())} />
+ )}
+ </For>
+ </WeekRow>
+ <div class="flex items-stretch">
+ <WeekdayGutter />
+ <WeekRow>
+ <For each={props.weeks}>
+ {(week) => <HeatmapWeek week={week} />}
+ </For>
+ </WeekRow>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function WeekdayGutter() {
+ return (
+ <div class="mr-1.5 flex w-3.5 shrink-0 flex-col gap-[3px] text-ink-extra-muted text-xs">
+ <For each={WEEKDAY_LABELS}>
+ {(label) => (
+ <span class="flex min-h-0 flex-1 items-center leading-none">
+ {label}
+ </span>
+ )}
+ </For>
+ </div>
+ );
+}
+
+function HeatmapWeek(props: { week: ContributionWeek }) {
+ return (
+ <WeekColumn class="flex flex-col gap-[3px]">
+ <For each={props.week}>{(day) => <DaySquare day={day} />}</For>
+ </WeekColumn>
+ );
+}
+
+function MonthLetter(props: { label?: string }) {
+ return (
+ <WeekColumn class="text-center text-ink-extra-muted text-xs leading-none">
+ {props.label}
+ </WeekColumn>
+ );
+}
+
+function DaySquare(props: { day: ContributionDay | null }) {
+ const day = props.day;
+ if (!day) {
+ return <span class="aspect-square w-full shrink-0" />;
+ }
+
+ const label = actionLabel(day);
+ return (
+ <Tooltip
+ as="span"
+ placement="top"
+ class="aspect-square w-full shrink-0"
+ label={label}
+ >
+ <span
+ aria-label={label}
+ class={`block size-full rounded-[3px] ${INTENSITY_CLASS[day.intensity]}`}
+ />
+ </Tooltip>
+ );
+}
+
+/**
+ * One week column. Grows to fill the card width, floored at the day-cell
+ * size (a very narrow panel scrolls horizontally rather than squashing the
+ * cells) and capped so leftover width goes to the row gaps.
+ */
+function WeekColumn(props: { class?: string; children?: JSX.Element }) {
+ return (
+ <div class={cn('max-w-3.5 shrink-0 grow basis-2.5', props.class)}>
+ {props.children}
+ </div>
+ );
+}
+
+function WeekRow(props: { class?: string; children?: JSX.Element }) {
+ return (
+ <div class={cn('flex flex-1 justify-between gap-[3px]', props.class)}>
+ {props.children}
+ </div>
+ );
+}
+
+function ActionGraphStats(props: { stats: ActivityStats }) {
+ return (
+ <dl class="flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-2">
+ <Stat
+ label="Most active month"
+ value={monthStat(props.stats.mostActiveMonth)}
+ />
+ <Stat
+ label="Most active day"
+ value={dayStat(props.stats.mostActiveDay)}
+ />
+ <Stat
+ label="Longest streak"
+ value={formatStreak(props.stats.longestStreak)}
+ />
+ <Stat
+ label="Current streak"
+ value={formatStreak(props.stats.currentStreak)}
+ />
+ </dl>
+ );
+}
+
+function Stat(props: { label: string; value: string }) {
+ return (
+ <div class="flex min-w-0 items-center gap-1.5">
+ <dt class="shrink-0 text-ink-extra-muted">{props.label}</dt>
+ <dd class="min-w-0 truncate font-medium text-ink tabular-nums">
+ {props.value}
+ </dd>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/activity/activity-dates.ts b/apps/web/src/features/activity/activity-dates.ts
new file mode 100644
index 0000000000..3c5be89f40
--- /dev/null
+++ b/apps/web/src/features/activity/activity-dates.ts
@@ -0,0 +1,14 @@
+import { tz } from '@date-fns/tz';
+import { format, parseISO } from 'date-fns';
+
+/** Calendar dates from the overview are already local `YYYY-MM-DD`. Treat them
+ * as UTC so `date-fns` never applies a second viewer time zone. */
+export const OVERVIEW_TZ = tz('UTC');
+
+export function parseOverviewDate(date: string): Date {
+ return parseISO(`${date}T00:00:00Z`);
+}
+
+export function formatOverviewDate(date: Date): string {
+ return format(date, 'yyyy-MM-dd', { in: OVERVIEW_TZ });
+}
diff --git a/apps/web/src/features/activity/activity-stats.test.ts b/apps/web/src/features/activity/activity-stats.test.ts
new file mode 100644
index 0000000000..a31f1649b7
--- /dev/null
+++ b/apps/web/src/features/activity/activity-stats.test.ts
@@ -0,0 +1,108 @@
+import { describe, expect, it } from 'vitest';
+import {
+ formatDayLabel,
+ formatMonthName,
+ formatStreak,
+ summarizeActivity,
+} from './activity-stats';
+
+describe('summarizeActivity', () => {
+ it('returns empty peaks and zero streaks for an empty window', () => {
+ expect(
+ summarizeActivity({
+ from: '2026-08-21',
+ to: '2026-08-21',
+ days: [{ date: '2026-08-20', count: 4 }],
+ })
+ ).toEqual({
+ currentStreak: 0,
+ longestStreak: 0,
+ mostActiveDay: null,
+ mostActiveMonth: null,
+ });
+ });
+
+ it('fills missing dates as zeros when computing streaks', () => {
+ expect(
+ summarizeActivity({
+ from: '2026-08-18',
+ to: '2026-08-22',
+ days: [
+ { date: '2026-08-18', count: 1 },
+ { date: '2026-08-20', count: 2 },
+ { date: '2026-08-21', count: 3 },
+ ],
+ })
+ ).toEqual({
+ currentStreak: 2,
+ longestStreak: 2,
+ mostActiveDay: '2026-08-21',
+ mostActiveMonth: '2026-08',
+ });
+ });
+
+ it('breaks the current streak when the last day is idle', () => {
+ expect(
+ summarizeActivity({
+ from: '2026-08-18',
+ to: '2026-08-22',
+ days: [
+ { date: '2026-08-18', count: 1 },
+ { date: '2026-08-19', count: 1 },
+ { date: '2026-08-20', count: 1 },
+ ],
+ })
+ ).toEqual({
+ currentStreak: 0,
+ longestStreak: 3,
+ mostActiveDay: '2026-08-20',
+ mostActiveMonth: '2026-08',
+ });
+ });
+
+ it('keeps a streak that crosses a month boundary', () => {
+ expect(
+ summarizeActivity({
+ from: '2026-07-30',
+ to: '2026-08-03',
+ days: [
+ { date: '2026-07-31', count: 2 },
+ { date: '2026-08-01', count: 4 },
+ { date: '2026-08-02', count: 1 },
+ ],
+ })
+ ).toEqual({
+ currentStreak: 3,
+ longestStreak: 3,
+ mostActiveDay: '2026-08-01',
+ mostActiveMonth: '2026-08',
+ });
+ });
+
+ it('picks the later day and month when counts tie', () => {
+ expect(
+ summarizeActivity({
+ from: '2026-07-01',
+ to: '2026-09-01',
+ days: [
+ { date: '2026-07-15', count: 5 },
+ { date: '2026-08-15', count: 5 },
+ ],
+ })
+ ).toEqual({
+ currentStreak: 0,
+ longestStreak: 1,
+ mostActiveDay: '2026-08-15',
+ mostActiveMonth: '2026-08',
+ });
+ });
+});
+
+describe('activity stat labels', () => {
+ it('formats month, day, and streak the way the card shows them', () => {
+ expect(formatMonthName('2026-08')).toBe('August');
+ expect(formatDayLabel('2026-08-21')).toBe('Aug 21, 2026');
+ expect(formatStreak(2)).toBe('2d');
+ expect(formatStreak(0)).toBe('0d');
+ });
+});
diff --git a/apps/web/src/features/activity/activity-stats.ts b/apps/web/src/features/activity/activity-stats.ts
new file mode 100644
index 0000000000..3a74ca02cc
--- /dev/null
+++ b/apps/web/src/features/activity/activity-stats.ts
@@ -0,0 +1,118 @@
+import {
+ addDays,
+ eachDayOfInterval,
+ format,
+ isBefore,
+ isValid,
+} from 'date-fns';
+import {
+ formatOverviewDate,
+ OVERVIEW_TZ,
+ parseOverviewDate,
+} from './activity-dates';
+
+export type ActivityDayCount = {
+ date: string;
+ count: number;
+};
+
+export type ActivityStats = {
+ currentStreak: number;
+ longestStreak: number;
+ mostActiveDay: string | null;
+ mostActiveMonth: string | null;
+};
+
+function eachDate(from: string, toExclusive: string): string[] {
+ const start = parseOverviewDate(from);
+ const end = parseOverviewDate(toExclusive);
+ if (!isValid(start) || !isValid(end) || !isBefore(start, end)) {
+ return [];
+ }
+
+ return eachDayOfInterval(
+ { start, end: addDays(end, -1) },
+ { in: OVERVIEW_TZ }
+ ).map(formatOverviewDate);
+}
+
+/**
+ * Peak month/day and consecutive-active-day streaks from the sparse overview
+ * window. Streaks walk every local date in `[from, to)`.
+ */
+export function summarizeActivity(overview: {
+ days: ActivityDayCount[];
+ from: string;
+ to: string;
+}): ActivityStats {
+ const counts = new Map(overview.days.map((day) => [day.date, day.count]));
+ const dates = eachDate(overview.from, overview.to);
+
+ let mostActiveDay: string | null = null;
+ let mostActiveDayCount = 0;
+ const months = new Map<string, number>();
+
+ let currentRun = 0;
+ let longestStreak = 0;
+ let currentStreak = 0;
+
+ for (const [index, date] of dates.entries()) {
+ const count = counts.get(date) ?? 0;
+ if (count > 0) {
+ if (
+ mostActiveDay === null ||
+ count > mostActiveDayCount ||
+ (count === mostActiveDayCount && date > mostActiveDay)
+ ) {
+ mostActiveDay = date;
+ mostActiveDayCount = count;
+ }
+ const month = format(parseOverviewDate(date), 'yyyy-MM', {
+ in: OVERVIEW_TZ,
+ });
+ months.set(month, (months.get(month) ?? 0) + count);
+ currentRun += 1;
+ longestStreak = Math.max(longestStreak, currentRun);
+ } else {
+ currentRun = 0;
+ }
+
+ if (index === dates.length - 1) {
+ currentStreak = currentRun;
+ }
+ }
+
+ let mostActiveMonth: string | null = null;
+ let mostActiveMonthCount = 0;
+ for (const [month, count] of months) {
+ if (
+ count > mostActiveMonthCount ||
+ (count === mostActiveMonthCount &&
+ (mostActiveMonth === null || month > mostActiveMonth))
+ ) {
+ mostActiveMonth = month;
+ mostActiveMonthCount = count;
+ }
+ }
+
+ return {
+ currentStreak,
+ longestStreak,
+ mostActiveDay,
+ mostActiveMonth,
+ };
+}
+
+export function formatMonthName(yearMonth: string): string {
+ return format(parseOverviewDate(`${yearMonth}-01`), 'MMMM', {
+ in: OVERVIEW_TZ,
+ });
+}
+
+export function formatDayLabel(date: string): string {
+ return format(parseOverviewDate(date), 'MMM d, yyyy', { in: OVERVIEW_TZ });
+}
+
+export function formatStreak(days: number): string {
+ return `${days}d`;
+}
diff --git a/apps/web/src/features/activity/contribution-grid.test.ts b/apps/web/src/features/activity/contribution-grid.test.ts
new file mode 100644
index 0000000000..d4a685c773
--- /dev/null
+++ b/apps/web/src/features/activity/contribution-grid.test.ts
@@ -0,0 +1,80 @@
+import { describe, expect, it } from 'vitest';
+import { buildContributionGrid } from './contribution-grid';
+
+describe('buildContributionGrid', () => {
+ it('omits leading and trailing weeks that are not a full Sunday–Saturday', () => {
+ const grid = buildContributionGrid({
+ from: '2026-08-19',
+ to: '2026-08-31',
+ days: [
+ { date: '2026-08-19', count: 2 },
+ { date: '2026-08-23', count: 8 },
+ ],
+ });
+
+ expect(grid.weeks).toHaveLength(1);
+ expect(grid.weeks[0].map((day) => day?.date)).toEqual([
+ '2026-08-23',
+ '2026-08-24',
+ '2026-08-25',
+ '2026-08-26',
+ '2026-08-27',
+ '2026-08-28',
+ '2026-08-29',
+ ]);
+ });
+
+ it('returns no columns when the window contains no full week', () => {
+ const grid = buildContributionGrid({
+ from: '2026-08-19',
+ to: '2026-08-24',
+ days: [
+ { date: '2026-08-19', count: 2 },
+ { date: '2026-08-23', count: 8 },
+ ],
+ });
+
+ expect(grid.weeks).toEqual([]);
+ expect(grid.monthLabels).toEqual([]);
+ });
+
+ it('fills missing API dates with zero and derives relative intensity', () => {
+ const grid = buildContributionGrid({
+ from: '2026-08-16',
+ to: '2026-08-23',
+ days: [
+ { date: '2026-08-17', count: 1 },
+ { date: '2026-08-20', count: 4 },
+ ],
+ });
+
+ expect(grid.weeks[0].map((day) => day?.count)).toEqual([
+ 0, 1, 0, 0, 4, 0, 0,
+ ]);
+ expect(grid.weeks[0].map((day) => day?.intensity)).toEqual([
+ 0, 1, 0, 0, 4, 0, 0,
+ ]);
+ });
+
+ it('anchors the current month and each later month to a week column', () => {
+ const grid = buildContributionGrid({
+ from: '2026-01-30',
+ to: '2026-03-03',
+ days: [],
+ });
+
+ expect(
+ grid.monthLabels.map(({ label, weekIndex }) => [label, weekIndex])
+ ).toEqual([['Feb', 0]]);
+ });
+
+ it('returns no columns for an invalid or empty window', () => {
+ expect(
+ buildContributionGrid({
+ from: '2026-08-21',
+ to: '2026-08-21',
+ days: [],
+ })
+ ).toEqual({ weeks: [], monthLabels: [] });
+ });
+});
diff --git a/apps/web/src/features/activity/contribution-grid.ts b/apps/web/src/features/activity/contribution-grid.ts
new file mode 100644
index 0000000000..1c98e386f0
--- /dev/null
+++ b/apps/web/src/features/activity/contribution-grid.ts
@@ -0,0 +1,97 @@
+import {
+ addDays,
+ eachDayOfInterval,
+ eachWeekOfInterval,
+ format,
+ getDate,
+ isBefore,
+ isValid,
+} from 'date-fns';
+import {
+ formatOverviewDate,
+ OVERVIEW_TZ,
+ parseOverviewDate,
+} from './activity-dates';
+import { type ActivityIntensity, intensityLevel } from './intensity';
+
+export type ContributionDay = {
+ date: string;
+ count: number;
+ intensity: ActivityIntensity;
+};
+
+export type ContributionWeek = Array<ContributionDay | null>;
+
+export type ContributionMonthLabel = {
+ label: string;
+ weekIndex: number;
+};
+
+export type ContributionGrid = {
+ weeks: ContributionWeek[];
+ monthLabels: ContributionMonthLabel[];
+};
+
+function labelMonth(day: ContributionDay): string {
+ return format(parseOverviewDate(day.date), 'MMM', { in: OVERVIEW_TZ });
+}
+
+function isInWindow(day: Date, from: Date, to: Date): boolean {
+ return !isBefore(day, from) && isBefore(day, to);
+}
+
+/**
+ * Sunday-first weeks that sit entirely inside the window. Leading and
+ * trailing stub columns (days outside `[from, to)`) are omitted, matching
+ * Cursor's heatmap. Dates stay in UTC so they never pick up a second
+ * viewer-time-zone conversion.
+ */
+export function buildContributionGrid(overview: {
+ from: string;
+ to: string;
+ days: Array<{ date: string; count: number }>;
+}): ContributionGrid {
+ const from = parseOverviewDate(overview.from);
+ const to = parseOverviewDate(overview.to);
+ if (!isValid(from) || !isValid(to) || !isBefore(from, to)) {
+ return { weeks: [], monthLabels: [] };
+ }
+
+ const counts = new Map(overview.days.map((day) => [day.date, day.count]));
+ const max = Math.max(0, ...overview.days.map((day) => day.count));
+ const weeks: ContributionWeek[] = [];
+
+ for (const weekStart of eachWeekOfInterval(
+ { start: from, end: addDays(to, -1) },
+ { weekStartsOn: 0, in: OVERVIEW_TZ }
+ )) {
+ const week = eachDayOfInterval(
+ { start: weekStart, end: addDays(weekStart, 6) },
+ { in: OVERVIEW_TZ }
+ ).map((day): ContributionDay | null => {
+ if (!isInWindow(day, from, to)) return null;
+ const date = formatOverviewDate(day);
+ const count = counts.get(date) ?? 0;
+ return { date, count, intensity: intensityLevel(count, max) };
+ });
+ if (week.every((day) => day !== null)) {
+ weeks.push(week);
+ }
+ }
+
+ const monthLabels: ContributionMonthLabel[] = [];
+ for (const [weekIndex, week] of weeks.entries()) {
+ const visibleDays = week.filter(
+ (day): day is ContributionDay => day !== null
+ );
+ const firstOfMonth = visibleDays.find(
+ (day) => getDate(parseOverviewDate(day.date), { in: OVERVIEW_TZ }) === 1
+ );
+ const labelDay = firstOfMonth ?? (weekIndex === 0 ? visibleDays[0] : null);
+ if (labelDay) {
+ monthLabels.push({ label: labelMonth(labelDay), weekIndex });
+ }
+ }
+
+ return { weeks, monthLabels };
+}
diff --git a/apps/web/src/features/activity/display-entity-type.ts b/apps/web/src/features/activity/display-entity-type.ts
new file mode 100644
index 0000000000..4b1a95ce39
--- /dev/null
+++ b/apps/web/src/features/activity/display-entity-type.ts
@@ -0,0 +1,16 @@
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import type { GraphqlEntityType } from '@service-storage/graphql/generated/graphql';
+import { match } from 'ts-pattern';
+
+export function displayEntityType(
+ entityType: GraphqlEntityType
+): EntityType | undefined {
+ return match<GraphqlEntityType, EntityType | undefined>(entityType)
+ .with('DOCUMENT', () => 'DOCUMENT')
+ .with('PROJECT', () => 'PROJECT')
+ .with('CHAT', () => 'CHAT')
+ .with('EMAIL_THREAD', () => 'THREAD')
+ .with('CHANNEL', () => 'CHANNEL')
+ .with('USER', () => 'USER')
+ .otherwise(() => undefined);
+}
diff --git a/apps/web/src/features/activity/intensity.test.ts b/apps/web/src/features/activity/intensity.test.ts
new file mode 100644
index 0000000000..0c2aae9846
--- /dev/null
+++ b/apps/web/src/features/activity/intensity.test.ts
@@ -0,0 +1,24 @@
+import { describe, expect, it } from 'vitest';
+import { intensityLevel } from './intensity';
+
+describe('intensityLevel', () => {
+ it('keeps empty and invalid ranges at zero', () => {
+ expect(intensityLevel(0, 10)).toBe(0);
+ expect(intensityLevel(5, 0)).toBe(0);
+ });
+
+ it('maps every positive count into levels one through four', () => {
+ expect(intensityLevel(1, 100)).toBe(1);
+ expect(intensityLevel(25, 100)).toBe(1);
+ expect(intensityLevel(26, 100)).toBe(2);
+ expect(intensityLevel(50, 100)).toBe(2);
+ expect(intensityLevel(75, 100)).toBe(3);
+ expect(intensityLevel(100, 100)).toBe(4);
+ });
+
+ it('is monotonic and clamps counts above the maximum', () => {
+ const levels = [1, 2, 3, 4, 5].map((count) => intensityLevel(count, 4));
+
+ expect(levels).toEqual([1, 2, 3, 4, 4]);
+ });
+});
diff --git a/apps/web/src/features/activity/intensity.ts b/apps/web/src/features/activity/intensity.ts
new file mode 100644
index 0000000000..a8e7cf2f6b
--- /dev/null
+++ b/apps/web/src/features/activity/intensity.ts
@@ -0,0 +1,14 @@
+export type ActivityIntensity = 0 | 1 | 2 | 3 | 4;
+
+export function intensityLevel(count: number, max: number): ActivityIntensity {
+ if (count <= 0 || max <= 0) return 0;
+ return Math.ceil(Math.min(count / max, 1) * 4) as ActivityIntensity;
+}
+
+export const INTENSITY_CLASS: Record<ActivityIntensity, string> = {
+ 0: 'bg-ink/10',
+ 1: 'bg-accent/25',
+ 2: 'bg-accent/45',
+ 3: 'bg-accent/70',
+ 4: 'bg-accent',
+};
diff --git a/apps/web/src/features/activity/my-activity-view.tsx b/apps/web/src/features/activity/my-activity-view.tsx
index 97f2f86c52..9414f24da2 100644
--- a/apps/web/src/features/activity/my-activity-view.tsx
+++ b/apps/web/src/features/activity/my-activity-view.tsx
@@ -4,14 +4,21 @@ import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHe
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
import type { ActivityEvent } from '@queries/activity/graphql/entity';
import { createMyActivityQuery } from '@queries/activity/graphql/feed';
+import { createMyActivityOverviewQuery } from '@queries/activity/graphql/overview';
import { Button } from '@ui';
import { type Component, createMemo, For, Show } from 'solid-js';
+import { ActionGraph } from './action-graph';
import { ActivityTimelineRow } from './activity-timeline-row';
+import { TopEntities } from './top-entities';
type FeedGroup = { key: string; label: string; events: ActivityEvent[] };
+/** The soup list inset shared by section headers, feed rows, and the overview. */
+const INSET_CLASS = 'mx-1 w-[calc(100%-0.5rem)]';
+
/** The user's own activity, newest first, behind the activity-feed flag. */
export function MyActivityView() {
+ const overview = createMyActivityOverviewQuery({ enabled: () => true });
const feed = createMyActivityQuery({ enabled: () => true });
const groups = createMemo<FeedGroup[]>(() => {
const out: FeedGroup[] = [];
@@ -34,31 +41,50 @@ export function MyActivityView() {
</SplitHeaderLeft>
<StaticMarkdownContext>
<div class="min-h-0 flex-1 overflow-y-auto py-1">
- <Show
- when={groups().length > 0}
- fallback={
- <p class="px-3 py-2 text-ink-muted text-sm">
- {feed.isLoading
- ? 'Loading…'
- : feed.isError
- ? 'Activity is unavailable right now. Try again in a moment.'
- : 'No activity yet.'}
- </p>
- }
- >
- <FeedGroups groups={groups()} row={ActivityTimelineRow} />
- <Show when={feed.hasNextPage}>
- <div class="flex justify-center py-2">
- <Button
- variant="ghost"
- onClick={() => void feed.fetchNextPage()}
- disabled={feed.isFetchingNextPage}
- >
- {feed.isFetchingNextPage ? 'Loading…' : 'Show more'}
- </Button>
- </div>
+ <div class="mx-auto w-full max-w-[1000px]">
+ <div class={`${INSET_CLASS} flex min-w-0 flex-col gap-2 pb-2`}>
+ <Show
+ when={overview.data}
+ fallback={
+ <p class="px-2 py-1 text-ink-extra-muted text-xs">
+ {overview.isError
+ ? 'Activity overview is unavailable right now.'
+ : 'Loading activity overview…'}
+ </p>
+ }
+ >
+ {(data) => <ActionGraph overview={data()} />}
+ </Show>
+ </div>
+ <Show when={overview.data}>
+ {(data) => <TopEntities entities={data().topEntities} />}
+ </Show>
+ <Show
+ when={groups().length > 0}
+ fallback={
+ <p class={`${INSET_CLASS} px-2 py-2 text-ink-muted text-sm`}>
+ {feed.isLoading
+ ? 'Loading…'
+ : feed.isError
+ ? 'Activity is unavailable right now. Try again in a moment.'
+ : 'No activity yet.'}
+ </p>
+ }
+ >
+ <FeedGroups groups={groups()} row={ActivityTimelineRow} />
+ <Show when={feed.hasNextPage}>
+ <div class="flex justify-center py-2">
+ <Button
+ variant="ghost"
+ onClick={() => void feed.fetchNextPage()}
+ disabled={feed.isFetchingNextPage}
+ >
+ {feed.isFetchingNextPage ? 'Loading…' : 'Show more'}
+ </Button>
+ </div>
+ </Show>
</Show>
- </Show>
+ </div>
</div>
</StaticMarkdownContext>
</div>
diff --git a/apps/web/src/features/activity/top-entities.tsx b/apps/web/src/features/activity/top-entities.tsx
new file mode 100644
index 0000000000..0c0a5f1069
--- /dev/null
+++ b/apps/web/src/features/activity/top-entities.tsx
@@ -0,0 +1,101 @@
+import { SoupSectionHeader } from '@app/features/next-soup/soup-view/section-header';
+import { openDocument } from '@core/component/LexicalMarkdown/component/core/BlockLink';
+import { useSplitNavigationHandler } from '@core/util/useSplitNavigationHandler';
+import { usePropertyEntityDisplay } from '@property/hooks';
+import type { ActivityOverview } from '@queries/activity/graphql/overview';
+import type { EntityType } from '@service-properties/generated/schemas/entityType';
+import { For, Show } from 'solid-js';
+import { displayEntityType } from './display-entity-type';
+import { EntityMention } from './entity-mention';
+
+type EntityRank = ActivityOverview['topEntities'][number];
+
+const ROW_CLASS = 'mx-1 flex w-[calc(100%-0.5rem)] items-stretch px-2 text-sm';
+const ROW_BODY_CLASS =
+ 'flex min-h-10 min-w-0 flex-1 items-center gap-1.5 rounded-lg px-2 py-0.5 hover:bg-hover/30';
+
+/**
+ * The entities the viewer touched most, as a list that shares the activity
+ * feed's row chrome — mention on the left, action count on the right.
+ */
+export function TopEntities(props: {
+ entities: ActivityOverview['topEntities'];
+}) {
+ return (
+ <section class="min-w-0" aria-label="Most active">
+ <SoupSectionHeader>Most active</SoupSectionHeader>
+ <Show
+ when={props.entities.length > 0}
+ fallback={
+ <p class="px-2 py-2 text-ink-muted text-sm">No entities yet.</p>
+ }
+ >
+ <For each={props.entities}>
+ {(entity) => <TopEntityRow entity={entity} />}
+ </For>
+ </Show>
+ </section>
+ );
+}
+
+function TopEntityRow(props: { entity: EntityRank }) {
+ const displayType = () => displayEntityType(props.entity.entityType);
+
+ return (
+ <div class={ROW_CLASS}>
+ <Show
+ when={displayType()}
+ fallback={
+ <div class={ROW_BODY_CLASS}>
+ <span class="min-w-0 truncate text-ink-extra-muted">
+ {props.entity.entityType}
+ </span>
+ <ActionCount count={props.entity.count} />
+ </div>
+ }
+ >
+ {(type) => (
+ <MappedEntityRow entity={props.entity} entityType={type()} />
+ )}
+ </Show>
+ </div>
+ );
+}
+
+function MappedEntityRow(props: {
+ entity: EntityRank;
+ entityType: EntityType;
+}) {
+ const display = usePropertyEntityDisplay(
+ () => props.entity.entityId,
+ () => props.entityType
+ );
+ const navHandlers = useSplitNavigationHandler<HTMLDivElement>((event) => {
+ const block = display.blockOrFileType();
+ if (!block) return;
+ openDocument(
+ block,
+ props.entity.entityId,
+ display.linkParams(),
+ event.shiftKey
+ );
+ });
+
+ return (
+ <div {...navHandlers} class={ROW_BODY_CLASS}>
+ <span class="min-w-0 truncate">
+ <EntityMention entityId={props.entity.entityId} display={display} />
+ </span>
+ <ActionCount count={props.entity.count} />
+ </div>
+ );
+}
+
+function ActionCount(props: { count: number }) {
+ const noun = () => (props.count === 1 ? 'action' : 'actions');
+ return (
+ <span class="ml-auto shrink-0 text-right font-medium text-ink-extra-muted text-xs tabular-nums">
+ {props.count.toLocaleString()} {noun()}
+ </span>
+ );
+}
diff --git a/apps/web/src/lib/queries/activity/graphql/overview.ts b/apps/web/src/lib/queries/activity/graphql/overview.ts
new file mode 100644
index 0000000000..0dcbec7141
--- /dev/null
+++ b/apps/web/src/lib/queries/activity/graphql/overview.ts
@@ -0,0 +1,35 @@
+import { createUrqlQuery } from '@app/lib/urql-solid/create-urql-query';
+import {
+ MyActivityOverviewDocument,
+ type MyActivityOverviewQuery,
+ type MyActivityOverviewQueryVariables,
+} from '@service-storage/graphql/generated/graphql';
+import { getGraphqlSoupClient } from '@service-storage/graphql-soup';
+import type { Accessor } from 'solid-js';
+
+export type ActivityOverview =
+ MyActivityOverviewQuery['user']['activityOverview'];
+
+function browserTimeZone(): string {
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
+}
+
+export function createMyActivityOverviewQuery(options: {
+ enabled: Accessor<boolean>;
+}) {
+ return createUrqlQuery<
+ MyActivityOverviewQuery,
+ MyActivityOverviewQueryVariables,
+ ActivityOverview
+ >(() => ({
+ query: MyActivityOverviewDocument,
+ client: getGraphqlSoupClient(),
+ variables: {
+ input: { timeZone: browserTimeZone() },
+ },
+ enabled: options.enabled(),
+ requestPolicy: 'cache-and-network',
+ keepPreviousData: true,
+ select: (data) => data.user.activityOverview,
+ }));
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/activity.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/activity.graphql
index b4c304518f..0de21f8ebc 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/activity.graphql
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/activity.graphql
@@ -10,6 +10,27 @@ query MyActivity($input: ActivityFeedInput!) {
}
}
+query MyActivityOverview($input: ActivityOverviewInput!) {
+ user {
+ id
+ activityOverview(input: $input) {
+ from
+ to
+ timeZone
+ total
+ days {
+ date
+ count
+ }
+ topEntities {
+ entityType
+ entityId
+ count
+ }
+ }
+ }
+}
+
query EntityActivity($input: SoupInput!, $limit: Int) {
user {
id
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
index 7e93770615..3bf18c8cd4 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
@@ -14,6 +14,12 @@ export type ActivityFeedInput = {
limit?: number | null | undefined;
};
+/** Request for the authenticated user's trailing-year activity overview. */
+export type ActivityOverviewInput = {
+ /** IANA time zone used for local dates. Omitted or empty means UTC. */
+ timeZone?: string | null | undefined;
+};
+
/** Channel activity operation exposed by GraphQL. */
export type ChannelActivityType =
/** Record that the user interacted with the channel. */
@@ -589,40 +595,17 @@ export type GraphqlFilterPropertiesExpr =
/** GraphQL input for matching a property value on an entity. */
export type GraphqlFilterPropertiesLiteral = {
/** Optional entity type scope for the property match. */
- entityType?: GraphqlFilterPropertyEntityType | null | undefined;
+ entityType?: GraphqlPropertyEntityType | null | undefined;
/** Property definition id to match. */
propertyDefinitionId: string | number;
/** Value to compare against the property. */
value: GraphqlFilterPropertyMatchValue;
};
-/** An entity type supported by property filters. */
-export type GraphqlFilterPropertyEntityType =
- /** Calendar event entity. */
- | 'CALENDAR_EVENT'
- /** Call record entity. */
- | 'CALL_RECORD'
- /** Channel entity. */
- | 'CHANNEL'
- /** Chat entity. */
- | 'CHAT'
- /** Company entity. */
- | 'COMPANY'
- /** Document entity. */
- | 'DOCUMENT'
- /** Project entity. */
- | 'PROJECT'
- /** Task entity. */
- | 'TASK'
- /** Thread entity. */
- | 'THREAD'
- /** User entity. */
- | 'USER';
-
/** GraphQL input value used when matching a property. */
export type GraphqlFilterPropertyMatchValue =
{ /** Entity reference id to match. */
- entityRef: string; selectOption?: never; }
+ entityRef: string | number; selectOption?: never; }
| { entityRef?: never; /** Select option id to match. */
selectOption: string | number; };
@@ -1157,6 +1140,13 @@ export type MyActivityQuery = { user: { id: string, activity: { nextCursor: stri
| { __typename: 'GraphqlActivityUnknownAction', tag: string, payload: unknown }
}> } } };
+export type MyActivityOverviewQueryVariables = Exact<{
+ input: ActivityOverviewInput;
+}>;
+
+
+export type MyActivityOverviewQuery = { user: { id: string, activityOverview: { from: string, to: string, timeZone: string, total: number, days: Array<{ date: string, count: number }>, topEntities: Array<{ entityType: GraphqlEntityType, entityId: string, count: number }> } } };
+
export type EntityActivityQueryVariables = Exact<{
input: SoupInput;
limit?: number | null | undefined;
@@ -8270,6 +8260,7 @@ export const GraphqlChatQuickAccessNameFragmentDoc = {"kind":"Document","definit
export const GraphqlProjectQuickAccessNameFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlProjectQuickAccessName"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}}]} as unknown as DocumentNode<GraphqlProjectQuickAccessNameFragment, unknown>;
export const SoupNotificationsEntityFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationsEntityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"done"}},{"kind":"Field","name":{"kind":"Name","value":"seen"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}}]} as unknown as DocumentNode<SoupNotificationsEntityFieldsFragment, unknown>;
export const MyActivityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyActivity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ActivityFeedInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"activity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ActivityEventFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"nextCursor"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ActivityEventFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"actorId"}},{"kind":"Field","name":{"kind":"Name","value":"subjectId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"occurredAt"}},{"kind":"Field","name":{"kind":"Name","value":"action"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityPropertyChanged"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"property"}},{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityParticipantAdded"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"participant"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityParticipantRemoved"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"participant"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityCallStarted"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"callId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityUnknownAction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tag"}},{"kind":"Field","name":{"kind":"Name","value":"payload"}}]}}]}}]}}]} as unknown as DocumentNode<MyActivityQuery, MyActivityQueryVariables>;
+export const MyActivityOverviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MyActivityOverview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ActivityOverviewInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"activityOverview"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}},{"kind":"Field","name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"days"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"date"}},{"kind":"Field","name":{"kind":"Name","value":"count"}}]}},{"kind":"Field","name":{"kind":"Name","value":"topEntities"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"count"}}]}}]}}]}}]}}]} as unknown as DocumentNode<MyActivityOverviewQuery, MyActivityOverviewQueryVariables>;
export const EntityActivityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"EntityActivity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SoupInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"limit"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"soup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EntityActivityFields"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ActivityEventFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"actorId"}},{"kind":"Field","name":{"kind":"Name","value":"subjectId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"occurredAt"}},{"kind":"Field","name":{"kind":"Name","value":"action"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityPropertyChanged"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"property"}},{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityParticipantAdded"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"participant"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityParticipantRemoved"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"participant"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityCallStarted"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"callId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlActivityUnknownAction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tag"}},{"kind":"Field","name":{"kind":"Name","value":"payload"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EntityActivityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"activity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"Variable","name":{"kind":"Name","value":"limit"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ActivityEventFields"}}]}}]}}]} as unknown as DocumentNode<EntityActivityQuery, EntityActivityQueryVariables>;
export const RecordChannelActivityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RecordChannelActivity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RecordChannelActivityInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"recordChannelActivity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}}]}}]}}]} as unknown as DocumentNode<RecordChannelActivityMutation, RecordChannelActivityMutationVariables>;
export const UpdateNotificationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateNotifications"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateNotificationsInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateNotifications"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"done"}},{"kind":"Field","name":{"kind":"Name","value":"seen"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}}]} as unknown as DocumentNode<UpdateNotificationsMutation, UpdateNotificationsMutationVariables>;
diff --git a/crates/activity/Cargo.toml b/crates/activity/Cargo.toml
index 74f2d29f81..a8685bed64 100644
--- a/crates/activity/Cargo.toml
+++ b/crates/activity/Cargo.toml
@@ -23,6 +23,7 @@ ai_toolset = { path = "../ai_toolset", optional = true }
async-trait = { workspace = true, optional = true }
channel_sender = { path = "../channel_sender" }
chrono = { workspace = true }
+chrono-tz = { workspace = true }
kafka_util = { path = "../kafka_util", optional = true }
macro_event_broker = { path = "../macro_event_broker", default-features = false, optional = true }
macro_user_id = { path = "../macro_user_id" }
diff --git a/crates/activity/src/domain/mod.rs b/crates/activity/src/domain/mod.rs
index fc203e14b9..ea00c93496 100644
--- a/crates/activity/src/domain/mod.rs
+++ b/crates/activity/src/domain/mod.rs
@@ -1,6 +1,7 @@
//! Domain layer: the activity model and the storage port.
pub mod models;
+pub mod overview;
pub mod ports;
#[cfg(feature = "ai_tools")]
pub mod service;
diff --git a/crates/activity/src/domain/overview.rs b/crates/activity/src/domain/overview.rs
new file mode 100644
index 0000000000..a2cdb8b380
--- /dev/null
+++ b/crates/activity/src/domain/overview.rs
@@ -0,0 +1,212 @@
+//! A subject's activity summarized over a bounded window of local dates.
+
+#[cfg(test)]
+mod test;
+
+use std::num::NonZeroU64;
+
+use chrono::{DateTime, Days, NaiveDate, Utc};
+use chrono_tz::Tz;
+
+use super::models::EntityType;
+
+/// Maximum number of local dates an overview window may contain.
+pub const MAX_ACTIVITY_WINDOW_DAYS: i64 = 400;
+
+/// Number of entities included in the overview ranking.
+pub const TOP_ENTITY_LIMIT: i64 = 8;
+
+/// A half-open span of local dates in one IANA time zone.
+///
+/// The outbound adapter converts both bounds and day buckets with the same
+/// Postgres `AT TIME ZONE` operation. Keeping UTC instants out of this type
+/// prevents the filter and its day buckets from choosing different offsets
+/// at an ambiguous local midnight.
+#[readonly::make]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct ActivityWindow {
+ /// Zone used to interpret the dates and bucket activity.
+ pub zone: Tz,
+ /// First local date, inclusive.
+ pub start: NaiveDate,
+ /// One past the final local date, exclusive.
+ pub end: NaiveDate,
+}
+
+/// Why an activity window is invalid.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum ActivityWindowError {
+ /// The end is not later than the start.
+ Empty,
+ /// The window contains more than [`MAX_ACTIVITY_WINDOW_DAYS`] dates.
+ TooWide,
+}
+
+impl std::fmt::Display for ActivityWindowError {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ Self::Empty => formatter.write_str("activity window must contain at least one day"),
+ Self::TooWide => formatter.write_str("activity window may contain at most 400 days"),
+ }
+ }
+}
+
+impl std::error::Error for ActivityWindowError {}
+
+impl ActivityWindow {
+ /// Builds a non-empty activity window containing at most 400 local dates.
+ pub fn new(zone: Tz, start: NaiveDate, end: NaiveDate) -> Result<Self, ActivityWindowError> {
+ let days = end.signed_duration_since(start).num_days();
+ if days <= 0 {
+ return Err(ActivityWindowError::Empty);
+ }
+ if days > MAX_ACTIVITY_WINDOW_DAYS {
+ return Err(ActivityWindowError::TooWide);
+ }
+ Ok(Self { zone, start, end })
+ }
+
+ /// Whether `day` belongs to this half-open window.
+ pub fn contains(&self, day: NaiveDate) -> bool {
+ self.start <= day && day < self.end
+ }
+}
+
+/// Builds the 365-local-date window ending after the viewer's current date.
+pub fn trailing_year(now: DateTime<Utc>, zone: Tz) -> ActivityWindow {
+ let today = now.with_timezone(&zone).date_naive();
+ let end = today
+ .checked_add_days(Days::new(1))
+ .expect("a current local date has a following day");
+ let start = end
+ .checked_sub_days(Days::new(365))
+ .expect("a current local date has a preceding year");
+ ActivityWindow::new(zone, start, end).expect("the trailing-year window is valid")
+}
+
+/// One local date with at least one activity.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct DayCount {
+ /// Local date in the overview's zone.
+ pub day: NaiveDate,
+ /// Number of activities on that date.
+ pub count: NonZeroU64,
+}
+
+/// One entity ranked by the number of activities that touched it.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct EntityRank {
+ /// Kind of entity.
+ pub entity_type: EntityType,
+ /// Entity identifier.
+ pub entity_id: String,
+ /// Number of activities that touched the entity.
+ pub count: NonZeroU64,
+}
+
+/// Why aggregate rows cannot form a valid overview.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum ActivityOverviewError {
+ /// A day falls outside the overview window.
+ DayOutsideWindow,
+ /// Day rows are not strictly ascending.
+ DaysNotAscending,
+ /// Summing the day rows exceeds `u64`.
+ TotalOverflow,
+ /// More ranked entities were supplied than the product permits.
+ TooManyEntities,
+ /// Entity rows do not follow the stable ranking order.
+ EntitiesNotRanked,
+}
+
+impl std::fmt::Display for ActivityOverviewError {
+ fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ match self {
+ Self::DayOutsideWindow => {
+ formatter.write_str("activity overview contains a day outside its window")
+ }
+ Self::DaysNotAscending => {
+ formatter.write_str("activity overview days must be strictly ascending")
+ }
+ Self::TotalOverflow => formatter.write_str("activity overview total exceeds u64"),
+ Self::TooManyEntities => {
+ formatter.write_str("activity overview contains more than eight entities")
+ }
+ Self::EntitiesNotRanked => {
+ formatter.write_str("activity overview entities are not stably ranked")
+ }
+ }
+ }
+}
+
+impl std::error::Error for ActivityOverviewError {}
+
+/// Sparse daily counts and a stable entity ranking over one window.
+#[readonly::make]
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct ActivityOverview {
+ /// Window covered by both aggregates.
+ pub window: ActivityWindow,
+ /// Sparse positive day counts in ascending date order.
+ pub days: Vec<DayCount>,
+ /// Top entities ordered by count descending, then type and id ascending.
+ pub top_entities: Vec<EntityRank>,
+}
+
+impl ActivityOverview {
+ /// Builds an overview after validating aggregate ordering and bounds.
+ pub fn new(
+ window: ActivityWindow,
+ days: Vec<DayCount>,
+ top_entities: Vec<EntityRank>,
+ ) -> Result<Self, ActivityOverviewError> {
+ let mut previous_day = None;
+ let mut total = 0_u64;
+ for day in &days {
+ if !window.contains(day.day) {
+ return Err(ActivityOverviewError::DayOutsideWindow);
+ }
+ if previous_day.is_some_and(|previous| previous >= day.day) {
+ return Err(ActivityOverviewError::DaysNotAscending);
+ }
+ total = total
+ .checked_add(day.count.get())
+ .ok_or(ActivityOverviewError::TotalOverflow)?;
+ previous_day = Some(day.day);
+ }
+
+ if top_entities.len() > TOP_ENTITY_LIMIT as usize {
+ return Err(ActivityOverviewError::TooManyEntities);
+ }
+ if top_entities.windows(2).any(|pair| {
+ let left = &pair[0];
+ let right = &pair[1];
+ left.count < right.count
+ || (left.count == right.count
+ && (left.entity_type.as_ref(), left.entity_id.as_str())
+ >= (right.entity_type.as_ref(), right.entity_id.as_str()))
+ }) {
+ return Err(ActivityOverviewError::EntitiesNotRanked);
+ }
+
+ Ok(Self {
+ window,
+ days,
+ top_entities,
+ })
+ }
+
+ /// Builds an overview with no activity.
+ pub fn empty(window: ActivityWindow) -> Self {
+ Self {
+ window,
+ days: Vec::new(),
+ top_entities: Vec::new(),
+ }
+ }
+
+ /// Total activities in the window.
+ pub fn total(&self) -> u64 {
+ self.days.iter().map(|day| day.count.get()).sum()
+ }
+}
diff --git a/crates/activity/src/domain/overview/test.rs b/crates/activity/src/domain/overview/test.rs
new file mode 100644
index 0000000000..e22c12c8c6
--- /dev/null
+++ b/crates/activity/src/domain/overview/test.rs
@@ -0,0 +1,148 @@
+use chrono::{NaiveDate, TimeZone};
+
+use super::*;
+
+fn date(year: i32, month: u32, day: u32) -> NaiveDate {
+ NaiveDate::from_ymd_opt(year, month, day).expect("valid test date")
+}
+
+fn count(value: u64) -> NonZeroU64 {
+ NonZeroU64::new(value).expect("positive test count")
+}
+
+fn window() -> ActivityWindow {
+ ActivityWindow::new(chrono_tz::UTC, date(2026, 1, 1), date(2026, 1, 4)).unwrap()
+}
+
+fn rank(entity_id: &str, value: u64) -> EntityRank {
+ EntityRank {
+ entity_type: EntityType::Document,
+ entity_id: entity_id.to_owned(),
+ count: count(value),
+ }
+}
+
+#[test]
+fn windows_reject_empty_reversed_and_overwide_spans() {
+ let start = date(2026, 1, 1);
+
+ assert_eq!(
+ ActivityWindow::new(chrono_tz::UTC, start, start),
+ Err(ActivityWindowError::Empty)
+ );
+ assert_eq!(
+ ActivityWindow::new(chrono_tz::UTC, start, date(2025, 12, 31)),
+ Err(ActivityWindowError::Empty)
+ );
+ assert_eq!(
+ ActivityWindow::new(
+ chrono_tz::UTC,
+ start,
+ start + chrono::Duration::days(MAX_ACTIVITY_WINDOW_DAYS + 1),
+ ),
+ Err(ActivityWindowError::TooWide)
+ );
+ assert!(
+ ActivityWindow::new(
+ chrono_tz::UTC,
+ start,
+ start + chrono::Duration::days(MAX_ACTIVITY_WINDOW_DAYS),
+ )
+ .is_ok()
+ );
+}
+
+#[test]
+fn trailing_year_uses_the_viewers_local_date() {
+ let now = Utc.with_ymd_and_hms(2026, 1, 1, 1, 30, 0).unwrap();
+ let window = trailing_year(now, chrono_tz::America::Los_Angeles);
+
+ assert_eq!(window.end, date(2026, 1, 1));
+ assert_eq!(window.start, date(2025, 1, 1));
+ assert_eq!(
+ window.end.signed_duration_since(window.start).num_days(),
+ 365
+ );
+}
+
+#[test]
+fn overview_is_sparse_ordered_bounded_and_totals_its_days() {
+ let overview = ActivityOverview::new(
+ window(),
+ vec![
+ DayCount {
+ day: date(2026, 1, 1),
+ count: count(2),
+ },
+ DayCount {
+ day: date(2026, 1, 3),
+ count: count(5),
+ },
+ ],
+ vec![rank("a", 5), rank("b", 2)],
+ )
+ .unwrap();
+
+ assert_eq!(overview.total(), 7);
+ assert_eq!(overview.days.len(), 2);
+}
+
+#[test]
+fn overview_rejects_days_outside_or_not_strictly_ascending() {
+ let outside = ActivityOverview::new(
+ window(),
+ vec![DayCount {
+ day: date(2026, 1, 4),
+ count: count(1),
+ }],
+ Vec::new(),
+ );
+ assert_eq!(outside, Err(ActivityOverviewError::DayOutsideWindow));
+
+ let repeated = ActivityOverview::new(
+ window(),
+ vec![
+ DayCount {
+ day: date(2026, 1, 2),
+ count: count(1),
+ },
+ DayCount {
+ day: date(2026, 1, 2),
+ count: count(2),
+ },
+ ],
+ Vec::new(),
+ );
+ assert_eq!(repeated, Err(ActivityOverviewError::DaysNotAscending));
+}
+
+#[test]
+fn overview_rejects_invalid_rankings_and_total_overflow() {
+ let unsorted = ActivityOverview::new(window(), Vec::new(), vec![rank("a", 1), rank("b", 2)]);
+ assert_eq!(unsorted, Err(ActivityOverviewError::EntitiesNotRanked));
+
+ let too_many = ActivityOverview::new(
+ window(),
+ Vec::new(),
+ (0..=TOP_ENTITY_LIMIT)
+ .map(|index| rank(&format!("{index:02}"), 1))
+ .collect(),
+ );
+ assert_eq!(too_many, Err(ActivityOverviewError::TooManyEntities));
+
+ let overflow = ActivityOverview::new(
+ window(),
+ vec![
+ DayCount {
+ day: date(2026, 1, 1),
+ count: count(u64::MAX),
+ },
+ DayCount {
+ day: date(2026, 1, 2),
+ count: count(1),
+ },
+ ],
+ Vec::new(),
+ );
+ assert_eq!(overflow, Err(ActivityOverviewError::TotalOverflow));
+}
diff --git a/crates/activity/src/domain/ports.rs b/crates/activity/src/domain/ports.rs
index 3e33066808..a06720b7ae 100644
--- a/crates/activity/src/domain/ports.rs
+++ b/crates/activity/src/domain/ports.rs
@@ -7,7 +7,10 @@ use chrono::{DateTime, Utc};
use model_entity::EntityType;
use uuid::Uuid;
-use super::models::{Activity, ActivityRecord};
+use super::{
+ models::{Activity, ActivityRecord},
+ overview::{ActivityOverview, ActivityWindow},
+};
/// Human-readable metadata for a property referenced by an activity event.
#[cfg(feature = "ai_tools")]
@@ -112,6 +115,14 @@ pub trait ActivityReads {
per_entity_limit: u32,
) -> impl Future<Output = Result<EntityActivityMap, Self::Err>> + Send;
+ /// Sparse day counts and the top entities for `subject_id` inside one
+ /// local-date window. Counts every stored action, including views.
+ fn subject_overview(
+ &self,
+ subject_id: &str,
+ window: ActivityWindow,
+ ) -> impl Future<Output = Result<ActivityOverview, Self::Err>> + Send;
+
/// The subject's activity in the half-open interval `[from, to)`, newest
/// first, capped at `limit`. `truncated` reports whether more matching raw
/// rows exist, so callers can disclose that the bounded result is partial.
diff --git a/crates/activity/src/domain/service/test.rs b/crates/activity/src/domain/service/test.rs
index 423c3260d4..2187d35d9c 100644
--- a/crates/activity/src/domain/service/test.rs
+++ b/crates/activity/src/domain/service/test.rs
@@ -40,6 +40,14 @@ impl ActivityReads for FakeReads {
unreachable!()
}
+ async fn subject_overview(
+ &self,
+ _subject_id: &str,
+ _window: crate::domain::overview::ActivityWindow,
+ ) -> Result<crate::domain::overview::ActivityOverview, Self::Err> {
+ unreachable!()
+ }
+
async fn subject_activity_range(
&self,
_subject_id: &str,
diff --git a/crates/activity/src/inbound/toolset/test.rs b/crates/activity/src/inbound/toolset/test.rs
index 3e47160eb7..13aeebceda 100644
--- a/crates/activity/src/inbound/toolset/test.rs
+++ b/crates/activity/src/inbound/toolset/test.rs
@@ -78,6 +78,14 @@ impl ActivityReads for FakeReads {
Ok(HashMap::new())
}
+ async fn subject_overview(
+ &self,
+ _subject_id: &str,
+ window: crate::domain::overview::ActivityWindow,
+ ) -> Result<crate::domain::overview::ActivityOverview, Self::Err> {
+ Ok(crate::domain::overview::ActivityOverview::empty(window))
+ }
+
async fn subject_activity_range(
&self,
subject_id: &str,
diff --git a/crates/activity/src/lib.rs b/crates/activity/src/lib.rs
index 69731373b9..5189b5f412 100644
--- a/crates/activity/src/lib.rs
+++ b/crates/activity/src/lib.rs
@@ -30,6 +30,10 @@ pub use domain::models::{
CallStart, CommonAction, DomainActivity, EntityType, Ingest, ParticipantChange, PropertyChange,
RecordedAction, VIEW_ACTION_TAGS, activity_id, event_time,
};
+pub use domain::overview::{
+ ActivityOverview, ActivityOverviewError, ActivityWindow, ActivityWindowError, DayCount,
+ EntityRank, MAX_ACTIVITY_WINDOW_DAYS, TOP_ENTITY_LIMIT, trailing_year,
+};
pub use domain::ports::{ActivityFeedPage, ActivityRange, ActivityReads, EntityActivityMap};
#[cfg(feature = "ai_tools")]
pub use domain::{
diff --git a/crates/activity/src/outbound/pg_activity_repo.rs b/crates/activity/src/outbound/pg_activity_repo.rs
index 6f6da9ff68..208e0accac 100644
--- a/crates/activity/src/outbound/pg_activity_repo.rs
+++ b/crates/activity/src/outbound/pg_activity_repo.rs
@@ -4,7 +4,7 @@
mod test;
use std::collections::HashMap;
-use std::num::NonZeroU32;
+use std::num::{NonZeroU32, NonZeroU64};
use std::str::FromStr;
use chrono::{DateTime, Utc};
@@ -14,6 +14,7 @@ use uuid::Uuid;
use crate::domain::{
models::{ActionDecodeError, Activity, ActivityRecord, Actor, RecordedAction},
+ overview::{ActivityOverview, ActivityWindow, DayCount, EntityRank, TOP_ENTITY_LIMIT},
ports::{ActivityFeedPage, ActivityRange, ActivityReads, ActivityRepo, EntityActivityMap},
};
@@ -290,6 +291,99 @@ impl ActivityReads for PgActivityRepo {
}
Ok(by_entity)
}
+ async fn subject_overview(
+ &self,
+ subject_id: &str,
+ window: ActivityWindow,
+ ) -> Result<ActivityOverview, Self::Err> {
+ let zone = window.zone.name();
+ let rankable_entity_types = rankable_entity_types();
+ // `timestamp AT TIME ZONE` picks the later UTC instant when local
+ // midnight is repeated (Havana 2026-11-01 is 04:00Z and 05:00Z).
+ // Widen the sargable envelope, then keep rows by local date so the
+ // first midnight is included and the exclusive end stays exclusive.
+ let day_rows = sqlx::query!(
+ r#"
+ SELECT (occurred_at AT TIME ZONE $1)::date AS "day!",
+ count(*)::bigint AS "n!"
+ FROM activity_events
+ WHERE subject_id = $2
+ AND occurred_at >= ($3::date::timestamp AT TIME ZONE $1)
+ - INTERVAL '26 hours'
+ AND occurred_at < ($4::date::timestamp AT TIME ZONE $1)
+ AND (occurred_at AT TIME ZONE $1)::date >= $3::date
+ AND (occurred_at AT TIME ZONE $1)::date < $4::date
+ GROUP BY 1
+ ORDER BY 1
+ "#,
+ zone,
+ subject_id,
+ window.start,
+ window.end,
+ )
+ .fetch_all(&self.pool)
+ .await?;
+
+ let rank_rows = sqlx::query!(
+ r#"
+ SELECT entity_type, entity_id, count(*)::bigint AS "n!"
+ FROM activity_events
+ WHERE subject_id = $2
+ AND occurred_at >= ($3::date::timestamp AT TIME ZONE $1)
+ - INTERVAL '26 hours'
+ AND occurred_at < ($4::date::timestamp AT TIME ZONE $1)
+ AND (occurred_at AT TIME ZONE $1)::date >= $3::date
+ AND (occurred_at AT TIME ZONE $1)::date < $4::date
+ AND entity_type = ANY($5::text[])
+ GROUP BY 1, 2
+ ORDER BY count(*) DESC, entity_type ASC, entity_id ASC
+ LIMIT $6
+ "#,
+ zone,
+ subject_id,
+ window.start,
+ window.end,
+ &rankable_entity_types,
+ TOP_ENTITY_LIMIT,
+ )
+ .fetch_all(&self.pool)
+ .await?;
+
+ let days = day_rows
+ .into_iter()
+ .map(|row| {
+ Ok(DayCount {
+ day: row.day,
+ count: positive_count(row.n)?,
+ })
+ })
+ .collect::<Result<Vec<_>, sqlx::Error>>()?;
+
+ let mut top_entities = Vec::with_capacity(rank_rows.len());
+ for row in rank_rows {
+ let Some(entity_type) = EntityType::from_str(&row.entity_type)
+ .inspect_err(|error| {
+ tracing::warn!(
+ entity_type = %row.entity_type,
+ entity_id = %row.entity_id,
+ ?error,
+ "skipping activity rank with unknown entity type"
+ );
+ })
+ .ok()
+ else {
+ continue;
+ };
+ top_entities.push(EntityRank {
+ entity_type,
+ entity_id: row.entity_id,
+ count: positive_count(row.n)?,
+ });
+ }
+
+ ActivityOverview::new(window, days, top_entities)
+ .map_err(|error| sqlx::Error::Decode(Box::new(error)))
+ }
async fn subject_activity_range(
&self,
@@ -328,3 +422,69 @@ impl ActivityReads for PgActivityRepo {
})
}
}
+
+/// Compile-fails when [`EntityType`] grows a variant that is missing from
+/// [`rankable_entity_types`].
+#[allow(dead_code)]
+const fn _rankable_entity_types_are_exhaustive(entity_type: EntityType) {
+ match entity_type {
+ EntityType::User
+ | EntityType::Chat
+ | EntityType::Channel
+ | EntityType::ChannelMessage
+ | EntityType::Document
+ | EntityType::Project
+ | EntityType::EmailThread
+ | EntityType::CalendarEvent
+ | EntityType::Team
+ | EntityType::Call
+ | EntityType::ForeignEntity
+ | EntityType::StaticFile
+ | EntityType::CrmCompany
+ | EntityType::CrmContact
+ | EntityType::Reminder
+ | EntityType::Skill
+ | EntityType::AgentSession => {}
+ }
+}
+
+/// Snake-case names [`EntityType::from_str`] accepts.
+fn rankable_entity_types() -> Vec<String> {
+ [
+ EntityType::User,
+ EntityType::Chat,
+ EntityType::Channel,
+ EntityType::ChannelMessage,
+ EntityType::Document,
+ EntityType::Project,
+ EntityType::EmailThread,
+ EntityType::CalendarEvent,
+ EntityType::Team,
+ EntityType::Call,
+ EntityType::ForeignEntity,
+ EntityType::StaticFile,
+ EntityType::CrmCompany,
+ EntityType::CrmContact,
+ EntityType::Reminder,
+ EntityType::Skill,
+ EntityType::AgentSession,
+ ]
+ .into_iter()
+ .map(|entity_type| entity_type.as_ref().to_owned())
+ .collect()
+}
+
+fn positive_count(value: i64) -> Result<NonZeroU64, sqlx::Error> {
+ u64::try_from(value)
+ .ok()
+ .and_then(NonZeroU64::new)
+ .ok_or_else(|| {
+ sqlx::Error::Decode(
+ std::io::Error::new(
+ std::io::ErrorKind::InvalidData,
+ format!("activity aggregate count must be positive, got {value}"),
+ )
+ .into(),
+ )
+ })
+}
diff --git a/crates/activity/src/outbound/pg_activity_repo/test.rs b/crates/activity/src/outbound/pg_activity_repo/test.rs
index 2688d4e1a4..02b46ac2ec 100644
--- a/crates/activity/src/outbound/pg_activity_repo/test.rs
+++ b/crates/activity/src/outbound/pg_activity_repo/test.rs
@@ -118,6 +118,37 @@ fn base_time() -> chrono::DateTime<Utc> {
.with_timezone(&Utc)
}
+fn overview_window(
+ zone: chrono_tz::Tz,
+ start: &str,
+ end: &str,
+) -> crate::domain::overview::ActivityWindow {
+ crate::domain::overview::ActivityWindow::new(
+ zone,
+ chrono::NaiveDate::parse_from_str(start, "%Y-%m-%d").unwrap(),
+ chrono::NaiveDate::parse_from_str(end, "%Y-%m-%d").unwrap(),
+ )
+ .unwrap()
+}
+
+fn seed_for_subject_at(
+ source_event: u128,
+ subject_id: &str,
+ entity_id: &str,
+ occurred_at: chrono::DateTime<Utc>,
+) -> Activity {
+ Activity::common(
+ Uuid::from_u128(source_event),
+ 0,
+ Actor::new_from_user(user("macro|[email protected]")),
+ Some(user(subject_id)),
+ model_entity::EntityType::Document,
+ entity_id,
+ CommonAction::Edited,
+ occurred_at,
+ )
+}
+
#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
async fn subject_feed_pages_by_keyset_newest_first(pool: PgPool) {
let repo = PgActivityRepo::new(pool.clone());
@@ -453,3 +484,267 @@ async fn a_corrupt_row_shrinks_the_page_but_never_ends_pagination(pool: PgPool)
assert_eq!(second.records[0].entity_id, "doc-old");
assert_eq!(second.next, None);
}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn subject_overview_filters_subject_and_window_and_orders_sparse_aggregates(pool: PgPool) {
+ let repo = PgActivityRepo::new(pool.clone());
+ let subject = "macro|[email protected]";
+ let start = base_time();
+ let mut activities = Vec::new();
+ let mut source = 100_u128;
+ for (entity_id, day, copies) in [("doc-a", 0_i64, 2_u32), ("doc-c", 1, 3), ("doc-b", 2, 2)] {
+ for minute in 0..copies {
+ activities.push(seed_for_subject_at(
+ source,
+ subject,
+ entity_id,
+ start + chrono::Duration::days(day) + chrono::Duration::minutes(i64::from(minute)),
+ ));
+ source += 1;
+ }
+ }
+ activities.push(seed_for_subject_at(
+ source,
+ subject,
+ "doc-outside",
+ start + chrono::Duration::days(3),
+ ));
+ activities.push(seed_for_subject_at(
+ source + 1,
+ "doc-other-subject",
+ start + chrono::Duration::days(1),
+ ));
+ repo.insert_activities(&activities).await.unwrap();
+ sqlx::query!(
+ r#"
+ INSERT INTO activity_events
+ (id, actor_id, subject_id, action, action_payload,
+ entity_type, entity_id, occurred_at)
+ VALUES ($1, 'macro|[email protected]', $2, 'edited', NULL,
+ 'future_entity', 'future-1', $3)
+ "#,
+ Uuid::from_u128(source + 2),
+ subject,
+ start + chrono::Duration::days(1),
+ )
+ .execute(&pool)
+ .await
+ .unwrap();
+
+ let overview = repo
+ .subject_overview(
+ subject,
+ overview_window(chrono_tz::UTC, "2026-08-01", "2026-08-04"),
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(
+ overview
+ .days
+ .iter()
+ .map(|day| (day.day.to_string(), day.count.get()))
+ .collect::<Vec<_>>(),
+ vec![
+ ("2026-08-01".to_owned(), 2),
+ ("2026-08-02".to_owned(), 4),
+ ("2026-08-03".to_owned(), 2),
+ ]
+ );
+ assert_eq!(overview.total(), 8);
+ assert_eq!(
+ overview
+ .top_entities
+ .iter()
+ .map(|rank| (rank.entity_id.as_str(), rank.count.get()))
+ .collect::<Vec<_>>(),
+ vec![("doc-c", 3), ("doc-a", 2), ("doc-b", 2)]
+ );
+
+ let empty = repo
+ .subject_overview(
+ overview_window(chrono_tz::UTC, "2026-08-01", "2026-08-04"),
+ )
+ .await
+ .unwrap();
+ assert!(empty.days.is_empty());
+ assert!(empty.top_entities.is_empty());
+ assert_eq!(empty.total(), 0);
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn subject_overview_buckets_fifteen_minute_rows_across_havana_midnights(pool: PgPool) {
+ let repo = PgActivityRepo::new(pool);
+ let subject = "macro|[email protected]";
+ let transition_starts = [
+ ("2026-03-08T04:00:00Z", "spring"),
+ ("2026-11-01T04:00:00Z", "fall"),
+ ];
+ let mut activities = Vec::new();
+ let mut source = 200_u128;
+ for (start, entity_id) in transition_starts {
+ let start = chrono::DateTime::parse_from_rfc3339(start)
+ .unwrap()
+ .with_timezone(&Utc);
+ for quarter_hour in 0..=8_i64 {
+ activities.push(seed_for_subject_at(
+ source,
+ subject,
+ entity_id,
+ start + chrono::Duration::minutes(quarter_hour * 15),
+ ));
+ source += 1;
+ }
+ }
+ repo.insert_activities(&activities).await.unwrap();
+
+ let overview = repo
+ .subject_overview(
+ subject,
+ overview_window(chrono_tz::America::Havana, "2026-03-07", "2026-11-02"),
+ )
+ .await
+ .unwrap();
+
+ assert_eq!(
+ overview
+ .days
+ .iter()
+ .map(|day| (day.day.to_string(), day.count.get()))
+ .collect::<Vec<_>>(),
+ vec![
+ ("2026-03-07".to_owned(), 4),
+ ("2026-03-08".to_owned(), 5),
+ ("2026-11-01".to_owned(), 9),
+ ]
+ );
+ assert_eq!(overview.total(), 18);
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn subject_overview_ranks_known_entities_when_unknown_type_outcounts_them(pool: PgPool) {
+ let repo = PgActivityRepo::new(pool.clone());
+ let subject = "macro|[email protected]";
+ let start = base_time();
+ let mut activities = Vec::new();
+ let mut source = 300_u128;
+ for index in 0..TOP_ENTITY_LIMIT {
+ let copies = (TOP_ENTITY_LIMIT - index) as u32;
+ for minute in 0..copies {
+ activities.push(seed_for_subject_at(
+ source,
+ subject,
+ &format!("doc-{index}"),
+ start + chrono::Duration::minutes(i64::from(minute)),
+ ));
+ source += 1;
+ }
+ }
+ repo.insert_activities(&activities).await.unwrap();
+ for copy in 0..(TOP_ENTITY_LIMIT + 1) {
+ sqlx::query!(
+ r#"
+ INSERT INTO activity_events
+ (id, actor_id, subject_id, action, action_payload,
+ entity_type, entity_id, occurred_at)
+ VALUES ($1, 'macro|[email protected]', $2, 'edited', NULL,
+ 'future_entity', 'future-top', $3)
+ "#,
+ Uuid::from_u128(source),
+ subject,
+ start + chrono::Duration::hours(i64::from(copy)),
+ )
+ .execute(&pool)
+ .await
+ .unwrap();
+ source += 1;
+ }
+
+ let overview = repo
+ .subject_overview(
+ subject,
+ overview_window(chrono_tz::UTC, "2026-08-01", "2026-08-02"),
+ )
+ .await
+ .unwrap();
+
+ let ranked: Vec<(String, u64)> = overview
+ .top_entities
+ .iter()
+ .map(|rank| (rank.entity_id.clone(), rank.count.get()))
+ .collect();
+ let expected: Vec<(String, u64)> = (0..TOP_ENTITY_LIMIT)
+ .map(|index| (format!("doc-{index}"), (TOP_ENTITY_LIMIT - index) as u64))
+ .collect();
+ assert_eq!(ranked, expected);
+}
+
+#[sqlx::test(migrator = "MACRO_DB_MIGRATIONS")]
+async fn subject_overview_includes_first_havana_midnight_when_window_starts_on_fallback(
+ pool: PgPool,
+) {
+ let repo = PgActivityRepo::new(pool);
+ let subject = "macro|[email protected]";
+ let first_midnight = chrono::DateTime::parse_from_rfc3339("2026-11-01T04:00:00Z")
+ .unwrap()
+ .with_timezone(&Utc);
+ let mut activities = Vec::new();
+ let mut source = 400_u128;
+ for (offset_minutes, entity_id) in [
+ (0_i64, "before-later-midnight"),
+ (15, "still-before-later-midnight"),
+ (60, "at-later-midnight"),
+ (75, "after-later-midnight"),
+ ] {
+ activities.push(seed_for_subject_at(
+ source,
+ subject,
+ entity_id,
+ first_midnight + chrono::Duration::minutes(offset_minutes),
+ ));
+ source += 1;
+ }
+ activities.push(seed_for_subject_at(
+ source,
+ subject,
+ "previous-day",
+ first_midnight - chrono::Duration::minutes(15),
+ ));
+ repo.insert_activities(&activities).await.unwrap();
+
+ let starting_on_fallback = repo
+ .subject_overview(
+ subject,
+ overview_window(chrono_tz::America::Havana, "2026-11-01", "2026-11-02"),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ starting_on_fallback
+ .days
+ .iter()
+ .map(|day| (day.day.to_string(), day.count.get()))
+ .collect::<Vec<_>>(),
+ vec![("2026-11-01".to_owned(), 4)]
+ );
+ assert_eq!(starting_on_fallback.total(), 4);
+
+ let ending_on_fallback = repo
+ .subject_overview(
+ subject,
+ overview_window(chrono_tz::America::Havana, "2026-10-31", "2026-11-01"),
+ )
+ .await
+ .unwrap();
+ assert_eq!(
+ ending_on_fallback
+ .days
+ .iter()
+ .map(|day| (day.day.to_string(), day.count.get()))
+ .collect::<Vec<_>>(),
+ vec![("2026-10-31".to_owned(), 1)]
+ );
+ assert_eq!(ending_on_fallback.total(), 1);
+}
diff --git a/crates/agent_harness/container/Dockerfile b/crates/agent_harness/container/Dockerfile
index cb3563a6a6..58344eb177 100644
--- a/crates/agent_harness/container/Dockerfile
+++ b/crates/agent_harness/container/Dockerfile
@@ -40,8 +40,14 @@ RUN nix develop --profile /env/.base-root path:/env --command true && \
# Bake the macro repo's dev shell, so sandboxes skip realization entirely
# (git comes from the base shell).
+#
+# Drop stripe-cli from the cloned flake: nixpkgs 1.43.2's checkPhase fails in
+# this sandbox (TestResolvePluginForInstallSucceedsForGAPluginWhenNotLoggedIn)
+# and a cache miss then fails the whole image. Revert once nixpkgs skips that
+# test or ships a cached build.
RUN bash -c 'source /env/dev-env.sh && \
git clone --depth 1 https://github.com/macro-inc/macro.git /tmp/bake && \
+ sed -i "/stripe-cli/d" /tmp/bake/nix/cloud-storage.nix && \
nix develop --accept-flake-config --profile /env/.repo-root path:/tmp/bake --command true && \
nix print-dev-env --accept-flake-config path:/tmp/bake > /env/repo-dev-env.sh && \
rm -rf /tmp/bake' && \
diff --git a/crates/complete_graph/src/lib.rs b/crates/complete_graph/src/lib.rs
index 2ba0344533..c2cdaa0945 100644
--- a/crates/complete_graph/src/lib.rs
+++ b/crates/complete_graph/src/lib.rs
@@ -14,9 +14,11 @@ mod sdl_test;
pub use edges::{SoupEdges, SoupEmailThreadEdges};
pub use graphql_activity::{
- ActivityEdgeKey, ActivityEdgeLoad, ActivityFeedInput, ActivityFeedReader, ActivityPortReader,
- ActivityReader, EntityActivityLoader, GraphqlActivityAction, GraphqlActivityEvent,
- GraphqlActivityPage, NoOpActivityReader, SoupActivityEdgeReader, entity_activity_loader,
+ ActivityEdgeKey, ActivityEdgeLoad, ActivityFeedInput, ActivityFeedReader,
+ ActivityOverviewInput, ActivityPortReader, ActivityReader, EntityActivityLoader,
+ GraphqlActivityAction, GraphqlActivityDay, GraphqlActivityEntityRank, GraphqlActivityEvent,
+ GraphqlActivityOverview, GraphqlActivityPage, NoOpActivityReader, SoupActivityEdgeReader,
+ entity_activity_loader,
};
pub use graphql_channel::{
ChannelActivityAuthorizer, ChannelActivityMutationService, ChannelMutationRoot,
diff --git a/crates/complete_graph/src/schema.rs b/crates/complete_graph/src/schema.rs
index 3a9a607d60..9ce9349b2d 100644
--- a/crates/complete_graph/src/schema.rs
+++ b/crates/complete_graph/src/schema.rs
@@ -12,8 +12,8 @@ use email::{
use entity_access::domain::ports::{EntityAccessService, NoOpEntityAccessService};
use entity_mutation::{EntityMutationService, UnavailableEntityMutationService};
use graphql_activity::{
- ActivityFeedInput, ActivityReader, GraphqlActivityPage, NoOpActivityReader,
- resolve_activity_feed,
+ ActivityFeedInput, ActivityOverviewInput, ActivityReader, GraphqlActivityOverview,
+ GraphqlActivityPage, NoOpActivityReader, resolve_activity_feed, resolve_activity_overview,
};
use graphql_channel::{
ChannelActivityAuthorizer, ChannelActivityMutationService, ChannelMutationRoot,
@@ -536,6 +536,16 @@ where
resolve_activity_feed::<AcR>(ctx, &self.user_id, input).await
}
+ /// The authenticated user's activity over the trailing year, bucketed
+ /// into local dates in the requested time zone.
+ async fn activity_overview(
+ &self,
+ ctx: &Context<'_>,
+ input: ActivityOverviewInput,
+ ) -> async_graphql::Result<GraphqlActivityOverview> {
+ resolve_activity_overview::<AcR>(ctx, &self.user_id, input).await
+ }
+
/// Authenticated user email catalog fields supplied by `graphql_email`.
#[graphql(flatten)]
async fn email(&self, ctx: &Context<'_>) -> async_graphql::Result<GraphqlEmailQuery<E>> {
diff --git a/crates/complete_graph/src/schema/test.rs b/crates/complete_graph/src/schema/test.rs
index ec3ce9c0d8..69edc7aa22 100644
--- a/crates/complete_graph/src/schema/test.rs
+++ b/crates/complete_graph/src/schema/test.rs
@@ -489,6 +489,7 @@ impl graphql_email::SoupEmailContentEdgeReader for RecordingEmailContentReader {
struct RecordingActivityReader {
edge_calls: Arc<Mutex<Vec<Vec<graphql_activity::ActivityEdgeKey>>>>,
feed_calls: Arc<Mutex<Vec<(String, Option<(chrono::DateTime<chrono::Utc>, Uuid)>, u32)>>>,
+ overview_calls: Arc<Mutex<Vec<(String, activity::ActivityWindow)>>>,
records: Arc<Mutex<Vec<activity::ActivityRecord>>>,
}
@@ -560,6 +561,30 @@ impl graphql_activity::ActivityFeedReader for RecordingActivityReader {
next,
})
}
+
+ async fn subject_overview(
+ &self,
+ subject_id: &str,
+ window: activity::ActivityWindow,
+ ) -> Result<activity::ActivityOverview, graphql_activity::ActivityReadFailed> {
+ self.overview_calls
+ .lock()
+ .expect("activity overview calls lock")
+ .push((subject_id.to_owned(), window.clone()));
+ Ok(activity::ActivityOverview::new(
+ window.clone(),
+ vec![activity::DayCount {
+ day: window.start,
+ count: std::num::NonZeroU64::new(2).unwrap(),
+ }],
+ vec![activity::EntityRank {
+ entity_type: ModelEntityType::Document,
+ entity_id: "overview-doc".to_owned(),
+ count: std::num::NonZeroU64::new(2).unwrap(),
+ }],
+ )
+ .unwrap())
+ }
}
fn parsed_message(thread_id: Uuid) -> ParsedMessage {
@@ -1629,6 +1654,40 @@ async fn activity_feed_pages_by_cursor_and_carries_unknown_actions() {
assert_eq!(cursor_id, Uuid::from_u128(2));
}
+#[tokio::test]
+async fn activity_overview_uses_the_authenticated_subject_and_requested_zone() {
+ let harness = harness();
+
+ let response = harness
+ .execute(
+ r#"{ user { activityOverview(input: {timeZone: "America/Havana"}) { from to timeZone total days { date count } topEntities { entityType entityId count } } } }"#,
+ )
+ .await;
+
+ assert!(response.errors.is_empty(), "{:?}", response.errors);
+ let calls = harness
+ .activity_reader
+ .overview_calls
+ .lock()
+ .expect("activity overview calls lock")
+ .clone();
+ assert_eq!(calls.len(), 1);
+ assert_eq!(calls[0].0, VALID_USER_ID);
+ assert_eq!(calls[0].1.zone.name(), "America/Havana");
+
+ let data = response.data.into_json().unwrap();
+ let overview = &data["user"]["activityOverview"];
+ assert_eq!(overview["from"], calls[0].1.start.to_string());
+ assert_eq!(overview["to"], calls[0].1.end.to_string());
+ assert_eq!(overview["timeZone"], "America/Havana");
+ assert_eq!(overview["total"], 2);
+ assert_eq!(overview["days"][0]["date"], calls[0].1.start.to_string());
+ assert_eq!(overview["days"][0]["count"], 2);
+ assert_eq!(overview["topEntities"][0]["entityType"], "DOCUMENT");
+ assert_eq!(overview["topEntities"][0]["entityId"], "overview-doc");
+ assert_eq!(overview["topEntities"][0]["count"], 2);
+}
+
#[tokio::test]
async fn email_message_full_fields_request_the_full_edge_payload() {
let harness = harness();
diff --git a/crates/complete_graph/src/sdl_test.rs b/crates/complete_graph/src/sdl_test.rs
index f60c802284..3b2ada5777 100644
--- a/crates/complete_graph/src/sdl_test.rs
+++ b/crates/complete_graph/src/sdl_test.rs
@@ -130,6 +130,36 @@ fn soup_response_schema_exposes_frontend_fields() {
);
}
+#[test]
+fn activity_overview_is_a_user_scoped_embedded_value() {
+ use apollo_compiler::schema::ExtendedType;
+
+ let schema =
+ apollo_compiler::Schema::parse_and_validate(crate::build_schema().sdl(), "schema.graphql")
+ .expect("generated SDL is valid");
+ let ExtendedType::Object(user) = schema.types.get("GraphqlUser").expect("user type exists")
+ else {
+ panic!("GraphqlUser must be an object");
+ };
+ assert!(user.fields.contains_key("activityOverview"));
+
+ for name in [
+ "GraphqlActivityOverview",
+ "GraphqlActivityDay",
+ "GraphqlActivityEntityRank",
+ ] {
+ let ExtendedType::Object(value) =
+ schema.types.get(name).expect("overview value type exists")
+ else {
+ panic!("{name} must be an object");
+ };
+ assert!(
+ !value.fields.contains_key("id"),
+ "{name} must remain embedded under GraphqlUser"
+ );
+ }
+}
+
#[test]
fn soup_interface_exposes_the_complete_shared_entity_contract() {
use apollo_compiler::schema::ExtendedType;
diff --git a/crates/graphql_activity/Cargo.toml b/crates/graphql_activity/Cargo.toml
index 35e4cb2eac..b38d01c6f1 100644
--- a/crates/graphql_activity/Cargo.toml
+++ b/crates/graphql_activity/Cargo.toml
@@ -8,6 +8,7 @@ version = "0.1.0"
activity = { path = "../activity", default-features = false }
async-graphql = { workspace = true, features = ["dataloader"] }
chrono = { workspace = true }
+chrono-tz = { workspace = true }
futures = { workspace = true }
graphql_common = { path = "../graphql_common" }
macro_user_id = { path = "../macro_user_id" }
diff --git a/crates/graphql_activity/src/lib.rs b/crates/graphql_activity/src/lib.rs
index b78d29fd57..67c65d1ff4 100644
--- a/crates/graphql_activity/src/lib.rs
+++ b/crates/graphql_activity/src/lib.rs
@@ -2,10 +2,12 @@
#![deny(clippy::missing_docs_in_private_items)]
//! GraphQL adapter for the activity system.
//!
-//! Two read surfaces over the `activity_events` log:
+//! Three read surfaces over the `activity_events` log:
//!
//! - the authenticated user's own feed ([`resolve_activity_feed`]), a
//! keyset-paginated field on `GraphqlUser`;
+//! - the authenticated user's trailing-year aggregate
+//! ([`resolve_activity_overview`]);
//! - a lazily-loaded `activity` edge on every Soup entity, batched across
//! entities through [`EntityActivityLoader`] so it costs nothing when not
//! selected and one query when it is.
@@ -20,6 +22,8 @@ mod feed;
mod loaders;
/// GraphQL objects for activity events and the typed action union.
mod objects;
+/// Trailing-year activity overview input, output, and resolver.
+mod overview;
pub use feed::{
ActivityFeedInput, DEFAULT_ACTIVITY_FEED_LIMIT, GraphqlActivityPage, MAX_ACTIVITY_FEED_LIMIT,
@@ -32,3 +36,7 @@ pub use loaders::{
parse_activity_edge_limit,
};
pub use objects::{GraphqlActivityAction, GraphqlActivityEvent};
+pub use overview::{
+ ActivityOverviewInput, GraphqlActivityDay, GraphqlActivityEntityRank, GraphqlActivityOverview,
+ resolve_activity_overview,
+};
diff --git a/crates/graphql_activity/src/loaders.rs b/crates/graphql_activity/src/loaders.rs
index e60f8064e2..bf77930d4b 100644
--- a/crates/graphql_activity/src/loaders.rs
+++ b/crates/graphql_activity/src/loaders.rs
@@ -1,6 +1,8 @@
use std::{collections::HashMap, num::NonZeroU32, sync::Arc};
-use activity::{ActivityFeedPage, ActivityReads, ActivityRecord, EntityType};
+use activity::{
+ ActivityFeedPage, ActivityOverview, ActivityReads, ActivityRecord, ActivityWindow, EntityType,
+};
use async_graphql::dataloader::{DataLoader, Loader};
use chrono::{DateTime, Utc};
use futures::StreamExt;
@@ -75,6 +77,13 @@ pub trait ActivityFeedReader: Send + Sync + 'static {
cursor: Option<(DateTime<Utc>, Uuid)>,
limit: NonZeroU32,
) -> impl Future<Output = Result<ActivityFeedPage, ActivityReadFailed>> + Send + 'a;
+
+ /// Aggregate the subject's activity inside one local-date window.
+ fn subject_overview<'a>(
+ &'a self,
+ subject_id: &'a str,
+ window: ActivityWindow,
+ ) -> impl Future<Output = Result<ActivityOverview, ActivityReadFailed>> + Send + 'a;
}
/// Combined reader capability required by the complete activity surface —
@@ -110,6 +119,14 @@ impl ActivityFeedReader for NoOpActivityReader {
next: None,
})
}
+
+ async fn subject_overview(
+ &self,
+ _subject_id: &str,
+ window: ActivityWindow,
+ ) -> Result<ActivityOverview, ActivityReadFailed> {
+ Ok(ActivityOverview::empty(window))
+ }
}
/// Reader backed by the activity storage port, supplied by the application
@@ -201,6 +218,20 @@ where
ActivityReadFailed
})
}
+
+ async fn subject_overview(
+ &self,
+ subject_id: &str,
+ window: ActivityWindow,
+ ) -> Result<ActivityOverview, ActivityReadFailed> {
+ self.reads
+ .subject_overview(subject_id, window)
+ .await
+ .inspect_err(|error| {
+ tracing::error!(error = ?error, "activity overview load failed");
+ })
+ .map_err(|_| ActivityReadFailed)
+ }
}
/// DataLoader for activity attached to Soup entities.
diff --git a/crates/graphql_activity/src/overview.rs b/crates/graphql_activity/src/overview.rs
new file mode 100644
index 0000000000..047c2618a5
--- /dev/null
+++ b/crates/graphql_activity/src/overview.rs
@@ -0,0 +1,147 @@
+use activity::{ActivityOverview, DayCount, EntityRank, trailing_year};
+use async_graphql::{Context, ID, InputObject, SimpleObject};
+use chrono::Utc;
+use chrono_tz::Tz;
+use graphql_common::GraphqlEntityType;
+use macro_user_id::user_id::MacroUserIdStr;
+
+use crate::loaders::ActivityFeedReader;
+
+#[cfg(test)]
+mod test;
+
+/// Request for the authenticated user's trailing-year activity overview.
+#[derive(InputObject)]
+pub struct ActivityOverviewInput {
+ /// IANA time zone used for local dates. Omitted or empty means UTC.
+ pub time_zone: Option<String>,
+}
+
+/// Activity aggregated over the authenticated user's trailing year.
+///
+/// This value has no `id`, so the normalized client cache embeds it under
+/// the authenticated user instead of treating it as a global entity.
+#[derive(SimpleObject)]
+pub struct GraphqlActivityOverview {
+ /// First local date, inclusive, in `YYYY-MM-DD` form.
+ pub from: String,
+ /// One past the final local date, exclusive, in `YYYY-MM-DD` form.
+ pub to: String,
+ /// IANA time zone used for the window and day buckets.
+ pub time_zone: String,
+ /// Total activity in the window.
+ pub total: i32,
+ /// Sparse positive day counts in ascending order.
+ pub days: Vec<GraphqlActivityDay>,
+ /// Most active entities in stable rank order.
+ pub top_entities: Vec<GraphqlActivityEntityRank>,
+}
+
+/// One local date with activity.
+#[derive(SimpleObject)]
+pub struct GraphqlActivityDay {
+ /// Local date in `YYYY-MM-DD` form.
+ pub date: String,
+ /// Number of activities on that date.
+ pub count: i32,
+}
+
+/// One entity ranked by its activity count.
+#[derive(SimpleObject)]
+pub struct GraphqlActivityEntityRank {
+ /// Kind of entity.
+ pub entity_type: GraphqlEntityType,
+ /// Entity identifier.
+ pub entity_id: ID,
+ /// Number of activities that touched the entity.
+ pub count: i32,
+}
+
+impl TryFrom<ActivityOverview> for GraphqlActivityOverview {
+ type Error = async_graphql::Error;
+
+ fn try_from(overview: ActivityOverview) -> Result<Self, Self::Error> {
+ let total = graphql_count(overview.total())?;
+ let days = overview
+ .days
+ .iter()
+ .copied()
+ .map(GraphqlActivityDay::try_from)
+ .collect::<Result<Vec<_>, _>>()?;
+ let top_entities = overview
+ .top_entities
+ .iter()
+ .cloned()
+ .map(GraphqlActivityEntityRank::try_from)
+ .collect::<Result<Vec<_>, _>>()?;
+
+ Ok(Self {
+ from: overview.window.start.to_string(),
+ to: overview.window.end.to_string(),
+ time_zone: overview.window.zone.name().to_owned(),
+ total,
+ days,
+ top_entities,
+ })
+ }
+}
+
+impl TryFrom<DayCount> for GraphqlActivityDay {
+ type Error = async_graphql::Error;
+
+ fn try_from(day: DayCount) -> Result<Self, Self::Error> {
+ Ok(Self {
+ date: day.day.to_string(),
+ count: graphql_count(day.count.get())?,
+ })
+ }
+}
+
+impl TryFrom<EntityRank> for GraphqlActivityEntityRank {
+ type Error = async_graphql::Error;
+
+ fn try_from(rank: EntityRank) -> Result<Self, Self::Error> {
+ Ok(Self {
+ entity_type: GraphqlEntityType::new(rank.entity_type),
+ entity_id: ID(rank.entity_id),
+ count: graphql_count(rank.count.get())?,
+ })
+ }
+}
+
+/// Narrow a domain count to GraphQL `Int`, rejecting overflow.
+fn graphql_count(count: u64) -> async_graphql::Result<i32> {
+ i32::try_from(count)
+ .map_err(|_| async_graphql::Error::new("activity count exceeds GraphQL Int"))
+}
+
+/// Parse an optional IANA zone name; omitted or empty means UTC.
+fn parse_time_zone(time_zone: Option<String>) -> async_graphql::Result<Tz> {
+ let Some(time_zone) = time_zone.filter(|zone| !zone.is_empty()) else {
+ return Ok(chrono_tz::UTC);
+ };
+ time_zone
+ .parse()
+ .map_err(|_| async_graphql::Error::new("invalid timeZone: expected an IANA zone name"))
+}
+
+/// Resolve the authenticated user's activity overview.
+pub async fn resolve_activity_overview<R>(
+ ctx: &Context<'_>,
+ user_id: &MacroUserIdStr<'static>,
+ input: ActivityOverviewInput,
+) -> async_graphql::Result<GraphqlActivityOverview>
+where
+ R: ActivityFeedReader,
+{
+ let reader = ctx.data::<R>()?;
+ let zone = parse_time_zone(input.time_zone)?;
+ let window = trailing_year(Utc::now(), zone);
+ let overview = reader
+ .subject_overview(user_id.as_ref(), window)
+ .await
+ .map_err(|_| async_graphql::Error::new("activity overview is unavailable"))?;
+ overview
+ .try_into()
+ .map_err(|_| async_graphql::Error::new("activity overview is unavailable"))
+}
diff --git a/crates/graphql_activity/src/overview/test.rs b/crates/graphql_activity/src/overview/test.rs
new file mode 100644
index 0000000000..b56d3f4de8
--- /dev/null
+++ b/crates/graphql_activity/src/overview/test.rs
@@ -0,0 +1,89 @@
+use std::num::NonZeroU64;
+
+use activity::ActivityWindow;
+use chrono::NaiveDate;
+
+use super::*;
+
+fn date(value: &str) -> NaiveDate {
+ NaiveDate::parse_from_str(value, "%Y-%m-%d").expect("valid test date")
+}
+
+fn count(value: u64) -> NonZeroU64 {
+ NonZeroU64::new(value).expect("positive test count")
+}
+
+fn window() -> ActivityWindow {
+ ActivityWindow::new(
+ chrono_tz::America::Havana,
+ date("2026-03-07"),
+ date("2026-03-10"),
+ )
+ .unwrap()
+}
+
+#[test]
+fn omitted_and_empty_time_zones_use_utc() {
+ assert_eq!(parse_time_zone(None).unwrap(), chrono_tz::UTC);
+ assert_eq!(
+ parse_time_zone(Some(String::new())).unwrap(),
+ chrono_tz::UTC
+ );
+}
+
+#[test]
+fn invalid_time_zones_are_client_errors() {
+ let error = parse_time_zone(Some("Not/AZone".to_owned())).unwrap_err();
+ assert_eq!(
+ error.message,
+ "invalid timeZone: expected an IANA zone name"
+ );
+}
+
+#[test]
+fn overview_projection_preserves_the_domain_window_and_order() {
+ let overview = ActivityOverview::new(
+ window(),
+ vec![
+ DayCount {
+ day: date("2026-03-07"),
+ count: count(2),
+ },
+ DayCount {
+ day: date("2026-03-09"),
+ count: count(3),
+ },
+ ],
+ vec![EntityRank {
+ entity_type: activity::EntityType::Document,
+ entity_id: "doc-1".to_owned(),
+ count: count(5),
+ }],
+ )
+ .unwrap();
+
+ let projected = GraphqlActivityOverview::try_from(overview).unwrap();
+
+ assert_eq!(projected.from, "2026-03-07");
+ assert_eq!(projected.to, "2026-03-10");
+ assert_eq!(projected.time_zone, "America/Havana");
+ assert_eq!(projected.total, 5);
+ assert_eq!(projected.days[0].date, "2026-03-07");
+ assert_eq!(projected.days[1].date, "2026-03-09");
+ assert_eq!(projected.top_entities[0].entity_id.as_str(), "doc-1");
+}
+
+#[test]
+fn counts_larger_than_graphql_int_are_rejected() {
+ let overview = ActivityOverview::new(
+ window(),
+ vec![DayCount {
+ day: date("2026-03-07"),
+ count: count(i32::MAX as u64 + 1),
+ }],
+ Vec::new(),
+ )
+ .unwrap();
+
+ assert!(GraphqlActivityOverview::try_from(overview).is_err());
+}
diff --git a/nix/cloud-storage.nix b/nix/cloud-storage.nix
index d4f54bc250..d1c5bbb1ec 100644
--- a/nix/cloud-storage.nix
+++ b/nix/cloud-storage.nix
@@ -887,7 +887,9 @@
doppler
biome
jq
- stripe-cli
+ # TEMP: nixpkgs stripe-cli 1.43.2 checkPhase fails in the sandbox
+ # (TestResolvePluginForInstallSucceedsForGAPluginWhenNotLoggedIn).
+ # stripe-cli
sccache
rustToolchain
python3
diff --git a/static_assets/schema.graphql b/static_assets/schema.graphql
index ea046b5a76..00d0d34531 100644
--- a/static_assets/schema.graphql
+++ b/static_assets/schema.graphql
@@ -13,6 +13,16 @@ input ActivityFeedInput {
limit: Int
}
+"""
+Request for the authenticated user's trailing-year activity overview.
+"""
+input ActivityOverviewInput {
+ """
+ IANA time zone used for local dates. Omitted or empty means UTC.
+ """
+ timeZone: String
+}
+
"""
Channel activity operation exposed by GraphQL.
"""
@@ -226,6 +236,20 @@ type GraphqlActivityCreated {
nothing: Boolean!
}
+"""
+One local date with activity.
+"""
+type GraphqlActivityDay {
+ """
+ Local date in `YYYY-MM-DD` form.
+ """
+ date: String!
+ """
+ Number of activities on that date.
+ """
+ count: Int!
+}
+
"""
The entity was soft-deleted.
"""
@@ -246,6 +270,24 @@ type GraphqlActivityEdited {
nothing: Boolean!
}
+"""
+One entity ranked by its activity count.
+"""
+type GraphqlActivityEntityRank {
+ """
+ Kind of entity.
+ """
+ entityType: GraphqlEntityType!
+ """
+ Entity identifier.
+ """
+ entityId: ID!
+ """
+ Number of activities that touched the entity.
+ """
+ count: Int!
+}
+
"""
One activity: a principal did something to an entity at a time.
@@ -305,6 +347,39 @@ type GraphqlActivityOpened {
nothing: Boolean!
}
+"""
+Activity aggregated over the authenticated user's trailing year.
+
+This value has no `id`, so the normalized client cache embeds it under
+the authenticated user instead of treating it as a global entity.
+"""
+type GraphqlActivityOverview {
+ """
+ First local date, inclusive, in `YYYY-MM-DD` form.
+ """
+ from: String!
+ """
+ One past the final local date, exclusive, in `YYYY-MM-DD` form.
+ """
+ to: String!
+ """
+ IANA time zone used for the window and day buckets.
+ """
+ timeZone: String!
+ """
+ Total activity in the window.
+ """
+ total: Int!
+ """
+ Sparse positive day counts in ascending order.
+ """
+ days: [GraphqlActivityDay!]!
+ """
+ Most active entities in stable rank order.
+ """
+ topEntities: [GraphqlActivityEntityRank!]!
+}
+
"""
One page of the authenticated user's activity, newest first.
"""
@@ -5172,6 +5247,11 @@ type GraphqlUser {
"""
activity(input: ActivityFeedInput!): GraphqlActivityPage!
"""
+ The authenticated user's activity over the trailing year, bucketed
+ into local dates in the requested time zone.
+ """
+ activityOverview(input: ActivityOverviewInput!): GraphqlActivityOverview!
+ """
Labels across every owned or delegated inbox accessible to the authenticated user.
"""
emailLabels: [GraphqlSoupEmailLabel!]!