Generate a short hex string for fallback session IDs. This is only used when the OpenCode plugin fails to provide a session_id, which should be rare. Uses timestamp + random bits for uniqueness.
()
| 641 | /// This is only used when the OpenCode plugin fails to provide a session_id, |
| 642 | /// which should be rare. Uses timestamp + random bits for uniqueness. |
| 643 | fn uuid_short() -> String { |
| 644 | use std::time::{SystemTime, UNIX_EPOCH}; |
| 645 | |
| 646 | let now = SystemTime::now() |
| 647 | .duration_since(UNIX_EPOCH) |
| 648 | .unwrap_or_default() |
| 649 | .as_millis(); |
| 650 | |
| 651 | // Use lower 32 bits of timestamp for a short hex ID |
| 652 | format!("{:08x}", (now & 0xFFFF_FFFF) as u32) |
| 653 | } |
| 654 | |
| 655 | // OpenCode hook verb → HookType mapping (registered in event.rs) |
| 656 |
no outgoing calls