soothe-client-python 1.0.22__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.
- soothe_client_python-1.0.22/.gitignore +219 -0
- soothe_client_python-1.0.22/LICENSE +21 -0
- soothe_client_python-1.0.22/PKG-INFO +88 -0
- soothe_client_python-1.0.22/README.md +55 -0
- soothe_client_python-1.0.22/pyproject.toml +90 -0
- soothe_client_python-1.0.22/src/soothe_client/__init__.py +99 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/__init__.py +113 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/attachments.py +115 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/broadcaster.py +116 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/card_projection.py +10 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/chunk_filter.py +99 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/classifier.py +501 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/daemon_session.py +983 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/events.py +56 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/loop_session_store.py +100 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/managed_client.py +231 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/observability.py +29 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/pool.py +266 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/query_gate.py +93 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/thinking_step.py +146 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/turn.py +357 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/turn_boundary.py +188 -0
- soothe_client_python-1.0.22/src/soothe_client/appkit/turn_runner.py +586 -0
- soothe_client_python-1.0.22/src/soothe_client/command_client.py +615 -0
- soothe_client_python-1.0.22/src/soothe_client/errors.py +65 -0
- soothe_client_python-1.0.22/src/soothe_client/helpers.py +472 -0
- soothe_client_python-1.0.22/src/soothe_client/intent_hints.py +23 -0
- soothe_client_python-1.0.22/src/soothe_client/protocol_params.py +459 -0
- soothe_client_python-1.0.22/src/soothe_client/py.typed +0 -0
- soothe_client_python-1.0.22/src/soothe_client/schemas.py +46 -0
- soothe_client_python-1.0.22/src/soothe_client/session.py +186 -0
- soothe_client_python-1.0.22/src/soothe_client/stream_terminal.py +150 -0
- soothe_client_python-1.0.22/src/soothe_client/turn_boundary.py +176 -0
- soothe_client_python-1.0.22/src/soothe_client/websocket.py +1564 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
.soothe/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mirasoth-AI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: soothe-client-python
|
|
3
|
+
Version: 1.0.22
|
|
4
|
+
Summary: WebSocket client + appkit for soothe-daemon (Python)
|
|
5
|
+
Project-URL: Homepage, https://github.com/mirasoth/soothe-client-python
|
|
6
|
+
Project-URL: Documentation, https://soothe.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/mirasoth/soothe-client-python
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agents,ai,client,soothe,websocket
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: <3.15,>=3.11
|
|
22
|
+
Requires-Dist: pillow<12.0.0,>=10.0.0
|
|
23
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
24
|
+
Requires-Dist: soothe-sdk<2.0.0,>=1.0.9
|
|
25
|
+
Requires-Dist: websockets>=12.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: ruff>=0.12.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# soothe-client-python
|
|
35
|
+
|
|
36
|
+
Talk to a running **soothe-daemon** over WebSocket — send prompts, stream agent
|
|
37
|
+
turns, run jobs.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pip install soothe-client-python
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Requires a local daemon (default `ws://127.0.0.1:8765`).
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import asyncio
|
|
49
|
+
from soothe_client.appkit import DaemonSession
|
|
50
|
+
|
|
51
|
+
async def main() -> None:
|
|
52
|
+
session = DaemonSession("ws://127.0.0.1:8765")
|
|
53
|
+
await session.connect()
|
|
54
|
+
await session.send_turn("Summarize this in one sentence: agents need tools.")
|
|
55
|
+
async for _namespace, mode, data in session.iter_turn_chunks():
|
|
56
|
+
if mode == "custom" and isinstance(data, dict):
|
|
57
|
+
text = data.get("content") or data.get("text")
|
|
58
|
+
if text:
|
|
59
|
+
print(text, end="", flush=True)
|
|
60
|
+
print()
|
|
61
|
+
await session.close()
|
|
62
|
+
|
|
63
|
+
asyncio.run(main())
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
More patterns: [`examples/`](examples/) (hello → streaming → multi-turn → pool → jobs).
|
|
67
|
+
|
|
68
|
+
## What you get
|
|
69
|
+
|
|
70
|
+
| Need | Use |
|
|
71
|
+
|------|-----|
|
|
72
|
+
| One conversation, stream replies | `DaemonSession` (`soothe_client.appkit`) |
|
|
73
|
+
| Jobs / cron (async) | `AsyncCommandClient` |
|
|
74
|
+
| Jobs / cron (scripts / sync) | `CommandClient` |
|
|
75
|
+
| Raw WebSocket / custom RPCs | `WebSocketClient` |
|
|
76
|
+
| Many users / HTTP backend | `ConnectionPool` + `TurnRunner` |
|
|
77
|
+
|
|
78
|
+
Wire request param models: `soothe_client.protocol_params`.
|
|
79
|
+
|
|
80
|
+
## Develop
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
make sync-dev
|
|
84
|
+
make check # lint + unit tests
|
|
85
|
+
make test-examples-offline # offline appkit examples
|
|
86
|
+
make test-examples # live 01–06 (needs soothed)
|
|
87
|
+
make test-integration # live integration suite (needs soothed)
|
|
88
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# soothe-client-python
|
|
2
|
+
|
|
3
|
+
Talk to a running **soothe-daemon** over WebSocket — send prompts, stream agent
|
|
4
|
+
turns, run jobs.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install soothe-client-python
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Requires a local daemon (default `ws://127.0.0.1:8765`).
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import asyncio
|
|
16
|
+
from soothe_client.appkit import DaemonSession
|
|
17
|
+
|
|
18
|
+
async def main() -> None:
|
|
19
|
+
session = DaemonSession("ws://127.0.0.1:8765")
|
|
20
|
+
await session.connect()
|
|
21
|
+
await session.send_turn("Summarize this in one sentence: agents need tools.")
|
|
22
|
+
async for _namespace, mode, data in session.iter_turn_chunks():
|
|
23
|
+
if mode == "custom" and isinstance(data, dict):
|
|
24
|
+
text = data.get("content") or data.get("text")
|
|
25
|
+
if text:
|
|
26
|
+
print(text, end="", flush=True)
|
|
27
|
+
print()
|
|
28
|
+
await session.close()
|
|
29
|
+
|
|
30
|
+
asyncio.run(main())
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
More patterns: [`examples/`](examples/) (hello → streaming → multi-turn → pool → jobs).
|
|
34
|
+
|
|
35
|
+
## What you get
|
|
36
|
+
|
|
37
|
+
| Need | Use |
|
|
38
|
+
|------|-----|
|
|
39
|
+
| One conversation, stream replies | `DaemonSession` (`soothe_client.appkit`) |
|
|
40
|
+
| Jobs / cron (async) | `AsyncCommandClient` |
|
|
41
|
+
| Jobs / cron (scripts / sync) | `CommandClient` |
|
|
42
|
+
| Raw WebSocket / custom RPCs | `WebSocketClient` |
|
|
43
|
+
| Many users / HTTP backend | `ConnectionPool` + `TurnRunner` |
|
|
44
|
+
|
|
45
|
+
Wire request param models: `soothe_client.protocol_params`.
|
|
46
|
+
|
|
47
|
+
## Develop
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
make sync-dev
|
|
51
|
+
make check # lint + unit tests
|
|
52
|
+
make test-examples-offline # offline appkit examples
|
|
53
|
+
make test-examples # live 01–06 (needs soothed)
|
|
54
|
+
make test-integration # live integration suite (needs soothed)
|
|
55
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "soothe-client-python"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "WebSocket client + appkit for soothe-daemon (Python)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11,<3.15"
|
|
12
|
+
keywords = ["soothe", "client", "websocket", "agents", "ai"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"soothe-sdk>=1.0.9,<2.0.0",
|
|
27
|
+
"pydantic>=2.0.0,<3.0.0",
|
|
28
|
+
"websockets>=12.0",
|
|
29
|
+
"pillow>=10.0.0,<12.0.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=8.0.0",
|
|
35
|
+
"pytest-asyncio>=1.3.0",
|
|
36
|
+
"pytest-cov",
|
|
37
|
+
"ruff>=0.12.0",
|
|
38
|
+
"mypy>=1.0.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/mirasoth/soothe-client-python"
|
|
43
|
+
Documentation = "https://soothe.readthedocs.io"
|
|
44
|
+
Repository = "https://github.com/mirasoth/soothe-client-python"
|
|
45
|
+
|
|
46
|
+
[tool.hatch.build.targets.wheel]
|
|
47
|
+
packages = ["src/soothe_client"]
|
|
48
|
+
|
|
49
|
+
[tool.hatch.build.targets.sdist]
|
|
50
|
+
include = ["src/soothe_client/"]
|
|
51
|
+
exclude = [
|
|
52
|
+
"**/__pycache__",
|
|
53
|
+
"**/*.pyc",
|
|
54
|
+
"**/*.pyo",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
line-length = 100
|
|
59
|
+
target-version = "py311"
|
|
60
|
+
|
|
61
|
+
[tool.ruff.lint]
|
|
62
|
+
select = ["E", "F", "I", "N", "W", "UP"]
|
|
63
|
+
ignore = ["E501"]
|
|
64
|
+
|
|
65
|
+
[tool.ruff.format]
|
|
66
|
+
docstring-code-format = true
|
|
67
|
+
|
|
68
|
+
[tool.hatch.version]
|
|
69
|
+
path = "VERSION"
|
|
70
|
+
pattern = "^(?P<version>[0-9]+\\.[0-9]+\\.[0-9]+)$"
|
|
71
|
+
|
|
72
|
+
[tool.mypy]
|
|
73
|
+
python_version = "3.12"
|
|
74
|
+
warn_return_any = true
|
|
75
|
+
warn_unused_configs = true
|
|
76
|
+
disallow_untyped_defs = true
|
|
77
|
+
packages = ["soothe_client"]
|
|
78
|
+
mypy_path = "src"
|
|
79
|
+
|
|
80
|
+
[[tool.mypy.overrides]]
|
|
81
|
+
module = ["soothe_sdk", "soothe_sdk.*"]
|
|
82
|
+
ignore_missing_imports = true
|
|
83
|
+
|
|
84
|
+
[tool.pytest.ini_options]
|
|
85
|
+
asyncio_mode = "auto"
|
|
86
|
+
testpaths = ["tests/unit", "examples/appkit"]
|
|
87
|
+
addopts = "--import-mode=importlib"
|
|
88
|
+
markers = [
|
|
89
|
+
"integration: live soothe-daemon tests (skipped when unreachable)",
|
|
90
|
+
]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Soothe WebSocket client for talking to a running soothe-daemon.
|
|
2
|
+
|
|
3
|
+
Public surface::
|
|
4
|
+
|
|
5
|
+
from soothe_client import WebSocketClient, is_daemon_live
|
|
6
|
+
from soothe_client import AsyncCommandClient, CommandClient
|
|
7
|
+
from soothe_client.appkit import DaemonSession
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import importlib.metadata
|
|
13
|
+
|
|
14
|
+
from soothe_sdk.wire.codec import ProtocolError
|
|
15
|
+
|
|
16
|
+
from soothe_client.command_client import (
|
|
17
|
+
AsyncCommandClient,
|
|
18
|
+
CommandClient,
|
|
19
|
+
async_command_client_from_config,
|
|
20
|
+
command_client_from_config,
|
|
21
|
+
)
|
|
22
|
+
from soothe_client.errors import (
|
|
23
|
+
DaemonError,
|
|
24
|
+
DisconnectCause,
|
|
25
|
+
ReconnectError,
|
|
26
|
+
StaleLoopError,
|
|
27
|
+
disconnect_cause_name,
|
|
28
|
+
)
|
|
29
|
+
from soothe_client.helpers import (
|
|
30
|
+
check_daemon_status,
|
|
31
|
+
connected_websocket,
|
|
32
|
+
fetch_config_section,
|
|
33
|
+
fetch_execution_state,
|
|
34
|
+
fetch_loop_history,
|
|
35
|
+
fetch_loop_messages,
|
|
36
|
+
fetch_skills_catalog,
|
|
37
|
+
is_daemon_live,
|
|
38
|
+
protocol1_rpc,
|
|
39
|
+
request_daemon_config_reload,
|
|
40
|
+
request_daemon_shutdown,
|
|
41
|
+
websocket_url_from_config,
|
|
42
|
+
)
|
|
43
|
+
from soothe_client.intent_hints import (
|
|
44
|
+
DEFAULT_DELIVERABLE_PHASES,
|
|
45
|
+
EMBED,
|
|
46
|
+
IMAGE_TO_TEXT,
|
|
47
|
+
OCR,
|
|
48
|
+
TEXT_COMPLETION,
|
|
49
|
+
)
|
|
50
|
+
from soothe_client.session import (
|
|
51
|
+
bootstrap_loop_session,
|
|
52
|
+
connect_websocket_with_retries,
|
|
53
|
+
)
|
|
54
|
+
from soothe_client.websocket import WebSocketClient
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
__version__ = importlib.metadata.version("soothe-client-python")
|
|
58
|
+
except importlib.metadata.PackageNotFoundError:
|
|
59
|
+
__version__ = "0.0.0"
|
|
60
|
+
|
|
61
|
+
__all__ = [
|
|
62
|
+
"__version__",
|
|
63
|
+
# Transport
|
|
64
|
+
"WebSocketClient",
|
|
65
|
+
"ProtocolError",
|
|
66
|
+
# Errors
|
|
67
|
+
"DaemonError",
|
|
68
|
+
"DisconnectCause",
|
|
69
|
+
"ReconnectError",
|
|
70
|
+
"StaleLoopError",
|
|
71
|
+
"disconnect_cause_name",
|
|
72
|
+
# Command clients
|
|
73
|
+
"AsyncCommandClient",
|
|
74
|
+
"CommandClient",
|
|
75
|
+
"command_client_from_config",
|
|
76
|
+
"async_command_client_from_config",
|
|
77
|
+
# Session bootstrap
|
|
78
|
+
"bootstrap_loop_session",
|
|
79
|
+
"connect_websocket_with_retries",
|
|
80
|
+
# Helpers
|
|
81
|
+
"websocket_url_from_config",
|
|
82
|
+
"connected_websocket",
|
|
83
|
+
"protocol1_rpc",
|
|
84
|
+
"check_daemon_status",
|
|
85
|
+
"is_daemon_live",
|
|
86
|
+
"request_daemon_config_reload",
|
|
87
|
+
"request_daemon_shutdown",
|
|
88
|
+
"fetch_skills_catalog",
|
|
89
|
+
"fetch_config_section",
|
|
90
|
+
"fetch_execution_state",
|
|
91
|
+
"fetch_loop_history",
|
|
92
|
+
"fetch_loop_messages",
|
|
93
|
+
# Intent hints
|
|
94
|
+
"TEXT_COMPLETION",
|
|
95
|
+
"IMAGE_TO_TEXT",
|
|
96
|
+
"OCR",
|
|
97
|
+
"EMBED",
|
|
98
|
+
"DEFAULT_DELIVERABLE_PHASES",
|
|
99
|
+
]
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Application helpers built on WebSocketClient.
|
|
2
|
+
|
|
3
|
+
Building blocks for agent UIs and backends: `DaemonSession`,
|
|
4
|
+
`ConnectionPool` / `TurnRunner`, `QueryGate`, `EventClassifier`,
|
|
5
|
+
`SSEBroadcaster`, `LoopSessionStore`.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from soothe_client.appkit.attachments import (
|
|
11
|
+
CompactImageOptions,
|
|
12
|
+
compact_attachments,
|
|
13
|
+
compact_image_attachment,
|
|
14
|
+
)
|
|
15
|
+
from soothe_client.appkit.broadcaster import SSEBroadcaster, SSEEvent
|
|
16
|
+
from soothe_client.appkit.card_projection import CardProjection, parse_card_custom_payload
|
|
17
|
+
from soothe_client.appkit.classifier import (
|
|
18
|
+
EVENT_FINAL_REPORT,
|
|
19
|
+
ChatEventResult,
|
|
20
|
+
ChatEventTerminal,
|
|
21
|
+
ClassifierConfig,
|
|
22
|
+
EventClassifier,
|
|
23
|
+
)
|
|
24
|
+
from soothe_client.appkit.daemon_session import DaemonSession
|
|
25
|
+
from soothe_client.appkit.loop_session_store import (
|
|
26
|
+
LoopSessionEntry,
|
|
27
|
+
LoopSessionStore,
|
|
28
|
+
SessionMessage,
|
|
29
|
+
)
|
|
30
|
+
from soothe_client.appkit.pool import (
|
|
31
|
+
ConnectionPool,
|
|
32
|
+
ErrPoolExhausted,
|
|
33
|
+
PoolConfig,
|
|
34
|
+
PooledConn,
|
|
35
|
+
default_pool_config,
|
|
36
|
+
)
|
|
37
|
+
from soothe_client.appkit.query_gate import ErrQueryBusy, QueryGate
|
|
38
|
+
from soothe_client.appkit.thinking_step import (
|
|
39
|
+
DEFAULT_THINKING_STEP_EVENTS,
|
|
40
|
+
extract_thinking_step,
|
|
41
|
+
)
|
|
42
|
+
from soothe_client.appkit.turn_boundary import (
|
|
43
|
+
TURN_END_IDLE,
|
|
44
|
+
TURN_END_STOPPED,
|
|
45
|
+
TURN_END_STREAM_END,
|
|
46
|
+
TurnBoundary,
|
|
47
|
+
TurnLifecycleGate,
|
|
48
|
+
is_daemon_turn_end_event,
|
|
49
|
+
)
|
|
50
|
+
from soothe_client.appkit.turn_runner import (
|
|
51
|
+
STREAM_CLOSE_FAIL,
|
|
52
|
+
STREAM_CLOSE_SOFT_COMPLETE,
|
|
53
|
+
Attachment,
|
|
54
|
+
ErrIdleTimeout,
|
|
55
|
+
ErrQueryTimeout,
|
|
56
|
+
InputOpts,
|
|
57
|
+
OnComplete,
|
|
58
|
+
OnError,
|
|
59
|
+
StreamClosePolicy,
|
|
60
|
+
TimeoutPolicy,
|
|
61
|
+
TurnConfig,
|
|
62
|
+
TurnRunner,
|
|
63
|
+
idle_timeout_for_turn,
|
|
64
|
+
input_message_for_loop,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
__all__ = [
|
|
68
|
+
"DEFAULT_THINKING_STEP_EVENTS",
|
|
69
|
+
"STREAM_CLOSE_FAIL",
|
|
70
|
+
"STREAM_CLOSE_SOFT_COMPLETE",
|
|
71
|
+
"Attachment",
|
|
72
|
+
"CardProjection",
|
|
73
|
+
"ChatEventResult",
|
|
74
|
+
"ChatEventTerminal",
|
|
75
|
+
"ClassifierConfig",
|
|
76
|
+
"CompactImageOptions",
|
|
77
|
+
"ConnectionPool",
|
|
78
|
+
"DaemonSession",
|
|
79
|
+
"EVENT_FINAL_REPORT",
|
|
80
|
+
"ErrIdleTimeout",
|
|
81
|
+
"ErrPoolExhausted",
|
|
82
|
+
"ErrQueryBusy",
|
|
83
|
+
"ErrQueryTimeout",
|
|
84
|
+
"EventClassifier",
|
|
85
|
+
"InputOpts",
|
|
86
|
+
"LoopSessionEntry",
|
|
87
|
+
"LoopSessionStore",
|
|
88
|
+
"OnComplete",
|
|
89
|
+
"OnError",
|
|
90
|
+
"PoolConfig",
|
|
91
|
+
"PooledConn",
|
|
92
|
+
"QueryGate",
|
|
93
|
+
"SSEBroadcaster",
|
|
94
|
+
"SSEEvent",
|
|
95
|
+
"SessionMessage",
|
|
96
|
+
"StreamClosePolicy",
|
|
97
|
+
"TURN_END_IDLE",
|
|
98
|
+
"TURN_END_STOPPED",
|
|
99
|
+
"TURN_END_STREAM_END",
|
|
100
|
+
"TimeoutPolicy",
|
|
101
|
+
"TurnBoundary",
|
|
102
|
+
"TurnConfig",
|
|
103
|
+
"TurnLifecycleGate",
|
|
104
|
+
"TurnRunner",
|
|
105
|
+
"compact_attachments",
|
|
106
|
+
"is_daemon_turn_end_event",
|
|
107
|
+
"compact_image_attachment",
|
|
108
|
+
"default_pool_config",
|
|
109
|
+
"extract_thinking_step",
|
|
110
|
+
"idle_timeout_for_turn",
|
|
111
|
+
"input_message_for_loop",
|
|
112
|
+
"parse_card_custom_payload",
|
|
113
|
+
]
|