feat: consolidate local-first mnote web runtime

This commit is contained in:
lix-2026
2026-05-28 22:01:44 +08:00
parent 7354807ee9
commit 39b9a0183a
154 changed files with 13591 additions and 12728 deletions
@@ -2,15 +2,16 @@ use crate::app::{AppConfig, AppState};
use crate::context::RequestContext;
use crate::error::WebError;
use crate::transport::convex::{
execute_convex_command_plan, execute_convex_command_plan_with_artifacts, ConvexCommandExecution,
RetiredCloudCommandExecution, execute_retired_command_plan,
execute_retired_command_plan_with_artifacts,
};
use bridge_runtime::{
execute_runtime_input, RuntimeActorWire, RuntimeBridgeContextWire, RuntimeCommandEnvelopeWire,
RuntimeActorWire, RuntimeBridgeContextWire, RuntimeCommandEnvelopeWire,
RuntimeCommandExecutionPlan, RuntimeExecutionPlan, RuntimeInput, RuntimeSourceWire,
RuntimeTargetWire,
RuntimeTargetWire, execute_runtime_input,
};
use serde_json::json;
use serde_json::Value;
use serde_json::json;
pub fn runtime_context(
context: &RequestContext,
@@ -63,22 +64,22 @@ pub fn build_runtime_command_plan(
Ok(plan)
}
pub async fn execute_runtime_command_via_convex(
pub async fn execute_runtime_command_via_legacy_cloud(
config: &AppConfig,
context: &RequestContext,
effective_workspace_id: Option<&str>,
command: RuntimeCommandEnvelopeWire,
) -> Result<Value, WebError> {
let plan = build_runtime_command_plan(context, effective_workspace_id, command)?;
execute_convex_command_plan(config, context, &plan).await
execute_retired_command_plan(config, context, &plan).await
}
pub async fn execute_runtime_command_via_convex_with_artifacts(
pub async fn execute_runtime_command_via_legacy_cloud_with_artifacts(
state: &AppState,
context: &RequestContext,
effective_workspace_id: Option<&str>,
command: RuntimeCommandEnvelopeWire,
) -> Result<ConvexCommandExecution, WebError> {
) -> Result<RetiredCloudCommandExecution, WebError> {
let runtime_context = runtime_context(context, effective_workspace_id);
let runtime_input = RuntimeInput::Command {
context: runtime_context.clone(),
@@ -90,7 +91,7 @@ pub async fn execute_runtime_command_via_convex_with_artifacts(
return Err(WebError::internal("runtime command 未返回 command plan").with_context(context));
};
let execution = execute_convex_command_plan_with_artifacts(
let execution = execute_retired_command_plan_with_artifacts(
state.config(),
context,
&runtime_context,