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:
37
akode-rs/app-server/src/request_processors/thread_input.rs
Normal file
37
akode-rs/app-server/src/request_processors/thread_input.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
use super::invalid_request;
|
||||
use akode_app_server_protocol::JSONRPCErrorError;
|
||||
use akode_core::CodexThread;
|
||||
use akode_protocol::protocol::MultiAgentVersion;
|
||||
use akode_protocol::protocol::SessionSource;
|
||||
use akode_protocol::protocol::SubAgentSource;
|
||||
|
||||
pub(super) const DIRECT_INPUT_TO_MULTI_AGENT_V2_SUBAGENT_ERROR: &str =
|
||||
"direct app-server input is not allowed for multi-agent v2 sub-agents";
|
||||
|
||||
/// Mirrors the ownership policy in request validation and thread capability responses.
|
||||
pub(super) fn can_accept_direct_input(
|
||||
multi_agent_version: Option<MultiAgentVersion>,
|
||||
session_source: &SessionSource,
|
||||
) -> bool {
|
||||
multi_agent_version != Some(MultiAgentVersion::V2)
|
||||
|| !matches!(
|
||||
session_source,
|
||||
SessionSource::SubAgent(SubAgentSource::ThreadSpawn { .. })
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) async fn ensure_direct_input_allowed(
|
||||
thread: &CodexThread,
|
||||
) -> Result<(), JSONRPCErrorError> {
|
||||
let config_snapshot = thread.config_snapshot().await;
|
||||
if !can_accept_direct_input(
|
||||
thread.multi_agent_version(),
|
||||
&config_snapshot.session_source,
|
||||
) {
|
||||
return Err(invalid_request(
|
||||
DIRECT_INPUT_TO_MULTI_AGENT_V2_SUBAGENT_ERROR,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user