mattermost-mobile/agent-ops/rules/domain/products-agents/rules.md
toki f013531d65
Some checks failed
ci / test (push) Has been cancelled
Update project configuration and add agent-ops skills
2026-03-21 13:05:45 +09:00

2.1 KiB

name description type
products-agents AI 에이전트 기능 - WebSocket 스트리밍, AI 봇, 툴 호출 core

Products/Agents Domain

목적 / 책임

AI 에이전트 기능을 담당한다. WebSocket 스트리밍, AI 봇 관리, 툴 호출/승인, 어노테이션을 처리한다.

포함 경로

  • app/products/agents/ (전체)
    • app/products/agents/actions/
    • app/products/agents/client/rest.ts
    • app/products/agents/components/
    • app/products/agents/constants.ts
    • app/products/agents/hooks/
    • app/products/agents/screens/
    • app/products/agents/store/
    • app/products/agents/types/
    • app/products/agents/websocket/

제외 경로

  • app/actions/remote/ (messaging 도메인)
  • app/products/calls/ (calls 도메인)

주요 구성 요소

  • WebSocket Handler: custom_mattermost-ai_postupdate 이벤트 처리 (start, message, reasoning, tool_call, annotation, end)
  • Streaming Store: 스트리밍 중 ephemeral 상태 관리
  • AI Bot: AI 봇 목록 조회 및 DB 동기화 (handleAIBots)
  • Tool Call: 툴 호출 승인/거절 처리
  • Client (ClientMix): app/products/agents/client/rest.ts

유지할 패턴

  • WebSocket 스트리밍: ENDED 이벤트에서 로컬 스트리밍 상태를 반드시 초기화 (stale state 방지)
  • ClientMix 패턴: API 호출은 client/rest.ts 내에서만 수행, action에서 직접 doFetch() 금지
  • PostType 추가 시: types/api/posts.d.tsPostType union에 타입 추가
  • Sync handler: create/update/delete 모두 처리 (prepareDestroyPermanently() 필수)

다른 도메인과의 경계

  • messaging 도메인: 포스트 데이터는 POST_EDITED WebSocket 이벤트로 수신
  • database 도메인: Agents 전용 DB 모델 사용
  • network 도메인: ClientMix를 통해 NetworkManager와 연결

금지 사항

  • 툴 호출 상태 변경을 별도 WebSocket 이벤트로 처리 (→ POST_EDITED로 수신)
  • ENDED 이벤트 후 스트리밍 상태 미초기화
  • action 파일에서 직접 client.doFetch() 호출