bma-executor-sdk 0.4.0__tar.gz → 0.4.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 (19) hide show
  1. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/PKG-INFO +1 -1
  2. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/pyproject.toml +1 -1
  3. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/client.py +12 -1
  4. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/tests/test_executor_runtime.py +17 -0
  5. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/.gitignore +0 -0
  6. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/README.md +0 -0
  7. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/examples/agent_minimal.py +0 -0
  8. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/examples/executor_minimal.py +0 -0
  9. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/examples/harness_loopback.py +0 -0
  10. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/__init__.py +0 -0
  11. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/_rpc.py +0 -0
  12. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/agent.py +0 -0
  13. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/generated.py +0 -0
  14. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/harness.py +0 -0
  15. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/src/bma_executor_sdk/transport.py +0 -0
  16. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/tests/executor_helpers.py +0 -0
  17. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/tests/test_executor_conformance.py +0 -0
  18. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/tests/test_executor_contract.py +0 -0
  19. {bma_executor_sdk-0.4.0 → bma_executor_sdk-0.4.1}/tests/test_executor_interop.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bma-executor-sdk
3
- Version: 0.4.0
3
+ Version: 0.4.1
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-sdks
6
6
  License-Expression: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bma-executor-sdk"
3
- version = "0.4.0"
3
+ version = "0.4.1"
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"
@@ -28,6 +28,7 @@ from .generated import (
28
28
  METHOD_TOOL_CALL,
29
29
  METHOD_TOOL_CANCEL,
30
30
  METHOD_TOOL_RESULT,
31
+ METHODS,
31
32
  Ack,
32
33
  Capabilities,
33
34
  ChannelScope,
@@ -509,7 +510,7 @@ class ExecutorClient:
509
510
  return await self._agent.methods[method](params)
510
511
  handler = self._request_handlers.get(method)
511
512
  if handler is None:
512
- raise RPCError(JsonRpcErrorCode.MethodNotFound, f"unknown method {method}")
513
+ raise _unregistered_method_error(method)
513
514
  return await handler(params)
514
515
 
515
516
  def _dispatch_notification(self, method: str, params: Any) -> None:
@@ -673,3 +674,13 @@ __all__ = [
673
674
  "MAX_FRAME_BYTES",
674
675
  "static_token",
675
676
  ]
677
+
678
+
679
+ def _unregistered_method_error(method: str) -> RPCError:
680
+ """A contract method behind a capability this executor did not register is
681
+ capability_unavailable naming that capability; anything else is
682
+ method_not_found."""
683
+ spec = METHODS.get(method)
684
+ if spec is None or not spec.capability or spec.direction == "executor-to-harness":
685
+ return RPCError(JsonRpcErrorCode.MethodNotFound, f"unknown method {method}")
686
+ return RPCError(JsonRpcErrorCode.CapabilityUnavailable, "capability_unavailable", {"capability": spec.capability})
@@ -407,3 +407,20 @@ async def test_start_turn_requires_agent_capability() -> None:
407
407
  await executor.start_turn(turn_start("s", "t", "hi")) # type: ignore[arg-type]
408
408
  assert error.value.code == JsonRpcErrorCode.CapabilityUnavailable
409
409
  await client.stop()
410
+
411
+
412
+ async def test_unregistered_contract_method_is_capability_unavailable() -> None:
413
+ harness = bx.Harness()
414
+ async with listen(harness, "inprocess") as (url, dialer):
415
+ client = make_client(url, dialer)
416
+ await client.start()
417
+ executor = await harness.wait_executor()
418
+ for method, capability in [("terminal.open", "terminal.enabled"), ("skill.install", "skills.install"), ("workspace.backup", "workspace.backup")]:
419
+ with pytest.raises(bx.RPCError) as error:
420
+ await executor._call(method, {}) # noqa: SLF001
421
+ assert error.value.code == JsonRpcErrorCode.CapabilityUnavailable, method
422
+ assert error.value.data == {"capability": capability}, method
423
+ with pytest.raises(bx.RPCError) as unknown:
424
+ await executor._call("vendor.unknown", {}) # noqa: SLF001
425
+ assert unknown.value.code == JsonRpcErrorCode.MethodNotFound
426
+ await client.stop()