aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 11:06:46 +01:00
parent df99318392
commit 86e7c72e5f
10383 changed files with 749164 additions and 749170 deletions

View File

@@ -0,0 +1,61 @@
//! Resolves controller targets using the caller's registered identity.
//! Legacy callers can still supply their captured session source for path resolution.
use super::LocalAgentControl;
use super::LocalAgentRuntime;
use crate::agent::api::AgentTarget;
use akode_protocol::AgentPath;
use akode_protocol::ThreadId;
use akode_protocol::error::CodexErr;
use akode_protocol::error::Result as CodexResult;
use akode_protocol::protocol::SessionSource;
impl LocalAgentControl {
pub(crate) fn resolve_target(
&self,
caller: ThreadId,
target: &AgentTarget,
) -> CodexResult<ThreadId> {
match target {
AgentTarget::Id(thread_id) => Ok(*thread_id),
AgentTarget::Reference(reference) => {
let caller = self.runtime.ensure_agent_known(caller)?;
self.runtime.resolve_path_reference(
&caller.agent_path.unwrap_or_else(AgentPath::root),
reference,
)
}
}
}
}
impl LocalAgentRuntime {
pub(crate) async fn resolve_agent_reference(
&self,
_current_thread_id: ThreadId,
current_session_source: &SessionSource,
agent_reference: &str,
) -> CodexResult<ThreadId> {
let current_agent_path = current_session_source
.get_agent_path()
.unwrap_or_else(AgentPath::root);
self.resolve_path_reference(&current_agent_path, agent_reference)
}
pub(super) fn resolve_path_reference(
&self,
current_agent_path: &AgentPath,
agent_reference: &str,
) -> CodexResult<ThreadId> {
let agent_path = current_agent_path
.resolve(agent_reference)
.map_err(CodexErr::UnsupportedOperation)?;
if let Some(thread_id) = self.registry.agent_id_for_path(&agent_path) {
return Ok(thread_id);
}
Err(CodexErr::UnsupportedOperation(format!(
"live agent path `{}` not found",
agent_path.as_str()
)))
}
}