gemini-computer-use 0.2.4 → 0.4.2
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 +741 -24
- package/bin/cli.js +112 -17
- package/core/agent.py +503 -18
- 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 +1840 -112
- 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 +8 -3
- package/skills/orchestrator.md +12 -0
package/bin/cli.js
CHANGED
|
@@ -1,27 +1,122 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawn } = require('child_process');
|
|
3
|
+
const fs = require('fs');
|
|
3
4
|
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
|
|
5
7
|
const isWindows = os.platform() === 'win32';
|
|
6
|
-
const
|
|
8
|
+
const argv = process.argv.slice(2);
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
// The local maintenance subcommands run scripts that ship next to this CLI:
|
|
11
|
+
// in the installer payload, or in a repository checkout. Only the FIRST argument
|
|
12
|
+
// is inspected, so every other invocation - including the argument-passing
|
|
13
|
+
// bootstrap "-Quick", "-User <name>", "-Gateway <domain>" - is forwarded to the
|
|
14
|
+
// published installer exactly as before.
|
|
15
|
+
const LOCAL_SCRIPTS = {
|
|
16
|
+
doctor: path.join('ops', 'doctor.ps1'),
|
|
17
|
+
restart: path.join('ops', 'windows', 'agent-watchdog.ps1'),
|
|
18
|
+
update: path.join('ops', 'update.ps1')
|
|
19
|
+
};
|
|
9
20
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Printed for "-h"/"-help"/"--help": the scripts declare their own parameter
|
|
22
|
+
// blocks, and forwarding a help flag to them only produced a PowerShell
|
|
23
|
+
// "parameter cannot be found" error.
|
|
24
|
+
const LOCAL_USAGE = {
|
|
25
|
+
doctor: [
|
|
26
|
+
'usage: gemini-computer-use doctor [-Json] [-ConfigDir <path>] [-TailLines <n>]',
|
|
27
|
+
' read-only node diagnostic: autostart interpreter, heartbeat, log tail, gateway state',
|
|
28
|
+
' exit code 0 when the node is healthy, 2 otherwise'
|
|
29
|
+
].join('\n'),
|
|
30
|
+
restart: [
|
|
31
|
+
'usage: gemini-computer-use restart [-Quiet] [-ConfigDir <path>] [-LogFile <path>] [-GraceSeconds <n>]',
|
|
32
|
+
' runs the watchdog once and starts the agent when the node is offline',
|
|
33
|
+
' exit code 0 when the node is online, 2 when the node is misconfigured, 3 when it is still offline'
|
|
34
|
+
].join('\n'),
|
|
35
|
+
update: [
|
|
36
|
+
'usage: gemini-computer-use update [-Check] [-Force] [-Offline] [-NoRestart] [-Json]',
|
|
37
|
+
' [-InstallDir <path>] [-Python <path>] [-ConfigDir <path>]',
|
|
38
|
+
' self-update from the newest GitHub release: -Check only reports what the',
|
|
39
|
+
' newest published version is, without -Check the payload is downloaded, its',
|
|
40
|
+
' SHA-256 verified and installed with a rollback backup, then the node restarts',
|
|
41
|
+
' exit code 0 up to date or applied, 2 update available (-Check), 3 failed,',
|
|
42
|
+
' 4 applied and the node is restarting'
|
|
43
|
+
].join('\n')
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function findLocalScript(relative) {
|
|
47
|
+
// The CLI is "bin/cli.js", so the payload/repository root is its parent; a
|
|
48
|
+
// bundled layout that puts ops/ next to the CLI and the current directory are
|
|
49
|
+
// accepted as well.
|
|
50
|
+
const roots = [path.resolve(__dirname, '..'), path.resolve(__dirname), process.cwd()];
|
|
51
|
+
for (const root of roots) {
|
|
52
|
+
const candidate = path.join(root, relative);
|
|
53
|
+
if (fs.existsSync(candidate)) {
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function runLocalScript(name, rest) {
|
|
61
|
+
if (!isWindows) {
|
|
62
|
+
console.error(`${name} is Windows-only: it drives Windows PowerShell 5.1 scripts.`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
if (rest.some(arg => ['-h', '--h', '-help', '--help'].includes(arg.toLowerCase()))) {
|
|
66
|
+
console.log(LOCAL_USAGE[name]);
|
|
67
|
+
process.exit(0);
|
|
68
|
+
}
|
|
69
|
+
const relative = LOCAL_SCRIPTS[name];
|
|
70
|
+
const script = findLocalScript(relative);
|
|
71
|
+
if (!script) {
|
|
72
|
+
console.error(`Cannot find ${relative.split(path.sep).join('/')} next to this CLI.`);
|
|
73
|
+
console.error('Run this from an installed node or from a repository checkout: the');
|
|
74
|
+
console.error('doctor and the watchdog ship with the installer payload.');
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
// Windows PowerShell binds parameter names case-insensitively and accepts the
|
|
78
|
+
// documented spelling, so a "--json" style flag only needs its second dash
|
|
79
|
+
// removed to reach -Json. Everything else is passed through untouched.
|
|
80
|
+
const forwarded = rest.map(arg => (arg.startsWith('--') ? arg.slice(1) : arg));
|
|
81
|
+
const ps = spawn(
|
|
82
|
+
'powershell.exe',
|
|
83
|
+
['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', script].concat(forwarded),
|
|
84
|
+
{ stdio: 'inherit' }
|
|
85
|
+
);
|
|
86
|
+
ps.on('error', (err) => {
|
|
87
|
+
console.error(`${name}: could not start powershell.exe: ${err.message}`);
|
|
88
|
+
process.exit(1);
|
|
24
89
|
});
|
|
25
|
-
|
|
90
|
+
ps.on('exit', (code) => process.exit(code === null ? 1 : code));
|
|
26
91
|
}
|
|
27
92
|
|
|
93
|
+
function launchRemoteInstaller(args) {
|
|
94
|
+
const rawArgs = args.map(arg => `"${arg.replace(/"/g, '\\"')}"`).join(' ');
|
|
95
|
+
|
|
96
|
+
console.log('🚀 Launching Gemini Computer Use installer...');
|
|
97
|
+
|
|
98
|
+
if (isWindows) {
|
|
99
|
+
const psCmd = rawArgs
|
|
100
|
+
? `& { $s = Invoke-RestMethod https://racknerd-5a24bf9.merino-carob.ts.net/install.ps1; & ([scriptblock]::Create($s)) ${rawArgs} }`
|
|
101
|
+
: `irm https://racknerd-5a24bf9.merino-carob.ts.net/install.ps1 | iex`;
|
|
102
|
+
const ps = spawn('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-Command', psCmd], {
|
|
103
|
+
stdio: 'inherit'
|
|
104
|
+
});
|
|
105
|
+
ps.on('exit', (code) => process.exit(code || 0));
|
|
106
|
+
} else {
|
|
107
|
+
const bashCmd = rawArgs
|
|
108
|
+
? `curl -fsSL https://racknerd-5a24bf9.merino-carob.ts.net/install.sh | bash -s -- ${rawArgs}`
|
|
109
|
+
: `curl -fsSL https://racknerd-5a24bf9.merino-carob.ts.net/install.sh | bash`;
|
|
110
|
+
const sh = spawn('bash', ['-c', bashCmd], {
|
|
111
|
+
stdio: 'inherit'
|
|
112
|
+
});
|
|
113
|
+
sh.on('exit', (code) => process.exit(code || 0));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const subcommand = (argv[0] || '').toLowerCase();
|
|
118
|
+
if (Object.prototype.hasOwnProperty.call(LOCAL_SCRIPTS, subcommand)) {
|
|
119
|
+
runLocalScript(subcommand, argv.slice(1));
|
|
120
|
+
} else {
|
|
121
|
+
launchRemoteInstaller(argv);
|
|
122
|
+
}
|