ec3a187dd7
Project CI / AI game creator shell Rust crates (push) Successful in 1m11s
Project CI / AI game creator shell Rust smoke (push) Successful in 1m34s
Project CI / Backend tests (push) Successful in 4m46s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m31s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 9m41s
Project CI / Frontend tests (push) Successful in 2m19s
Project CI / Native shell tests (push) Successful in 7m5s
Project CI / AI game creator shell web tests (push) Successful in 1m54s
Project CI / Repository checks (push) Successful in 2m36s
Reviewed-on: https://git.genarrative.world/git/GenarrativeAI/Genarrative/pulls/503 Co-authored-by: Linghong <ink29535@proton.me> Co-committed-by: Linghong <ink29535@proton.me>
74 lines
3.0 KiB
Rust
74 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,
|
|
hold_external_agent_runner_gui_participant_lock,
|
|
install_external_agent_runner_platform_session, 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_for_gui_exit, 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 client::{
|
|
call_external_managed_editor, disconnect_external_managed_editor_project,
|
|
mark_external_editor_uncertain,
|
|
};
|
|
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, 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;
|