MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse

Function parse

atomic-agent/tests/grok_real_payloads.rs:24–29  ·  view source on GitHub ↗
(hook_type: HookType, payload: &str)

Source from the content-addressed store, hash-verified

22const SESSION_END: &str = include_str!("fixtures/grok-1.0.77/session_end.json");
23
24fn parse(hook_type: HookType, payload: &str) -> TurnEvent {
25 let registry = AgentRegistry::with_defaults();
26 let grok = registry.require("grok").unwrap();
27 grok.parse_event(hook_type, payload.as_bytes())
28 .unwrap_or_else(|error| panic!("grok {hook_type}: {error}"))
29}
30
31fn raw_str<'a>(event: &'a TurnEvent, key: &str) -> Option<&'a str> {
32 event.raw_json.as_ref()?.get(key).and_then(Value::as_str)

Calls 4

unwrapMethod · 0.45
requireMethod · 0.45
parse_eventMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected