nextloop 0.1.0rc1__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.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: nextloop
3
+ Version: 0.1.0rc1
4
+ Summary: An embeddable AgentLoop with explicit event, tool, recovery, and delivery semantics
5
+ Author-email: 12bitsD <bis12@163.com>
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/12bitsD/nextloop
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Typing :: Typed
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: httpx<1,>=0.27
18
+ Requires-Dist: jsonschema<5,>=4.23
19
+ Provides-Extra: dev
20
+ Requires-Dist: build<2,>=1.2; extra == "dev"
21
+ Requires-Dist: mypy<2,>=1.13; extra == "dev"
22
+ Requires-Dist: pytest<10,>=8; extra == "dev"
23
+ Requires-Dist: pytest-asyncio<2,>=0.24; extra == "dev"
24
+ Requires-Dist: ruff<1,>=0.8; extra == "dev"
25
+ Requires-Dist: twine<7,>=5; extra == "dev"
26
+ Requires-Dist: types-jsonschema<5,>=4.23; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # nextloop
30
+
31
+ A small, embeddable Python AgentLoop with explicit execution, recovery, and delivery semantics.
32
+
33
+ Current version: **0.1.0rc1**.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ python -m pip install nextloop==0.1.0rc1
39
+ ```
40
+
41
+ For local development:
42
+
43
+ ```bash
44
+ uv venv --python 3.11 .venv
45
+ uv pip install --python .venv/bin/python -e '.[dev]'
46
+ ```
47
+
48
+ ## What it provides
49
+
50
+ - DSH-aligned Session/Turn/Step execution with 4D integer coordinates and writer fencing.
51
+ - Append-only Trajectory and O(Δ) `surface_op` watermark projection.
52
+ - In-memory `Inbox` serialization for steer and final commitment.
53
+ - Whole-batch Tool Schema validation, bounded parallel calls, and exclusive failure barriers.
54
+ - Closed five-variant `ToolOutcome`: `Completed`, `Skipped`, `Cancelled`, `UncertainSettled`, `UncertainHanging`.
55
+ - Bounded Provider retries, protocol correction, WorkingContext, Compaction, and cancellation.
56
+ - SQLite and in-memory EventStores, crash closers, and delivery-only recovery.
57
+ - OpenAI-compatible and Anthropic streaming Provider adapters.
58
+
59
+ It is a library, not an HTTP service, product bot, Router, EventBus, or multi-agent framework.
60
+
61
+ ## Public API
62
+
63
+ ```python
64
+ AgentLoop.run(TurnContext) -> TurnOutcome
65
+ AgentLoop.steer(session_id, content, *, input_id=None) -> bool
66
+ AgentLoop.cancel(session_id, cause="user_stop") -> bool
67
+ AgentLoop.recover(session_id, store, delivery) -> RecoveryOutcome
68
+ ```
69
+
70
+ The only four Adapter protocols are `EventStore`, `ModelProvider`, `ToolRuntime`, and `DeliveryOwner`. Context projection and Compaction are built in and configured through `LoopConfig`.
71
+
72
+ `ToolRegistry` is the built-in `ToolRuntime` implementation:
73
+
74
+ ```python
75
+ from nextloop import ToolRegistry, ToolSpec, ToolExecutionMode
76
+
77
+ registry = ToolRegistry()
78
+ registry.register(
79
+ ToolSpec(
80
+ "read",
81
+ "Read a file",
82
+ {
83
+ "type": "object",
84
+ "properties": {"path": {"type": "string"}},
85
+ "required": ["path"],
86
+ },
87
+ mode=ToolExecutionMode.PARALLEL,
88
+ ),
89
+ lambda arguments, context: "file contents",
90
+ )
91
+ ```
92
+
93
+ Run the complete fake-Provider example:
94
+
95
+ ```bash
96
+ python examples/basic.py
97
+ ```
98
+
99
+ It executes model → Tool → Observation → model → delivery without a hosted model.
100
+
101
+ ## Code structure
102
+
103
+ ```text
104
+ src/nextloop/
105
+ contracts.py # public schemas, ToolOutcome, four Protocols, LoopConfig
106
+ loop.py # AgentLoop and active Session registry
107
+ driver.py # thin Turn/Step orchestration and SessionActor
108
+ events/ # pure projection, response/outcome folds, crash repair
109
+ execute/ # model retries, Tool registration, batch scheduling
110
+ adapters/ # SQLite, memory, OpenAI, Anthropic
111
+ ```
112
+
113
+ `events/` performs no I/O. `execute/` owns side effects and classified failures. `driver.py` only composes them.
114
+
115
+ ## Verification
116
+
117
+ The release-candidate checks cover:
118
+
119
+ - text, Tool, multi-Step, mixed, empty, truncated, and malformed responses;
120
+ - whole-batch rejection and parallel/exclusive scheduling with deterministic gates;
121
+ - steer/final ordering, cancellation, WorkingContext, and Compaction;
122
+ - protocol exhaustion, exact-byte retry, and partial-output failure;
123
+ - resource-lock recovery, conflict prevention, and explicit release;
124
+ - real subprocess exits during Tool execution and final delivery, followed by SQLite recovery;
125
+ - recorded OpenAI and Anthropic SSE streams;
126
+ - `ruff`, `mypy`, wheel/sdist builds, `twine check`, and clean wheel installation.
127
+
128
+ Current limits:
129
+
130
+ - Hosted-model smoke and nika integration are separate acceptance work.
131
+ - Concurrent writers across multiple processes fail closed; they are not coordinated.
132
+ - Large-asset lifecycle, backup, and GC are not part of this release candidate.
133
+
134
+ ## Documents
135
+
136
+ - [AgentLoop design](docs/design/agent-loop.md)
137
+ - [Public interface](docs/design/loop-interface.md)
138
+ - [ReAct protocol](docs/design/react-protocol.md)
139
+ - [Verification matrix](docs/design/verification-matrix.md)
140
+ - [Development plan](docs/architecture/development-plan.md)
141
+ - [Changelog](CHANGELOG.md)
142
+ - [ADR-0002](docs/adr/0002-dsh-aligned-agent-loop.md) and [ADR-0003](docs/adr/0003-python-and-centralized-contracts.md)
143
+
144
+ ## Release
145
+
146
+ CI covers Python 3.11, 3.12, and 3.13. A `v*` tag runs the release workflow, which verifies the package, publishes wheel and sdist to PyPI through Trusted Publishing, and creates a GitHub Release.
147
+
148
+ This is a public repository. Do not commit credentials, private trajectories, internal endpoints, or personal data.
@@ -0,0 +1,25 @@
1
+ nextloop/__init__.py,sha256=ay9yFORTWZyBJoG0RR4AGVbNLCgqSrQF5fdyXbTEsPs,1914
2
+ nextloop/contracts.py,sha256=xAqLM9tb9ar_o4ZFa7Z5g0qIkvFagxxo4uw07CXSCkE,8928
3
+ nextloop/driver.py,sha256=i3Gv6r4Qrmru5uBg_qA-22tNNUqryzuh3T-SvhLH45k,17591
4
+ nextloop/loop.py,sha256=fNP91rboueHW7GXDicjps-dMkaFqhuxyq7U0OAE6qZU,6743
5
+ nextloop/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ nextloop/adapters/__init__.py,sha256=gF6fQXIuApctPG3bvPBetNf4LiFgp93VONzTA256xe8,245
7
+ nextloop/adapters/_sse.py,sha256=ZDOOYnY1RJ-errBgs-ocJex-mg29ftaYixkf0acXsKQ,691
8
+ nextloop/adapters/anthropic.py,sha256=L4UhLAOyRikKGlabZgJz79zZmQFLYkuYWvlOjU3KWNA,8496
9
+ nextloop/adapters/memory.py,sha256=oBBfE86fkkALYCyAERCOP_LxLXDadqoDQDsOLtI37OQ,3559
10
+ nextloop/adapters/openai.py,sha256=XH4F6nbHenKvHTPxwhB2LaMBxeZgyM_EvT65J5zTcyk,7022
11
+ nextloop/adapters/sqlite.py,sha256=DXNi8zdpelMP6EdyCxfd4p-rVpdsJayo1YWgaUpgQYw,9810
12
+ nextloop/events/__init__.py,sha256=Br2AHEBVTFT6Cfjd8B3hvUUEcbX75ijYtHYplA3L900,465
13
+ nextloop/events/outcome.py,sha256=MlJR4IHC5nwirZ-idYwj1ML0LwxGgZx8vgjn8CGKTXo,6083
14
+ nextloop/events/project.py,sha256=dEQiirHNXz5HusvDRcV-RZRe-KrpxDKyoQWtTxUx5vc,5542
15
+ nextloop/events/repair.py,sha256=qjUs6kcRwdHFAXKQ8pVCZhhLooEOV7Dm5HqYD3cONn0,5214
16
+ nextloop/events/response.py,sha256=tWE1fvh9e3mplfbgHCQNJzpxLw7PCMVHe_ueP0vwrmo,6699
17
+ nextloop/execute/__init__.py,sha256=7qiWBjCJePVwOSYYSXrR9KBm8NXsiMU9T8riUjAnjQI,374
18
+ nextloop/execute/batch.py,sha256=O6CS9Z4-rpWhUmukACOYVAxl9hSL4EpDBq-I0jn4XFc,5673
19
+ nextloop/execute/model.py,sha256=Z2KaUkl0Jj1G1dy64o1JXnMuJ1W483_q3MZQFbV7oT0,4964
20
+ nextloop/execute/tools.py,sha256=MRNhlvnC45AyERtgJZlwHtYgcMxiWUl54Is_uyzeUZE,5599
21
+ nextloop-0.1.0rc1.dist-info/licenses/LICENSE,sha256=SC2YSuode-D_ZgS0Wv5P1_p_EmOvyc4Pm1Rsr2lrWzs,1064
22
+ nextloop-0.1.0rc1.dist-info/METADATA,sha256=7zaNXJ1QdDg-3Yotbe1DlRH2CVU1fg-EWoRDyptD-mM,5517
23
+ nextloop-0.1.0rc1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
24
+ nextloop-0.1.0rc1.dist-info/top_level.txt,sha256=eIkI84Hci0_JzqLksxx2DUnwj2-7YHSsi1KgYswONeY,9
25
+ nextloop-0.1.0rc1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 12bitsD
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 @@
1
+ nextloop