sidekick-agent-cli 0.2.2__tar.gz → 0.3.0__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.
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/PKG-INFO +1 -1
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/pyproject.toml +1 -1
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/auth.py +6 -4
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/chat.py +0 -1
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/chat_display.py +0 -1
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/cli.py +9 -2
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/cli_common.py +8 -4
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/local_tools.py +5 -5
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/runner.py +28 -4
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/runtime.py +0 -1
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/.gitignore +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/LICENSE +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/README.md +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/SECURITY.md +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/__init__.py +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/__main__.py +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/api_client.py +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/display.py +0 -0
- {sidekick_agent_cli-0.2.2 → sidekick_agent_cli-0.3.0}/src/agent_runtime/run.py +0 -0
|
@@ -13,6 +13,7 @@ import json
|
|
|
13
13
|
import logging
|
|
14
14
|
import os
|
|
15
15
|
import pathlib
|
|
16
|
+
import sys
|
|
16
17
|
import secrets
|
|
17
18
|
import tempfile
|
|
18
19
|
import webbrowser
|
|
@@ -86,10 +87,11 @@ def _write_credentials(creds: dict[str, Any]) -> None:
|
|
|
86
87
|
)
|
|
87
88
|
try:
|
|
88
89
|
os.write(fd, json.dumps(creds, indent=2, default=str).encode())
|
|
89
|
-
|
|
90
|
+
if sys.platform != "win32":
|
|
91
|
+
os.fchmod(fd, 0o600)
|
|
90
92
|
os.close(fd)
|
|
91
93
|
fd = -1 # mark as closed
|
|
92
|
-
os.
|
|
94
|
+
os.replace(tmp_path, CREDENTIALS_PATH)
|
|
93
95
|
except BaseException:
|
|
94
96
|
if fd >= 0:
|
|
95
97
|
os.close(fd)
|
|
@@ -335,7 +337,7 @@ async def browser_auth(url: str) -> dict:
|
|
|
335
337
|
try:
|
|
336
338
|
# Open browser to authorization page
|
|
337
339
|
auth_url = f"{url.rstrip('/')}/cli/authorize?port={port}&state={state}"
|
|
338
|
-
print(
|
|
340
|
+
print("\nOpening browser for authentication...")
|
|
339
341
|
print(f"If the browser doesn't open, visit:\n {auth_url}\n")
|
|
340
342
|
webbrowser.open(auth_url)
|
|
341
343
|
|
|
@@ -446,7 +448,7 @@ def browser_register(url: str) -> dict[str, str]:
|
|
|
446
448
|
|
|
447
449
|
register_url = f"{url.rstrip('/')}/cli/register?port={port}&state={state}"
|
|
448
450
|
logger.info("Opening browser for runner registration: %s", register_url)
|
|
449
|
-
print(
|
|
451
|
+
print("\nOpening browser for runner registration...")
|
|
450
452
|
print(f"If the browser doesn't open, visit:\n {register_url}\n")
|
|
451
453
|
webbrowser.open(register_url)
|
|
452
454
|
|
|
@@ -364,13 +364,20 @@ def _run_serve(args: argparse.Namespace) -> None:
|
|
|
364
364
|
)
|
|
365
365
|
)
|
|
366
366
|
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
if sys.platform != "win32":
|
|
368
|
+
for sig in (signal.SIGINT, signal.SIGTERM):
|
|
369
|
+
loop.add_signal_handler(sig, task.cancel)
|
|
369
370
|
|
|
370
371
|
try:
|
|
371
372
|
loop.run_until_complete(task)
|
|
372
373
|
except asyncio.CancelledError:
|
|
373
374
|
pass
|
|
375
|
+
except KeyboardInterrupt:
|
|
376
|
+
task.cancel()
|
|
377
|
+
try:
|
|
378
|
+
loop.run_until_complete(task)
|
|
379
|
+
except asyncio.CancelledError:
|
|
380
|
+
pass
|
|
374
381
|
finally:
|
|
375
382
|
loop.close()
|
|
376
383
|
|
|
@@ -9,7 +9,6 @@ from __future__ import annotations
|
|
|
9
9
|
|
|
10
10
|
import asyncio
|
|
11
11
|
import logging
|
|
12
|
-
import os
|
|
13
12
|
import signal
|
|
14
13
|
import sys
|
|
15
14
|
from dataclasses import dataclass
|
|
@@ -87,14 +86,19 @@ def run_async(coro) -> None:
|
|
|
87
86
|
loop = asyncio.new_event_loop()
|
|
88
87
|
task = loop.create_task(coro)
|
|
89
88
|
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if sys.platform != "win32":
|
|
90
|
+
for sig in (signal.SIGINT, signal.SIGTERM):
|
|
91
|
+
loop.add_signal_handler(sig, task.cancel)
|
|
92
92
|
|
|
93
93
|
try:
|
|
94
94
|
loop.run_until_complete(task)
|
|
95
95
|
except asyncio.CancelledError:
|
|
96
96
|
pass
|
|
97
97
|
except KeyboardInterrupt:
|
|
98
|
-
|
|
98
|
+
task.cancel()
|
|
99
|
+
try:
|
|
100
|
+
loop.run_until_complete(task)
|
|
101
|
+
except asyncio.CancelledError:
|
|
102
|
+
pass
|
|
99
103
|
finally:
|
|
100
104
|
loop.close()
|
|
@@ -7,12 +7,9 @@ running the runtime inside a VM — zero-hop tool execution.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import asyncio
|
|
10
|
-
import json
|
|
11
10
|
import logging
|
|
12
11
|
import os
|
|
13
12
|
from pathlib import Path
|
|
14
|
-
from typing import Any, Dict
|
|
15
|
-
|
|
16
13
|
from .api_client import ToolNode, ToolResult
|
|
17
14
|
|
|
18
15
|
logger = logging.getLogger(__name__)
|
|
@@ -40,6 +37,9 @@ SENSITIVE_ENV_VARS = frozenset({
|
|
|
40
37
|
"PYTHONPATH", "PATH", "PYTHONSTARTUP", "PYTHONHOME", "NODE_OPTIONS",
|
|
41
38
|
# Home / config directories (information leakage)
|
|
42
39
|
"HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME",
|
|
40
|
+
"USERPROFILE", "APPDATA", "LOCALAPPDATA",
|
|
41
|
+
# Windows system paths and shell
|
|
42
|
+
"COMSPEC", "PATHEXT", "SYSTEMROOT", "WINDIR",
|
|
43
43
|
# Proxy settings (traffic redirection)
|
|
44
44
|
"HTTP_PROXY", "HTTPS_PROXY", "ALL_PROXY", "NO_PROXY",
|
|
45
45
|
# TLS / certificate overrides
|
|
@@ -374,9 +374,9 @@ async def _get_session_info(node: ToolNode, workspace: str | None = None) -> Too
|
|
|
374
374
|
|
|
375
375
|
cwd = os.getcwd()
|
|
376
376
|
info_lines = [
|
|
377
|
-
|
|
377
|
+
"Status: online",
|
|
378
378
|
f"Working Directory: {cwd}",
|
|
379
|
-
|
|
379
|
+
"Backend: self-hosted",
|
|
380
380
|
f"Hostname: {socket.gethostname()}",
|
|
381
381
|
f"OS: {platform.system()} {platform.release()}",
|
|
382
382
|
]
|
|
@@ -30,13 +30,25 @@ except Exception:
|
|
|
30
30
|
__version__ = "0.1.0" # Fallback for editable installs / development
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
def _is_wsl() -> bool:
|
|
34
|
+
"""Detect if running inside Windows Subsystem for Linux."""
|
|
35
|
+
try:
|
|
36
|
+
with open("/proc/version") as f:
|
|
37
|
+
return "microsoft" in f.read().lower()
|
|
38
|
+
except Exception:
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
|
|
33
42
|
def _get_machine_info(name: str | None = None) -> dict:
|
|
34
43
|
"""Collect machine info to send on WebSocket connect."""
|
|
35
|
-
|
|
44
|
+
system = platform.system()
|
|
45
|
+
os_label = f"{system} {platform.release()}"
|
|
46
|
+
if system == "Linux" and _is_wsl():
|
|
47
|
+
os_label += " (WSL)"
|
|
36
48
|
|
|
37
49
|
info: dict = {
|
|
38
50
|
"hostname": socket.gethostname(),
|
|
39
|
-
"os":
|
|
51
|
+
"os": os_label,
|
|
40
52
|
"platform": platform.platform(),
|
|
41
53
|
"python_version": platform.python_version(),
|
|
42
54
|
"agent_runtime_version": __version__,
|
|
@@ -46,17 +58,29 @@ def _get_machine_info(name: str | None = None) -> dict:
|
|
|
46
58
|
# CPU info
|
|
47
59
|
info["cpu_cores"] = os.cpu_count()
|
|
48
60
|
info["cpu_arch"] = platform.machine()
|
|
49
|
-
|
|
61
|
+
if system == "Darwin":
|
|
62
|
+
info["cpu_name"] = _run_quiet(["sysctl", "-n", "machdep.cpu.brand_string"])
|
|
63
|
+
elif system == "Windows":
|
|
64
|
+
raw = _run_quiet(["wmic", "cpu", "get", "name", "/value"])
|
|
65
|
+
info["cpu_name"] = raw.split("=", 1)[1].strip() if raw and "=" in raw else None
|
|
66
|
+
else:
|
|
67
|
+
info["cpu_name"] = _read_file_line("/proc/cpuinfo", "model name")
|
|
50
68
|
if not info["cpu_name"]:
|
|
51
69
|
info["cpu_name"] = platform.processor() or None
|
|
52
70
|
|
|
53
71
|
# Memory (total physical RAM in bytes)
|
|
54
|
-
system = platform.system()
|
|
55
72
|
mem_bytes: int | None = None
|
|
56
73
|
if system == "Darwin":
|
|
57
74
|
raw = _run_quiet(["sysctl", "-n", "hw.memsize"])
|
|
58
75
|
if raw:
|
|
59
76
|
mem_bytes = int(raw)
|
|
77
|
+
elif system == "Windows":
|
|
78
|
+
raw = _run_quiet(["wmic", "OS", "get", "TotalVisibleMemorySize", "/value"])
|
|
79
|
+
if raw and "=" in raw:
|
|
80
|
+
try:
|
|
81
|
+
mem_bytes = int(raw.split("=", 1)[1].strip()) * 1024 # KB -> bytes
|
|
82
|
+
except (ValueError, IndexError):
|
|
83
|
+
pass
|
|
60
84
|
elif system == "Linux":
|
|
61
85
|
raw = _read_file_line("/proc/meminfo", "MemTotal")
|
|
62
86
|
if raw:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|