Merge branch 'master' of https://github.com/SciSharp/BotSharp into features/add-agent-function-visibility

This commit is contained in:
Jicheng Lu 2025-08-19 10:20:55 -05:00
commit 14e416c213
3 changed files with 23 additions and 1 deletions

View file

@ -38,7 +38,7 @@
<PackageVersion Include="Nanoid" Version="3.1.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="8.1.2" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
<PackageVersion Include="Anthropic.SDK" Version="5.1.1" />
<PackageVersion Include="Anthropic.SDK" Version="5.5.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageVersion Include="NAudio" Version="2.2.1" />
<PackageVersion Include="NAudio.Core" Version="2.2.1" />

View file

@ -29,6 +29,10 @@ public class WinOSDriver : IComputerUse
case "right_click":
WindowsMouseController.RightClick();
break;
case "cursor_position":
var (x, y) = WindowsMouseController.GetCurrentCursorPosition();
Console.WriteLine($"Current cursor position: ({x}, {y})");
break;
default:
throw new ToolError($"Action {action} is not supported");
}

View file

@ -13,6 +13,13 @@ public class WindowsMouseController
public int Left, Top, Right, Bottom;
}
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
}
// Define MONITORINFO structure
[StructLayout(LayoutKind.Sequential)]
public struct MONITORINFO
@ -34,6 +41,10 @@ public class WindowsMouseController
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFO lpmi);
[DllImport("user32.dll")]
private static extern bool GetCursorPos(out POINT lpPoint);
// Class to hold monitor information
public class MonitorInfo
{
@ -41,6 +52,13 @@ public class WindowsMouseController
public RECT MonitorArea;
}
// Method to get current cursor position
public static (int x, int y) GetCurrentCursorPosition()
{
GetCursorPos(out POINT cursorPos);
return (cursorPos.X, cursorPos.Y);
}
// Method to get all connected monitors
public static List<MonitorInfo> GetMonitors()
{