bma-executor-sdk 1.0.2__tar.gz → 1.0.3__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.
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/PKG-INFO +1 -1
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/pyproject.toml +1 -1
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/_rpc.py +4 -0
- bma_executor_sdk-1.0.3/tests/test_rpc_unretrieved_future.py +60 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/.gitignore +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/README.md +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/examples/agent_minimal.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/examples/executor_minimal.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/examples/harness_loopback.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/__init__.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/_methods.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/_npipe.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/agent.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/client.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/generated.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/harness.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/methods.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/py.typed +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/tools.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/src/bma_executor_sdk/transport.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/executor_helpers.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_base_url.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_close_codes.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_executor_conformance.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_executor_contract.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_executor_interop.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_executor_runtime.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_executor_token_refresh.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_npipe.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_reconnect.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_review.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/test_typed_tools.py +0 -0
- {bma_executor_sdk-1.0.2 → bma_executor_sdk-1.0.3}/tests/typecheck/typed_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bma-executor-sdk
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: BMA executor protocol (bma.executor.v1.1): executor, harness and agent ends on asyncio with WebSocket, Unix socket and in-process transports.
|
|
5
5
|
Project-URL: Repository, https://github.com/beeos-ai/bma-executor-sdk
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "bma-executor-sdk"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.3"
|
|
4
4
|
description = "BMA executor protocol (bma.executor.v1.1): executor, harness and agent ends on asyncio with WebSocket, Unix socket and in-process transports."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -99,6 +99,10 @@ class Peer:
|
|
|
99
99
|
raise TimeoutError(f"{method}: no response within {timeout}s") from error
|
|
100
100
|
finally:
|
|
101
101
|
self._pending.pop(request_id, None)
|
|
102
|
+
if future.done() and not future.cancelled():
|
|
103
|
+
# The channel can fail the call while it is still being written; that error
|
|
104
|
+
# surfaces from the write, so retrieve the Future's own (asyncio would log it).
|
|
105
|
+
future.exception()
|
|
102
106
|
|
|
103
107
|
async def notify(self, method: str, params: Any) -> None:
|
|
104
108
|
if self.closed is not None:
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""A channel that closes (4002 runtime ended) while a call is still being
|
|
2
|
+
written must not leave a failed Future nobody retrieves: asyncio logs
|
|
3
|
+
"Future exception was never retrieved" when such a Future is collected."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import gc
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
import pytest
|
|
12
|
+
|
|
13
|
+
from bma_executor_sdk._rpc import NotConnectedError, Peer
|
|
14
|
+
from bma_executor_sdk.transport import CLOSE_FORBIDDEN, ChannelClosed
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ClosingConnection:
|
|
18
|
+
"""send blocks until the channel is closed, then fails as a closed channel does."""
|
|
19
|
+
|
|
20
|
+
subprotocol = None
|
|
21
|
+
|
|
22
|
+
def __init__(self) -> None:
|
|
23
|
+
self.closed = asyncio.Event()
|
|
24
|
+
|
|
25
|
+
async def send(self, message: str) -> None:
|
|
26
|
+
await self.closed.wait()
|
|
27
|
+
raise ChannelClosed(CLOSE_FORBIDDEN, "runtime ended")
|
|
28
|
+
|
|
29
|
+
async def recv(self) -> str:
|
|
30
|
+
await self.closed.wait()
|
|
31
|
+
raise ChannelClosed(CLOSE_FORBIDDEN, "runtime ended")
|
|
32
|
+
|
|
33
|
+
async def close(self, code: int = 1000, reason: str = "") -> None:
|
|
34
|
+
self.closed.set()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async def test_close_during_send_leaves_no_unretrieved_future() -> None:
|
|
38
|
+
loop = asyncio.get_running_loop()
|
|
39
|
+
reported: list[dict[str, Any]] = []
|
|
40
|
+
loop.set_exception_handler(lambda _loop, context: reported.append(context))
|
|
41
|
+
|
|
42
|
+
conn = ClosingConnection()
|
|
43
|
+
|
|
44
|
+
async def no_request(*_: Any) -> Any:
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
peer = Peer(conn, id_prefix="t", on_request=no_request, on_notification=lambda *_: None, on_log=lambda *_: None)
|
|
48
|
+
reader = asyncio.create_task(peer.run())
|
|
49
|
+
call = asyncio.create_task(peer.call("tool.call", {}, 5.0))
|
|
50
|
+
await asyncio.sleep(0) # the call is registered and blocked in send
|
|
51
|
+
conn.closed.set()
|
|
52
|
+
with pytest.raises(NotConnectedError):
|
|
53
|
+
await call
|
|
54
|
+
await reader
|
|
55
|
+
del call, reader, peer
|
|
56
|
+
for _ in range(3):
|
|
57
|
+
gc.collect()
|
|
58
|
+
await asyncio.sleep(0)
|
|
59
|
+
|
|
60
|
+
assert [c.get("message") for c in reported] == []
|
|
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
|