3tears-agent-knowledge 0.14.0__py3-none-any.whl
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.
- 3tears_agent_knowledge-0.14.0.dist-info/METADATA +36 -0
- 3tears_agent_knowledge-0.14.0.dist-info/RECORD +10 -0
- 3tears_agent_knowledge-0.14.0.dist-info/WHEEL +4 -0
- 3tears_agent_knowledge-0.14.0.dist-info/licenses/LICENSE +21 -0
- threetears/agent/knowledge/__init__.py +105 -0
- threetears/agent/knowledge/collections.py +676 -0
- threetears/agent/knowledge/entities.py +46 -0
- threetears/agent/knowledge/integration.py +426 -0
- threetears/agent/knowledge/middleware.py +1096 -0
- threetears/agent/knowledge/py.typed +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 3tears-agent-knowledge
|
|
3
|
+
Version: 0.14.0
|
|
4
|
+
Summary: Governed-knowledge retrieval + injection for LLM agents -- concepts, playbook entries, three-scope shadow merge, and before_model middleware
|
|
5
|
+
Project-URL: Repository, https://github.com/pacepace/3tears
|
|
6
|
+
Author: pace
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Framework :: AsyncIO
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.14
|
|
18
|
+
Requires-Dist: 3tears
|
|
19
|
+
Requires-Dist: 3tears-agent-acl
|
|
20
|
+
Requires-Dist: 3tears-agent-memory
|
|
21
|
+
Requires-Dist: 3tears-langgraph
|
|
22
|
+
Requires-Dist: 3tears-nats
|
|
23
|
+
Requires-Dist: 3tears-observe
|
|
24
|
+
Requires-Dist: langchain-core
|
|
25
|
+
Requires-Dist: pgvector
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# 3tears-agent-knowledge
|
|
29
|
+
|
|
30
|
+
Agent-side governed-knowledge read stack for LangGraph agents.
|
|
31
|
+
|
|
32
|
+
Homes the playbook-entry / concept collections (over the platform RBAC proxy), the
|
|
33
|
+
`KnowledgeIntegration` wiring, and the `create_agent` `before_model` injection
|
|
34
|
+
middleware, on top of the shared three-scope shadow-merge authority in
|
|
35
|
+
`threetears.knowledge` (core). It lives in its own package because the collections
|
|
36
|
+
depend on `threetears.agent.acl`, which core cannot depend on.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
threetears/agent/knowledge/__init__.py,sha256=qCGAqPghh1H0egAUheUfCBGKAhocyF2eZjewMbKneZ4,4688
|
|
2
|
+
threetears/agent/knowledge/collections.py,sha256=FqK-xmEvzMnM9_m3c-ptx9Rh8uyeI5_UmbjYri5Fea0,30257
|
|
3
|
+
threetears/agent/knowledge/entities.py,sha256=jnVMGjvoX5LbZevqTchfHlF4fQqbCQ5GLGCwJVqrmaU,1992
|
|
4
|
+
threetears/agent/knowledge/integration.py,sha256=HGpsa0MJZJGsYJidizewHD_DkqOlWM_3SsUhmo4tP6c,19156
|
|
5
|
+
threetears/agent/knowledge/middleware.py,sha256=41-888Xo1-7IjXu4ozW2gXUOVeu4YBGrCtLV0p5_PtY,50546
|
|
6
|
+
threetears/agent/knowledge/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
3tears_agent_knowledge-0.14.0.dist-info/METADATA,sha256=JjaTU9oV9V7LIDZUeh1bIOJhim5gVBFH6WQZC6D6EDw,1476
|
|
8
|
+
3tears_agent_knowledge-0.14.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
9
|
+
3tears_agent_knowledge-0.14.0.dist-info/licenses/LICENSE,sha256=7GWEoEOcFJenZLt4LDzqH2K7QLxo_2m8rzG7Vv8VGXo,1066
|
|
10
|
+
3tears_agent_knowledge-0.14.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Pace
|
|
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,105 @@
|
|
|
1
|
+
"""3tears-agent-knowledge: governed-knowledge retrieval + injection for LangGraph agents.
|
|
2
|
+
|
|
3
|
+
Homes the agent-side knowledge read stack -- the playbook-entry / concept
|
|
4
|
+
collections over the platform RBAC proxy, the ``KnowledgeIntegration`` wiring, and
|
|
5
|
+
the ``create_agent`` ``wrap_model_call`` injection middleware -- on top of the shared
|
|
6
|
+
three-scope merge authority in :mod:`threetears.knowledge` (core). This package
|
|
7
|
+
exists because the collections need :mod:`threetears.agent.acl`, which core (where
|
|
8
|
+
``threetears.knowledge`` lives) cannot depend on.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
# Version derived from pyproject.toml so the metadata is the single source of
|
|
14
|
+
# truth -- a future release that bumps pyproject without updating ``__init__.py``
|
|
15
|
+
# can't drift the runtime ``__version__``. The except guard handles the rare case
|
|
16
|
+
# where the package isn't installed via importlib.metadata (e.g. running directly
|
|
17
|
+
# from a checked-out source tree without ``uv sync``); the fallback keeps imports
|
|
18
|
+
# working but reports ``unknown`` rather than crashing.
|
|
19
|
+
from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
|
|
20
|
+
from importlib.metadata import version as _version
|
|
21
|
+
from typing import TYPE_CHECKING
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
__version__ = _version("3tears-agent-knowledge")
|
|
25
|
+
except _PackageNotFoundError: # pragma: no cover - dev fallback
|
|
26
|
+
__version__ = "unknown"
|
|
27
|
+
|
|
28
|
+
# lazy public API (PEP 562). the package namespace no longer imports its
|
|
29
|
+
# implementation modules eagerly: importing this package (or any of its
|
|
30
|
+
# submodules) costs only this file, and each public attribute resolves its
|
|
31
|
+
# defining module on first access. the TYPE_CHECKING block carries the real
|
|
32
|
+
# imports so mypy and IDEs see the full statically-typed API; the _LAZY map is the
|
|
33
|
+
# runtime equivalent. the three-way agreement between __all__, _LAZY, and the
|
|
34
|
+
# TYPE_CHECKING block is pinned by the package's lazy-surface consistency test.
|
|
35
|
+
if TYPE_CHECKING:
|
|
36
|
+
from threetears.agent.knowledge.collections import (
|
|
37
|
+
ConceptCollection,
|
|
38
|
+
PlaybookEntryCollection,
|
|
39
|
+
)
|
|
40
|
+
from threetears.agent.knowledge.entities import ConceptEntity, PlaybookEntryEntity
|
|
41
|
+
from threetears.agent.knowledge.integration import (
|
|
42
|
+
DraftView,
|
|
43
|
+
KnowledgeIntegration,
|
|
44
|
+
retrieve_concepts,
|
|
45
|
+
retrieve_entries,
|
|
46
|
+
scope_context_admitted_scopes,
|
|
47
|
+
)
|
|
48
|
+
from threetears.agent.knowledge.middleware import KnowledgeInjectionMiddleware
|
|
49
|
+
|
|
50
|
+
# public attribute -> (defining module, attribute name in that module)
|
|
51
|
+
_LAZY: dict[str, tuple[str, str]] = {
|
|
52
|
+
"ConceptCollection": ("threetears.agent.knowledge.collections", "ConceptCollection"),
|
|
53
|
+
"ConceptEntity": ("threetears.agent.knowledge.entities", "ConceptEntity"),
|
|
54
|
+
"DraftView": ("threetears.agent.knowledge.integration", "DraftView"),
|
|
55
|
+
"KnowledgeInjectionMiddleware": ("threetears.agent.knowledge.middleware", "KnowledgeInjectionMiddleware"),
|
|
56
|
+
"KnowledgeIntegration": ("threetears.agent.knowledge.integration", "KnowledgeIntegration"),
|
|
57
|
+
"PlaybookEntryCollection": ("threetears.agent.knowledge.collections", "PlaybookEntryCollection"),
|
|
58
|
+
"PlaybookEntryEntity": ("threetears.agent.knowledge.entities", "PlaybookEntryEntity"),
|
|
59
|
+
"retrieve_concepts": ("threetears.agent.knowledge.integration", "retrieve_concepts"),
|
|
60
|
+
"retrieve_entries": ("threetears.agent.knowledge.integration", "retrieve_entries"),
|
|
61
|
+
"scope_context_admitted_scopes": ("threetears.agent.knowledge.integration", "scope_context_admitted_scopes"),
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
__all__ = [
|
|
65
|
+
"ConceptCollection",
|
|
66
|
+
"ConceptEntity",
|
|
67
|
+
"DraftView",
|
|
68
|
+
"KnowledgeInjectionMiddleware",
|
|
69
|
+
"KnowledgeIntegration",
|
|
70
|
+
"PlaybookEntryCollection",
|
|
71
|
+
"PlaybookEntryEntity",
|
|
72
|
+
"retrieve_concepts",
|
|
73
|
+
"retrieve_entries",
|
|
74
|
+
"scope_context_admitted_scopes",
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def __getattr__(name: str) -> object:
|
|
79
|
+
"""resolve a public attribute from its defining module on first access.
|
|
80
|
+
|
|
81
|
+
:param name: attribute name being resolved
|
|
82
|
+
:ptype name: str
|
|
83
|
+
:return: the resolved attribute (also cached in module globals so
|
|
84
|
+
``__getattr__`` fires at most once per name)
|
|
85
|
+
:rtype: object
|
|
86
|
+
:raises AttributeError: when ``name`` is not part of the public API
|
|
87
|
+
"""
|
|
88
|
+
entry = _LAZY.get(name)
|
|
89
|
+
if entry is None:
|
|
90
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
91
|
+
from importlib import import_module
|
|
92
|
+
|
|
93
|
+
module_name, attr = entry
|
|
94
|
+
value: object = getattr(import_module(module_name), attr)
|
|
95
|
+
globals()[name] = value
|
|
96
|
+
return value
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def __dir__() -> list[str]:
|
|
100
|
+
"""include lazy attributes in ``dir()`` output.
|
|
101
|
+
|
|
102
|
+
:return: sorted union of materialized globals and lazy names
|
|
103
|
+
:rtype: list[str]
|
|
104
|
+
"""
|
|
105
|
+
return sorted(set(globals()) | set(_LAZY))
|