Files
Genarrative/apps/ai-game-creator-shell/src-tauri/src/runner.rs
T
lhk229 55375b1406
Project CI / AI game creator shell Rust crates (push) Successful in 1m18s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m30s
Project CI / Backend tests (push) Successful in 3m58s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 10m12s
Project CI / Native shell tests (push) Successful in 5m49s
Project CI / Frontend tests (push) Successful in 2m18s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 9m50s
Project CI / AI game creator shell web tests (push) Failing after 2m11s
Project CI / Repository checks (push) Successful in 2m55s
清理测试编译warning (#509)
Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/509
Co-authored-by: Linghong <ink29535@proton.me>
Co-committed-by: Linghong <ink29535@proton.me>
2026-10-01 15:29:23 +08:00

80 lines
3.2 KiB
Rust

mod client;
mod dispatch;
mod endpoint;
mod project_owner;
mod protocol;
mod server;
mod state;
#[cfg(any(not(test), unix))]
pub(crate) use client::configure_external_agent_runner_read_only;
#[cfg(not(test))]
pub(crate) use client::{
attach_external_agent_runner_gui_owner, configure_external_agent_runner,
hold_external_agent_runner_gui_participant_lock, shutdown_external_agent_runner_for_gui_exit,
};
pub(crate) use client::{
call_external_managed_editor, disconnect_external_managed_editor_project,
mark_external_editor_uncertain,
};
#[allow(unused_imports)]
pub(crate) use client::{
cancel_external_agent_runner_goal, compact_external_agent_runner_context,
continue_external_agent_runner_action, ensure_external_agent_runner_started,
pause_external_agent_runner, read_external_agent_runner_status,
require_external_agent_runner_configured_for_cli_runtime_write,
require_external_agent_runner_for_cli_runtime_write, resume_external_agent_runner,
shutdown_external_agent_runner_if_idle, steer_external_agent_runner,
wake_external_agent_runner_pending, wake_external_agent_runner_pending_for_run,
};
pub(crate) use endpoint::external_agent_runner_process_start_identity;
#[cfg(windows)]
pub(crate) use endpoint::validate_windows_regular_file_handle;
pub(crate) use endpoint::{external_agent_runner_enabled, external_agent_runner_is_server_process};
#[allow(unused_imports)]
pub(crate) use protocol::{ExternalAgentRunnerStatus, EXTERNAL_AGENT_RUNNER_PROTOCOL_VERSION};
pub(crate) use server::bind_loopback_listener_with_linux_fallback;
#[cfg(not(test))]
pub(crate) use server::run_external_agent_runner_server;
#[cfg(test)]
pub(crate) fn simulate_external_agent_runner_cross_boot_owner_claim_for_test(
root: &std::path::Path,
config_dir: &std::path::Path,
previous_boot_id: &str,
current_boot_id: &str,
) -> Result<(std::path::PathBuf, Option<String>), String> {
let previous = project_owner::acquire_external_agent_runner_project_execution_owner(
root,
previous_boot_id,
protocol::EXTERNAL_AGENT_RUNNER_PROTOCOL_VERSION,
)?;
drop(previous);
let state = state::ExternalAgentRunnerServerState::new(
config_dir.join(protocol::EXTERNAL_AGENT_RUNNER_ENDPOINT_FILE_NAME),
protocol::ExternalAgentRunnerEndpoint {
protocol_version: protocol::EXTERNAL_AGENT_RUNNER_PROTOCOL_VERSION,
pid: std::process::id(),
boot_id: current_boot_id.to_string(),
port: 41009,
token: "owner-provider-token-owner-provider-token".to_string(),
heartbeat_at: 1_725_000_000_000,
executable_fingerprint: Some("a".repeat(64)),
process_start_identity: None,
},
);
let claim = state.claim_project_execution_owner(root)?;
let result = (claim.root, claim.recovered_from_boot_id);
let second = state.claim_project_execution_owner(root)?;
if second.recovered_from_boot_id.is_some() {
return Err("同 boot execution owner 重入重复触发恢复".to_string());
}
Ok(result)
}
#[cfg(test)]
mod tests;
pub(crate) use client::{
clear_external_agent_runner_platform_session, install_external_agent_runner_platform_session,
};