Rebuild Unity bridge as CultMesh mirror
This commit is contained in:
parent
3c6ab7e4df
commit
cb806aac75
83 changed files with 741 additions and 901 deletions
|
|
@ -1,16 +1,9 @@
|
|||
use anyhow::{Context, Result, bail};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::collections::VecDeque;
|
||||
use std::io::{Read, Write};
|
||||
use std::net::{TcpListener, TcpStream};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use anyhow::Result;
|
||||
use serde::Serialize;
|
||||
|
||||
const PROVIDER_SCHEMA: &str = "gamecult.brokkr.provider_advertisement.v0";
|
||||
const PROVIDER_ID: &str = "brokkr.creative_tool_broker";
|
||||
const CULTMESH_BASE_URI: &str = "cultmesh://brokkr";
|
||||
const DEFAULT_BIND: &str = "127.0.0.1:8798";
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
|
@ -20,6 +13,8 @@ struct ProviderAdvertisement {
|
|||
authority: Authority,
|
||||
transports: Vec<Transport>,
|
||||
tool_surfaces: Vec<ToolSurface>,
|
||||
mirror_documents: Vec<MirrorDocument>,
|
||||
realtime_routes: Vec<RealtimeRoute>,
|
||||
eve_surfaces: Vec<EveSurface>,
|
||||
command_policy: CommandPolicy,
|
||||
}
|
||||
|
|
@ -61,6 +56,28 @@ struct ToolSurface {
|
|||
capabilities: Vec<&'static str>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct MirrorDocument {
|
||||
name: &'static str,
|
||||
schema: &'static str,
|
||||
owner: &'static str,
|
||||
record_hint: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct RealtimeRoute {
|
||||
id: &'static str,
|
||||
owner: &'static str,
|
||||
source: &'static str,
|
||||
sink: &'static str,
|
||||
schema: &'static str,
|
||||
transport: &'static str,
|
||||
direction: &'static str,
|
||||
notes: Vec<&'static str>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct EveSurface {
|
||||
|
|
@ -79,566 +96,132 @@ struct CommandPolicy {
|
|||
notes: Vec<&'static str>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ToolHostSnapshot {
|
||||
schema: String,
|
||||
provider_id: String,
|
||||
tool_kind: String,
|
||||
project_path: String,
|
||||
observed_at: String,
|
||||
unity_version: Option<String>,
|
||||
product_name: Option<String>,
|
||||
active_scene_path: Option<String>,
|
||||
open_scene_count: Option<u32>,
|
||||
selected_object_names: Vec<String>,
|
||||
asset_count: Option<u32>,
|
||||
capabilities: Vec<String>,
|
||||
#[serde(default)]
|
||||
scene_objects: Vec<Value>,
|
||||
#[serde(default)]
|
||||
assets: Vec<Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct UnityCommand {
|
||||
schema: String,
|
||||
command_id: String,
|
||||
action: String,
|
||||
#[serde(default)]
|
||||
target_object_id: String,
|
||||
#[serde(default)]
|
||||
name: String,
|
||||
#[serde(default)]
|
||||
component_type: String,
|
||||
#[serde(default)]
|
||||
property_path: String,
|
||||
#[serde(default)]
|
||||
value: String,
|
||||
#[serde(default)]
|
||||
asset_path: String,
|
||||
#[serde(default)]
|
||||
parent_object_id: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct UnityCommandEnvelope {
|
||||
command: Option<UnityCommand>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct UnityCommandReceipt {
|
||||
schema: String,
|
||||
command_id: String,
|
||||
status: String,
|
||||
message: String,
|
||||
#[serde(default)]
|
||||
object_id: String,
|
||||
observed_at: String,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct BrokerState {
|
||||
unity_snapshot: Option<ToolHostSnapshot>,
|
||||
unity_command_queue: VecDeque<UnityCommand>,
|
||||
unity_receipts: Vec<UnityCommandReceipt>,
|
||||
next_command_number: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct HealthResponse<'a> {
|
||||
ok: bool,
|
||||
provider_id: &'a str,
|
||||
version: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct HostSnapshotsResponse {
|
||||
unity: Option<ToolHostSnapshot>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct UnitySceneResponse {
|
||||
provider_id: &'static str,
|
||||
observed_at: Option<String>,
|
||||
scene_objects: Vec<Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct UnityAssetsResponse {
|
||||
provider_id: &'static str,
|
||||
observed_at: Option<String>,
|
||||
assets: Vec<Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct EveSurfaceDocument {
|
||||
schema: &'static str,
|
||||
surface_id: &'static str,
|
||||
mode: &'static str,
|
||||
title: &'static str,
|
||||
provider_id: &'static str,
|
||||
updated_at: Option<String>,
|
||||
sections: Vec<EveSurfaceSection>,
|
||||
commands: Vec<EveCommandAffordance>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct EveSurfaceSection {
|
||||
id: &'static str,
|
||||
title: &'static str,
|
||||
kind: &'static str,
|
||||
items: Vec<Value>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct EveCommandAffordance {
|
||||
id: &'static str,
|
||||
title: &'static str,
|
||||
command_schema: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct SnapshotReceipt<'a> {
|
||||
schema: &'a str,
|
||||
provider_id: &'a str,
|
||||
tool_kind: &'a str,
|
||||
accepted_at: String,
|
||||
status: &'a str,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut args = std::env::args().skip(1);
|
||||
let command = args.next().unwrap_or_else(|| "provider".to_string());
|
||||
|
||||
match command.as_str() {
|
||||
"provider" => print_provider(),
|
||||
"smoke" => print_provider(),
|
||||
"serve" => {
|
||||
let bind = match args.next().as_deref() {
|
||||
Some("--bind") => args.next().unwrap_or_else(|| DEFAULT_BIND.to_string()),
|
||||
Some(value) => value.to_string(),
|
||||
None => DEFAULT_BIND.to_string(),
|
||||
};
|
||||
serve(&bind)
|
||||
}
|
||||
"provider" | "smoke" => print_provider(),
|
||||
_ => {
|
||||
eprintln!("usage: brokkr-daemon [provider|smoke|serve [--bind] [addr]]");
|
||||
eprintln!("usage: brokkr-daemon [provider|smoke]");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print_provider() -> Result<()> {
|
||||
let advertisement = build_provider_advertisement();
|
||||
println!("{}", serde_json::to_string_pretty(&advertisement)?);
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&build_provider_advertisement())?
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn serve(bind: &str) -> Result<()> {
|
||||
let listener =
|
||||
TcpListener::bind(bind).with_context(|| format!("failed to bind Brokkr on {bind}"))?;
|
||||
let state = Arc::new(Mutex::new(BrokerState::default()));
|
||||
eprintln!("Brokkr listening on http://{bind}");
|
||||
|
||||
for stream in listener.incoming() {
|
||||
let stream = stream.context("failed to accept connection")?;
|
||||
let state = Arc::clone(&state);
|
||||
if let Err(error) = handle_connection(stream, state) {
|
||||
eprintln!("request failed: {error:#}");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn handle_connection(mut stream: TcpStream, state: Arc<Mutex<BrokerState>>) -> Result<()> {
|
||||
stream.set_read_timeout(Some(Duration::from_secs(5)))?;
|
||||
let request = read_http_request(&mut stream)?;
|
||||
|
||||
let response = match (request.method.as_str(), request.path.as_str()) {
|
||||
("GET", "/health") => json_response(
|
||||
200,
|
||||
&HealthResponse {
|
||||
ok: true,
|
||||
provider_id: PROVIDER_ID,
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
},
|
||||
)?,
|
||||
("GET", "/provider") => json_response(200, &build_provider_advertisement())?,
|
||||
("GET", "/hosts") => {
|
||||
let state = state.lock().expect("broker state poisoned");
|
||||
json_response(
|
||||
200,
|
||||
&HostSnapshotsResponse {
|
||||
unity: state.unity_snapshot.clone(),
|
||||
},
|
||||
)?
|
||||
}
|
||||
("GET", "/unity/scene") => {
|
||||
let state = state.lock().expect("broker state poisoned");
|
||||
let snapshot = state.unity_snapshot.clone();
|
||||
json_response(
|
||||
200,
|
||||
&UnitySceneResponse {
|
||||
provider_id: "brokkr.unity_editor",
|
||||
observed_at: snapshot.as_ref().map(|item| item.observed_at.clone()),
|
||||
scene_objects: snapshot
|
||||
.as_ref()
|
||||
.map(|item| item.scene_objects.clone())
|
||||
.unwrap_or_default(),
|
||||
},
|
||||
)?
|
||||
}
|
||||
("GET", "/unity/assets") => {
|
||||
let state = state.lock().expect("broker state poisoned");
|
||||
let snapshot = state.unity_snapshot.clone();
|
||||
json_response(
|
||||
200,
|
||||
&UnityAssetsResponse {
|
||||
provider_id: "brokkr.unity_editor",
|
||||
observed_at: snapshot.as_ref().map(|item| item.observed_at.clone()),
|
||||
assets: snapshot
|
||||
.as_ref()
|
||||
.map(|item| item.assets.clone())
|
||||
.unwrap_or_default(),
|
||||
},
|
||||
)?
|
||||
}
|
||||
("GET", "/unity/receipts") => {
|
||||
let state = state.lock().expect("broker state poisoned");
|
||||
json_response(200, &state.unity_receipts)?
|
||||
}
|
||||
("GET", "/eve/unity/gui") => {
|
||||
let state = state.lock().expect("broker state poisoned");
|
||||
json_response(200, &build_unity_eve_surface(&state, "gui"))?
|
||||
}
|
||||
("GET", "/eve/unity/tui") => {
|
||||
let state = state.lock().expect("broker state poisoned");
|
||||
json_response(200, &build_unity_eve_surface(&state, "tui"))?
|
||||
}
|
||||
("POST", "/hosts/unity/snapshot") => {
|
||||
let snapshot: ToolHostSnapshot = serde_json::from_slice(&request.body)
|
||||
.context("invalid Unity host snapshot JSON")?;
|
||||
validate_unity_snapshot(&snapshot)?;
|
||||
let receipt = SnapshotReceipt {
|
||||
schema: "gamecult.brokkr.snapshot_receipt.v0",
|
||||
provider_id: "brokkr.unity_editor",
|
||||
tool_kind: "unity-editor",
|
||||
accepted_at: unix_millis_timestamp(),
|
||||
status: "accepted",
|
||||
};
|
||||
state.lock().expect("broker state poisoned").unity_snapshot = Some(snapshot);
|
||||
json_response(202, &receipt)?
|
||||
}
|
||||
("POST", "/commands/unity") => {
|
||||
let mut command: UnityCommand =
|
||||
serde_json::from_slice(&request.body).context("invalid Unity command JSON")?;
|
||||
validate_unity_command(&command)?;
|
||||
let mut state = state.lock().expect("broker state poisoned");
|
||||
if command.command_id.is_empty() {
|
||||
state.next_command_number += 1;
|
||||
command.command_id = format!("unity-command-{}", state.next_command_number);
|
||||
}
|
||||
state.unity_command_queue.push_back(command.clone());
|
||||
json_response(202, &command)?
|
||||
}
|
||||
("GET", "/hosts/unity/commands/next") => {
|
||||
let mut state = state.lock().expect("broker state poisoned");
|
||||
let command = state.unity_command_queue.pop_front();
|
||||
json_response(200, &UnityCommandEnvelope { command })?
|
||||
}
|
||||
("POST", "/hosts/unity/commands/receipt") => {
|
||||
let receipt: UnityCommandReceipt = serde_json::from_slice(&request.body)
|
||||
.context("invalid Unity command receipt JSON")?;
|
||||
validate_unity_receipt(&receipt)?;
|
||||
state
|
||||
.lock()
|
||||
.expect("broker state poisoned")
|
||||
.unity_receipts
|
||||
.push(receipt.clone());
|
||||
json_response(202, &receipt)?
|
||||
}
|
||||
_ => text_response(404, "not found"),
|
||||
};
|
||||
|
||||
stream.write_all(response.as_bytes())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_unity_command(command: &UnityCommand) -> Result<()> {
|
||||
if command.schema != "gamecult.brokkr.unity_command.v0" {
|
||||
bail!("unexpected Unity command schema: {}", command.schema);
|
||||
}
|
||||
match command.action.as_str() {
|
||||
"createGameObject"
|
||||
| "attachComponent"
|
||||
| "setComponentProperty"
|
||||
| "instantiatePrefab"
|
||||
| "createPrefabVariant" => Ok(()),
|
||||
_ => bail!("unsupported Unity command action: {}", command.action),
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_unity_receipt(receipt: &UnityCommandReceipt) -> Result<()> {
|
||||
if receipt.schema != "gamecult.brokkr.unity_command_receipt.v0" {
|
||||
bail!("unexpected Unity receipt schema: {}", receipt.schema);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn build_unity_eve_surface(state: &BrokerState, mode: &'static str) -> EveSurfaceDocument {
|
||||
let snapshot = state.unity_snapshot.clone();
|
||||
let scene_objects = snapshot
|
||||
.as_ref()
|
||||
.map(|item| item.scene_objects.iter().take(80).cloned().collect())
|
||||
.unwrap_or_default();
|
||||
let assets = snapshot
|
||||
.as_ref()
|
||||
.map(|item| item.assets.iter().take(80).cloned().collect())
|
||||
.unwrap_or_default();
|
||||
let receipts = state
|
||||
.unity_receipts
|
||||
.iter()
|
||||
.rev()
|
||||
.take(25)
|
||||
.map(|receipt| serde_json::to_value(receipt).unwrap_or(Value::Null))
|
||||
.collect();
|
||||
|
||||
EveSurfaceDocument {
|
||||
schema: "gamecult.eve.surface.v1",
|
||||
surface_id: if mode == "tui" {
|
||||
"brokkr.eve.unity_editor_tui.v0"
|
||||
} else {
|
||||
"brokkr.eve.unity_editor_gui.v0"
|
||||
},
|
||||
mode,
|
||||
title: "Unity Editor",
|
||||
provider_id: "brokkr.unity_editor",
|
||||
updated_at: snapshot.as_ref().map(|item| item.observed_at.clone()),
|
||||
sections: vec![
|
||||
EveSurfaceSection {
|
||||
id: "scene",
|
||||
title: "Scene Graph",
|
||||
kind: "tree",
|
||||
items: scene_objects,
|
||||
},
|
||||
EveSurfaceSection {
|
||||
id: "assets",
|
||||
title: "Asset Library",
|
||||
kind: "table",
|
||||
items: assets,
|
||||
},
|
||||
EveSurfaceSection {
|
||||
id: "receipts",
|
||||
title: "Command Receipts",
|
||||
kind: "log",
|
||||
items: receipts,
|
||||
},
|
||||
],
|
||||
commands: vec![
|
||||
EveCommandAffordance {
|
||||
id: "createGameObject",
|
||||
title: "Create GameObject",
|
||||
command_schema: "gamecult.brokkr.unity_command.v0",
|
||||
},
|
||||
EveCommandAffordance {
|
||||
id: "attachComponent",
|
||||
title: "Attach Component",
|
||||
command_schema: "gamecult.brokkr.unity_command.v0",
|
||||
},
|
||||
EveCommandAffordance {
|
||||
id: "setComponentProperty",
|
||||
title: "Set Component Property",
|
||||
command_schema: "gamecult.brokkr.unity_command.v0",
|
||||
},
|
||||
EveCommandAffordance {
|
||||
id: "instantiatePrefab",
|
||||
title: "Instantiate Prefab",
|
||||
command_schema: "gamecult.brokkr.unity_command.v0",
|
||||
},
|
||||
EveCommandAffordance {
|
||||
id: "createPrefabVariant",
|
||||
title: "Create Prefab Variant",
|
||||
command_schema: "gamecult.brokkr.unity_command.v0",
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_unity_snapshot(snapshot: &ToolHostSnapshot) -> Result<()> {
|
||||
if snapshot.schema != "gamecult.brokkr.tool_host_snapshot.v0" {
|
||||
bail!("unexpected snapshot schema: {}", snapshot.schema);
|
||||
}
|
||||
if snapshot.provider_id != "brokkr.unity_editor" {
|
||||
bail!("unexpected provider id: {}", snapshot.provider_id);
|
||||
}
|
||||
if snapshot.tool_kind != "unity-editor" {
|
||||
bail!("unexpected tool kind: {}", snapshot.tool_kind);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct HttpRequest {
|
||||
method: String,
|
||||
path: String,
|
||||
body: Vec<u8>,
|
||||
}
|
||||
|
||||
fn read_http_request(stream: &mut TcpStream) -> Result<HttpRequest> {
|
||||
let mut buffer = Vec::new();
|
||||
let mut chunk = [0_u8; 4096];
|
||||
let header_end;
|
||||
|
||||
loop {
|
||||
let bytes_read = stream.read(&mut chunk)?;
|
||||
if bytes_read == 0 {
|
||||
bail!("connection closed before headers");
|
||||
}
|
||||
buffer.extend_from_slice(&chunk[..bytes_read]);
|
||||
if let Some(index) = find_header_end(&buffer) {
|
||||
header_end = index;
|
||||
break;
|
||||
}
|
||||
if buffer.len() > 64 * 1024 {
|
||||
bail!("request headers too large");
|
||||
}
|
||||
}
|
||||
|
||||
let header_text = std::str::from_utf8(&buffer[..header_end]).context("headers not utf-8")?;
|
||||
let mut lines = header_text.lines();
|
||||
let request_line = lines.next().context("missing request line")?;
|
||||
let mut parts = request_line.split_whitespace();
|
||||
let method = parts.next().context("missing method")?.to_string();
|
||||
let path = parts.next().context("missing path")?.to_string();
|
||||
|
||||
let mut content_length = 0_usize;
|
||||
for line in lines {
|
||||
if let Some(value) = line.strip_prefix("Content-Length:") {
|
||||
content_length = value.trim().parse().context("bad Content-Length")?;
|
||||
} else if let Some(value) = line.strip_prefix("content-length:") {
|
||||
content_length = value.trim().parse().context("bad Content-Length")?;
|
||||
}
|
||||
}
|
||||
|
||||
let body_start = header_end + 4;
|
||||
while buffer.len() < body_start + content_length {
|
||||
let bytes_read = stream.read(&mut chunk)?;
|
||||
if bytes_read == 0 {
|
||||
bail!("connection closed before body");
|
||||
}
|
||||
buffer.extend_from_slice(&chunk[..bytes_read]);
|
||||
}
|
||||
|
||||
Ok(HttpRequest {
|
||||
method,
|
||||
path,
|
||||
body: buffer[body_start..body_start + content_length].to_vec(),
|
||||
})
|
||||
}
|
||||
|
||||
fn find_header_end(buffer: &[u8]) -> Option<usize> {
|
||||
buffer.windows(4).position(|window| window == b"\r\n\r\n")
|
||||
}
|
||||
|
||||
fn json_response<T: Serialize>(status: u16, value: &T) -> Result<String> {
|
||||
let body = serde_json::to_string_pretty(value)?;
|
||||
Ok(http_response(status, "application/json", &body))
|
||||
}
|
||||
|
||||
fn text_response(status: u16, body: &str) -> String {
|
||||
http_response(status, "text/plain; charset=utf-8", body)
|
||||
}
|
||||
|
||||
fn http_response(status: u16, content_type: &str, body: &str) -> String {
|
||||
let reason = match status {
|
||||
200 => "OK",
|
||||
202 => "Accepted",
|
||||
404 => "Not Found",
|
||||
_ => "OK",
|
||||
};
|
||||
format!(
|
||||
"HTTP/1.1 {status} {reason}\r\nContent-Type: {content_type}\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{body}",
|
||||
body.len()
|
||||
)
|
||||
}
|
||||
|
||||
fn unix_millis_timestamp() -> String {
|
||||
let millis = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
.as_millis();
|
||||
format!("unix-ms:{millis}")
|
||||
}
|
||||
|
||||
fn build_provider_advertisement() -> ProviderAdvertisement {
|
||||
ProviderAdvertisement {
|
||||
schema: PROVIDER_SCHEMA,
|
||||
provider: ProviderIdentity {
|
||||
id: PROVIDER_ID,
|
||||
title: "Brokkr",
|
||||
description: "GameCult creative-tool broker for Unity, Blender, and future editor runtimes.",
|
||||
description: "Creative-tool broker exposing Unity and Blender editor state as a CultMesh mirror.",
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
},
|
||||
authority: Authority {
|
||||
owner: "Brokkr",
|
||||
role: "CultMesh broker for creative editor observations, command admission, receipts, and Eve/CultUI projection.",
|
||||
state_owner: "Brokkr typed CultCache witnesses; host editors own host-local scene and asset truth.",
|
||||
presentation_owner: "Eve/CultUI lowers Brokkr surfaces without owning editor truth.",
|
||||
discovery_owner: "Odin discovers Brokkr through CultMesh provider advertisements.",
|
||||
owner: PROVIDER_ID,
|
||||
role: "creative-tool Verse broker",
|
||||
state_owner: "CultCache documents mirrored through CultMesh",
|
||||
presentation_owner: "Eve/CultUI projections over mirrored editor state",
|
||||
discovery_owner: "Odin rendezvous over Brokkr provider advertisement",
|
||||
},
|
||||
transports: vec![
|
||||
Transport {
|
||||
kind: "cultmesh",
|
||||
base_uri: CULTMESH_BASE_URI,
|
||||
status: "scaffold",
|
||||
},
|
||||
Transport {
|
||||
kind: "http-local",
|
||||
base_uri: "http://127.0.0.1:8798",
|
||||
status: "active-local-adapter",
|
||||
},
|
||||
],
|
||||
transports: vec![Transport {
|
||||
kind: "cultmesh",
|
||||
base_uri: CULTMESH_BASE_URI,
|
||||
status: "primary",
|
||||
}],
|
||||
tool_surfaces: vec![
|
||||
ToolSurface {
|
||||
id: "brokkr.unity_editor",
|
||||
title: "Unity Editor",
|
||||
tool_kind: "unity-editor",
|
||||
adapter: "surfaces/unity/Packages/com.gamecult.brokkr",
|
||||
capabilities: shared_capabilities(),
|
||||
capabilities: vec![
|
||||
"cultcache.mirror.publish",
|
||||
"cultcache.intent.watch",
|
||||
"host.status.read",
|
||||
"scene.tree.read",
|
||||
"component.state.read",
|
||||
"selection.read",
|
||||
"asset.catalog.read",
|
||||
"asset.prefab.instantiate",
|
||||
"asset.prefab.variant.create",
|
||||
"gameobject.create",
|
||||
"component.attach",
|
||||
"component.property.write",
|
||||
"command.receipt.publish",
|
||||
"eve.gui.publish",
|
||||
"eve.tui.publish",
|
||||
"quest.input.consume",
|
||||
"quest.pose.consume",
|
||||
"quest.video.publish",
|
||||
],
|
||||
},
|
||||
ToolSurface {
|
||||
id: "brokkr.blender_editor",
|
||||
title: "Blender Editor",
|
||||
tool_kind: "blender-editor",
|
||||
adapter: "surfaces/blender/brokkr_bridge",
|
||||
capabilities: shared_capabilities(),
|
||||
adapter: "surfaces/blender/brokkr_blender",
|
||||
capabilities: vec![
|
||||
"cultcache.mirror.publish",
|
||||
"cultcache.intent.watch",
|
||||
"host.status.read",
|
||||
"scene.tree.read",
|
||||
"asset.catalog.read",
|
||||
"command.receipt.publish",
|
||||
"eve.gui.publish",
|
||||
"eve.tui.publish",
|
||||
],
|
||||
},
|
||||
],
|
||||
mirror_documents: vec![
|
||||
MirrorDocument {
|
||||
name: "Unity host snapshot",
|
||||
schema: "brokkr.unity.host_snapshot.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
record_hint: "unity/host/current",
|
||||
},
|
||||
MirrorDocument {
|
||||
name: "Unity command intent",
|
||||
schema: "brokkr.unity.command_intent.v0",
|
||||
owner: "Verse command clients",
|
||||
record_hint: "unity/commands/{commandId}",
|
||||
},
|
||||
MirrorDocument {
|
||||
name: "Unity command receipt",
|
||||
schema: "brokkr.unity.command_receipt.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
record_hint: "unity/receipts/{commandId}",
|
||||
},
|
||||
MirrorDocument {
|
||||
name: "Unity snapshot receipt",
|
||||
schema: "brokkr.unity.snapshot_receipt.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
record_hint: "unity/receipts/snapshots/{observedAt}",
|
||||
},
|
||||
MirrorDocument {
|
||||
name: "Unity Quest route",
|
||||
schema: "brokkr.unity.quest_route.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
record_hint: "unity/quest-routes/{routeId}",
|
||||
},
|
||||
MirrorDocument {
|
||||
name: "Unity warped video frame",
|
||||
schema: "brokkr.unity.warped_video_frame.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
record_hint: "unity/quest/video/{frameId}",
|
||||
},
|
||||
],
|
||||
realtime_routes: build_unity_quest_routes(),
|
||||
eve_surfaces: vec![
|
||||
EveSurface {
|
||||
id: "brokkr.eve.tool_broker.v0",
|
||||
title: "Creative Tool Broker",
|
||||
cult_mesh_uri: "cultmesh://brokkr/eve/tool-broker",
|
||||
schema: "gamecult.eve.surface.v1",
|
||||
},
|
||||
EveSurface {
|
||||
id: "brokkr.eve.command_receipts.v0",
|
||||
title: "Command Receipts",
|
||||
cult_mesh_uri: "cultmesh://brokkr/eve/command-receipts",
|
||||
schema: "gamecult.eve.surface.v1",
|
||||
},
|
||||
EveSurface {
|
||||
id: "brokkr.eve.unity_editor_gui.v0",
|
||||
title: "Unity Editor GUI",
|
||||
|
|
@ -653,26 +236,58 @@ fn build_provider_advertisement() -> ProviderAdvertisement {
|
|||
},
|
||||
],
|
||||
command_policy: CommandPolicy {
|
||||
mode: "policy-gated",
|
||||
envelope_schema: "gamecult.brokkr.command_request.v0",
|
||||
receipt_schema: "gamecult.brokkr.command_receipt.v0",
|
||||
mode: "intent-documents-with-host-receipts",
|
||||
envelope_schema: "brokkr.unity.command_intent.v0",
|
||||
receipt_schema: "brokkr.unity.command_receipt.v0",
|
||||
notes: vec![
|
||||
"Plugins are adapters and do not own Verse provider truth.",
|
||||
"All host mutations must produce command receipts.",
|
||||
"Unity and Blender commands share one envelope shape.",
|
||||
"Verse clients write command intent documents into CultCache through CultMesh.",
|
||||
"Unity watches command intents, performs editor mutations, and publishes receipts.",
|
||||
"CultCache is durable mirror truth; Brokkr provider output is discovery metadata.",
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn shared_capabilities() -> Vec<&'static str> {
|
||||
fn build_unity_quest_routes() -> Vec<RealtimeRoute> {
|
||||
vec![
|
||||
"host.status.read",
|
||||
"scene.tree.read",
|
||||
"selection.read",
|
||||
"asset.catalog.read",
|
||||
"command.palette.read",
|
||||
"command.execute",
|
||||
"receipt.read",
|
||||
RealtimeRoute {
|
||||
id: "brokkr.unity.quest_input.consume.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
source: "quest.controllers",
|
||||
sink: "unity.input",
|
||||
schema: "gamecult.xr.quest_controller_input.v0",
|
||||
transport: "cultmesh",
|
||||
direction: "consume",
|
||||
notes: vec![
|
||||
"Quest controller state is a command/input stream, not Unity scene truth.",
|
||||
"Unity consumes this stream when play mode or editor tooling has opted in.",
|
||||
],
|
||||
},
|
||||
RealtimeRoute {
|
||||
id: "brokkr.unity.quest_pose.consume.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
source: "quest.hmd",
|
||||
sink: "unity.camera_rig",
|
||||
schema: "gamecult.xr.quest_pose.v0",
|
||||
transport: "cultmesh",
|
||||
direction: "consume",
|
||||
notes: vec![
|
||||
"Quest HMD pose can drive editor preview rigs or play-mode camera rigs.",
|
||||
"Pose input does not own persisted transform state unless Unity accepts a command intent.",
|
||||
],
|
||||
},
|
||||
RealtimeRoute {
|
||||
id: "brokkr.unity.quest_video.publish.v0",
|
||||
owner: "brokkr.unity_editor",
|
||||
source: "unity.playmode_camera",
|
||||
sink: "quest.video_surface",
|
||||
schema: "brokkr.unity.warped_video_frame.v0",
|
||||
transport: "cultmesh",
|
||||
direction: "publish",
|
||||
notes: vec![
|
||||
"Unity may publish warped frame descriptors for Quest presentation.",
|
||||
"Frame payloads are handles; the typed CultCache document carries ownership and timing.",
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,67 +2,70 @@
|
|||
|
||||
## Objective
|
||||
|
||||
Expose creative editor runtimes to the Verse through one coherent CultMesh broker
|
||||
daemon, beginning with Unity and Blender plugin surfaces.
|
||||
Expose creative editor runtimes to the Verse as live CultMesh mirrors, beginning
|
||||
with Unity and Blender plugin surfaces.
|
||||
|
||||
## Current Mechanism
|
||||
|
||||
Brokkr starts as a Rust daemon that emits a provider advertisement and exposes a
|
||||
local HTTP adapter lane for tool plugins. Unity can capture a host snapshot from
|
||||
the editor, including scene graph, components, serialized component state, and
|
||||
asset library records, then publish it to `POST /hosts/unity/snapshot`. Brokkr
|
||||
validates and retains that snapshot for `GET /hosts`, `/unity/scene`,
|
||||
`/unity/assets`, and Eve GUI/TUI lowerings. Unity writes are queued through
|
||||
`POST /commands/unity`; the Unity adapter polls, executes the command, and posts
|
||||
a receipt. Blender still has a thin plugin scaffold with host-local metadata and
|
||||
connection settings.
|
||||
Brokkr is a provider identity and editor-adapter contract. The Rust daemon emits
|
||||
the discovery document for Odin and the Verse. It does not own Unity scene
|
||||
truth, command queues, or dashboard state.
|
||||
|
||||
The Unity package opens a durable CultMesh node backed by a CultCache store at
|
||||
`.brokkr/unity-editor.ccmp`. Unity writes typed CultCache documents for the
|
||||
current editor snapshot, command receipts, Quest routes, and future Eve/CultUI
|
||||
surface projections. Verse-side clients write typed command-intent documents
|
||||
into the same mirror; Unity watches those intents, mutates the editor, and
|
||||
publishes receipts plus an updated snapshot.
|
||||
|
||||
## Invariants
|
||||
|
||||
- Editor hosts keep editor truth. Brokkr never becomes the canonical scene,
|
||||
asset, object, import, or build database.
|
||||
- Brokkr owns Verse-facing broker identity, command admission, routing receipts,
|
||||
and durable witness publication.
|
||||
- Unity and Blender commands share the same command envelope and receipt shape.
|
||||
- Eve/CultUI surfaces are projections over Brokkr/provider state and host
|
||||
observations, not separate dashboards with their own truth.
|
||||
- JSON is tolerated only as a schema/debug/export boundary. Durable state should
|
||||
become CultCache `.cc` witnesses as the runtime grows.
|
||||
- CultCache documents are the durable mirror state. CultMesh carries sync,
|
||||
watch streams, and Verse visibility.
|
||||
- Brokkr owns provider identity, mirror schema advertisement, and discovery
|
||||
metadata.
|
||||
- Unity owns Unity editor mutations. A command intent is not truth until Unity
|
||||
publishes a receipt and refreshed mirror state.
|
||||
- Eve/CultUI surfaces are typed projections over the mirror, not renderer-owned
|
||||
dashboards.
|
||||
- JSON is tolerated for schema publication and debug inspection only. It is not
|
||||
the load-bearing state lane.
|
||||
|
||||
## Intended Change
|
||||
|
||||
The Unity idea is widened into a general creative-tool broker: Unity and Blender
|
||||
are peers behind one broker contract. Tool-specific plugins stay boring and
|
||||
replaceable. Brokkr becomes the stable Verse organ.
|
||||
The old local adapter server has been cut out. The live path is now:
|
||||
|
||||
## Cut Line
|
||||
|
||||
Do not build separate Unity and Blender Verse providers unless a future invariant
|
||||
proves they need independent authority. Do not give plugins their own discovery
|
||||
truth, command policy, or dashboard summaries. They delegate to Brokkr.
|
||||
1. Brokkr advertises CultMesh mirror schemas.
|
||||
2. Unity opens its CultMesh node.
|
||||
3. Unity captures editor state and writes typed CultCache documents.
|
||||
4. Verse clients watch mirror state or write command-intent documents.
|
||||
5. Unity consumes command intents and publishes receipts.
|
||||
6. Eve GUI/TUI clients lower the mirrored interface documents.
|
||||
|
||||
## Owner Map
|
||||
|
||||
Owner: Brokkr owns tool-to-Verse brokerage.
|
||||
Owner: Brokkr owns tool-to-Verse discovery.
|
||||
|
||||
Inputs:
|
||||
|
||||
- Host observations from Unity and Blender plugins.
|
||||
- Operator commands admitted through Brokkr's command policy.
|
||||
- Command-intent documents written through CultMesh.
|
||||
- Odin discovery queries.
|
||||
- Eve/CultUI surface requests.
|
||||
- CultCache witness stores.
|
||||
- Eve/CultUI lowering requests.
|
||||
|
||||
Outputs:
|
||||
|
||||
- `gamecult.brokkr.provider_advertisement.v0`
|
||||
- `gamecult.brokkr.tool_host_snapshot.v0`
|
||||
- `gamecult.brokkr.command_request.v0`
|
||||
- `gamecult.brokkr.command_receipt.v0`
|
||||
- local adapter receipts for accepted host snapshots
|
||||
- Unity editor GUI/TUI Eve surface projections
|
||||
- `brokkr.unity.host_snapshot.v0`
|
||||
- `brokkr.unity.command_intent.v0`
|
||||
- `brokkr.unity.command_receipt.v0`
|
||||
- `brokkr.unity.snapshot_receipt.v0`
|
||||
- `brokkr.unity.quest_route.v0`
|
||||
- `brokkr.unity.warped_video_frame.v0`
|
||||
- Eve/CultUI surface documents for host status, selection, assets, scene/object
|
||||
trees, command palette, and receipt history.
|
||||
trees, component state, command affordances, and receipt history.
|
||||
|
||||
Derived State:
|
||||
|
||||
|
|
@ -73,19 +76,20 @@ Derived State:
|
|||
|
||||
Forbidden Writers:
|
||||
|
||||
- Unity editor callbacks cannot write Verse provider truth directly.
|
||||
- Blender operators cannot write Verse provider truth directly.
|
||||
- Discovery metadata cannot mutate editor state.
|
||||
- Eve renderers cannot admit commands directly to editor hosts.
|
||||
- Odin discovery records cannot decide command permissions.
|
||||
- Local debug exports cannot become durable state truth.
|
||||
|
||||
Shared Paths:
|
||||
|
||||
- Unity commands, Blender commands, programmatic commands, UI-triggered commands,
|
||||
and replayed command receipts must use the same command envelope.
|
||||
- Host snapshots from all tools must carry host id, tool kind, project path,
|
||||
- Direct Unity commands, programmatic commands, UI-triggered commands, and replayed
|
||||
command receipts use the same command-intent and receipt documents.
|
||||
- Host snapshots from all tools carry host id, tool kind, project path,
|
||||
observed-at timestamp, capabilities, and authority owner.
|
||||
|
||||
Deletion Line:
|
||||
|
||||
If a plugin grows its own command policy, provider advertisement, or durable
|
||||
state ledger, cut it back into an adapter and move the authority into Brokkr.
|
||||
If a plugin grows its own provider advertisement, command policy, or durable
|
||||
state ledger outside CultCache/CultMesh, cut it back into an adapter and move
|
||||
the authority into the mirror contract.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ Provider id: `brokkr.creative_tool_broker`
|
|||
|
||||
CultMesh base URI: `cultmesh://brokkr`
|
||||
|
||||
Local adapter HTTP endpoint: `http://127.0.0.1:8798`
|
||||
|
||||
Primary Eve surface id: `brokkr.eve.tool_broker.v0`
|
||||
|
||||
## Tool Kinds
|
||||
|
|
@ -15,40 +13,35 @@ Primary Eve surface id: `brokkr.eve.tool_broker.v0`
|
|||
|
||||
## Capability Families
|
||||
|
||||
- `cultcache.mirror.publish`
|
||||
- `cultcache.intent.watch`
|
||||
- `host.status.read`
|
||||
- `scene.tree.read`
|
||||
- `component.state.read`
|
||||
- `selection.read`
|
||||
- `asset.catalog.read`
|
||||
- `command.palette.read`
|
||||
- `command.execute`
|
||||
- `receipt.read`
|
||||
- `asset.prefab.instantiate`
|
||||
- `asset.prefab.variant.create`
|
||||
- `gameobject.create`
|
||||
- `component.attach`
|
||||
- `component.property.write`
|
||||
- `command.receipt.publish`
|
||||
- `eve.gui.publish`
|
||||
- `eve.tui.publish`
|
||||
|
||||
The scaffold advertises command execution as policy-gated. No host command
|
||||
should execute unless the host plugin recognizes the command family and Brokkr
|
||||
has issued a command request with a receipt id.
|
||||
## Mirror Documents
|
||||
|
||||
## Local Adapter Endpoints
|
||||
|
||||
- `GET /health`
|
||||
- `GET /provider`
|
||||
- `GET /hosts`
|
||||
- `POST /hosts/unity/snapshot`
|
||||
- `GET /unity/scene`
|
||||
- `GET /unity/assets`
|
||||
- `POST /commands/unity`
|
||||
- `GET /hosts/unity/commands/next`
|
||||
- `POST /hosts/unity/commands/receipt`
|
||||
- `GET /unity/receipts`
|
||||
- `GET /eve/unity/gui`
|
||||
- `GET /eve/unity/tui`
|
||||
|
||||
The HTTP lane is a local adapter transport. It is not the canonical public
|
||||
Verse contract.
|
||||
- `brokkr.unity.host_snapshot.v0` at `unity/host/current`
|
||||
- `brokkr.unity.command_intent.v0` at `unity/commands/{commandId}`
|
||||
- `brokkr.unity.command_receipt.v0` at `unity/receipts/{commandId}`
|
||||
- `brokkr.unity.snapshot_receipt.v0` at `unity/receipts/snapshots/{observedAt}`
|
||||
- `brokkr.unity.quest_route.v0` at `unity/quest-routes/{routeId}`
|
||||
- `brokkr.unity.warped_video_frame.v0` at `unity/quest/video/{frameId}`
|
||||
|
||||
## Unity Command Actions
|
||||
|
||||
All Unity writes use `gamecult.brokkr.unity_command.v0` and receive
|
||||
`gamecult.brokkr.unity_command_receipt.v0`.
|
||||
All Unity writes use `brokkr.unity.command_intent.v0` and receive
|
||||
`brokkr.unity.command_receipt.v0`.
|
||||
|
||||
- `createGameObject`
|
||||
- `attachComponent`
|
||||
|
|
@ -56,14 +49,14 @@ All Unity writes use `gamecult.brokkr.unity_command.v0` and receive
|
|||
- `instantiatePrefab`
|
||||
- `createPrefabVariant`
|
||||
|
||||
Unity owns the mutation. Brokkr queues the command and records the receipt after
|
||||
Unity executes it.
|
||||
Unity owns the mutation. Brokkr advertises the command surface; Verse clients
|
||||
write typed command intents; Unity executes recognized intents and publishes
|
||||
receipts.
|
||||
|
||||
## Eve/CultUI Lowerings
|
||||
|
||||
`/eve/unity/gui` and `/eve/unity/tui` expose the Unity editor surface as
|
||||
`gamecult.eve.surface.v1` projections. GUI and TUI clients should render these
|
||||
documents as views over the same Brokkr state:
|
||||
Unity publishes lowerable Eve/CultUI documents through CultMesh. GUI and TUI
|
||||
clients render those documents as views over the same mirrored state:
|
||||
|
||||
- scene graph
|
||||
- component state
|
||||
|
|
@ -71,5 +64,5 @@ documents as views over the same Brokkr state:
|
|||
- command affordances
|
||||
- command receipts
|
||||
|
||||
These documents are not dashboard-owned truth. They are lowerable interface
|
||||
state over Unity observations and Brokkr command receipts.
|
||||
These documents are interface state over Unity observations and receipts. They
|
||||
do not own editor truth.
|
||||
|
|
|
|||
8
surfaces/unity/Packages/com.gamecult.brokkr/Editor.meta
Normal file
8
surfaces/unity/Packages/com.gamecult.brokkr/Editor.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4df16e920207ce44e9ecd03b4af80a46
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using GameCult.Brokkr;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameCult.Brokkr.Editor
|
||||
{
|
||||
internal static class BrokkrBrokerClient
|
||||
{
|
||||
internal static string GetHealth(string endpoint)
|
||||
{
|
||||
return Send(endpoint, "/health", "GET", null);
|
||||
}
|
||||
|
||||
internal static BrokkrSnapshotReceipt PublishUnitySnapshot(string endpoint, BrokkrHostSnapshot snapshot)
|
||||
{
|
||||
var json = JsonUtility.ToJson(snapshot);
|
||||
var response = Send(endpoint, "/hosts/unity/snapshot", "POST", json);
|
||||
return JsonUtility.FromJson<BrokkrSnapshotReceipt>(response);
|
||||
}
|
||||
|
||||
internal static BrokkrUnityCommand GetNextUnityCommand(string endpoint)
|
||||
{
|
||||
var response = Send(endpoint, "/hosts/unity/commands/next", "GET", null);
|
||||
var envelope = JsonUtility.FromJson<BrokkrUnityCommandEnvelope>(response);
|
||||
return envelope?.command;
|
||||
}
|
||||
|
||||
internal static void PublishUnityCommandReceipt(string endpoint, BrokkrUnityCommandReceipt receipt)
|
||||
{
|
||||
var json = JsonUtility.ToJson(receipt);
|
||||
Send(endpoint, "/hosts/unity/commands/receipt", "POST", json);
|
||||
}
|
||||
|
||||
private static string Send(string endpoint, string path, string method, string body)
|
||||
{
|
||||
var request = (HttpWebRequest)WebRequest.Create(endpoint.TrimEnd('/') + path);
|
||||
request.Method = method;
|
||||
request.Timeout = 2500;
|
||||
request.ReadWriteTimeout = 2500;
|
||||
request.Accept = "application/json";
|
||||
|
||||
if (body != null)
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(body);
|
||||
request.ContentType = "application/json";
|
||||
request.ContentLength = bytes.Length;
|
||||
using var requestStream = request.GetRequestStream();
|
||||
requestStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var response = (HttpWebResponse)request.GetResponse();
|
||||
using var responseStream = response.GetResponseStream();
|
||||
using var reader = new StreamReader(responseStream ?? Stream.Null);
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
catch (WebException error) when (error.Response != null)
|
||||
{
|
||||
using var responseStream = error.Response.GetResponseStream();
|
||||
using var reader = new StreamReader(responseStream ?? Stream.Null);
|
||||
throw new InvalidOperationException(reader.ReadToEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using GameCult.Caching;
|
||||
using GameCult.Mesh;
|
||||
using GameCult.Networking;
|
||||
using R3;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameCult.Brokkr.Editor
|
||||
{
|
||||
internal sealed class BrokkrCultMeshMirror : IDisposable
|
||||
{
|
||||
private readonly Queue<BrokkrUnityCommand> commandQueue = new();
|
||||
private CultMeshNode node;
|
||||
private IDisposable commandSubscription;
|
||||
|
||||
internal bool IsRunning => node != null;
|
||||
internal string CachePath { get; private set; } = "";
|
||||
|
||||
internal async Task StartAsync(string cachePath)
|
||||
{
|
||||
if (node != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CachePath = cachePath;
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cachePath) ?? ".");
|
||||
|
||||
node = await CultMesh.StartNodeAsync(cachePath, new CultMeshNodeOptions
|
||||
{
|
||||
EnableDurableShardLogs = true,
|
||||
DatabaseOptions = new CultNetDatabaseOptions
|
||||
{
|
||||
RuntimeId = "brokkr-unity-editor"
|
||||
}
|
||||
});
|
||||
|
||||
commandSubscription = node.Database
|
||||
.Watch<BrokkrUnityCommand>()
|
||||
.Subscribe(change =>
|
||||
{
|
||||
if (change.Document != null)
|
||||
{
|
||||
commandQueue.Enqueue(change.Document);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
internal async Task PublishSnapshotAsync(BrokkrHostSnapshot snapshot)
|
||||
{
|
||||
RequireRunning();
|
||||
await node.Database.PutAsync(new CultRecordKey("unity/host/current"), snapshot);
|
||||
await node.FlushAsync(soft: true);
|
||||
}
|
||||
|
||||
internal async Task PublishReceiptAsync(BrokkrUnityCommandReceipt receipt)
|
||||
{
|
||||
RequireRunning();
|
||||
var key = string.IsNullOrWhiteSpace(receipt.commandId)
|
||||
? $"unity/receipts/{Guid.NewGuid():N}"
|
||||
: $"unity/receipts/{receipt.commandId}";
|
||||
await node.Database.PutAsync(new CultRecordKey(key), receipt);
|
||||
await node.FlushAsync(soft: true);
|
||||
}
|
||||
|
||||
internal async Task PublishQuestRouteAsync(BrokkrQuestRoute route)
|
||||
{
|
||||
RequireRunning();
|
||||
await node.Database.PutAsync(new CultRecordKey($"unity/quest-routes/{route.id}"), route);
|
||||
await node.FlushAsync(soft: true);
|
||||
}
|
||||
|
||||
internal bool TryDequeueCommand(out BrokkrUnityCommand command)
|
||||
{
|
||||
if (commandQueue.Count > 0)
|
||||
{
|
||||
command = commandQueue.Dequeue();
|
||||
return true;
|
||||
}
|
||||
|
||||
command = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static string DefaultCachePath()
|
||||
{
|
||||
var projectRoot = Application.dataPath.Replace("/Assets", "");
|
||||
return Path.Combine(projectRoot, ".brokkr", "unity-editor.ccmp");
|
||||
}
|
||||
|
||||
private void RequireRunning()
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
throw new InvalidOperationException("Brokkr CultMesh mirror is not running.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
commandSubscription?.Dispose();
|
||||
commandSubscription = null;
|
||||
node?.Dispose();
|
||||
node = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 211da6d14d98cf743a74b9122648d849
|
||||
|
|
@ -7,7 +7,6 @@ namespace GameCult.Brokkr.Editor
|
|||
internal const string ProviderId = "brokkr.unity_editor";
|
||||
internal const string ToolKind = "unity-editor";
|
||||
internal const string DefaultBrokerUri = "cultmesh://brokkr";
|
||||
internal const string DefaultHttpEndpoint = "http://127.0.0.1:8798";
|
||||
|
||||
internal static string BrokerUri
|
||||
{
|
||||
|
|
@ -15,12 +14,6 @@ namespace GameCult.Brokkr.Editor
|
|||
set => EditorPrefs.SetString("GameCult.Brokkr.BrokerUri", value);
|
||||
}
|
||||
|
||||
internal static string HttpEndpoint
|
||||
{
|
||||
get => EditorPrefs.GetString("GameCult.Brokkr.HttpEndpoint", DefaultHttpEndpoint);
|
||||
set => EditorPrefs.SetString("GameCult.Brokkr.HttpEndpoint", value.TrimEnd('/'));
|
||||
}
|
||||
|
||||
internal static bool AutoPublish
|
||||
{
|
||||
get => EditorPrefs.GetBool("GameCult.Brokkr.AutoPublish", false);
|
||||
|
|
@ -32,5 +25,11 @@ namespace GameCult.Brokkr.Editor
|
|||
get => EditorPrefs.GetBool("GameCult.Brokkr.AutoPollCommands", false);
|
||||
set => EditorPrefs.SetBool("GameCult.Brokkr.AutoPollCommands", value);
|
||||
}
|
||||
|
||||
internal static string CultMeshCachePath
|
||||
{
|
||||
get => EditorPrefs.GetString("GameCult.Brokkr.CultMeshCachePath", BrokkrCultMeshMirror.DefaultCachePath());
|
||||
set => EditorPrefs.SetString("GameCult.Brokkr.CultMeshCachePath", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6fd9250cc49bb0b49a8b99c44707ad0e
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1afc8472aaf9f3841bed6b89f5be07c5
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5db7c33dba9d8d84baee655b42298691
|
||||
|
|
@ -8,13 +8,14 @@ namespace GameCult.Brokkr.Editor
|
|||
public sealed class BrokkrWindow : EditorWindow
|
||||
{
|
||||
private string brokerUri = BrokkrSettings.DefaultBrokerUri;
|
||||
private string httpEndpoint = BrokkrSettings.DefaultHttpEndpoint;
|
||||
private string cultMeshCachePath = "";
|
||||
private bool autoPublish;
|
||||
private bool autoPollCommands;
|
||||
private BrokkrHostSnapshot lastSnapshot;
|
||||
private string lastReceipt = "No snapshot published yet.";
|
||||
private MessageType lastMessageType = MessageType.Info;
|
||||
private double nextPollAt;
|
||||
private BrokkrCultMeshMirror mirror;
|
||||
|
||||
[MenuItem("GameCult/Brokkr")]
|
||||
public static void Open()
|
||||
|
|
@ -25,7 +26,7 @@ namespace GameCult.Brokkr.Editor
|
|||
private void OnEnable()
|
||||
{
|
||||
brokerUri = BrokkrSettings.BrokerUri;
|
||||
httpEndpoint = BrokkrSettings.HttpEndpoint;
|
||||
cultMeshCachePath = BrokkrSettings.CultMeshCachePath;
|
||||
autoPublish = BrokkrSettings.AutoPublish;
|
||||
autoPollCommands = BrokkrSettings.AutoPollCommands;
|
||||
Selection.selectionChanged += Repaint;
|
||||
|
|
@ -40,6 +41,8 @@ namespace GameCult.Brokkr.Editor
|
|||
EditorSceneManagerBridge.SceneDirtied -= OnEditorSignal;
|
||||
EditorApplication.playModeStateChanged -= OnPlayModeChanged;
|
||||
EditorApplication.update -= OnEditorUpdate;
|
||||
mirror?.Dispose();
|
||||
mirror = null;
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
|
|
@ -47,14 +50,14 @@ namespace GameCult.Brokkr.Editor
|
|||
EditorGUILayout.LabelField("Provider", BrokkrSettings.ProviderId);
|
||||
EditorGUILayout.LabelField("Tool Kind", BrokkrSettings.ToolKind);
|
||||
brokerUri = EditorGUILayout.TextField("Broker URI", brokerUri);
|
||||
httpEndpoint = EditorGUILayout.TextField("HTTP Endpoint", httpEndpoint);
|
||||
cultMeshCachePath = EditorGUILayout.TextField("CultMesh Cache", cultMeshCachePath);
|
||||
autoPublish = EditorGUILayout.Toggle("Auto Publish", autoPublish);
|
||||
autoPollCommands = EditorGUILayout.Toggle("Auto Poll Commands", autoPollCommands);
|
||||
|
||||
if (GUILayout.Button("Save Settings"))
|
||||
{
|
||||
BrokkrSettings.BrokerUri = brokerUri;
|
||||
BrokkrSettings.HttpEndpoint = httpEndpoint;
|
||||
BrokkrSettings.CultMeshCachePath = cultMeshCachePath;
|
||||
BrokkrSettings.AutoPublish = autoPublish;
|
||||
BrokkrSettings.AutoPollCommands = autoPollCommands;
|
||||
SetStatus("Settings saved.", MessageType.Info);
|
||||
|
|
@ -63,12 +66,12 @@ namespace GameCult.Brokkr.Editor
|
|||
EditorGUILayout.Space();
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
if (GUILayout.Button("Capture Snapshot"))
|
||||
if (GUILayout.Button("Start CultMesh Mirror"))
|
||||
{
|
||||
CaptureSnapshot();
|
||||
StartMirror();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Publish Snapshot"))
|
||||
if (GUILayout.Button("Publish Mirror"))
|
||||
{
|
||||
PublishSnapshot();
|
||||
}
|
||||
|
|
@ -76,12 +79,12 @@ namespace GameCult.Brokkr.Editor
|
|||
|
||||
using (new EditorGUILayout.HorizontalScope())
|
||||
{
|
||||
if (GUILayout.Button("Ping Brokkr"))
|
||||
if (GUILayout.Button("Capture Snapshot"))
|
||||
{
|
||||
PingBroker();
|
||||
CaptureSnapshot();
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Poll Command"))
|
||||
if (GUILayout.Button("Poll Mirror Command"))
|
||||
{
|
||||
PollAndExecuteCommand(false);
|
||||
}
|
||||
|
|
@ -118,8 +121,9 @@ namespace GameCult.Brokkr.Editor
|
|||
lastSnapshot = BrokkrUnitySnapshotBuilder.Capture();
|
||||
}
|
||||
|
||||
var receipt = BrokkrBrokerClient.PublishUnitySnapshot(httpEndpoint, lastSnapshot);
|
||||
SetStatus($"Snapshot {receipt.status}: {receipt.acceptedAt}", MessageType.Info);
|
||||
RequireMirror();
|
||||
mirror.PublishSnapshotAsync(lastSnapshot).GetAwaiter().GetResult();
|
||||
SetStatus($"Mirrored Unity snapshot: {lastSnapshot.observedAt}", MessageType.Info);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
|
|
@ -127,12 +131,13 @@ namespace GameCult.Brokkr.Editor
|
|||
}
|
||||
}
|
||||
|
||||
private void PingBroker()
|
||||
private async void StartMirror()
|
||||
{
|
||||
try
|
||||
{
|
||||
var health = BrokkrBrokerClient.GetHealth(httpEndpoint);
|
||||
SetStatus(health, MessageType.Info);
|
||||
mirror ??= new BrokkrCultMeshMirror();
|
||||
await mirror.StartAsync(cultMeshCachePath);
|
||||
SetStatus($"CultMesh mirror running: {mirror.CachePath}", MessageType.Info);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
|
|
@ -144,21 +149,21 @@ namespace GameCult.Brokkr.Editor
|
|||
{
|
||||
try
|
||||
{
|
||||
var command = BrokkrBrokerClient.GetNextUnityCommand(httpEndpoint);
|
||||
if (command == null || string.IsNullOrEmpty(command.commandId))
|
||||
RequireMirror();
|
||||
if (!mirror.TryDequeueCommand(out var command) || string.IsNullOrEmpty(command.commandId))
|
||||
{
|
||||
if (!quiet)
|
||||
{
|
||||
SetStatus("No queued Unity command.", MessageType.Info);
|
||||
SetStatus("No queued CultMesh Unity command.", MessageType.Info);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var receipt = BrokkrUnityCommandExecutor.Execute(command);
|
||||
BrokkrBrokerClient.PublishUnityCommandReceipt(httpEndpoint, receipt);
|
||||
mirror.PublishReceiptAsync(receipt).GetAwaiter().GetResult();
|
||||
lastSnapshot = BrokkrUnitySnapshotBuilder.Capture();
|
||||
BrokkrBrokerClient.PublishUnitySnapshot(httpEndpoint, lastSnapshot);
|
||||
mirror.PublishSnapshotAsync(lastSnapshot).GetAwaiter().GetResult();
|
||||
SetStatus($"Command {receipt.status}: {receipt.commandId} {receipt.message}", MessageType.Info);
|
||||
}
|
||||
catch (Exception error)
|
||||
|
|
@ -196,6 +201,14 @@ namespace GameCult.Brokkr.Editor
|
|||
PollAndExecuteCommand(true);
|
||||
}
|
||||
|
||||
private void RequireMirror()
|
||||
{
|
||||
if (mirror == null || !mirror.IsRunning)
|
||||
{
|
||||
throw new InvalidOperationException("Start the Brokkr CultMesh mirror first.");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStatus(string message, MessageType messageType)
|
||||
{
|
||||
lastReceipt = message;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef5a39d0fbc93cc4a957f5043c24ad76
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ec8f7253c75003241b119ad822c1458f
|
||||
|
|
@ -2,7 +2,11 @@
|
|||
"name": "GameCult.Brokkr.Editor",
|
||||
"rootNamespace": "GameCult.Brokkr.Editor",
|
||||
"references": [
|
||||
"GameCult.Brokkr"
|
||||
"GameCult.Brokkr",
|
||||
"GameCult.Caching",
|
||||
"GameCult.Mesh",
|
||||
"GameCult.Networking",
|
||||
"R3"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8d04e9fd0de9f694980354480a3b4474
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
surfaces/unity/Packages/com.gamecult.brokkr/Plugins.meta
Normal file
8
surfaces/unity/Packages/com.gamecult.brokkr/Plugins.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 61034eb84e867684db7ddef7ed9fadbe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: adae6c2a0f4b3f743b6ab78cb0988871
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 664ec081a56277e4c8c9d1efc3b6416f
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7f7d43fe0ed322446a4ae5b345a4b1a9
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 384dd07098d548f4cb3cdd573cba2fac
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: be58f7171a27e4641bc5c1ece94e1a0e
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: be4ca9f17443d3b4ca054c236480ccac
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 544b484d57520474d8b31d232b87d5bd
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9403fba97394ef941ab2ab830adb0bdf
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f5fad94e45028b4cb6a62b62252e1a4
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 941b8cae890bc58489c85b9a53eb0c52
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: af58bbde7fb10c74891cfc94811b25e9
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 36d3af9ac3f57cb46b1cbd574931f69c
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 28ef17d784838b64cb4be5ebdc1ee8a0
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bddff633377fe234b85d00b3e2764100
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d2cc82d315542004b91042f6dac44368
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e68bfb4b774a27847b375e30c5ec3905
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3a6830e9cbbf7849a5b7f011ba74e51
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 72d7f2b2b7ff7634b81428b763b45852
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 426a8a696a5c1b94fbd9dfcc04786c7d
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dea147d566e7d7b43a1b13c532cfcf0c
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2dc4cd724917584aa9b38f0a4bc669a
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6f80ea203cf635b4584cb104fba83594
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 230003b782f92e349a35339fb2320133
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7bbc7179ab442cf44bf45ae6344c8766
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d6474534f64e9594aa9cd78743056068
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 5f598b1f1749353408add83931bd042e
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ef728200a42c6a46b150b5a3143be6f
|
||||
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b3d0157e180a40942a31d7682f7c5674
|
||||
8
surfaces/unity/Packages/com.gamecult.brokkr/Runtime.meta
Normal file
8
surfaces/unity/Packages/com.gamecult.brokkr/Runtime.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9f3d356ff1cae6744a12a19e055ad108
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,109 +1,124 @@
|
|||
using System;
|
||||
using GameCult.Caching;
|
||||
using MessagePack;
|
||||
|
||||
namespace GameCult.Brokkr
|
||||
{
|
||||
[CultDocument("brokkr.unity.host_snapshot", "brokkr.unity.host_snapshot.v0")]
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrHostSnapshot
|
||||
{
|
||||
public string schema = "gamecult.brokkr.tool_host_snapshot.v0";
|
||||
public string providerId = "brokkr.unity_editor";
|
||||
public string toolKind = "unity-editor";
|
||||
public string projectPath = "";
|
||||
public string observedAt = "";
|
||||
public string unityVersion = "";
|
||||
public string productName = "";
|
||||
public string activeScenePath = "";
|
||||
public int openSceneCount;
|
||||
public string[] selectedObjectNames = Array.Empty<string>();
|
||||
public int assetCount;
|
||||
public string[] capabilities = Array.Empty<string>();
|
||||
public BrokkrGameObjectSnapshot[] sceneObjects = Array.Empty<BrokkrGameObjectSnapshot>();
|
||||
public BrokkrAssetSnapshot[] assets = Array.Empty<BrokkrAssetSnapshot>();
|
||||
[Key(0)] public string schema = "gamecult.brokkr.tool_host_snapshot.v0";
|
||||
[Key(1)] public string providerId = "brokkr.unity_editor";
|
||||
[Key(2)] public string toolKind = "unity-editor";
|
||||
[Key(3)] public string projectPath = "";
|
||||
[Key(4)] public string observedAt = "";
|
||||
[Key(5)] public string unityVersion = "";
|
||||
[Key(6)] public string productName = "";
|
||||
[Key(7)] public string activeScenePath = "";
|
||||
[Key(8)] public int openSceneCount;
|
||||
[Key(9)] public string[] selectedObjectNames = Array.Empty<string>();
|
||||
[Key(10)] public int assetCount;
|
||||
[Key(11)] public string[] capabilities = Array.Empty<string>();
|
||||
[Key(12)] public BrokkrGameObjectSnapshot[] sceneObjects = Array.Empty<BrokkrGameObjectSnapshot>();
|
||||
[Key(13)] public BrokkrAssetSnapshot[] assets = Array.Empty<BrokkrAssetSnapshot>();
|
||||
}
|
||||
|
||||
[CultDocument("brokkr.unity.snapshot_receipt", "brokkr.unity.snapshot_receipt.v0")]
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrSnapshotReceipt
|
||||
{
|
||||
public string schema = "";
|
||||
public string providerId = "";
|
||||
public string toolKind = "";
|
||||
public string acceptedAt = "";
|
||||
public string status = "";
|
||||
[Key(0)] public string schema = "";
|
||||
[Key(1)] public string providerId = "";
|
||||
[Key(2)] public string toolKind = "";
|
||||
[Key(3)] public string acceptedAt = "";
|
||||
[Key(4)] public string status = "";
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrGameObjectSnapshot
|
||||
{
|
||||
public string objectId = "";
|
||||
public string name = "";
|
||||
public string path = "";
|
||||
public string scenePath = "";
|
||||
public bool activeSelf;
|
||||
public string tag = "";
|
||||
public int layer;
|
||||
public int childCount;
|
||||
public string parentId = "";
|
||||
public BrokkrComponentSnapshot[] components = Array.Empty<BrokkrComponentSnapshot>();
|
||||
[Key(0)] public string objectId = "";
|
||||
[Key(1)] public string name = "";
|
||||
[Key(2)] public string path = "";
|
||||
[Key(3)] public string scenePath = "";
|
||||
[Key(4)] public bool activeSelf;
|
||||
[Key(5)] public string tag = "";
|
||||
[Key(6)] public int layer;
|
||||
[Key(7)] public int childCount;
|
||||
[Key(8)] public string parentId = "";
|
||||
[Key(9)] public BrokkrComponentSnapshot[] components = Array.Empty<BrokkrComponentSnapshot>();
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrComponentSnapshot
|
||||
{
|
||||
public string componentId = "";
|
||||
public string typeName = "";
|
||||
public string assemblyQualifiedName = "";
|
||||
public bool enabled;
|
||||
public BrokkrSerializedPropertySnapshot[] properties = Array.Empty<BrokkrSerializedPropertySnapshot>();
|
||||
[Key(0)] public string componentId = "";
|
||||
[Key(1)] public string typeName = "";
|
||||
[Key(2)] public string assemblyQualifiedName = "";
|
||||
[Key(3)] public bool enabled;
|
||||
[Key(4)] public BrokkrSerializedPropertySnapshot[] properties = Array.Empty<BrokkrSerializedPropertySnapshot>();
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrSerializedPropertySnapshot
|
||||
{
|
||||
public string path = "";
|
||||
public string displayName = "";
|
||||
public string propertyType = "";
|
||||
public string value = "";
|
||||
public bool editable;
|
||||
[Key(0)] public string path = "";
|
||||
[Key(1)] public string displayName = "";
|
||||
[Key(2)] public string propertyType = "";
|
||||
[Key(3)] public string value = "";
|
||||
[Key(4)] public bool editable;
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrAssetSnapshot
|
||||
{
|
||||
public string path = "";
|
||||
public string guid = "";
|
||||
public string typeName = "";
|
||||
public bool isPrefab;
|
||||
[Key(0)] public string path = "";
|
||||
[Key(1)] public string guid = "";
|
||||
[Key(2)] public string typeName = "";
|
||||
[Key(3)] public bool isPrefab;
|
||||
}
|
||||
|
||||
[CultDocument("brokkr.unity.command_intent", "brokkr.unity.command_intent.v0")]
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrUnityCommand
|
||||
{
|
||||
public string schema = "gamecult.brokkr.unity_command.v0";
|
||||
public string commandId = "";
|
||||
public string action = "";
|
||||
public string targetObjectId = "";
|
||||
public string name = "";
|
||||
public string componentType = "";
|
||||
public string propertyPath = "";
|
||||
public string value = "";
|
||||
public string assetPath = "";
|
||||
public string parentObjectId = "";
|
||||
[Key(0)] public string schema = "gamecult.brokkr.unity_command.v0";
|
||||
[Key(1)] public string commandId = "";
|
||||
[Key(2)] public string action = "";
|
||||
[Key(3)] public string targetObjectId = "";
|
||||
[Key(4)] public string name = "";
|
||||
[Key(5)] public string componentType = "";
|
||||
[Key(6)] public string propertyPath = "";
|
||||
[Key(7)] public string value = "";
|
||||
[Key(8)] public string assetPath = "";
|
||||
[Key(9)] public string parentObjectId = "";
|
||||
}
|
||||
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrUnityCommandEnvelope
|
||||
{
|
||||
public BrokkrUnityCommand command;
|
||||
[Key(0)] public BrokkrUnityCommand command;
|
||||
}
|
||||
|
||||
[CultDocument("brokkr.unity.command_receipt", "brokkr.unity.command_receipt.v0")]
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrUnityCommandReceipt
|
||||
{
|
||||
public string schema = "gamecult.brokkr.unity_command_receipt.v0";
|
||||
public string commandId = "";
|
||||
public string status = "";
|
||||
public string message = "";
|
||||
public string objectId = "";
|
||||
public string observedAt = "";
|
||||
[Key(0)] public string schema = "gamecult.brokkr.unity_command_receipt.v0";
|
||||
[Key(1)] public string commandId = "";
|
||||
[Key(2)] public string status = "";
|
||||
[Key(3)] public string message = "";
|
||||
[Key(4)] public string objectId = "";
|
||||
[Key(5)] public string observedAt = "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8a1f93f8d19113a45b2da02e4c996dfa
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using GameCult.Caching;
|
||||
using MessagePack;
|
||||
|
||||
namespace GameCult.Brokkr
|
||||
{
|
||||
[CultDocument("brokkr.unity.quest_route", "brokkr.unity.quest_route.v0")]
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrQuestRoute
|
||||
{
|
||||
[Key(0)] public string id = "";
|
||||
[Key(1)] public string owner = "";
|
||||
[Key(2)] public string source = "";
|
||||
[Key(3)] public string sink = "";
|
||||
[Key(4)] public string schema = "";
|
||||
[Key(5)] public string transport = "";
|
||||
[Key(6)] public string direction = "";
|
||||
[Key(7)] public string[] notes = Array.Empty<string>();
|
||||
}
|
||||
|
||||
[CultDocument("brokkr.unity.warped_video_frame", "brokkr.unity.warped_video_frame.v0")]
|
||||
[MessagePackObject]
|
||||
[Serializable]
|
||||
public sealed class BrokkrUnityWarpedVideoFrame
|
||||
{
|
||||
[Key(0)] public string schema = "gamecult.brokkr.unity_warped_video_frame.v0";
|
||||
[Key(1)] public string frameId = "";
|
||||
[Key(2)] public string sourceId = "brokkr.unity_editor:playmode-warped-frame";
|
||||
[Key(3)] public string targetStreamId = "";
|
||||
[Key(4)] public long presentedAtNs;
|
||||
[Key(5)] public int width;
|
||||
[Key(6)] public int height;
|
||||
[Key(7)] public string pixelFormat = "";
|
||||
[Key(8)] public string colorSpace = "";
|
||||
[Key(9)] public string warpProfileId = "";
|
||||
[Key(10)] public string payloadTransport = "";
|
||||
[Key(11)] public string payloadHandle = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f36680b710a81e64bbac2ac1b1746461
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
{
|
||||
"name": "GameCult.Brokkr",
|
||||
"rootNamespace": "GameCult.Brokkr",
|
||||
"references": [],
|
||||
"references": [
|
||||
"GameCult.Caching",
|
||||
"MessagePack"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
|
|
@ -12,4 +15,3 @@
|
|||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b84ea38e725cd8d428cad499527a997e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94101088cd10b894c888a691ddf883a6
|
||||
PackageManifestImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
# Brokkr Unity Adapter
|
||||
|
||||
This package lets the Unity Editor publish a host snapshot to the local Brokkr
|
||||
daemon.
|
||||
This package lets the Unity Editor publish its scene, component, asset, command,
|
||||
receipt, Quest, and Eve/CultUI state as typed CultCache documents synced through
|
||||
CultMesh.
|
||||
|
||||
## Install By Local Path
|
||||
|
||||
|
|
@ -11,53 +12,43 @@ Add this package to a Unity project's `Packages/manifest.json`:
|
|||
"com.gamecult.brokkr": "file:E:/Projects/Brokkr/surfaces/unity/Packages/com.gamecult.brokkr"
|
||||
```
|
||||
|
||||
Vendor the CultMesh runtime DLLs before opening Unity:
|
||||
|
||||
```powershell
|
||||
.\tools\vendor-cultmesh-unity.ps1
|
||||
```
|
||||
|
||||
Then open `GameCult > Brokkr`.
|
||||
|
||||
## Local Smoke
|
||||
|
||||
Start the daemon:
|
||||
|
||||
```powershell
|
||||
cargo run -p brokkr-daemon -- serve
|
||||
```
|
||||
|
||||
In Unity:
|
||||
|
||||
1. Open `GameCult > Brokkr`.
|
||||
2. Leave HTTP endpoint as `http://127.0.0.1:8798`.
|
||||
3. Click `Ping Brokkr`.
|
||||
4. Click `Capture Snapshot`.
|
||||
5. Click `Publish Snapshot`.
|
||||
2. Confirm `Broker URI` is `cultmesh://brokkr`.
|
||||
3. Confirm `CultMesh Cache` points at `.brokkr/unity-editor.ccmp`.
|
||||
4. Click `Start CultMesh Mirror`.
|
||||
5. Click `Capture Snapshot`.
|
||||
6. Click `Publish Mirror`.
|
||||
|
||||
The daemon should retain the latest Unity snapshot at:
|
||||
The Unity adapter writes the latest editor snapshot to:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8798/hosts
|
||||
unity/host/current
|
||||
```
|
||||
|
||||
The richer read surfaces are available at:
|
||||
Verse-side command clients write `brokkr.unity.command_intent.v0` documents to:
|
||||
|
||||
```text
|
||||
http://127.0.0.1:8798/unity/scene
|
||||
http://127.0.0.1:8798/unity/assets
|
||||
http://127.0.0.1:8798/eve/unity/gui
|
||||
http://127.0.0.1:8798/eve/unity/tui
|
||||
unity/commands/{commandId}
|
||||
```
|
||||
|
||||
Writes are queued through Brokkr and executed by the Unity editor adapter:
|
||||
Unity watches those command intents, mutates the editor, and publishes receipts
|
||||
to:
|
||||
|
||||
```powershell
|
||||
@'
|
||||
{
|
||||
"schema": "gamecult.brokkr.unity_command.v0",
|
||||
"commandId": "demo-create",
|
||||
"action": "createGameObject",
|
||||
"name": "Brokkr Demo"
|
||||
}
|
||||
'@ | curl.exe -s -X POST http://127.0.0.1:8798/commands/unity -H "Content-Type: application/json" --data-binary "@-"
|
||||
```text
|
||||
unity/receipts/{commandId}
|
||||
```
|
||||
|
||||
Then click `Poll Command` in Unity or enable `Auto Poll Commands`.
|
||||
|
||||
The Unity plugin is still an adapter. Brokkr owns the Verse-facing provider and
|
||||
receipt lane; Unity owns Unity editor truth.
|
||||
The Unity plugin is still an adapter. Unity owns Unity editor truth; Brokkr owns
|
||||
provider discovery; CultCache and CultMesh own the live mirror lane.
|
||||
|
|
|
|||
127
tools/check.ps1
127
tools/check.ps1
|
|
@ -7,106 +7,53 @@ function Assert-NativeSuccess {
|
|||
}
|
||||
}
|
||||
|
||||
function Assert-Contains {
|
||||
param(
|
||||
[string]$Haystack,
|
||||
[string]$Needle,
|
||||
[string]$Label
|
||||
)
|
||||
if (-not $Haystack.Contains($Needle)) {
|
||||
throw "$Label did not contain '$Needle'"
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location (Split-Path -Parent $PSScriptRoot)
|
||||
try {
|
||||
cargo fmt --check
|
||||
Assert-NativeSuccess "cargo fmt"
|
||||
cargo test --workspace
|
||||
Assert-NativeSuccess "cargo test"
|
||||
cargo run -p brokkr-daemon -- provider | Out-Null
|
||||
|
||||
$provider = cargo run -p brokkr-daemon -- provider
|
||||
Assert-NativeSuccess "cargo provider smoke"
|
||||
cargo build -p brokkr-daemon | Out-Null
|
||||
Assert-NativeSuccess "cargo build"
|
||||
$providerText = ($provider | Out-String)
|
||||
$providerJson = $providerText | ConvertFrom-Json
|
||||
|
||||
$smokeRoot = Join-Path (Get-Location) ".brokkr-smoke"
|
||||
New-Item -ItemType Directory -Force -Path $smokeRoot | Out-Null
|
||||
|
||||
$log = Join-Path $smokeRoot "brokkr-daemon.log"
|
||||
$out = Join-Path $smokeRoot "brokkr-daemon.out.log"
|
||||
Remove-Item $log, $out -ErrorAction SilentlyContinue
|
||||
|
||||
$daemon = Start-Process `
|
||||
-FilePath (Join-Path (Get-Location) "target\debug\brokkr-daemon.exe") `
|
||||
-ArgumentList @("serve", "--bind", "127.0.0.1:8798") `
|
||||
-WorkingDirectory (Get-Location) `
|
||||
-RedirectStandardError $log `
|
||||
-RedirectStandardOutput $out `
|
||||
-WindowStyle Hidden `
|
||||
-PassThru
|
||||
|
||||
try {
|
||||
Start-Sleep -Milliseconds 500
|
||||
$healthText = curl.exe -s http://127.0.0.1:8798/health
|
||||
Assert-NativeSuccess "health request"
|
||||
$health = $healthText | ConvertFrom-Json
|
||||
if ($health.ok -ne $true) {
|
||||
throw "Brokkr health smoke failed: $health"
|
||||
}
|
||||
|
||||
$snapshotPath = Join-Path $smokeRoot "unity-snapshot.json"
|
||||
$snapshot = '{"schema":"gamecult.brokkr.tool_host_snapshot.v0","providerId":"brokkr.unity_editor","toolKind":"unity-editor","projectPath":"E:/Projects/StreamPixelsUnity","observedAt":"2026-06-12T12:00:00.0000000Z","unityVersion":"smoke","productName":"StreamPixelsUnity","activeScenePath":"Assets/Scenes/SampleScene.unity","openSceneCount":1,"selectedObjectNames":["SmokeObject"],"assetCount":42,"capabilities":["host.status.read","scene.tree.read","selection.read","asset.catalog.read","command.palette.read","command.execute","receipt.read"],"sceneObjects":[{"objectId":"scene-object-1","name":"SmokeObject","path":"SmokeObject","scenePath":"Assets/Scenes/SampleScene.unity","activeSelf":true,"tag":"Untagged","layer":0,"childCount":0,"parentId":"","components":[{"componentId":"component-1","typeName":"UnityEngine.Transform","assemblyQualifiedName":"UnityEngine.Transform, UnityEngine.CoreModule","enabled":true,"properties":[{"path":"m_LocalPosition.x","displayName":"X","propertyType":"Float","value":"0","editable":true}]}]}],"assets":[{"path":"Assets/Smoke.prefab","guid":"smoke-guid","typeName":"UnityEngine.GameObject","isPrefab":true}]}'
|
||||
[System.IO.File]::WriteAllText($snapshotPath, $snapshot, [System.Text.UTF8Encoding]::new($false))
|
||||
|
||||
$receiptText = curl.exe -s -X POST http://127.0.0.1:8798/hosts/unity/snapshot -H "Content-Type: application/json" --data-binary "@$snapshotPath"
|
||||
Assert-NativeSuccess "Unity snapshot request"
|
||||
$receipt = $receiptText | ConvertFrom-Json
|
||||
if ($receipt.status -ne "accepted") {
|
||||
throw "Unity snapshot smoke failed: $receipt"
|
||||
}
|
||||
|
||||
$hostsText = curl.exe -s http://127.0.0.1:8798/hosts
|
||||
Assert-NativeSuccess "Unity host readback request"
|
||||
$hosts = $hostsText | ConvertFrom-Json
|
||||
if ($hosts.unity.providerId -ne "brokkr.unity_editor") {
|
||||
throw "Unity host readback smoke failed: $hosts"
|
||||
}
|
||||
|
||||
$scene = curl.exe -s http://127.0.0.1:8798/unity/scene
|
||||
Assert-NativeSuccess "Unity scene read request"
|
||||
$scene = $scene | ConvertFrom-Json
|
||||
if ($scene.providerId -ne "brokkr.unity_editor") {
|
||||
throw "Unity scene read smoke failed: $scene"
|
||||
}
|
||||
|
||||
$command = '{"schema":"gamecult.brokkr.unity_command.v0","commandId":"smoke-create","action":"createGameObject","name":"BrokkrSmokeObject"}'
|
||||
$queued = $command | curl.exe -s -X POST http://127.0.0.1:8798/commands/unity -H "Content-Type: application/json" --data-binary "@-"
|
||||
Assert-NativeSuccess "Unity command queue request"
|
||||
$queued = $queued | ConvertFrom-Json
|
||||
if ($queued.commandId -ne "smoke-create") {
|
||||
throw "Unity command queue smoke failed: $queued"
|
||||
}
|
||||
|
||||
$next = curl.exe -s http://127.0.0.1:8798/hosts/unity/commands/next
|
||||
Assert-NativeSuccess "Unity command next request"
|
||||
$next = $next | ConvertFrom-Json
|
||||
if ($next.command.commandId -ne "smoke-create") {
|
||||
throw "Unity command next smoke failed: $next"
|
||||
}
|
||||
|
||||
$commandReceipt = '{"schema":"gamecult.brokkr.unity_command_receipt.v0","commandId":"smoke-create","status":"accepted","message":"smoke","objectId":"smoke-object","observedAt":"2026-06-12T12:00:00.0000000Z"}'
|
||||
$postedReceipt = $commandReceipt | curl.exe -s -X POST http://127.0.0.1:8798/hosts/unity/commands/receipt -H "Content-Type: application/json" --data-binary "@-"
|
||||
Assert-NativeSuccess "Unity command receipt request"
|
||||
$postedReceipt = $postedReceipt | ConvertFrom-Json
|
||||
if ($postedReceipt.status -ne "accepted") {
|
||||
throw "Unity command receipt smoke failed: $postedReceipt"
|
||||
}
|
||||
|
||||
$gui = curl.exe -s http://127.0.0.1:8798/eve/unity/gui
|
||||
Assert-NativeSuccess "Unity Eve GUI request"
|
||||
$gui = $gui | ConvertFrom-Json
|
||||
if ($gui.schema -ne "gamecult.eve.surface.v1") {
|
||||
throw "Unity Eve GUI smoke failed: $gui"
|
||||
}
|
||||
|
||||
$tui = curl.exe -s http://127.0.0.1:8798/eve/unity/tui
|
||||
Assert-NativeSuccess "Unity Eve TUI request"
|
||||
$tui = $tui | ConvertFrom-Json
|
||||
if ($tui.mode -ne "tui") {
|
||||
throw "Unity Eve TUI smoke failed: $tui"
|
||||
Assert-Contains $providerText '"kind": "cultmesh"' "provider advertisement"
|
||||
Assert-Contains $providerText "brokkr.unity.host_snapshot.v0" "provider advertisement"
|
||||
Assert-Contains $providerText "brokkr.unity.command_intent.v0" "provider advertisement"
|
||||
foreach ($transport in $providerJson.transports) {
|
||||
if ($transport.kind -ne "cultmesh") {
|
||||
throw "Unexpected provider transport kind: $($transport.kind)"
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Stop-Process -Id $daemon.Id -ErrorAction SilentlyContinue
|
||||
|
||||
$pluginRoot = Join-Path (Get-Location) "surfaces\unity\Packages\com.gamecult.brokkr\Plugins\CultMesh"
|
||||
$requiredDlls = @(
|
||||
"GameCult.Caching.dll",
|
||||
"GameCult.Caching.MessagePack.dll",
|
||||
"GameCult.Mesh.dll",
|
||||
"GameCult.Networking.dll",
|
||||
"MessagePack.dll",
|
||||
"R3.dll"
|
||||
)
|
||||
|
||||
foreach ($dll in $requiredDlls) {
|
||||
$path = Join-Path $pluginRoot $dll
|
||||
if (-not (Test-Path $path)) {
|
||||
throw "Missing vendored CultMesh Unity dependency: $path"
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
|||
52
tools/vendor-cultmesh-unity.ps1
Normal file
52
tools/vendor-cultmesh-unity.ps1
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$cultLibRoot = "E:\Projects\CultLib"
|
||||
$pluginRoot = Join-Path $repoRoot "surfaces\unity\Packages\com.gamecult.brokkr\Plugins\CultMesh"
|
||||
|
||||
dotnet build (Join-Path $cultLibRoot "src\GameCult.Mesh\GameCult.Mesh.csproj") -c Debug
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "CultMesh build failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $pluginRoot | Out-Null
|
||||
|
||||
$sources = @(
|
||||
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Logging.dll"),
|
||||
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Caching.dll"),
|
||||
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Caching.MessagePack.dll"),
|
||||
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Networking.dll"),
|
||||
(Join-Path $cultLibRoot "bin\GameCult.Mesh\Debug\netstandard2.1\GameCult.Mesh.dll"),
|
||||
"$env:USERPROFILE\.nuget\packages\concurrenthashset\1.3.0\lib\netstandard2.0\ConcurrentCollections.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\isopoh.cryptography.argon2\2.0.0\lib\netstandard2.0\Isopoh.Cryptography.Argon2.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\isopoh.cryptography.blake2b\2.0.0\lib\netstandard2.0\Isopoh.Cryptography.Blake2b.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\isopoh.cryptography.securearray\2.0.0\lib\netstandard2.0\Isopoh.Cryptography.SecureArray.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\litenetlib\2.1.2\lib\netstandard2.1\LiteNetLib.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\messagepack\3.1.4\lib\netstandard2.1\MessagePack.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\messagepack.annotations\3.1.4\lib\netstandard2.0\MessagePack.Annotations.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\microsoft.bcl.asyncinterfaces\9.0.10\lib\netstandard2.1\Microsoft.Bcl.AsyncInterfaces.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\microsoft.bcl.timeprovider\8.0.0\lib\netstandard2.0\Microsoft.Bcl.TimeProvider.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\microsoft.net.stringtools\17.11.4\lib\netstandard2.0\Microsoft.NET.StringTools.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\r3\1.3.0\lib\netstandard2.1\R3.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.buffers\4.5.1\lib\netstandard2.0\System.Buffers.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.collections.immutable\8.0.0\lib\netstandard2.0\System.Collections.Immutable.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.componentmodel.annotations\5.0.0\lib\netstandard2.1\System.ComponentModel.Annotations.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.io.pipelines\9.0.10\lib\netstandard2.0\System.IO.Pipelines.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.memory\4.5.5\lib\netstandard2.0\System.Memory.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.numerics.vectors\4.4.0\lib\netstandard2.0\System.Numerics.Vectors.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.runtime.compilerservices.unsafe\6.0.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.text.encodings.web\9.0.10\lib\netstandard2.0\System.Text.Encodings.Web.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.text.json\9.0.10\lib\netstandard2.0\System.Text.Json.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.threading.channels\8.0.0\lib\netstandard2.1\System.Threading.Channels.dll",
|
||||
"$env:USERPROFILE\.nuget\packages\system.threading.tasks.extensions\4.5.4\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll"
|
||||
)
|
||||
|
||||
foreach ($source in $sources) {
|
||||
if (!(Test-Path $source)) {
|
||||
throw "Missing CultMesh Unity dependency: $source"
|
||||
}
|
||||
|
||||
Copy-Item -LiteralPath $source -Destination $pluginRoot -Force
|
||||
}
|
||||
|
||||
Write-Host "Vendored CultMesh Unity dependencies into $pluginRoot"
|
||||
Loading…
Reference in a new issue