statewire 0.7.0__tar.gz → 0.7.2__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.
- {statewire-0.7.0 → statewire-0.7.2}/PKG-INFO +2 -2
- {statewire-0.7.0 → statewire-0.7.2}/pyproject.toml +2 -2
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/client.py +11 -1
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_client.py +27 -0
- {statewire-0.7.0 → statewire-0.7.2}/.gitignore +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/README.md +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/examples/__init__.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/examples/demo_app.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/__init__.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/api.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/langgraph.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/ops.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/state.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/src/statewire/testing.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/client_helpers.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/statewire_helpers.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_authorize.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_client_ws.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_commands.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_context.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_frames.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_idle.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_langgraph.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_lifespan.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_meta.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_observer.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_route_auth.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_start_session.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_state_proxy.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_statewire_hostable.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_stream.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_testing.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_writer_lease.py +0 -0
- {statewire-0.7.0 → statewire-0.7.2}/tests/test_ws.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: statewire
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Replicate one JSON object over an SSE op stream + a command endpoint
|
|
5
5
|
Project-URL: Repository, https://github.com/assistant-ui/harness-sdk
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Requires-Python: <4.0,>=3.12
|
|
8
8
|
Requires-Dist: fastapi>=0.115
|
|
9
9
|
Requires-Dist: httpx>=0.27
|
|
10
|
-
Requires-Dist: pinned<0.
|
|
10
|
+
Requires-Dist: pinned<0.4,>=0.2.0
|
|
11
11
|
Provides-Extra: langgraph
|
|
12
12
|
Requires-Dist: langchain-core>=0.3; extra == 'langgraph'
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "statewire"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.2"
|
|
4
4
|
description = "Replicate one JSON object over an SSE op stream + a command endpoint"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
7
7
|
requires-python = ">=3.12,<4.0"
|
|
8
8
|
dependencies = [
|
|
9
|
-
"pinned>=0.2.0,<0.
|
|
9
|
+
"pinned>=0.2.0,<0.4",
|
|
10
10
|
"fastapi>=0.115",
|
|
11
11
|
"httpx>=0.27",
|
|
12
12
|
]
|
|
@@ -239,9 +239,19 @@ def _apply_mutable(root: Any, op: dict[str, Any]) -> Any:
|
|
|
239
239
|
return root
|
|
240
240
|
|
|
241
241
|
|
|
242
|
+
def _is_mount_plane_op(op: Any) -> bool:
|
|
243
|
+
return isinstance(op, dict) and (
|
|
244
|
+
"doc" in op or op.get("op") in ("mount", "unmount")
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
|
|
242
248
|
def apply_ops(state: Any, ops: list[Any]) -> Any:
|
|
243
|
-
"""Apply an op array; returns the next state.
|
|
249
|
+
"""Apply an op array; returns the next state. Mount-plane ops (a ``doc``
|
|
250
|
+
field, or op ``mount``/``unmount``) are dropped; unknown op kinds are
|
|
251
|
+
skipped."""
|
|
244
252
|
for op in ops:
|
|
253
|
+
if _is_mount_plane_op(op):
|
|
254
|
+
continue
|
|
245
255
|
kind = op.get("op") if isinstance(op, dict) else None
|
|
246
256
|
if kind in ("replace", "add", "remove"):
|
|
247
257
|
state = _apply_mutable(state, _revive_op(op))
|
|
@@ -280,6 +280,33 @@ def test_apply_ops_text_insert_protocol_faults():
|
|
|
280
280
|
apply_ops({"count": 1}, [{"op": "add", "path": ["count", 0], "value": "!"}])
|
|
281
281
|
|
|
282
282
|
|
|
283
|
+
def test_apply_ops_drops_mount_plane_ops_and_applies_the_rest():
|
|
284
|
+
state = apply_ops(
|
|
285
|
+
{"count": 0},
|
|
286
|
+
[
|
|
287
|
+
{"op": "replace", "path": ["count"], "value": 1},
|
|
288
|
+
{"op": "replace", "path": ["missing", "x"], "value": 1, "doc": 3},
|
|
289
|
+
{"op": "mount", "doc": 3, "at": ["threads", "t1"], "meta": "garbage"},
|
|
290
|
+
{"op": "unmount", "doc": 3},
|
|
291
|
+
],
|
|
292
|
+
)
|
|
293
|
+
assert state == {"count": 1}
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
def test_apply_ops_applies_a_mount_plane_only_packet_as_a_no_op():
|
|
297
|
+
state = apply_ops(
|
|
298
|
+
{"count": 0}, [{"op": "mount", "doc": 1}, {"op": "unmount", "doc": 1}]
|
|
299
|
+
)
|
|
300
|
+
assert state == {"count": 0}
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def test_apply_ops_still_raises_on_invalid_non_mount_plane_ops():
|
|
304
|
+
with pytest.raises(StatewireProtocolError):
|
|
305
|
+
apply_ops(
|
|
306
|
+
{"count": 0}, [{"op": "replace", "path": ["missing", "x"], "value": 1}]
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
|
|
283
310
|
def transport_answering(responder):
|
|
284
311
|
transport = SseTransport(URL, http=httpx.AsyncClient(transport=httpx.MockTransport(responder)))
|
|
285
312
|
transport._lease = "lease"
|
|
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
|