1pub mod approval;
10pub mod config;
11pub mod context;
12pub mod context_compiler;
13pub mod context_snapshot;
14pub mod dispatch;
15pub mod handle;
16pub mod host_bundle;
17pub mod hosts;
18pub mod kernel_event;
19pub mod kernel_event_golden;
20pub mod kernel_mode;
21pub mod kernel_turn_host;
22pub mod loop_guard;
23pub mod lsp_edit_paths;
24pub mod op;
25pub mod op_loop;
26pub mod platform_ext;
27pub mod request_fingerprint;
28pub mod runtime;
29pub mod runtime_new;
30pub mod scratchpad_state;
31pub mod start_turn;
32pub mod streaming;
33pub mod subagent_port;
34pub mod token_estimate;
35pub mod tool_bridge;
36pub mod tool_catalog;
37mod tool_dispatch;
38pub mod tool_effects;
39pub mod tool_parser;
40pub mod tool_progress;
41pub mod turn_loop;
42pub mod turn_machine;
43mod turn_port;
44
45pub use crate::session::{Session, SessionUsage};
46pub use crate::turn::{TurnContext, TurnLoopMode, TurnOutcomeStatus};
47pub use approval::{
48 ApprovalDecision, ApprovalResult, UserInputDecision, await_tool_approval,
49 recv_user_input_for_tool,
50};
51pub use context::{
52 COMPACTION_SUMMARY_MARKER, MAX_CONTEXT_RECOVERY_ATTEMPTS, MIN_RECENT_MESSAGES_TO_KEEP,
53 TURN_MAX_OUTPUT_TOKENS, compact_tool_result_for_context, context_input_budget,
54 count_oldest_messages_to_drain, effective_max_output_tokens,
55 estimate_input_tokens_conservative, extract_compaction_summary_prompt,
56 is_context_length_error_message, summarize_text, turn_response_headroom_tokens,
57};
58pub use context_compiler::{
59 BudgetOverride, BudgetPolicy, CompileError, CompiledContext, ContextCompiler,
60 ContextCompilerMode, ContextLayer, ContextProjection, ContextSource, RenderFn, RenderedBlock,
61 SourceContribution, SourceId,
62};
63pub use context_snapshot::ThreadContextSnapshot;
64pub use dispatch::{
65 ToolParallelPlanFlags, caller_allowed_for_tool, caller_type_for_tool_use, final_tool_input,
66 format_tool_error, is_mcp_tool_name, mcp_tool_approval_description, mcp_tool_is_parallel_safe,
67 mcp_tool_is_read_only, parse_parallel_tool_calls, parse_tool_input_json,
68 should_force_update_plan_first, should_parallelize_tool_batch, should_stop_after_plan_tool,
69};
70pub use handle::EngineHandle;
71pub use host_bundle::EngineHostBundle;
72pub use hosts::{
73 LspHost, McpHost, SandboxHost, SeamError, SeamHost, ShellHost, SubAgentHost, TopicMemoryHost,
74 WorkshopHost,
75};
76pub use kernel_event::{
77 ArtifactId, CallId, CapacityAction, CapacityCheckpointKind, DeltaKind, KernelEvent,
78 KernelEventEnvelope, MessageRange, OverflowStrategy, PolicyDecision, ToolOutcome, TurnId,
79 TurnOutcome,
80};
81pub use kernel_mode::KernelMachineMode;
82pub use kernel_turn_host::KernelTurnHost;
83pub use loop_guard::{AttemptDecision, LoopGuard, OutcomeDecision};
84pub use lsp_edit_paths::{edited_paths_for_tool, parse_patch_paths};
85pub use op::Op;
86pub use request_fingerprint::{RequestFingerprint, compute_request_fingerprint, sha256_hex};
87pub use runtime::Engine;
88pub use scratchpad_state::ScratchpadStepState;
89pub use start_turn::StartTurnParams;
90pub use streaming::{
91 ContentBlockKind, FAKE_WRAPPER_NOTICE, MAX_STREAM_ERRORS_BEFORE_FAIL,
92 MAX_TRANSPARENT_STREAM_RETRIES, STREAM_CHUNK_TIMEOUT_SECS, STREAM_MAX_CONTENT_BYTES,
93 STREAM_MAX_DURATION_SECS, TOOL_CALL_END_MARKERS, TOOL_CALL_START_MARKERS, ToolUseState,
94 contains_fake_tool_wrapper, filter_tool_call_delta, should_transparently_retry_stream,
95};
96#[allow(deprecated)]
97pub use subagent_port::SubAgentSpawnPort;
98pub use subagent_port::{SubAgentSpawnError, SubAgentSpawnOutcome};
99pub use token_estimate::{
100 MESSAGE_FRAMING_TOKENS, SESSION_FRAMING_TOKENS, TokenEstimator, estimate_text_tokens,
101};
102pub use tool_bridge::{
103 function_call_to_tool_error, tool_call_input, tool_name_is_mutating, tool_output_to_result,
104 tool_result_to_output, value_to_tool_call,
105};
106pub use tool_catalog::{
107 CODE_EXECUTION_TOOL_NAME, MULTI_TOOL_PARALLEL_NAME, REQUEST_USER_INPUT_NAME,
108 TOOL_SEARCH_BM25_NAME, active_tools_for_step, apply_mcp_tool_deferral,
109 apply_native_tool_deferral, build_model_tool_catalog, ensure_advanced_tooling,
110 execute_tool_search, initial_active_tools, is_tool_search_tool,
111 maybe_activate_requested_deferred_tool, missing_tool_error_message, should_default_defer_tool,
112};
113pub use tool_dispatch::EngineToolDispatch;
114pub use tool_effects::tool_writes_state;
115pub use tool_progress::{emit_tool_audit, tool_progress_opening_line, tool_progress_phase_line};
116#[allow(deprecated)]
117pub use turn_loop::{
118 LiveOuterLoopState, LiveTurnMachine, McpPoolPort, OuterLoopHost, ToolExecOutcome,
119 ToolExecutionPlan, ToolPlanApprovalMeta, TurnLoopConfigView, TurnLoopControl,
120 TurnLoopStreamingPhaseOutcome, TurnLoopToolExec, TurnLoopToolExecutor,
121 TurnLoopToolPhaseOutcome, TurnLoopToolRegistry, V3TurnHost, build_edit_file_approval_desc,
122 handle_deepseek_turn, messages_with_turn_metadata, resolve_auto_effort,
123};
124pub use turn_machine::{
125 Effect, KernelEventSink, KernelMemoryPlaneUserEstimate, KernelMessageRoleEstimate,
126 KernelResumeHints, LiveTurnSnapshot, ReplayEffectCounts, ReplayTurnMachine,
127 SessionCompactionArtifactEntry, SessionMessageCoverage, SessionMessageRoleIndex,
128 SessionMessageTimelineCoverage, StepOutput, ThreadCompactionReplayEntry,
129 ThreadCompactionReplayIndex, ThreadMessagePlaneIndex, ThreadMessageReplayStats,
130 ThreadMessageTimelineEntry, ThreadReplayProjection, ThreadReplayReport,
131 ThreadTurnReplaySummary, TurnKernelProjection, TurnMachine, TurnReplayReport,
132 build_session_compaction_artifact_index, build_session_message_coverage,
133 build_session_message_role_index, build_session_message_timeline_coverage,
134 build_thread_replay_report, capacity_cooldown_backoff_millis,
135 compaction_messages_removed_count, compaction_run_effects_from_events,
136 compare_projection_to_live, continuation_inject_steer_effects_for_step, emit_kernel,
137 emit_kernel_event, events_for_step, is_compaction_run_kernel_event, is_lsp_notify_tool,
138 is_memory_plane_injection_kernel_event, kernel_resume_hints_from_projection,
139 kernel_resume_hints_from_thread_projection, memory_plane_inject_steer_effects_from_events,
140 notify_lsp_effects_from_step_events, outcome_from_status, plan_v3_step_effects,
141 replay_effect_counts, replay_kernel_memory_plane_user_estimate,
142 replay_kernel_message_role_estimate, replay_step_effects, replay_thread_compaction_index,
143 replay_thread_compaction_timeline, replay_thread_effect_counts,
144 replay_thread_message_plane_index, replay_thread_message_stats, replay_thread_message_timeline,
145 replay_thread_projection, replay_turn_effects, replay_turn_projection,
146 request_approval_effects_from_step_events, verify_compaction_artifacts_vs_kernel_timeline,
147 verify_effect_replay_chain, verify_guard_projection_chain, verify_memory_projection_chain,
148 verify_message_timeline_coherence, verify_message_timeline_vs_session,
149 verify_session_compaction_depth, verify_session_memory_plane_user_depth,
150 verify_session_message_coverage, verify_session_message_plane_depth, verify_session_role_index,
151 verify_step_capacity_sleep_anchor, verify_step_compaction_replay_anchor,
152 verify_step_continuation_anchor, verify_step_effect_parity,
153 verify_step_memory_plane_replay_anchor, verify_step_model_message_anchor,
154 verify_step_notify_lsp_anchor, verify_step_request_approval_anchor,
155 verify_thread_compaction_replay_anchors, verify_thread_continuation_anchors,
156 verify_thread_memory_plane_replay_anchors, verify_thread_notify_lsp_anchors,
157 verify_thread_request_approval_anchors, verify_timeline_vs_request_count,
158 verify_turn_replay_coherence,
159};
160pub use turn_port::TurnEnginePort;