3tears-agent-intention 0.15.0__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.
- 3tears_agent_intention-0.15.0/.gitignore +216 -0
- 3tears_agent_intention-0.15.0/CHANGELOG.md +23 -0
- 3tears_agent_intention-0.15.0/LICENSE +21 -0
- 3tears_agent_intention-0.15.0/PKG-INFO +76 -0
- 3tears_agent_intention-0.15.0/README.md +49 -0
- 3tears_agent_intention-0.15.0/pyproject.toml +51 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/__init__.py +146 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/authorize.py +203 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/collections.py +475 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/entities.py +237 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/events.py +128 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/migrations/__init__.py +68 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/migrations/v001_create_intentions_table.py +120 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/py.typed +0 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/tools.py +557 -0
- 3tears_agent_intention-0.15.0/src/threetears/agent/intention/types.py +43 -0
- 3tears_agent_intention-0.15.0/tests/integration/__init__.py +0 -0
- 3tears_agent_intention-0.15.0/tests/integration/conftest.py +321 -0
- 3tears_agent_intention-0.15.0/tests/integration/test_intention_tools.py +600 -0
- 3tears_agent_intention-0.15.0/tests/integration/test_intentions_collection.py +246 -0
- 3tears_agent_intention-0.15.0/tests/test_lazy_init.py +81 -0
- 3tears_agent_intention-0.15.0/tests/test_smoke.py +4 -0
- 3tears_agent_intention-0.15.0/tests/unit/test_authorize.py +127 -0
- 3tears_agent_intention-0.15.0/tests/unit/test_events.py +70 -0
- 3tears_agent_intention-0.15.0/tests/unit/test_intention_entities.py +105 -0
- 3tears_agent_intention-0.15.0/tests/unit/test_to_sqlalchemy_table_parity.py +106 -0
- 3tears_agent_intention-0.15.0/tests/unit/test_tools_input.py +134 -0
|
@@ -0,0 +1,216 @@
|
|
|
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
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
208
|
+
|
|
209
|
+
# Claude Code local state
|
|
210
|
+
.claude/
|
|
211
|
+
|
|
212
|
+
# prawduct session evidence (local governance artifacts, never shipped)
|
|
213
|
+
.prawduct/
|
|
214
|
+
|
|
215
|
+
# macOS folder metadata
|
|
216
|
+
.DS_Store
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `3tears-agent-intention` are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and the package version moves in **lockstep** with the rest of the
|
|
7
|
+
3tears monorepo (every package tracks the framework git tag; see
|
|
8
|
+
`README.md` "Versioning policy").
|
|
9
|
+
|
|
10
|
+
## [0.15.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Initial release of the standing-wants corpus (Presence/aliveness program).
|
|
15
|
+
- `intentions` table (migration `v001`): partition on `agent_id`, composite PK
|
|
16
|
+
`(agent_id, intention_id)`, CAS on `date_updated`; a fresh PG enum
|
|
17
|
+
`intention_status` (`open` / `asked` / `granted` / `dropped`); pgvector `embedding`
|
|
18
|
+
for log-time dedup; the `salience` / `last_decayed_at` decay substrate reused from
|
|
19
|
+
`agent/memory`; a `last_surfaced_at` cooldown anchor; soft-ref `source_memory_id` /
|
|
20
|
+
`source_conversation_id` provenance columns.
|
|
21
|
+
- `IntentionsCollection` (three-tier CRUD, CAS fence, `user_id`-required user-facing
|
|
22
|
+
reads), `IntentionEntity`, `intentions_table` factory, and the `IntentionStatus`
|
|
23
|
+
value set.
|
|
@@ -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,76 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: 3tears-agent-intention
|
|
3
|
+
Version: 0.15.0
|
|
4
|
+
Summary: Standing-wants corpus for LLM agents -- intention lifecycle, salience decay, embedding dedup, and private deliberation tools
|
|
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-langgraph
|
|
21
|
+
Requires-Dist: 3tears-observe
|
|
22
|
+
Requires-Dist: langchain-core
|
|
23
|
+
Requires-Dist: pgvector
|
|
24
|
+
Requires-Dist: pydantic
|
|
25
|
+
Requires-Dist: uuid-utils
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# 3tears Agent Intention
|
|
29
|
+
|
|
30
|
+
Standing-wants corpus for LLM agents. An intention is agent-authored deliberation
|
|
31
|
+
output -- a want the agent is holding onto ("ask Pace about the migration", "check
|
|
32
|
+
whether the wake threads are firing") -- with its own status lifecycle, salience
|
|
33
|
+
decay, and restraint brakes so the agent surfaces a want at most occasionally
|
|
34
|
+
rather than every turn.
|
|
35
|
+
|
|
36
|
+
Part of the [3tears](https://github.com/pacepace/3tears) framework.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install 3tears-agent-intention
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Why a separate package (not a memory of `kind=intention`)
|
|
45
|
+
|
|
46
|
+
Memory is a hard-delete-only user-fact taxonomy with immutable scope columns and no
|
|
47
|
+
lifecycle. An intention is all lifecycle: `open -> asked -> granted / dropped`, a
|
|
48
|
+
partial index for "find the open wants", and a validated status value set. Riding the
|
|
49
|
+
shared `memory_type` PG enum would pollute a user-fact taxonomy with an agent-internal
|
|
50
|
+
control construct and force an irreversible enum add on six consumers.
|
|
51
|
+
|
|
52
|
+
Enhance-first is still honoured: intention **consumes** the reusable salience/decay
|
|
53
|
+
substrate the `agent/memory` enhancement built (the same `salience` column shape and
|
|
54
|
+
the shared `apply_salience_decay` helper), rather than reinventing it.
|
|
55
|
+
|
|
56
|
+
## Components
|
|
57
|
+
|
|
58
|
+
### `intentions` table
|
|
59
|
+
|
|
60
|
+
Partition on `agent_id`; composite PK `(agent_id, intention_id)`; CAS on `date_updated`
|
|
61
|
+
(mirrors memory). Columns: `status` (PG enum `intention_status`), `content`,
|
|
62
|
+
`embedding` (pgvector 1024, for dedup on log), `salience` (NUMERIC(5,4), reuses the
|
|
63
|
+
decay substrate), `last_decayed_at` (decay anchor), `last_surfaced_at` (cooldown
|
|
64
|
+
anchor), `source_memory_id` / `source_conversation_id` (soft-ref provenance, no FK).
|
|
65
|
+
|
|
66
|
+
### User isolation is a `user_id` WHERE clause, not RBAC
|
|
67
|
+
|
|
68
|
+
Every metallm user shares one `agent_id`, so the partition isolates nothing and the
|
|
69
|
+
agent-owner RBAC short-circuit sees every want. `user_id` is the only boundary: the
|
|
70
|
+
collection's user-facing reads take `user_id` as a **required** parameter, and every
|
|
71
|
+
consumer read filters on it.
|
|
72
|
+
|
|
73
|
+
## Versioning policy
|
|
74
|
+
|
|
75
|
+
The package version moves in **lockstep** with the rest of the 3tears monorepo -- every
|
|
76
|
+
package tracks the framework git tag.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# 3tears Agent Intention
|
|
2
|
+
|
|
3
|
+
Standing-wants corpus for LLM agents. An intention is agent-authored deliberation
|
|
4
|
+
output -- a want the agent is holding onto ("ask Pace about the migration", "check
|
|
5
|
+
whether the wake threads are firing") -- with its own status lifecycle, salience
|
|
6
|
+
decay, and restraint brakes so the agent surfaces a want at most occasionally
|
|
7
|
+
rather than every turn.
|
|
8
|
+
|
|
9
|
+
Part of the [3tears](https://github.com/pacepace/3tears) framework.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install 3tears-agent-intention
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Why a separate package (not a memory of `kind=intention`)
|
|
18
|
+
|
|
19
|
+
Memory is a hard-delete-only user-fact taxonomy with immutable scope columns and no
|
|
20
|
+
lifecycle. An intention is all lifecycle: `open -> asked -> granted / dropped`, a
|
|
21
|
+
partial index for "find the open wants", and a validated status value set. Riding the
|
|
22
|
+
shared `memory_type` PG enum would pollute a user-fact taxonomy with an agent-internal
|
|
23
|
+
control construct and force an irreversible enum add on six consumers.
|
|
24
|
+
|
|
25
|
+
Enhance-first is still honoured: intention **consumes** the reusable salience/decay
|
|
26
|
+
substrate the `agent/memory` enhancement built (the same `salience` column shape and
|
|
27
|
+
the shared `apply_salience_decay` helper), rather than reinventing it.
|
|
28
|
+
|
|
29
|
+
## Components
|
|
30
|
+
|
|
31
|
+
### `intentions` table
|
|
32
|
+
|
|
33
|
+
Partition on `agent_id`; composite PK `(agent_id, intention_id)`; CAS on `date_updated`
|
|
34
|
+
(mirrors memory). Columns: `status` (PG enum `intention_status`), `content`,
|
|
35
|
+
`embedding` (pgvector 1024, for dedup on log), `salience` (NUMERIC(5,4), reuses the
|
|
36
|
+
decay substrate), `last_decayed_at` (decay anchor), `last_surfaced_at` (cooldown
|
|
37
|
+
anchor), `source_memory_id` / `source_conversation_id` (soft-ref provenance, no FK).
|
|
38
|
+
|
|
39
|
+
### User isolation is a `user_id` WHERE clause, not RBAC
|
|
40
|
+
|
|
41
|
+
Every metallm user shares one `agent_id`, so the partition isolates nothing and the
|
|
42
|
+
agent-owner RBAC short-circuit sees every want. `user_id` is the only boundary: the
|
|
43
|
+
collection's user-facing reads take `user_id` as a **required** parameter, and every
|
|
44
|
+
consumer read filters on it.
|
|
45
|
+
|
|
46
|
+
## Versioning policy
|
|
47
|
+
|
|
48
|
+
The package version moves in **lockstep** with the rest of the 3tears monorepo -- every
|
|
49
|
+
package tracks the framework git tag.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "3tears-agent-intention"
|
|
7
|
+
version = "0.15.0"
|
|
8
|
+
description = "Standing-wants corpus for LLM agents -- intention lifecycle, salience decay, embedding dedup, and private deliberation tools"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.14"
|
|
11
|
+
authors = [{name = "pace"}]
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Framework :: AsyncIO",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
# In-repo (3tears*) deps are declared only when a module imports them:
|
|
25
|
+
# the dependency-alignment enforcement gate flags a declared 3tears*
|
|
26
|
+
# dep that nothing imports. B1 (schema + collection) imported core +
|
|
27
|
+
# observe only; B2 adds the tool surface that imports 3tears-agent-acl
|
|
28
|
+
# (owner RBAC in authorize.py) and 3tears-langgraph (FrameworkEvents in
|
|
29
|
+
# events.py), so both are declared here alongside the code that uses them.
|
|
30
|
+
dependencies = [
|
|
31
|
+
"3tears",
|
|
32
|
+
"3tears-agent-acl",
|
|
33
|
+
"3tears-langgraph",
|
|
34
|
+
"3tears-observe",
|
|
35
|
+
"pgvector",
|
|
36
|
+
"langchain-core",
|
|
37
|
+
"pydantic",
|
|
38
|
+
"uuid-utils",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Repository = "https://github.com/pacepace/3tears"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.build.targets.wheel]
|
|
45
|
+
packages = ["src/threetears"]
|
|
46
|
+
|
|
47
|
+
[tool.uv.sources]
|
|
48
|
+
3tears = { workspace = true }
|
|
49
|
+
3tears-agent-acl = { workspace = true }
|
|
50
|
+
3tears-langgraph = { workspace = true }
|
|
51
|
+
3tears-observe = { workspace = true }
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"""Agent intention package -- standing-want entities, collection, and status enum."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# Version derived from pyproject.toml so the metadata is the single
|
|
6
|
+
# source of truth -- a future release that bumps pyproject without
|
|
7
|
+
# updating ``__init__.py`` can't drift the runtime ``__version__``.
|
|
8
|
+
# The except guard handles the rare case where the package isn't
|
|
9
|
+
# installed via importlib.metadata (e.g. running directly from a
|
|
10
|
+
# checked-out source tree without ``uv sync``); the fallback keeps
|
|
11
|
+
# imports working but reports ``unknown`` rather than crashing.
|
|
12
|
+
from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
|
|
13
|
+
from importlib.metadata import version as _version
|
|
14
|
+
from typing import TYPE_CHECKING
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
__version__ = _version("3tears-agent-intention")
|
|
18
|
+
except _PackageNotFoundError: # pragma: no cover - dev fallback
|
|
19
|
+
__version__ = "unknown"
|
|
20
|
+
|
|
21
|
+
# lazy public API (PEP 562). the package namespace no longer imports its
|
|
22
|
+
# implementation modules eagerly: importing this package (or any of its
|
|
23
|
+
# submodules) costs only this file, and each public attribute resolves
|
|
24
|
+
# its defining module on first access. the TYPE_CHECKING block carries
|
|
25
|
+
# the real imports so mypy and IDEs see the full statically-typed API;
|
|
26
|
+
# the _LAZY map is the runtime equivalent. the three-way agreement
|
|
27
|
+
# between __all__, _LAZY, and the TYPE_CHECKING block is pinned by the
|
|
28
|
+
# package's lazy-surface consistency test. mirrors agent/memory's
|
|
29
|
+
# hand-rolled PEP 562 (zero added runtime deps, no stub drift).
|
|
30
|
+
if TYPE_CHECKING:
|
|
31
|
+
from threetears.agent.intention.authorize import (
|
|
32
|
+
ACTION_INTENTION_READ,
|
|
33
|
+
ACTION_INTENTION_WRITE,
|
|
34
|
+
INTENTION_NAMESPACE_TYPE,
|
|
35
|
+
IntentionAccessDenied,
|
|
36
|
+
IntentionAuthorizerDependencies,
|
|
37
|
+
authorize_intention_access,
|
|
38
|
+
intention_namespace_name,
|
|
39
|
+
)
|
|
40
|
+
from threetears.agent.intention.collections import (
|
|
41
|
+
IntentionsCollection,
|
|
42
|
+
intentions_table,
|
|
43
|
+
)
|
|
44
|
+
from threetears.agent.intention.entities import IntentionEntity
|
|
45
|
+
from threetears.agent.intention.events import (
|
|
46
|
+
IntentionResolvedEvent,
|
|
47
|
+
IntentionSurfacedEvent,
|
|
48
|
+
)
|
|
49
|
+
from threetears.agent.intention.tools import (
|
|
50
|
+
IntentionListInput,
|
|
51
|
+
IntentionLogInput,
|
|
52
|
+
IntentionMarkSurfacedInput,
|
|
53
|
+
load_intention_list_tool,
|
|
54
|
+
load_intention_log_tool,
|
|
55
|
+
load_intention_mark_surfaced_tool,
|
|
56
|
+
)
|
|
57
|
+
from threetears.agent.intention.types import (
|
|
58
|
+
INTENTION_STATUS_VALUES,
|
|
59
|
+
IntentionStatus,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# public attribute -> (defining module, attribute name in that module)
|
|
63
|
+
_LAZY: dict[str, tuple[str, str]] = {
|
|
64
|
+
"ACTION_INTENTION_READ": ("threetears.agent.intention.authorize", "ACTION_INTENTION_READ"),
|
|
65
|
+
"ACTION_INTENTION_WRITE": ("threetears.agent.intention.authorize", "ACTION_INTENTION_WRITE"),
|
|
66
|
+
"INTENTION_NAMESPACE_TYPE": ("threetears.agent.intention.authorize", "INTENTION_NAMESPACE_TYPE"),
|
|
67
|
+
"INTENTION_STATUS_VALUES": ("threetears.agent.intention.types", "INTENTION_STATUS_VALUES"),
|
|
68
|
+
"IntentionAccessDenied": ("threetears.agent.intention.authorize", "IntentionAccessDenied"),
|
|
69
|
+
"IntentionAuthorizerDependencies": (
|
|
70
|
+
"threetears.agent.intention.authorize",
|
|
71
|
+
"IntentionAuthorizerDependencies",
|
|
72
|
+
),
|
|
73
|
+
"IntentionEntity": ("threetears.agent.intention.entities", "IntentionEntity"),
|
|
74
|
+
"IntentionListInput": ("threetears.agent.intention.tools", "IntentionListInput"),
|
|
75
|
+
"IntentionLogInput": ("threetears.agent.intention.tools", "IntentionLogInput"),
|
|
76
|
+
"IntentionMarkSurfacedInput": ("threetears.agent.intention.tools", "IntentionMarkSurfacedInput"),
|
|
77
|
+
"IntentionResolvedEvent": ("threetears.agent.intention.events", "IntentionResolvedEvent"),
|
|
78
|
+
"IntentionStatus": ("threetears.agent.intention.types", "IntentionStatus"),
|
|
79
|
+
"IntentionSurfacedEvent": ("threetears.agent.intention.events", "IntentionSurfacedEvent"),
|
|
80
|
+
"IntentionsCollection": ("threetears.agent.intention.collections", "IntentionsCollection"),
|
|
81
|
+
"authorize_intention_access": (
|
|
82
|
+
"threetears.agent.intention.authorize",
|
|
83
|
+
"authorize_intention_access",
|
|
84
|
+
),
|
|
85
|
+
"intention_namespace_name": ("threetears.agent.intention.authorize", "intention_namespace_name"),
|
|
86
|
+
"intentions_table": ("threetears.agent.intention.collections", "intentions_table"),
|
|
87
|
+
"load_intention_list_tool": ("threetears.agent.intention.tools", "load_intention_list_tool"),
|
|
88
|
+
"load_intention_log_tool": ("threetears.agent.intention.tools", "load_intention_log_tool"),
|
|
89
|
+
"load_intention_mark_surfaced_tool": (
|
|
90
|
+
"threetears.agent.intention.tools",
|
|
91
|
+
"load_intention_mark_surfaced_tool",
|
|
92
|
+
),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
__all__ = [
|
|
96
|
+
"ACTION_INTENTION_READ",
|
|
97
|
+
"ACTION_INTENTION_WRITE",
|
|
98
|
+
"INTENTION_NAMESPACE_TYPE",
|
|
99
|
+
"INTENTION_STATUS_VALUES",
|
|
100
|
+
"IntentionAccessDenied",
|
|
101
|
+
"IntentionAuthorizerDependencies",
|
|
102
|
+
"IntentionEntity",
|
|
103
|
+
"IntentionListInput",
|
|
104
|
+
"IntentionLogInput",
|
|
105
|
+
"IntentionMarkSurfacedInput",
|
|
106
|
+
"IntentionResolvedEvent",
|
|
107
|
+
"IntentionStatus",
|
|
108
|
+
"IntentionSurfacedEvent",
|
|
109
|
+
"IntentionsCollection",
|
|
110
|
+
"authorize_intention_access",
|
|
111
|
+
"intention_namespace_name",
|
|
112
|
+
"intentions_table",
|
|
113
|
+
"load_intention_list_tool",
|
|
114
|
+
"load_intention_log_tool",
|
|
115
|
+
"load_intention_mark_surfaced_tool",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def __getattr__(name: str) -> object:
|
|
120
|
+
"""resolve a public attribute from its defining module on first access.
|
|
121
|
+
|
|
122
|
+
:param name: attribute name being resolved
|
|
123
|
+
:ptype name: str
|
|
124
|
+
:return: the resolved attribute (also cached in module globals so
|
|
125
|
+
``__getattr__`` fires at most once per name)
|
|
126
|
+
:rtype: object
|
|
127
|
+
:raises AttributeError: when ``name`` is not part of the public API
|
|
128
|
+
"""
|
|
129
|
+
entry = _LAZY.get(name)
|
|
130
|
+
if entry is None:
|
|
131
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
132
|
+
from importlib import import_module
|
|
133
|
+
|
|
134
|
+
module_name, attr = entry
|
|
135
|
+
value: object = getattr(import_module(module_name), attr)
|
|
136
|
+
globals()[name] = value
|
|
137
|
+
return value
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def __dir__() -> list[str]:
|
|
141
|
+
"""include lazy attributes in ``dir()`` output.
|
|
142
|
+
|
|
143
|
+
:return: sorted union of materialized globals and lazy names
|
|
144
|
+
:rtype: list[str]
|
|
145
|
+
"""
|
|
146
|
+
return sorted(set(globals()) | set(_LAZY))
|