meshagent-cli 0.0.34__py3-none-any.whl → 0.0.36__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/auth_async.py +1 -1
- meshagent/cli/chatbot.py +91 -61
- meshagent/cli/cli.py +136 -0
- meshagent/cli/otel.py +118 -0
- meshagent/cli/tty.py +2 -2
- meshagent/cli/version.py +1 -1
- meshagent/cli/voicebot.py +1 -1
- meshagent_cli-0.0.36.dist-info/METADATA +28 -0
- {meshagent_cli-0.0.34.dist-info → meshagent_cli-0.0.36.dist-info}/RECORD +12 -11
- meshagent_cli-0.0.34.dist-info/METADATA +0 -26
- {meshagent_cli-0.0.34.dist-info → meshagent_cli-0.0.36.dist-info}/WHEEL +0 -0
- {meshagent_cli-0.0.34.dist-info → meshagent_cli-0.0.36.dist-info}/entry_points.txt +0 -0
- {meshagent_cli-0.0.34.dist-info → meshagent_cli-0.0.36.dist-info}/top_level.txt +0 -0
meshagent/cli/auth_async.py
CHANGED
|
@@ -58,7 +58,7 @@ async def _wait_for_code() -> str:
|
|
|
58
58
|
return web.Response(status=400)
|
|
59
59
|
|
|
60
60
|
app.add_routes([web.get("/callback", callback)])
|
|
61
|
-
runner = web.AppRunner(app)
|
|
61
|
+
runner = web.AppRunner(app, access_log=None)
|
|
62
62
|
await runner.setup()
|
|
63
63
|
site = web.TCPSite(runner, "localhost", REDIRECT_PORT)
|
|
64
64
|
await site.start()
|
meshagent/cli/chatbot.py
CHANGED
|
@@ -11,7 +11,7 @@ from meshagent.agents.chat import ChatBot
|
|
|
11
11
|
from meshagent.openai import OpenAIResponsesAdapter
|
|
12
12
|
from meshagent.openai.tools.responses_adapter import LocalShellTool
|
|
13
13
|
from meshagent.api.services import ServiceHost
|
|
14
|
-
|
|
14
|
+
from meshagent.computers.agent import ComputerAgent
|
|
15
15
|
from meshagent.agents.chat import ChatBotThreadOpenAIImageGenerationTool
|
|
16
16
|
|
|
17
17
|
from typing import List
|
|
@@ -20,6 +20,77 @@ from meshagent.api import RequiredToolkit, RequiredSchema
|
|
|
20
20
|
|
|
21
21
|
app = async_typer.AsyncTyper()
|
|
22
22
|
|
|
23
|
+
|
|
24
|
+
def build_chatbot(*,
|
|
25
|
+
model: str,
|
|
26
|
+
agent_name: str,
|
|
27
|
+
rule: List[str],
|
|
28
|
+
toolkit: List[str],
|
|
29
|
+
schema: List[str],
|
|
30
|
+
image_generation: Optional[str] = None,
|
|
31
|
+
local_shell: bool,
|
|
32
|
+
computer_use: bool
|
|
33
|
+
):
|
|
34
|
+
|
|
35
|
+
requirements = []
|
|
36
|
+
|
|
37
|
+
toolkits = []
|
|
38
|
+
|
|
39
|
+
for t in toolkit:
|
|
40
|
+
requirements.append(RequiredToolkit(name=t))
|
|
41
|
+
|
|
42
|
+
for t in schema:
|
|
43
|
+
requirements.append(RequiredSchema(name=t))
|
|
44
|
+
|
|
45
|
+
BaseClass = ChatBot
|
|
46
|
+
if computer_use:
|
|
47
|
+
BaseClass = ComputerAgent
|
|
48
|
+
|
|
49
|
+
llm_adapter = OpenAIResponsesAdapter(
|
|
50
|
+
model=model,
|
|
51
|
+
response_options={
|
|
52
|
+
"reasoning" : {
|
|
53
|
+
"generate_summary" : "concise"
|
|
54
|
+
},
|
|
55
|
+
"truncation" : "auto"
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
llm_adapter = OpenAIResponsesAdapter(
|
|
60
|
+
model=model
|
|
61
|
+
)
|
|
62
|
+
class CustomChatbot(BaseClass):
|
|
63
|
+
def __init__(self):
|
|
64
|
+
super().__init__(
|
|
65
|
+
llm_adapter=llm_adapter,
|
|
66
|
+
name=agent_name,
|
|
67
|
+
requires=requirements,
|
|
68
|
+
toolkits=toolkits,
|
|
69
|
+
rules=rule if len(rule) > 0 else None
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
async def get_thread_toolkits(self, *, thread_context, participant):
|
|
73
|
+
toolkits = await super().get_thread_toolkits(thread_context=thread_context, participant=participant)
|
|
74
|
+
|
|
75
|
+
thread_toolkit = Toolkit(name="thread_toolkit", tools=[])
|
|
76
|
+
|
|
77
|
+
if local_shell:
|
|
78
|
+
thread_toolkit.tools.append(LocalShellTool())
|
|
79
|
+
|
|
80
|
+
if image_generation != None:
|
|
81
|
+
|
|
82
|
+
print("adding openai image gen to thread", flush=True)
|
|
83
|
+
thread_toolkit.tools.append(ChatBotThreadOpenAIImageGenerationTool(
|
|
84
|
+
model=image_generation,
|
|
85
|
+
thread_context=thread_context,
|
|
86
|
+
partial_images=3
|
|
87
|
+
))
|
|
88
|
+
|
|
89
|
+
toolkits.append(thread_toolkit)
|
|
90
|
+
return toolkits
|
|
91
|
+
|
|
92
|
+
return CustomChatbot
|
|
93
|
+
|
|
23
94
|
@app.async_command("join")
|
|
24
95
|
async def make_call(
|
|
25
96
|
*,
|
|
@@ -29,11 +100,15 @@ async def make_call(
|
|
|
29
100
|
name: Annotated[str, typer.Option(..., help="Participant name")] = "cli",
|
|
30
101
|
role: str = "agent",
|
|
31
102
|
agent_name: Annotated[str, typer.Option(..., help="Name of the agent to call")],
|
|
103
|
+
token_path: Annotated[Optional[str], typer.Option()] = None,
|
|
104
|
+
|
|
32
105
|
rule: Annotated[List[str], typer.Option("--rule", "-r", help="a system rule")] = [],
|
|
33
106
|
toolkit: Annotated[List[str], typer.Option("--toolkit", "-t", help="the name or url of a required toolkit")] = [],
|
|
34
|
-
schema: Annotated[List[str], typer.Option("--schema", "-s", help="the name or url of a required schema")] = [],
|
|
35
|
-
|
|
36
|
-
image_generation: Annotated[Optional[str], typer.Option(..., help="Name of an image gen
|
|
107
|
+
schema: Annotated[List[str], typer.Option("--schema", "-s", help="the name or url of a required schema")] = [],
|
|
108
|
+
model: Annotated[str, typer.Option(..., help="Name of the LLM model to use for the chatbot")] = "gpt-4o",
|
|
109
|
+
image_generation: Annotated[Optional[str], typer.Option(..., help="Name of an image gen model")] = None,
|
|
110
|
+
computer_use: Annotated[Optional[bool], typer.Option(..., help="Enable computer use (requires computer-use-preview model)")] = False,
|
|
111
|
+
local_shell: Annotated[Optional[bool], typer.Option(..., help="Enable local shell tool calling")] = False,
|
|
37
112
|
):
|
|
38
113
|
account_client = await get_client()
|
|
39
114
|
try:
|
|
@@ -43,10 +118,12 @@ async def make_call(
|
|
|
43
118
|
room = resolve_room(room)
|
|
44
119
|
jwt = await resolve_token_jwt(project_id=project_id, api_key_id=api_key_id, token_path=token_path, name=name, role=role, room=room)
|
|
45
120
|
|
|
46
|
-
print("[bold green]Connecting to room...[/bold green]")
|
|
121
|
+
print("[bold green]Connecting to room...[/bold green]", flush=True)
|
|
47
122
|
async with RoomClient(
|
|
48
|
-
protocol=WebSocketClientProtocol(
|
|
49
|
-
|
|
123
|
+
protocol=WebSocketClientProtocol(
|
|
124
|
+
url=websocket_room_url(room_name=room, base_url=meshagent_base_url()),
|
|
125
|
+
token=jwt
|
|
126
|
+
)
|
|
50
127
|
) as client:
|
|
51
128
|
|
|
52
129
|
requirements = []
|
|
@@ -59,21 +136,7 @@ async def make_call(
|
|
|
59
136
|
for t in schema:
|
|
60
137
|
requirements.append(RequiredSchema(name=t))
|
|
61
138
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
async def get_thread_toolkits(self, *, thread_context, participant):
|
|
65
|
-
toolkits = await super().get_thread_toolkits(thread_context=thread_context, participant=participant)
|
|
66
|
-
|
|
67
|
-
thread_toolkit = Toolkit(name="thread_toolkit", tools=[])
|
|
68
|
-
if image_generation != None:
|
|
69
|
-
if image_generation == "openai":
|
|
70
|
-
print("adding openai image gen to thread")
|
|
71
|
-
thread_toolkit.tools.append(ChatBotThreadOpenAIImageGenerationTool(thread_context=thread_context, partial_images=3))
|
|
72
|
-
else:
|
|
73
|
-
raise Exception("image-generation must be openai")
|
|
74
|
-
toolkits.append(thread_toolkit)
|
|
75
|
-
return toolkits
|
|
76
|
-
|
|
139
|
+
CustomChatbot = build_chatbot(computer_use=computer_use, model=model, local_shell=local_shell, agent_name=agent_name, rule=rule, toolkit=toolkit, schema=schema, image_generation=image_generation)
|
|
77
140
|
|
|
78
141
|
bot = CustomChatbot(
|
|
79
142
|
llm_adapter=OpenAIResponsesAdapter(),
|
|
@@ -104,7 +167,10 @@ async def service(
|
|
|
104
167
|
rule: Annotated[List[str], typer.Option("--rule", "-r", help="a system rule")] = [],
|
|
105
168
|
toolkit: Annotated[List[str], typer.Option("--toolkit", "-t", help="the name or url of a required toolkit")] = [],
|
|
106
169
|
schema: Annotated[List[str], typer.Option("--schema", "-s", help="the name or url of a required schema")] = [],
|
|
107
|
-
|
|
170
|
+
model: Annotated[str, typer.Option(..., help="Name of the LLM model to use for the chatbot")] = "gpt-4o",
|
|
171
|
+
image_generation: Annotated[Optional[str], typer.Option(..., help="Name of an image gen model")] = None,
|
|
172
|
+
local_shell: Annotated[Optional[bool], typer.Option(..., help="Enable local shell tool calling")] = False,
|
|
173
|
+
computer_use: Annotated[Optional[bool], typer.Option(..., help="Enable computer use (requires computer-use-preview model)")] = False,
|
|
108
174
|
|
|
109
175
|
host: Annotated[Optional[str], typer.Option()] = None,
|
|
110
176
|
port: Annotated[Optional[int], typer.Option()] = None,
|
|
@@ -113,48 +179,12 @@ async def service(
|
|
|
113
179
|
|
|
114
180
|
room = resolve_room(room)
|
|
115
181
|
|
|
116
|
-
print("[bold green]Connecting to room...[/bold green]")
|
|
117
|
-
|
|
118
|
-
requirements = []
|
|
119
|
-
|
|
120
|
-
toolkits = []
|
|
121
|
-
|
|
122
|
-
for t in toolkit:
|
|
123
|
-
requirements.append(RequiredToolkit(name=t))
|
|
124
|
-
|
|
125
|
-
for t in schema:
|
|
126
|
-
requirements.append(RequiredSchema(name=t))
|
|
127
|
-
|
|
128
|
-
class CustomChatbot(ChatBot):
|
|
129
|
-
|
|
130
|
-
async def get_thread_toolkits(self, *, thread_context, participant):
|
|
131
|
-
toolkits = await super().get_thread_toolkits(thread_context=thread_context, participant=participant)
|
|
132
|
-
|
|
133
|
-
thread_toolkit = Toolkit(name="thread_toolkit", tools=[])
|
|
134
|
-
if image_generation != None:
|
|
135
|
-
if image_generation == "openai":
|
|
136
|
-
print("adding openai image gen to thread")
|
|
137
|
-
thread_toolkit.tools.append(ChatBotThreadOpenAIImageGenerationTool(thread_context=thread_context, partial_images=3))
|
|
138
|
-
else:
|
|
139
|
-
raise Exception("image-generation must be openai")
|
|
140
|
-
toolkits.append(thread_toolkit)
|
|
141
|
-
return toolkits
|
|
142
|
-
|
|
182
|
+
print("[bold green]Connecting to room...[/bold green]", flush=True)
|
|
143
183
|
|
|
144
184
|
service = ServiceHost(
|
|
145
185
|
host=host,
|
|
146
186
|
port=port
|
|
147
187
|
)
|
|
148
|
-
|
|
149
|
-
@service.path(path=path)
|
|
150
|
-
class CustomChatbot(ChatBot):
|
|
151
|
-
def __init__(self):
|
|
152
|
-
super().__init__(
|
|
153
|
-
llm_adapter=OpenAIResponsesAdapter(),
|
|
154
|
-
name=agent_name,
|
|
155
|
-
requires=requirements,
|
|
156
|
-
toolkits=toolkits,
|
|
157
|
-
rules=rule if len(rule) > 0 else None
|
|
158
|
-
)
|
|
188
|
+
service.add_path(path=path, cls=build_chatbot(computer_use=computer_use, model=model, local_shell=local_shell, agent_name=agent_name, rule=rule, toolkit=toolkit, schema=schema, image_generation=image_generation))
|
|
159
189
|
|
|
160
190
|
await service.run()
|
meshagent/cli/cli.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import typer
|
|
2
2
|
import asyncio
|
|
3
|
+
from typing import Optional
|
|
3
4
|
|
|
4
5
|
from meshagent.cli import auth
|
|
5
6
|
from meshagent.cli import api_keys
|
|
@@ -19,6 +20,16 @@ from meshagent.cli import chatbot
|
|
|
19
20
|
from meshagent.cli import voicebot
|
|
20
21
|
from meshagent.cli import tty
|
|
21
22
|
|
|
23
|
+
from meshagent.cli import otel
|
|
24
|
+
|
|
25
|
+
import logging
|
|
26
|
+
|
|
27
|
+
otel.init(level=logging.INFO)
|
|
28
|
+
|
|
29
|
+
# Turn down OpenAI logs, they are a bit noisy
|
|
30
|
+
logging.getLogger("openai").setLevel(logging.ERROR)
|
|
31
|
+
logging.getLogger("httpx").setLevel(logging.ERROR)
|
|
32
|
+
|
|
22
33
|
app = typer.Typer()
|
|
23
34
|
app.add_typer(call.app, name="call")
|
|
24
35
|
app.add_typer(auth.app, name="auth")
|
|
@@ -41,6 +52,131 @@ app.add_typer(tty.app, name="tty")
|
|
|
41
52
|
def _run_async(coro):
|
|
42
53
|
asyncio.run(coro)
|
|
43
54
|
|
|
55
|
+
|
|
56
|
+
import os, sys
|
|
57
|
+
from pathlib import Path
|
|
58
|
+
import typer
|
|
59
|
+
from meshagent.cli.helper import get_client, set_active_project, get_active_project, resolve_project_id, resolve_api_key
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def detect_shell() -> str:
|
|
63
|
+
"""
|
|
64
|
+
Best-effort detection of the *current* interactive shell.
|
|
65
|
+
|
|
66
|
+
Order of preference
|
|
67
|
+
1. Explicit --shell argument (handled by Typer)
|
|
68
|
+
2. Per-shell env vars set by the running shell
|
|
69
|
+
• BASH_VERSION / ZSH_VERSION / FISH_VERSION
|
|
70
|
+
3. $SHELL on POSIX (user’s login shell – still correct >90 % of the time)
|
|
71
|
+
4. Parent process on Windows (COMSPEC → cmd / powershell)
|
|
72
|
+
5. Safe default: 'bash'
|
|
73
|
+
"""
|
|
74
|
+
# Per-shell version variables (works even if login shell ≠ current shell)
|
|
75
|
+
for var, name in (
|
|
76
|
+
("ZSH_VERSION", "zsh"),
|
|
77
|
+
("BASH_VERSION", "bash"),
|
|
78
|
+
("FISH_VERSION", "fish"),
|
|
79
|
+
):
|
|
80
|
+
if var in os.environ:
|
|
81
|
+
return name
|
|
82
|
+
|
|
83
|
+
# POSIX fallback: login shell path
|
|
84
|
+
sh = os.environ.get("SHELL")
|
|
85
|
+
if sh:
|
|
86
|
+
return Path(sh).name.lower()
|
|
87
|
+
|
|
88
|
+
# Windows heuristics
|
|
89
|
+
if sys.platform == "win32":
|
|
90
|
+
comspec = Path(os.environ.get("COMSPEC", "")).name.lower()
|
|
91
|
+
if "powershell" in comspec:
|
|
92
|
+
return "powershell"
|
|
93
|
+
if "cmd" in comspec:
|
|
94
|
+
return "cmd"
|
|
95
|
+
return "powershell" # sensible default on modern Windows
|
|
96
|
+
|
|
97
|
+
# Last-ditch default
|
|
98
|
+
return "bash"
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _bash_like(name: str, value: str, unset: bool) -> str:
|
|
102
|
+
return f'unset {name}' if unset else f'export {name}="{value}"'
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _fish(name: str, value: str, unset: bool) -> str:
|
|
106
|
+
return f'set -e {name}' if unset else f'set -gx {name} "{value}"'
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _powershell(name: str, value: str, unset: bool) -> str:
|
|
110
|
+
return f'Remove-Item Env:{name}' if unset else f'$Env:{name}="{value}"'
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _cmd(name: str, value: str, unset: bool) -> str:
|
|
114
|
+
return f'set {name}=' if unset else f'set {name}={value}'
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
SHELL_RENDERERS = {
|
|
118
|
+
"bash": _bash_like,
|
|
119
|
+
"zsh": _bash_like,
|
|
120
|
+
"fish": _fish,
|
|
121
|
+
"powershell": _powershell,
|
|
122
|
+
"cmd": _cmd,
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@app.command(
|
|
127
|
+
"env",
|
|
128
|
+
help="Generate commands to set meshagent environment variables.",
|
|
129
|
+
)
|
|
130
|
+
def env(
|
|
131
|
+
shell: Optional[str] = typer.Option(None,
|
|
132
|
+
"--shell",
|
|
133
|
+
case_sensitive=False,
|
|
134
|
+
help="bash | zsh | fish | powershell | cmd",
|
|
135
|
+
),
|
|
136
|
+
unset: bool = typer.Option(
|
|
137
|
+
False, "--unset", help="Output commands to unset the variables."
|
|
138
|
+
),
|
|
139
|
+
):
|
|
140
|
+
"""Print shell-specific exports/unsets for Docker environment variables."""
|
|
141
|
+
|
|
142
|
+
async def command():
|
|
143
|
+
nonlocal shell, unset
|
|
144
|
+
shell = (shell or detect_shell()).lower()
|
|
145
|
+
if shell not in SHELL_RENDERERS:
|
|
146
|
+
typer.echo(f"Unsupported shell '{shell}'.", err=True)
|
|
147
|
+
raise typer.Exit(code=1)
|
|
148
|
+
|
|
149
|
+
client = await get_client()
|
|
150
|
+
try:
|
|
151
|
+
project_id = await resolve_project_id(project_id=None)
|
|
152
|
+
api_key_id = await resolve_api_key(project_id=project_id, api_key_id=None)
|
|
153
|
+
|
|
154
|
+
token = (await client.decrypt_project_api_key(project_id=project_id, id=api_key_id))["token"]
|
|
155
|
+
finally:
|
|
156
|
+
await client.close()
|
|
157
|
+
|
|
158
|
+
vars = {
|
|
159
|
+
"MESHAGENT_PROJECT_ID" : project_id,
|
|
160
|
+
"MESHAGENT_API_KEY" : api_key_id,
|
|
161
|
+
"MESHAGENT_SECRET" : token
|
|
162
|
+
}
|
|
163
|
+
if shell not in SHELL_RENDERERS:
|
|
164
|
+
typer.echo(f"Unsupported shell '{shell}'.", err=True)
|
|
165
|
+
raise typer.Exit(code=1)
|
|
166
|
+
|
|
167
|
+
render = SHELL_RENDERERS[shell]
|
|
168
|
+
|
|
169
|
+
for name, value in vars.items():
|
|
170
|
+
typer.echo(render(name, value, unset))
|
|
171
|
+
|
|
172
|
+
if not unset and shell in ("bash", "zsh"):
|
|
173
|
+
typer.echo(
|
|
174
|
+
'\n# Run this command to configure your current shell:\n'
|
|
175
|
+
f'# eval "$(meshagent env)"'
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
_run_async(command())
|
|
179
|
+
|
|
44
180
|
@app.command("setup")
|
|
45
181
|
def setup_command():
|
|
46
182
|
"""Perform initial login and project/api key activation."""
|
meshagent/cli/otel.py
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
|
|
2
|
+
from opentelemetry import trace
|
|
3
|
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
|
4
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
5
|
+
from opentelemetry.sdk.trace.export import BatchSpanProcessor, ConsoleSpanExporter
|
|
6
|
+
|
|
7
|
+
from opentelemetry import metrics
|
|
8
|
+
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter
|
|
9
|
+
from opentelemetry.sdk._logs.export import ConsoleLogExporter
|
|
10
|
+
from opentelemetry.sdk.metrics import MeterProvider
|
|
11
|
+
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader, ConsoleMetricExporter
|
|
12
|
+
from opentelemetry import _logs
|
|
13
|
+
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
|
|
14
|
+
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
|
|
15
|
+
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
|
|
16
|
+
from opentelemetry.sdk.metrics.export import AggregationTemporality
|
|
17
|
+
from opentelemetry.sdk.metrics import Counter, Histogram
|
|
18
|
+
import logging
|
|
19
|
+
|
|
20
|
+
import os
|
|
21
|
+
|
|
22
|
+
def _call_once(fn):
|
|
23
|
+
called = False
|
|
24
|
+
result = None
|
|
25
|
+
|
|
26
|
+
def wrapper(*args, **kwargs):
|
|
27
|
+
nonlocal called, result
|
|
28
|
+
if not called:
|
|
29
|
+
result = fn(*args, **kwargs)
|
|
30
|
+
called = True
|
|
31
|
+
return result
|
|
32
|
+
return wrapper
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
attributes = {
|
|
36
|
+
SERVICE_NAME: "room-server",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if os.getenv("MESHAGENT_PROJECT_ID") != None:
|
|
40
|
+
attributes["project"] = os.getenv("MESHAGENT_PROJECT_ID")
|
|
41
|
+
|
|
42
|
+
if os.getenv("MESHAGENT_SESSION_ID") != None:
|
|
43
|
+
attributes["session"] = os.getenv("MESHAGENT_SESSION_ID")
|
|
44
|
+
|
|
45
|
+
if os.getenv("MESHAGENT_ROOM") != None:
|
|
46
|
+
attributes["room"] = os.getenv("MESHAGENT_ROOM")
|
|
47
|
+
|
|
48
|
+
resource = Resource.create(attributes=attributes)
|
|
49
|
+
|
|
50
|
+
logger_provider = None
|
|
51
|
+
tracer_provider = None
|
|
52
|
+
meter_provider = None
|
|
53
|
+
|
|
54
|
+
add_console_exporters = False
|
|
55
|
+
|
|
56
|
+
otel_endpoint = os.getenv("OTEL_ENDPOINT")
|
|
57
|
+
|
|
58
|
+
if otel_endpoint != None:
|
|
59
|
+
|
|
60
|
+
otel_logs_endpoint = otel_endpoint + "/v1/logs"
|
|
61
|
+
otel_traces_endpoint = otel_endpoint + "/v1/traces"
|
|
62
|
+
otel_metrics_endpoint = otel_endpoint + "/v1/metrics"
|
|
63
|
+
|
|
64
|
+
if otel_logs_endpoint != None:
|
|
65
|
+
logs_exporter = OTLPLogExporter(
|
|
66
|
+
endpoint=otel_logs_endpoint,
|
|
67
|
+
)
|
|
68
|
+
logger_provider = LoggerProvider(resource=resource)
|
|
69
|
+
_logs.set_logger_provider(logger_provider)
|
|
70
|
+
|
|
71
|
+
logger_provider.add_log_record_processor(
|
|
72
|
+
BatchLogRecordProcessor(logs_exporter)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
if add_console_exporters:
|
|
76
|
+
logger_provider.add_log_record_processor(BatchLogRecordProcessor(ConsoleLogExporter()))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if otel_traces_endpoint != None:
|
|
80
|
+
tracer_provider = TracerProvider(resource=resource)
|
|
81
|
+
processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=otel_traces_endpoint))
|
|
82
|
+
tracer_provider.add_span_processor(processor)
|
|
83
|
+
if add_console_exporters:
|
|
84
|
+
tracer_provider.add_span_processor(BatchSpanProcessor(ConsoleSpanExporter()))
|
|
85
|
+
trace.set_tracer_provider(tracer_provider)
|
|
86
|
+
|
|
87
|
+
if otel_metrics_endpoint != None:
|
|
88
|
+
reader = PeriodicExportingMetricReader(
|
|
89
|
+
exporter=OTLPMetricExporter(
|
|
90
|
+
endpoint=otel_metrics_endpoint,
|
|
91
|
+
preferred_temporality={
|
|
92
|
+
Counter: AggregationTemporality.DELTA,
|
|
93
|
+
Histogram: AggregationTemporality.DELTA,
|
|
94
|
+
},
|
|
95
|
+
),
|
|
96
|
+
export_interval_millis=1000
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
readers = [
|
|
100
|
+
reader,
|
|
101
|
+
]
|
|
102
|
+
if add_console_exporters:
|
|
103
|
+
readers.append(PeriodicExportingMetricReader(
|
|
104
|
+
ConsoleMetricExporter()
|
|
105
|
+
))
|
|
106
|
+
|
|
107
|
+
meter_provider = MeterProvider(resource=resource, metric_readers=readers)
|
|
108
|
+
metrics.set_meter_provider(meter_provider)
|
|
109
|
+
|
|
110
|
+
@_call_once
|
|
111
|
+
def init(level):
|
|
112
|
+
if logger_provider != None:
|
|
113
|
+
logging_handler = LoggingHandler(level=level, logger_provider=logger_provider)
|
|
114
|
+
root = logging.getLogger()
|
|
115
|
+
root.setLevel(level)
|
|
116
|
+
root.addHandler(logging_handler)
|
|
117
|
+
else:
|
|
118
|
+
logging.basicConfig(level=level)
|
meshagent/cli/tty.py
CHANGED
|
@@ -2,6 +2,7 @@ import pathlib
|
|
|
2
2
|
import sys
|
|
3
3
|
import tty
|
|
4
4
|
import termios
|
|
5
|
+
from meshagent.api.helpers import websocket_room_url
|
|
5
6
|
from typing import Annotated, Optional
|
|
6
7
|
|
|
7
8
|
import asyncio
|
|
@@ -46,10 +47,9 @@ async def tty_command(
|
|
|
46
47
|
)
|
|
47
48
|
|
|
48
49
|
token.add_role_grant(role="user")
|
|
49
|
-
|
|
50
50
|
token.add_room_grant(room)
|
|
51
51
|
|
|
52
|
-
ws_url =
|
|
52
|
+
ws_url = websocket_room_url(room_name=room)+"/tty?token={token.to_jwt(token=key)}"
|
|
53
53
|
|
|
54
54
|
print(f"[bold green]Connecting to[/bold green] {room}")
|
|
55
55
|
|
meshagent/cli/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.36"
|
meshagent/cli/voicebot.py
CHANGED
|
@@ -53,7 +53,7 @@ async def make_call(
|
|
|
53
53
|
room = resolve_room(room)
|
|
54
54
|
jwt = await resolve_token_jwt(project_id=project_id, api_key_id=api_key_id, token_path=token_path, name=name, role=role, room=room)
|
|
55
55
|
|
|
56
|
-
print("[bold green]Connecting to room...[/bold green]")
|
|
56
|
+
print("[bold green]Connecting to room...[/bold green]", flush=True)
|
|
57
57
|
async with RoomClient(
|
|
58
58
|
protocol=WebSocketClientProtocol(url=websocket_room_url(room_name=room, base_url=meshagent_base_url()), token=jwt)
|
|
59
59
|
) as client:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: meshagent-cli
|
|
3
|
+
Version: 0.0.36
|
|
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.12
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: typer~=0.15
|
|
12
|
+
Requires-Dist: pydantic-yaml~=1.4
|
|
13
|
+
Requires-Dist: meshagent-api~=0.0.36
|
|
14
|
+
Requires-Dist: meshagent-agents~=0.0.36
|
|
15
|
+
Requires-Dist: meshagent-tools~=0.0.36
|
|
16
|
+
Requires-Dist: meshagent-mcp~=0.0.36
|
|
17
|
+
Requires-Dist: supabase~=2.15
|
|
18
|
+
Requires-Dist: fastmcp~=2.8
|
|
19
|
+
Requires-Dist: opentelemetry-distro~=0.54b1
|
|
20
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http~=1.33
|
|
21
|
+
|
|
22
|
+
### Meshagent CLI
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
@@ -3,26 +3,27 @@ meshagent/cli/agent.py,sha256=0VjwJkwZ-G637Mps3OtxxWIfjWbrirJ4TTq2Idvjtug,10023
|
|
|
3
3
|
meshagent/cli/api_keys.py,sha256=VZynVFCBwxcwJ6dtxcoqKB91B0_QsUfJTim4vUXGvKc,4550
|
|
4
4
|
meshagent/cli/async_typer.py,sha256=GCeSefBDbpd-V4V8LrvHGUTBMth3HspVMfFa-HUZ0cg,898
|
|
5
5
|
meshagent/cli/auth.py,sha256=pZQwYTNWQOWTqpyDrkQLNKuidH-wn9GNE5yEJoxn3-g,767
|
|
6
|
-
meshagent/cli/auth_async.py,sha256=
|
|
6
|
+
meshagent/cli/auth_async.py,sha256=run_J11mRPJQ6BI_aAtV_3O3h52eAl1EOnHuotwhoqQ,4018
|
|
7
7
|
meshagent/cli/call.py,sha256=-6Bf5PCVcsuLMgDpG1g3GiY3S5rgs_-CWgWX4C6AXwg,4739
|
|
8
|
-
meshagent/cli/chatbot.py,sha256=
|
|
9
|
-
meshagent/cli/cli.py,sha256=
|
|
8
|
+
meshagent/cli/chatbot.py,sha256=1MDzQOdNPyyux50D3rre_HhqXlySo8tBVfnDu2_std4,7455
|
|
9
|
+
meshagent/cli/cli.py,sha256=HbMyzks8LTDz-D6pGV97OHZAiAX39VqS3DrZZB06Y5A,6166
|
|
10
10
|
meshagent/cli/cli_mcp.py,sha256=SG0r-cL3P7eu-fbwB-1WgjQPCmxKqQBh-X3kTKDli-E,9536
|
|
11
11
|
meshagent/cli/cli_secrets.py,sha256=U0kdzN3zt7JIqzdRLynAjxdvAsI0enesBd_m7TeXjnQ,13629
|
|
12
12
|
meshagent/cli/developer.py,sha256=5eoDr3kfi-IufA5d6OESqNr739Bdut_IFBtT3nq0xZU,3002
|
|
13
13
|
meshagent/cli/helper.py,sha256=39_oznxO4sCi3namCJzYC0eWqeeGNlen1zlOuWF43os,4785
|
|
14
14
|
meshagent/cli/messaging.py,sha256=bHMecKtVwY8P11itXMIvaLxPv-Zm6SpgrXnLDppb4Gc,6282
|
|
15
|
+
meshagent/cli/otel.py,sha256=6XaCrffRwPnQWp2KqGBAz4oPZUdlT6xh5kc-JKanJm4,4056
|
|
15
16
|
meshagent/cli/participant_token.py,sha256=uCGmlUgNOfarYGkDZpzreXwnv9AJrM76tu5Lt690vYU,1456
|
|
16
17
|
meshagent/cli/projects.py,sha256=EQfbO9_GQKkjlFcaSHQfIxqIxsmFR3FbH5Fd17I5IPk,3305
|
|
17
18
|
meshagent/cli/services.py,sha256=pMAyLg0eEO33fhRiin5q0KbNVoTzQyT5wSDgvDqeRYM,11241
|
|
18
19
|
meshagent/cli/sessions.py,sha256=WWvuztYqRfthSq6ztwL_eQ_sz9JRc33jcN6p7YyM_Fs,782
|
|
19
20
|
meshagent/cli/storage.py,sha256=Se_4xhxiihIovSR1ajlEWo_YZ12G7eUY_-lvifJ8pjo,33806
|
|
20
|
-
meshagent/cli/tty.py,sha256=
|
|
21
|
-
meshagent/cli/version.py,sha256=
|
|
22
|
-
meshagent/cli/voicebot.py,sha256=
|
|
21
|
+
meshagent/cli/tty.py,sha256=DkgeYQckjil191HNoEGHmheniCi41XNUSMpYY1ilAic,4099
|
|
22
|
+
meshagent/cli/version.py,sha256=oSKhQHo_8dYEVv3A19nCmQysoh4TbOzHl508xX9iHoo,23
|
|
23
|
+
meshagent/cli/voicebot.py,sha256=lkiFHL2vhQuknQU5b2fbLafqzfycDik8DGZ8PkuK1z0,4713
|
|
23
24
|
meshagent/cli/webhook.py,sha256=KBl8U1TcOX3z2uoyH4YMuUuw0vSVX7xpRxYvzxI5c-Y,2811
|
|
24
|
-
meshagent_cli-0.0.
|
|
25
|
-
meshagent_cli-0.0.
|
|
26
|
-
meshagent_cli-0.0.
|
|
27
|
-
meshagent_cli-0.0.
|
|
28
|
-
meshagent_cli-0.0.
|
|
25
|
+
meshagent_cli-0.0.36.dist-info/METADATA,sha256=TW6N-7Duj-FnJA6C5NkWpKBF3ovNE18HHcNK6MQKCHM,731
|
|
26
|
+
meshagent_cli-0.0.36.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
+
meshagent_cli-0.0.36.dist-info/entry_points.txt,sha256=WRcGGN4vMtvC5Pgl3uRFqsJiQXNoHuLLa-TCSY3gAhQ,52
|
|
28
|
+
meshagent_cli-0.0.36.dist-info/top_level.txt,sha256=GlcXnHtRP6m7zlG3Df04M35OsHtNXy_DY09oFwWrH74,10
|
|
29
|
+
meshagent_cli-0.0.36.dist-info/RECORD,,
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: meshagent-cli
|
|
3
|
-
Version: 0.0.34
|
|
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.12
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
Requires-Dist: typer~=0.15.3
|
|
12
|
-
Requires-Dist: pydantic-yaml~=1.4.0
|
|
13
|
-
Requires-Dist: meshagent-api~=0.0.34
|
|
14
|
-
Requires-Dist: meshagent-agents~=0.0.34
|
|
15
|
-
Requires-Dist: meshagent-tools~=0.0.34
|
|
16
|
-
Requires-Dist: meshagent-mcp~=0.0.34
|
|
17
|
-
Requires-Dist: supabase~=2.15.1
|
|
18
|
-
Requires-Dist: fastmcp~=2.8.1
|
|
19
|
-
|
|
20
|
-
### Meshagent CLI
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|