Files
Genarrative/apps/ai-game-creator-shell/src-tauri/src/runner.rs
T
suzmii 26e4eab6b6 对齐主线ACL文件边界
将AGC Rust源码中的ACL专用实现恢复为主线版本

移除本分支内的Windows ACL提权命令与私有路径调用

保留Router、联网搜索和流式传输改动在后续stash中继续处理
2026-08-31 13:09:29 +08:00

72 lines
3.0 KiB
Rust

mod client;
mod dispatch;
mod endpoint;
mod project_owner;
mod protocol;
mod server;
mod state;
#[allow(unused_imports)]
pub(crate) use client::{
attach_external_agent_runner_gui_owner, cancel_external_agent_runner_goal,
clear_external_agent_runner_platform_session, compact_external_agent_runner_context,
configure_external_agent_runner, configure_external_agent_runner_read_only,
continue_external_agent_runner_action, ensure_external_agent_runner_started,
ensure_external_agent_runner_started_for_gui, install_external_agent_runner_platform_session,
interrupt_external_agent_runner_provider_for_steer_decision, notify_external_agent_runner,
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, shutdown_external_agent_runner_for_client_exit,
shutdown_external_agent_runner_if_idle, steer_external_agent_runner,
wake_external_agent_runner_pending, wake_external_agent_runner_pending_for_run,
};
#[cfg(windows)]
pub(crate) use endpoint::validate_windows_regular_file_handle;
pub(crate) use endpoint::{
acquire_external_agent_runner_gui_owner_lock, 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, 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;