feat(feishu): bind credentials through participants#204
Conversation
| type bindResult struct { | ||
| Status string `json:"status"` | ||
| Channel string `json:"channel"` | ||
| FeishuKind string `json:"feishu_kind"` |
There was a problem hiding this comment.
Isn't FeishuKind too specific for a general structure? Propose ParticipantType or so to align with type in Participant.
|
|
||
| func (s *Service) appConfigForMentionLocked(mention string) (AppConfig, error) { | ||
| if app, ok := s.apps[mention]; ok { | ||
| if app, ok := s.appConfigByIDLocked(mention); ok { |
There was a problem hiding this comment.
The new bind flow stores two different Feishu participant shapes: agent participants carry app credentials in channel_app_config, while the admin human carries only channel_user_kind=open_id and channel_user_ref=ou_xxx. Feishu can mention a human by open_id; the sender app config is required to send the message, but the human target should not need its own app config.
This path still treats every mention target as app-backed: SendMessage resolves mention_id through appConfigForMentionLocked, and defaultSendMessage then fetches a bot open_id from that target app. That works for agent participants, but mention_id=admin fails before send because the human participant has no app config.
Proposal: resolve mention targets through the participant model first. For type=human + channel_user_kind=open_id, use channel_user_ref as the Feishu at-user open_id. For type=agent, keep resolving the bot open_id from its app config. Please add focused coverage for agent -> admin human mention and keep the existing agent -> agent mention behavior.
| h.handleParticipantEventsStream(w, r, participantID) | ||
| case "feishu": | ||
| h.handleFeishuParticipantEvents(w, r, h.resolveFeishuParticipantTargetID(id)) | ||
| h.handleFeishuParticipantEvents(w, r, id, h.resolveFeishuParticipantTargetID(id)) |
There was a problem hiding this comment.
This event target set includes the participant id and channel_user_ref, but app-backed Feishu agents have no channel_user_ref. Real Feishu mention events normally carry the bot open_id, so /channels/feishu/participants/{id}/events may miss real @agent events unless the target set also includes the resolved bot open_id or inbound Feishu mentions are normalized to participant IDs before filtering.
850a6ec to
6dc8a28
Compare
| @@ -0,0 +1,184 @@ | |||
| package feishuparticipant | |||
There was a problem hiding this comment.
This package does not introduce a new channel; it implements a participant-backed provider for the existing Feishu channel. Keeping it under internal/channel/feishuparticipant makes the directory layout read like a new channel module. Would it be clearer to move this into internal/channel/feishu, for example as participant_provider.go or participant.go, so the package structure matches the actual responsibility?
|
This now masks |
Summary