mattermost-mobile/app/client/rest/index.ts
Christopher Speller 0c675ec2db
Agents posts on mobile (#9317)
* Agents streaming

* Fix bug and lint

* Add reasoning summaries to mobile agents

* Add tool call approval UI for mobile agents

* Add citations and annotations support for mobile agents

Implements Phase 4 from the agents mobile plan:
- WebSocket event handling for annotations control signal
- CitationsList component displaying sources below agent responses
- Collapsible sources section with source count
- Each citation shows title, domain, and opens URL on tap
- Citations persisted in post.props.annotations
- Touch-optimized UI with 44pt minimum tap targets

* Add stop and regenerate controls for mobile agents

* Add tests

* Fix tool approval buttons not updating after accept/reject

- Remove optimistic WebSocket event approach that didn't work
- Clear component streaming state on ENDED event to force switch to persisted data
- Remove delays in streaming store cleanup (500ms and 100ms)
- POST_EDITED event now properly updates UI for both accept and reject
- Remove debug console.log statements
- Fix ESLint issues (unused vars, nested callbacks, nested ternary)

* Refactor agents code: remove unused client mixin, fix bugs, and simplify logic

* Fixes

* Add CLAUDE.md

* Review feedback.

* Review feedback inline functions

* Learnings

* Address review feedback: StyleSheet.create, parent mount checks, utils

* Move to observables

* Last style fix

* Style tweaks
2025-12-09 03:56:12 -08:00

93 lines
3.3 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import ClientAgents, {type ClientAgentsMix} from '@agents/client/rest';
import ClientCalls, {type ClientCallsMix} from '@calls/client/rest';
import ClientPlugins, {type ClientPluginsMix} from '@client/rest/plugins';
import ClientPlaybooks, {type ClientPlaybooksMix} from '@playbooks/client/rest';
import mix from '@utils/mix';
import ClientApps, {type ClientAppsMix} from './apps';
import ClientBase from './base';
import ClientCategories, {type ClientCategoriesMix} from './categories';
import ClientChannelBookmarks, {type ClientChannelBookmarksMix} from './channel_bookmark';
import ClientChannels, {type ClientChannelsMix} from './channels';
import {DEFAULT_LIMIT_AFTER, DEFAULT_LIMIT_BEFORE, HEADER_X_VERSION_ID} from './constants';
import ClientCustomAttributes, {type ClientCustomAttributesMix} from './custom_profile_attributes';
import ClientEmojis, {type ClientEmojisMix} from './emojis';
import ClientFiles, {type ClientFilesMix} from './files';
import ClientGeneral, {type ClientGeneralMix} from './general';
import ClientGroups, {type ClientGroupsMix} from './groups';
import ClientIntegrations, {type ClientIntegrationsMix} from './integrations';
import ClientNPS, {type ClientNPSMix} from './nps';
import ClientPosts, {type ClientPostsMix} from './posts';
import ClientPreferences, {type ClientPreferencesMix} from './preferences';
import ClientScheduledPost, {type ClientScheduledPostMix} from './scheduled_post';
import ClientTeams, {type ClientTeamsMix} from './teams';
import ClientThreads, {type ClientThreadsMix} from './threads';
import ClientTos, {type ClientTosMix} from './tos';
import ClientUsers, {type ClientUsersMix} from './users';
import type {APIClientInterface} from '@mattermost/react-native-network-client';
interface Client extends ClientBase,
ClientAgentsMix,
ClientAppsMix,
ClientCategoriesMix,
ClientChannelsMix,
ClientChannelBookmarksMix,
ClientEmojisMix,
ClientFilesMix,
ClientGeneralMix,
ClientGroupsMix,
ClientIntegrationsMix,
ClientPostsMix,
ClientPreferencesMix,
ClientScheduledPostMix,
ClientTeamsMix,
ClientThreadsMix,
ClientTosMix,
ClientUsersMix,
ClientCallsMix,
ClientPluginsMix,
ClientNPSMix,
ClientCustomAttributesMix,
ClientPlaybooksMix
{
setClientCredentials: (token: string, preauthSecret?: string) => void;
setCSRFToken: (csrfToken: string) => void;
}
class Client extends mix(ClientBase).with(
ClientAgents,
ClientApps,
ClientCategories,
ClientChannels,
ClientChannelBookmarks,
ClientEmojis,
ClientFiles,
ClientGeneral,
ClientGroups,
ClientIntegrations,
ClientPosts,
ClientPreferences,
ClientScheduledPost,
ClientTeams,
ClientThreads,
ClientTos,
ClientUsers,
ClientCalls,
ClientPlugins,
ClientNPS,
ClientCustomAttributes,
ClientScheduledPost,
ClientPlaybooks,
) {
// eslint-disable-next-line no-useless-constructor
constructor(apiClient: APIClientInterface, serverUrl: string, bearerToken?: string, csrfToken?: string, preauthSecret?: string) {
super(apiClient, serverUrl, bearerToken, csrfToken, preauthSecret);
}
}
export {Client, DEFAULT_LIMIT_AFTER, DEFAULT_LIMIT_BEFORE, HEADER_X_VERSION_ID};