feat: add thread info and status reads
This commit is contained in:
16 files changed
+496
-33
No files matched your search
@@ -1,27 +1,40 @@
|
||||
from typing import Protocol
|
||||
|
||||
from agentmsgs.core.store import Store
|
||||
from agentmsgs.core.store import (
|
||||
AgentStore,
|
||||
CursorStore,
|
||||
MessageStore,
|
||||
Store,
|
||||
ThreadStore,
|
||||
)
|
||||
|
||||
|
||||
def test_store_is_protocol():
|
||||
def test_store_composes_domain_protocols():
|
||||
assert issubclass(Store, Protocol)
|
||||
# check required methods exist
|
||||
for m in [
|
||||
"get_or_create_agent",
|
||||
"get_agent_by_name",
|
||||
"get_agent_by_id",
|
||||
"create_agent",
|
||||
"delete_agent",
|
||||
"list_agents",
|
||||
"create_thread",
|
||||
"get_thread",
|
||||
"find_threads",
|
||||
"add_participant",
|
||||
"remove_participant",
|
||||
"delete_thread",
|
||||
"append_message",
|
||||
"list_messages",
|
||||
"get_cursor",
|
||||
"set_cursor",
|
||||
]:
|
||||
assert hasattr(Store, m), f"missing {m}"
|
||||
assert AgentStore in Store.__mro__
|
||||
assert ThreadStore in Store.__mro__
|
||||
assert MessageStore in Store.__mro__
|
||||
assert CursorStore in Store.__mro__
|
||||
|
||||
for protocol, methods in {
|
||||
AgentStore: [
|
||||
"get_or_create_agent",
|
||||
"get_agent_by_name",
|
||||
"get_agent_by_id",
|
||||
"create_agent",
|
||||
"delete_agent",
|
||||
"list_agents",
|
||||
],
|
||||
ThreadStore: [
|
||||
"create_thread",
|
||||
"get_thread",
|
||||
"find_threads",
|
||||
"add_participant",
|
||||
"remove_participant",
|
||||
"delete_thread",
|
||||
],
|
||||
MessageStore: ["append_message", "list_messages"],
|
||||
CursorStore: ["get_cursor", "set_cursor"],
|
||||
}.items():
|
||||
for method in methods:
|
||||
assert hasattr(protocol, method), f"missing {method} from {protocol.__name__}"
|
||||
Reference in new issue
Block a user