//! Bounded service foundation for the native `MetaCrate` `OpenSim` grid agent.
//!
//! Configuration is resolved and validated before [`AgentService::start`]
//! creates tasks or calls a backend. The core has no signal, terminal, path,
//! subprocess, provider-SDK, or platform-specific dependency.

pub mod acceptance;
pub mod backend;
pub mod behavior;
pub mod build;
pub mod config;
pub mod control_plane;
pub mod control_runtime;
pub mod conversation;
pub mod interaction;
pub mod landmarks;
pub mod llm;
pub mod observability;
pub mod perception;
pub mod policy;
pub mod script_delivery;
pub mod service;
pub mod session;
pub mod testing;
pub mod tool_loop;
pub mod tui;
pub mod types;
pub mod vision;

#[cfg(test)]
mod behavior_tests;
#[cfg(test)]
mod build_tests;
#[cfg(test)]
mod control_plane_tests;
#[cfg(test)]
mod control_runtime_tests;
#[cfg(test)]
mod conversation_tests;
#[cfg(test)]
mod interaction_tests;
#[cfg(test)]
mod landmark_tests;
#[cfg(test)]
mod observability_tests;
#[cfg(test)]
mod perception_tests;
#[cfg(test)]
mod policy_tests;
#[cfg(test)]
mod script_delivery_tests;
#[cfg(test)]
mod session_tests;
#[cfg(test)]
mod tui_tests;
#[cfg(test)]
mod vision_tests;

