* Add two-phase tool call approval for agents in channels Implements the mobile counterpart to the webapp's multiplayer tool calling feature. When a bot is @mentioned in a channel, tool call arguments and results are redacted from other members. Only the invoker can approve/reject tool execution (Phase 1) and decide whether to share results with the channel (Phase 2). See mattermost/mattermost-plugin-agents#491 for the server/webapp changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add tests for channel tool calling utilities and remote actions Tests for isToolCallRedacted, isPendingToolResult, getToolApprovalStage, mergeToolCalls utility functions and fetchToolCallPrivate, fetchToolResultPrivate, submitToolResult remote actions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add e2e tests and testIDs for agent tool calls in channels Adds detox e2e tests covering tool call card rendering, approval buttons, result approval phase, and multi-tool-call scenarios. Adds testID props to ToolApprovalSet and ToolCard components to support the e2e tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Address PR review feedback for two-phase tool call approval - Fix mergeToolCalls to preserve public-only tools instead of dropping them - Fix stale closure race in handleToolDecision with functional setState - Add forceLogoutIfNecessary to tool_private and tool_result remote actions - Show snackbar on submit failure using existing error types - Reset isDM in catch block to prevent stale state - Sync animation shared values when isCollapsed changes externally - Clear private data on streaming-to-persisted transition - Wrap action buttons with usePreventDoubleTap - Use toolCalls reference instead of toolCalls.length in effect dependency - Fix grammar in warning callout ("its" -> "their") - Change fontWeight from number to string per RN conventions Co-authored-by: Cursor <cursoragent@cursor.com> * Address PR review feedback: withObservables HOC, memoization, typography - Refactor AgentPost to use withObservables HOC for channel observation instead of useEffect+subscribe, providing isDM as a prop - Memoize undecidedCount in ToolApprovalSet and move before early return - Replace manual font styles with typography() utility in ToolCard Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
/**
|
|
* Agent post types
|
|
*/
|
|
export const AGENT_POST_TYPES = {
|
|
LLMBOT: 'custom_llmbot',
|
|
LLM_POSTBACK: 'custom_llm_postback',
|
|
} as const;
|
|
|
|
/**
|
|
* Minimum touch target size for accessibility (44pt per iOS HIG)
|
|
*/
|
|
export const TOUCH_TARGET_SIZE = 44;
|
|
|
|
/**
|
|
* WebSocket event name for agent post updates
|
|
*/
|
|
export const AGENT_WEBSOCKET_EVENT = 'custom_mattermost-ai_postupdate';
|
|
|
|
/**
|
|
* WebSocket event name for tool call status updates in channels
|
|
*/
|
|
export const AGENT_TOOL_CALL_STATUS_EVENT = 'custom_mattermost-ai_tool_call_status_updated';
|
|
|
|
/**
|
|
* Control signal values from WebSocket messages
|
|
*/
|
|
export const CONTROL_SIGNALS = {
|
|
START: 'start',
|
|
END: 'end',
|
|
CANCEL: 'cancel',
|
|
REASONING_SUMMARY: 'reasoning_summary',
|
|
REASONING_SUMMARY_DONE: 'reasoning_summary_done',
|
|
TOOL_CALL: 'tool_call',
|
|
ANNOTATIONS: 'annotations',
|
|
} as const;
|
|
|
|
export const DEFAULT_AGENT_BOT_USERNAME = 'ai-bot';
|
|
export const AGENT_ANALYSIS_SUMMARY = 'summarize_channel';
|