chatom 0.2.0__tar.gz → 0.2.2__tar.gz
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.
- {chatom-0.2.0 → chatom-0.2.2}/.gitignore +6 -0
- chatom-0.2.2/PKG-INFO +158 -0
- chatom-0.2.2/README.md +94 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/__init__.py +114 -112
- {chatom-0.2.0 → chatom-0.2.2}/chatom/agent/__init__.py +2 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/agent/context.py +6 -7
- chatom-0.2.2/chatom/agent/files.py +185 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/agent/toolset.py +225 -72
- {chatom-0.2.0 → chatom-0.2.2}/chatom/backend/__init__.py +3 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/backend/backend.py +158 -112
- {chatom-0.2.0 → chatom-0.2.2}/chatom/backend/backend_config.py +2 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/backend/backend_registry.py +19 -25
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/attachment.py +7 -7
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/authorization.py +39 -42
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/base.py +3 -3
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/capabilities.py +7 -5
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/channel.py +7 -7
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/connection.py +33 -35
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/conversion.py +24 -28
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/embed.py +11 -12
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/interaction.py +7 -7
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/mention.py +17 -22
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/message.py +21 -21
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/organization.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/presence.py +5 -6
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/reaction.py +6 -6
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/testing.py +35 -35
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/thread.py +3 -3
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/user.py +3 -3
- {chatom-0.2.0 → chatom-0.2.2}/chatom/bridge/identity.py +28 -28
- {chatom-0.2.0 → chatom-0.2.2}/chatom/bridge/relay.py +10 -10
- {chatom-0.2.0 → chatom-0.2.2}/chatom/csp/__init__.py +2 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/csp/adapter.py +15 -11
- {chatom-0.2.0 → chatom-0.2.2}/chatom/csp/interactions.py +11 -12
- {chatom-0.2.0 → chatom-0.2.2}/chatom/csp/nodes.py +25 -23
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/backend.py +86 -95
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/channel.py +3 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/config.py +3 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/guild.py +4 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/mention.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/message.py +14 -14
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/presence.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/testing.py +61 -61
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/user.py +3 -3
- {chatom-0.2.0 → chatom-0.2.2}/chatom/enums.py +1 -15
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/basic_connection.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/cross_platform_bot.py +4 -5
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/direct_messages.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/formatted_messages.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/listen_for_messages.py +3 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/mentions_and_reactions.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/message_history.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/send_message.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/threads_and_replies.py +1 -2
- chatom-0.2.2/chatom/examples/unified_frontend.py +32 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/attachment.py +5 -7
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/components.py +57 -59
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/embed.py +14 -14
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/message.py +28 -28
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/parse.py +8 -16
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/spec/symphony.py +11 -13
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/table.py +14 -14
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/telegram.py +7 -8
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/text.py +30 -46
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/variant.py +6 -16
- {chatom-0.2.0 → chatom-0.2.2}/chatom/handlers.py +10 -9
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/cli.py +3 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/server.py +83 -41
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/backend.py +78 -80
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/channel.py +2 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/config.py +7 -8
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/mention.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/message.py +24 -20
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/presence.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/testing.py +63 -63
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/backend.py +387 -130
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/channel.py +2 -3
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/config.py +68 -58
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/message.py +18 -18
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/presence.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/testing.py +56 -56
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/user.py +1 -3
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/backend.py +67 -62
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/config.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/mention.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/message.py +14 -14
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/testing.py +59 -59
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/combined_e2e.py +202 -181
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_message_conversion_slack.py +26 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/integration/test_telegram_integration.py +6 -6
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_access_policy.py +40 -12
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_agent.py +199 -65
- chatom-0.2.2/chatom/tests/test_attachment_files.py +92 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_backend.py +1 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_backend_registry.py +14 -16
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_bot_features.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_bridge.py +3 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_conversion.py +1 -1
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_csp.py +54 -26
- chatom-0.2.2/chatom/tests/test_enums.py +90 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_format.py +88 -0
- chatom-0.2.2/chatom/tests/test_incoming_attachments.py +399 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_interactions.py +5 -6
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_mcp.py +132 -42
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_mock_backends.py +18 -16
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_symphony_fetch_messages.py +178 -14
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_testing.py +2 -2
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_threads.py +2 -2
- {chatom-0.2.0 → chatom-0.2.2}/pyproject.toml +14 -15
- chatom-0.2.0/PKG-INFO +0 -522
- chatom-0.2.0/README.md +0 -466
- chatom-0.2.0/chatom/tests/test_enums.py +0 -38
- chatom-0.2.0/chatom/tests/test_incoming_attachments.py +0 -164
- {chatom-0.2.0 → chatom-0.2.2}/LICENSE +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/base/__init__.py +55 -55
- {chatom-0.2.0 → chatom-0.2.2}/chatom/bridge/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/discord/__init__.py +7 -7
- {chatom-0.2.0 → chatom-0.2.2}/chatom/examples/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/__init__.py +50 -50
- {chatom-0.2.0 → chatom-0.2.2}/chatom/format/spec/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/config.yaml +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/gateway/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/gateway/discord.yaml +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/gateway/slack.yaml +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/gateway/symphony.yaml +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/gateway/symphony_dev.yaml +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/mcp/config/gateway/telegram.yaml +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/__init__.py +6 -6
- {chatom-0.2.0 → chatom-0.2.2}/chatom/slack/user.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/__init__.py +8 -8
- {chatom-0.2.0 → chatom-0.2.2}/chatom/symphony/mention.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/__init__.py +4 -4
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/channel.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/presence.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/telegram/user.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_message_conversion.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_message_conversion_cross.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_message_conversion_discord.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_message_conversion_symphony.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_symphony_messageml_compliance.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/conversion/test_telegram_html.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/integration/__init__.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/integration/test_discord_integration.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/integration/test_slack_integration.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/integration/test_symphony_integration.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_all.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_backends.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_base_models.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_config.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_connection.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_discord_channel_conversion.py +0 -0
- {chatom-0.2.0 → chatom-0.2.2}/chatom/tests/test_mention.py +0 -0
|
@@ -13,6 +13,10 @@ __pycache__/
|
|
|
13
13
|
*.exp
|
|
14
14
|
*.lib
|
|
15
15
|
|
|
16
|
+
# vcpkg
|
|
17
|
+
vcpkg/
|
|
18
|
+
vcpkg_installed/
|
|
19
|
+
|
|
16
20
|
# Rust
|
|
17
21
|
target
|
|
18
22
|
target-capi
|
|
@@ -119,6 +123,7 @@ docs/api
|
|
|
119
123
|
docs/html
|
|
120
124
|
docs/index.md
|
|
121
125
|
docs/jupyter_execute
|
|
126
|
+
docs/versions/
|
|
122
127
|
docs/src/_build/
|
|
123
128
|
docs/superpowers
|
|
124
129
|
index.md
|
|
@@ -142,6 +147,7 @@ chatom/labextension
|
|
|
142
147
|
|
|
143
148
|
# Emscripten SDK (locally installed)
|
|
144
149
|
emsdk
|
|
150
|
+
.pyodide_build/
|
|
145
151
|
|
|
146
152
|
# Mac
|
|
147
153
|
.DS_Store
|
chatom-0.2.2/PKG-INFO
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: chatom
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Minimum viable chat components
|
|
5
|
+
Project-URL: Repository, https://github.com/1kbgz/chatom
|
|
6
|
+
Project-URL: Homepage, https://github.com/1kbgz/chatom
|
|
7
|
+
Author-email: the chatom authors <dev@1kbgz.com>
|
|
8
|
+
License: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agent,chat,chatbot,discord,llm,mcp,messenger,model-context-protocol,slack,symphony,telegram
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
19
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: mistune>=3
|
|
22
|
+
Requires-Dist: pydantic>=2
|
|
23
|
+
Requires-Dist: singledispatch
|
|
24
|
+
Provides-Extra: agent
|
|
25
|
+
Requires-Dist: openpyxl<4,>=3.1; extra == 'agent'
|
|
26
|
+
Requires-Dist: pydantic-ai>=0.4; extra == 'agent'
|
|
27
|
+
Requires-Dist: pypdf<7,>=6; extra == 'agent'
|
|
28
|
+
Requires-Dist: python-docx<2,>=1; extra == 'agent'
|
|
29
|
+
Requires-Dist: reportlab<6,>=4; extra == 'agent'
|
|
30
|
+
Provides-Extra: develop
|
|
31
|
+
Requires-Dist: build; extra == 'develop'
|
|
32
|
+
Requires-Dist: bump-my-version; extra == 'develop'
|
|
33
|
+
Requires-Dist: check-dist; extra == 'develop'
|
|
34
|
+
Requires-Dist: codespell; extra == 'develop'
|
|
35
|
+
Requires-Dist: csp; extra == 'develop'
|
|
36
|
+
Requires-Dist: discord-py; extra == 'develop'
|
|
37
|
+
Requires-Dist: fastmcp>=2; extra == 'develop'
|
|
38
|
+
Requires-Dist: hatchling; extra == 'develop'
|
|
39
|
+
Requires-Dist: hydra-core>=1.3; extra == 'develop'
|
|
40
|
+
Requires-Dist: mdformat; extra == 'develop'
|
|
41
|
+
Requires-Dist: mdformat-tables>=1; extra == 'develop'
|
|
42
|
+
Requires-Dist: openpyxl<4,>=3.1; extra == 'develop'
|
|
43
|
+
Requires-Dist: pydantic-ai>=0.4; extra == 'develop'
|
|
44
|
+
Requires-Dist: pypdf<7,>=6; extra == 'develop'
|
|
45
|
+
Requires-Dist: pytest; extra == 'develop'
|
|
46
|
+
Requires-Dist: pytest-asyncio; extra == 'develop'
|
|
47
|
+
Requires-Dist: pytest-cov; extra == 'develop'
|
|
48
|
+
Requires-Dist: pytest-mock; extra == 'develop'
|
|
49
|
+
Requires-Dist: python-docx<2,>=1; extra == 'develop'
|
|
50
|
+
Requires-Dist: python-telegram-bot; extra == 'develop'
|
|
51
|
+
Requires-Dist: reportlab<6,>=4; extra == 'develop'
|
|
52
|
+
Requires-Dist: ruff; extra == 'develop'
|
|
53
|
+
Requires-Dist: slack-sdk; extra == 'develop'
|
|
54
|
+
Requires-Dist: symphony-bdk-python; extra == 'develop'
|
|
55
|
+
Requires-Dist: twine; extra == 'develop'
|
|
56
|
+
Requires-Dist: ty; extra == 'develop'
|
|
57
|
+
Requires-Dist: uv; extra == 'develop'
|
|
58
|
+
Requires-Dist: whatsapp-python; extra == 'develop'
|
|
59
|
+
Requires-Dist: wheel; extra == 'develop'
|
|
60
|
+
Provides-Extra: mcp
|
|
61
|
+
Requires-Dist: fastmcp>=2; extra == 'mcp'
|
|
62
|
+
Requires-Dist: hydra-core>=1.3; extra == 'mcp'
|
|
63
|
+
Description-Content-Type: text/markdown
|
|
64
|
+
|
|
65
|
+
<p>
|
|
66
|
+
<img src="https://github.com/1kbgz/chatom/raw/main/docs/img/logo-light.png?raw=true#gh-light-mode-only" alt="chatom" width="150">
|
|
67
|
+
<img src="https://github.com/1kbgz/chatom/raw/main/docs/img/logo-dark.png?raw=true#gh-dark-mode-only" alt="chatom" width="150">
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
# Chatom
|
|
71
|
+
|
|
72
|
+
A unified Python frontend for Discord, Slack, Symphony, Telegram, and other chat backends.
|
|
73
|
+
|
|
74
|
+
[](https://github.com/1kbgz/chatom/actions/workflows/build.yaml)
|
|
75
|
+
[](https://codecov.io/gh/1kbgz/chatom)
|
|
76
|
+
[](https://github.com/1kbgz/chatom)
|
|
77
|
+
[](https://pypi.python.org/pypi/chatom)
|
|
78
|
+
|
|
79
|
+
Chatom lets application code use one set of users, channels, messages, formatting nodes, interactions, and backend operations. Platform adapters translate that frontend to Discord, Slack, Symphony, or Telegram at the edge. The same models also feed cross-platform bridges, pydantic-ai tools, MCP servers, and CSP graphs.
|
|
80
|
+
|
|
81
|
+
## Install
|
|
82
|
+
|
|
83
|
+
Chatom requires Python 3.11 or newer.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pip install chatom
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Install the SDKs for the backends you use:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pip install slack-sdk discord.py symphony-bdk-python python-telegram-bot
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Optional integrations are available with `chatom[agent]` and `chatom[mcp]`.
|
|
96
|
+
|
|
97
|
+
## One message, four backends
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from chatom import MessageBuilder
|
|
101
|
+
|
|
102
|
+
message = (
|
|
103
|
+
MessageBuilder()
|
|
104
|
+
.heading("Deployment status", level=2)
|
|
105
|
+
.paragraph("All checks passed.")
|
|
106
|
+
.bold("Environment: ")
|
|
107
|
+
.text("production")
|
|
108
|
+
.table(
|
|
109
|
+
[["API", "healthy"], ["Workers", "healthy"]],
|
|
110
|
+
headers=["Service", "State"],
|
|
111
|
+
)
|
|
112
|
+
.build()
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
slack_content = message.render_for("slack")
|
|
116
|
+
discord_content = message.render_for("discord")
|
|
117
|
+
symphony_content = message.render_for("symphony")
|
|
118
|
+
telegram_content = message.render_for("telegram")
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Message construction stays unchanged. Only rendering and backend configuration know which platform receives it.
|
|
122
|
+
|
|
123
|
+
Connected backends share the same lifecycle and operation shape:
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
await backend.connect()
|
|
127
|
+
try:
|
|
128
|
+
channel = await backend.fetch_channel(name="operations")
|
|
129
|
+
await backend.send_message(channel, message.render_for(backend.name))
|
|
130
|
+
finally:
|
|
131
|
+
await backend.disconnect()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## What the frontend covers
|
|
135
|
+
|
|
136
|
+
- Platform-independent models for users, channels, organizations, threads, messages, attachments, embeds, reactions, presence, and interactions
|
|
137
|
+
- Rich text, tables, mentions, embeds, buttons, select menus, and format conversion
|
|
138
|
+
- A common asynchronous backend interface with a synchronous facade
|
|
139
|
+
- Backend capabilities for feature-dependent operations such as reactions, editing, files, presence, and threads
|
|
140
|
+
- Model promotion and demotion between common and backend-specific types
|
|
141
|
+
- Identity mapping and message forwarding between platforms
|
|
142
|
+
- Agent, MCP, and CSP integrations built on the same backend contract
|
|
143
|
+
- In-memory Discord, Slack, Symphony, and Telegram backends for tests
|
|
144
|
+
|
|
145
|
+
## Documentation
|
|
146
|
+
|
|
147
|
+
- [Installation](docs/src/installation.md)
|
|
148
|
+
- [Tutorials](docs/src/tutorials.md)
|
|
149
|
+
- [How-to guides](docs/src/howtos.md)
|
|
150
|
+
- [Why the unified frontend works](docs/src/concepts.md)
|
|
151
|
+
- [API reference](docs/src/api.md)
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
Chatom is licensed under the [Apache License 2.0](LICENSE).
|
|
156
|
+
|
|
157
|
+
> [!NOTE]
|
|
158
|
+
> This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base)
|
chatom-0.2.2/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
<img src="https://github.com/1kbgz/chatom/raw/main/docs/img/logo-light.png?raw=true#gh-light-mode-only" alt="chatom" width="150">
|
|
3
|
+
<img src="https://github.com/1kbgz/chatom/raw/main/docs/img/logo-dark.png?raw=true#gh-dark-mode-only" alt="chatom" width="150">
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
# Chatom
|
|
7
|
+
|
|
8
|
+
A unified Python frontend for Discord, Slack, Symphony, Telegram, and other chat backends.
|
|
9
|
+
|
|
10
|
+
[](https://github.com/1kbgz/chatom/actions/workflows/build.yaml)
|
|
11
|
+
[](https://codecov.io/gh/1kbgz/chatom)
|
|
12
|
+
[](https://github.com/1kbgz/chatom)
|
|
13
|
+
[](https://pypi.python.org/pypi/chatom)
|
|
14
|
+
|
|
15
|
+
Chatom lets application code use one set of users, channels, messages, formatting nodes, interactions, and backend operations. Platform adapters translate that frontend to Discord, Slack, Symphony, or Telegram at the edge. The same models also feed cross-platform bridges, pydantic-ai tools, MCP servers, and CSP graphs.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Chatom requires Python 3.11 or newer.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install chatom
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Install the SDKs for the backends you use:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install slack-sdk discord.py symphony-bdk-python python-telegram-bot
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Optional integrations are available with `chatom[agent]` and `chatom[mcp]`.
|
|
32
|
+
|
|
33
|
+
## One message, four backends
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from chatom import MessageBuilder
|
|
37
|
+
|
|
38
|
+
message = (
|
|
39
|
+
MessageBuilder()
|
|
40
|
+
.heading("Deployment status", level=2)
|
|
41
|
+
.paragraph("All checks passed.")
|
|
42
|
+
.bold("Environment: ")
|
|
43
|
+
.text("production")
|
|
44
|
+
.table(
|
|
45
|
+
[["API", "healthy"], ["Workers", "healthy"]],
|
|
46
|
+
headers=["Service", "State"],
|
|
47
|
+
)
|
|
48
|
+
.build()
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
slack_content = message.render_for("slack")
|
|
52
|
+
discord_content = message.render_for("discord")
|
|
53
|
+
symphony_content = message.render_for("symphony")
|
|
54
|
+
telegram_content = message.render_for("telegram")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Message construction stays unchanged. Only rendering and backend configuration know which platform receives it.
|
|
58
|
+
|
|
59
|
+
Connected backends share the same lifecycle and operation shape:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
await backend.connect()
|
|
63
|
+
try:
|
|
64
|
+
channel = await backend.fetch_channel(name="operations")
|
|
65
|
+
await backend.send_message(channel, message.render_for(backend.name))
|
|
66
|
+
finally:
|
|
67
|
+
await backend.disconnect()
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## What the frontend covers
|
|
71
|
+
|
|
72
|
+
- Platform-independent models for users, channels, organizations, threads, messages, attachments, embeds, reactions, presence, and interactions
|
|
73
|
+
- Rich text, tables, mentions, embeds, buttons, select menus, and format conversion
|
|
74
|
+
- A common asynchronous backend interface with a synchronous facade
|
|
75
|
+
- Backend capabilities for feature-dependent operations such as reactions, editing, files, presence, and threads
|
|
76
|
+
- Model promotion and demotion between common and backend-specific types
|
|
77
|
+
- Identity mapping and message forwarding between platforms
|
|
78
|
+
- Agent, MCP, and CSP integrations built on the same backend contract
|
|
79
|
+
- In-memory Discord, Slack, Symphony, and Telegram backends for tests
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
- [Installation](docs/src/installation.md)
|
|
84
|
+
- [Tutorials](docs/src/tutorials.md)
|
|
85
|
+
- [How-to guides](docs/src/howtos.md)
|
|
86
|
+
- [Why the unified frontend works](docs/src/concepts.md)
|
|
87
|
+
- [API reference](docs/src/api.md)
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
Chatom is licensed under the [Apache License 2.0](LICENSE).
|
|
92
|
+
|
|
93
|
+
> [!NOTE]
|
|
94
|
+
> This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base)
|
|
@@ -19,6 +19,7 @@ For platform-specific functionality, import from the backend modules:
|
|
|
19
19
|
"""
|
|
20
20
|
|
|
21
21
|
from .backend import (
|
|
22
|
+
AttachmentDownloadLimitError,
|
|
22
23
|
Backend,
|
|
23
24
|
BackendBase,
|
|
24
25
|
BackendConfig,
|
|
@@ -165,48 +166,61 @@ from .format import (
|
|
|
165
166
|
)
|
|
166
167
|
from .handlers import InteractionHandler, InteractionRegistry
|
|
167
168
|
|
|
168
|
-
__version__ = "0.2.
|
|
169
|
+
__version__ = "0.2.2"
|
|
169
170
|
|
|
170
171
|
__all__ = (
|
|
171
|
-
|
|
172
|
-
"__version__",
|
|
173
|
-
# Backend
|
|
174
|
-
"Backend",
|
|
175
|
-
"BackendConfig",
|
|
176
|
-
# Backend registry
|
|
177
|
-
"BackendBase",
|
|
178
|
-
"BackendRegistry",
|
|
179
|
-
"get_backend",
|
|
180
|
-
"get_backend_format",
|
|
181
|
-
"list_backends",
|
|
182
|
-
"register_backend",
|
|
172
|
+
"ALL_BACKENDS",
|
|
183
173
|
# Enums
|
|
184
174
|
"BACKEND",
|
|
175
|
+
"BACKEND_FORMAT_MAP",
|
|
185
176
|
"DISCORD",
|
|
177
|
+
"DISCORD_CAPABILITIES",
|
|
178
|
+
"DISCORD_MARKDOWN",
|
|
179
|
+
"FORMAT",
|
|
180
|
+
"HTML",
|
|
181
|
+
"MARKDOWN",
|
|
182
|
+
"PLAINTEXT",
|
|
186
183
|
"SLACK",
|
|
184
|
+
"SLACK_CAPABILITIES",
|
|
185
|
+
"SLACK_MARKDOWN",
|
|
187
186
|
"SYMPHONY",
|
|
187
|
+
"SYMPHONY_CAPABILITIES",
|
|
188
|
+
"SYMPHONY_MESSAGEML",
|
|
188
189
|
"TELEGRAM",
|
|
189
|
-
"
|
|
190
|
+
"TELEGRAM_CAPABILITIES",
|
|
191
|
+
"TELEGRAM_HTML",
|
|
192
|
+
# Presence
|
|
193
|
+
"Activity",
|
|
194
|
+
"ActivityType",
|
|
195
|
+
# Attachment
|
|
196
|
+
"Attachment",
|
|
197
|
+
"AttachmentDownloadLimitError",
|
|
198
|
+
"AttachmentType",
|
|
199
|
+
# Backend
|
|
200
|
+
"Backend",
|
|
201
|
+
# Backend registry
|
|
202
|
+
"BackendBase",
|
|
203
|
+
# Capabilities
|
|
204
|
+
"BackendCapabilities",
|
|
205
|
+
"BackendConfig",
|
|
206
|
+
# Conversion utilities
|
|
207
|
+
"BackendNotFoundError",
|
|
208
|
+
"BackendRegistry",
|
|
190
209
|
# Base classes
|
|
191
210
|
"BaseModel",
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
-
# User
|
|
195
|
-
"User",
|
|
211
|
+
"Bold",
|
|
212
|
+
"Capability",
|
|
196
213
|
# Channel
|
|
197
214
|
"Channel",
|
|
215
|
+
"ChannelMention",
|
|
216
|
+
"ChannelRegistry",
|
|
198
217
|
"ChannelType",
|
|
199
|
-
|
|
200
|
-
"
|
|
201
|
-
#
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
# Attachment
|
|
206
|
-
"Attachment",
|
|
207
|
-
"AttachmentType",
|
|
208
|
-
"File",
|
|
209
|
-
"Image",
|
|
218
|
+
"Code",
|
|
219
|
+
"CodeBlock",
|
|
220
|
+
# Connection and registries
|
|
221
|
+
"Connection",
|
|
222
|
+
"ConversionError",
|
|
223
|
+
"Document",
|
|
210
224
|
# Embed
|
|
211
225
|
"Embed",
|
|
212
226
|
"EmbedAuthor",
|
|
@@ -215,101 +229,89 @@ __all__ = (
|
|
|
215
229
|
"EmbedMedia",
|
|
216
230
|
# Reaction
|
|
217
231
|
"Emoji",
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
"
|
|
232
|
+
"Field",
|
|
233
|
+
"File",
|
|
234
|
+
# Format
|
|
235
|
+
"Format",
|
|
236
|
+
# Attachment formatting
|
|
237
|
+
"FormattedAttachment",
|
|
238
|
+
"FormattedImage",
|
|
239
|
+
# Message formatting
|
|
240
|
+
"FormattedMessage",
|
|
241
|
+
"Heading",
|
|
242
|
+
"HorizontalRule",
|
|
243
|
+
"Identifiable",
|
|
244
|
+
# Bridge
|
|
245
|
+
"IdentityMapper",
|
|
246
|
+
"Image",
|
|
247
|
+
# Interactions
|
|
248
|
+
"Interaction",
|
|
249
|
+
"InteractionHandler",
|
|
250
|
+
"InteractionRegistry",
|
|
251
|
+
"InteractionType",
|
|
252
|
+
"Italic",
|
|
253
|
+
"LineBreak",
|
|
254
|
+
"Link",
|
|
255
|
+
"ListItem",
|
|
256
|
+
"LookupError",
|
|
257
|
+
# Message
|
|
258
|
+
"Message",
|
|
259
|
+
"MessageBridge",
|
|
260
|
+
"MessageBuilder",
|
|
261
|
+
"MessageReference",
|
|
262
|
+
"MessageType",
|
|
263
|
+
"OrderedList",
|
|
264
|
+
"Paragraph",
|
|
222
265
|
"Presence",
|
|
223
266
|
"PresenceStatus",
|
|
224
|
-
|
|
225
|
-
"
|
|
226
|
-
"
|
|
227
|
-
"
|
|
228
|
-
|
|
229
|
-
"
|
|
230
|
-
"
|
|
231
|
-
|
|
232
|
-
"
|
|
233
|
-
"
|
|
267
|
+
"Quote",
|
|
268
|
+
"Reaction",
|
|
269
|
+
"Span",
|
|
270
|
+
"Strikethrough",
|
|
271
|
+
# Table
|
|
272
|
+
"Table",
|
|
273
|
+
"TableAlignment",
|
|
274
|
+
"TableCell",
|
|
275
|
+
"TableRow",
|
|
276
|
+
"Text",
|
|
277
|
+
# Text nodes
|
|
278
|
+
"TextNode",
|
|
279
|
+
# Thread
|
|
280
|
+
"Thread",
|
|
281
|
+
"Underline",
|
|
282
|
+
"UnorderedList",
|
|
283
|
+
# User
|
|
284
|
+
"User",
|
|
285
|
+
"UserMention",
|
|
286
|
+
"UserRegistry",
|
|
234
287
|
"ValidationResult",
|
|
288
|
+
# Version
|
|
289
|
+
"__version__",
|
|
290
|
+
"bold",
|
|
235
291
|
"can_promote",
|
|
292
|
+
"code",
|
|
293
|
+
"code_block",
|
|
236
294
|
"demote",
|
|
295
|
+
"format_message",
|
|
296
|
+
"get_backend",
|
|
297
|
+
"get_backend_format",
|
|
237
298
|
"get_backend_type",
|
|
238
299
|
"get_base_type",
|
|
300
|
+
"get_format_for_backend",
|
|
301
|
+
"italic",
|
|
302
|
+
"link",
|
|
303
|
+
"list_backends",
|
|
239
304
|
"list_backends_for_type",
|
|
240
|
-
"promote",
|
|
241
|
-
"register_backend_type",
|
|
242
|
-
"validate_for_backend",
|
|
243
305
|
# Mention utilities
|
|
244
306
|
"mention_channel",
|
|
245
|
-
"mention_user",
|
|
246
307
|
"mention_channel_for_backend",
|
|
308
|
+
"mention_user",
|
|
247
309
|
"mention_user_for_backend",
|
|
248
|
-
|
|
249
|
-
"
|
|
250
|
-
"
|
|
251
|
-
"
|
|
252
|
-
"LookupError",
|
|
253
|
-
# Format
|
|
254
|
-
"Format",
|
|
255
|
-
"FORMAT",
|
|
256
|
-
"PLAINTEXT",
|
|
257
|
-
"MARKDOWN",
|
|
258
|
-
"SLACK_MARKDOWN",
|
|
259
|
-
"DISCORD_MARKDOWN",
|
|
260
|
-
"HTML",
|
|
261
|
-
"TELEGRAM_HTML",
|
|
262
|
-
"SYMPHONY_MESSAGEML",
|
|
263
|
-
# Text nodes
|
|
264
|
-
"TextNode",
|
|
265
|
-
"Text",
|
|
266
|
-
"Bold",
|
|
267
|
-
"Italic",
|
|
268
|
-
"Strikethrough",
|
|
269
|
-
"Underline",
|
|
270
|
-
"Code",
|
|
271
|
-
"CodeBlock",
|
|
272
|
-
"Link",
|
|
273
|
-
"Quote",
|
|
274
|
-
"Paragraph",
|
|
275
|
-
"LineBreak",
|
|
276
|
-
"HorizontalRule",
|
|
277
|
-
"ListItem",
|
|
278
|
-
"UnorderedList",
|
|
279
|
-
"OrderedList",
|
|
280
|
-
"Heading",
|
|
281
|
-
"UserMention",
|
|
282
|
-
"ChannelMention",
|
|
283
|
-
"Span",
|
|
284
|
-
"Document",
|
|
310
|
+
"promote",
|
|
311
|
+
"register_backend",
|
|
312
|
+
"register_backend_type",
|
|
313
|
+
"render_message",
|
|
285
314
|
# Helper functions
|
|
286
315
|
"text",
|
|
287
|
-
"
|
|
288
|
-
"italic",
|
|
289
|
-
"code",
|
|
290
|
-
"code_block",
|
|
291
|
-
"link",
|
|
292
|
-
# Table
|
|
293
|
-
"Table",
|
|
294
|
-
"TableRow",
|
|
295
|
-
"TableCell",
|
|
296
|
-
"TableAlignment",
|
|
297
|
-
# Attachment formatting
|
|
298
|
-
"FormattedAttachment",
|
|
299
|
-
"FormattedImage",
|
|
300
|
-
# Message formatting
|
|
301
|
-
"FormattedMessage",
|
|
302
|
-
"MessageBuilder",
|
|
303
|
-
"render_message",
|
|
304
|
-
"format_message",
|
|
305
|
-
"BACKEND_FORMAT_MAP",
|
|
306
|
-
"get_format_for_backend",
|
|
307
|
-
# Bridge
|
|
308
|
-
"IdentityMapper",
|
|
309
|
-
"MessageBridge",
|
|
310
|
-
# Interactions
|
|
311
|
-
"Interaction",
|
|
312
|
-
"InteractionType",
|
|
313
|
-
"InteractionHandler",
|
|
314
|
-
"InteractionRegistry",
|
|
316
|
+
"validate_for_backend",
|
|
315
317
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
try:
|
|
2
|
-
from pydantic_ai.toolsets.abstract import AbstractToolset
|
|
2
|
+
from pydantic_ai.toolsets.abstract import AbstractToolset
|
|
3
3
|
except ImportError as e:
|
|
4
4
|
raise ImportError("chatom.agent requires the 'agent' extra. Install it with: pip install chatom[agent]") from e
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ __all__ = (
|
|
|
10
10
|
"AccessDeniedError",
|
|
11
11
|
"AccessPolicy",
|
|
12
12
|
"BackendToolset",
|
|
13
|
-
"ToolBudgetExceededError",
|
|
14
13
|
"ChannelContext",
|
|
14
|
+
"ToolBudgetExceededError",
|
|
15
15
|
"build_channel_context",
|
|
16
16
|
)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from datetime import datetime
|
|
4
|
-
from typing import List, Optional, Union
|
|
5
4
|
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
@@ -16,10 +15,10 @@ class MessageSummary(BaseModel):
|
|
|
16
15
|
id: str = ""
|
|
17
16
|
author: str = ""
|
|
18
17
|
content: str = ""
|
|
19
|
-
timestamp:
|
|
18
|
+
timestamp: datetime | None = None
|
|
20
19
|
|
|
21
20
|
@classmethod
|
|
22
|
-
def from_message(cls, msg: Message) ->
|
|
21
|
+
def from_message(cls, msg: Message) -> MessageSummary:
|
|
23
22
|
author = ""
|
|
24
23
|
if msg.author:
|
|
25
24
|
author = msg.author.display_name or msg.author.name or msg.author.id or ""
|
|
@@ -46,8 +45,8 @@ class ChannelContext(BaseModel):
|
|
|
46
45
|
channel_id: str = ""
|
|
47
46
|
channel_name: str = ""
|
|
48
47
|
topic: str = ""
|
|
49
|
-
messages:
|
|
50
|
-
participants:
|
|
48
|
+
messages: list[MessageSummary] = Field(default_factory=list)
|
|
49
|
+
participants: list[str] = Field(default_factory=list)
|
|
51
50
|
|
|
52
51
|
def format_for_llm(self) -> str:
|
|
53
52
|
"""Render the context as a human-readable text block.
|
|
@@ -72,10 +71,10 @@ class ChannelContext(BaseModel):
|
|
|
72
71
|
|
|
73
72
|
async def build_channel_context(
|
|
74
73
|
backend: BackendBase,
|
|
75
|
-
channel:
|
|
74
|
+
channel: str | Channel,
|
|
76
75
|
*,
|
|
77
76
|
limit: int = 50,
|
|
78
|
-
token_budget:
|
|
77
|
+
token_budget: int | None = None,
|
|
79
78
|
) -> ChannelContext:
|
|
80
79
|
"""Build a :class:`ChannelContext` from a live backend.
|
|
81
80
|
|