Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(channels): make composable and add detail view (#6762)
dev-rbc42521ad60ac
diff --git a/apps/web/src/components/entity-detail/EntityDetail.tsx b/apps/web/src/components/entity-detail/EntityDetail.tsxindex 5bb2e0fcee..786baed04f 100644--- a/apps/web/src/components/entity-detail/EntityDetail.tsx+++ b/apps/web/src/components/entity-detail/EntityDetail.tsx@@ -26,13 +26,16 @@ import {VideoDetail,type VideoDetailContext,} from '@app/features/drive-view/views/VideoDetail';+import { getChannelEntityTarget } from '@app/features/next-soup/utils';import type { MarkdownDocumentKind } from '@block-md/types';+import { ChannelDetail } from '@channel/Channel/ChannelDetail';+import type { ChannelTargetRequest } from '@channel/Channel/ChannelSurface';import { useGlobalBlockOrchestrator } from '@components/app/GlobalAppState';import { PreviewPanel } from '@components/app/PreviewPanel';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import type { BlockAlias, BlockName } from '@core/block';import { fileTypeToBlockName } from '@core/constant/allBlocks';-import { type JSX, Match, Switch } from 'solid-js';+import { createMemo, type JSX, Match, Switch, untrack } from 'solid-js';import type { EntityDetailTarget } from './EntityDetailNavigationStack';export type EntityDetailContext =@@ -100,10 +103,48 @@ export function entityDetailBlockType(}}+type ChannelDetailTarget = {+ channelId: string;+ target: ChannelTargetRequest | undefined;+ fallbackName?: string;+};++function channelDetailTarget(+ target: EntityDetailTarget+): ChannelDetailTarget | undefined {+ if (+ target.type !== 'channel' &&+ target.type !== 'channel_message' &&+ target.type !== 'channel_thread'+ ) {+ return undefined;+ }+ const clickTarget = getChannelEntityTarget(target);+ return {+ channelId: target.type === 'channel' ? target.id : target.channelId,+ target:+ clickTarget?.kind === 'message'+ ? {+ kind: 'message',+ messageId: clickTarget.messageId,+ threadId: clickTarget.threadId,+ }+ : clickTarget,+ fallbackName: target.fallbackName,+ };+}+export function EntityDetail(props: EntityDetailProps) {const documentTarget = () =>props.target.type === 'document' ? props.target : undefined;const blockType = () => entityDetailBlockType(props.target);+ // Resolved once per entry (untracked): a channel row's aim must not shift+ // and re-scroll when its notifications reconcile to read — PreviewPanel+ // applied the same rule by keying navigation on the explicit target only.+ const channelTarget = createMemo(() => {+ const target = props.target;+ return untrack(() => channelDetailTarget(target));+ });const renderChildren = (context: EntityDetailContext) =>props.children?.(context);@@ -185,6 +226,15 @@ export function EntityDetail(props: EntityDetailProps) {{(context) => <>{renderChildren(context)}</>}</UnknownDetail></Match>+ <Match when={channelTarget()}>+ {(channel) => (+ <ChannelDetail+ channelId={channel().channelId}+ target={channel().target}+ fallbackName={channel().fallbackName}+ />+ )}+ </Match><Match when={true}><PreviewPanelEntityDetailtarget={props.target}diff --git a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsxindex 200c023054..d12e98849a 100644--- a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx+++ b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx@@ -9,8 +9,8 @@ import {} from '@app/features/next-soup/actions';import { globalSplitManager } from '@app/signal/splitLayout';import { URL_PARAMS } from '@block-channel/constants';-import { convertTargetMessage } from '@block-channel/utils/target-message';import { ChannelAttachmentsTab } from '@channel/Attachments/ChannelAttachmentsTab';+import { useChannelBotManagement } from '@channel/Bots/use-channel-bot-management';import { useCallContextOptional } from '@channel/Call/CallContext';import { CallEventSync } from '@channel/Call/CallEventSync';import { ChannelCallAutoJoin } from '@channel/Call/ChannelCallAutoJoin';@@ -18,21 +18,20 @@ import { ChannelCallButton } from '@channel/Call/ChannelCallButton';import { ChannelCallTab } from '@channel/Call/ChannelCallTab';import { getCallJoinTab } from '@channel/Call/call-tabs';import { useCall } from '@channel/Call/use-call';-import { isNativeIosCallKitEnabled } from '@channel/Call/use-callkit';import { ChannelCallsTab } from '@channel/Calls/ChannelCallsTab';+import type { MessageTimelineStateSnapshot } from '@channel/Channel/Channel';import {- type ChannelHandle,- type ChannelProps,- type MessageTimelineStateSnapshot,- Channel as NewChannel,-} from '@channel/Channel/Channel';+ ChannelMessages,+ ChannelSurface,+ type ChannelSurfaceApi,+ type ChannelTargetRequest,+} from '@channel/Channel/ChannelSurface';import {ChannelTabProvider,useChannelTab,} from '@channel/Channel/ChannelTabContext';import { ChannelTopBarLiveIndicators } from '@channel/Channel/ChannelTopBarLiveIndicators';import {- CHANNEL_TABS,type ChannelTabId,DEFAULT_CHANNEL_TAB,} from '@channel/Channel/channel-tabs';@@ -41,6 +40,11 @@ import {isJoinCallRequested,isOpenCallTabRequested,} from '@channel/Channel/link';+import {+ canUseInlineCallTab,+ normalizeChannelTab,+ useChannelTabItems,+} from '@channel/Channel/use-channel-tab-items';import { useChannelPictureActions } from '@channel/channel-picture';import { ChannelParticipantsTab } from '@channel/Participants/ChannelParticipantsTab';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';@@ -62,7 +66,7 @@ import {import { useUserId } from '@core/context/user';import { TOKENS } from '@core/hotkey/tokens';import { isMobile } from '@core/mobile/isMobile';-import { awaitCondition, createMethodRegistration } from '@core/orchestrator';+import { createMethodRegistration } from '@core/orchestrator';import { blockHotkeyScopeSignal } from '@core/signal/blockElement';import { blockHandleSignal } from '@core/signal/load';import { buildEntityData } from '@entity';@@ -71,11 +75,6 @@ import RenameIcon from '@phosphor/pencil-line.svg';import TrashIcon from '@phosphor/trash.svg';import { useActiveCallQuery } from '@queries/call/call';import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';-import {- fetchResolvedChannelMessage,- findThreadIdInMessageTimeline,- findTopLevelMessageInMessageTimeline,-} from '@queries/messages/timeline';import { ChannelType } from '@service-storage/generated/schemas/channelType';import { useSearchParams } from '@solidjs/router';import { cn } from '@ui';@@ -89,7 +88,6 @@ import {Switch,} from 'solid-js';import { CHANNEL_TAB_ICONS, ChannelTopLeft } from './Top';-import { useChannelBotManagement } from './useChannelBotManagement';const CHANNEL_STATE_ENTRY_KEY = 'channel.state';@@ -107,30 +105,22 @@ type ChannelEntryStateSnapshot = {messages?: MessageTimelineStateSnapshot;};-type ChannelPropsTargetMessage = Pick<- ChannelProps,- 'targetMessageId' | 'targetMessageReplyId'->;--function CallTabLabel() {- return (- <span class="flex items-center gap-1.5">- <span class="size-1.5 rounded-full bg-success animate-pulse" />- Call- </span>- );+/**+ * Decode channel target params into a surface request. A bare `thread` param+ * becomes a request whose message is the thread root itself, which the+ * surface collapses to a top-level target — same rule convertTargetMessage+ * applied when this decoding lived here.+ */+function toTargetRequest(+ params: ChannelTargetMessageParams+): ChannelTargetRequest | undefined {+ const messageId = params[URL_PARAMS.message];+ const threadId = params[URL_PARAMS.thread];+ const primary = messageId ?? threadId;+ if (!primary) return undefined;+ return { kind: 'message', messageId: primary, threadId };}-const canUseInlineCallTab = () => {- return !isNativeIosCallKitEnabled();-};--// Native iOS CallKit owns the call surface, so the embedded Call tab should-// never become the active channel tab on that platform.-const normalizeChannelTab = (tab: ChannelTabId) => {- return tab === 'call' && !canUseInlineCallTab() ? DEFAULT_CHANNEL_TAB : tab;-};-const initialChannelTab = (options: {wantsJoinCall: boolean;hasActiveCallHere: boolean;@@ -165,30 +155,7 @@ function NewTop(props: { channelId: string }) {(participant.role === 'admin' || participant.role === 'owner')),});- // Show the Call tab whenever we're actually in the call, mid-join, or- // the tab is being displayed (e.g. via the auto-join flow that flips- // `activeTab` to `call` before the join request resolves).- const showCallTab = () =>- ENABLE_CALLS &&- canUseInlineCallTab() &&- (call.isInThisChannel() ||- call.isJoining() ||- activeTab() === 'call' ||- !!activeCallQuery.data);- const availableTabs = () => {- let filtered = [...CHANNEL_TABS];- if (channelType() === ChannelType.direct_message)- filtered = filtered.filter((tab) => tab.value !== 'participants');- if (!ENABLE_CALLS)- filtered = filtered.filter((tab) => tab.value !== 'calls');- if (!showCallTab())- filtered = filtered.filter((tab) => tab.value !== 'call');- return filtered;- };- const tabs = () =>- availableTabs().map((tab) =>- tab.value === 'call' ? { ...tab, label: <CallTabLabel /> } : tab- );+ const tabs = useChannelTabItems(props.channelId);const channelEntity = () => {const ch = channel();@@ -228,7 +195,7 @@ function NewTop(props: { channelId: string }) {options: tabs().map((tab) => ({value: tab.value,label: tab.label,- icon: CHANNEL_TAB_ICONS[tab.value],+ icon: CHANNEL_TAB_ICONS[tab.value as ChannelTabId],})),value: activeTab(),onSelect: (value: string) => setActiveTab(value as ChannelTabId),@@ -419,18 +386,15 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {);const [pendingJoinCall, setPendingJoinCall] = createSignal(wantsJoinCall);- // Set when `<NewChannel>` mounts (Messages tab only); used for goToMessage.- // A signal so goToLocationFromParams can await it via the orchestrator's- // availability primitive when the tab hasn't mounted yet.- const [messagesHandle, setMessagesHandle] = createSignal<ChannelHandle>();- let lastMessagesStateSnapshot = persistedChannelState?.messages;+ // Navigation flows into the surface as state; the messages part navigates+ // whenever a fresh request lands, whether or not it was mounted at the time.+ const [targetRequest, setTargetRequest] = createSignal<+ ChannelTargetRequest | undefined+ >(toTargetRequest(initialTargetMessageParams()));+ let surfaceApi: ChannelSurfaceApi | undefined;const setActiveTab = (tab: ChannelTabId) => {- tab = normalizeChannelTab(tab);- if (tab !== 'messages') {- setMessagesHandle(undefined);- }- setActiveTabInternal(tab);+ setActiveTabInternal(normalizeChannelTab(tab));};const botManagement = useChannelBotManagement({@@ -471,64 +435,6 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {);});- // A mention/link to a thread reply may carry only the message id (the reply)- // without its thread id. Left as-is `convertTargetMessage` would treat that- // reply as a top-level message, which never loads, so the target is never- // highlighted. When only a message id is present, resolve it: a thread reply- // targets its parent thread with the reply id, a top-level message stays as- // itself. An explicit thread id is already unambiguous, so trust it.- const resolveTargetMessage = async (- params: ChannelTargetMessageParams- ): Promise<ChannelPropsTargetMessage> => {- const messageId = params[URL_PARAMS.message] as string | undefined;- const threadId = params[URL_PARAMS.thread] as string | undefined;- if (threadId || !messageId) return convertTargetMessage(params);-- // Cache-first: an already-open channel has the clicked message warm, so a- // plain send (the common inbox-row click) or a reply in a loaded thread- // preview resolves synchronously with no roundtrip. Only a genuinely- // unknown id — an old mention/link opening a cold channel — pays a resolve.- if (- findTopLevelMessageInMessageTimeline(- { type: 'channel', id: channelId },- messageId- )- ) {- return { targetMessageId: messageId, targetMessageReplyId: undefined };- }- const cachedThreadId = findThreadIdInMessageTimeline(- { type: 'channel', id: channelId },- messageId- );- if (cachedThreadId) {- return {- targetMessageId: cachedThreadId,- targetMessageReplyId: messageId,- };- }-- const resolved = await fetchResolvedChannelMessage(- { type: 'channel', id: channelId },- messageId- ).catch(() => undefined);- if (resolved?.kind === 'thread_reply') {- return {- targetMessageId: resolved.thread_id,- targetMessageReplyId: messageId,- };- }- return { targetMessageId: messageId, targetMessageReplyId: undefined };- };-- // The Messages tab may not have mounted yet (e.g. right after the split- // opens). Wait for its handle via the orchestrator's availability primitive.- const awaitMessagesHandle = async () => {- await awaitCondition(() => messagesHandle() !== undefined, 10_000).catch(- () => {}- );- return messagesHandle();- };-// Register on the block always — `goToLocationFromParams` used to live only// inside `onChannelReady` (Messages tab), so open-call from Attachments/etc. was a no-op.createMethodRegistration(blockHandle, {@@ -538,13 +444,10 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {return;}- const { targetMessageId, targetMessageReplyId } =- await resolveTargetMessage(params);-- if (targetMessageId) {+ const target = toTargetRequest(params);+ if (target) {setActiveTab(DEFAULT_CHANNEL_TAB);- const handle = await awaitMessagesHandle();- handle?.goToMessage(targetMessageId, targetMessageReplyId);+ setTargetRequest(target);}if (isJoinCallRequested(params[CHANNEL_URL_PARAMS.joinCall])) {@@ -554,28 +457,16 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {},goToLatest: async () => {setActiveTab(DEFAULT_CHANNEL_TAB);- const handle = await awaitMessagesHandle();- handle?.goToLatest();+ setTargetRequest({ kind: 'latest' });},});- const onChannelReady = (handle: ChannelHandle) => {- setMessagesHandle(() => handle);- };-const disposeChannelStateCaptor = splitPanel.handle.registerEntryStateCaptor(CHANNEL_STATE_ENTRY_KEY,- (): ChannelEntryStateSnapshot => {- const handle = messagesHandle();- const messages = handle- ? handle.getMessagesStateSnapshot()- : lastMessagesStateSnapshot;- lastMessagesStateSnapshot = messages;- return {- activeTab: activeTab(),- messages,- };- }+ (): ChannelEntryStateSnapshot => ({+ activeTab: activeTab(),+ messages: surfaceApi?.getMessagesStateSnapshot(),+ }));onCleanup(disposeChannelStateCaptor);@@ -585,7 +476,14 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {: undefined;return (- <>+ <ChannelSurface+ channelId={channelId}+ targetRequest={targetRequest()}+ initialMessagesState={initialMessagesStateSnapshot()}+ ref={(api) => {+ surfaceApi = api;+ }}+ ><CallEventSync /><ChannelTabProvider activeTab={activeTab} setActiveTab={setActiveTab}><ChannelCallAutoJoin@@ -605,12 +503,8 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {><Switch><Match when={activeTab() === 'messages'}>- <NewChannel- channelId={channelId}- onHandleReady={onChannelReady}+ <ChannelMessagesautofocus={canAutofocusSplitContent && !navigatedFromJK()}- initialMessagesStateSnapshot={initialMessagesStateSnapshot()}- {...convertTargetMessage(initialTargetMessageParams())}/></Match><Match when={activeTab() === 'attachments'}>@@ -638,6 +532,6 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {<NewTop channelId={channelId} /></div></ChannelTabProvider>- </>+ </ChannelSurface>);}diff --git a/apps/web/src/features/block-channel/component/Top.tsx b/apps/web/src/features/block-channel/component/Top.tsxindex e01976a5e3..c00e39ed40 100644--- a/apps/web/src/features/block-channel/component/Top.tsx+++ b/apps/web/src/features/block-channel/component/Top.tsx@@ -1,5 +1,5 @@import type { ChannelTabId } from '@channel/Channel/channel-tabs';-import { ChannelAvatar } from '@channel/channel-avatar';+import { ChannelTopIcon } from '@channel/components/ChannelTopIcon';import { CollapsibleHeaderItem } from '@components/app/split-layout/components/CollapsibleItem';import { HeaderIsland } from '@components/app/split-layout/components/HeaderIsland';import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHeader';@@ -8,9 +8,7 @@ import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { useBlockId } from '@core/block';import type { TabItem } from '@core/component/Tabs';import { TabsInset } from '@core/component/TabsInset';-import { UserIcon } from '@core/component/UserIcon';import { useChannelName } from '@core/context/channels';-import { useUserId } from '@core/context/user';import { isTouchDevice } from '@core/mobile/isTouchDevice';import ChatTextIcon from '@phosphor/chat-text.svg';import PaperclipIcon from '@phosphor/paperclip.svg';@@ -18,7 +16,7 @@ import PhoneIcon from '@phosphor/phone.svg';import PhoneCallIcon from '@phosphor/phone-call.svg';import UsersIcon from '@phosphor/users.svg';import type { ChannelParticipant } from '@queries/channel/types';-import { ChannelType } from '@service-storage/generated/schemas/channelType';+import type { ChannelType } from '@service-storage/generated/schemas/channelType';import { type Component, type JSX, Show } from 'solid-js';export const CHANNEL_TAB_ICONS: Record<@@ -32,37 +30,6 @@ export const CHANNEL_TAB_ICONS: Record<call: PhoneCallIcon,};-type TopIconProps = {- channelId: string;- channelType: ChannelType;- participants: ChannelParticipant[];-};--function TopIcon(props: TopIconProps) {- const userId = useUserId();- const recipient = () => {- return props.participants.find((p) => p && p.user_id !== userId());- };-- return (- <Show- when={props.channelType === ChannelType.direct_message && recipient()}- fallback={- <ChannelAvatar- channelId={props.channelId}- class="size-4 [&_img]:rounded-full"- />- }- >- {(recipient) => {- return (- <UserIcon id={recipient().user_id} isDeleted={false} size="sm" />- );- }}- </Show>- );-}-type TopProps = {channelType: ChannelType;participants: ChannelParticipant[];@@ -100,7 +67,7 @@ export function ChannelTopLeft(props: ChannelTopLeftProps) {<SplitHeaderLeft><HeaderIsland class="shrink"><div class="ph-no-capture z-split-header-content relative flex items-center gap-2 max-w-full h-full shrink min-w-15">- <TopIcon+ <ChannelTopIconchannelId={props.channelId}channelType={props.channelType}participants={props.participants}diff --git a/apps/web/src/features/block-channel/component/useChannelBotManagement.ts b/apps/web/src/features/channel/Bots/use-channel-bot-management.tssimilarity index 100%rename from apps/web/src/features/block-channel/component/useChannelBotManagement.tsrename to apps/web/src/features/channel/Bots/use-channel-bot-management.tsdiff --git a/apps/web/src/features/channel/Channel/ChannelDetail.tsx b/apps/web/src/features/channel/Channel/ChannelDetail.tsxnew file mode 100644index 0000000000..1f5fd673fe--- /dev/null+++ b/apps/web/src/features/channel/Channel/ChannelDetail.tsx@@ -0,0 +1,231 @@+import { ViewShell } from '@app/components/view-shell';+import { ChatWithAgentButton } from '@app/features/chat/ChatWithAgentButton';+import { ChannelAttachmentsTab } from '@channel/Attachments/ChannelAttachmentsTab';+import { useChannelBotManagement } from '@channel/Bots/use-channel-bot-management';+import { useCallContextOptional } from '@channel/Call/CallContext';+import { CallEventSync } from '@channel/Call/CallEventSync';+import { ChannelCallButton } from '@channel/Call/ChannelCallButton';+import { ChannelCallTab } from '@channel/Call/ChannelCallTab';+import { useCall } from '@channel/Call/use-call';+import { ChannelCallsTab } from '@channel/Calls/ChannelCallsTab';+import { ChannelTopIcon } from '@channel/components/ChannelTopIcon';+import { ChannelParticipantsTab } from '@channel/Participants/ChannelParticipantsTab';+import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';+import { TabsInset } from '@core/component/TabsInset';+import { ENABLE_CALLS } from '@core/constant/featureFlags';+import { useChannelName, useChannelType } from '@core/context/channels';+import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';+import {+ createComputed,+ createMemo,+ createSignal,+ Match,+ on,+ onCleanup,+ Show,+ Switch,+} from 'solid-js';+import {+ ChannelMessages,+ ChannelSurface,+ type ChannelTargetRequest,+} from './ChannelSurface';+import { ChannelTabProvider, useChannelTab } from './ChannelTabContext';+import { ChannelLiveIndicators } from './ChannelTopBarLiveIndicators';+import { type ChannelTabId, DEFAULT_CHANNEL_TAB } from './channel-tabs';+import {+ canUseInlineCallTab,+ normalizeChannelTab,+ useChannelTabItems,+} from './use-channel-tab-items';++export type ChannelDetailProps = {+ channelId: string;+ /**+ * Navigation target, compared by value: a changed value re-navigates, a+ * re-derived equal value does not. A host that needs identity-request+ * semantics (re-issuing the same target navigates again) should compose+ * ChannelSurface directly.+ */+ target?: ChannelTargetRequest;+ /** Name shown until the channel loads. */+ fallbackName?: string;+ /** Whether the composer grabs focus on mount. Defaults to false. */+ autofocus?: boolean;+};++function ChannelDetailTopBar(props: {+ channelId: string;+ fallbackName?: string;+}) {+ const { activeTab, setActiveTab } = useChannelTab();+ const tabs = useChannelTabItems(props.channelId);+ const channelName = useChannelName(props.channelId, props.fallbackName);+ const channelType = useChannelType(props.channelId);+ const participantsQuery = useChannelParticipantsQuery(() => props.channelId);+ const participants = () =>+ participantsQuery.isSuccess ? (participantsQuery.data ?? []) : [];+ const call = useCall(() => props.channelId);++ // Seed for "Ask Macro": a new chat with this channel @mentioned, so the+ // user does not have to create an agent and mention the channel by hand.+ const askMacroEntity = () => {+ const type = channelType();+ if (!type) return undefined;+ return {+ type: 'channel' as const,+ id: props.channelId,+ name: channelName() ?? 'New Channel',+ channelType: type,+ };+ };++ return (+ <ViewShell.TopBar class="gap-3">+ <div class="ph-no-capture flex min-w-0 shrink items-center gap-2">+ <ChannelTopIcon+ channelId={props.channelId}+ channelType={channelType()}+ participants={participants()}+ />+ <span class="truncate text-sm font-semibold">+ {channelName() ?? 'New Channel'}+ </span>+ </div>+ <TabsInset+ list={tabs()}+ value={activeTab()}+ onChange={(value) => setActiveTab(value as ChannelTabId)}+ />+ <div class="ml-auto flex shrink-0 items-center gap-2">+ <ChannelLiveIndicators channelId={props.channelId} />+ <Show when={ENABLE_CALLS && !call.isInThisChannel()}>+ <ChannelCallButton channelId={props.channelId} />+ </Show>+ <Show when={askMacroEntity()}>+ {(entity) => (+ <ChatWithAgentButton entity={entity()} label="Ask Macro" />+ )}+ </Show>+ </div>+ </ViewShell.TopBar>+ );+}++function ChannelDetailContent(props: ChannelDetailProps) {+ const panel = useSplitPanelOrThrow();+ const channelId = props.channelId;++ // Convert the value-semantic target prop into identity-stable surface+ // requests: only a changed value produces a new request object.+ let lastTargetKey: string | undefined;+ const targetRequest = createMemo<ChannelTargetRequest | undefined>(+ (previous) => {+ const target = props.target;+ const key = !target+ ? ''+ : target.kind === 'latest'+ ? 'latest'+ : `${target.messageId}:${target.threadId ?? ''}`;+ if (lastTargetKey !== undefined && key === lastTargetKey) return previous;+ lastTargetKey = key;+ return target;+ }+ );++ const callCtx = useCallContextOptional();+ // A channel that owns this client's active call opens on the Call tab, so+ // selecting it never hides the live call — the block adapter's rule.+ const hasActiveCallHere = !!(+ callCtx?.isInCall() && callCtx.activeChannelId() === channelId+ );+ const [activeTab, setActiveTabInternal] = createSignal<ChannelTabId>(+ normalizeChannelTab(hasActiveCallHere ? 'call' : DEFAULT_CHANNEL_TAB)+ );+ const setActiveTab = (tab: ChannelTabId) => {+ setActiveTabInternal(normalizeChannelTab(tab));+ };++ // A new target within the already-mounted channel (a notification jump)+ // must land on the messages pane, whichever tab is open.+ createComputed(+ on(+ targetRequest,+ (request) => {+ if (request) setActiveTab(DEFAULT_CHANNEL_TAB);+ },+ { defer: true }+ )+ );++ // CallContext: which channel has the Call tab selected (for isCallPage(), etc.).+ createComputed(() =>+ callCtx?.syncCallPageTab(channelId, activeTab() === 'call')+ );+ onCleanup(() => callCtx?.syncCallPageTab(channelId, false));++ const botManagement = useChannelBotManagement({+ channelId,+ hotkeyScopeId: panel.splitHotkeyScope,+ openParticipants: () => setActiveTab('participants'),+ });++ return (+ <ChannelSurface channelId={channelId} targetRequest={targetRequest()}>+ <CallEventSync />+ <ChannelTabProvider activeTab={activeTab} setActiveTab={setActiveTab}>+ <div class="flex size-full min-h-0 flex-col">+ <ChannelDetailTopBar+ channelId={channelId}+ fallbackName={props.fallbackName}+ />+ <div class="flex min-h-0 flex-1 flex-col px-2">+ <Switch>+ <Match when={activeTab() === 'messages'}>+ <ChannelMessages autofocus={props.autofocus ?? false} />+ </Match>+ <Match when={activeTab() === 'attachments'}>+ <ChannelAttachmentsTab channelId={channelId} />+ </Match>+ <Match when={activeTab() === 'calls' && ENABLE_CALLS}>+ <ChannelCallsTab channelId={channelId} />+ </Match>+ <Match when={activeTab() === 'participants'}>+ <ChannelParticipantsTab+ channelId={channelId}+ botManagementEnabled={botManagement.enabled()}+ onCreateBot={botManagement.openCreateBot}+ inviteBotFocusRequest={botManagement.inviteFocusRequest()}+ onOpenBot={botManagement.openBot}+ />+ </Match>+ <Match when={activeTab() === 'call' && canUseInlineCallTab()}>+ <ChannelCallTab+ channelId={channelId}+ pendingJoin={() => false}+ />+ </Match>+ </Switch>+ </div>+ </div>+ </ChannelTabProvider>+ </ChannelSurface>+ );+}++/**+ * Default channel detail composed from channel parts (surface, tabs, top-bar+ * pieces) — the channel analogue of MarkdownDetail. Hosts needing a custom+ * arrangement compose ChannelSurface and the parts directly instead.+ *+ * Keys its content by channel id internally: the timeline, controllers, and+ * tab state are per-channel by construction, so a channel switch remounts.+ * Hosts pass a reactive `channelId` and never key their own render.+ */+export function ChannelDetail(props: ChannelDetailProps) {+ return (+ <Show when={props.channelId} keyed>+ {(channelId) => <ChannelDetailContent {...props} channelId={channelId} />}+ </Show>+ );+}diff --git a/apps/web/src/features/channel/Channel/ChannelSurface.tsx b/apps/web/src/features/channel/Channel/ChannelSurface.tsxnew file mode 100644index 0000000000..cc3a34aa6b--- /dev/null+++ b/apps/web/src/features/channel/Channel/ChannelSurface.tsx@@ -0,0 +1,283 @@+import {+ fetchResolvedChannelMessage,+ findThreadIdInMessageTimeline,+ findTopLevelMessageInMessageTimeline,+} from '@queries/messages/timeline';+import type { MessageParent } from '@service-storage/messages';+import {+ type Accessor,+ createComputed,+ createContext,+ createEffect,+ createSignal,+ on,+ onCleanup,+ type ParentProps,+ untrack,+ useContext,+} from 'solid-js';+import {+ Channel,+ type ChannelHandle,+ type MessageTimelineStateSnapshot,+} from './Channel';++/**+ * A navigation intent for a channel. Hosts own this as state and pass it+ * down; a fresh object per user action is what re-navigates, so repeating+ * the same target (re-clicking an inbox row) means creating a new request.+ */+export type ChannelTargetRequest =+ | { kind: 'message'; messageId: string; threadId?: string }+ | { kind: 'latest' };++/** A request resolved against the channel/thread model, identity-stable per request. */+export type ChannelResolvedTarget =+ | { kind: 'latest'; request: ChannelTargetRequest }+ | {+ kind: 'message';+ request: ChannelTargetRequest;+ targetMessageId: string;+ targetMessageReplyId?: string;+ };++export type ChannelSurfaceApi = {+ /** Live timeline state while messages are mounted, else the last state seen. */+ getMessagesStateSnapshot: () => MessageTimelineStateSnapshot | undefined;+};++export type ChannelSurfaceProps = {+ channelId: string;+ /** Latest navigation intent; see {@link ChannelTargetRequest}. */+ targetRequest?: ChannelTargetRequest;+ /** Timeline state to restore when messages first mount (persisted by the host). */+ initialMessagesState?: MessageTimelineStateSnapshot;+ ref?: (api: ChannelSurfaceApi) => void;+};++type ChannelSurfaceContextValue = {+ channelId: Accessor<string>;+ resolvedTarget: Accessor<ChannelResolvedTarget | undefined>;+};++type ChannelSurfaceInternal = ChannelSurfaceContextValue & {+ initialMessagesState: Accessor<MessageTimelineStateSnapshot | undefined>;+ bindMessagesHandle: (handle: ChannelHandle | undefined) => void;+ isTargetConsumed: (target: ChannelResolvedTarget) => boolean;+ markTargetConsumed: (target: ChannelResolvedTarget) => void;+};++const ChannelSurfaceContext = createContext<ChannelSurfaceInternal>();++export function useChannelSurface(): ChannelSurfaceContextValue {+ return useChannelSurfaceInternal();+}++function useChannelSurfaceInternal(): ChannelSurfaceInternal {+ const context = useContext(ChannelSurfaceContext);+ if (!context) {+ throw new Error('useChannelSurface must be used within <ChannelSurface>');+ }+ return context;+}++/**+ * Resolve a request from what is already known: `latest` and explicit-thread+ * targets need no lookup, and a bare message id is checked against the cached+ * timeline. Returns undefined only when the id is genuinely unknown.+ */+function resolveSync(+ channelId: string,+ request: ChannelTargetRequest+): ChannelResolvedTarget | undefined {+ if (request.kind === 'latest') return { kind: 'latest', request };+ const { messageId, threadId } = request;+ // A thread root references itself as its thread: an unambiguous top-level+ // target, resolved without any lookup (same rule as convertTargetMessage).+ if (threadId === messageId) {+ return { kind: 'message', request, targetMessageId: messageId };+ }+ if (threadId) {+ return {+ kind: 'message',+ request,+ targetMessageId: threadId,+ targetMessageReplyId: messageId,+ };+ }+ const parent: MessageParent = { type: 'channel', id: channelId };+ if (findTopLevelMessageInMessageTimeline(parent, messageId)) {+ return { kind: 'message', request, targetMessageId: messageId };+ }+ const cachedThreadId = findThreadIdInMessageTimeline(parent, messageId);+ if (cachedThreadId) {+ return {+ kind: 'message',+ request,+ targetMessageId: cachedThreadId,+ targetMessageReplyId: messageId,+ };+ }+}++/**+ * Tab-agnostic channel context. Owns target resolution and the messages+ * timeline snapshot; knows nothing about tabs, calls, or host chrome. Layers+ * above attach by passing state down (`targetRequest`) or mounting parts+ * (`ChannelMessages`) — the surface exposes no registration hooks beyond the+ * single `ref` escape hatch for the host's persistence captor.+ *+ * Hosts must remount the surface when `channelId` changes (key it).+ */+export function ChannelSurface(props: ParentProps<ChannelSurfaceProps>) {+ const [resolvedTarget, setResolvedTarget] =+ createSignal<ChannelResolvedTarget>();++ // Resolution runs once per request (not as a derived memo) so the resolved+ // object stays identity-stable while cache contents shift underneath, and+ // so the sync fast path lands in the same tick — a resource would resolve+ // in a microtask and initial targets would miss the messages mount.+ createComputed(+ on(+ [() => props.channelId, () => props.targetRequest],+ ([channelId, request]) => {+ if (!request) {+ setResolvedTarget(undefined);+ return;+ }+ const sync = untrack(() => resolveSync(channelId, request));+ if (sync) {+ setResolvedTarget(sync);+ return;+ }+ setResolvedTarget(undefined);+ if (request.kind !== 'message') return;+ void (async () => {+ const resolved = await fetchResolvedChannelMessage(+ { type: 'channel', id: channelId },+ request.messageId+ ).catch(() => undefined);+ if (props.targetRequest !== request) return;+ setResolvedTarget(+ resolved?.kind === 'thread_reply'+ ? {+ kind: 'message',+ request,+ targetMessageId: resolved.thread_id,+ targetMessageReplyId: request.messageId,+ }+ : {+ kind: 'message',+ request,+ targetMessageId: request.messageId,+ }+ );+ })();+ }+ )+ );++ const [messagesHandle, setMessagesHandle] = createSignal<ChannelHandle>();+ let lastMessagesSnapshot = untrack(() => props.initialMessagesState);+ const bindMessagesHandle = (handle: ChannelHandle | undefined) => {+ if (!handle) {+ lastMessagesSnapshot =+ untrack(messagesHandle)?.getMessagesStateSnapshot() ??+ lastMessagesSnapshot;+ }+ setMessagesHandle(() => handle);+ };++ // A resolved target is consumed exactly once — by riding into the messages+ // mount as initial props or by a live handle navigation. Tracked here, not+ // in the part, so a messages remount (tab away and back) restores its state+ // instead of replaying an already-shown target.+ let consumedTarget: ChannelResolvedTarget | undefined;++ props.ref?.({+ getMessagesStateSnapshot: () =>+ messagesHandle()?.getMessagesStateSnapshot() ?? lastMessagesSnapshot,+ });++ return (+ <ChannelSurfaceContext.Provider+ value={{+ channelId: () => props.channelId,+ resolvedTarget,+ // The messages part restores from here on every mount: the host's+ // initial state until the first cleanup stashes something fresher, so+ // leaving the messages pane and returning keeps scroll/thread/reply+ // state rather than resetting to the host's snapshot.+ initialMessagesState: () => lastMessagesSnapshot,+ bindMessagesHandle,+ isTargetConsumed: (target) => target === consumedTarget,+ markTargetConsumed: (target) => {+ consumedTarget = target;+ },+ }}+ >+ {props.children}+ </ChannelSurfaceContext.Provider>+ );+}++export type ChannelMessagesProps = {+ /** Whether to auto-focus the channel input on mount. Defaults to `!isTouchDevice()`. */+ autofocus?: boolean;+};++/**+ * The messages timeline part. Mounts `Channel` against the surface: an+ * unconsumed message target at mount rides in as initial props (load-around+ * from the first frame); everything else — a pending `latest` target, targets+ * that resolve later, targets that arrive while mounted — navigates through+ * the live handle. An already-consumed target is not replayed, so remounting+ * restores the stashed timeline state instead.+ */+export function ChannelMessages(props: ChannelMessagesProps) {+ const surface = useChannelSurfaceInternal();+ const [handle, setHandle] = createSignal<ChannelHandle>();+ const mountTarget = untrack(surface.resolvedTarget);+ // A pending `latest` cannot ride into the mount — Channel would restore the+ // snapshot and stay there — so it is left unconsumed for the effect below.+ const initialTarget =+ mountTarget?.kind === 'message' && !surface.isTargetConsumed(mountTarget)+ ? mountTarget+ : undefined;+ if (initialTarget) surface.markTargetConsumed(initialTarget);++ createEffect(() => {+ const target = surface.resolvedTarget();+ const channelHandle = handle();+ if (!channelHandle || !target || surface.isTargetConsumed(target)) return;+ surface.markTargetConsumed(target);+ if (target.kind === 'latest') {+ channelHandle.goToLatest();+ } else {+ channelHandle.goToMessage(+ target.targetMessageId,+ target.targetMessageReplyId+ );+ }+ });++ onCleanup(() => surface.bindMessagesHandle(undefined));++ return (+ <Channel+ channelId={surface.channelId()}+ onHandleReady={(channelHandle) => {+ setHandle(() => channelHandle);+ surface.bindMessagesHandle(channelHandle);+ }}+ autofocus={props.autofocus}+ // A mount that load-arounds a target must not also restore old timeline+ // state — the same rule as the block host's hydration gate.+ initialMessagesStateSnapshot={+ initialTarget ? undefined : surface.initialMessagesState()+ }+ targetMessageId={initialTarget?.targetMessageId}+ targetMessageReplyId={initialTarget?.targetMessageReplyId}+ />+ );+}diff --git a/apps/web/src/features/channel/Channel/ChannelTopBarLiveIndicators.tsx b/apps/web/src/features/channel/Channel/ChannelTopBarLiveIndicators.tsxindex de07e7c311..fb83803279 100644--- a/apps/web/src/features/channel/Channel/ChannelTopBarLiveIndicators.tsx+++ b/apps/web/src/features/channel/Channel/ChannelTopBarLiveIndicators.tsx@@ -1,20 +1,33 @@import { SplitHeaderRight } from '@components/app/split-layout/components/SplitHeader';import { useBlockId } from '@core/block';-import { BlockLiveIndicators } from '@core/component/LiveIndicators';-import { useEntitySubscription } from '@service-connection/client';+import { LiveIndicators } from '@core/component/LiveIndicators';+import { ENABLE_LIVE_INDICATORS } from '@core/constant/featureFlags';+import { useUserId } from '@core/context/user';+import { useUserIndicators } from '@core/state/liveIndicators';+import { useChannelPresenceSubscription } from '@queries/channel/presence';+import { Show } from 'solid-js';++/** Live viewer avatars for a channel; hosts place it in their own chrome. */+export function ChannelLiveIndicators(props: { channelId: string }) {+ const userId = useUserId();+ const indicators = useUserIndicators(() => props.channelId);+ useChannelPresenceSubscription(() => props.channelId);++ return (+ <Show when={ENABLE_LIVE_INDICATORS}>+ <LiveIndicators userIds={indicators() ?? []} currentUserId={userId()} />+ </Show>+ );+}export function ChannelTopBarLiveIndicators() {const channelId = useBlockId();- useEntitySubscription(() => ({- entity_type: 'channel',- entity_id: channelId,- }));return (<SplitHeaderRight>{/* Hidden on mobile/tablet: no floating-island treatment for live avatars yet. */}<div class="-order-1 touch:hidden">- <BlockLiveIndicators />+ <ChannelLiveIndicators channelId={channelId} /></div></SplitHeaderRight>);diff --git a/apps/web/src/features/channel/Channel/use-channel-tab-items.tsx b/apps/web/src/features/channel/Channel/use-channel-tab-items.tsxnew file mode 100644index 0000000000..b69969d806--- /dev/null+++ b/apps/web/src/features/channel/Channel/use-channel-tab-items.tsx@@ -0,0 +1,70 @@+import { useCall } from '@channel/Call/use-call';+import { isNativeIosCallKitEnabled } from '@channel/Call/use-callkit';+import type { TabItem } from '@core/component/Tabs';+import { ENABLE_CALLS } from '@core/constant/featureFlags';+import { useChannelType } from '@core/context/channels';+import { useActiveCallQuery } from '@queries/call/call';+import { ChannelType } from '@service-storage/generated/schemas/channelType';+import type { Accessor } from 'solid-js';+import { useChannelTab } from './ChannelTabContext';+import {+ CHANNEL_TABS,+ type ChannelTabId,+ DEFAULT_CHANNEL_TAB,+} from './channel-tabs';++export const canUseInlineCallTab = () => {+ return !isNativeIosCallKitEnabled();+};++// Native iOS CallKit owns the call surface, so the embedded Call tab should+// never become the active channel tab on that platform.+export const normalizeChannelTab = (tab: ChannelTabId) => {+ return tab === 'call' && !canUseInlineCallTab() ? DEFAULT_CHANNEL_TAB : tab;+};++function CallTabLabel() {+ return (+ <span class="flex items-center gap-1.5">+ <span class="size-1.5 rounded-full bg-success animate-pulse" />+ Call+ </span>+ );+}++/**+ * The tabs a channel host should offer right now: DMs hide participants,+ * calls-disabled builds hide call history, and the live Call tab appears only+ * while relevant. Reads the active tab from the enclosing ChannelTabProvider.+ */+export function useChannelTabItems(channelId: string): Accessor<TabItem[]> {+ const { activeTab } = useChannelTab();+ const channelType = useChannelType(channelId);+ const call = useCall(() => channelId);+ const activeCallQuery = useActiveCallQuery(() => channelId);+ // Show the Call tab whenever we're actually in the call, mid-join, or+ // the tab is being displayed (e.g. via the auto-join flow that flips+ // `activeTab` to `call` before the join request resolves).+ const showCallTab = () =>+ ENABLE_CALLS &&+ canUseInlineCallTab() &&+ (call.isInThisChannel() ||+ call.isJoining() ||+ activeTab() === 'call' ||+ !!activeCallQuery.data);+ const availableTabs = () => {+ let filtered = [...CHANNEL_TABS];+ if (channelType() === ChannelType.direct_message)+ filtered = filtered.filter((tab) => tab.value !== 'participants');+ if (!ENABLE_CALLS)+ filtered = filtered.filter((tab) => tab.value !== 'calls');+ if (!showCallTab())+ filtered = filtered.filter((tab) => tab.value !== 'call');+ return filtered;+ };++ return () =>+ availableTabs().map((tab) =>+ tab.value === 'call' ? { ...tab, label: <CallTabLabel /> } : tab+ );+}diff --git a/apps/web/src/features/channel/components/ChannelTopIcon.tsx b/apps/web/src/features/channel/components/ChannelTopIcon.tsxnew file mode 100644index 0000000000..68a58244ea--- /dev/null+++ b/apps/web/src/features/channel/components/ChannelTopIcon.tsx@@ -0,0 +1,36 @@+import { ChannelAvatar } from '@channel/channel-avatar';+import { UserIcon } from '@core/component/UserIcon';+import { useUserId } from '@core/context/user';+import type { ChannelParticipant } from '@queries/channel/types';+import { ChannelType } from '@service-storage/generated/schemas/channelType';+import { Show } from 'solid-js';++export type ChannelTopIconProps = {+ channelId: string;+ channelType: ChannelType | undefined;+ participants: ChannelParticipant[];+};++/** Channel avatar, or the other participant's avatar for a direct message. */+export function ChannelTopIcon(props: ChannelTopIconProps) {+ const userId = useUserId();+ const recipient = () => {+ return props.participants.find((p) => p && p.user_id !== userId());+ };++ return (+ <Show+ when={props.channelType === ChannelType.direct_message && recipient()}+ fallback={+ <ChannelAvatar+ channelId={props.channelId}+ class="size-4 [&_img]:rounded-full"+ />+ }+ >+ {(recipient) => (+ <UserIcon id={recipient().user_id} isDeleted={false} size="sm" />+ )}+ </Show>+ );+}diff --git a/apps/web/src/features/channels-view/channels-view.test.tsx b/apps/web/src/features/channels-view/channels-view.test.tsxindex b99a338230..edd90b7895 100644--- a/apps/web/src/features/channels-view/channels-view.test.tsx+++ b/apps/web/src/features/channels-view/channels-view.test.tsx@@ -73,6 +73,14 @@ vi.mock(() => ({ StaticMarkdownContext: mocks.pass }));vi.mock('@entity', () => ({ ListEntityMetadataQueryProvider: mocks.pass }));+vi.mock('./components/ChannelDetailView', () => ({+ ChannelDetailView: (props: { channel: ChannelEntity }) => (+ <div data-testid="preview">+ {props.channel.id}+ <textarea aria-label="Composer" />+ </div>+ ),+}));vi.mock('./components/ChannelsMobileView', () => ({ChannelsMobileView: () => null,}));diff --git a/apps/web/src/features/channels-view/channels-view.tsx b/apps/web/src/features/channels-view/channels-view.tsxindex 1b03b53385..36673e239d 100644--- a/apps/web/src/features/channels-view/channels-view.tsx+++ b/apps/web/src/features/channels-view/channels-view.tsx@@ -3,11 +3,7 @@ import { markChannelNotificationsSeenOnOpen } from '@app/features/next-soup/utilimport { MaybeSoupEntityActionDrawerManager } from '@app/features/soup';import { withEntityNotifications } from '@app/features/soup/entity-notifications';import { SplitRouter } from '@app/lib/split-router';-import {- useGlobalBlockOrchestrator,- useGlobalNotificationSource,-} from '@components/app/GlobalAppState';-import { PreviewPanel } from '@components/app/PreviewPanel';+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';import { SplitPanel } from '@components/app/split-panel';import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';@@ -25,6 +21,7 @@ import {useContext,} from 'solid-js';import { ChannelsViewProvider, useChannelsView } from './channels-view-context';+import { ChannelDetailView } from './components/ChannelDetailView';import { ChannelsMobileView } from './components/ChannelsMobileView';import { ChannelsRail } from './components/rail/ChannelsRail';import {@@ -143,8 +140,6 @@ function ChannelsViewRoot() {}export function ChannelDetailRouteView() {- const panel = useSplitPanelOrThrow();- const orchestrator = useGlobalBlockOrchestrator();const { selectedChannel } = useChannelsView();const notificationSource = useGlobalNotificationSource();const channelId = () => selectedChannel()?.id;@@ -234,13 +229,7 @@ export function ChannelDetailRouteView() {</div>}>- {(channel) => (- <PreviewPanel- selectedEntity={channel()}- orchestrator={orchestrator}- splitPanelContext={panel}- />- )}+ {(channel) => <ChannelDetailView channel={channel()} />}</Show></Suspense>);diff --git a/apps/web/src/features/channels-view/components/ChannelDetailView.tsx b/apps/web/src/features/channels-view/components/ChannelDetailView.tsxnew file mode 100644index 0000000000..0fa76ca403--- /dev/null+++ b/apps/web/src/features/channels-view/components/ChannelDetailView.tsx@@ -0,0 +1,41 @@+import { getChannelEntityTarget } from '@app/features/next-soup/utils';+import { ChannelDetail } from '@channel/Channel/ChannelDetail';+import type { ChannelTargetRequest } from '@channel/Channel/ChannelSurface';+import type { ChannelEntity } from '@entity';+import { createMemo } from 'solid-js';++/**+ * Rail-selection adapter for the shared ChannelDetail. Fresh metadata and+ * notifications reconcile into a replacement entity for the same selection;+ * only a channel switch or an explicit target change re-derives the target,+ * so notification reads never re-navigate an open conversation (PreviewPanel+ * applied the same rule via its stringified navigation key).+ */+export function ChannelDetailView(props: { channel: ChannelEntity }) {+ let lastTargetKey: string | undefined;+ const target = createMemo<ChannelTargetRequest | undefined>((previous) => {+ const key = `${props.channel.id}:${props.channel.target?.messageId ?? ''}:${+ props.channel.target?.threadId ?? ''+ }`;+ if (lastTargetKey !== undefined && key === lastTargetKey) return previous;+ lastTargetKey = key;+ const clickTarget = getChannelEntityTarget(props.channel);+ if (!clickTarget) return undefined;+ return clickTarget.kind === 'latest'+ ? { kind: 'latest' }+ : {+ kind: 'message',+ messageId: clickTarget.messageId,+ threadId: clickTarget.threadId,+ };+ });++ return (+ <ChannelDetail+ channelId={props.channel.id}+ target={target()}+ fallbackName={props.channel.name}+ autofocus={false}+ />+ );+}diff --git a/apps/web/src/lib/queries/channel/presence.ts b/apps/web/src/lib/queries/channel/presence.tsnew file mode 100644index 0000000000..d76acf8b3b--- /dev/null+++ b/apps/web/src/lib/queries/channel/presence.ts@@ -0,0 +1,14 @@+import { useEntitySubscription } from '@service-connection/client';+import type { Accessor } from 'solid-js';++/**+ * Tracks presence on a channel so live viewer indicators populate. Pure+ * tracking — message updates for open channels invalidate through+ * useMessageSubscription, not here.+ */+export function useChannelPresenceSubscription(channelId: Accessor<string>) {+ useEntitySubscription(() => ({+ entity_type: 'channel',+ entity_id: channelId(),+ }));+}diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.mdindex 4d92601f76..f3e6128820 100644--- a/docs/AGENT_GUIDE/channels.md+++ b/docs/AGENT_GUIDE/channels.md@@ -278,7 +278,8 @@ an incoming selection must not mark the Home item done or edit the thread root.Press `Escape` to clear selection; the parent Home shortcut is then availableagain. Typing `e` in the composer or inline editor should still enter text.Returning through split navigation restores the saved message position and expanded-threads. Switching channel tabs currently opens Messages at latest. The `Scroll to bottom` control appears when scrolling down through history;+threads. Switching channel tabs and returning restores the Messages position,+expanded threads, and pending reply from when the tab was left. The `Scroll to bottom` control appears when scrolling down through history;it returns to the latest page even after opening a link into old history.The jump waits for that page to reach the rendered list.A newer message navigation cancels a pending jump to latest. Scrolling manually@@ -569,6 +570,13 @@ already @mentioned as context (see ai-chat.md). On mobile it lives in the channe`...` drawer instead. Clicking the radio input can time out — click the adjacent label textinstead.+In the Chat workspace — and wherever a channel opens inline inside another+view's detail stack (a channel mention followed from the email view, say) — the+conversation renders an inline detail whose top bar holds the channel avatar+and name, the same tab strip, live viewer avatars, and the `Call` and+`Ask Macro` buttons. The title `...` menu (rename, channel picture) is not+offered there; open the channel as a split (shift-click a rail row) to use it.+`Calls` tab: recordings, transcriptions, and summaries for this channel. Click arow to open the call. The search field above the list matches call names andtranscripts in this channel; queries shorter than 3 characters are not sent.