samai-zagent 0.28.38__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.
- samai_zagent-0.28.38/.gitignore +70 -0
- samai_zagent-0.28.38/PKG-INFO +73 -0
- samai_zagent-0.28.38/README.md +54 -0
- samai_zagent-0.28.38/pyproject.toml +41 -0
- samai_zagent-0.28.38/src/zagent/__init__.py +3 -0
- samai_zagent-0.28.38/src/zagent/bin/.gitkeep +1 -0
- samai_zagent-0.28.38/src/zagent/bin/zagent-darwin-amd64 +0 -0
- samai_zagent-0.28.38/src/zagent/bin/zagent-darwin-arm64 +0 -0
- samai_zagent-0.28.38/src/zagent/bin/zagent-linux-amd64 +0 -0
- samai_zagent-0.28.38/src/zagent/bin/zagent-linux-arm64 +0 -0
- samai_zagent-0.28.38/src/zagent/bin/zagent-windows-amd64.exe +0 -0
- samai_zagent-0.28.38/src/zagent/bin/zagent-windows-arm64.exe +0 -0
- samai_zagent-0.28.38/src/zagent/cli.py +202 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Binaries
|
|
2
|
+
/zagent
|
|
3
|
+
/zagent/
|
|
4
|
+
zagent-*
|
|
5
|
+
dist/
|
|
6
|
+
*.exe
|
|
7
|
+
*.key
|
|
8
|
+
|
|
9
|
+
# Environment & secrets
|
|
10
|
+
.env
|
|
11
|
+
*.pem
|
|
12
|
+
*_private_key*
|
|
13
|
+
|
|
14
|
+
# Logs
|
|
15
|
+
*.log
|
|
16
|
+
|
|
17
|
+
# Python virtual environment
|
|
18
|
+
aicq-env/
|
|
19
|
+
|
|
20
|
+
# Wrongly introduced directories (managed separately)
|
|
21
|
+
aicq/
|
|
22
|
+
download/
|
|
23
|
+
skills/
|
|
24
|
+
|
|
25
|
+
# Runtime scripts (hardcoded paths, not portable)
|
|
26
|
+
aicq_loop*.py
|
|
27
|
+
aicq_loop_daemon.sh
|
|
28
|
+
|
|
29
|
+
# Agent work logs
|
|
30
|
+
worklog.md
|
|
31
|
+
|
|
32
|
+
# OS files
|
|
33
|
+
.DS_Store
|
|
34
|
+
Thumbs.db
|
|
35
|
+
|
|
36
|
+
# Web runtime
|
|
37
|
+
web/node_modules/
|
|
38
|
+
|
|
39
|
+
# Chrome runtime output
|
|
40
|
+
chrome_stderr.txt
|
|
41
|
+
|
|
42
|
+
*.exe~
|
|
43
|
+
start_bg.bat
|
|
44
|
+
start_hidden.vbs
|
|
45
|
+
test_nowebui*
|
|
46
|
+
|
|
47
|
+
# Submodule dirs (managed separately)
|
|
48
|
+
tc/
|
|
49
|
+
tunnelgo/
|
|
50
|
+
|
|
51
|
+
# Build artifacts and archives
|
|
52
|
+
*.tar.gz
|
|
53
|
+
*.bak
|
|
54
|
+
|
|
55
|
+
# Android build artifacts
|
|
56
|
+
android/.gradle/
|
|
57
|
+
android/app/build/
|
|
58
|
+
android/build/
|
|
59
|
+
android/local.properties
|
|
60
|
+
|
|
61
|
+
# Test/data files
|
|
62
|
+
zai_test.json
|
|
63
|
+
ai-summary.txt
|
|
64
|
+
server.log
|
|
65
|
+
releases_page.json
|
|
66
|
+
repo_page.json
|
|
67
|
+
search2.json
|
|
68
|
+
search_result.json
|
|
69
|
+
go1.21.0.linux-amd64.tar.gz
|
|
70
|
+
zhudongshan_profile.html
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: samai-zagent
|
|
3
|
+
Version: 0.28.38
|
|
4
|
+
Summary: ZAgent - Lightweight cross-platform AI agent for AICQ, with streaming chat, tool use, workflow automation, and stealth browser capabilities
|
|
5
|
+
Project-URL: Homepage, https://zagent.samai.cc
|
|
6
|
+
Project-URL: Documentation, https://zagent.samai.cc/install.html
|
|
7
|
+
Project-URL: Repository, https://github.com/samaidev/zagent_r
|
|
8
|
+
Author-email: SamAI <admin@samai.cc>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: agent,ai,aicq,assistant,automation,chatbot,llm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Communications :: Chat
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
17
|
+
Requires-Python: >=3.7
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# ZAgent
|
|
21
|
+
|
|
22
|
+
<div align="center">
|
|
23
|
+
|
|
24
|
+
**🌐 Website: [zagent.samai.cc](https://zagent.samai.cc)**
|
|
25
|
+
|
|
26
|
+
[](https://pypi.org/project/samai-zagent/)
|
|
27
|
+
[](#)
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
ZAgent is a lightweight cross-platform AI agent for AICQ, with streaming chat, tool use, workflow automation, and stealth browser capabilities.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install samai-zagent
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
After install, run:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
zagent
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- **Streaming Chat** — Real-time responses with collapsible reasoning panel
|
|
50
|
+
- **30+ Built-in Tools** — File ops, command execution, code execution, web search, browser automation
|
|
51
|
+
- **Workflow Automation** — Create and run multi-step automated workflows
|
|
52
|
+
- **Stealth Browser** — Anti-detection Chrome automation
|
|
53
|
+
- **Persistent Memory** — SQLite-backed memory with keyword search
|
|
54
|
+
- **Multi-Platform** — Linux, macOS, Windows (amd64 + arm64), Android
|
|
55
|
+
|
|
56
|
+
## How It Works
|
|
57
|
+
|
|
58
|
+
The `pip install samai-zagent` command installs a Python wrapper package with bundled native binaries for all platforms. Run `zagent` after install to start.
|
|
59
|
+
|
|
60
|
+
## Links
|
|
61
|
+
|
|
62
|
+
- **Website**: [zagent.samai.cc](https://zagent.samai.cc)
|
|
63
|
+
- **Install Guide**: [zagent.samai.cc/install.html](https://zagent.samai.cc/install.html)
|
|
64
|
+
- **GitHub Releases**: [github.com/samaidev/zagent_r/releases](https://github.com/samaidev/zagent_r/releases)
|
|
65
|
+
- **Live Demo**: [zagent.aitun.cc](https://zagent.aitun.cc)
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
|
70
|
+
|
|
71
|
+
## Contact
|
|
72
|
+
|
|
73
|
+
admin@samai.cc
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# ZAgent
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**🌐 Website: [zagent.samai.cc](https://zagent.samai.cc)**
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/samai-zagent/)
|
|
8
|
+
[](#)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
ZAgent is a lightweight cross-platform AI agent for AICQ, with streaming chat, tool use, workflow automation, and stealth browser capabilities.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install samai-zagent
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
After install, run:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
zagent
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Streaming Chat** — Real-time responses with collapsible reasoning panel
|
|
31
|
+
- **30+ Built-in Tools** — File ops, command execution, code execution, web search, browser automation
|
|
32
|
+
- **Workflow Automation** — Create and run multi-step automated workflows
|
|
33
|
+
- **Stealth Browser** — Anti-detection Chrome automation
|
|
34
|
+
- **Persistent Memory** — SQLite-backed memory with keyword search
|
|
35
|
+
- **Multi-Platform** — Linux, macOS, Windows (amd64 + arm64), Android
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
The `pip install samai-zagent` command installs a Python wrapper package with bundled native binaries for all platforms. Run `zagent` after install to start.
|
|
40
|
+
|
|
41
|
+
## Links
|
|
42
|
+
|
|
43
|
+
- **Website**: [zagent.samai.cc](https://zagent.samai.cc)
|
|
44
|
+
- **Install Guide**: [zagent.samai.cc/install.html](https://zagent.samai.cc/install.html)
|
|
45
|
+
- **GitHub Releases**: [github.com/samaidev/zagent_r/releases](https://github.com/samaidev/zagent_r/releases)
|
|
46
|
+
- **Live Demo**: [zagent.aitun.cc](https://zagent.aitun.cc)
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
|
51
|
+
|
|
52
|
+
## Contact
|
|
53
|
+
|
|
54
|
+
admin@samai.cc
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "samai-zagent"
|
|
7
|
+
version = "0.28.38"
|
|
8
|
+
description = "ZAgent - Lightweight cross-platform AI agent for AICQ, with streaming chat, tool use, workflow automation, and stealth browser capabilities"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = []
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "SamAI", email = "admin@samai.cc" }
|
|
15
|
+
]
|
|
16
|
+
keywords = ["ai", "agent", "aicq", "automation", "llm", "chatbot", "assistant"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Topic :: Communications :: Chat",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://zagent.samai.cc"
|
|
28
|
+
Documentation = "https://zagent.samai.cc/install.html"
|
|
29
|
+
Repository = "https://github.com/samaidev/zagent_r"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
zagent = "zagent.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.wheel]
|
|
35
|
+
# Use force-include for everything to ensure bin/ directory with native binaries
|
|
36
|
+
# is included in the wheel
|
|
37
|
+
only-include = ["src/zagent/cli.py", "src/zagent/__init__.py"]
|
|
38
|
+
sources = ["src"]
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
41
|
+
"src/zagent/bin" = "zagent/bin"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""ZAgent CLI wrapper - runs the bundled native binary (or downloads on demand).
|
|
3
|
+
|
|
4
|
+
This module is the entry point for the `zagent` command installed via pip.
|
|
5
|
+
It locates the platform-specific native binary (bundled in the wheel or
|
|
6
|
+
downloaded on first run) and exec's it with the user's arguments.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
zagent # start with default options
|
|
10
|
+
zagent -code <room_code> # join a specific room
|
|
11
|
+
zagent -h # show help
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
16
|
+
import platform
|
|
17
|
+
import subprocess
|
|
18
|
+
import urllib.request
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
GITHUB_REPO = "samaidev/zagent_r"
|
|
22
|
+
DOWNLOAD_BASE = "https://zagent.samai.cc/downloads"
|
|
23
|
+
VERSION = "0.28.38"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_bin_dir():
|
|
27
|
+
"""Return the directory where native binaries are stored."""
|
|
28
|
+
return Path(__file__).parent / "bin"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_platform_suffix():
|
|
32
|
+
"""Return the binary filename for the current platform.
|
|
33
|
+
|
|
34
|
+
Returns None if the platform is not supported.
|
|
35
|
+
"""
|
|
36
|
+
system = platform.system().lower()
|
|
37
|
+
machine = platform.machine().lower()
|
|
38
|
+
|
|
39
|
+
if system == "linux":
|
|
40
|
+
if machine in ("x86_64", "amd64"):
|
|
41
|
+
return "zagent-linux-amd64"
|
|
42
|
+
elif machine in ("aarch64", "arm64"):
|
|
43
|
+
return "zagent-linux-arm64"
|
|
44
|
+
elif system == "darwin":
|
|
45
|
+
if machine in ("x86_64", "amd64", "i386"):
|
|
46
|
+
return "zagent-darwin-amd64"
|
|
47
|
+
elif machine in ("arm64",):
|
|
48
|
+
return "zagent-darwin-arm64"
|
|
49
|
+
elif system == "windows":
|
|
50
|
+
if machine in ("arm64", "aarch64"):
|
|
51
|
+
return "zagent-windows-arm64.exe"
|
|
52
|
+
return "zagent-windows-amd64.exe"
|
|
53
|
+
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_binary_path():
|
|
58
|
+
"""Return the full path to the native binary for this platform."""
|
|
59
|
+
suffix = get_platform_suffix()
|
|
60
|
+
if suffix is None:
|
|
61
|
+
return None
|
|
62
|
+
return get_bin_dir() / suffix
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def download_binary(force=False):
|
|
66
|
+
"""Download the native binary if not already present.
|
|
67
|
+
|
|
68
|
+
Tries the official download server first, falls back to GitHub Releases.
|
|
69
|
+
"""
|
|
70
|
+
binary_path = get_binary_path()
|
|
71
|
+
if binary_path is None:
|
|
72
|
+
print(f"Error: Unsupported platform: {platform.system()}/{platform.machine()}")
|
|
73
|
+
print("ZAgent supports: Linux (amd64/arm64), macOS (amd64/arm64), Windows (amd64/arm64)")
|
|
74
|
+
sys.exit(1)
|
|
75
|
+
|
|
76
|
+
if binary_path.exists() and not force:
|
|
77
|
+
return binary_path
|
|
78
|
+
|
|
79
|
+
binary_path.parent.mkdir(parents=True, exist_ok=True)
|
|
80
|
+
suffix = get_platform_suffix()
|
|
81
|
+
|
|
82
|
+
# The download server serves .zip for Windows and .tar.gz for Unix.
|
|
83
|
+
# We need to download and extract the archive to get the binary.
|
|
84
|
+
if system_is_windows():
|
|
85
|
+
archive_name = f"zagent-windows-{get_arch_name()}.zip"
|
|
86
|
+
else:
|
|
87
|
+
archive_name = f"zagent-{system_name()}-{get_arch_name()}.tar.gz"
|
|
88
|
+
|
|
89
|
+
download_url = f"{DOWNLOAD_BASE}/{archive_name}"
|
|
90
|
+
print(f"Downloading ZAgent v{VERSION} for {platform.system()}/{platform.machine()}...")
|
|
91
|
+
|
|
92
|
+
# Try official server first
|
|
93
|
+
if try_download_and_extract(download_url, binary_path, suffix):
|
|
94
|
+
return binary_path
|
|
95
|
+
|
|
96
|
+
# Fall back to GitHub Releases
|
|
97
|
+
gh_url = f"https://github.com/{GITHUB_REPO}/releases/latest/download/{archive_name}"
|
|
98
|
+
print(f"Primary download failed, trying GitHub: {gh_url}")
|
|
99
|
+
if try_download_and_extract(gh_url, binary_path, suffix):
|
|
100
|
+
return binary_path
|
|
101
|
+
|
|
102
|
+
print(f"Error: Failed to download ZAgent binary.")
|
|
103
|
+
print(f"Please download manually from https://zagent.samai.cc/install.html")
|
|
104
|
+
sys.exit(1)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def try_download_and_extract(url, binary_path, expected_name):
|
|
108
|
+
"""Download an archive from url and extract the binary."""
|
|
109
|
+
try:
|
|
110
|
+
req = urllib.request.Request(url, headers={"User-Agent": "zagent-pip"})
|
|
111
|
+
with urllib.request.urlopen(req, timeout=120) as resp:
|
|
112
|
+
data = resp.read()
|
|
113
|
+
|
|
114
|
+
import tempfile, tarfile, zipfile
|
|
115
|
+
tmpdir = tempfile.mkdtemp(prefix="zagent-pip-")
|
|
116
|
+
|
|
117
|
+
if url.endswith(".zip"):
|
|
118
|
+
# Windows zip
|
|
119
|
+
with zipfile.ZipFile(__import__("io").BytesIO(data)) as zf:
|
|
120
|
+
zf.extractall(tmpdir)
|
|
121
|
+
else:
|
|
122
|
+
# Unix tar.gz
|
|
123
|
+
with tarfile.open(fileobj=__import__("io").BytesIO(data), mode="r:gz") as tf:
|
|
124
|
+
tf.extractall(tmpdir)
|
|
125
|
+
|
|
126
|
+
# Find the binary in extracted files
|
|
127
|
+
binary_name = expected_name if system_is_windows() else "zagent"
|
|
128
|
+
found = None
|
|
129
|
+
for root, dirs, files in os.walk(tmpdir):
|
|
130
|
+
for f in files:
|
|
131
|
+
if f == binary_name or (system_is_windows() and f.lower() == "zagent.exe"):
|
|
132
|
+
found = os.path.join(root, f)
|
|
133
|
+
break
|
|
134
|
+
if found:
|
|
135
|
+
break
|
|
136
|
+
|
|
137
|
+
if not found:
|
|
138
|
+
print(f"Error: binary not found in archive")
|
|
139
|
+
import shutil
|
|
140
|
+
shutil.rmtree(tmpdir, ignore_errors=True)
|
|
141
|
+
return False
|
|
142
|
+
|
|
143
|
+
# Move binary to target path
|
|
144
|
+
import shutil
|
|
145
|
+
shutil.move(found, binary_path)
|
|
146
|
+
if not system_is_windows():
|
|
147
|
+
os.chmod(binary_path, 0o755)
|
|
148
|
+
shutil.rmtree(tmpdir, ignore_errors=True)
|
|
149
|
+
return True
|
|
150
|
+
|
|
151
|
+
except Exception as e:
|
|
152
|
+
print(f"Download/extract failed: {e}")
|
|
153
|
+
return False
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def system_is_windows():
|
|
157
|
+
return platform.system().lower() == "windows"
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def system_name():
|
|
161
|
+
s = platform.system().lower()
|
|
162
|
+
if s == "darwin":
|
|
163
|
+
return "darwin"
|
|
164
|
+
return s
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def get_arch_name():
|
|
168
|
+
m = platform.machine().lower()
|
|
169
|
+
if m in ("x86_64", "amd64", "i386"):
|
|
170
|
+
return "amd64"
|
|
171
|
+
if m in ("aarch64", "arm64"):
|
|
172
|
+
return "arm64"
|
|
173
|
+
return m
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def main():
|
|
177
|
+
"""Entry point for the `zagent` command."""
|
|
178
|
+
binary_path = get_binary_path()
|
|
179
|
+
|
|
180
|
+
if binary_path is None or not binary_path.exists():
|
|
181
|
+
binary_path = download_binary()
|
|
182
|
+
|
|
183
|
+
# Exec the native binary with all user arguments
|
|
184
|
+
try:
|
|
185
|
+
cmd = [str(binary_path)] + sys.argv[1:]
|
|
186
|
+
if system_is_windows():
|
|
187
|
+
# On Windows, use subprocess to avoid console window issues
|
|
188
|
+
result = subprocess.run(cmd)
|
|
189
|
+
sys.exit(result.returncode)
|
|
190
|
+
else:
|
|
191
|
+
# On Unix, exec to replace the Python process
|
|
192
|
+
os.execvp(str(binary_path), cmd)
|
|
193
|
+
except FileNotFoundError:
|
|
194
|
+
print(f"Error: ZAgent binary not found at {binary_path}")
|
|
195
|
+
print("Try running `zagent` again to re-download, or install manually from https://zagent.samai.cc")
|
|
196
|
+
sys.exit(1)
|
|
197
|
+
except KeyboardInterrupt:
|
|
198
|
+
sys.exit(130)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
if __name__ == "__main__":
|
|
202
|
+
main()
|