Route Epiphany app-server DTOs through bridge
This commit is contained in:
parent
85b6dac130
commit
38c1573166
7 changed files with 77 additions and 56 deletions
|
|
@ -6,7 +6,6 @@ use codex_protocol::protocol::EpiphanyThreadState;
|
|||
use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
|
||||
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
|
||||
use epiphany_codex_bridge::launch::epiphany_role_binding_id;
|
||||
use epiphany_codex_bridge::launch::map_core_worker_launch_document;
|
||||
use epiphany_codex_bridge::mutation::epiphany_state_updated_notification;
|
||||
use epiphany_codex_bridge::mutation_service::EpiphanyThreadPromoteApplied;
|
||||
use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_promote;
|
||||
|
|
@ -14,12 +13,11 @@ use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_reorient_acce
|
|||
use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_role_accept;
|
||||
use epiphany_codex_bridge::mutation_service::apply_thread_epiphany_update;
|
||||
use epiphany_codex_bridge::mutation_service::interrupt_thread_epiphany_job;
|
||||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_job;
|
||||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_job_from_route_params;
|
||||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_reorient;
|
||||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_role;
|
||||
use epiphany_codex_bridge::retrieve::index_thread_epiphany_retrieval;
|
||||
use epiphany_codex_bridge::retrieve::thread_epiphany_retrieval_state;
|
||||
use epiphany_core::EpiphanyJobLaunchRequest;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::CodexMessageProcessor;
|
||||
|
|
@ -550,63 +548,29 @@ impl CodexMessageProcessor {
|
|||
request_id: ConnectionRequestId,
|
||||
params: ThreadEpiphanyJobLaunchParams,
|
||||
) {
|
||||
let ThreadEpiphanyJobLaunchParams {
|
||||
thread_id,
|
||||
expected_revision,
|
||||
binding_id,
|
||||
kind,
|
||||
scope,
|
||||
owner_role,
|
||||
authority_scope,
|
||||
linked_subgoal_ids,
|
||||
linked_graph_node_ids,
|
||||
instruction,
|
||||
launch_document,
|
||||
output_contract_id,
|
||||
max_runtime_seconds,
|
||||
} = params;
|
||||
let thread_id = params.thread_id.clone();
|
||||
|
||||
let (thread_uuid, thread) = match self.load_epiphany_thread(&request_id, &thread_id).await {
|
||||
Some(thread) => thread,
|
||||
None => return,
|
||||
};
|
||||
|
||||
let launch_document = map_core_worker_launch_document(launch_document);
|
||||
let applied = match launch_thread_epiphany_job(
|
||||
thread.as_ref(),
|
||||
EpiphanyJobLaunchRequest {
|
||||
expected_revision,
|
||||
binding_id: binding_id.clone(),
|
||||
kind,
|
||||
scope,
|
||||
owner_role,
|
||||
authority_scope,
|
||||
linked_subgoal_ids,
|
||||
linked_graph_node_ids,
|
||||
instruction,
|
||||
launch_document,
|
||||
output_contract_id,
|
||||
max_runtime_seconds,
|
||||
},
|
||||
kind,
|
||||
"missing launched job projection",
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(applied) => applied,
|
||||
Err(CodexErr::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
Err(err) => {
|
||||
self.send_internal_error(
|
||||
request_id,
|
||||
format!("failed to launch Epiphany job for {thread_uuid}: {err}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
let applied =
|
||||
match launch_thread_epiphany_job_from_route_params(thread.as_ref(), params).await {
|
||||
Ok(applied) => applied,
|
||||
Err(CodexErr::InvalidRequest(message)) => {
|
||||
self.send_invalid_request_error(request_id, message).await;
|
||||
return;
|
||||
}
|
||||
Err(err) => {
|
||||
self.send_internal_error(
|
||||
request_id,
|
||||
format!("failed to launch Epiphany job for {thread_uuid}: {err}"),
|
||||
)
|
||||
.await;
|
||||
return;
|
||||
}
|
||||
};
|
||||
let changed_fields = applied.changed_fields;
|
||||
let epiphany_state = applied.epiphany_state;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
|
|||
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
|
||||
use epiphany_codex_bridge::launch::epiphany_role_binding_id;
|
||||
use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_response;
|
||||
use epiphany_codex_bridge::retrieve::normalize_thread_epiphany_retrieve_query;
|
||||
use epiphany_codex_bridge::retrieve::retrieve_thread_epiphany;
|
||||
use epiphany_codex_bridge::retrieve::thread_epiphany_retrieval_state;
|
||||
use epiphany_codex_bridge::state::load_optional_thread_memory_graph_snapshot;
|
||||
|
|
@ -25,7 +26,6 @@ use epiphany_codex_bridge::view::map_epiphany_propose_response;
|
|||
use epiphany_codex_bridge::view::map_epiphany_reorient_result_response;
|
||||
use epiphany_codex_bridge::view::map_epiphany_role_result_response;
|
||||
use epiphany_codex_bridge::view::map_epiphany_view_response;
|
||||
use epiphany_core::normalize_epiphany_retrieve_query;
|
||||
|
||||
use super::CodexMessageProcessor;
|
||||
use super::ConnectionRequestId;
|
||||
|
|
@ -463,7 +463,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let query = match normalize_epiphany_retrieve_query(query, limit, path_prefixes) {
|
||||
let query = match normalize_thread_epiphany_retrieve_query(query, limit, path_prefixes) {
|
||||
Ok(query) => query,
|
||||
Err(message) => {
|
||||
self.send_invalid_request_error(request_id, message.to_string())
|
||||
|
|
|
|||
Reference in a new issue