gemini-computer-use 0.2.3 → 0.4.1
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.
- package/README.md +935 -148
- package/bin/cli.js +112 -17
- package/core/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/__pycache__/agent.cpython-313.pyc +0 -0
- package/core/__pycache__/code_cache.cpython-313.pyc +0 -0
- package/core/__pycache__/mcp_tools.cpython-313.pyc +0 -0
- package/core/__pycache__/schemas.cpython-313.pyc +0 -0
- package/core/__pycache__/server.cpython-313.pyc +0 -0
- package/core/__pycache__/vitals.cpython-313.pyc +0 -0
- package/core/__pycache__/web_share.cpython-313.pyc +0 -0
- package/core/agent.py +688 -27
- package/core/agent_harness.py +9 -2
- package/core/code_cache.py +15 -3
- package/core/device.py +2400 -0
- package/core/domain.py +303 -0
- package/core/mcp_tools.py +1949 -110
- package/core/policies.py +35 -5
- package/core/server.py +78 -32
- package/core/termux.py +916 -0
- package/core/updater.py +1713 -0
- package/core/version.py +31 -0
- package/core/vitals.py +66 -2
- package/core/web_share.py +814 -0
- package/gateway.py +1469 -98
- package/install-gui.cmd +40 -0
- package/install-gui.ps1 +1882 -0
- package/install-gui.strings.json +211 -0
- package/install.ps1 +960 -92
- package/install.sh +1214 -81
- package/ops/doctor.ps1 +735 -0
- package/ops/mesh-domain.sh +86 -0
- package/ops/nginx/README.md +77 -0
- package/ops/nginx/antigravity-mesh-mcp.conf +172 -0
- package/ops/nginx/mesh-domain.vhost.template +58 -0
- package/ops/nginx/render-domain.sh +123 -0
- package/ops/update.ps1 +373 -0
- package/ops/windows/README.md +298 -0
- package/ops/windows/agent-watchdog.ps1 +575 -0
- package/ops/windows/run-hidden.vbs +64 -0
- package/package.json +6 -2
- package/skills/orchestrator.md +12 -0
package/core/version.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""core/version.py - the ONE place this node's version is declared.
|
|
2
|
+
|
|
3
|
+
Every other place that needs the node version asks this module:
|
|
4
|
+
|
|
5
|
+
* ``core/updater.py`` compares it against the newest GitHub release;
|
|
6
|
+
* ``core/mcp_tools.py`` reports it from ``mesh_status`` and ``mesh_update``;
|
|
7
|
+
* ``build-installer-exe.ps1`` refuses to build when ``package.json`` disagrees
|
|
8
|
+
with it, so the npm package and the Python node can never ship as two
|
|
9
|
+
different versions;
|
|
10
|
+
* ``tests/test_version_single_source.py`` pins that agreement.
|
|
11
|
+
|
|
12
|
+
The repository deliberately keeps no second literal: a version that lives in two
|
|
13
|
+
files is a version that eventually disagrees with itself, and an updater that
|
|
14
|
+
compares the wrong number either reinstalls forever or never updates at all.
|
|
15
|
+
|
|
16
|
+
Format: ``MAJOR.MINOR.PATCH``, optionally followed by a pre-release suffix
|
|
17
|
+
(``0.3.0-rc.1``). The suffix never changes the meaning of the three numbers; a
|
|
18
|
+
pre-release is older than the release it precedes, which is what
|
|
19
|
+
``core.updater.is_newer`` implements.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
#: The node version. Keep it in sync with ``package.json`` (the build enforces it).
|
|
23
|
+
__version__ = "0.4.1"
|
|
24
|
+
|
|
25
|
+
#: The repository that publishes the releases this node updates itself from.
|
|
26
|
+
#: Declared here as well so a checkout says where it came from; ``package.json``
|
|
27
|
+
#: carries the same slug under ``repository.url`` and a test pins the agreement.
|
|
28
|
+
REPO_SLUG = "LevRa7/Computer-use-for-Gemini-App-Web"
|
|
29
|
+
|
|
30
|
+
#: Anchored pattern for the only accepted spelling, used by the single-source test.
|
|
31
|
+
VERSION_PATTERN = r"^\d+\.\d+\.\d+(?:-[0-9A-Za-z.\-]+)?$"
|
package/core/vitals.py
CHANGED
|
@@ -3,11 +3,70 @@ import platform
|
|
|
3
3
|
import shutil
|
|
4
4
|
import socket
|
|
5
5
|
import subprocess
|
|
6
|
+
import time
|
|
6
7
|
from typing import Dict, Any
|
|
7
8
|
|
|
9
|
+
|
|
10
|
+
def _windows_cpu_usage_pct(sample_seconds: float = 0.1) -> float:
|
|
11
|
+
"""Measured CPU utilisation on Windows.
|
|
12
|
+
|
|
13
|
+
Windows has no load average, so ``os.getloadavg`` does not exist and the
|
|
14
|
+
previous code reported a hardcoded 0.0. ``GetSystemTimes`` gives idle and
|
|
15
|
+
total processor time, and their delta over a short sample is the utilisation
|
|
16
|
+
every other Windows tool reports.
|
|
17
|
+
"""
|
|
18
|
+
try:
|
|
19
|
+
import ctypes
|
|
20
|
+
from ctypes import wintypes
|
|
21
|
+
|
|
22
|
+
class FILETIME(ctypes.Structure):
|
|
23
|
+
_fields_ = [
|
|
24
|
+
("dwLowDateTime", wintypes.DWORD),
|
|
25
|
+
("dwHighDateTime", wintypes.DWORD),
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
def as_int(value: "FILETIME") -> int:
|
|
29
|
+
return (value.dwHighDateTime << 32) | value.dwLowDateTime
|
|
30
|
+
|
|
31
|
+
kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]
|
|
32
|
+
|
|
33
|
+
def sample():
|
|
34
|
+
idle_c, kernel_c, user_c = FILETIME(), FILETIME(), FILETIME()
|
|
35
|
+
ok = kernel32.GetSystemTimes(
|
|
36
|
+
ctypes.byref(idle_c), ctypes.byref(kernel_c), ctypes.byref(user_c)
|
|
37
|
+
)
|
|
38
|
+
if not ok:
|
|
39
|
+
return None
|
|
40
|
+
return as_int(idle_c), as_int(kernel_c), as_int(user_c)
|
|
41
|
+
|
|
42
|
+
first = sample()
|
|
43
|
+
if first is None:
|
|
44
|
+
return 0.0
|
|
45
|
+
time.sleep(sample_seconds)
|
|
46
|
+
second = sample()
|
|
47
|
+
if second is None:
|
|
48
|
+
return 0.0
|
|
49
|
+
|
|
50
|
+
idle_delta = second[0] - first[0]
|
|
51
|
+
total_delta = (second[1] - first[1]) + (second[2] - first[2])
|
|
52
|
+
if total_delta <= 0:
|
|
53
|
+
return 0.0
|
|
54
|
+
usage = 100.0 * (total_delta - idle_delta) / total_delta
|
|
55
|
+
return round(max(0.0, min(100.0, usage)), 1)
|
|
56
|
+
except Exception:
|
|
57
|
+
return 0.0
|
|
58
|
+
|
|
59
|
+
|
|
8
60
|
def get_host_vitals() -> Dict[str, Any]:
|
|
9
61
|
hostname = socket.gethostname()
|
|
10
|
-
system = platform.system() # 'Linux', 'Darwin', 'Windows'
|
|
62
|
+
system = platform.system() # 'Linux', 'Darwin', 'Windows' - and 'Android' on a phone
|
|
63
|
+
|
|
64
|
+
# Python on Android (Termux, 3.13+) answers platform.system() == "Android", not
|
|
65
|
+
# "Linux", although it is Linux underneath and /proc is right there. Without this
|
|
66
|
+
# a phone reported "0 MB of RAM" - verified on an OPPO PHY110 running Android 16
|
|
67
|
+
# with Python 3.14, where the memory block came back as 0.0/0.0 MB. The file is
|
|
68
|
+
# the honest signal, so it decides.
|
|
69
|
+
linux_like = system == "Linux" or os.path.isfile("/proc/meminfo")
|
|
11
70
|
|
|
12
71
|
# CPU load average (Unix)
|
|
13
72
|
cpu_load = {"1m": 0.0, "5m": 0.0, "15m": 0.0}
|
|
@@ -19,6 +78,11 @@ def get_host_vitals() -> Dict[str, Any]:
|
|
|
19
78
|
"5m": round(load[1], 2),
|
|
20
79
|
"15m": round(load[2], 2),
|
|
21
80
|
}
|
|
81
|
+
elif system == "Windows":
|
|
82
|
+
# No load average exists there: report the measured utilisation in all
|
|
83
|
+
# three slots so no consumer reads a fabricated zero.
|
|
84
|
+
usage = _windows_cpu_usage_pct()
|
|
85
|
+
cpu_load = {"1m": usage, "5m": usage, "15m": usage}
|
|
22
86
|
except Exception:
|
|
23
87
|
pass
|
|
24
88
|
|
|
@@ -26,7 +90,7 @@ def get_host_vitals() -> Dict[str, Any]:
|
|
|
26
90
|
total_mb = 0.0
|
|
27
91
|
free_mb = 0.0
|
|
28
92
|
|
|
29
|
-
if
|
|
93
|
+
if linux_like:
|
|
30
94
|
total_kb, avail_kb = 0, 0
|
|
31
95
|
try:
|
|
32
96
|
with open("/proc/meminfo", "r") as f:
|