Merge branch 'codex/container-simulate'

# Conflicts:
#	.hermes/shared-memory/decision-log.md
#	server-rs/crates/api-server/src/puzzle.rs
#	server-rs/crates/spacetime-client/src/mapper.rs
This commit is contained in:
kdletters
2026-05-19 10:07:45 +08:00
40 changed files with 2795 additions and 165 deletions

View File

@@ -624,6 +624,7 @@ pub mod record_custom_world_profile_play_procedure;
pub mod record_daily_login_tracking_event_and_return_procedure;
pub mod record_puzzle_work_like_procedure;
pub mod record_tracking_event_and_return_procedure;
pub mod record_tracking_events_and_return_procedure;
pub mod record_visual_novel_runtime_event_procedure;
pub mod redeem_profile_referral_invite_code_procedure;
pub mod redeem_profile_reward_code_procedure;
@@ -764,6 +765,7 @@ pub mod runtime_snapshot_row_type;
pub mod runtime_snapshot_table;
pub mod runtime_snapshot_type;
pub mod runtime_snapshot_upsert_input_type;
pub mod runtime_tracking_event_batch_procedure_result_type;
pub mod runtime_tracking_event_input_type;
pub mod runtime_tracking_event_procedure_result_type;
pub mod runtime_tracking_scope_kind_type;
@@ -1548,6 +1550,7 @@ pub use record_custom_world_profile_play_procedure::record_custom_world_profile_
pub use record_daily_login_tracking_event_and_return_procedure::record_daily_login_tracking_event_and_return;
pub use record_puzzle_work_like_procedure::record_puzzle_work_like;
pub use record_tracking_event_and_return_procedure::record_tracking_event_and_return;
pub use record_tracking_events_and_return_procedure::record_tracking_events_and_return;
pub use record_visual_novel_runtime_event_procedure::record_visual_novel_runtime_event;
pub use redeem_profile_referral_invite_code_procedure::redeem_profile_referral_invite_code;
pub use redeem_profile_reward_code_procedure::redeem_profile_reward_code;
@@ -1688,6 +1691,7 @@ pub use runtime_snapshot_row_type::RuntimeSnapshotRow;
pub use runtime_snapshot_table::*;
pub use runtime_snapshot_type::RuntimeSnapshot;
pub use runtime_snapshot_upsert_input_type::RuntimeSnapshotUpsertInput;
pub use runtime_tracking_event_batch_procedure_result_type::RuntimeTrackingEventBatchProcedureResult;
pub use runtime_tracking_event_input_type::RuntimeTrackingEventInput;
pub use runtime_tracking_event_procedure_result_type::RuntimeTrackingEventProcedureResult;
pub use runtime_tracking_scope_kind_type::RuntimeTrackingScopeKind;

View File

@@ -0,0 +1,59 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::runtime_tracking_event_batch_procedure_result_type::RuntimeTrackingEventBatchProcedureResult;
use super::runtime_tracking_event_input_type::RuntimeTrackingEventInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct RecordTrackingEventsAndReturnArgs {
pub inputs: Vec<RuntimeTrackingEventInput>,
}
impl __sdk::InModule for RecordTrackingEventsAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `record_tracking_events_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait record_tracking_events_and_return {
fn record_tracking_events_and_return(&self, inputs: Vec<RuntimeTrackingEventInput>) {
self.record_tracking_events_and_return_then(inputs, |_, _| {});
}
fn record_tracking_events_and_return_then(
&self,
inputs: Vec<RuntimeTrackingEventInput>,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeTrackingEventBatchProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl record_tracking_events_and_return for super::RemoteProcedures {
fn record_tracking_events_and_return_then(
&self,
inputs: Vec<RuntimeTrackingEventInput>,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<RuntimeTrackingEventBatchProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, RuntimeTrackingEventBatchProcedureResult>(
"record_tracking_events_and_return",
RecordTrackingEventsAndReturnArgs { inputs },
__callback,
);
}
}

View File

@@ -0,0 +1,17 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct RuntimeTrackingEventBatchProcedureResult {
pub ok: bool,
pub accepted_count: u32,
pub error_message: Option<String>,
}
impl __sdk::InModule for RuntimeTrackingEventBatchProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -585,6 +585,35 @@ impl SpacetimeClient {
.await
}
pub async fn record_tracking_events(
&self,
events: Vec<module_runtime::RuntimeTrackingEventInput>,
) -> Result<u32, SpacetimeClientError> {
if events.is_empty() {
return Ok(0);
}
let procedure_inputs = events
.into_iter()
.map(crate::module_bindings::RuntimeTrackingEventInput::from)
.collect::<Vec<_>>();
self.call_after_connect(
"record_tracking_events_and_return",
move |connection, sender| {
connection
.procedures()
.record_tracking_events_and_return_then(procedure_inputs, move |_, result| {
let mapped = result
.map_err(SpacetimeClientError::from_sdk_error)
.and_then(map_runtime_tracking_event_batch_procedure_result);
send_once(&sender, mapped);
});
},
)
.await
}
pub async fn get_profile_task_center(
&self,
user_id: String,