Files
MetaCrate/crates/metacrate-grid-agent/src/lib.rs
Chili Palmer 8658c0407e
Some checks failed
CI / rust-skia (Rust only) (push) Successful in 2m43s
CI / required (push) Failing after 2m42s
feat(grid-agent): add structured observability and replay (#127)
2026-08-18 05:28:47 +00:00

132 lines
6.0 KiB
Rust

//! 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 backend;
pub mod behavior;
pub mod config;
pub mod control_plane;
pub mod control_runtime;
pub mod conversation;
pub mod interaction;
pub mod llm;
pub mod observability;
pub mod perception;
pub mod policy;
pub mod service;
pub mod session;
pub mod tool_loop;
pub mod types;
#[cfg(test)]
mod behavior_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 observability_tests;
#[cfg(test)]
mod perception_tests;
#[cfg(test)]
mod policy_tests;
#[cfg(test)]
mod session_tests;
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, 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,
};
pub use config::{
AgentConfig, BehaviorSettings, ConfigError, ConfigLoader, ControlSettings,
ConversationSettings, EndpointUrl, Environment, GridConnection, Limits, LlmConnection,
MapEnvironment, OperatingMode, 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 llm::{
Completion, CompletionMessage, ContentPart, ImageDetail, LlmClient, LlmError,
LlmTransportLimits, ToolDefinition, ToolSchema, Usage,
};
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,
};
pub use service::{AgentService, ServiceError, ServiceHandle, ServiceState};
pub use session::{
GridSession, GridSessionBackend, ReconnectPolicy, SessionControl, SessionFailure,
SessionFailureKind, SessionFuture, SessionObservation, SessionReason, SessionSignal,
SessionState, SessionStatus, SessionSupervisor, SessionSupervisorError,
SessionSupervisorHandle, SessionWork, WorkDisposition, WorkKind,
};
pub use tool_loop::{
HistorySummarizer, SessionGeneration, ToolExecution, ToolExecutor, ToolFuture, ToolLoop,
ToolLoopError, ToolLoopLimits, ToolLoopOutcome,
};
pub use types::{
BoundaryError, BoundedText, BoundedVec, ControlCommand, Conversation, ConversationMessage,
GridEvent, GridEventKind, LlmRequest, LlmResult, MessageRole, ObservableEvent,
ProposedToolCall, ToolCallOutcome,
};