Add agent_id to WebSocket authentication
- Add UUID-based agent_id field to Config struct - Auto-generate and persist agent_id on first run - Include agent_id in WebSocket query parameters - Update production server URL to connect.azcomputerguru.com Fixes WebSocket connection failure where server expected agent_id parameter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,17 +29,17 @@ pub struct WebSocketTransport {
|
||||
|
||||
impl WebSocketTransport {
|
||||
/// Connect to the server
|
||||
pub async fn connect(url: &str, api_key: &str) -> Result<Self> {
|
||||
// Append API key as query parameter
|
||||
let url_with_auth = if url.contains('?') {
|
||||
format!("{}&api_key={}", url, api_key)
|
||||
pub async fn connect(url: &str, agent_id: &str, api_key: &str) -> Result<Self> {
|
||||
// Append agent_id and API key as query parameters
|
||||
let url_with_params = if url.contains('?') {
|
||||
format!("{}&agent_id={}&api_key={}", url, agent_id, api_key)
|
||||
} else {
|
||||
format!("{}?api_key={}", url, api_key)
|
||||
format!("{}?agent_id={}&api_key={}", url, agent_id, api_key)
|
||||
};
|
||||
|
||||
tracing::info!("Connecting to {}", url);
|
||||
tracing::info!("Connecting to {} as agent {}", url, agent_id);
|
||||
|
||||
let (ws_stream, response) = connect_async(&url_with_auth)
|
||||
let (ws_stream, response) = connect_async(&url_with_params)
|
||||
.await
|
||||
.context("Failed to connect to WebSocket server")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user