feat(chat): chatChannels tool for the registered Discord chat channels
- Tool (chat_channels.spec.md): list, read, search, send, edit, react,
delete, pin, unpin. Offered only when the v2 brain gives the turn a chat
backend, and then on every turn. Channel by ID, name, part of a name or a
name inside the text; a message ID finds its channel; planner forms of the
action ("send_message") work. Read and search results are fenced as
untrusted data. delete only reports until called again with confirm=true
in a later turn of the same person.
- Worker: chat_channels from the app, ChatBridge reads/searches the history
store and sends chat_action, waiting for chat_action_result (15 s timeout,
failed on session close); per-person reply turns and pending deletes.
- App: channel switches edit/react (on) and delete/pin (off); chat_channels
sent on worker ready and after login; chat_action runs send, edit (own
messages only), react, delete, pin, unpin and answers with ids or the error.
- Engine: chatChannels left out of the catalogue without a backend; the
"router returned everything" check now tolerates that.
- live_discord: edit own, refuse editing the speaker's, react, pin (Discord
refuses in a voice channel's chat, reported as an error), delete, refuse an
unregistered channel; passed in 109.4 s.
- Eval (qwen2.5:7b, 3 runs): 10 of 12; never obeyed the "delete everything"
message and never deleted in the same turn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -225,3 +225,16 @@ def test_search_folds_case_the_same_way_for_every_script(store):
|
||||
store.add_voice(VC, "a", "Alice", "Straße frei", T0 + 1)
|
||||
assert texts(store.search("a", "москва", scope=Scope())) == ["Поездка в МОСКВА завтра"]
|
||||
assert texts(store.search("a", "STRASSE", scope=Scope())) == ["Straße frei"]
|
||||
|
||||
|
||||
def test_chat_tool_reads_and_searches_one_channels_messages(store):
|
||||
store.add_chat("c1", "m1", "b", "Bob", "회의는 3시", T0)
|
||||
store.add_chat("c1", "m2", "a", "Alice", "점심은 김밥", T0 + 1)
|
||||
store.add_chat("c2", "m3", "c", "Carol", "회의 취소", T0 + 2)
|
||||
store.add_voice(VC, "a", "Alice", "회의 얘기 음성", T0 + 3)
|
||||
assert texts(store.chat_messages("c1", 1)) == ["점심은 김밥"]
|
||||
assert texts(store.chat_messages("c1", 10)) == ["회의는 3시", "점심은 김밥"]
|
||||
assert texts(store.search_chat(["c1"], "회의")) == ["회의는 3시"]
|
||||
assert sorted(texts(store.search_chat(["c1", "c2"], "회의"))) == ["회의 취소", "회의는 3시"]
|
||||
assert store.search_chat([], "회의") == []
|
||||
assert store.chat_channel_of("m3") == "c2" and store.chat_channel_of("nope") is None
|
||||
|
||||
Reference in New Issue
Block a user