trinity-lite 0.1.1__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.
Files changed (30) hide show
  1. trinity_lite-0.1.1/LICENSE +21 -0
  2. trinity_lite-0.1.1/PKG-INFO +254 -0
  3. trinity_lite-0.1.1/README.md +211 -0
  4. trinity_lite-0.1.1/pyproject.toml +36 -0
  5. trinity_lite-0.1.1/setup.cfg +4 -0
  6. trinity_lite-0.1.1/tests/test_bus.py +74 -0
  7. trinity_lite-0.1.1/tests/test_cli.py +150 -0
  8. trinity_lite-0.1.1/tests/test_doctor.py +255 -0
  9. trinity_lite-0.1.1/tests/test_guard.py +78 -0
  10. trinity_lite-0.1.1/tests/test_orchestrator.py +81 -0
  11. trinity_lite-0.1.1/tests/test_router.py +379 -0
  12. trinity_lite-0.1.1/tests/test_worker.py +67 -0
  13. trinity_lite-0.1.1/trinity_lite/__init__.py +3 -0
  14. trinity_lite-0.1.1/trinity_lite/__main__.py +4 -0
  15. trinity_lite-0.1.1/trinity_lite/adapters.py +136 -0
  16. trinity_lite-0.1.1/trinity_lite/bus.py +229 -0
  17. trinity_lite-0.1.1/trinity_lite/cli.py +178 -0
  18. trinity_lite-0.1.1/trinity_lite/config.py +16 -0
  19. trinity_lite-0.1.1/trinity_lite/doctor.py +182 -0
  20. trinity_lite-0.1.1/trinity_lite/guard.py +111 -0
  21. trinity_lite-0.1.1/trinity_lite/orchestrator.py +97 -0
  22. trinity_lite-0.1.1/trinity_lite/paths.py +30 -0
  23. trinity_lite-0.1.1/trinity_lite/router.py +134 -0
  24. trinity_lite-0.1.1/trinity_lite/validation.py +152 -0
  25. trinity_lite-0.1.1/trinity_lite/worker.py +42 -0
  26. trinity_lite-0.1.1/trinity_lite.egg-info/PKG-INFO +254 -0
  27. trinity_lite-0.1.1/trinity_lite.egg-info/SOURCES.txt +28 -0
  28. trinity_lite-0.1.1/trinity_lite.egg-info/dependency_links.txt +1 -0
  29. trinity_lite-0.1.1/trinity_lite.egg-info/entry_points.txt +2 -0
  30. trinity_lite-0.1.1/trinity_lite.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yomiracle
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,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: trinity-lite
3
+ Version: 0.1.1
4
+ Summary: A minimal public multi-agent task bus with routing, workers, and safety checks.
5
+ Author: Yomiracle
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Yomiracle
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/Yomiracle/trinity-lite
29
+ Project-URL: Repository, https://github.com/Yomiracle/trinity-lite
30
+ Project-URL: Issues, https://github.com/Yomiracle/trinity-lite/issues
31
+ Keywords: ai-agent,multi-agent,agent-orchestration,codex,claude-code
32
+ Classifier: Development Status :: 3 - Alpha
33
+ Classifier: Intended Audience :: Developers
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Programming Language :: Python :: 3
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Classifier: Programming Language :: Python :: 3.12
39
+ Requires-Python: >=3.10
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Dynamic: license-file
43
+
44
+ # Trinity Lite
45
+
46
+ [![Tests](https://github.com/Yomiracle/trinity-lite/actions/workflows/test.yml/badge.svg)](https://github.com/Yomiracle/trinity-lite/actions/workflows/test.yml)
47
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
48
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
49
+ [![Release](https://img.shields.io/github/v/release/Yomiracle/trinity-lite)](https://github.com/Yomiracle/trinity-lite/releases)
50
+
51
+ **Local-first multi-agent workflow infrastructure for CLI-based AI agents.**
52
+
53
+ Trinity Lite gives Codex, Claude Code, Hermes, Qwen, Gemini, Aider, and any CLI-based agent a shared task bus: route work, persist state in SQLite, run workers, capture results, and inspect the whole workflow from the command line.
54
+
55
+ [中文 README](README_zh.md)
56
+
57
+ ## Why Trinity Lite
58
+
59
+ AI coding agents are powerful on their own, but multi-agent work is often still coordinated by hand:
60
+
61
+ | Manual workflow | Trinity Lite workflow |
62
+ |-----------------|----------------------|
63
+ | Copy results between tools | Dispatch tasks through a shared bus |
64
+ | Remember task state yourself | Store task status and results in SQLite |
65
+ | Decide handoffs manually | Route by task type or explicit agent |
66
+ | Lose failure context | Keep errors, results, and messages queryable |
67
+ | Demo depends on installed real agents | Mock agents run the full workflow locally |
68
+
69
+ Trinity Lite turns "several AI tools on one machine" into a small, reproducible agent workflow layer.
70
+
71
+ ## Who It Is For
72
+
73
+ | User | What Trinity Lite helps with |
74
+ |------|------------------------------|
75
+ | AI developers | Prototype multi-agent coding workflows without building a platform first |
76
+ | Agent workflow builders | Test routing, task persistence, review handoffs, and worker execution |
77
+ | Indie hackers and small teams | Coordinate local CLI agents without server infrastructure |
78
+ | Technical creators and educators | Demonstrate real multi-agent flow with commands people can run |
79
+
80
+ ## 30-Second Demo
81
+
82
+ ```bash
83
+ git clone https://github.com/Yomiracle/trinity-lite.git
84
+ cd trinity-lite
85
+ python3 -m pip install -e .
86
+ trinity-lite doctor --scan-root .
87
+ trinity-lite dispatch-auto "implement a hello-world function"
88
+ trinity-lite worker codex --once
89
+ trinity-lite tasks
90
+ ```
91
+
92
+ The default agents are mock agents, so this demo works even if Codex, Claude Code, or Hermes are not installed.
93
+
94
+ ## How It Works
95
+
96
+ ```text
97
+ +----------------+
98
+ user task ------> | router |
99
+ +-------+--------+
100
+ |
101
+ v
102
+ +-------+--------+
103
+ | SQLite task bus|
104
+ +-------+--------+
105
+ |
106
+ +---------------+----------------+
107
+ v v
108
+ +------+-------+ +------+-------+
109
+ | Codex worker | | review worker|
110
+ +------+-------+ +------+-------+
111
+ | |
112
+ v v
113
+ agent adapter agent adapter
114
+ | |
115
+ +---------------+----------------+
116
+ v
117
+ status / result / inbox
118
+ ```
119
+
120
+ Codex, Claude Code, and Hermes are default presets, not requirements. Roles are configurable:
121
+
122
+ | Agent | Default Role |
123
+ |-------|--------------|
124
+ | `codex` | primary implementation, testing, project audit |
125
+ | `claude_code` | secondary review and cross-check |
126
+ | `hermes` | orchestration and acceptance |
127
+
128
+ ## Core Capabilities
129
+
130
+ - **Routing**: resolve task types to explicit agents or agents selected by declared capabilities.
131
+ - **Durable bus**: store tasks, status, results, errors, and messages in SQLite.
132
+ - **Worker model**: pull queued tasks and execute mock agents or real local CLIs.
133
+ - **Command adapters**: connect Codex, Claude Code, Hermes, Qwen, Gemini, Aider, or any CLI through JSON-array commands.
134
+ - **Local health checks**: verify Python, SQLite, route config, agent config, publish readiness, and optional runtime hygiene.
135
+ - **Safety boundaries**: block self-delegation, cap delegation depth, enforce allowed working directories, and scan public trees.
136
+
137
+ ## Technical Highlights
138
+
139
+ - **Zero runtime dependencies**: standard-library Python package.
140
+ - **SQLite-first state**: local, inspectable, transactional task storage.
141
+ - **Shell-safe command execution**: command adapters use JSON arrays and `shell=False`.
142
+ - **Mock-to-real upgrade path**: run the full demo before installing real agent CLIs.
143
+ - **Capability routing**: agents can declare roles, capabilities, and priority for name-agnostic routing.
144
+ - **CI-backed public release**: tests, compile checks, and doctor checks run in GitHub Actions.
145
+ - **Designed for extension**: MCP server and orchestrator are planned as optional layers, not required for the core bus.
146
+
147
+ ## Product Positioning
148
+
149
+ Trinity Lite sits between "single-agent CLI tools" and "full agent frameworks":
150
+
151
+ ```text
152
+ Codex / Claude Code / custom CLI
153
+ |
154
+ v
155
+ Trinity Lite: route -> bus -> worker -> result
156
+ |
157
+ v
158
+ future layers: MCP server, orchestrator, tracing, dashboard
159
+ ```
160
+
161
+ It does not try to replace agent frameworks. It provides a lightweight coordination layer for the AI tools developers already use.
162
+
163
+ ## Quick Start
164
+
165
+ ```bash
166
+ git clone https://github.com/Yomiracle/trinity-lite.git
167
+ cd trinity-lite
168
+ python3 -m pip install -e .
169
+
170
+ # Run a local health check
171
+ trinity-lite doctor --scan-root .
172
+
173
+ # Dispatch a task using the built-in route resolver
174
+ trinity-lite dispatch-auto "implement a hello-world function"
175
+
176
+ # Run one mock Codex worker cycle
177
+ trinity-lite worker codex --once
178
+
179
+ # Check recent tasks
180
+ trinity-lite tasks
181
+ ```
182
+
183
+ ## Use Real Agent Commands
184
+
185
+ Copy the command example and edit it for your machine:
186
+
187
+ ```bash
188
+ cp examples/agents.command.example.json agents.local.json
189
+ trinity-lite dispatch-auto "write a unit test"
190
+ trinity-lite worker codex --once --agents agents.local.json
191
+ ```
192
+
193
+ Agent commands are configured as JSON arrays and run with `shell=False`.
194
+
195
+ See [docs/REAL_AGENTS.md](docs/REAL_AGENTS.md) for Codex, Claude Code, and generic CLI examples.
196
+
197
+ For name-agnostic routing, copy the generic capability examples:
198
+
199
+ ```bash
200
+ cp examples/agents.generic.example.json agents.local.json
201
+ cp examples/routes.capabilities.example.json routes.local.json
202
+ trinity-lite dispatch-auto "fix the parser bug" --agents agents.local.json --routes routes.local.json
203
+ ```
204
+
205
+ ## Roadmap
206
+
207
+ - **v0.1.x**: harden the public local bus, docs, examples, and tests.
208
+ - **v0.2**: add a minimal MCP server so AI clients can call Trinity Lite directly.
209
+ - **v0.3**: add an optional orchestrator for primary work -> review -> doctor/tests -> acceptance.
210
+ - **v1.0**: stabilize CLI, schema, and packaging.
211
+
212
+ See [ROADMAP.md](ROADMAP.md).
213
+
214
+ ## Core Commands
215
+
216
+ ```bash
217
+ trinity-lite route "review this patch" --previous-agent codex
218
+ trinity-lite dispatch codex "implement X"
219
+ trinity-lite dispatch-auto "audit this project"
220
+ trinity-lite status <task_id>
221
+ trinity-lite tasks
222
+ trinity-lite worker codex --once
223
+ trinity-lite send claude_code "please review task abc"
224
+ trinity-lite inbox claude_code
225
+ trinity-lite orchestrate "implement X"
226
+ trinity-lite doctor --scan-root .
227
+ ```
228
+
229
+ For long-running local installs that maintain a metrics log, add runtime hygiene
230
+ checks:
231
+
232
+ ```bash
233
+ trinity-lite doctor --runtime-root ~/.trinity-lite --retired-port 9797
234
+ ```
235
+
236
+ ## Architecture
237
+
238
+ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
239
+
240
+ ## Project Docs
241
+
242
+ - [Trinity Lite tutorial](docs/TRINITY_LITE.md)
243
+ - [Real agent command setup](docs/REAL_AGENTS.md)
244
+ - [Agent capabilities](docs/CAPABILITIES.md)
245
+ - [Product positioning](docs/PRODUCT.md)
246
+ - [Operations guide](docs/OPERATIONS.md)
247
+ - [Security notes](docs/SECURITY.md)
248
+ - [Roadmap](ROADMAP.md)
249
+ - [Changelog](CHANGELOG.md)
250
+ - [Contributing](CONTRIBUTING.md)
251
+
252
+ ## License
253
+
254
+ MIT
@@ -0,0 +1,211 @@
1
+ # Trinity Lite
2
+
3
+ [![Tests](https://github.com/Yomiracle/trinity-lite/actions/workflows/test.yml/badge.svg)](https://github.com/Yomiracle/trinity-lite/actions/workflows/test.yml)
4
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
6
+ [![Release](https://img.shields.io/github/v/release/Yomiracle/trinity-lite)](https://github.com/Yomiracle/trinity-lite/releases)
7
+
8
+ **Local-first multi-agent workflow infrastructure for CLI-based AI agents.**
9
+
10
+ Trinity Lite gives Codex, Claude Code, Hermes, Qwen, Gemini, Aider, and any CLI-based agent a shared task bus: route work, persist state in SQLite, run workers, capture results, and inspect the whole workflow from the command line.
11
+
12
+ [中文 README](README_zh.md)
13
+
14
+ ## Why Trinity Lite
15
+
16
+ AI coding agents are powerful on their own, but multi-agent work is often still coordinated by hand:
17
+
18
+ | Manual workflow | Trinity Lite workflow |
19
+ |-----------------|----------------------|
20
+ | Copy results between tools | Dispatch tasks through a shared bus |
21
+ | Remember task state yourself | Store task status and results in SQLite |
22
+ | Decide handoffs manually | Route by task type or explicit agent |
23
+ | Lose failure context | Keep errors, results, and messages queryable |
24
+ | Demo depends on installed real agents | Mock agents run the full workflow locally |
25
+
26
+ Trinity Lite turns "several AI tools on one machine" into a small, reproducible agent workflow layer.
27
+
28
+ ## Who It Is For
29
+
30
+ | User | What Trinity Lite helps with |
31
+ |------|------------------------------|
32
+ | AI developers | Prototype multi-agent coding workflows without building a platform first |
33
+ | Agent workflow builders | Test routing, task persistence, review handoffs, and worker execution |
34
+ | Indie hackers and small teams | Coordinate local CLI agents without server infrastructure |
35
+ | Technical creators and educators | Demonstrate real multi-agent flow with commands people can run |
36
+
37
+ ## 30-Second Demo
38
+
39
+ ```bash
40
+ git clone https://github.com/Yomiracle/trinity-lite.git
41
+ cd trinity-lite
42
+ python3 -m pip install -e .
43
+ trinity-lite doctor --scan-root .
44
+ trinity-lite dispatch-auto "implement a hello-world function"
45
+ trinity-lite worker codex --once
46
+ trinity-lite tasks
47
+ ```
48
+
49
+ The default agents are mock agents, so this demo works even if Codex, Claude Code, or Hermes are not installed.
50
+
51
+ ## How It Works
52
+
53
+ ```text
54
+ +----------------+
55
+ user task ------> | router |
56
+ +-------+--------+
57
+ |
58
+ v
59
+ +-------+--------+
60
+ | SQLite task bus|
61
+ +-------+--------+
62
+ |
63
+ +---------------+----------------+
64
+ v v
65
+ +------+-------+ +------+-------+
66
+ | Codex worker | | review worker|
67
+ +------+-------+ +------+-------+
68
+ | |
69
+ v v
70
+ agent adapter agent adapter
71
+ | |
72
+ +---------------+----------------+
73
+ v
74
+ status / result / inbox
75
+ ```
76
+
77
+ Codex, Claude Code, and Hermes are default presets, not requirements. Roles are configurable:
78
+
79
+ | Agent | Default Role |
80
+ |-------|--------------|
81
+ | `codex` | primary implementation, testing, project audit |
82
+ | `claude_code` | secondary review and cross-check |
83
+ | `hermes` | orchestration and acceptance |
84
+
85
+ ## Core Capabilities
86
+
87
+ - **Routing**: resolve task types to explicit agents or agents selected by declared capabilities.
88
+ - **Durable bus**: store tasks, status, results, errors, and messages in SQLite.
89
+ - **Worker model**: pull queued tasks and execute mock agents or real local CLIs.
90
+ - **Command adapters**: connect Codex, Claude Code, Hermes, Qwen, Gemini, Aider, or any CLI through JSON-array commands.
91
+ - **Local health checks**: verify Python, SQLite, route config, agent config, publish readiness, and optional runtime hygiene.
92
+ - **Safety boundaries**: block self-delegation, cap delegation depth, enforce allowed working directories, and scan public trees.
93
+
94
+ ## Technical Highlights
95
+
96
+ - **Zero runtime dependencies**: standard-library Python package.
97
+ - **SQLite-first state**: local, inspectable, transactional task storage.
98
+ - **Shell-safe command execution**: command adapters use JSON arrays and `shell=False`.
99
+ - **Mock-to-real upgrade path**: run the full demo before installing real agent CLIs.
100
+ - **Capability routing**: agents can declare roles, capabilities, and priority for name-agnostic routing.
101
+ - **CI-backed public release**: tests, compile checks, and doctor checks run in GitHub Actions.
102
+ - **Designed for extension**: MCP server and orchestrator are planned as optional layers, not required for the core bus.
103
+
104
+ ## Product Positioning
105
+
106
+ Trinity Lite sits between "single-agent CLI tools" and "full agent frameworks":
107
+
108
+ ```text
109
+ Codex / Claude Code / custom CLI
110
+ |
111
+ v
112
+ Trinity Lite: route -> bus -> worker -> result
113
+ |
114
+ v
115
+ future layers: MCP server, orchestrator, tracing, dashboard
116
+ ```
117
+
118
+ It does not try to replace agent frameworks. It provides a lightweight coordination layer for the AI tools developers already use.
119
+
120
+ ## Quick Start
121
+
122
+ ```bash
123
+ git clone https://github.com/Yomiracle/trinity-lite.git
124
+ cd trinity-lite
125
+ python3 -m pip install -e .
126
+
127
+ # Run a local health check
128
+ trinity-lite doctor --scan-root .
129
+
130
+ # Dispatch a task using the built-in route resolver
131
+ trinity-lite dispatch-auto "implement a hello-world function"
132
+
133
+ # Run one mock Codex worker cycle
134
+ trinity-lite worker codex --once
135
+
136
+ # Check recent tasks
137
+ trinity-lite tasks
138
+ ```
139
+
140
+ ## Use Real Agent Commands
141
+
142
+ Copy the command example and edit it for your machine:
143
+
144
+ ```bash
145
+ cp examples/agents.command.example.json agents.local.json
146
+ trinity-lite dispatch-auto "write a unit test"
147
+ trinity-lite worker codex --once --agents agents.local.json
148
+ ```
149
+
150
+ Agent commands are configured as JSON arrays and run with `shell=False`.
151
+
152
+ See [docs/REAL_AGENTS.md](docs/REAL_AGENTS.md) for Codex, Claude Code, and generic CLI examples.
153
+
154
+ For name-agnostic routing, copy the generic capability examples:
155
+
156
+ ```bash
157
+ cp examples/agents.generic.example.json agents.local.json
158
+ cp examples/routes.capabilities.example.json routes.local.json
159
+ trinity-lite dispatch-auto "fix the parser bug" --agents agents.local.json --routes routes.local.json
160
+ ```
161
+
162
+ ## Roadmap
163
+
164
+ - **v0.1.x**: harden the public local bus, docs, examples, and tests.
165
+ - **v0.2**: add a minimal MCP server so AI clients can call Trinity Lite directly.
166
+ - **v0.3**: add an optional orchestrator for primary work -> review -> doctor/tests -> acceptance.
167
+ - **v1.0**: stabilize CLI, schema, and packaging.
168
+
169
+ See [ROADMAP.md](ROADMAP.md).
170
+
171
+ ## Core Commands
172
+
173
+ ```bash
174
+ trinity-lite route "review this patch" --previous-agent codex
175
+ trinity-lite dispatch codex "implement X"
176
+ trinity-lite dispatch-auto "audit this project"
177
+ trinity-lite status <task_id>
178
+ trinity-lite tasks
179
+ trinity-lite worker codex --once
180
+ trinity-lite send claude_code "please review task abc"
181
+ trinity-lite inbox claude_code
182
+ trinity-lite orchestrate "implement X"
183
+ trinity-lite doctor --scan-root .
184
+ ```
185
+
186
+ For long-running local installs that maintain a metrics log, add runtime hygiene
187
+ checks:
188
+
189
+ ```bash
190
+ trinity-lite doctor --runtime-root ~/.trinity-lite --retired-port 9797
191
+ ```
192
+
193
+ ## Architecture
194
+
195
+ See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
196
+
197
+ ## Project Docs
198
+
199
+ - [Trinity Lite tutorial](docs/TRINITY_LITE.md)
200
+ - [Real agent command setup](docs/REAL_AGENTS.md)
201
+ - [Agent capabilities](docs/CAPABILITIES.md)
202
+ - [Product positioning](docs/PRODUCT.md)
203
+ - [Operations guide](docs/OPERATIONS.md)
204
+ - [Security notes](docs/SECURITY.md)
205
+ - [Roadmap](ROADMAP.md)
206
+ - [Changelog](CHANGELOG.md)
207
+ - [Contributing](CONTRIBUTING.md)
208
+
209
+ ## License
210
+
211
+ MIT
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "trinity-lite"
7
+ version = "0.1.1"
8
+ description = "A minimal public multi-agent task bus with routing, workers, and safety checks."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { file = "LICENSE" }
12
+ authors = [
13
+ { name = "Yomiracle" }
14
+ ]
15
+ keywords = ["ai-agent", "multi-agent", "agent-orchestration", "codex", "claude-code"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ ]
25
+ dependencies = []
26
+
27
+ [project.scripts]
28
+ trinity-lite = "trinity_lite.cli:main"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/Yomiracle/trinity-lite"
32
+ Repository = "https://github.com/Yomiracle/trinity-lite"
33
+ Issues = "https://github.com/Yomiracle/trinity-lite/issues"
34
+
35
+ [tool.setuptools]
36
+ packages = ["trinity_lite"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,74 @@
1
+ import tempfile
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+ from trinity_lite.bus import TrinityBus
6
+ from trinity_lite.guard import GuardError
7
+
8
+
9
+ class BusTest(unittest.TestCase):
10
+ def setUp(self):
11
+ self.temp = tempfile.TemporaryDirectory()
12
+ self.root = Path(self.temp.name)
13
+ self.db = self.root / "bus.db"
14
+ self.bus = TrinityBus(self.db, allowed_roots=[self.root])
15
+
16
+ def tearDown(self):
17
+ self.temp.cleanup()
18
+
19
+ def test_task_round_trip(self):
20
+ task = self.bus.submit_task("user", "codex", "build it", "implementation", cwd=self.root)
21
+ self.assertEqual(task["status"], "queued")
22
+ claimed = self.bus.task_for_worker("codex")
23
+ self.assertEqual(claimed["id"], task["id"])
24
+ self.assertEqual(claimed["status"], "running")
25
+ done = self.bus.finish_worker(task["id"], result="ok")
26
+ self.assertEqual(done["status"], "completed")
27
+ self.assertEqual(done["result"], "ok")
28
+
29
+ def test_rejects_self_delegation_depth_and_cwd_escape(self):
30
+ with self.assertRaises(GuardError):
31
+ self.bus.submit_task("codex", "codex", "loop", cwd=self.root)
32
+ with self.assertRaises(GuardError):
33
+ self.bus.submit_task("user", "codex", "too deep", cwd=self.root, depth=3)
34
+ with self.assertRaises(GuardError):
35
+ self.bus.submit_task("user", "codex", "escape", cwd="/")
36
+
37
+ def test_connection_context_rolls_back_on_exception(self):
38
+ with self.assertRaises(RuntimeError):
39
+ with self.bus.connect() as conn:
40
+ conn.execute(
41
+ """
42
+ INSERT INTO tasks (
43
+ id, source_agent, target_agent, prompt, cwd,
44
+ status, depth, created_at, heartbeat_at
45
+ )
46
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
47
+ """,
48
+ (
49
+ "rollback-test",
50
+ "user",
51
+ "codex",
52
+ "work",
53
+ str(self.root),
54
+ "queued",
55
+ 0,
56
+ "2026-01-01T00:00:00+00:00",
57
+ "2026-01-01T00:00:00+00:00",
58
+ ),
59
+ )
60
+ raise RuntimeError("force rollback")
61
+ with self.assertRaises(KeyError):
62
+ self.bus.get_task("rollback-test")
63
+
64
+ def test_message_round_trip(self):
65
+ msg = self.bus.send_message("codex", "claude_code", "please review")
66
+ self.assertEqual(msg["read"], 0)
67
+ inbox = self.bus.inbox("claude_code", mark_read=True)
68
+ self.assertEqual(len(inbox), 1)
69
+ self.assertEqual(inbox[0]["message"], "please review")
70
+ self.assertEqual(self.bus.inbox("claude_code"), [])
71
+
72
+
73
+ if __name__ == "__main__":
74
+ unittest.main()