Expose thread APIs for message board access (#59154)

## What changed

- Add `CodexThread` methods for reading the registration source, resolving agent references, and reading the configured clock.
- Replace the board-specific thread lookup with public `ThreadManager::get_thread_with_extension`, which requires matching typed extension data and never loads a missing runtime.
- Update the local message board host to use these APIs and thread startup metadata instead of accessing session internals directly.

GitOrigin-RevId: 143b798cc710e079e20be59a84d05738a3bc6a0b
This commit is contained in:
jif
2026-11-03 13:17:38 +00:00
committed by copyberry
parent f05aa41da6
commit 4a971492e7
3 changed files with 56 additions and 49 deletions
+30
View File
@@ -245,6 +245,36 @@ impl CodexThread {
self.submit_with_trace(op, /*trace*/ None).await
}
/// Returns the source used for registration and agent-reference resolution.
/// Internal runtimes can have a different source in their captured session settings.
pub fn session_source(&self) -> &SessionSource {
&self.session_source
}
/// Resolves an agent reference through this thread's controller without loading it.
pub async fn resolve_agent_reference(&self, target: &str) -> CodexResult<ThreadId> {
self.session
.services
.agent_control
.resolve(
self.session.thread_id,
self.session_source.parent_thread_id(),
&self.session_source,
target,
)
.await
}
/// Reads this thread's configured clock, including an external or simulated clock.
pub async fn current_time(&self) -> CodexResult<DateTime<Utc>> {
self.session
.services
.time_provider
.current_time(self.session.thread_id)
.await
.map_err(|error| CodexErr::Io(std::io::Error::other(error)))
}
/// Returns the session telemetry handle for thread-scoped production instrumentation.
pub fn session_telemetry(&self) -> SessionTelemetry {
self.session.services.session_telemetry.clone()