(timestamp: Option<Value>)
| 7 | use serde_json::{json, Value}; |
| 8 | |
| 9 | fn input(timestamp: Option<Value>) -> Vec<u8> { |
| 10 | let mut raw = json!({ |
| 11 | "session_id": "source-time", |
| 12 | "conversation_id": "source-time", |
| 13 | "taskId": "source-time", |
| 14 | "thread_id": "source-time", |
| 15 | "prompt": "Keep the source time", |
| 16 | "tool_name": "read", |
| 17 | "tool_use_id": "tool-1", |
| 18 | // These are user data, not the hook envelope's timestamp. |
| 19 | "tool_input": {"timestamp": "not an event timestamp"}, |
| 20 | "extra": {"timestamp": "not an event timestamp"}, |
| 21 | }); |
| 22 | if let Some(timestamp) = timestamp { |
| 23 | raw["timestamp"] = timestamp; |
| 24 | } |
| 25 | serde_json::to_vec(&raw).unwrap() |
| 26 | } |
| 27 | |
| 28 | fn source_timestamps(agent: &str) -> Vec<Value> { |
| 29 | match agent { |
no test coverage detected