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.
()
| 631 | /// This is only used when the OpenCode plugin fails to provide a session_id, |
| 632 | /// which should be rare. Uses timestamp + random bits for uniqueness. |
| 633 | fn uuid_short() -> String { |
| 634 | use std::time::{SystemTime, UNIX_EPOCH}; |
| 635 | |
| 636 | let now = SystemTime::now() |
| 637 | .duration_since(UNIX_EPOCH) |
| 638 | .unwrap_or_default() |
| 639 | .as_millis(); |
| 640 | |
| 641 | // Use lower 32 bits of timestamp for a short hex ID |
| 642 | format!("{:08x}", (now & 0xFFFF_FFFF) as u32) |
| 643 | } |
| 644 | |
| 645 | // OpenCode hook verb → HookType mapping (registered in event.rs) |
| 646 |
no outgoing calls