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(channels): add calls tab to see list of calls (#6715)

dev-rbf90d3e66a012
diff --git a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx
index 2f3ea3ec04..200c023054 100644
--- a/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx
+++ b/apps/web/src/features/block-channel/component/NewChannelBlockAdapter.tsx
@@ -19,6 +19,7 @@ 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 ChannelHandle,
type ChannelProps,
@@ -178,6 +179,8 @@ function NewTop(props: { channelId: string }) {
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;
@@ -613,6 +616,9 @@ export function NewChannelBlockAdapter(props: BlockChannelProps) {
<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}
diff --git a/apps/web/src/features/block-channel/component/Top.tsx b/apps/web/src/features/block-channel/component/Top.tsx
index b3b932ce48..e01976a5e3 100644
--- a/apps/web/src/features/block-channel/component/Top.tsx
+++ b/apps/web/src/features/block-channel/component/Top.tsx
@@ -14,20 +14,22 @@ 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';
-import PhoneIcon from '@phosphor/phone-call.svg';
+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 Component, type JSX, Show } from 'solid-js';
export const CHANNEL_TAB_ICONS: Record<
- string,
+ ChannelTabId,
Component<JSX.SvgSVGAttributes<SVGSVGElement>>
> = {
messages: ChatTextIcon,
attachments: PaperclipIcon,
+ calls: PhoneIcon,
participants: UsersIcon,
- call: PhoneIcon,
+ call: PhoneCallIcon,
};
type TopIconProps = {
@@ -85,7 +87,7 @@ export function ChannelTopLeft(props: ChannelTopLeftProps) {
const iconTabList = () =>
(props.tabs ?? []).map((tab) => {
- const Icon = CHANNEL_TAB_ICONS[tab.value];
+ const Icon = CHANNEL_TAB_ICONS[tab.value as ChannelTabId];
return {
value: tab.value,
label: Icon ? <Icon class="size-4 touch:size-6" /> : tab.label,
diff --git a/apps/web/src/features/channel/Calls/ChannelCallsTab.tsx b/apps/web/src/features/channel/Calls/ChannelCallsTab.tsx
new file mode 100644
index 0000000000..0fd18509c8
--- /dev/null
+++ b/apps/web/src/features/channel/Calls/ChannelCallsTab.tsx
@@ -0,0 +1,454 @@
+import '@entity/composed/ListEntity.css';
+import {
+ createListController,
+ type ListActivation,
+ listOwnedSlotName,
+ useListInteractions,
+} from '@app/components/list';
+import { SearchBar } from '@app/components/view-shell';
+import { LIST_VIEW_DOCS_URL } from '@app/constants/docs-links';
+import {
+ resolveEntityActionViewContext,
+ toEntityActionListState,
+ useEntityActionHotkeys,
+} from '@app/features/next-soup/actions';
+import { openEntityInSplitFromUnifiedList } from '@app/features/next-soup/utils';
+import {
+ MaybeSoupEntityActionDrawerManager,
+ SoupEntityContextMenu,
+ useSoupListNavigationHotkeys,
+} from '@app/features/soup';
+import { DEBUG_SETTING_KEYS, useDebugSetting } from '@app/lib/debugSettings';
+import {
+ useSplitPanelOrThrow,
+ withSplitPanelOwner,
+} from '@components/app/split-layout/layoutUtils';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import EmptyStateCallsGraphic from '@design/empty-state-calls.svg';
+import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
+import {
+ type EntityData,
+ ListEntity,
+ ListEntityMetadataQueryProvider,
+ ListLayoutProvider,
+} from '@entity';
+import CaretDownIcon from '@phosphor/caret-down.svg';
+import SpinnerIcon from '@phosphor/spinner.svg';
+import { validateSearchServiceText } from '@queries/soup/search';
+import { createElementSize } from '@solid-primitives/resize-observer';
+import { Button, cn, EmptyStatePanel } from '@ui';
+import {
+ createEffect,
+ createMemo,
+ createSignal,
+ Match,
+ onCleanup,
+ Show,
+ Suspense,
+ Switch,
+} from 'solid-js';
+import { Virtualizer, type VirtualizerHandle } from 'virtua/solid';
+import {
+ type ChannelCallsRow,
+ useChannelCallsSource,
+} from './use-channel-calls-source';
+
+type ChannelCallsActivationMetadata = {
+ event?: MouseEvent;
+ newSplit?: boolean;
+};
+
+export function ChannelCallsTab(props: { channelId: string }) {
+ return (
+ <div class="relative flex h-full min-h-0 flex-1 justify-center overflow-hidden p-2 touch:pb-(--mobile-content-inset-bottom)">
+ <div class="macro-message-width size-full min-h-0">
+ <ListEntityMetadataQueryProvider>
+ <ChannelCallsList channelId={props.channelId} />
+ </ListEntityMetadataQueryProvider>
+ </div>
+ </div>
+ );
+}
+
+function ChannelCallsList(props: { channelId: string }) {
+ const panel = useSplitPanelOrThrow();
+ const forceEmptyState = useDebugSetting(
+ DEBUG_SETTING_KEYS.FORCE_EMPTY_STATES
+ );
+
+ const [searchFor, setSearchFor] = createSignal({
+ channelId: props.channelId,
+ text: '',
+ });
+ const searchText = () =>
+ searchFor().channelId === props.channelId ? searchFor().text : '';
+ const setSearchText = (text: string) =>
+ setSearchFor({ channelId: props.channelId, text });
+ const source = withSplitPanelOwner(listOwnedSlotName('data-source'), () =>
+ useChannelCallsSource(() => props.channelId, searchText)
+ );
+
+ const list = withSplitPanelOwner(listOwnedSlotName('controller'), () =>
+ createListController<ChannelCallsRow, ChannelCallsActivationMetadata>({
+ items: source.items,
+ getKey: (row) => row.id,
+ selection: {
+ getKey: (row) => (row.kind === 'entity' ? row.entity.id : row.id),
+ },
+ isNavigable: (row) => row.kind === 'entity' || row.kind === 'load-more',
+ isSelectable: (row) => row.kind === 'entity',
+ onActivate,
+ })
+ );
+
+ function openEntity(
+ entity: EntityData,
+ options: {
+ openInNewSplit?: boolean;
+ replacePreview?: boolean;
+ mergeHistory?: boolean;
+ } = {}
+ ) {
+ void openEntityInSplitFromUnifiedList(entity, {
+ splitHandle: panel.handle,
+ referredFrom: 'calls',
+ ...options,
+ });
+ }
+
+ function onActivate({
+ item,
+ metadata,
+ }: ListActivation<ChannelCallsRow, ChannelCallsActivationMetadata>) {
+ if (item.kind === 'load-more') {
+ if (!item.isLoading) void source.loadMore();
+ return;
+ }
+
+ if (item.kind !== 'entity') return;
+
+ const newSplit =
+ metadata?.newSplit === true || metadata?.event?.shiftKey === true;
+
+ openEntity(item.entity, {
+ openInNewSplit: newSplit,
+ replacePreview: metadata?.event?.altKey === true && !newSplit,
+ });
+ }
+
+ withSplitPanelOwner(listOwnedSlotName('navigation-hotkeys'), () => {
+ useSoupListNavigationHotkeys({
+ splitHotkeyScope: panel.splitHotkeyScope,
+ viewId: 'calls',
+ dataSource: source,
+ controller: list,
+ handle: panel.handle,
+ openEntityInSplit: (entity, options) => {
+ void openEntityInSplitFromUnifiedList(entity, {
+ splitHandle: panel.handle,
+ ...options,
+ });
+ },
+ });
+ });
+
+ const [viewport, setViewport] = createSignal<HTMLDivElement>();
+ const [grid, setGrid] = createSignal<HTMLDivElement>();
+ const [virtualizer, setVirtualizer] = createSignal<VirtualizerHandle>();
+ const viewportSize = createElementSize(viewport);
+
+ const selectedEntities = createMemo(() =>
+ list.selection
+ .items()
+ .flatMap((row) => (row.kind === 'entity' ? [row.entity] : []))
+ );
+
+ const actionState = toEntityActionListState({
+ controller: list,
+ getEntity: (row) => (row.kind === 'entity' ? row.entity : undefined),
+ onFocus: (target) => {
+ if (target) {
+ virtualizer()?.scrollToIndex(target.index, { align: 'nearest' });
+ }
+ grid()?.focus();
+ },
+ });
+
+ const entityActionViewContext = () =>
+ resolveEntityActionViewContext({
+ activeListView: 'calls',
+ activeTab: 'all',
+ });
+
+ useListInteractions({
+ controller: list,
+ scopeId: panel.splitHotkeyScope,
+ enabled: panel.isPanelActive,
+ scrollHandle: virtualizer,
+ navigation: {
+ onNavigate: (event) => {
+ if (event.kind !== 'move' || event.direction !== 1) return;
+ if (source.error()) return;
+
+ if (!event.result || list.items.count() - event.result.index <= 4) {
+ void source.loadMore();
+ }
+ },
+ },
+ activation: {
+ createMetadata: (intent) => ({ newSplit: intent === 'alternate' }),
+ alternateDescription: 'Open in new split',
+ },
+ });
+
+ useEntityActionHotkeys({
+ scopeId: panel.splitHotkeyScope,
+ list: actionState,
+ selectedEntities,
+ focusedEntity: () => {
+ const item = list.focus.item();
+ return item?.kind === 'entity' ? item.entity : undefined;
+ },
+ restoreFocus: () => grid()?.focus(),
+ viewContext: entityActionViewContext,
+ splitHandle: panel.handle,
+ condition: panel.isPanelActive,
+ });
+
+ const checkNearEnd = () => {
+ if (forceEmptyState() || source.error()) return;
+ if (source.isLoading() || source.isFetching() || !source.hasMore()) return;
+
+ const container = viewport();
+ if (!container || container.clientHeight === 0) return;
+
+ const distance =
+ container.scrollHeight - container.scrollTop - container.clientHeight;
+ if (distance < 300) void source.loadMore();
+ };
+
+ createEffect(() => {
+ source.items();
+ source.isFetching();
+ viewportSize.height;
+
+ const frame = requestAnimationFrame(checkNearEnd);
+ onCleanup(() => cancelAnimationFrame(frame));
+ });
+
+ const rows = source.items;
+
+ const searchQuery = () => searchText().trim();
+
+ return (
+ <MaybeSoupEntityActionDrawerManager>
+ <div class="flex size-full min-h-0 min-w-0 flex-col">
+ <div class="shrink-0 pb-2">
+ <SearchBar
+ label="Search calls"
+ placeholder="Search calls"
+ value={searchText()}
+ onValueChange={setSearchText}
+ onEscape={() => grid()?.focus()}
+ />
+ </div>
+ <div
+ ref={setGrid}
+ role="grid"
+ aria-label="Calls"
+ aria-multiselectable="true"
+ aria-activedescendant={list.focus.key()}
+ tabIndex={0}
+ class="soup-list relative flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden outline-none"
+ >
+ <ListLayoutProvider ref={grid}>
+ <Switch>
+ <Match
+ when={
+ !forceEmptyState() &&
+ source.isLoading() &&
+ rows().length === 0
+ }
+ >
+ <div class="grid min-h-0 flex-1 place-items-center text-ink-muted">
+ <SpinnerIcon
+ aria-label="Loading calls"
+ class="size-5 animate-spin"
+ />
+ </div>
+ </Match>
+
+ <Match when={!forceEmptyState() && source.error()}>
+ <div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 text-sm text-ink-muted">
+ <span>
+ {searchQuery()
+ ? 'Search couldn’t be completed.'
+ : 'Calls couldn’t be loaded.'}
+ </span>
+ <Button
+ variant="outline"
+ size="sm"
+ class="rounded-lg"
+ onClick={() => void source.refresh()}
+ >
+ Try again
+ </Button>
+ </div>
+ </Match>
+
+ <Match when={forceEmptyState() || rows().length === 0}>
+ <div class="min-h-0 flex-1 overflow-y-auto">
+ <EmptyStatePanel
+ graphic={
+ searchQuery()
+ ? EmptyStateNoSearchMatchGraphic
+ : EmptyStateCallsGraphic
+ }
+ title={
+ !searchQuery()
+ ? 'No calls in this channel'
+ : validateSearchServiceText(searchQuery())
+ ? `No results for "${searchQuery()}"`
+ : 'Keep typing to search'
+ }
+ description={
+ !searchQuery()
+ ? 'Recordings, transcriptions, and summaries of calls in this channel will appear here.'
+ : validateSearchServiceText(searchQuery())
+ ? 'Search matches call names and transcripts in this channel.'
+ : 'Call search starts at 3 characters and matches names and transcripts.'
+ }
+ documentationUrl={LIST_VIEW_DOCS_URL.calls}
+ />
+ </div>
+ </Match>
+
+ <Match when={true}>
+ <div
+ ref={setViewport}
+ class="scrollbar-hidden min-h-0 flex-1 overflow-y-auto overscroll-none"
+ onScroll={checkNearEnd}
+ >
+ <Suspense>
+ <Virtualizer
+ ref={setVirtualizer}
+ data={rows()}
+ scrollRef={viewport()}
+ bufferSize={500}
+ itemSize={44}
+ keepMounted={
+ list.focus.index() >= 0
+ ? [list.focus.index()]
+ : undefined
+ }
+ onScroll={checkNearEnd}
+ >
+ {(row) => (
+ <Switch>
+ <Match when={row.kind === 'entity' ? row : undefined}>
+ {(entityRow) => (
+ <SoupEntityContextMenu
+ entity={entityRow().entity}
+ list={actionState}
+ selectedEntities={selectedEntities}
+ viewContext={entityActionViewContext()}
+ onOpenChange={(open) => {
+ if (!open) return;
+ list.focus.set(entityRow().id, {
+ reason: 'pointer',
+ force: true,
+ });
+ list.selection.setAnchor(entityRow().id);
+ }}
+ >
+ <div
+ id={entityRow().id}
+ role="row"
+ data-soup-entity
+ >
+ <div role="gridcell">
+ <ListEntity
+ entity={entityRow().entity}
+ hideCheckbox
+ highlighted={
+ !isTouchDevice() &&
+ list.focus.key() === entityRow().id
+ }
+ onMouseMove={() =>
+ list.focus.set(entityRow().id, {
+ reason: 'hover',
+ })
+ }
+ onClick={(event) => {
+ list.activate.key(entityRow().id, {
+ reason: 'pointer',
+ metadata: { event },
+ });
+ }}
+ />
+ </div>
+ </div>
+ </SoupEntityContextMenu>
+ )}
+ </Match>
+ <Match
+ when={row.kind === 'load-more' ? row : undefined}
+ >
+ {(loadMore) => (
+ <div id={loadMore().id} role="row">
+ <div
+ role="gridcell"
+ aria-busy={loadMore().isLoading}
+ class={cn(
+ 'my-1 flex min-h-12 items-center justify-center rounded-lg',
+ !isTouchDevice() &&
+ list.focus.key() === loadMore().id &&
+ 'bg-active/60'
+ )}
+ onMouseMove={() =>
+ list.focus.set(loadMore().id, {
+ reason: 'hover',
+ })
+ }
+ onClick={() =>
+ list.activate.key(loadMore().id, {
+ reason: 'pointer',
+ })
+ }
+ >
+ <Button
+ variant="outline"
+ size="sm"
+ depth={2}
+ disabled={loadMore().isLoading}
+ class="bg-surface"
+ >
+ <Show
+ when={!loadMore().isLoading}
+ fallback={
+ <SpinnerIcon class="size-3 animate-spin" />
+ }
+ >
+ <CaretDownIcon class="size-2.5" />
+ </Show>
+ {loadMore().isLoading
+ ? 'Loading...'
+ : 'Load More'}
+ </Button>
+ </div>
+ </div>
+ )}
+ </Match>
+ </Switch>
+ )}
+ </Virtualizer>
+ </Suspense>
+ </div>
+ </Match>
+ </Switch>
+ </ListLayoutProvider>
+ </div>
+ </div>
+ </MaybeSoupEntityActionDrawerManager>
+ );
+}
diff --git a/apps/web/src/features/channel/Calls/channel-calls-query.test.ts b/apps/web/src/features/channel/Calls/channel-calls-query.test.ts
new file mode 100644
index 0000000000..40641adf6f
--- /dev/null
+++ b/apps/web/src/features/channel/Calls/channel-calls-query.test.ts
@@ -0,0 +1,59 @@
+import { NIL_UUID } from '@app/features/soup/filters';
+import { describe, expect, it } from 'vitest';
+import {
+ buildChannelCallsQuery,
+ buildChannelCallsSearchRequest,
+} from './channel-calls-query';
+
+const CHANNEL_ID = 'channel-1';
+
+describe('buildChannelCallsQuery', () => {
+ it('lists calls newest first', () => {
+ expect(buildChannelCallsQuery(CHANNEL_ID).params).toEqual({
+ expand: true,
+ limit: 100,
+ sort_method: 'updated_at',
+ sort_direction: 'desc',
+ });
+ });
+
+ it('scopes callf to the channel and confines every other entity target', () => {
+ const { body } = buildChannelCallsQuery(CHANNEL_ID);
+
+ expect(body.callf).toEqual({ l: { ChannelId: CHANNEL_ID } });
+ expect(body.df).toEqual({ l: { id: NIL_UUID } });
+ expect(body.ef).toEqual({ l: { ThreadId: NIL_UUID } });
+ expect(body.chanf).toEqual({ l: { ChannelId: NIL_UUID } });
+ expect(body.cthf).toEqual({ l: { ChannelId: NIL_UUID } });
+ expect(body.cf).toEqual({ l: { cid: NIL_UUID } });
+ expect(body.pf).toEqual({ l: { pid: NIL_UUID } });
+ expect(body.calf).toEqual({ l: { id: NIL_UUID } });
+ expect(body.fef).toEqual({ l: { id: NIL_UUID } });
+ expect(body.ccf).toEqual({ l: { id: NIL_UUID } });
+ expect(body.asf).toEqual({ l: { id: NIL_UUID } });
+ expect(body.remf).toEqual({ l: { id: NIL_UUID } });
+ });
+});
+
+describe('buildChannelCallsSearchRequest', () => {
+ it('searches call names and transcripts in this channel only', () => {
+ const { body } = buildChannelCallsSearchRequest(CHANNEL_ID, {
+ query: 'standup',
+ matchType: 'partial',
+ });
+
+ expect(body.query).toBe('standup');
+ expect(body.match_type).toBe('partial');
+ expect(body.search_on).toBe('name_content');
+ expect(body.filters?.call_filters).toEqual({ channel_ids: [CHANNEL_ID] });
+ expect(body.filters?.document_filters).toEqual({
+ document_ids: [NIL_UUID],
+ });
+ expect(body.filters?.email_filters).toEqual({
+ email_thread_ids: [NIL_UUID],
+ });
+ expect(body.filters?.channel_filters).toEqual({
+ channel_ids: [NIL_UUID],
+ });
+ });
+});
diff --git a/apps/web/src/features/channel/Calls/channel-calls-query.ts b/apps/web/src/features/channel/Calls/channel-calls-query.ts
new file mode 100644
index 0000000000..15f86f6f3b
--- /dev/null
+++ b/apps/web/src/features/channel/Calls/channel-calls-query.ts
@@ -0,0 +1,65 @@
+import {
+ clause,
+ compileClause,
+ confine,
+ NIL_UUID,
+} from '@app/features/soup/filters';
+import type { SoupSearchRequest } from '@app/features/soup/search';
+import type { SoupAstItemsQueryArgs } from '@queries/soup/items';
+import type { SearchSoupQueryArgs } from '@queries/soup/search';
+import type { EntityFilters } from '@service-search/generated/models';
+
+/** Every non-call type is pinned to an id that cannot exist. */
+function excludedNonCallFilters(): EntityFilters {
+ return {
+ agent_session_filters: { ids: [NIL_UUID] },
+ calendar_event_filters: { calendar_event_ids: [NIL_UUID] },
+ channel_filters: { channel_ids: [NIL_UUID] },
+ channel_thread_filters: { thread_ids: [NIL_UUID] },
+ chat_filters: { chat_ids: [NIL_UUID] },
+ crm_company_filters: { company_ids: [NIL_UUID] },
+ document_filters: { document_ids: [NIL_UUID] },
+ email_filters: { email_thread_ids: [NIL_UUID] },
+ foreign_entity_filters: { ids: [NIL_UUID] },
+ project_filters: { project_ids: [NIL_UUID] },
+ reminder_filters: { ids: [NIL_UUID] },
+ };
+}
+
+/** Soup AST for the calls recorded in a single channel. */
+export function buildChannelCallsQuery(
+ channelId: string
+): SoupAstItemsQueryArgs {
+ return {
+ params: {
+ expand: true,
+ limit: 100,
+ sort_method: 'updated_at',
+ sort_direction: 'desc',
+ },
+ body: compileClause(
+ confine({
+ callf: clause.eq('callChannelId', channelId),
+ })
+ ),
+ };
+}
+
+/** Name and transcript search for the calls recorded in one channel. */
+export function buildChannelCallsSearchRequest(
+ channelId: string,
+ search: SoupSearchRequest
+): SearchSoupQueryArgs {
+ return {
+ params: { cursor: null, page_size: 100 },
+ body: {
+ query: search.query,
+ match_type: search.matchType,
+ search_on: 'name_content',
+ filters: {
+ ...excludedNonCallFilters(),
+ call_filters: { channel_ids: [channelId] },
+ },
+ },
+ };
+}
diff --git a/apps/web/src/features/channel/Calls/use-channel-calls-source.ts b/apps/web/src/features/channel/Calls/use-channel-calls-source.ts
new file mode 100644
index 0000000000..3b2197ea2f
--- /dev/null
+++ b/apps/web/src/features/channel/Calls/use-channel-calls-source.ts
@@ -0,0 +1,120 @@
+import type { ListDataSource } from '@app/components/list';
+import {
+ buildFlatSoupRows,
+ createSearchState,
+ createSoupLoadMoreRow,
+ type SoupRow,
+} from '@app/features/soup';
+import { withEntityNotifications } from '@app/features/soup/entity-notifications';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import { type EntityData, isCallEntity, type WithNotification } from '@entity';
+import { useSoupAstItemsQuery } from '@queries/soup/items';
+import { type Accessor, createMemo } from 'solid-js';
+import {
+ buildChannelCallsQuery,
+ buildChannelCallsSearchRequest,
+} from './channel-calls-query';
+
+export type ChannelCallsRow = SoupRow<WithNotification<EntityData>>;
+
+export type ChannelCallsSource = ListDataSource<ChannelCallsRow>;
+
+/** Query and row assembly for the channel Calls tab. */
+export function useChannelCallsSource(
+ channelId: Accessor<string>,
+ searchText: Accessor<string>
+): ChannelCallsSource {
+ const notificationSource = useGlobalNotificationSource();
+ const query = useSoupAstItemsQuery(() => buildChannelCallsQuery(channelId()));
+
+ // The quick-access pool is not this channel's calls, so matches come from
+ // the search service.
+ const search = createSearchState({
+ text: searchText,
+ disableLocalSearch: () => true,
+ buildRequest: (request) =>
+ buildChannelCallsSearchRequest(channelId(), request),
+ });
+
+ const entities = createMemo<WithNotification<EntityData>[]>(
+ (previous = []) => {
+ if (search.isSearching()) {
+ const channel = channelId();
+ return search
+ .data()
+ .filter(
+ (entity) => isCallEntity(entity) && entity.channelId === channel
+ )
+ .map((entity) => withEntityNotifications(entity, notificationSource));
+ }
+
+ if (query.isLoading) return previous;
+
+ return (query.data?.entities ?? [])
+ .filter(isCallEntity)
+ .map((entity) => withEntityNotifications(entity, notificationSource));
+ },
+ []
+ );
+
+ const usesServiceSearch = search.usesServiceSearch;
+
+ const hasMore = () => {
+ if (search.isSearching()) return search.hasNextPage();
+ return query.hasNextPage;
+ };
+
+ const isLoadingMore = () => {
+ if (usesServiceSearch()) return search.isFetchingNextPage();
+ return query.isFetchingNextPage;
+ };
+
+ const items = createMemo<ChannelCallsRow[]>(() => {
+ const rows: ChannelCallsRow[] = buildFlatSoupRows(entities());
+ if (hasMore()) {
+ rows.push(
+ createSoupLoadMoreRow({
+ scopeId: search.isSearching()
+ ? `channel-calls:${channelId()}:search`
+ : `channel-calls:${channelId()}`,
+ isLoading: isLoadingMore(),
+ })
+ );
+ }
+ return rows;
+ });
+
+ return {
+ items,
+ isLoading: () => {
+ if (search.isSearching()) {
+ return search.isLoading() && entities().length === 0;
+ }
+ return query.isLoading && entities().length === 0;
+ },
+ isFetching: () => {
+ if (search.isSettling()) return true;
+ return usesServiceSearch() ? search.isFetching() : query.isFetching;
+ },
+ error: () => {
+ if (usesServiceSearch()) return search.error();
+ return query.error ?? undefined;
+ },
+ hasMore,
+ isLoadingMore,
+ loadMore: async () => {
+ if (usesServiceSearch()) {
+ await search.fetchNextPage();
+ return;
+ }
+ await query.fetchNextPage();
+ },
+ refresh: async () => {
+ if (usesServiceSearch()) {
+ await search.refetch();
+ return;
+ }
+ await query.refresh();
+ },
+ };
+}
diff --git a/apps/web/src/features/channel/Channel/channel-tabs.ts b/apps/web/src/features/channel/Channel/channel-tabs.ts
index dd835e67c0..8c03d4e8d3 100644
--- a/apps/web/src/features/channel/Channel/channel-tabs.ts
+++ b/apps/web/src/features/channel/Channel/channel-tabs.ts
@@ -1,6 +1,7 @@
export const CHANNEL_TABS = [
{ value: 'messages', label: 'Messages' },
{ value: 'attachments', label: 'Attachments' },
+ { value: 'calls', label: 'Calls' },
{ value: 'participants', label: 'Participants' },
{ value: 'call', label: 'Call' },
] as const;
diff --git a/docs/AGENT_GUIDE/channels.md b/docs/AGENT_GUIDE/channels.md
index e9c41d8baf..af340a8338 100644
--- a/docs/AGENT_GUIDE/channels.md
+++ b/docs/AGENT_GUIDE/channels.md
@@ -376,12 +376,20 @@ shows Connecting and waits for that request before registering again.
## Channel tabs
-Radio group at the top of the channel pane: `Messages` / `Attachments` / `Participants`,
-plus `Ask Macro` and `Call` buttons. `Ask Macro` opens a new chat pane with the channel
+Radio group at the top of the channel pane: `Messages` / `Attachments` / `Calls` / `Participants`,
+plus `Ask Macro` and `Call` buttons. The `Calls` tab lists recordings for that channel
+(same rows as the Calls soup view, filtered to this channel). The live `Call` tab
+appears while a call is in progress. `Ask Macro` opens a new chat pane with the channel
already @mentioned as context (see ai-chat.md). On mobile it lives in the channel title's
`...` drawer instead. Clicking the radio input can time out — click the adjacent label text
instead.
+`Calls` tab: recordings, transcriptions, and summaries for this channel. Click a
+row to open the call. The search field above the list matches call names and
+transcripts in this channel; queries shorter than 3 characters are not sent.
+Empty copy: `No calls in this channel`. No matches: `No results for "…"`.
+Shorter queries: `Keep typing to search`.
+
`Participants` tab:
- `Copy invite link`, participant search box.
- Add: combobox `[email protected]` + `Add Participant` button.
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 19e7ffa470..8652f0009f 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -579,6 +579,10 @@ and summaries appear here; empty state notes "Calls are available to agents."
On phones, recorded call headers omit the **Call Again** action.
+A channel's `Calls` tab lists that channel's recordings with the same rows, filtered
+by the channel id. Its search field matches call names and transcripts in that
+channel.
+
If a recording fails to play, reload the page to obtain a fresh recording link,
or use **Open or download recording**. The playback warning does not assume
that the failure is caused by an unsupported media format.