codex_runtime/runtime/
mod.rs1pub mod api;
2pub mod approvals;
3pub mod client;
4pub mod core;
5pub(crate) mod detached_task;
6pub mod errors;
7pub mod events;
8pub mod hooks;
9pub(crate) mod id;
10pub mod metrics;
11pub mod rpc;
12pub mod rpc_contract;
13pub(crate) mod runtime_validation;
14pub mod shell_hook;
15pub mod sink;
16pub mod state;
17pub mod transport;
18pub(crate) mod turn_lifecycle;
19pub mod turn_output;
20
21pub use api::{
22 ApprovalPolicy, ByteRange, CommandExecOutputDeltaNotification, CommandExecOutputStream,
23 CommandExecParams, CommandExecResizeParams, CommandExecResizeResponse, CommandExecResponse,
24 CommandExecTerminalSize, CommandExecTerminateParams, CommandExecTerminateResponse,
25 CommandExecWriteParams, CommandExecWriteResponse, ExternalNetworkAccess, InputItem,
26 Personality, PromptAttachment, PromptRunError, PromptRunParams, PromptRunResult,
27 PromptRunStream, PromptRunStreamEvent, ReasoningEffort, SandboxPolicy, SandboxPreset,
28 ServiceTier, SkillDependencies, SkillErrorInfo, SkillInterface, SkillMetadata, SkillScope,
29 SkillToolDependency, SkillsListEntry, SkillsListExtraRootsForCwd, SkillsListParams,
30 SkillsListResponse, TextElement, ThreadAgentMessageItemView, ThreadCommandExecutionItemView,
31 ThreadHandle, ThreadItemPayloadView, ThreadItemType, ThreadItemView, ThreadListParams,
32 ThreadListResponse, ThreadListSortKey, ThreadLoadedListParams, ThreadLoadedListResponse,
33 ThreadReadParams, ThreadReadResponse, ThreadRollbackParams, ThreadRollbackResponse,
34 ThreadStartParams, ThreadTurnErrorView, ThreadTurnStatus, ThreadTurnView, ThreadView,
35 TurnHandle, TurnStartParams, DEFAULT_REASONING_EFFORT,
36};
37pub use approvals::{ServerRequest, ServerRequestConfig, TimeoutAction};
38pub use client::{
39 Client, ClientConfig, ClientError, CompatibilityGuard, RunProfile, SemVerTriplet, Session,
40 SessionConfig,
41};
42pub use core::{InitializeCapabilities, RestartPolicy, Runtime, RuntimeConfig, SupervisorConfig};
43pub use errors::{RpcError, RpcErrorObject, RuntimeError, SinkError};
44pub use hooks::RuntimeHookConfig;
45pub use metrics::RuntimeMetricsSnapshot;
46pub use rpc_contract::RpcValidationMode;
47pub use shell_hook::ShellCommandHook;
48pub use transport::{StdioProcessSpec, StdioTransportConfig};
49
50pub type ServerRequestRx = tokio::sync::mpsc::Receiver<ServerRequest>;
51
52pub(crate) fn now_millis() -> i64 {
55 use std::time::{SystemTime, UNIX_EPOCH};
56 match SystemTime::now().duration_since(UNIX_EPOCH) {
57 Ok(d) => d.as_millis() as i64,
58 Err(_) => 0,
59 }
60}