meshagent-agents 0.3.0__py3-none-any.whl → 0.4.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of meshagent-agents might be problematic. Click here for more details.
- meshagent/agents/mail.py +47 -7
- meshagent/agents/version.py +1 -1
- {meshagent_agents-0.3.0.dist-info → meshagent_agents-0.4.1.dist-info}/METADATA +6 -6
- {meshagent_agents-0.3.0.dist-info → meshagent_agents-0.4.1.dist-info}/RECORD +7 -7
- {meshagent_agents-0.3.0.dist-info → meshagent_agents-0.4.1.dist-info}/WHEEL +0 -0
- {meshagent_agents-0.3.0.dist-info → meshagent_agents-0.4.1.dist-info}/licenses/LICENSE +0 -0
- {meshagent_agents-0.3.0.dist-info → meshagent_agents-0.4.1.dist-info}/top_level.txt +0 -0
meshagent/agents/mail.py
CHANGED
|
@@ -3,11 +3,11 @@ from meshagent.api.room_server_client import TextDataType
|
|
|
3
3
|
from email import message_from_bytes
|
|
4
4
|
from email.message import EmailMessage
|
|
5
5
|
from email.policy import default
|
|
6
|
+
from meshagent.tools import ToolContext, Toolkit
|
|
6
7
|
import email.utils
|
|
7
8
|
from meshagent.api import ParticipantToken
|
|
8
|
-
|
|
9
9
|
from meshagent.api import RoomClient
|
|
10
|
-
|
|
10
|
+
from meshagent.agents import AgentChatContext
|
|
11
11
|
from datetime import datetime, timezone
|
|
12
12
|
|
|
13
13
|
import secrets
|
|
@@ -26,6 +26,12 @@ logger = logging.getLogger("mail")
|
|
|
26
26
|
type MessageRole = Literal["user", "agent"]
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
class MailThreadContext:
|
|
30
|
+
def __init__(self, *, chat: AgentChatContext, room_address: str):
|
|
31
|
+
self.chat = chat
|
|
32
|
+
self.room_address = room_address
|
|
33
|
+
|
|
34
|
+
|
|
29
35
|
def create_reply_email_message(
|
|
30
36
|
*, message: dict, from_address: str, body: str
|
|
31
37
|
) -> EmailMessage:
|
|
@@ -277,13 +283,24 @@ class MailWorker(Worker):
|
|
|
277
283
|
)
|
|
278
284
|
|
|
279
285
|
async def process_message(self, *, chat_context, room, message, toolkits):
|
|
286
|
+
thread_context = MailThreadContext(chat=chat_context, room_address=message)
|
|
287
|
+
toolkits = [
|
|
288
|
+
*toolkits,
|
|
289
|
+
*await self.get_thread_toolkits(thread_context=thread_context),
|
|
290
|
+
]
|
|
291
|
+
|
|
280
292
|
logger.info(f"processing message {message}")
|
|
281
|
-
|
|
282
|
-
chat_context=
|
|
293
|
+
reply = await super().process_message(
|
|
294
|
+
chat_context=thread_context.chat,
|
|
295
|
+
room=room,
|
|
296
|
+
message=message,
|
|
297
|
+
toolkits=toolkits,
|
|
283
298
|
)
|
|
299
|
+
return await self.send_reply_message(room=room, message=message, reply=reply)
|
|
284
300
|
|
|
301
|
+
async def send_reply_message(self, *, room: RoomClient, message: dict, reply: str):
|
|
285
302
|
msg = create_reply_email_message(
|
|
286
|
-
message=message, from_address=self._email_address, body=
|
|
303
|
+
message=message, from_address=self._email_address, body=reply
|
|
287
304
|
)
|
|
288
305
|
|
|
289
306
|
reply_msg_dict = await save_email_message(
|
|
@@ -300,14 +317,37 @@ class MailWorker(Worker):
|
|
|
300
317
|
if password is None:
|
|
301
318
|
password = self.room.protocol.token
|
|
302
319
|
|
|
320
|
+
hostname = self._smtp.hostname
|
|
321
|
+
if hostname is None:
|
|
322
|
+
hostname = self._domain
|
|
323
|
+
|
|
324
|
+
port = self._smtp.port
|
|
325
|
+
|
|
326
|
+
logger.info(f"using smtp {username}@{hostname}:{port}")
|
|
327
|
+
|
|
303
328
|
await aiosmtplib.send(
|
|
304
329
|
msg,
|
|
305
|
-
hostname=
|
|
306
|
-
port=
|
|
330
|
+
hostname=hostname,
|
|
331
|
+
port=port,
|
|
307
332
|
username=username,
|
|
308
333
|
password=password,
|
|
309
334
|
)
|
|
310
335
|
|
|
336
|
+
async def get_thread_toolkits(
|
|
337
|
+
self,
|
|
338
|
+
*,
|
|
339
|
+
thread_context: MailThreadContext,
|
|
340
|
+
) -> list[Toolkit]:
|
|
341
|
+
toolkits = await self.get_required_toolkits(
|
|
342
|
+
context=ToolContext(
|
|
343
|
+
room=self.room,
|
|
344
|
+
caller=self.room.local_participant,
|
|
345
|
+
caller_context={"chat": thread_context.chat.to_json()},
|
|
346
|
+
)
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
return [*self._toolkits, *toolkits]
|
|
350
|
+
|
|
311
351
|
|
|
312
352
|
def base36encode(number: int):
|
|
313
353
|
if not isinstance(number, int):
|
meshagent/agents/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.4.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meshagent-agents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Agent Building Blocks for Meshagent
|
|
5
5
|
License-Expression: Apache-2.0
|
|
6
6
|
Project-URL: Documentation, https://docs.meshagent.com
|
|
@@ -12,19 +12,19 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: pyjwt~=2.10
|
|
13
13
|
Requires-Dist: pytest~=8.4
|
|
14
14
|
Requires-Dist: pytest-asyncio~=0.26
|
|
15
|
-
Requires-Dist: meshagent-api~=0.
|
|
16
|
-
Requires-Dist: meshagent-tools~=0.
|
|
17
|
-
Requires-Dist: meshagent-openai~=0.
|
|
15
|
+
Requires-Dist: meshagent-api~=0.4.1
|
|
16
|
+
Requires-Dist: meshagent-tools~=0.4.1
|
|
17
|
+
Requires-Dist: meshagent-openai~=0.4.1
|
|
18
18
|
Requires-Dist: pydantic~=2.11
|
|
19
19
|
Requires-Dist: opentelemetry-distro~=0.54b1
|
|
20
20
|
Provides-Extra: all
|
|
21
|
-
Requires-Dist: meshagent-api[all]~=0.
|
|
21
|
+
Requires-Dist: meshagent-api[all]~=0.4.1; extra == "all"
|
|
22
22
|
Requires-Dist: chonkie~=0.5.1; extra == "all"
|
|
23
23
|
Requires-Dist: chonkie[semantic]~=0.5.1; extra == "all"
|
|
24
24
|
Requires-Dist: chonkie[openai]~=0.5.1; extra == "all"
|
|
25
25
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "all"
|
|
26
26
|
Provides-Extra: sync
|
|
27
|
-
Requires-Dist: meshagent-api[sync]~=0.
|
|
27
|
+
Requires-Dist: meshagent-api[sync]~=0.4.1; extra == "sync"
|
|
28
28
|
Provides-Extra: mail
|
|
29
29
|
Requires-Dist: aiosmtplib~=4.0.1; extra == "mail"
|
|
30
30
|
Provides-Extra: rag
|
|
@@ -7,14 +7,14 @@ meshagent/agents/development.py,sha256=AEBkkycNZDRLYIdmX2LkrVZv715ALswiwSR9CiV3H
|
|
|
7
7
|
meshagent/agents/hosting.py,sha256=tCcswAweEhlMxGaBR_m2YvUkwZiaHbTBT64urRHfK7I,5446
|
|
8
8
|
meshagent/agents/indexer.py,sha256=xFEzAmwAxhKu9xHppnxFUFlzeRHMfVk6MatRyka0ZW8,19367
|
|
9
9
|
meshagent/agents/listener.py,sha256=q5z216FMVW-a7FBs706u3IuB81VArfucxEHaHvPFHEo,5139
|
|
10
|
-
meshagent/agents/mail.py,sha256=
|
|
10
|
+
meshagent/agents/mail.py,sha256=NQUbLuUzk0xFCb_ROvD8ZWW3VnkN7pKMGJcJzcB8p3Q,12348
|
|
11
11
|
meshagent/agents/planning.py,sha256=69HLEkOR_24mZ1mcUCQVX_DgPfX5TVA7EJYCHENH6M0,21980
|
|
12
12
|
meshagent/agents/prompt.py,sha256=OSSqbzaugyQtuvYxTY5UcZQWyeV73e3GUJz_iC5xZkA,1883
|
|
13
13
|
meshagent/agents/pydantic.py,sha256=RrdOESZg-n_FyxbfkOBwRPVxV39IOjxK2unsyAGn9as,6278
|
|
14
14
|
meshagent/agents/single_shot_writer.py,sha256=miWVMo4NX8Hib0yHwDmiwuk8GraJwg1JzljsgFyTl4Y,3237
|
|
15
15
|
meshagent/agents/thread_schema.py,sha256=OGQ-H5c2fJgNOYHC3Pas8iqTi2RUSxP2bytf0SK-SYc,4208
|
|
16
16
|
meshagent/agents/utils.py,sha256=6D9GXpYu9xx5XlfD3DiGFdyOwq46e5-sTYOF_FYep1o,1446
|
|
17
|
-
meshagent/agents/version.py,sha256=
|
|
17
|
+
meshagent/agents/version.py,sha256=pMtTmSUht-XtbR_7Doz6bsQqopJJd8rZ8I8zy2HwwoA,22
|
|
18
18
|
meshagent/agents/worker.py,sha256=SkrPhxIQ-Chyjg-eZGOlehkbrVYmsas8zmZnrTsAl3o,3910
|
|
19
19
|
meshagent/agents/writer.py,sha256=dXglYgHwBrBJIaapMqBDyD3kmwSyi94tOdHH44itODc,2682
|
|
20
20
|
meshagent/agents/schemas/__init__.py,sha256=_xAhrkxvFdfer3NolrynragGxcLElGR51LSribT3deU,299
|
|
@@ -23,8 +23,8 @@ meshagent/agents/schemas/gallery.py,sha256=65IsrH2wiFIR-DNo8est-nCOC72i1Aa5EmVNU
|
|
|
23
23
|
meshagent/agents/schemas/presentation.py,sha256=aaMzkFQryurbHd1fbzTQPdN7v8QIhsjXuvbE8ZiuXNY,1589
|
|
24
24
|
meshagent/agents/schemas/schema.py,sha256=8OXGCLVouoPg6eHBU9mgf1pTGTMvVZqiKNq15wkQJe0,5310
|
|
25
25
|
meshagent/agents/schemas/super_editor_document.py,sha256=iRv4Q-DE_5kUdsAD5Rm4GwHek8L_7ZEpxIZ1x2dWjdg,1813
|
|
26
|
-
meshagent_agents-0.
|
|
27
|
-
meshagent_agents-0.
|
|
28
|
-
meshagent_agents-0.
|
|
29
|
-
meshagent_agents-0.
|
|
30
|
-
meshagent_agents-0.
|
|
26
|
+
meshagent_agents-0.4.1.dist-info/licenses/LICENSE,sha256=eTt0SPW-sVNdkZe9PS_S8WfCIyLjRXRl7sUBWdlteFg,10254
|
|
27
|
+
meshagent_agents-0.4.1.dist-info/METADATA,sha256=eVrK8i5KFqzWhQaen2zqvw_GugOz9cJgGwryQApNgnE,3731
|
|
28
|
+
meshagent_agents-0.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
29
|
+
meshagent_agents-0.4.1.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
|
|
30
|
+
meshagent_agents-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|