meshagent-cli 0.7.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.
@@ -0,0 +1 @@
1
+ __version__ = "0.7.0"
@@ -0,0 +1,178 @@
1
+ import typer
2
+ from rich import print
3
+ from typing import Annotated, Optional
4
+ from meshagent.cli.common_options import ProjectIdOption, RoomOption
5
+ from meshagent.api import RoomClient, WebSocketClientProtocol, RoomException
6
+ from meshagent.api.helpers import meshagent_base_url, websocket_room_url
7
+ from meshagent.cli import async_typer
8
+ from meshagent.api import ParticipantToken, ApiScope
9
+ from meshagent.cli.helper import (
10
+ get_client,
11
+ resolve_project_id,
12
+ resolve_room,
13
+ resolve_key,
14
+ )
15
+ from typing import List
16
+
17
+ from meshagent.api import RequiredToolkit, RequiredSchema
18
+ from meshagent.api.services import ServiceHost
19
+ from pathlib import Path
20
+
21
+
22
+ app = async_typer.AsyncTyper(help="Join a voicebot to a room")
23
+
24
+
25
+ @app.async_command("join")
26
+ async def make_call(
27
+ *,
28
+ project_id: ProjectIdOption = None,
29
+ room: RoomOption,
30
+ agent_name: Annotated[str, typer.Option(..., help="Name of the agent to call")],
31
+ rule: Annotated[List[str], typer.Option("--rule", "-r", help="a system rule")] = [],
32
+ rules_file: Optional[str] = None,
33
+ toolkit: Annotated[
34
+ List[str],
35
+ typer.Option("--toolkit", "-t", help="the name or url of a required toolkit"),
36
+ ] = [],
37
+ schema: Annotated[
38
+ List[str],
39
+ typer.Option("--schema", "-s", help="the name or url of a required schema"),
40
+ ] = [],
41
+ auto_greet_message: Annotated[Optional[str], typer.Option()] = None,
42
+ auto_greet_prompt: Annotated[Optional[str], typer.Option()] = None,
43
+ key: Annotated[
44
+ str,
45
+ typer.Option("--key", help="an api key to sign the token with"),
46
+ ] = None,
47
+ ):
48
+ try:
49
+ from meshagent.livekit.agents.voice import VoiceBot
50
+ except ImportError:
51
+
52
+ class VoiceBot:
53
+ def __init__(self, **kwargs):
54
+ raise RoomException(
55
+ "meshagent.livekit module not found, voicebots are not available"
56
+ )
57
+
58
+ key = await resolve_key(project_id=project_id, key=key)
59
+
60
+ account_client = await get_client()
61
+ try:
62
+ project_id = await resolve_project_id(project_id=project_id)
63
+ room = resolve_room(room)
64
+
65
+ token = ParticipantToken(
66
+ name=agent_name,
67
+ )
68
+
69
+ token.add_api_grant(ApiScope.agent_default())
70
+
71
+ token.add_role_grant(role="agent")
72
+ token.add_room_grant(room)
73
+
74
+ jwt = token.to_jwt(api_key=key)
75
+ if rules_file is not None:
76
+ try:
77
+ with open(Path(rules_file).resolve(), "r") as f:
78
+ rule.extend(f.read().splitlines())
79
+ except FileNotFoundError:
80
+ print(f"[yellow]rules file not found at {rules_file}[/yellow]")
81
+
82
+ print("[bold green]Connecting to room...[/bold green]", flush=True)
83
+ async with RoomClient(
84
+ protocol=WebSocketClientProtocol(
85
+ url=websocket_room_url(room_name=room, base_url=meshagent_base_url()),
86
+ token=jwt,
87
+ )
88
+ ) as client:
89
+ requirements = []
90
+
91
+ for t in toolkit:
92
+ requirements.append(RequiredToolkit(name=t))
93
+
94
+ for t in schema:
95
+ requirements.append(RequiredSchema(name=t))
96
+
97
+ bot = VoiceBot(
98
+ auto_greet_message=auto_greet_message,
99
+ auto_greet_prompt=auto_greet_prompt,
100
+ name=agent_name,
101
+ requires=requirements,
102
+ rules=rule if len(rule) > 0 else None,
103
+ )
104
+
105
+ await bot.start(room=client)
106
+
107
+ try:
108
+ print(
109
+ f"[bold green]Open the studio to interact with your agent: {meshagent_base_url().replace('api.', 'studio.')}/projects/{project_id}/rooms/{client.room_name}[/bold green]",
110
+ flush=True,
111
+ )
112
+ await client.protocol.wait_for_close()
113
+ except KeyboardInterrupt:
114
+ await bot.stop()
115
+
116
+ finally:
117
+ await account_client.close()
118
+
119
+
120
+ @app.async_command("service")
121
+ async def service(
122
+ *,
123
+ agent_name: Annotated[str, typer.Option(..., help="Name of the agent to call")],
124
+ rule: Annotated[List[str], typer.Option("--rule", "-r", help="a system rule")] = [],
125
+ rules_file: Optional[str] = None,
126
+ toolkit: Annotated[
127
+ List[str],
128
+ typer.Option("--toolkit", "-t", help="the name or url of a required toolkit"),
129
+ ] = [],
130
+ schema: Annotated[
131
+ List[str],
132
+ typer.Option("--schema", "-s", help="the name or url of a required schema"),
133
+ ] = [],
134
+ auto_greet_message: Annotated[Optional[str], typer.Option()] = None,
135
+ auto_greet_prompt: Annotated[Optional[str], typer.Option()] = None,
136
+ host: Annotated[Optional[str], typer.Option()] = None,
137
+ port: Annotated[Optional[int], typer.Option()] = None,
138
+ path: Annotated[str, typer.Option()] = "/agent",
139
+ ):
140
+ try:
141
+ from meshagent.livekit.agents.voice import VoiceBot
142
+ except ImportError:
143
+
144
+ class VoiceBot:
145
+ def __init__(self, **kwargs):
146
+ raise RoomException(
147
+ "meshagent.livekit module not found, voicebots are not available"
148
+ )
149
+
150
+ requirements = []
151
+
152
+ for t in toolkit:
153
+ requirements.append(RequiredToolkit(name=t))
154
+
155
+ for t in schema:
156
+ requirements.append(RequiredSchema(name=t))
157
+
158
+ if rules_file is not None:
159
+ try:
160
+ with open(Path(rules_file).resolve(), "r") as f:
161
+ rule.extend(f.read().splitlines())
162
+ except FileNotFoundError:
163
+ print(f"[yellow]rules file not found at {rules_file}[/yellow]")
164
+
165
+ service = ServiceHost(host=host, port=port)
166
+
167
+ @service.path(path=path)
168
+ class CustomVoiceBot(VoiceBot):
169
+ def __init__(self):
170
+ super().__init__(
171
+ auto_greet_message=auto_greet_message,
172
+ auto_greet_prompt=auto_greet_prompt,
173
+ name=agent_name,
174
+ requires=requirements,
175
+ rules=rule if len(rule) > 0 else None,
176
+ )
177
+
178
+ await service.run()
@@ -0,0 +1,100 @@
1
+ import typer
2
+ from rich import print
3
+ import json
4
+ from typing import Annotated, List, Optional
5
+ from meshagent.cli.common_options import ProjectIdOption
6
+
7
+ from meshagent.cli import async_typer
8
+ from meshagent.cli.helper import get_client, print_json_table, resolve_project_id
9
+
10
+ app = async_typer.AsyncTyper()
11
+
12
+ # ---------------------------------------------------------------------------
13
+ # Webhook commands
14
+ # ---------------------------------------------------------------------------
15
+
16
+
17
+ @app.async_command("create")
18
+ async def webhook_create(
19
+ *,
20
+ project_id: ProjectIdOption = None,
21
+ name: Annotated[str, typer.Option(help="Friendly name for the webhook")],
22
+ url: Annotated[str, typer.Option(help="Target URL that will receive POSTs")],
23
+ event: Annotated[
24
+ List[str],
25
+ typer.Option(
26
+ "-e", "--event", help="Event to subscribe to (repeat for multiple)."
27
+ ),
28
+ ],
29
+ description: Annotated[
30
+ str, typer.Option(default="", help="Optional description")
31
+ ] = "",
32
+ action: Annotated[
33
+ Optional[str],
34
+ typer.Option("--action", help="Optional action name delivered with each call"),
35
+ ] = None,
36
+ payload: Annotated[
37
+ Optional[str],
38
+ typer.Option(
39
+ "--payload",
40
+ help="Optional JSON string sent as the body (merged with event payload).",
41
+ ),
42
+ ] = None,
43
+ ):
44
+ """Create a new project webhook."""
45
+ client = await get_client()
46
+ try:
47
+ project_id = await resolve_project_id(project_id=project_id)
48
+
49
+ payload_obj = json.loads(payload) if payload else None
50
+ webhook = await client.create_webhook(
51
+ project_id=project_id,
52
+ name=name,
53
+ url=url,
54
+ events=event,
55
+ description=description,
56
+ action=action,
57
+ payload=payload_obj,
58
+ )
59
+ print_json_table([webhook])
60
+ finally:
61
+ await client.close()
62
+
63
+
64
+ @app.async_command("list")
65
+ async def webhook_list(
66
+ *,
67
+ project_id: ProjectIdOption = None,
68
+ ):
69
+ """List all webhooks for the project."""
70
+ client = await get_client()
71
+ try:
72
+ project_id = await resolve_project_id(project_id=project_id)
73
+ hooks = await client.list_webhooks(project_id)
74
+ print_json_table(
75
+ hooks.get("webhooks"),
76
+ "id",
77
+ "name",
78
+ "description",
79
+ "url",
80
+ "events",
81
+ "action",
82
+ )
83
+ finally:
84
+ await client.close()
85
+
86
+
87
+ @app.async_command("delete")
88
+ async def webhook_delete(
89
+ *,
90
+ project_id: ProjectIdOption = None,
91
+ webhook_id: Annotated[str, typer.Argument(help="ID of the webhook to delete")],
92
+ ):
93
+ """Delete a project webhook."""
94
+ client = await get_client()
95
+ try:
96
+ project_id = await resolve_project_id(project_id=project_id)
97
+ await client.delete_webhook(project_id, webhook_id)
98
+ print(f"[green]Webhook {webhook_id} deleted.[/]")
99
+ finally:
100
+ await client.close()
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: meshagent-cli
3
+ Version: 0.7.0
4
+ Summary: CLI for Meshagent
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Documentation, https://docs.meshagent.com
7
+ Project-URL: Website, https://www.meshagent.com
8
+ Project-URL: Source, https://www.meshagent.com
9
+ Requires-Python: >=3.13
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: typer~=0.15
12
+ Requires-Dist: fastmcp~=2.8
13
+ Requires-Dist: opentelemetry-distro~=0.54b1
14
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http~=1.33
15
+ Requires-Dist: art~=6.5
16
+ Requires-Dist: pydantic-yaml~=1.5
17
+ Requires-Dist: pathspec~=0.12.1
18
+ Provides-Extra: all
19
+ Requires-Dist: meshagent-agents[all]~=0.7.0; extra == "all"
20
+ Requires-Dist: meshagent-api[all]~=0.7.0; extra == "all"
21
+ Requires-Dist: meshagent-computers~=0.7.0; extra == "all"
22
+ Requires-Dist: meshagent-openai~=0.7.0; extra == "all"
23
+ Requires-Dist: meshagent-mcp~=0.7.0; extra == "all"
24
+ Requires-Dist: meshagent-tools~=0.7.0; extra == "all"
25
+ Requires-Dist: supabase-auth~=2.12.3; extra == "all"
26
+ Provides-Extra: mcp-service
27
+ Requires-Dist: meshagent-agents[all]~=0.7.0; extra == "mcp-service"
28
+ Requires-Dist: meshagent-api~=0.7.0; extra == "mcp-service"
29
+ Requires-Dist: meshagent-mcp~=0.7.0; extra == "mcp-service"
30
+ Requires-Dist: meshagent-tools~=0.7.0; extra == "mcp-service"
31
+ Requires-Dist: supabase-auth~=2.12.3; extra == "mcp-service"
32
+
33
+ # [Meshagent](https://www.meshagent.com)
34
+
35
+ ## MeshAgent CLI
36
+
37
+ The ``meshagent.cli`` package installs everything you need to streamline room and agent management from your terminal. The CLI assembles submodules for authentication, projects, API keys, participant tokens, messaging, storage, agents, webhooks, and more.
38
+ Check out the [CLI Quickstart](https://docs.meshagent.com/cli/getting_started) for more details.
39
+
40
+ ---
41
+ ### Learn more about MeshAgent on our website or check out the docs for additional examples!
42
+
43
+ **Website**: [www.meshagent.com](https://www.meshagent.com/)
44
+
45
+ **Documentation**: [docs.meshagent.com](https://docs.meshagent.com/)
46
+
47
+ ---
@@ -0,0 +1,36 @@
1
+ meshagent/cli/__init__.py,sha256=X78Z4yEg5XfkNKH0HiIdG4k1q5ktB-ampTuXHLNFrAw,58
2
+ meshagent/cli/agent.py,sha256=CKH8XkRJ4oeu2hbG-FL8tWXtDn2tYDvTSCxSvQ0sCIY,8976
3
+ meshagent/cli/api_keys.py,sha256=2_-TB0a1vca4uG-RG4zc0_c9QTJ8EHt3qomy2wfKlXE,3192
4
+ meshagent/cli/async_typer.py,sha256=GCeSefBDbpd-V4V8LrvHGUTBMth3HspVMfFa-HUZ0cg,898
5
+ meshagent/cli/auth.py,sha256=wpGTomrFH0uvbwv262sTqK0DgB4ltAuurEmI9tYedIs,815
6
+ meshagent/cli/auth_async.py,sha256=Ce0h_V3tNlZBvplQuhy2uRP9PJvhi6k_vUGh3GMNL-E,9277
7
+ meshagent/cli/call.py,sha256=ydxEnX7uPZ9B2-ND1LvBt4Leb2K8whhmdogRIsCydnw,7315
8
+ meshagent/cli/chatbot.py,sha256=sui_h2XtBhjOUglQkyM9e2il8v5YGiN-jVFOuoQEq7w,20437
9
+ meshagent/cli/cli.py,sha256=XGfLfCp0vQatVY2tavrh9uZfoXJIdINXRSTd2rhN3EE,5581
10
+ meshagent/cli/cli_mcp.py,sha256=d3N37rZ-CMFouk9jxJRe8CIUprv_nExiata8Ni8OKsQ,11259
11
+ meshagent/cli/cli_secrets.py,sha256=_hxEe93YJaJczWZXbMxS-qiedMpwGLC3ez-YUnjqudM,13713
12
+ meshagent/cli/common_options.py,sha256=79OnCgiBLhExf-_l18R3dkLidoND5BPJD2NY7gAtl00,573
13
+ meshagent/cli/containers.py,sha256=s9xuxjT_jLLmML3cuxBeLi8HE2w0lI3wRgVk8COOM3w,17573
14
+ meshagent/cli/developer.py,sha256=2nWCX9lqtTd__i6qDJOOJtI0kB4X185s_3Ktfx5MaRQ,2251
15
+ meshagent/cli/exec.py,sha256=fZpRvvTJC5bUBpaUCOFFJuaZDuyIPz5r42-bxtwDWhM,15647
16
+ meshagent/cli/helper.py,sha256=RLUJxNJ1aDx4fij61ps_s0NGXwYVcp_Ek6n1ChHM3HM,3961
17
+ meshagent/cli/helpers.py,sha256=9JSZiWOnVkh0qfM3DKcvz4u83EJ34DBdukx2Ple9V94,4783
18
+ meshagent/cli/mailbot.py,sha256=CSkRY6fX2t6Izbz5uJN6GQhMPDGcPJxtGkX4VQwn4MI,8529
19
+ meshagent/cli/meeting_transcriber.py,sha256=Eo4itFxwQvMoz-IBN4hMA7PMVsU81uUsYSnmCyZK9QA,3834
20
+ meshagent/cli/messaging.py,sha256=guzaFxtmApLJ0p6RCqiHstk-md2NGW3FLTu-Pzwdo5Q,5278
21
+ meshagent/cli/oauth2.py,sha256=-ArxgO7KAjowanp8KcHlSEnVpemzm49fSov6wrKOe0o,6193
22
+ meshagent/cli/participant_token.py,sha256=zdNDviXfChhvbVyWukJt4CNvi7nVIl5nJChST_qCjaI,1778
23
+ meshagent/cli/projects.py,sha256=-s5xIfd2pCW8HsuqRsNoKZr5hsF6xYxfEjyYI6Nm4YI,3511
24
+ meshagent/cli/queue.py,sha256=DauqjVul7v6dLHQ_t3C-Pqmrgvjg093FHCRsD5Yf3bg,2937
25
+ meshagent/cli/room.py,sha256=TddjQn_cg0JSDou-x-dmbavHfUO28m48XFtbh3w3VGM,6472
26
+ meshagent/cli/services.py,sha256=GZA40INO9bOZMoKAw0u_qTtD2inGEJAX4aqXqUuSt3Y,14908
27
+ meshagent/cli/sessions.py,sha256=bUwrPkzeEWE8gTqD4E-tfr2ChBns3Fvv9MsSV4RRNTQ,881
28
+ meshagent/cli/storage.py,sha256=0pSrviBM53-2xFlD1ZW4rDthJ-CwUD5tQC43FcaU5sU,32541
29
+ meshagent/cli/version.py,sha256=RaANGbRu5e-vehwXI1-Qe2ggPPfs1TQaZj072JdbLk4,22
30
+ meshagent/cli/voicebot.py,sha256=t8sqygbXPbasfCf6cDDTGxZWHD3KeuBZhYDkV0k-wQI,6003
31
+ meshagent/cli/webhook.py,sha256=g2vqt3fKQ5HQ2miXZbekjyZ_NODsyRTYIgWEni5bDP0,2971
32
+ meshagent_cli-0.7.0.dist-info/METADATA,sha256=b6iXHJhspTKa5uX26-8j3YRRiNIxnVBvKUYl3Cb_8Mc,1976
33
+ meshagent_cli-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
34
+ meshagent_cli-0.7.0.dist-info/entry_points.txt,sha256=WRcGGN4vMtvC5Pgl3uRFqsJiQXNoHuLLa-TCSY3gAhQ,52
35
+ meshagent_cli-0.7.0.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
36
+ meshagent_cli-0.7.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ meshagent = meshagent.cli.cli:app
@@ -0,0 +1 @@
1
+ meshagent