rqark-app 0.11.8__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.
- rqark_app-0.11.8/.gitea/workflows/pypi-hub.yaml +31 -0
- rqark_app-0.11.8/.gitea/workflows/pypi.yaml +32 -0
- rqark_app-0.11.8/.gitignore +178 -0
- rqark_app-0.11.8/.python-version +1 -0
- rqark_app-0.11.8/.vscode/settings.json +37 -0
- rqark_app-0.11.8/AGENTS.md +7 -0
- rqark_app-0.11.8/LICENSE +18 -0
- rqark_app-0.11.8/PKG-INFO +152 -0
- rqark_app-0.11.8/README.md +132 -0
- rqark_app-0.11.8/example/base.py +52 -0
- rqark_app-0.11.8/example/compact.py +102 -0
- rqark_app-0.11.8/example/model.py +1 -0
- rqark_app-0.11.8/example/storage.py +59 -0
- rqark_app-0.11.8/pyproject.toml +71 -0
- rqark_app-0.11.8/src/rqark_app/_app/core.py +21 -0
- rqark_app-0.11.8/src/rqark_app/_app/event.py +58 -0
- rqark_app-0.11.8/src/rqark_app/_app/helper.py +44 -0
- rqark_app-0.11.8/src/rqark_app/agent/agents/__init__.py +5 -0
- rqark_app-0.11.8/src/rqark_app/agent/agents/angel_holiday.py +18 -0
- rqark_app-0.11.8/src/rqark_app/agent/agents/diana.py +21 -0
- rqark_app-0.11.8/src/rqark_app/agent/agents/wednesday.py +27 -0
- rqark_app-0.11.8/src/rqark_app/agent/manager.py +39 -0
- rqark_app-0.11.8/src/rqark_app/app.py +210 -0
- rqark_app-0.11.8/src/rqark_app/cloud/chat.py +56 -0
- rqark_app-0.11.8/src/rqark_app/cloud/client.py +301 -0
- rqark_app-0.11.8/src/rqark_app/compact/__init__.py +5 -0
- rqark_app-0.11.8/src/rqark_app/compact/compactor.py +29 -0
- rqark_app-0.11.8/src/rqark_app/compact/detect.py +65 -0
- rqark_app-0.11.8/src/rqark_app/compact/messages.py +25 -0
- rqark_app-0.11.8/src/rqark_app/compact/prompt.py +21 -0
- rqark_app-0.11.8/src/rqark_app/config/default.py +7 -0
- rqark_app-0.11.8/src/rqark_app/config/dir_cache.py +79 -0
- rqark_app-0.11.8/src/rqark_app/config/manager.py +209 -0
- rqark_app-0.11.8/src/rqark_app/libs/io.py +47 -0
- rqark_app-0.11.8/src/rqark_app/memory/__init__.py +9 -0
- rqark_app-0.11.8/src/rqark_app/memory/settings.py +42 -0
- rqark_app-0.11.8/src/rqark_app/memory/writer.py +227 -0
- rqark_app-0.11.8/src/rqark_app/prompts/memory.py +61 -0
- rqark_app-0.11.8/src/rqark_app/prompts/memory_writer.py +69 -0
- rqark_app-0.11.8/src/rqark_app/prompts/state.py +36 -0
- rqark_app-0.11.8/src/rqark_app/prompts/title.py +19 -0
- rqark_app-0.11.8/src/rqark_app/provider/manager.py +33 -0
- rqark_app-0.11.8/src/rqark_app/py.typed +0 -0
- rqark_app-0.11.8/src/rqark_app/session/manager.py +55 -0
- rqark_app-0.11.8/src/rqark_app/session/storage/__init__.py +3 -0
- rqark_app-0.11.8/src/rqark_app/session/storage/base.py +17 -0
- rqark_app-0.11.8/src/rqark_app/session/storage/cloud.py +64 -0
- rqark_app-0.11.8/src/rqark_app/session/storage/jsonl.py +49 -0
- rqark_app-0.11.8/src/rqark_app/sop/__init__.py +5 -0
- rqark_app-0.11.8/src/rqark_app/sop/expand.py +26 -0
- rqark_app-0.11.8/src/rqark_app/sop/manager.py +131 -0
- rqark_app-0.11.8/src/rqark_app/sop/types.py +34 -0
- rqark_app-0.11.8/src/rqark_app/tools/__init__.py +6 -0
- rqark_app-0.11.8/src/rqark_app/tools/context.py +32 -0
- rqark_app-0.11.8/src/rqark_app/tools/memory_save.py +64 -0
- rqark_app-0.11.8/src/rqark_app/tools/memory_search.py +48 -0
- rqark_app-0.11.8/src/rqark_app/tools/task.py +142 -0
- rqark_app-0.11.8/src/rqark_app/tools/todo.py +109 -0
- rqark_app-0.11.8/src/rqark_app/types/agent.py +30 -0
- rqark_app-0.11.8/src/rqark_app/types/cloud.py +12 -0
- rqark_app-0.11.8/src/rqark_app/types/event.py +12 -0
- rqark_app-0.11.8/src/rqark_app/types/session.py +158 -0
- rqark_app-0.11.8/tests/test_agent_manager.py +39 -0
- rqark_app-0.11.8/tests/test_app.py +405 -0
- rqark_app-0.11.8/tests/test_cloud_chat.py +93 -0
- rqark_app-0.11.8/tests/test_cloud_client.py +498 -0
- rqark_app-0.11.8/tests/test_cloud_client_selection.py +33 -0
- rqark_app-0.11.8/tests/test_cloud_store.py +207 -0
- rqark_app-0.11.8/tests/test_config_agents.py +371 -0
- rqark_app-0.11.8/tests/test_dir_cache.py +135 -0
- rqark_app-0.11.8/tests/test_image_message.py +210 -0
- rqark_app-0.11.8/tests/test_memory_prompt.py +85 -0
- rqark_app-0.11.8/tests/test_memory_tools.py +125 -0
- rqark_app-0.11.8/tests/test_memory_writer.py +300 -0
- rqark_app-0.11.8/tests/test_message_id.py +94 -0
- rqark_app-0.11.8/tests/test_provider_mgr.py +49 -0
- rqark_app-0.11.8/tests/test_retry_compact.py +181 -0
- rqark_app-0.11.8/tests/test_sop.py +221 -0
- rqark_app-0.11.8/tests/test_state_prompt.py +112 -0
- rqark_app-0.11.8/tests/test_summary.py +104 -0
- rqark_app-0.11.8/tests/test_task_tool.py +200 -0
- rqark_app-0.11.8/tests/test_todo_tool.py +132 -0
- rqark_app-0.11.8/tests/test_turn_memory.py +363 -0
- rqark_app-0.11.8/uv.lock +1403 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Publish to PyPI Hub
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v3
|
|
18
|
+
with:
|
|
19
|
+
enable-cache: true
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
run: uv python install 3.14
|
|
23
|
+
|
|
24
|
+
- name: Build the package
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
env:
|
|
29
|
+
UV_PUBLISH_USERNAME: __token__
|
|
30
|
+
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
31
|
+
run: uv publish
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Build and Publish with uv
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
release:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout code
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Install uv
|
|
17
|
+
uses: astral-sh/setup-uv@v3
|
|
18
|
+
with:
|
|
19
|
+
enable-cache: true
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
run: uv python install 3.14
|
|
23
|
+
|
|
24
|
+
- name: Build the package
|
|
25
|
+
run: uv build
|
|
26
|
+
|
|
27
|
+
- name: Publish to Gitea PyPI
|
|
28
|
+
env:
|
|
29
|
+
UV_PUBLISH_URL: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/pypi
|
|
30
|
+
UV_PUBLISH_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
|
|
31
|
+
UV_PUBLISH_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
|
32
|
+
run: uv publish
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# ---> Python
|
|
2
|
+
# Byte-compiled / optimized / DLL files
|
|
3
|
+
__pycache__/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*$py.class
|
|
6
|
+
|
|
7
|
+
# C extensions
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Distribution / packaging
|
|
11
|
+
.Python
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
.pybuilder/
|
|
77
|
+
target/
|
|
78
|
+
|
|
79
|
+
# Jupyter Notebook
|
|
80
|
+
.ipynb_checkpoints
|
|
81
|
+
|
|
82
|
+
# IPython
|
|
83
|
+
profile_default/
|
|
84
|
+
ipython_config.py
|
|
85
|
+
|
|
86
|
+
# pyenv
|
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
89
|
+
# .python-version
|
|
90
|
+
|
|
91
|
+
# pipenv
|
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
95
|
+
# install all needed dependencies.
|
|
96
|
+
#Pipfile.lock
|
|
97
|
+
|
|
98
|
+
# UV
|
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
101
|
+
# commonly ignored for libraries.
|
|
102
|
+
#uv.lock
|
|
103
|
+
|
|
104
|
+
# poetry
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
106
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
107
|
+
# commonly ignored for libraries.
|
|
108
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
109
|
+
#poetry.lock
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
#pdm.lock
|
|
114
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
115
|
+
# in version control.
|
|
116
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
117
|
+
.pdm.toml
|
|
118
|
+
.pdm-python
|
|
119
|
+
.pdm-build/
|
|
120
|
+
|
|
121
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
122
|
+
__pypackages__/
|
|
123
|
+
|
|
124
|
+
# Celery stuff
|
|
125
|
+
celerybeat-schedule
|
|
126
|
+
celerybeat.pid
|
|
127
|
+
|
|
128
|
+
# SageMath parsed files
|
|
129
|
+
*.sage.py
|
|
130
|
+
|
|
131
|
+
# Environments
|
|
132
|
+
.env
|
|
133
|
+
.venv
|
|
134
|
+
env/
|
|
135
|
+
venv/
|
|
136
|
+
ENV/
|
|
137
|
+
env.bak/
|
|
138
|
+
venv.bak/
|
|
139
|
+
|
|
140
|
+
# Spyder project settings
|
|
141
|
+
.spyderproject
|
|
142
|
+
.spyproject
|
|
143
|
+
|
|
144
|
+
# Rope project settings
|
|
145
|
+
.ropeproject
|
|
146
|
+
|
|
147
|
+
# mkdocs documentation
|
|
148
|
+
/site
|
|
149
|
+
|
|
150
|
+
# mypy
|
|
151
|
+
.mypy_cache/
|
|
152
|
+
.dmypy.json
|
|
153
|
+
dmypy.json
|
|
154
|
+
|
|
155
|
+
# Pyre type checker
|
|
156
|
+
.pyre/
|
|
157
|
+
|
|
158
|
+
# pytype static type analyzer
|
|
159
|
+
.pytype/
|
|
160
|
+
|
|
161
|
+
# Cython debug symbols
|
|
162
|
+
cython_debug/
|
|
163
|
+
|
|
164
|
+
# PyCharm
|
|
165
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
166
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
167
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
168
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
169
|
+
#.idea/
|
|
170
|
+
|
|
171
|
+
# Ruff stuff:
|
|
172
|
+
.ruff_cache/
|
|
173
|
+
|
|
174
|
+
# PyPI configuration file
|
|
175
|
+
.pypirc
|
|
176
|
+
|
|
177
|
+
.sessions
|
|
178
|
+
.rqark
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
/*
|
|
3
|
+
* BASE
|
|
4
|
+
*/
|
|
5
|
+
"files.encoding": "utf8",
|
|
6
|
+
"editor.linkedEditing": true, // 使得同時編輯相同變數或符號更容易。
|
|
7
|
+
"editor.bracketPairColorization.enabled": true, // 啟用括號配對著色功能。
|
|
8
|
+
"editor.guides.bracketPairs": true, // 在括號間顯示視覺導引線
|
|
9
|
+
"explorer.compactFolders": false,
|
|
10
|
+
/*
|
|
11
|
+
* GIT
|
|
12
|
+
*/
|
|
13
|
+
"git.autofetch": true,
|
|
14
|
+
"git.enableSmartCommit": true,
|
|
15
|
+
"git.confirmSync": false,
|
|
16
|
+
/*
|
|
17
|
+
* PYTHON
|
|
18
|
+
*/
|
|
19
|
+
"python.analysis.inlayHints.callArgumentNames": "partial",
|
|
20
|
+
"python.analysis.inlayHints.functionReturnTypes": true,
|
|
21
|
+
"python.analysis.inlayHints.pytestParameters": true,
|
|
22
|
+
"python.analysis.inlayHints.variableTypes": true,
|
|
23
|
+
"python.analysis.autoSearchPaths": true,
|
|
24
|
+
"python.analysis.autoIndent": true,
|
|
25
|
+
"python.analysis.autoFormatStrings": true, // 在字串內輸入“{”時,是否自動加上“f”前綴。
|
|
26
|
+
"python.analysis.completeFunctionParens": true,
|
|
27
|
+
"python.analysis.typeEvaluation.analyzeUnannotatedFunctions": true, // 為函數補全添加括號。
|
|
28
|
+
"python.analysis.typeEvaluation.strictSetInference": true,
|
|
29
|
+
"python.analysis.includeAliasesFromUserFiles": false,
|
|
30
|
+
"python.analysis.typeCheckingMode": "basic",
|
|
31
|
+
"python.analysis.typeEvaluation.strictDictionaryInference": true,
|
|
32
|
+
"python.analysis.typeEvaluation.strictListInference": true,
|
|
33
|
+
/*
|
|
34
|
+
* JUPYTER
|
|
35
|
+
*/
|
|
36
|
+
"jupyter.exportWithOutputEnabled": false,
|
|
37
|
+
}
|
rqark_app-0.11.8/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RedQueenArk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
6
|
+
associated documentation files (the "Software"), to deal in the Software without restriction, including
|
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
12
|
+
portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
15
|
+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
|
16
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
18
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: rqark-app
|
|
3
|
+
Version: 0.11.8
|
|
4
|
+
Summary: Session, provider and agent management on top of rqark-core, with optional rqark-data-cloud integration
|
|
5
|
+
Project-URL: Repository, https://gitea.carhyme.top/RedQueenArk/rqark-app
|
|
6
|
+
Author: RedQueenArk
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agent,llm,openai,session
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Python: >=3.14
|
|
14
|
+
Requires-Dist: certifi>=2026.10.23
|
|
15
|
+
Requires-Dist: httpx2>=2.12.0
|
|
16
|
+
Requires-Dist: httpx>=0.28.1
|
|
17
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
18
|
+
Requires-Dist: rqark-core==0.5.0
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# rqark-app
|
|
22
|
+
|
|
23
|
+
Session, provider and agent management on top of `rqark-core`, with an optional data cloud for memory, todos and settings.
|
|
24
|
+
|
|
25
|
+
## Why rqark-app
|
|
26
|
+
|
|
27
|
+
`rqark-core` runs one conversation. This keeps it: turns are stored and can be resumed, a failed provider rotates to the next one, and a finished turn is recorded without anyone calling a tool.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Requires Python 3.14+.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
uv add rqark-app
|
|
35
|
+
# or
|
|
36
|
+
pip install rqark-app
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import asyncio
|
|
43
|
+
|
|
44
|
+
from rqark_core.types.chat import Chunk
|
|
45
|
+
from rqark_core.types.event import AgentPayload
|
|
46
|
+
from rqark_core.types.provider import Provider
|
|
47
|
+
|
|
48
|
+
from rqark_app.agent.agents import Wednesday
|
|
49
|
+
from rqark_app.app import AgentApp
|
|
50
|
+
from rqark_app.session.storage import JSONLStorage
|
|
51
|
+
|
|
52
|
+
provider = Provider(model_name='gpt-5', api_base='https://api.openai.com/v1', priority=0, api_key='sk-...')
|
|
53
|
+
|
|
54
|
+
app = AgentApp([provider], storage=JSONLStorage('./.sessions'))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@app.on_content()
|
|
58
|
+
async def print_content(ev: AgentPayload[Chunk]):
|
|
59
|
+
print(ev.payload.content, end='', flush=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
async def main():
|
|
63
|
+
session = await app.chat('Who are you?', Wednesday(), path=('demo',))
|
|
64
|
+
print(session.uuid)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
asyncio.run(main())
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## App
|
|
71
|
+
|
|
72
|
+
### Events
|
|
73
|
+
|
|
74
|
+
- `on_think`
|
|
75
|
+
- `on_content`
|
|
76
|
+
- `on_tool_calls`
|
|
77
|
+
- `on_tool_result`
|
|
78
|
+
- `on_usage`
|
|
79
|
+
- `on_error`
|
|
80
|
+
- `on_message`
|
|
81
|
+
- `on_plan`
|
|
82
|
+
- `on_provider_switched`
|
|
83
|
+
|
|
84
|
+
### Retry
|
|
85
|
+
|
|
86
|
+
`APIError` reports a failure to the `ProviderManager`; three consecutive failures rotate the provider. A context overflow asks the `Compactor` for a summary, appends it to the history, and retries from the last chunk. Anything else is raised.
|
|
87
|
+
|
|
88
|
+
`session.plan_items` is seeded back into each new core, so `plan_update` sees the running plan instead of "No active plan".
|
|
89
|
+
|
|
90
|
+
## Managers
|
|
91
|
+
|
|
92
|
+
### Session
|
|
93
|
+
|
|
94
|
+
- `SessionManager`
|
|
95
|
+
- `Session`
|
|
96
|
+
- `SessionStorage`
|
|
97
|
+
- `JSONLStorage`
|
|
98
|
+
- `CloudStorage`
|
|
99
|
+
|
|
100
|
+
### Provider
|
|
101
|
+
|
|
102
|
+
- `ProviderManager`
|
|
103
|
+
|
|
104
|
+
### Agent
|
|
105
|
+
|
|
106
|
+
- `AgentManager`
|
|
107
|
+
- `BaseAgent`
|
|
108
|
+
- `Wednesday`
|
|
109
|
+
- `Diana`
|
|
110
|
+
- `AgentHoliday`
|
|
111
|
+
|
|
112
|
+
### Config
|
|
113
|
+
|
|
114
|
+
- `ConfigManager`
|
|
115
|
+
- `DirCache`
|
|
116
|
+
- `SopManager`
|
|
117
|
+
|
|
118
|
+
## Cloud
|
|
119
|
+
|
|
120
|
+
`cloud.yml` needs `enabled`, `url` and `api_key`. Once configured the cloud is the only source; there is no fallback to local files and a failed load raises `DataCloudError`.
|
|
121
|
+
|
|
122
|
+
- `RQArkDataCloudClient`
|
|
123
|
+
- `CloudStorage`
|
|
124
|
+
- `DataCloudError` — `REQUEST_FAILED` unreachable, `INVALID_RESPONSE` not JSON, anything else is a 4xx/5xx from the cloud
|
|
125
|
+
|
|
126
|
+
### Default agent
|
|
127
|
+
|
|
128
|
+
One per `source`, stored in the cloud and shared across clients. `set_default_agent()` and `clear_default_agent()` write it back; the agent needs an `id` from the cloud.
|
|
129
|
+
|
|
130
|
+
## Memory
|
|
131
|
+
|
|
132
|
+
- `TurnMemoryWriter`
|
|
133
|
+
- `MemorySettings`
|
|
134
|
+
- `MemorySave`
|
|
135
|
+
- `MemorySearch`
|
|
136
|
+
|
|
137
|
+
## Tools
|
|
138
|
+
|
|
139
|
+
### Memory
|
|
140
|
+
|
|
141
|
+
- `MemorySave`
|
|
142
|
+
- `MemorySearch`
|
|
143
|
+
|
|
144
|
+
### Cloud
|
|
145
|
+
|
|
146
|
+
- `Todo`
|
|
147
|
+
- `Task`
|
|
148
|
+
|
|
149
|
+
## SOP
|
|
150
|
+
|
|
151
|
+
- `SopManager`
|
|
152
|
+
- `Sop`
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# rqark-app
|
|
2
|
+
|
|
3
|
+
Session, provider and agent management on top of `rqark-core`, with an optional data cloud for memory, todos and settings.
|
|
4
|
+
|
|
5
|
+
## Why rqark-app
|
|
6
|
+
|
|
7
|
+
`rqark-core` runs one conversation. This keeps it: turns are stored and can be resumed, a failed provider rotates to the next one, and a finished turn is recorded without anyone calling a tool.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Requires Python 3.14+.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv add rqark-app
|
|
15
|
+
# or
|
|
16
|
+
pip install rqark-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import asyncio
|
|
23
|
+
|
|
24
|
+
from rqark_core.types.chat import Chunk
|
|
25
|
+
from rqark_core.types.event import AgentPayload
|
|
26
|
+
from rqark_core.types.provider import Provider
|
|
27
|
+
|
|
28
|
+
from rqark_app.agent.agents import Wednesday
|
|
29
|
+
from rqark_app.app import AgentApp
|
|
30
|
+
from rqark_app.session.storage import JSONLStorage
|
|
31
|
+
|
|
32
|
+
provider = Provider(model_name='gpt-5', api_base='https://api.openai.com/v1', priority=0, api_key='sk-...')
|
|
33
|
+
|
|
34
|
+
app = AgentApp([provider], storage=JSONLStorage('./.sessions'))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@app.on_content()
|
|
38
|
+
async def print_content(ev: AgentPayload[Chunk]):
|
|
39
|
+
print(ev.payload.content, end='', flush=True)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
async def main():
|
|
43
|
+
session = await app.chat('Who are you?', Wednesday(), path=('demo',))
|
|
44
|
+
print(session.uuid)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
asyncio.run(main())
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## App
|
|
51
|
+
|
|
52
|
+
### Events
|
|
53
|
+
|
|
54
|
+
- `on_think`
|
|
55
|
+
- `on_content`
|
|
56
|
+
- `on_tool_calls`
|
|
57
|
+
- `on_tool_result`
|
|
58
|
+
- `on_usage`
|
|
59
|
+
- `on_error`
|
|
60
|
+
- `on_message`
|
|
61
|
+
- `on_plan`
|
|
62
|
+
- `on_provider_switched`
|
|
63
|
+
|
|
64
|
+
### Retry
|
|
65
|
+
|
|
66
|
+
`APIError` reports a failure to the `ProviderManager`; three consecutive failures rotate the provider. A context overflow asks the `Compactor` for a summary, appends it to the history, and retries from the last chunk. Anything else is raised.
|
|
67
|
+
|
|
68
|
+
`session.plan_items` is seeded back into each new core, so `plan_update` sees the running plan instead of "No active plan".
|
|
69
|
+
|
|
70
|
+
## Managers
|
|
71
|
+
|
|
72
|
+
### Session
|
|
73
|
+
|
|
74
|
+
- `SessionManager`
|
|
75
|
+
- `Session`
|
|
76
|
+
- `SessionStorage`
|
|
77
|
+
- `JSONLStorage`
|
|
78
|
+
- `CloudStorage`
|
|
79
|
+
|
|
80
|
+
### Provider
|
|
81
|
+
|
|
82
|
+
- `ProviderManager`
|
|
83
|
+
|
|
84
|
+
### Agent
|
|
85
|
+
|
|
86
|
+
- `AgentManager`
|
|
87
|
+
- `BaseAgent`
|
|
88
|
+
- `Wednesday`
|
|
89
|
+
- `Diana`
|
|
90
|
+
- `AgentHoliday`
|
|
91
|
+
|
|
92
|
+
### Config
|
|
93
|
+
|
|
94
|
+
- `ConfigManager`
|
|
95
|
+
- `DirCache`
|
|
96
|
+
- `SopManager`
|
|
97
|
+
|
|
98
|
+
## Cloud
|
|
99
|
+
|
|
100
|
+
`cloud.yml` needs `enabled`, `url` and `api_key`. Once configured the cloud is the only source; there is no fallback to local files and a failed load raises `DataCloudError`.
|
|
101
|
+
|
|
102
|
+
- `RQArkDataCloudClient`
|
|
103
|
+
- `CloudStorage`
|
|
104
|
+
- `DataCloudError` — `REQUEST_FAILED` unreachable, `INVALID_RESPONSE` not JSON, anything else is a 4xx/5xx from the cloud
|
|
105
|
+
|
|
106
|
+
### Default agent
|
|
107
|
+
|
|
108
|
+
One per `source`, stored in the cloud and shared across clients. `set_default_agent()` and `clear_default_agent()` write it back; the agent needs an `id` from the cloud.
|
|
109
|
+
|
|
110
|
+
## Memory
|
|
111
|
+
|
|
112
|
+
- `TurnMemoryWriter`
|
|
113
|
+
- `MemorySettings`
|
|
114
|
+
- `MemorySave`
|
|
115
|
+
- `MemorySearch`
|
|
116
|
+
|
|
117
|
+
## Tools
|
|
118
|
+
|
|
119
|
+
### Memory
|
|
120
|
+
|
|
121
|
+
- `MemorySave`
|
|
122
|
+
- `MemorySearch`
|
|
123
|
+
|
|
124
|
+
### Cloud
|
|
125
|
+
|
|
126
|
+
- `Todo`
|
|
127
|
+
- `Task`
|
|
128
|
+
|
|
129
|
+
## SOP
|
|
130
|
+
|
|
131
|
+
- `SopManager`
|
|
132
|
+
- `Sop`
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
|
|
3
|
+
from model import MODEL_NAME
|
|
4
|
+
from rqark_core.types.chat import Chunk, ToolMessage
|
|
5
|
+
from rqark_core.types.event import AgentPayload
|
|
6
|
+
from rqark_core.types.provider import Provider
|
|
7
|
+
|
|
8
|
+
from rqark_app.agent.agents import Wednesday
|
|
9
|
+
from rqark_app.app import AgentApp
|
|
10
|
+
from rqark_app.types.event import ProviderSwitch
|
|
11
|
+
|
|
12
|
+
provider = Provider(MODEL_NAME, 'http://127.0.0.1:8080', 0, 'api_key', combine=True, thinking='disabled')
|
|
13
|
+
|
|
14
|
+
app = AgentApp([provider])
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@app.on_think()
|
|
18
|
+
async def thinking(ev: AgentPayload[Chunk]):
|
|
19
|
+
print(ev)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@app.on_content()
|
|
23
|
+
async def content(ev: AgentPayload[Chunk]):
|
|
24
|
+
print(ev)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@app.on_tool_calls()
|
|
28
|
+
async def tool_calls(ev: AgentPayload[Chunk]):
|
|
29
|
+
print(ev)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@app.on_tool_result()
|
|
33
|
+
async def tool_result(ev: AgentPayload[ToolMessage]):
|
|
34
|
+
print(ev)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@app.on_error()
|
|
38
|
+
async def has_error(ev: AgentPayload[Chunk]):
|
|
39
|
+
print(ev)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@app.on_provider_switched()
|
|
43
|
+
async def switch_provider(ev: AgentPayload[ProviderSwitch]):
|
|
44
|
+
print(ev)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
async def main():
|
|
48
|
+
await app.chat('你係邊個?', Wednesday())
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
if __name__ == '__main__':
|
|
52
|
+
asyncio.run(main())
|