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.
Files changed (41) hide show
  1. package/README.md +935 -148
  2. package/bin/cli.js +112 -17
  3. package/core/__pycache__/__init__.cpython-313.pyc +0 -0
  4. package/core/__pycache__/agent.cpython-313.pyc +0 -0
  5. package/core/__pycache__/code_cache.cpython-313.pyc +0 -0
  6. package/core/__pycache__/mcp_tools.cpython-313.pyc +0 -0
  7. package/core/__pycache__/schemas.cpython-313.pyc +0 -0
  8. package/core/__pycache__/server.cpython-313.pyc +0 -0
  9. package/core/__pycache__/vitals.cpython-313.pyc +0 -0
  10. package/core/__pycache__/web_share.cpython-313.pyc +0 -0
  11. package/core/agent.py +688 -27
  12. package/core/agent_harness.py +9 -2
  13. package/core/code_cache.py +15 -3
  14. package/core/device.py +2400 -0
  15. package/core/domain.py +303 -0
  16. package/core/mcp_tools.py +1949 -110
  17. package/core/policies.py +35 -5
  18. package/core/server.py +78 -32
  19. package/core/termux.py +916 -0
  20. package/core/updater.py +1713 -0
  21. package/core/version.py +31 -0
  22. package/core/vitals.py +66 -2
  23. package/core/web_share.py +814 -0
  24. package/gateway.py +1469 -98
  25. package/install-gui.cmd +40 -0
  26. package/install-gui.ps1 +1882 -0
  27. package/install-gui.strings.json +211 -0
  28. package/install.ps1 +960 -92
  29. package/install.sh +1214 -81
  30. package/ops/doctor.ps1 +735 -0
  31. package/ops/mesh-domain.sh +86 -0
  32. package/ops/nginx/README.md +77 -0
  33. package/ops/nginx/antigravity-mesh-mcp.conf +172 -0
  34. package/ops/nginx/mesh-domain.vhost.template +58 -0
  35. package/ops/nginx/render-domain.sh +123 -0
  36. package/ops/update.ps1 +373 -0
  37. package/ops/windows/README.md +298 -0
  38. package/ops/windows/agent-watchdog.ps1 +575 -0
  39. package/ops/windows/run-hidden.vbs +64 -0
  40. package/package.json +6 -2
  41. 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 rawArgs = process.argv.slice(2).map(arg => `"${arg.replace(/"/g, '\\"')}"`).join(' ');
8
+ const argv = process.argv.slice(2);
7
9
 
8
- console.log('🚀 Launching Gemini Computer Use installer...');
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
- if (isWindows) {
11
- const psCmd = rawArgs
12
- ? `& { $s = Invoke-RestMethod https://smart-server.online/install.ps1; & ([scriptblock]::Create($s)) ${rawArgs} }`
13
- : `irm https://smart-server.online/install.ps1 | iex`;
14
- const ps = spawn('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-Command', psCmd], {
15
- stdio: 'inherit'
16
- });
17
- ps.on('exit', (code) => process.exit(code || 0));
18
- } else {
19
- const bashCmd = rawArgs
20
- ? `curl -fsSL https://smart-server.online/install.sh | bash -s -- ${rawArgs}`
21
- : `curl -fsSL https://smart-server.online/install.sh | bash`;
22
- const sh = spawn('bash', ['-c', bashCmd], {
23
- stdio: 'inherit'
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
- sh.on('exit', (code) => process.exit(code || 0));
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://smart-server.online/install.ps1; & ([scriptblock]::Create($s)) ${rawArgs} }`
101
+ : `irm https://smart-server.online/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://smart-server.online/install.sh | bash -s -- ${rawArgs}`
109
+ : `curl -fsSL https://smart-server.online/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
+ }