Implement transactional scripted prim builds (#131)
Some checks failed
CI / rust-skia (Rust only) (push) Successful in 2m46s
CI / required (push) Failing after 53s

This commit is contained in:
2026-08-18 11:32:32 +02:00
parent 08696cd2fe
commit 64edd8df46
11 changed files with 1766 additions and 20 deletions

View File

@@ -291,6 +291,7 @@ async fn run_live(
config.limits.control_queue,
)?;
control_target.attach_observability(live.observability.clone());
control_target.attach_build_control(live.build_control.clone());
control_target.update_session(handle.status());
let erased_target: Arc<dyn ControlTarget> = control_target.clone();
let (control_plane, integrated_client, control_server) = match config.mode {
@@ -490,6 +491,7 @@ struct LiveInteractions {
observability: Arc<metacrate_grid_agent::Observability>,
_landmark_intake: metacrate_grid_agent::LibremetaverseLandmarkIntake,
landmark_roaming: metacrate_grid_agent::LandmarkRoamingHandle,
build_control: Arc<dyn metacrate_grid_agent::BuildControl>,
}
#[cfg(feature = "live-grid")]
@@ -500,13 +502,14 @@ fn start_live_interactions(
) -> Result<LiveInteractions, Box<dyn Error>> {
use metacrate_grid_agent::{
AuthorizedBackendRouter, AuthorizedToolBackend, BehaviorBackend, BehaviorController,
ConversationStore, InteractionCoordinator, LandmarkLimits, LandmarkService,
LandmarkToolBackend, LibremetaverseLandmarkGrid, LibremetaverseLandmarkIntake,
LibremetaverseScriptInventory, LlmClient, LlmTransportLimits, MemoryPolicyAudit,
Observability, ObservabilityLimits, PerceptionBackend, PolicyAuditSink, PolicyGateway,
PolicyLimits, PolicyLlmResponder, ScriptDeliveryBackend, ScriptDeliverySettings,
SystemRoamingRandom, ToolLoopLimits, UnifiedPolicyAudit, behavior_policy_tools,
landmark_policy_tools, perception_policy_tools, script_delivery_policy_tool,
BuildLimits, BuildService, BuildToolBackend, ConversationStore, InteractionCoordinator,
LandmarkLimits, LandmarkService, LandmarkToolBackend, LibremetaverseBuildGrid,
LibremetaverseLandmarkGrid, LibremetaverseLandmarkIntake, LibremetaverseScriptInventory,
LlmClient, LlmTransportLimits, MemoryPolicyAudit, Observability, ObservabilityLimits,
PerceptionBackend, PolicyAuditSink, PolicyGateway, PolicyLimits, PolicyLlmResponder,
ScriptDeliveryBackend, ScriptDeliverySettings, SystemRoamingRandom, ToolLoopLimits,
UnifiedPolicyAudit, behavior_policy_tools, build_policy_tools, landmark_policy_tools,
perception_policy_tools, script_delivery_policy_tool,
};
let transport_limits = LlmTransportLimits {
@@ -558,6 +561,14 @@ fn start_live_interactions(
tools.push(script_delivery_policy_tool(
ScriptDeliverySettings::default(),
)?);
let build_service = Arc::new(BuildService::new(
Arc::new(LibremetaverseBuildGrid::new(owner)),
BuildLimits::default(),
)?);
let build_control: Arc<dyn metacrate_grid_agent::BuildControl> = build_service.clone();
let build_backend: Arc<dyn AuthorizedToolBackend> =
Arc::new(BuildToolBackend::new(build_service));
tools.extend(build_policy_tools(BuildLimits::default())?);
let landmark_service = Arc::new(LandmarkService::new(
Arc::new(LibremetaverseLandmarkGrid::new(owner)),
Arc::new(SystemRoamingRandom::default()),
@@ -582,16 +593,17 @@ fn start_live_interactions(
.iter()
.map(|tool| tool.definition.name.as_str().to_owned())
.map(|name| {
let backend: Arc<dyn AuthorizedToolBackend> =
if name == metacrate_grid_agent::SCRIPT_DELIVERY_TOOL {
Arc::clone(&script_backend)
} else if name.starts_with("landmark_") {
Arc::clone(&landmark_backend)
} else if name.starts_with("behavior_") {
Arc::new(BehaviorBackend::new(behavior_ingress.clone()))
} else {
perception.clone()
};
let backend: Arc<dyn AuthorizedToolBackend> = if name.starts_with("build_object_") {
Arc::clone(&build_backend)
} else if name == metacrate_grid_agent::SCRIPT_DELIVERY_TOOL {
Arc::clone(&script_backend)
} else if name.starts_with("landmark_") {
Arc::clone(&landmark_backend)
} else if name.starts_with("behavior_") {
Arc::new(BehaviorBackend::new(behavior_ingress.clone()))
} else {
perception.clone()
};
(name, backend)
})
.collect::<Vec<_>>();
@@ -649,6 +661,7 @@ fn start_live_interactions(
observability,
_landmark_intake: landmark_intake,
landmark_roaming,
build_control,
})
}