meshagent-cli 0.5.18__py3-none-any.whl → 0.6.0__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.
Potentially problematic release.
This version of meshagent-cli might be problematic. Click here for more details.
- meshagent/cli/agent.py +11 -62
- meshagent/cli/api_keys.py +46 -93
- meshagent/cli/auth_async.py +225 -68
- meshagent/cli/call.py +82 -19
- meshagent/cli/chatbot.py +83 -49
- meshagent/cli/cli.py +26 -70
- meshagent/cli/cli_mcp.py +61 -27
- meshagent/cli/cli_secrets.py +1 -1
- meshagent/cli/common_options.py +2 -10
- meshagent/cli/containers.py +577 -0
- meshagent/cli/developer.py +7 -25
- meshagent/cli/exec.py +162 -76
- meshagent/cli/helper.py +35 -67
- meshagent/cli/helpers.py +131 -0
- meshagent/cli/mailbot.py +31 -26
- meshagent/cli/meeting_transcriber.py +124 -0
- meshagent/cli/messaging.py +12 -51
- meshagent/cli/oauth2.py +189 -0
- meshagent/cli/participant_token.py +32 -21
- meshagent/cli/queue.py +6 -37
- meshagent/cli/services.py +300 -335
- meshagent/cli/storage.py +24 -89
- meshagent/cli/version.py +1 -1
- meshagent/cli/voicebot.py +39 -28
- meshagent/cli/webhook.py +3 -3
- {meshagent_cli-0.5.18.dist-info → meshagent_cli-0.6.0.dist-info}/METADATA +17 -11
- meshagent_cli-0.6.0.dist-info/RECORD +35 -0
- meshagent/cli/otel.py +0 -122
- meshagent_cli-0.5.18.dist-info/RECORD +0 -32
- {meshagent_cli-0.5.18.dist-info → meshagent_cli-0.6.0.dist-info}/WHEEL +0 -0
- {meshagent_cli-0.5.18.dist-info → meshagent_cli-0.6.0.dist-info}/entry_points.txt +0 -0
- {meshagent_cli-0.5.18.dist-info → meshagent_cli-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import typer
|
|
2
2
|
from rich import print
|
|
3
3
|
from typing import Annotated
|
|
4
|
-
from meshagent.cli.common_options import ProjectIdOption, ApiKeyIdOption, RoomOption
|
|
5
4
|
from meshagent.api import ParticipantToken
|
|
6
|
-
from meshagent.cli.helper import resolve_project_id, resolve_api_key, resolve_room
|
|
7
5
|
from meshagent.cli import async_typer
|
|
8
|
-
from meshagent.cli.helper import get_client
|
|
6
|
+
from meshagent.cli.helper import get_client, resolve_key, resolve_project_id
|
|
9
7
|
import pathlib
|
|
8
|
+
from typing import Optional
|
|
9
|
+
from meshagent.api.participant_token import ParticipantTokenSpec
|
|
10
|
+
from pydantic_yaml import parse_yaml_raw_as
|
|
11
|
+
from meshagent.cli.common_options import ProjectIdOption
|
|
10
12
|
|
|
11
13
|
app = async_typer.AsyncTyper()
|
|
12
14
|
|
|
@@ -15,35 +17,44 @@ app = async_typer.AsyncTyper()
|
|
|
15
17
|
async def generate(
|
|
16
18
|
*,
|
|
17
19
|
project_id: ProjectIdOption = None,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
output: Annotated[
|
|
21
|
+
Optional[str],
|
|
22
|
+
typer.Option("--output", "-o", help="File path to a file"),
|
|
23
|
+
] = None,
|
|
24
|
+
input: Annotated[
|
|
25
|
+
str,
|
|
26
|
+
typer.Option("--input", "-i", help="File path to a token spec"),
|
|
27
|
+
],
|
|
28
|
+
key: Annotated[
|
|
29
|
+
str,
|
|
30
|
+
typer.Option("--key", help="an api key to sign the token with"),
|
|
31
|
+
] = None,
|
|
23
32
|
):
|
|
33
|
+
project_id = await resolve_project_id(project_id=project_id)
|
|
34
|
+
key = await resolve_key(project_id=project_id, key=key)
|
|
35
|
+
|
|
24
36
|
client = await get_client()
|
|
25
37
|
try:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
room = resolve_room(room)
|
|
29
|
-
key = (
|
|
30
|
-
await client.decrypt_project_api_key(project_id=project_id, id=api_key_id)
|
|
31
|
-
)["token"]
|
|
38
|
+
with open(str(pathlib.Path(input).expanduser().resolve()), "rb") as f:
|
|
39
|
+
spec = parse_yaml_raw_as(ParticipantTokenSpec, f.read())
|
|
32
40
|
|
|
33
41
|
token = ParticipantToken(
|
|
34
|
-
name=
|
|
42
|
+
name=spec.identity,
|
|
35
43
|
)
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
if spec.role is not None:
|
|
46
|
+
token.add_role_grant(role=spec.role)
|
|
47
|
+
if spec.room is not None:
|
|
48
|
+
token.add_room_grant(spec.room)
|
|
38
49
|
|
|
39
|
-
token.
|
|
50
|
+
token.add_api_grant(spec.api)
|
|
40
51
|
|
|
41
|
-
if
|
|
42
|
-
print(token.to_jwt(
|
|
52
|
+
if output is None:
|
|
53
|
+
print(token.to_jwt(api_key=key))
|
|
43
54
|
|
|
44
55
|
else:
|
|
45
|
-
pathlib.Path(
|
|
46
|
-
token.to_jwt(
|
|
56
|
+
pathlib.Path(output).expanduser().resolve().write_text(
|
|
57
|
+
token.to_jwt(api_key=key)
|
|
47
58
|
)
|
|
48
59
|
|
|
49
60
|
finally:
|
meshagent/cli/queue.py
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import typer
|
|
2
2
|
from rich import print
|
|
3
3
|
from typing import Annotated, Optional
|
|
4
|
-
from meshagent.cli.common_options import ProjectIdOption,
|
|
4
|
+
from meshagent.cli.common_options import ProjectIdOption, RoomOption
|
|
5
5
|
import json as _json
|
|
6
6
|
|
|
7
7
|
from meshagent.api.helpers import meshagent_base_url, websocket_room_url
|
|
8
8
|
from meshagent.api import (
|
|
9
9
|
RoomClient,
|
|
10
|
-
ParticipantToken,
|
|
11
10
|
WebSocketClientProtocol,
|
|
12
11
|
RoomException,
|
|
13
12
|
)
|
|
14
|
-
from meshagent.cli.helper import resolve_project_id,
|
|
13
|
+
from meshagent.cli.helper import resolve_project_id, resolve_room
|
|
15
14
|
from meshagent.cli import async_typer
|
|
16
15
|
from meshagent.cli.helper import get_client
|
|
17
16
|
|
|
@@ -23,9 +22,6 @@ async def send(
|
|
|
23
22
|
*,
|
|
24
23
|
project_id: ProjectIdOption = None,
|
|
25
24
|
room: RoomOption,
|
|
26
|
-
api_key_id: ApiKeyIdOption = None,
|
|
27
|
-
name: Annotated[str, typer.Option(..., help="Participant name")] = "cli",
|
|
28
|
-
role: str = "user",
|
|
29
25
|
queue: Annotated[str, typer.Option(..., help="Queue name")],
|
|
30
26
|
json: Optional[str] = typer.Option(..., help="a JSON message to send to the queue"),
|
|
31
27
|
file: Annotated[
|
|
@@ -36,27 +32,15 @@ async def send(
|
|
|
36
32
|
account_client = await get_client()
|
|
37
33
|
try:
|
|
38
34
|
project_id = await resolve_project_id(project_id=project_id)
|
|
39
|
-
api_key_id = await resolve_api_key(project_id, api_key_id)
|
|
40
35
|
room = resolve_room(room)
|
|
41
36
|
|
|
42
|
-
|
|
43
|
-
await account_client.decrypt_project_api_key(
|
|
44
|
-
project_id=project_id, id=api_key_id
|
|
45
|
-
)
|
|
46
|
-
)["token"]
|
|
47
|
-
|
|
48
|
-
token = ParticipantToken(
|
|
49
|
-
name=name, project_id=project_id, api_key_id=api_key_id
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
token.add_role_grant(role=role)
|
|
53
|
-
token.add_room_grant(room)
|
|
37
|
+
connection = await account_client.connect_room(project_id=project_id, room=room)
|
|
54
38
|
|
|
55
39
|
print("[bold green]Connecting to room...[/bold green]")
|
|
56
40
|
async with RoomClient(
|
|
57
41
|
protocol=WebSocketClientProtocol(
|
|
58
42
|
url=websocket_room_url(room_name=room, base_url=meshagent_base_url()),
|
|
59
|
-
token=
|
|
43
|
+
token=connection.jwt,
|
|
60
44
|
)
|
|
61
45
|
) as client:
|
|
62
46
|
if file is not None:
|
|
@@ -78,34 +62,19 @@ async def receive(
|
|
|
78
62
|
*,
|
|
79
63
|
project_id: ProjectIdOption = None,
|
|
80
64
|
room: RoomOption,
|
|
81
|
-
api_key_id: ApiKeyIdOption = None,
|
|
82
|
-
name: Annotated[str, typer.Option(..., help="Participant name")] = "cli",
|
|
83
|
-
role: str = "user",
|
|
84
65
|
queue: Annotated[str, typer.Option(..., help="Queue name")],
|
|
85
66
|
):
|
|
86
67
|
account_client = await get_client()
|
|
87
68
|
try:
|
|
88
69
|
project_id = await resolve_project_id(project_id=project_id)
|
|
89
|
-
api_key_id = await resolve_api_key(project_id, api_key_id)
|
|
90
70
|
room = resolve_room(room)
|
|
91
71
|
|
|
92
|
-
|
|
93
|
-
await account_client.decrypt_project_api_key(
|
|
94
|
-
project_id=project_id, id=api_key_id
|
|
95
|
-
)
|
|
96
|
-
)["token"]
|
|
97
|
-
|
|
98
|
-
token = ParticipantToken(
|
|
99
|
-
name=name, project_id=project_id, api_key_id=api_key_id
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
token.add_role_grant(role=role)
|
|
103
|
-
token.add_room_grant(room)
|
|
72
|
+
connection = await account_client.connect_room(project_id=project_id, room=room)
|
|
104
73
|
|
|
105
74
|
async with RoomClient(
|
|
106
75
|
protocol=WebSocketClientProtocol(
|
|
107
76
|
url=websocket_room_url(room_name=room, base_url=meshagent_base_url()),
|
|
108
|
-
token=
|
|
77
|
+
token=connection.jwt,
|
|
109
78
|
)
|
|
110
79
|
) as client:
|
|
111
80
|
response = await client.queues.receive(name=queue, wait=False)
|