feat(agent): derive + report deterministic machine_uid (SPEC-004 Task 1)
All checks were successful
All checks were successful
Agent now derives a recomputable, opaque machine_uid (Windows: SHA-256 of the OS MachineGuid at HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid -> muid_<hex>; non-Windows / registry-failure: persisted random UUID, warn-logged). Raw GUID never exposed; OnceLock-cached. Reported ALONGSIDE agent_id (unchanged) on AgentStatus (new additive proto field 12) and in the connect handshake query. This is the stable identity that fixes config-loss duplicate registrations (DESKTOP-I66IM5Q x9); server-side dedup keying that consumes it is SPEC-004 Task 2. Non-breaking, isolated. 5 unit tests; cargo fmt/clippy(-D warnings)/test green on GURU-5070. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -35,14 +35,25 @@ impl WebSocketTransport {
|
||||
api_key: &str,
|
||||
hostname: Option<&str>,
|
||||
support_code: Option<&str>,
|
||||
machine_uid: Option<&str>,
|
||||
) -> Result<Self> {
|
||||
// Build query parameters
|
||||
// Build query parameters. agent_id + api_key are kept exactly as-is;
|
||||
// machine_uid is appended ALONGSIDE them (v2 stable-identity Task 1) so
|
||||
// the server sees the deterministic identity at connect time. It does not
|
||||
// change registration keying (a separate server-side task).
|
||||
let mut params = format!("agent_id={}&api_key={}", agent_id, api_key);
|
||||
|
||||
if let Some(hostname) = hostname {
|
||||
params.push_str(&format!("&hostname={}", urlencoding::encode(hostname)));
|
||||
}
|
||||
|
||||
if let Some(machine_uid) = machine_uid {
|
||||
params.push_str(&format!(
|
||||
"&machine_uid={}",
|
||||
urlencoding::encode(machine_uid)
|
||||
));
|
||||
}
|
||||
|
||||
if let Some(code) = support_code {
|
||||
params.push_str(&format!("&support_code={}", code));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user