pub use acceptance::{
    ACCEPTANCE_SCHEMA_VERSION, ACCEPTANCE_SECRET_CANARY, AcceptanceBudgets, AcceptanceError,
    AcceptanceEvidenceWriter, AcceptanceRecord, AcceptanceStatus, run_deterministic_acceptance,
};
pub use backend::{
    AuthorizedToolBackend, BackendError, BackendFuture, GridBackend, OfflineGridBackend,
    WorldMutator,
};
#[cfg(feature = "live-grid")]
pub use backend::{
    LibremetaverseClientOwner, LibremetaverseEmbodimentSink, LibremetaverseInteractionSink,
    LibremetaverseSessionBackend, LibremetaverseWorldSnapshotSource,
};
pub use behavior::{
    AuthorizedBackendRouter, BehaviorBackend, BehaviorController, BehaviorError, BehaviorHandle,
    BehaviorIngress, BehaviorMode, BehaviorObservation, BehaviorOutcome, BehaviorPolicyResult,
    BehaviorRandom, BehaviorTrigger, CAMERA_RESET_TOOL, CAMERA_SET_TOOL, CURRENT_POSE_TOOL,
    EmbodiedPose, EmbodimentFuture, EmbodimentSink, FACE_AVATAR_TOOL, FACE_POINT_TOOL,
    LOOK_AROUND_TOOL, SIT_TOOL, STAND_TOOL, STOP_TOOL, WALK_SHORT_TOOL, behavior_policy_tools,
};
#[cfg(feature = "live-grid")]
pub use build::LibremetaverseBuildGrid;
pub use build::{
    BUILD_CLEANUP_TOOL, BUILD_DRY_RUN_TOOL, BUILD_EXECUTE_TOOL, BuildCleanupReceipt, BuildControl,
    BuildError, BuildFuture, BuildGrid, BuildLimits, BuildObservation, BuildObservationKind,
    BuildPlan, BuildPrim, BuildReceipt, BuildService, BuildShape, BuildToolBackend,
    BuildValidation, PrimReceipt, build_policy_tools,
};
pub use config::{
    AgentConfig, AgentPreferences, BehaviorSettings, CONFIG_SCHEMA_VERSION, ConfigError,
    ConfigLoader, ConnectionPreferences, ControlSettings, ConversationSettings, EndpointUrl,
    Environment, GridConnection, GridPreferences, Limits, LlmConnection, MapEnvironment,
    OperatingMode, PlatformPaths, PreferencesSummary, RemoteTlsSettings, SecretString,
    StdEnvironment, Timeouts,
};
pub use control_plane::{
    AuditEventView, CONTROL_PROTOCOL_VERSION, ControlContext, ControlError, ControlErrorBody,
    ControlErrorCode, ControlEvent, ControlEventKind, ControlFuture, ControlLimits, ControlPayload,
    ControlPlane, ControlRequest, ControlRequestEnvelope, ControlResponseEnvelope, ControlRole,
    ControlSubscription, ControlTarget, ConversationChannelView, HealthView,
    InProcessControlClient, Page, PageRequest, PendingApprovalView, RuntimeView, ScheduledJobView,
    SessionMetadataView, TcpControlClient, TcpControlConfig, TcpControlServer,
};
pub use control_runtime::{AgentControlTarget, RuntimeControlCommand};
pub use conversation::{
    ConversationChannel, ConversationClock, ConversationContext, ConversationError,
    ConversationKey, ConversationLimits, ConversationMetadata, ConversationPersistence,
    ConversationStore, MemoryEvent, MemoryReason, MemoryRecord, MemoryTrust, MemoryUpdate,
    SystemConversationClock,
};
pub use interaction::{
    DeliveryFuture, DeliveryOutcome, ImDialogKind, InboundInteraction, InboundSource,
    InferenceOutcome, InteractionChannel, InteractionCoordinator, InteractionDeliveryError,
    InteractionError, InteractionHandle, InteractionIngress, InteractionIntent,
    InteractionModelError, InteractionObservation, InteractionOrigin, InteractionPacingError,
    InteractionResponder, InteractionSettings, InteractionSink, OutboundInteraction, PacerFuture,
    PolicyLlmResponder, ResponderFuture, ResponsePacer, ResponseRequest, SuppressionReason,
    VisibleResponse, split_utf8,
};
pub use landmarks::{
    LANDMARK_CREATE_TOOL, LANDMARK_LIST_TOOL, LANDMARK_SCHEDULE_TOOL, LANDMARK_STATUS_TOOL,
    LANDMARK_TELEPORT_TOOL, LandmarkEntry, LandmarkError, LandmarkFuture, LandmarkGrid,
    LandmarkLimits, LandmarkObservation, LandmarkObservationKind, LandmarkOffer, LandmarkOutcome,
    LandmarkRoamingHandle, LandmarkService, LandmarkToolBackend, LandmarkValidation, OfferDecision,
    OfferedInventoryKind, OfferedInventoryNode, RoamingPause, RoamingRandom, RoamingSchedule,
    SystemRoamingRandom, TeleportReceipt, TeleportTrigger, landmark_policy_tools,
};
#[cfg(feature = "live-grid")]
pub use landmarks::{
    LibremetaverseLandmarkGrid, LibremetaverseLandmarkIntake, permission_fingerprint,
};
pub use llm::{
    CompletionMessage, ContentPart, ImageDetail, LlmClient, LlmError, ToolDefinition, ToolSchema,
};
pub use observability::{
    AgentMetrics, CorrelationIds, DiagnosticDirection, EventDraft, EventFamily, EventOrigin,
    EventSeverity, EventSubscription, JournalConfig, LatencyMetrics, MetricsSnapshot,
    OBSERVABILITY_SCHEMA_VERSION, Observability, ObservabilityError, ObservabilityLimits,
    ObservabilityRuntime, OutcomeCode, OutcomeMetrics, ReplayAction, ReplayState,
    SensitiveDiagnosticPart, StructuredEvent, UnifiedPolicyAudit, event_json,
    pseudonymous_identifier, replay_journal,
};
pub use perception::{
    AGENT_STATE_TOOL, AgentSnapshot, EnvironmentSnapshot, INVENTORY_SEARCH_TOOL, InventoryMetadata,
    LOCATION_TOOL, LandmarkMetadata, NEARBY_AVATARS_TOOL, ObservedAvatar, ObservedObject,
    PARCEL_ENVIRONMENT_TOOL, PerceptionBackend, PerceptionError, PerceptionIngress,
    PerceptionObservation, PerceptionOutcome, RECEIVED_LANDMARKS_TOOL, RECENT_PARTICIPANTS_TOOL,
    SnapshotFuture, VISIBLE_OBJECTS_TOOL, WorldPosition, WorldSnapshot, WorldSnapshotSource,
    perception_policy_tools, unix_millis_now,
};
pub use policy::{
    ActionOrigin, AllowedOrigins, ApprovalId, ApprovalRule, AuthenticatedPrincipal,
    AuthorizedAction, BudgetLimits, Capability, FixedCost, Idempotency, MemoryPolicyAudit,
    OriginClass, PendingApprovalMetadata, PolicyAuditError, PolicyAuditRecord, PolicyAuditSink,
    PolicyDisposition, PolicyError, PolicyEvaluation, PolicyFinalOutcome, PolicyGateway,
    PolicyLimits, PolicyReasonCode, PolicyRequestContext, PolicySnapshot, PolicyTool,
    PolicyToolExecutor, ResourceCost, ResourceEstimator, Risk, SchedulerGrantId, UntrustedData,
    UntrustedSource,
};
#[cfg(feature = "live-grid")]
pub use script_delivery::LibremetaverseScriptInventory;
pub use script_delivery::{
    GeneratedScript, SCRIPT_DELIVERY_TOOL, ScriptDeliveryBackend, ScriptDeliveryError,
    ScriptDeliveryOutcome, ScriptDeliverySettings, ScriptDeliveryTool, ScriptInventory,
    ScriptInventoryFuture, ScriptInventoryReceipt, script_delivery_policy_tool,
};
pub use service::{AgentService, ServiceError, ServiceHandle, ServiceState};
pub use session::{
    FrameworkReadiness, GridSession, GridSessionBackend, ReconnectPolicy, SessionControl,
    SessionFailure, SessionFailureKind, SessionFuture, SessionObservation, SessionReason,
    SessionSignal, SessionState, SessionStatus, SessionSupervisor, SessionSupervisorError,
    SessionSupervisorHandle, SessionWork, WorkDisposition, WorkKind,
};
pub use tool_loop::{ToolExecution, ToolExecutor, ToolFuture, ToolLoopError, ToolLoopLimits};
pub use tui::{
    CommandConfirmation, EventFilter, OperatorCommand, OperatorScreen, OperatorSnapshot,
    OperatorTui, PreferenceField, PreferencesPanel, ReconnectingTcpTransport, TuiAction, TuiError,
    TuiInput, TuiRenderOptions, TuiTransport,
};
pub use types::{
    BoundaryError, BoundedText, BoundedVec, ControlCommand, Conversation, ConversationMessage,
    GridEvent, GridEventKind, LlmRequest, LlmResult, MessageRole, ObservableEvent,
    ProposedToolCall, ToolCallOutcome,
};
#[cfg(feature = "live-grid")]
pub use vision::LibremetaverseSceneSource;
pub use vision::{
    CameraPose, SceneBuildTimings, SceneEntity, SceneEntityKind, SceneSnapshot, SceneSource,
    SceneTriangle, SnapshotCompleteness, VisionAugmentedResponder, VisionCapture, VisionControl,
    VisionError, VisionFuture, VisionLimits, VisionObservation, VisionObservationKind,
    VisionService, visual_question,
};
