agent-core-discord 0.8.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.
- agent_core_discord-0.8.2/.gitignore +245 -0
- agent_core_discord-0.8.2/CHANGELOG.md +41 -0
- agent_core_discord-0.8.2/PKG-INFO +13 -0
- agent_core_discord-0.8.2/VERSION +1 -0
- agent_core_discord-0.8.2/changelog.d/190.added.md +8 -0
- agent_core_discord-0.8.2/pyproject.toml +32 -0
- agent_core_discord-0.8.2/src/agent_core_discord/__init__.py +10 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_acks.py +73 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_exceptions.py +18 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_handlers.py +538 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_lifecycle.py +544 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_outbound.py +676 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_state.py +150 -0
- agent_core_discord-0.8.2/src/agent_core_discord/_tools.py +437 -0
- agent_core_discord-0.8.2/src/agent_core_discord/access.py +133 -0
- agent_core_discord-0.8.2/src/agent_core_discord/args.py +154 -0
- agent_core_discord-0.8.2/src/agent_core_discord/briefing.py +70 -0
- agent_core_discord-0.8.2/src/agent_core_discord/chunking.py +332 -0
- agent_core_discord-0.8.2/src/agent_core_discord/endpoint.py +188 -0
- agent_core_discord-0.8.2/src/agent_core_discord/send_retry.py +95 -0
- agent_core_discord-0.8.2/src/agent_core_discord/shape_validator.py +219 -0
- agent_core_discord-0.8.2/src/agent_core_discord/sigil.py +40 -0
- agent_core_discord-0.8.2/src/agent_core_discord/testing/__init__.py +33 -0
- agent_core_discord-0.8.2/src/agent_core_discord/testing/fakes.py +507 -0
- agent_core_discord-0.8.2/src/agent_core_discord/text_sanitize.py +40 -0
- agent_core_discord-0.8.2/tests/test_access.py +249 -0
- agent_core_discord-0.8.2/tests/test_access_reload.py +169 -0
- agent_core_discord-0.8.2/tests/test_attachment_retention.py +84 -0
- agent_core_discord-0.8.2/tests/test_awaiting_reply_pair.py +111 -0
- agent_core_discord-0.8.2/tests/test_chunking.py +122 -0
- agent_core_discord-0.8.2/tests/test_discord_send_args.py +81 -0
- agent_core_discord-0.8.2/tests/test_discord_spawn_lifecycle.py +117 -0
- agent_core_discord-0.8.2/tests/test_endpoint_characterization.py +452 -0
- agent_core_discord-0.8.2/tests/test_endpoint_hardening.py +336 -0
- agent_core_discord-0.8.2/tests/test_endpoint_inbound.py +1098 -0
- agent_core_discord-0.8.2/tests/test_endpoint_lifecycle.py +237 -0
- agent_core_discord-0.8.2/tests/test_endpoint_nack.py +261 -0
- agent_core_discord-0.8.2/tests/test_endpoint_outbound.py +2860 -0
- agent_core_discord-0.8.2/tests/test_endpoint_pending_acks.py +176 -0
- agent_core_discord-0.8.2/tests/test_endpoint_urgency.py +149 -0
- agent_core_discord-0.8.2/tests/test_fakes_attachments.py +52 -0
- agent_core_discord-0.8.2/tests/test_integration.py +159 -0
- agent_core_discord-0.8.2/tests/test_recent_inbounds.py +111 -0
- agent_core_discord-0.8.2/tests/test_resolve_channel_id.py +150 -0
- agent_core_discord-0.8.2/tests/test_send_retry.py +77 -0
- agent_core_discord-0.8.2/tests/test_shape_validator.py +286 -0
- agent_core_discord-0.8.2/tests/test_sigil.py +55 -0
- agent_core_discord-0.8.2/tests/test_text_sanitize.py +102 -0
- agent_core_discord-0.8.2/tests/test_typing_ttl.py +91 -0
- agent_core_discord-0.8.2/tests/test_voice_transcription.py +362 -0
- agent_core_discord-0.8.2/towncrier.toml +38 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Memory compiler runtime state
|
|
2
|
+
memory-compiler/daily/
|
|
3
|
+
memory-compiler/reports/
|
|
4
|
+
memory-compiler/scripts/state.json
|
|
5
|
+
memory-compiler/scripts/last-flush.json
|
|
6
|
+
memory-compiler/scripts/flush.log
|
|
7
|
+
memory-compiler/scripts/compile.log
|
|
8
|
+
memory-compiler/scripts/session-flush-*.md
|
|
9
|
+
memory-compiler/scripts/flush-context-*.md
|
|
10
|
+
|
|
11
|
+
# Handoff writer state (placed alongside handoff files)
|
|
12
|
+
**/handoff-state.json
|
|
13
|
+
|
|
14
|
+
# Git worktrees (superpowers / parallel feature work)
|
|
15
|
+
.worktrees/
|
|
16
|
+
# Native (harness) worktrees
|
|
17
|
+
.claude/worktrees/
|
|
18
|
+
|
|
19
|
+
# Superpowers brainstorm mockups / scratch
|
|
20
|
+
.superpowers/
|
|
21
|
+
|
|
22
|
+
# Agent-core runtime state (handoffs, bus.sqlite, transcripts, etc.)
|
|
23
|
+
.agent-core/
|
|
24
|
+
|
|
25
|
+
# Local scratch / smoke-test artifacts
|
|
26
|
+
.tmp/
|
|
27
|
+
|
|
28
|
+
# Claude Code per-machine local overrides
|
|
29
|
+
.claude/settings.local.json
|
|
30
|
+
.claude/*.lock
|
|
31
|
+
|
|
32
|
+
# Byte-compiled / optimized / DLL files
|
|
33
|
+
__pycache__/
|
|
34
|
+
*.py[codz]
|
|
35
|
+
*$py.class
|
|
36
|
+
|
|
37
|
+
# C extensions
|
|
38
|
+
*.so
|
|
39
|
+
|
|
40
|
+
# Distribution / packaging
|
|
41
|
+
.Python
|
|
42
|
+
build/
|
|
43
|
+
develop-eggs/
|
|
44
|
+
dist/
|
|
45
|
+
downloads/
|
|
46
|
+
eggs/
|
|
47
|
+
.eggs/
|
|
48
|
+
lib/
|
|
49
|
+
lib64/
|
|
50
|
+
parts/
|
|
51
|
+
sdist/
|
|
52
|
+
var/
|
|
53
|
+
wheels/
|
|
54
|
+
share/python-wheels/
|
|
55
|
+
*.egg-info/
|
|
56
|
+
.installed.cfg
|
|
57
|
+
*.egg
|
|
58
|
+
MANIFEST
|
|
59
|
+
|
|
60
|
+
# PyInstaller
|
|
61
|
+
# Usually these files are written by a python script from a template
|
|
62
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
63
|
+
*.manifest
|
|
64
|
+
*.spec
|
|
65
|
+
|
|
66
|
+
# Installer logs
|
|
67
|
+
pip-log.txt
|
|
68
|
+
pip-delete-this-directory.txt
|
|
69
|
+
|
|
70
|
+
# Unit test / coverage reports
|
|
71
|
+
htmlcov/
|
|
72
|
+
.tox/
|
|
73
|
+
.nox/
|
|
74
|
+
.coverage
|
|
75
|
+
.coverage.*
|
|
76
|
+
.cache
|
|
77
|
+
nosetests.xml
|
|
78
|
+
coverage.xml
|
|
79
|
+
*.cover
|
|
80
|
+
*.py.cover
|
|
81
|
+
.hypothesis/
|
|
82
|
+
.pytest_cache/
|
|
83
|
+
cover/
|
|
84
|
+
|
|
85
|
+
# Translations
|
|
86
|
+
*.mo
|
|
87
|
+
*.pot
|
|
88
|
+
|
|
89
|
+
# Django stuff:
|
|
90
|
+
*.log
|
|
91
|
+
local_settings.py
|
|
92
|
+
db.sqlite3
|
|
93
|
+
db.sqlite3-journal
|
|
94
|
+
|
|
95
|
+
# Flask stuff:
|
|
96
|
+
instance/
|
|
97
|
+
.webassets-cache
|
|
98
|
+
|
|
99
|
+
# Scrapy stuff:
|
|
100
|
+
.scrapy
|
|
101
|
+
|
|
102
|
+
# Sphinx documentation
|
|
103
|
+
docs/_build/
|
|
104
|
+
|
|
105
|
+
# PyBuilder
|
|
106
|
+
.pybuilder/
|
|
107
|
+
target/
|
|
108
|
+
|
|
109
|
+
# Jupyter Notebook
|
|
110
|
+
.ipynb_checkpoints
|
|
111
|
+
|
|
112
|
+
# IPython
|
|
113
|
+
profile_default/
|
|
114
|
+
ipython_config.py
|
|
115
|
+
|
|
116
|
+
# pyenv
|
|
117
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
118
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
119
|
+
# .python-version
|
|
120
|
+
|
|
121
|
+
# pipenv
|
|
122
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
123
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
124
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
125
|
+
# install all needed dependencies.
|
|
126
|
+
#Pipfile.lock
|
|
127
|
+
|
|
128
|
+
# UV
|
|
129
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
130
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
131
|
+
# commonly ignored for libraries.
|
|
132
|
+
#uv.lock
|
|
133
|
+
|
|
134
|
+
# poetry
|
|
135
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
136
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
137
|
+
# commonly ignored for libraries.
|
|
138
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
139
|
+
#poetry.lock
|
|
140
|
+
#poetry.toml
|
|
141
|
+
|
|
142
|
+
# pdm
|
|
143
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
144
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
145
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
146
|
+
#pdm.lock
|
|
147
|
+
#pdm.toml
|
|
148
|
+
.pdm-python
|
|
149
|
+
.pdm-build/
|
|
150
|
+
|
|
151
|
+
# pixi
|
|
152
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
153
|
+
#pixi.lock
|
|
154
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
155
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
156
|
+
.pixi
|
|
157
|
+
|
|
158
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
159
|
+
__pypackages__/
|
|
160
|
+
|
|
161
|
+
# Celery stuff
|
|
162
|
+
celerybeat-schedule
|
|
163
|
+
celerybeat.pid
|
|
164
|
+
|
|
165
|
+
# SageMath parsed files
|
|
166
|
+
*.sage.py
|
|
167
|
+
|
|
168
|
+
# Environments
|
|
169
|
+
.env
|
|
170
|
+
.envrc
|
|
171
|
+
.venv
|
|
172
|
+
env/
|
|
173
|
+
venv/
|
|
174
|
+
ENV/
|
|
175
|
+
env.bak/
|
|
176
|
+
venv.bak/
|
|
177
|
+
|
|
178
|
+
# Spyder project settings
|
|
179
|
+
.spyderproject
|
|
180
|
+
.spyproject
|
|
181
|
+
|
|
182
|
+
# Rope project settings
|
|
183
|
+
.ropeproject
|
|
184
|
+
|
|
185
|
+
# mkdocs documentation
|
|
186
|
+
/site
|
|
187
|
+
|
|
188
|
+
# mypy
|
|
189
|
+
.mypy_cache/
|
|
190
|
+
.dmypy.json
|
|
191
|
+
dmypy.json
|
|
192
|
+
|
|
193
|
+
# Pyre type checker
|
|
194
|
+
.pyre/
|
|
195
|
+
|
|
196
|
+
# pytype static type analyzer
|
|
197
|
+
.pytype/
|
|
198
|
+
|
|
199
|
+
# Cython debug symbols
|
|
200
|
+
cython_debug/
|
|
201
|
+
|
|
202
|
+
# PyCharm
|
|
203
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
204
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
205
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
206
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
207
|
+
#.idea/
|
|
208
|
+
|
|
209
|
+
# Abstra
|
|
210
|
+
# Abstra is an AI-powered process automation framework.
|
|
211
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
212
|
+
# Learn more at https://abstra.io/docs
|
|
213
|
+
.abstra/
|
|
214
|
+
|
|
215
|
+
# Visual Studio Code
|
|
216
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
217
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
218
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
219
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
220
|
+
# .vscode/
|
|
221
|
+
|
|
222
|
+
# Ruff stuff:
|
|
223
|
+
.ruff_cache/
|
|
224
|
+
|
|
225
|
+
# PyPI configuration file
|
|
226
|
+
.pypirc
|
|
227
|
+
|
|
228
|
+
# Cursor
|
|
229
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
230
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
231
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
232
|
+
.cursorignore
|
|
233
|
+
.cursorindexingignore
|
|
234
|
+
|
|
235
|
+
# Marimo
|
|
236
|
+
marimo/_static/
|
|
237
|
+
marimo/_lsp/
|
|
238
|
+
__marimo__/
|
|
239
|
+
.gstack/
|
|
240
|
+
|
|
241
|
+
# macOS Finder metadata (occasionally sneaks in via vendored sources)
|
|
242
|
+
.DS_Store
|
|
243
|
+
|
|
244
|
+
# Operational docs that must not live in source control
|
|
245
|
+
pepper-vault-plan.txt
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.8.2](https://github.com/jeffrichley/agent_core/compare/v0.8.1...agent-core-discord-v0.8.2) (2026-07-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* republish package family to complete rate-limited first publish ([#477](https://github.com/jeffrichley/agent_core/issues/477)) ([32977ac](https://github.com/jeffrichley/agent_core/commit/32977ac78da4a15553329bb4e1fdaa9e894834ad))
|
|
9
|
+
|
|
10
|
+
## [0.8.1](https://github.com/jeffrichley/agent_core/compare/v0.8.0...agent-core-discord-v0.8.1) (2026-07-22)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* rename flagship dist to agent-core-bus + bump inter-package pins to 0.8.x ([#474](https://github.com/jeffrichley/agent_core/issues/474)) ([48426e7](https://github.com/jeffrichley/agent_core/commit/48426e7ff753d8f35d4a4626308546e9d0f331f7))
|
|
16
|
+
|
|
17
|
+
## [0.8.0](https://github.com/jeffrichley/agent_core/compare/v0.7.0...agent-core-discord-v0.8.0) (2026-07-21)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **deps:** version-pin sibling deps and remove qwen-tts from voice ([#430](https://github.com/jeffrichley/agent_core/issues/430)) ([3b173ee](https://github.com/jeffrichley/agent_core/commit/3b173eebd24fb8eab995785a9e154a0dda870f19))
|
|
23
|
+
* **discord:** extract _HandlersMixin into _handlers.py per spec ([#458](https://github.com/jeffrichley/agent_core/issues/458)) ([6d137cf](https://github.com/jeffrichley/agent_core/commit/6d137cf751204600793bf8b8490065cbf9f52934)), closes [#441](https://github.com/jeffrichley/agent_core/issues/441)
|
|
24
|
+
* **discord:** extract _OutboundMixin and _ToolsMixin from endpoint.py ([#461](https://github.com/jeffrichley/agent_core/issues/461)) ([3e86492](https://github.com/jeffrichley/agent_core/commit/3e864928e7aa88863202050a2f1eaf8d42b16c8e))
|
|
25
|
+
* **discord:** voice memo capture + auto-transcription via faster-whisper ([#252](https://github.com/jeffrichley/agent_core/issues/252)) ([4c44c2f](https://github.com/jeffrichley/agent_core/commit/4c44c2f68adf248aa84a8a209f3bf33df12baa80))
|
|
26
|
+
* **hatchery:** ungendered templates + .mcp.json generation ([#81](https://github.com/jeffrichley/agent_core/issues/81)/[#82](https://github.com/jeffrichley/agent_core/issues/82)) ([#357](https://github.com/jeffrichley/agent_core/issues/357)) ([f48762d](https://github.com/jeffrichley/agent_core/commit/f48762df78eb12cfa9524e9b5a277741534ea8a7)), closes [#311](https://github.com/jeffrichley/agent_core/issues/311)
|
|
27
|
+
* mypy --strict for agent-core-discord + log CancelledError swallows (closes [#444](https://github.com/jeffrichley/agent_core/issues/444)) ([#470](https://github.com/jeffrichley/agent_core/issues/470)) ([3ca9419](https://github.com/jeffrichley/agent_core/commit/3ca94193c98d547acfe2cd5203b314cb134656d4))
|
|
28
|
+
* **release:** configure release-please for 12-package synchronized version train ([#428](https://github.com/jeffrichley/agent_core/issues/428)) ([c1b4097](https://github.com/jeffrichley/agent_core/commit/c1b409765c61d09a6657b0e8b5e43a27cb235b3e))
|
|
29
|
+
* **secrets:** add vault-API accessor and scrub subprocess env ([#399](https://github.com/jeffrichley/agent_core/issues/399)) ([adb404b](https://github.com/jeffrichley/agent_core/commit/adb404b046bd224b56d64188b2cb56eb134d99b7))
|
|
30
|
+
* **supervision:** migrate leaky asyncio.create_task sites to BusHandle.spawn() ([#302](https://github.com/jeffrichley/agent_core/issues/302)) ([0716587](https://github.com/jeffrichley/agent_core/commit/07165879a4f1055ff1d0636169bdc2a178ea57da))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **discord,inbound:** nack transient failures instead of acking (issue [#275](https://github.com/jeffrichley/agent_core/issues/275)) ([#281](https://github.com/jeffrichley/agent_core/issues/281)) ([ad52bd6](https://github.com/jeffrichley/agent_core/commit/ad52bd6eb883f1706e76df32260317767f697b2d))
|
|
36
|
+
* **discord:** evict missing-timestamp typing orphans regardless of host uptime ([#335](https://github.com/jeffrichley/agent_core/issues/335)) ([0fce89c](https://github.com/jeffrichley/agent_core/commit/0fce89c3c76e796ba1eaaf72a804a2fbc2467268))
|
|
37
|
+
* **discord:** harden access-config reload loop against schema-invalid JSON ([#257](https://github.com/jeffrichley/agent_core/issues/257)) ([bd36b88](https://github.com/jeffrichley/agent_core/commit/bd36b8884abb062aadcea28ad4787a2dbcdca8ec))
|
|
38
|
+
|
|
39
|
+
## agent-core-discord changelog
|
|
40
|
+
|
|
41
|
+
<!-- towncrier release notes start -->
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent-core-discord
|
|
3
|
+
Version: 0.8.2
|
|
4
|
+
Summary: Discord bot adapter for the agent-core bus — one bot per agent (1:1).
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: agent-core-bus<0.9,>=0.8
|
|
8
|
+
Requires-Dist: agent-core-credentials<0.9,>=0.8
|
|
9
|
+
Requires-Dist: discord-py>=2.4
|
|
10
|
+
Requires-Dist: pydantic>=2.0
|
|
11
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
12
|
+
Provides-Extra: voice
|
|
13
|
+
Requires-Dist: faster-whisper>=1.1; extra == 'voice'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.8.2
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
`DiscordEndpoint` now hot-reloads its `access_config_path` JSON without a daemon
|
|
2
|
+
restart. A background mtime-poll task (default interval: 5 s, configurable via
|
|
3
|
+
`access_config_reload_interval`, 0 to disable) detects file changes and atomically
|
|
4
|
+
swaps the in-memory `AccessConfig`. Malformed JSON during a mid-edit write is logged
|
|
5
|
+
at WARN level and ignored; the previous config is kept until the next poll finds a
|
|
6
|
+
valid file. Operators can add channels to the allowlist and see them take effect
|
|
7
|
+
within one poll interval while all other endpoints in the same daemon process run
|
|
8
|
+
uninterrupted. (#190)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "agent-core-discord"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Discord bot adapter for the agent-core bus — one bot per agent (1:1)."
|
|
5
|
+
license = "MIT"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"agent-core-bus>=0.8,<0.9",
|
|
9
|
+
"agent-core-credentials>=0.8,<0.9",
|
|
10
|
+
"discord.py>=2.4",
|
|
11
|
+
"python-dotenv>=1.0.0",
|
|
12
|
+
"pydantic>=2.0",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.optional-dependencies]
|
|
16
|
+
voice = ["faster-whisper>=1.1"]
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["hatchling", "uv-dynamic-versioning"]
|
|
20
|
+
build-backend = "hatchling.build"
|
|
21
|
+
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["src/agent_core_discord"]
|
|
24
|
+
|
|
25
|
+
[tool.hatch.version]
|
|
26
|
+
source = "uv-dynamic-versioning"
|
|
27
|
+
|
|
28
|
+
[tool.uv-dynamic-versioning]
|
|
29
|
+
fallback-version = "0.0.0"
|
|
30
|
+
|
|
31
|
+
[tool.uv]
|
|
32
|
+
cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true } }]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""agent-core-discord — Discord bot adapter for the agent-core bus.
|
|
2
|
+
|
|
3
|
+
One DiscordEndpoint instance per Discord bot. Bridges one bot to one named
|
|
4
|
+
agent on the bus (1:1 mapping). See the design doc at
|
|
5
|
+
docs/superpowers/specs/2026-04-28-discord-endpoint-design.md for details.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from agent_core_discord.endpoint import DiscordEndpoint
|
|
9
|
+
|
|
10
|
+
__all__ = ["DiscordEndpoint"]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""Ack-tracking mixin for DiscordEndpoint.
|
|
2
|
+
|
|
3
|
+
Move-only extraction from endpoint.py (issue #440, Step 2 of F-B6).
|
|
4
|
+
Imports nothing from endpoint.py to avoid circular imports.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import contextlib
|
|
10
|
+
import logging
|
|
11
|
+
import time
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from agent_core_discord._state import _EndpointState
|
|
15
|
+
|
|
16
|
+
log = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _AcksMixin(_EndpointState):
|
|
20
|
+
def _track_pending_ack(self, message_id: str, emoji: str, channel_id: str) -> None:
|
|
21
|
+
"""Record a pending ack and evict the oldest entry if we hit the cap.
|
|
22
|
+
|
|
23
|
+
When LRU eviction fires, the evicted entry's 👀 is removed from the
|
|
24
|
+
original message in a fire-and-forget task — we don't want bookkeeping
|
|
25
|
+
to slow down on_message dispatch.
|
|
26
|
+
"""
|
|
27
|
+
self._pending_acks[message_id] = (emoji, channel_id, time.monotonic())
|
|
28
|
+
while len(self._pending_acks) > self.pending_acks_max:
|
|
29
|
+
old_id, (old_emoji, old_ch, _ts) = self._pending_acks.popitem(last=False)
|
|
30
|
+
self._awaiting_reply_ids.discard(old_id)
|
|
31
|
+
self._awaiting_reply_ids_timestamps.pop(old_id, None)
|
|
32
|
+
assert self._handle is not None
|
|
33
|
+
self._handle.spawn(
|
|
34
|
+
self._remote_remove_ack(old_id, old_emoji, old_ch),
|
|
35
|
+
name=f"discord-endpoint-{self.name}-evict-ack",
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
async def _remote_remove_ack(self, message_id: str, emoji: str, channel_id: str) -> None:
|
|
39
|
+
"""Best-effort removal of an ack reaction from a Discord message."""
|
|
40
|
+
if self._client is None:
|
|
41
|
+
return
|
|
42
|
+
try:
|
|
43
|
+
channel = self._client.get_channel(channel_id)
|
|
44
|
+
if channel is None:
|
|
45
|
+
channel = await self._client.fetch_channel(channel_id)
|
|
46
|
+
msg = await channel.fetch_message(message_id)
|
|
47
|
+
if msg is None:
|
|
48
|
+
return
|
|
49
|
+
await msg.remove_reaction(emoji, self._client.user)
|
|
50
|
+
except Exception:
|
|
51
|
+
log.debug(
|
|
52
|
+
"discord(%s): could not remove evicted ack on message %s",
|
|
53
|
+
self.name,
|
|
54
|
+
message_id,
|
|
55
|
+
exc_info=True,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
async def _clear_pending_ack(self, channel: Any, message_id: str) -> None:
|
|
59
|
+
mid = str(message_id)
|
|
60
|
+
self._awaiting_reply_ids.discard(mid)
|
|
61
|
+
self._awaiting_reply_ids_timestamps.pop(mid, None)
|
|
62
|
+
entry = self._pending_acks.pop(mid, None)
|
|
63
|
+
if entry is None:
|
|
64
|
+
return
|
|
65
|
+
emoji, _channel_id, _ts = entry
|
|
66
|
+
try:
|
|
67
|
+
msg = await channel.fetch_message(mid)
|
|
68
|
+
except Exception:
|
|
69
|
+
return
|
|
70
|
+
if msg is None:
|
|
71
|
+
return
|
|
72
|
+
with contextlib.suppress(Exception):
|
|
73
|
+
await msg.remove_reaction(emoji, self._client.user)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Shared exception types for the agent_core_discord package.
|
|
2
|
+
|
|
3
|
+
Leaf module — imports nothing from other agent_core_discord modules so
|
|
4
|
+
that _acks.py and _lifecycle.py can import from here without creating
|
|
5
|
+
circular-import cycles.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class _ToolError(Exception):
|
|
12
|
+
"""User-error during tool dispatch — produces an Acknowledgment with note."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class _PersistError(Exception):
|
|
16
|
+
"""Attachment could not be persisted (unsafe path, etc.). Neutral —
|
|
17
|
+
shared by the MCP tool and the inbound path; the tool layer
|
|
18
|
+
translates it to _ToolError."""
|