MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / codex_session_context_for_event

Function codex_session_context_for_event

src/hooks/codex.rs:115–133  ·  view source on GitHub ↗

Builds Codex session/prompt context.

(event_json: &str)

Source from the content-addressed store, hash-verified

113
114/// Builds Codex session/prompt context.
115async fn codex_session_context_for_event(event_json: &str) -> (String, HookWorkspaceStatus) {
116 let parsed = serde_json::from_str::<Value>(event_json).unwrap_or(Value::Null);
117 let root = codex_project_root_from_parsed_event(&parsed);
118 let cwd = event_cwd_from_parsed(&parsed);
119 let session_id = event_session_id(&parsed);
120 let status = codex_workspace_status(root.as_deref(), cwd.as_deref());
121 record_workspace_status_analytics(root.as_deref(), status, session_id.as_deref());
122 let staleness = match (status, root.as_deref()) {
123 (HookWorkspaceStatus::Initialized, Some(r)) => {
124 let (staleness, _) = cursor_index_signals_for_root(r).await;
125 staleness
126 }
127 _ => None,
128 };
129 (
130 build_codex_session_context_for_workspace(status, staleness.as_deref()),
131 status,
132 )
133}
134
135/// Codex `SubagentStart` hook handler.
136pub async fn hook_codex_subagent_start() -> i32 {

Tested by

no test coverage detected