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.

fix(agents): show live viewers in session headers (#9003)

Wolf Mermelstein08949b0d9366
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 6c5937acaf..d4b93438df 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -209,6 +209,10 @@ the user's newest account for that app from the last fifteen minutes.
### General
+Agent split headers show live viewers through `BlockLiveIndicators` with the
+resolved session ID; keep the existing `AgentSessionProvider` subscription to
+`agent_session` rather than enabling legacy block tracking of placeholder IDs.
+
- Share URL recognition with `packages/lexical-core/utils/auto-link.ts`; preserve explicit unlink markers when saving and rendering messages. See `packages/lexical-core/README.md` at the repository root.
- Empty human DMs use the shared centered conversations graphic and explain email delivery to nonusers; keep this state out of agent DMs, loading/error states, and populated timelines.
- Keep CRM database discovery row-linked and permission-scoped; use horizontally centered actionable list states raised toward the toolbar and shared skeletons, with separate search-empty and retry states. See `src/features/crm/README.md` and `docs/agent-guide/crm.md` at the repo root.
diff --git a/apps/web/src/features/block-agent/component/AgentSplitHeader.tsx b/apps/web/src/features/block-agent/component/AgentSplitHeader.tsx
index cf78e0ae7c..cf136efe57 100644
--- a/apps/web/src/features/block-agent/component/AgentSplitHeader.tsx
+++ b/apps/web/src/features/block-agent/component/AgentSplitHeader.tsx
@@ -6,6 +6,7 @@ import {
ResponsiveBlockToolbar,
ToolButton,
} from '@components/app/ResponsiveBlockToolbar';
+import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';
import type { FileOperation } from '@components/app/split-layout/components/SplitFileMenu';
import {
SplitHeaderLeft,
@@ -13,6 +14,7 @@ import {
} from '@components/app/split-layout/components/SplitHeader';
import { StaticSplitLabel } from '@components/app/split-layout/components/SplitLabel';
import { ProviderIcon } from '@core/component/AI/component/ProviderIcon';
+import { BlockLiveIndicators } from '@core/component/LiveIndicators';
import { Permissions } from '@core/component/SharePermissions';
import { ShareTrigger } from '@core/component/TopBar/ShareButton';
import { useShareModal } from '@core/component/TopBar/shareModal';
@@ -186,6 +188,13 @@ export function AgentSplitHeader(props: {
{/* Session context stays next to the grouped header actions. */}
<SplitHeaderRight>
+ <Show when={props.session && sessionId()}>
+ {(id) => (
+ <HeaderIsland class="-order-1">
+ <BlockLiveIndicators entityId={id} />
+ </HeaderIsland>
+ )}
+ </Show>
<div class="order-[900] flex items-center gap-2 touch:gap-1.5">
<Show when={props.session?.taskId}>
{(taskId) => <AgentTaskChip taskId={taskId()} />}
diff --git a/apps/web/src/lib/core/component/LiveIndicators.tsx b/apps/web/src/lib/core/component/LiveIndicators.tsx
index 97c9f8aa65..2aa318ac3a 100644
--- a/apps/web/src/lib/core/component/LiveIndicators.tsx
+++ b/apps/web/src/lib/core/component/LiveIndicators.tsx
@@ -2,7 +2,7 @@ import { useBlockId } from '@core/block';
import { ENABLE_LIVE_INDICATORS } from '@core/constant/featureFlags';
import { useUserId } from '@core/context/user';
import { AvatarGroup } from '@ui';
-import { createMemo, For, Show } from 'solid-js';
+import { type Accessor, createMemo, For, Show } from 'solid-js';
import { useUserIndicators } from '../state/liveIndicators';
import { UserIcon } from './UserIcon';
@@ -40,9 +40,14 @@ export function LiveIndicators(props: {
);
}
-export function BlockLiveIndicators() {
- const blockId = useBlockId();
- const indicators = useUserIndicators(() => blockId);
+export function BlockLiveIndicators(
+ props: { entityId?: Accessor<string> } = {}
+) {
+ // Session hosts can supply their resolved identity without a legacy block.
+ const blockId = props.entityId ? undefined : useBlockId();
+ const indicators = useUserIndicators(
+ () => props.entityId?.() ?? blockId ?? ''
+ );
const userId = useUserId();
return (
diff --git a/docs/agent-guide/ai-chat.md b/docs/agent-guide/ai-chat.md
index 141542c3a6..225f63cfcd 100644
--- a/docs/agent-guide/ai-chat.md
+++ b/docs/agent-guide/ai-chat.md
@@ -1,5 +1,12 @@
# AI Chat (Agents)
+Agent session split headers show other current viewers' avatars, excluding your
+own, with up to three avatars and a count for additional viewers. Presence uses
+the resolved session ID, including sessions opened from the create menu. Open
+the same shared session in two signed-in browser contexts and check that each
+shows the other viewer; closing one session removes its avatar from the other.
+Desktop and touch headers use the same avatar group.
+
User-sent messages in chat and agent transcripts use an ink-colored bubble with
`InvertUtil` in light themes. Dark themes use `Layer depth={3}` for the slightly
lighter bubble with the normal text palette. Preview Markdown and controls at