soliplex 0.92.2__tar.gz → 0.93__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.
- {soliplex-0.92.2/src/soliplex.egg-info → soliplex-0.93}/PKG-INFO +2 -2
- {soliplex-0.92.2 → soliplex-0.93}/pyproject.toml +2 -2
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agui/__init__.py +31 -3
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agui/persistence.py +88 -5
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agui/schema.py +19 -0
- soliplex-0.93/src/soliplex/agui/text_search.py +123 -0
- soliplex-0.93/src/soliplex/alembic_migrations/versions/e5d2f5ef98a3_soliplex_v0_93.py +75 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/agui.py +1 -1
- {soliplex-0.92.2 → soliplex-0.93/src/soliplex.egg-info}/PKG-INFO +2 -2
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex.egg-info/SOURCES.txt +2 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex.egg-info/requires.txt +1 -1
- {soliplex-0.92.2 → soliplex-0.93}/LICENSE +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/MANIFEST.in +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/README.md +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/example/skills/bare-bones/SKILL.md +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/example/skills/stanzas/SKILL.md +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/setup.cfg +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/skills/soliplex-docs/SKILL.md +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agents.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agui/parser.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agui/sse_delivery.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/agui/util.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/env.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/216d48e1e2e5_soliplex_v0_53.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/4b63e5f3f39e_soliplex_v0_51_1.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/63edaa5987f6_soliplex_v0_67.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/98cd91f27cb5_soliplex_v0_92.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/a1c7d3e90b42_soliplex_v0_80.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/b7e2f41c9d05_soliplex_v0_82.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/d5009d4f9874_soliplex_v0_44.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/alembic_migrations/versions/f13fea6c1953_soliplex_v0_86.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/authn.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/authz/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/authz/persistence.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/authz/schema.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/capabilities/filesystem.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/capabilities/rag_audit.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/admin_users.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/ask.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/_common.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/admin_users.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/completions.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/databases.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/environment.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/installation.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/interpolation.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/logfire.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/logging.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/non_local_paths.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/oidc.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/ollama.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/quizzes.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/room_authz.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/rooms.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/secrets.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/audit/skills.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/cli_util.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/database.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/main.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/ollama.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/room_authz.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/serve.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/service_token.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/cli/types.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/completions.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/_utils.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/agents.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/agui.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/authsystem.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/completions.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/exceptions.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/installation.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/interpolation.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/logfire.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/meta.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/middleware.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/quizzes.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/rag.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/rooms.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/routing.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/secrets.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/skills.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/sse_delivery.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/config/tools.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/examples.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/installation.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/labels.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/log_ingest.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/loggers.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/main.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/mcp_auth.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/mcp_client.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/mcp_server.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/models.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/ollama.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/quizzes.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/rag_audit.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/sandbox_audit.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/secrets.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/skills/bwrap_sandbox/SKILL.md +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/skills/bwrap_sandbox/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/titles.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/token_mint.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tools/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tools/agui_run_feedback.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tools/file_uploads.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tools/rag.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tui/cli.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tui/main.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tui/rest_api.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/tui/serve.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/util.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/__init__.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/authn.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/authz.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/completions.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/installation.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/labels.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/log_ingest.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/quizzes.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/room_file_uploads.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/rooms.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/sandbox_workdirs.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/stats.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/streaming.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/templates/consent.html.mako +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/templates/cookie-too-large.html.mako +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex/views/thread_file_uploads.py +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex.egg-info/dependency_links.txt +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex.egg-info/entry_points.txt +0 -0
- {soliplex-0.92.2 → soliplex-0.93}/src/soliplex.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: soliplex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.93
|
|
4
4
|
Summary: An AI-powered Retrieval-Augmented Generation (RAG) system with a modern web interface.
|
|
5
5
|
Author-email: Enfold <info@enfoldsystems.net>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -20,7 +20,7 @@ Requires-Dist: fakeredis!=2.35.0
|
|
|
20
20
|
Requires-Dist: fastapi
|
|
21
21
|
Requires-Dist: fastmcp<5.0,>=4.1.2
|
|
22
22
|
Requires-Dist: greenlet
|
|
23
|
-
Requires-Dist: haiku.rag-slim<0.
|
|
23
|
+
Requires-Dist: haiku.rag-slim<0.113,>=0.112.0
|
|
24
24
|
Requires-Dist: idna>=3.15
|
|
25
25
|
Requires-Dist: itsdangerous
|
|
26
26
|
Requires-Dist: joserfc<1.8,>=1.7.5
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "soliplex"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.93"
|
|
8
8
|
description = "An AI-powered Retrieval-Augmented Generation (RAG) system with a modern web interface."
|
|
9
9
|
authors = [{ name = "Enfold", email = "info@enfoldsystems.net" }]
|
|
10
10
|
readme = "README.md"
|
|
@@ -26,7 +26,7 @@ dependencies = [
|
|
|
26
26
|
"fastapi",
|
|
27
27
|
"fastmcp >= 4.1.2, < 5.0",
|
|
28
28
|
"greenlet",
|
|
29
|
-
"haiku.rag-slim >= 0.
|
|
29
|
+
"haiku.rag-slim >= 0.112.0, < 0.113",
|
|
30
30
|
"idna >= 3.15",
|
|
31
31
|
"itsdangerous",
|
|
32
32
|
"joserfc >= 1.7.5, < 1.8", # CVE-2026-11928{3,4}
|
|
@@ -14,6 +14,13 @@ AGUI_Events = list[agui_core.Event]
|
|
|
14
14
|
AGUI_State = dict[str, typing.Any]
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
NAME_QUERY_DEPRECATION = """\
|
|
18
|
+
'name_query' is deprecated, and will be removed after 'soliplex v0.94'.
|
|
19
|
+
|
|
20
|
+
Use 'text_query' instead.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
|
|
17
24
|
class AGUI_Exception(ValueError):
|
|
18
25
|
status_code = 400
|
|
19
26
|
|
|
@@ -343,6 +350,7 @@ class ThreadStorage(abc.ABC):
|
|
|
343
350
|
after: ThreadPagePosition | None = None,
|
|
344
351
|
label_ids: list[int] = None,
|
|
345
352
|
unlabeled: bool = False,
|
|
353
|
+
text_query: str = None,
|
|
346
354
|
name_query: str = None,
|
|
347
355
|
) -> tuple[
|
|
348
356
|
list[tuple[Thread, datetime.datetime]],
|
|
@@ -369,9 +377,14 @@ class ThreadStorage(abc.ABC):
|
|
|
369
377
|
It joins 'label_ids' as one more alternative: passing both keeps
|
|
370
378
|
threads carrying any of those labels *or* none.
|
|
371
379
|
|
|
372
|
-
'
|
|
373
|
-
it, case-insensitively
|
|
374
|
-
|
|
380
|
+
'text_query', when given, keeps only threads whose name contains
|
|
381
|
+
it, case-insensitively, *or* (where the storage supports
|
|
382
|
+
full-text search) whose user prompts and agent responses match
|
|
383
|
+
it as a full-text query. The text and label filters combine:
|
|
384
|
+
passing both keeps threads that match the text *and* carry one
|
|
385
|
+
of the labels.
|
|
386
|
+
|
|
387
|
+
'name_query' is a deprecated alias for 'text_query'.
|
|
375
388
|
|
|
376
389
|
Paging is by position rather than by offset: 'after' is the
|
|
377
390
|
position of the last thread on the previous page, and the second
|
|
@@ -634,6 +647,21 @@ class ThreadStorage(abc.ABC):
|
|
|
634
647
|
) -> None:
|
|
635
648
|
"""Mark a run as finished"""
|
|
636
649
|
|
|
650
|
+
@abc.abstractmethod
|
|
651
|
+
async def index_run_text(
|
|
652
|
+
self,
|
|
653
|
+
*,
|
|
654
|
+
user_name: str,
|
|
655
|
+
room_id: str,
|
|
656
|
+
thread_id: str,
|
|
657
|
+
run_id: str,
|
|
658
|
+
) -> None:
|
|
659
|
+
"""Add a finished run's text to its thread's full-text search
|
|
660
|
+
|
|
661
|
+
The text is the run's new user prompts and its agent responses.
|
|
662
|
+
A no-op where the storage does not support full-text search.
|
|
663
|
+
"""
|
|
664
|
+
|
|
637
665
|
@abc.abstractmethod
|
|
638
666
|
async def list_run_events_after(
|
|
639
667
|
self,
|
|
@@ -4,6 +4,7 @@ import collections.abc
|
|
|
4
4
|
import contextlib
|
|
5
5
|
import datetime
|
|
6
6
|
import typing
|
|
7
|
+
import warnings
|
|
7
8
|
|
|
8
9
|
import logfire
|
|
9
10
|
from ag_ui import core as agui_core
|
|
@@ -15,6 +16,7 @@ from soliplex import agui
|
|
|
15
16
|
from soliplex.agui import persistence as agui_persistence
|
|
16
17
|
from soliplex.agui import schema as agui_schema
|
|
17
18
|
from soliplex.agui import sse_delivery as agui_sse_delivery
|
|
19
|
+
from soliplex.agui import text_search as agui_text_search
|
|
18
20
|
from soliplex.agui import util as agui_util
|
|
19
21
|
|
|
20
22
|
FeedbackReviewStatus = agui.FeedbackReviewStatus
|
|
@@ -188,11 +190,21 @@ class ThreadStorage(agui.ThreadStorage):
|
|
|
188
190
|
after: agui.ThreadPagePosition | None = None,
|
|
189
191
|
label_ids: list[int] = None,
|
|
190
192
|
unlabeled: bool = False,
|
|
193
|
+
text_query: str = None,
|
|
191
194
|
name_query: str = None,
|
|
192
195
|
) -> tuple[
|
|
193
196
|
list[tuple[agui_schema.Thread, datetime.datetime]],
|
|
194
197
|
agui.ThreadPagePosition | None,
|
|
195
198
|
]:
|
|
199
|
+
if name_query is not None:
|
|
200
|
+
warnings.warn(
|
|
201
|
+
agui.NAME_QUERY_DEPRECATION,
|
|
202
|
+
category=DeprecationWarning,
|
|
203
|
+
stacklevel=2,
|
|
204
|
+
)
|
|
205
|
+
if text_query is None:
|
|
206
|
+
text_query = name_query
|
|
207
|
+
|
|
196
208
|
room_ids = list(room_ids)
|
|
197
209
|
|
|
198
210
|
if not room_ids:
|
|
@@ -270,13 +282,13 @@ class ThreadStorage(agui.ThreadStorage):
|
|
|
270
282
|
if label_filters:
|
|
271
283
|
query = query.where(sqla_sql.or_(*label_filters))
|
|
272
284
|
|
|
273
|
-
if
|
|
285
|
+
if text_query:
|
|
274
286
|
# Correlated rather than joined to 'thread_metadata',
|
|
275
287
|
# which is optional: a never-titled thread has no row,
|
|
276
288
|
# and must still appear in an unfiltered listing.
|
|
277
289
|
fold = await _name_fold(session)
|
|
278
|
-
pattern = f"%{_like_escape(
|
|
279
|
-
|
|
290
|
+
pattern = f"%{_like_escape(text_query).lower()}%"
|
|
291
|
+
text_matches = [
|
|
280
292
|
sqla_sql.select(sqla_sql.literal(1))
|
|
281
293
|
.select_from(agui_schema.ThreadMetadata)
|
|
282
294
|
.where(
|
|
@@ -288,7 +300,17 @@ class ThreadStorage(agui.ThreadStorage):
|
|
|
288
300
|
)
|
|
289
301
|
.correlate(agui_schema.Thread)
|
|
290
302
|
.exists()
|
|
291
|
-
|
|
303
|
+
]
|
|
304
|
+
|
|
305
|
+
connection = await session.connection()
|
|
306
|
+
if agui_text_search.supports_text_search(
|
|
307
|
+
connection.dialect.name
|
|
308
|
+
):
|
|
309
|
+
text_matches.append(
|
|
310
|
+
agui_text_search.matches_clause(text_query)
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
query = query.where(sqla_sql.or_(*text_matches))
|
|
292
314
|
|
|
293
315
|
if after is not None:
|
|
294
316
|
# Strictly past the previous page's last thread in the
|
|
@@ -831,6 +853,47 @@ class ThreadStorage(agui.ThreadStorage):
|
|
|
831
853
|
run.finished = agui_util._timestamp()
|
|
832
854
|
session.add(run)
|
|
833
855
|
|
|
856
|
+
async def index_run_text(
|
|
857
|
+
self,
|
|
858
|
+
*,
|
|
859
|
+
user_name: str,
|
|
860
|
+
room_id: str,
|
|
861
|
+
thread_id: str,
|
|
862
|
+
run_id: str,
|
|
863
|
+
) -> None:
|
|
864
|
+
"""Add a finished run's text to its thread's full-text search
|
|
865
|
+
|
|
866
|
+
The text is the run's new user prompts and its agent responses.
|
|
867
|
+
A no-op unless the database is PostgreSQL.
|
|
868
|
+
"""
|
|
869
|
+
async with self.session as session:
|
|
870
|
+
connection = await session.connection()
|
|
871
|
+
if not agui_text_search.supports_text_search(
|
|
872
|
+
connection.dialect.name
|
|
873
|
+
):
|
|
874
|
+
return
|
|
875
|
+
|
|
876
|
+
run = await self._find_thread_run(
|
|
877
|
+
user_name=user_name,
|
|
878
|
+
room_id=room_id,
|
|
879
|
+
thread_id=thread_id,
|
|
880
|
+
run_id=run_id,
|
|
881
|
+
session=session,
|
|
882
|
+
)
|
|
883
|
+
|
|
884
|
+
run_input = await run.awaitable_attrs.run_agent_input
|
|
885
|
+
messages = [] if run_input is None else run_input.messages
|
|
886
|
+
events = await run.list_events()
|
|
887
|
+
|
|
888
|
+
text = agui_text_search.run_search_text(messages, events)
|
|
889
|
+
|
|
890
|
+
if text:
|
|
891
|
+
await session.execute(
|
|
892
|
+
agui_text_search.append_text_statement(
|
|
893
|
+
run.thread_id_, text
|
|
894
|
+
)
|
|
895
|
+
)
|
|
896
|
+
|
|
834
897
|
async def list_run_events_after(
|
|
835
898
|
self,
|
|
836
899
|
*,
|
|
@@ -1360,7 +1423,12 @@ async def finish_run(
|
|
|
1360
1423
|
thread_id: str,
|
|
1361
1424
|
run_id: str,
|
|
1362
1425
|
):
|
|
1363
|
-
"""Mark a run as finished in the database.
|
|
1426
|
+
"""Mark a run as finished in the database.
|
|
1427
|
+
|
|
1428
|
+
Then, in a separate transaction, add the run's text to its thread's
|
|
1429
|
+
full-text search. A failure there is logged, and leaves the run
|
|
1430
|
+
finished.
|
|
1431
|
+
"""
|
|
1364
1432
|
async with sqla_asyncio.AsyncSession(bind=sqla_engine) as session:
|
|
1365
1433
|
the_threads = ThreadStorage(session)
|
|
1366
1434
|
|
|
@@ -1372,6 +1440,21 @@ async def finish_run(
|
|
|
1372
1440
|
run_id=run_id,
|
|
1373
1441
|
)
|
|
1374
1442
|
|
|
1443
|
+
try:
|
|
1444
|
+
async with session.begin():
|
|
1445
|
+
await the_threads.index_run_text(
|
|
1446
|
+
user_name=user_name,
|
|
1447
|
+
room_id=room_id,
|
|
1448
|
+
thread_id=thread_id,
|
|
1449
|
+
run_id=run_id,
|
|
1450
|
+
)
|
|
1451
|
+
except Exception:
|
|
1452
|
+
logfire.exception(
|
|
1453
|
+
"Error indexing run text: {thread_id}/{run_id}",
|
|
1454
|
+
thread_id=thread_id,
|
|
1455
|
+
run_id=run_id,
|
|
1456
|
+
)
|
|
1457
|
+
|
|
1375
1458
|
|
|
1376
1459
|
async def drive_agui_turn(
|
|
1377
1460
|
*,
|
|
@@ -9,6 +9,7 @@ import sqlalchemy
|
|
|
9
9
|
from ag_ui import core as agui_core
|
|
10
10
|
from sqlalchemy import orm as sqla_orm
|
|
11
11
|
from sqlalchemy import schema as sqla_schema
|
|
12
|
+
from sqlalchemy.dialects import postgresql as sqla_postgresql
|
|
12
13
|
from sqlalchemy.ext import asyncio as sqla_asyncio
|
|
13
14
|
from sqlalchemy.sql import sqltypes as sqla_sqltypes
|
|
14
15
|
|
|
@@ -94,6 +95,24 @@ class Thread(Base):
|
|
|
94
95
|
#
|
|
95
96
|
user_name: Mapped[str] = mapped_column(index=True)
|
|
96
97
|
email: Mapped[str | None] = mapped_column(index=True)
|
|
98
|
+
|
|
99
|
+
# Accumulated full-text search vector of the thread's user prompts
|
|
100
|
+
# and agent responses (PostgreSQL only; always NULL on SQLite).
|
|
101
|
+
text_search: Mapped[str | None] = mapped_column(
|
|
102
|
+
sqla_postgresql.TSVECTOR().with_variant(
|
|
103
|
+
sqla_sqltypes.Text(), "sqlite"
|
|
104
|
+
),
|
|
105
|
+
deferred=True,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
__table_args__ = (
|
|
109
|
+
sqlalchemy.Index(
|
|
110
|
+
"ix_thread_text_search",
|
|
111
|
+
"text_search",
|
|
112
|
+
postgresql_using="gin",
|
|
113
|
+
).ddl_if(dialect="postgresql"),
|
|
114
|
+
)
|
|
115
|
+
|
|
97
116
|
runs: Mapped[list[Run]] = relationship(
|
|
98
117
|
back_populates="thread",
|
|
99
118
|
order_by="Run.created",
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Full-text search over the text of AG-UI threads (PostgreSQL only)
|
|
2
|
+
|
|
3
|
+
Each finished run appends its new user prompts and its agent responses
|
|
4
|
+
to its thread's 'text_search' vector; a thread search matches against
|
|
5
|
+
that vector. Reasoning / thinking output, tool calls and tool results
|
|
6
|
+
are never included.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import collections.abc
|
|
12
|
+
|
|
13
|
+
from ag_ui import core as agui_core
|
|
14
|
+
from sqlalchemy import sql as sqla_sql
|
|
15
|
+
|
|
16
|
+
from soliplex.agui import schema as agui_schema
|
|
17
|
+
|
|
18
|
+
TEXT_SEARCH_CONFIG = "english"
|
|
19
|
+
|
|
20
|
+
# Longest text one run contributes to its thread's search vector; the
|
|
21
|
+
# rest of the run's text is dropped.
|
|
22
|
+
MAX_RUN_TEXT_CHARS = 100_000
|
|
23
|
+
|
|
24
|
+
_ASSISTANT_TEXT_EVENT_TYPES = frozenset(
|
|
25
|
+
{
|
|
26
|
+
agui_core.EventType.TEXT_MESSAGE_CONTENT,
|
|
27
|
+
agui_core.EventType.TEXT_MESSAGE_CHUNK,
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def supports_text_search(dialect_name: str) -> bool:
|
|
33
|
+
"""Is full-text search available on the named SQL dialect?"""
|
|
34
|
+
return dialect_name == "postgresql"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def new_user_texts(
|
|
38
|
+
messages: collections.abc.Sequence[agui_core.Message],
|
|
39
|
+
) -> list[str]:
|
|
40
|
+
"""Return the text parts of the last message, if from the user
|
|
41
|
+
|
|
42
|
+
A run's input repeats the thread's whole history: only its last
|
|
43
|
+
message, the user's prompt, is new to the run. Non-text content
|
|
44
|
+
parts (images, documents, etc.) are skipped.
|
|
45
|
+
"""
|
|
46
|
+
if not messages or messages[-1].role != "user":
|
|
47
|
+
return []
|
|
48
|
+
|
|
49
|
+
content = messages[-1].content
|
|
50
|
+
|
|
51
|
+
if isinstance(content, str):
|
|
52
|
+
texts = [content]
|
|
53
|
+
else:
|
|
54
|
+
texts = [part.text for part in content if part.type == "text"]
|
|
55
|
+
|
|
56
|
+
return [text for text in texts if text]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def assistant_texts(
|
|
60
|
+
events: collections.abc.Iterable[agui_core.Event],
|
|
61
|
+
) -> list[str]:
|
|
62
|
+
"""Return the text of each agent message in 'events'
|
|
63
|
+
|
|
64
|
+
'events' must be in the order they were emitted: a message's text
|
|
65
|
+
may be split across many events. A 'TEXT_MESSAGE_CHUNK' with no
|
|
66
|
+
'message_id' continues the previous message. Messages with no text
|
|
67
|
+
are omitted.
|
|
68
|
+
"""
|
|
69
|
+
by_message_id: dict[str | None, list[str]] = {}
|
|
70
|
+
message_id = None
|
|
71
|
+
|
|
72
|
+
for event in events:
|
|
73
|
+
if event.type in _ASSISTANT_TEXT_EVENT_TYPES:
|
|
74
|
+
if event.message_id is not None:
|
|
75
|
+
message_id = event.message_id
|
|
76
|
+
|
|
77
|
+
if event.delta:
|
|
78
|
+
by_message_id.setdefault(message_id, []).append(event.delta)
|
|
79
|
+
|
|
80
|
+
return ["".join(deltas) for deltas in by_message_id.values()]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def run_search_text(
|
|
84
|
+
messages: collections.abc.Sequence[agui_core.Message],
|
|
85
|
+
events: collections.abc.Iterable[agui_core.Event],
|
|
86
|
+
max_chars: int = MAX_RUN_TEXT_CHARS,
|
|
87
|
+
) -> str:
|
|
88
|
+
"""Return the searchable text a run adds to its thread
|
|
89
|
+
|
|
90
|
+
The run's new user prompts, then its agent responses, separated by
|
|
91
|
+
blank lines and truncated to 'max_chars'.
|
|
92
|
+
"""
|
|
93
|
+
texts = new_user_texts(messages) + assistant_texts(events)
|
|
94
|
+
return "\n\n".join(texts)[:max_chars]
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def append_text_statement(thread_pk: int, text: str):
|
|
98
|
+
"""Return an 'UPDATE' appending 'text' to a thread's search vector"""
|
|
99
|
+
column = agui_schema.Thread.text_search
|
|
100
|
+
empty = sqla_sql.cast(sqla_sql.literal(""), column.type)
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
sqla_sql.update(agui_schema.Thread)
|
|
104
|
+
.where(agui_schema.Thread.id_ == thread_pk)
|
|
105
|
+
.values(
|
|
106
|
+
text_search=sqla_sql.func.coalesce(column, empty).op("||")(
|
|
107
|
+
sqla_sql.func.to_tsvector(TEXT_SEARCH_CONFIG, text)
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
.execution_options(synchronize_session=False)
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def matches_clause(text_query: str):
|
|
115
|
+
"""Return a clause matching threads whose text matches 'text_query'
|
|
116
|
+
|
|
117
|
+
'text_query' is in 'websearch_to_tsquery' syntax: bare words (all
|
|
118
|
+
required), '"quoted phrases"', 'OR', and '-excluded' words. It
|
|
119
|
+
never raises a syntax error.
|
|
120
|
+
"""
|
|
121
|
+
return agui_schema.Thread.text_search.op("@@")(
|
|
122
|
+
sqla_sql.func.websearch_to_tsquery(TEXT_SEARCH_CONFIG, text_query)
|
|
123
|
+
)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""soliplex-v0.93
|
|
2
|
+
|
|
3
|
+
AGUI: add 'Thread.text_search', a full-text search vector, with a GIN
|
|
4
|
+
index on PostgreSQL only
|
|
5
|
+
|
|
6
|
+
Revision ID: e5d2f5ef98a3
|
|
7
|
+
Revises: 98cd91f27cb5
|
|
8
|
+
Create Date: 2026-11-13 13:11:30.391459
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import typing
|
|
13
|
+
|
|
14
|
+
import sqlalchemy as sa
|
|
15
|
+
from alembic import op
|
|
16
|
+
from sqlalchemy.dialects import postgresql
|
|
17
|
+
|
|
18
|
+
# revision identifiers, used by Alembic.
|
|
19
|
+
revision: str = "e5d2f5ef98a3"
|
|
20
|
+
down_revision: str | typing.Sequence[str] | None = "98cd91f27cb5"
|
|
21
|
+
branch_labels: str | typing.Sequence[str] | None = None
|
|
22
|
+
depends_on: str | typing.Sequence[str] | None = None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def upgrade(engine_name: str) -> None:
|
|
26
|
+
"""Upgrade schema."""
|
|
27
|
+
globals()[f"upgrade_{engine_name}"]()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def downgrade(engine_name: str) -> None:
|
|
31
|
+
"""Downgrade schema."""
|
|
32
|
+
globals()[f"downgrade_{engine_name}"]()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def upgrade_agui() -> None:
|
|
36
|
+
"""Upgrade agui schema."""
|
|
37
|
+
op.add_column(
|
|
38
|
+
"thread",
|
|
39
|
+
sa.Column(
|
|
40
|
+
"text_search",
|
|
41
|
+
postgresql.TSVECTOR().with_variant(sa.Text(), "sqlite"),
|
|
42
|
+
nullable=True,
|
|
43
|
+
),
|
|
44
|
+
)
|
|
45
|
+
# Autogenerate drops the model's 'ddl_if': without this branch,
|
|
46
|
+
# SQLite would get a plain index the models do not declare.
|
|
47
|
+
if op.get_context().dialect.name == "postgresql":
|
|
48
|
+
op.create_index(
|
|
49
|
+
"ix_thread_text_search",
|
|
50
|
+
"thread",
|
|
51
|
+
["text_search"],
|
|
52
|
+
unique=False,
|
|
53
|
+
postgresql_using="gin",
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def downgrade_agui() -> None:
|
|
58
|
+
"""Downgrade agui schema."""
|
|
59
|
+
if op.get_context().dialect.name == "postgresql":
|
|
60
|
+
op.drop_index(
|
|
61
|
+
"ix_thread_text_search",
|
|
62
|
+
table_name="thread",
|
|
63
|
+
postgresql_using="gin",
|
|
64
|
+
)
|
|
65
|
+
op.drop_column("thread", "text_search")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def upgrade_authz() -> None:
|
|
69
|
+
"""Upgrade authz schema."""
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def downgrade_authz() -> None:
|
|
74
|
+
"""Downgrade authz schema."""
|
|
75
|
+
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: soliplex
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.93
|
|
4
4
|
Summary: An AI-powered Retrieval-Augmented Generation (RAG) system with a modern web interface.
|
|
5
5
|
Author-email: Enfold <info@enfoldsystems.net>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -20,7 +20,7 @@ Requires-Dist: fakeredis!=2.35.0
|
|
|
20
20
|
Requires-Dist: fastapi
|
|
21
21
|
Requires-Dist: fastmcp<5.0,>=4.1.2
|
|
22
22
|
Requires-Dist: greenlet
|
|
23
|
-
Requires-Dist: haiku.rag-slim<0.
|
|
23
|
+
Requires-Dist: haiku.rag-slim<0.113,>=0.112.0
|
|
24
24
|
Requires-Dist: idna>=3.15
|
|
25
25
|
Requires-Dist: itsdangerous
|
|
26
26
|
Requires-Dist: joserfc<1.8,>=1.7.5
|
|
@@ -37,6 +37,7 @@ src/soliplex/agui/parser.py
|
|
|
37
37
|
src/soliplex/agui/persistence.py
|
|
38
38
|
src/soliplex/agui/schema.py
|
|
39
39
|
src/soliplex/agui/sse_delivery.py
|
|
40
|
+
src/soliplex/agui/text_search.py
|
|
40
41
|
src/soliplex/agui/util.py
|
|
41
42
|
src/soliplex/alembic_migrations/__init__.py
|
|
42
43
|
src/soliplex/alembic_migrations/env.py
|
|
@@ -47,6 +48,7 @@ src/soliplex/alembic_migrations/versions/98cd91f27cb5_soliplex_v0_92.py
|
|
|
47
48
|
src/soliplex/alembic_migrations/versions/a1c7d3e90b42_soliplex_v0_80.py
|
|
48
49
|
src/soliplex/alembic_migrations/versions/b7e2f41c9d05_soliplex_v0_82.py
|
|
49
50
|
src/soliplex/alembic_migrations/versions/d5009d4f9874_soliplex_v0_44.py
|
|
51
|
+
src/soliplex/alembic_migrations/versions/e5d2f5ef98a3_soliplex_v0_93.py
|
|
50
52
|
src/soliplex/alembic_migrations/versions/f13fea6c1953_soliplex_v0_86.py
|
|
51
53
|
src/soliplex/authz/__init__.py
|
|
52
54
|
src/soliplex/authz/persistence.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|