agentconnect-cli 0.1.0a1__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.
- agentconnect/__init__.py +3 -0
- agentconnect/a2a_adapter/__init__.py +6 -0
- agentconnect/a2a_adapter/adapter.py +565 -0
- agentconnect/a2a_adapter/cards.py +149 -0
- agentconnect/a2a_adapter/convert.py +157 -0
- agentconnect/a2a_adapter/facade.py +560 -0
- agentconnect/a2a_adapter/seen.py +49 -0
- agentconnect/a2a_adapter/serve.py +67 -0
- agentconnect/adapter.py +319 -0
- agentconnect/adapters.py +52 -0
- agentconnect/apiclient.py +51 -0
- agentconnect/backoff.py +42 -0
- agentconnect/callback.py +314 -0
- agentconnect/cli.py +2324 -0
- agentconnect/cli_json.py +470 -0
- agentconnect/cli_support.py +444 -0
- agentconnect/clock.py +161 -0
- agentconnect/config.py +1213 -0
- agentconnect/daemon/__init__.py +41 -0
- agentconnect/deliveries.py +295 -0
- agentconnect/directory_client.py +255 -0
- agentconnect/failpoints.py +99 -0
- agentconnect/identity.py +111 -0
- agentconnect/isolation.py +345 -0
- agentconnect/keystore.py +279 -0
- agentconnect/limits.py +457 -0
- agentconnect/log.py +143 -0
- agentconnect/mcp/__init__.py +30 -0
- agentconnect/mcp/backend.py +405 -0
- agentconnect/mcp/server.py +382 -0
- agentconnect/mcp/session.py +373 -0
- agentconnect/mcp/tools.py +583 -0
- agentconnect/ownerfile.py +238 -0
- agentconnect/payloads.py +109 -0
- agentconnect/policy.py +1066 -0
- agentconnect/provision.py +239 -0
- agentconnect/py.typed +0 -0
- agentconnect/relay.py +405 -0
- agentconnect/runtime/__init__.py +46 -0
- agentconnect/runtime/agent.py +225 -0
- agentconnect/runtime/api.py +2043 -0
- agentconnect/runtime/engine.py +5359 -0
- agentconnect/runtime/errors.py +47 -0
- agentconnect/runtime/floor.py +649 -0
- agentconnect/runtime/groups.py +1351 -0
- agentconnect/runtime/knocks.py +1422 -0
- agentconnect/runtime/ledger.py +94 -0
- agentconnect/runtime/listing.py +1307 -0
- agentconnect/runtime/registry.py +53 -0
- agentconnect/runtime/runtime.py +158 -0
- agentconnect/runtime/sas.py +1002 -0
- agentconnect/sas_emoji.py +83 -0
- agentconnect/schemas.py +381 -0
- agentconnect/shapes.py +56 -0
- agentconnect/sockets.py +86 -0
- agentconnect/sse.py +234 -0
- agentconnect/store.py +3282 -0
- agentconnect/tasks.py +35 -0
- agentconnect/tokens.py +63 -0
- agentconnect/webhook.py +199 -0
- agentconnect_cli-0.1.0a1.dist-info/METADATA +103 -0
- agentconnect_cli-0.1.0a1.dist-info/RECORD +64 -0
- agentconnect_cli-0.1.0a1.dist-info/WHEEL +4 -0
- agentconnect_cli-0.1.0a1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Errors of the runtime's operations, and how each maps to an API answer.
|
|
2
|
+
|
|
3
|
+
The local API and the embedded SDK both turn a failed operation into the
|
|
4
|
+
same ``(status, code, message)``, so a caller sees the same error whichever
|
|
5
|
+
host it uses.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from agentconnect.relay import RelayError
|
|
11
|
+
from agentconnect.runtime.engine import DaemonError
|
|
12
|
+
|
|
13
|
+
ERROR_STATUS = {
|
|
14
|
+
"bad_request": 400,
|
|
15
|
+
"wrong_relay": 400,
|
|
16
|
+
"forbidden": 403,
|
|
17
|
+
"not_permitted": 403,
|
|
18
|
+
"not_found": 404,
|
|
19
|
+
"group_full": 409,
|
|
20
|
+
"expired": 409,
|
|
21
|
+
"stale_epoch": 409,
|
|
22
|
+
"invite_not_open": 409,
|
|
23
|
+
"not_moderated": 409,
|
|
24
|
+
"too_large": 413,
|
|
25
|
+
"rate_limited": 429,
|
|
26
|
+
"relay": 502,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ApiError(Exception):
|
|
31
|
+
"""A refused request: an HTTP ``status`` and a short ``code``."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, status: int, code: str, message: str) -> None:
|
|
34
|
+
super().__init__(message)
|
|
35
|
+
self.status, self.code = status, code
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def error_reply(e: Exception) -> tuple[int, str, str] | None:
|
|
39
|
+
"""``(status, code, message)`` for an operation's error, or ``None`` for
|
|
40
|
+
an unexpected one (a bug: the caller logs it and answers 500)."""
|
|
41
|
+
if isinstance(e, ApiError):
|
|
42
|
+
return e.status, e.code, str(e)
|
|
43
|
+
if isinstance(e, DaemonError):
|
|
44
|
+
return ERROR_STATUS.get(e.code, 409), e.code, str(e)
|
|
45
|
+
if isinstance(e, RelayError):
|
|
46
|
+
return 502, e.code, str(e)
|
|
47
|
+
return None
|