Feishu Takeoverdoc/{zh,en}/design/plugins/feishu-takeover.md

Takeover: Answering a Chat Without Being Addressed

Status: built on 2026-12-03 for the Feishu bot and the Feishu digital twin (/dt); unit tests pass, not yet tried in a live Feishu chat. The owner's decisions of 2026-12-03: the com

Status: built on 2026-12-03 for the Feishu bot and the Feishu digital twin (/dt); unit tests pass, not yet tried in a live Feishu chat. The owner's decisions of 2026-12-03: the command words, every kind of chat, the twin's marker kept, and on until turned off.

1. Scenario

An admin hands a chat over to Orquelo. From then on a message there from another person is read even without /dt or a mention of the bot, and Orquelo answers it on the owner's behalf when it needs an answer; otherwise nothing is sent: no reply, no status reaction.

  • ◆Bot: an admin sends /takeover on (in a group, mentioning the bot), /takeover off, or /takeover to see the state.
  • ◆Twin: the owner sends /dt takeover on, /dt takeover off or /dt takeover in the chat.
  • ◆Every kind of chat: direct chats, normal groups and topic groups.
  • ◆The switch is kept per chat until an admin turns it off, across Host restarts.

2. Call Chain

text
Transport ── event (Mentioned: false) ──▶ Host: TriggerInput.TakenOver ──▶ chat trigger: start, Takeover
   ▲                                                                              │
   └── TakeoverReader.TakenOver (twin only)                                       ▼
Delivery ◀── nothing, or the answer ◀── Host: run.takeover = 1 ◀── Runtime: RunInput.Takeover, stay_silent
  1. Transport. The bot already submits a group line that does not mention it (Feishu delivers them with the bot's group-message permission; the Host keeps them as chat lines). The twin submits only what it acts on, so it asks the Host (plugin.TakeoverReader, implemented by the transport host) whether the chat is taken over, and then submits another person's text or post message without /dt as an event with Mentioned: false, in the thread it is in (or none). The owner's own messages, bots' messages and the twin's replies are never taken. Neither side shows a status reaction for such an event.
  2. Host routing. For an event with Mentioned: false, the Host reads the switch (takeovers table, per connection and conversation id) into TriggerInput.TakenOver.
  3. Trigger. The chat trigger starts a run with Decision.Takeover for a person's non-empty line in a taken-over chat, with the text as written (no directive applies); a bot's line is ignored as before. /takeover maps to DecisionTakeover with on, off or nothing.
  4. Host. DecisionTakeover is admins only: it sets or clears the switch and answers with a notice (takeover.is_on, takeover.is_off, takeover.usage, takeover.forbidden). A takeover run is marked (runs.takeover), does not close a pending question, shows no progress, and when it fails or ends with nothing to say, nothing is delivered; the log and the run's record keep it.
  5. Runtime. RunInput.Takeover tells the runtime the line was not addressed to it; RunInput.MayStaySilent() covers it and a quiet schedule. The builtin agent sees a takeover note in its context and is offered stay_silent. An external runtime has no such tool and always answers.
  6. Delivery. The bot replies to the message as usual. The twin quotes the message in the chat (in a topic group it joins the message's topic; in a thread, the thread), with its "Answered by Orquelo" marker (owner decision 2).

3. Contracts

ContractChange
plugin.DecisionTakeoverNew control action; Text is on, off or empty
plugin.TriggerInput.TakenOverThe conversation is taken over
plugin.Decision.TakeoverWith start: a takeover run
plugin.RunInput.Takeover, MayStaySilent()The run answers a line not addressed to it
plugin.TakeoverReaderOptional interface of the transport host
MigrationTable takeovers, column runs.takeover

The switch has no deadline by the owner's choice; turning it off is its way out. A takeover run's state ends like any run's.

4. Trust

A takeover run belongs to the person who wrote the line and has that person's grants, not the owner's. The twin still sends the answer from the owner's account, which the owner accepts by turning takeover on. The confirmation of /dt takeover on is the Host's notice, which in a chat others are in is visible to them; it differs from the "only the owner sees it" default the vq intake proposed, since the twin cannot send a message that only the owner sees.

A takeover run acts on a stranger's line and answers as the owner, so it gets none of the runtime's tools but those the configuration's takeover.tools lists, by tool name or instance id (none by default; the runtime's own stay_silent stays); a tool left out and called by name is refused. Its approvals go to the admins, never to the person whose line started it (Feishu #377, #392).

5. Verification

Unit tests: plugins/chat/takeover_test.go, internal/host/engine/takeover_test.go (on, off, a non-admin refused, an answer, silence and a failure sending nothing, no progress), plugins/feishu/webtakeover_test.go and TestDeliverWeb (a topic group), plugins/agent/staysilent_test.go. The vq e2e cases cover only the bot's direct chat; the main path needs a second account in a live chat.