Move protocol edge mapping out of app server
This commit is contained in:
parent
6086c8a7c3
commit
7385d28266
10 changed files with 263 additions and 236 deletions
|
|
@ -9,6 +9,7 @@ pub mod launch;
|
|||
pub mod mutation;
|
||||
pub mod mutation_service;
|
||||
pub mod pressure;
|
||||
pub mod protocol_edge;
|
||||
pub mod reorient;
|
||||
pub mod results;
|
||||
pub mod retrieve;
|
||||
|
|
|
|||
228
epiphany-codex-bridge/src/protocol_edge.rs
Normal file
228
epiphany-codex-bridge/src/protocol_edge.rs
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
use codex_app_server_protocol::ThreadEpiphanyContextParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyDistillParams;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQuery;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryDirection;
|
||||
use codex_app_server_protocol::ThreadEpiphanyGraphQueryKind;
|
||||
use codex_app_server_protocol::ThreadEpiphanyReorientWorkerLaunchDocument;
|
||||
use codex_app_server_protocol::ThreadEpiphanyRoleWorkerLaunchDocument;
|
||||
use codex_app_server_protocol::ThreadEpiphanyUpdatePatch;
|
||||
use codex_app_server_protocol::ThreadEpiphanyViewLens;
|
||||
use codex_app_server_protocol::ThreadEpiphanyWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyContextParams;
|
||||
use epiphany_core::EpiphanyDistillInput;
|
||||
use epiphany_core::EpiphanyGraphQuery;
|
||||
use epiphany_core::EpiphanyGraphQueryDirection;
|
||||
use epiphany_core::EpiphanyGraphQueryKind;
|
||||
use epiphany_core::EpiphanyReorientWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyRoleStatePatchDocument;
|
||||
use epiphany_core::EpiphanyRoleWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyViewLens;
|
||||
use epiphany_core::EpiphanyWorkerLaunchDocument;
|
||||
use epiphany_core::default_epiphany_view_lenses;
|
||||
use epiphany_core::epiphany_view_needs_jobs;
|
||||
use epiphany_core::epiphany_view_needs_pressure;
|
||||
use epiphany_core::epiphany_view_needs_reorientation_inputs;
|
||||
use epiphany_core::epiphany_view_needs_runtime_store;
|
||||
|
||||
pub fn default_core_epiphany_view_lenses() -> Vec<EpiphanyViewLens> {
|
||||
default_epiphany_view_lenses()
|
||||
}
|
||||
|
||||
pub fn protocol_view_lenses_to_core(lenses: Vec<ThreadEpiphanyViewLens>) -> Vec<EpiphanyViewLens> {
|
||||
lenses.into_iter().map(protocol_view_lens_to_core).collect()
|
||||
}
|
||||
|
||||
pub fn core_epiphany_view_needs_jobs(lenses: &[EpiphanyViewLens]) -> bool {
|
||||
epiphany_view_needs_jobs(lenses)
|
||||
}
|
||||
|
||||
pub fn core_epiphany_view_needs_reorientation_inputs(lenses: &[EpiphanyViewLens]) -> bool {
|
||||
epiphany_view_needs_reorientation_inputs(lenses)
|
||||
}
|
||||
|
||||
pub fn core_epiphany_view_needs_pressure(lenses: &[EpiphanyViewLens]) -> bool {
|
||||
epiphany_view_needs_pressure(lenses)
|
||||
}
|
||||
|
||||
pub fn core_epiphany_view_needs_runtime_store(lenses: &[EpiphanyViewLens]) -> bool {
|
||||
epiphany_view_needs_runtime_store(lenses)
|
||||
}
|
||||
|
||||
pub fn protocol_context_params_to_core(
|
||||
params: &ThreadEpiphanyContextParams,
|
||||
) -> EpiphanyContextParams {
|
||||
EpiphanyContextParams {
|
||||
graph_node_ids: params.graph_node_ids.clone(),
|
||||
graph_edge_ids: params.graph_edge_ids.clone(),
|
||||
observation_ids: params.observation_ids.clone(),
|
||||
evidence_ids: params.evidence_ids.clone(),
|
||||
include_active_frontier: params.include_active_frontier,
|
||||
include_linked_evidence: params.include_linked_evidence,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn protocol_distill_params_to_core(
|
||||
params: ThreadEpiphanyDistillParams,
|
||||
) -> EpiphanyDistillInput {
|
||||
let ThreadEpiphanyDistillParams {
|
||||
source_kind,
|
||||
status,
|
||||
text,
|
||||
subject,
|
||||
evidence_kind,
|
||||
code_refs,
|
||||
..
|
||||
} = params;
|
||||
EpiphanyDistillInput {
|
||||
source_kind,
|
||||
status,
|
||||
text,
|
||||
subject,
|
||||
evidence_kind,
|
||||
code_refs,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn protocol_graph_query_to_core(query: &ThreadEpiphanyGraphQuery) -> EpiphanyGraphQuery {
|
||||
EpiphanyGraphQuery {
|
||||
kind: protocol_graph_query_kind_to_core(query.kind),
|
||||
node_ids: query.node_ids.clone(),
|
||||
edge_ids: query.edge_ids.clone(),
|
||||
paths: query.paths.clone(),
|
||||
symbols: query.symbols.clone(),
|
||||
edge_kinds: query.edge_kinds.clone(),
|
||||
direction: query.direction.map(protocol_graph_query_direction_to_core),
|
||||
depth: query.depth,
|
||||
include_links: query.include_links,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn protocol_worker_launch_document_to_core(
|
||||
document: ThreadEpiphanyWorkerLaunchDocument,
|
||||
) -> EpiphanyWorkerLaunchDocument {
|
||||
match document {
|
||||
ThreadEpiphanyWorkerLaunchDocument::Role(document) => EpiphanyWorkerLaunchDocument::Role(
|
||||
protocol_role_worker_launch_document_to_core(document),
|
||||
),
|
||||
ThreadEpiphanyWorkerLaunchDocument::Reorient(document) => {
|
||||
EpiphanyWorkerLaunchDocument::Reorient(
|
||||
protocol_reorient_worker_launch_document_to_core(document),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn protocol_update_patch_to_core(
|
||||
patch: &ThreadEpiphanyUpdatePatch,
|
||||
) -> EpiphanyRoleStatePatchDocument {
|
||||
EpiphanyRoleStatePatchDocument {
|
||||
objective: patch.objective.clone(),
|
||||
active_subgoal_id: patch.active_subgoal_id.clone(),
|
||||
subgoals: patch.subgoals.clone(),
|
||||
invariants: patch.invariants.clone(),
|
||||
graphs: patch.graphs.clone(),
|
||||
graph_frontier: patch.graph_frontier.clone(),
|
||||
graph_checkpoint: patch.graph_checkpoint.clone(),
|
||||
scratch: patch.scratch.clone(),
|
||||
investigation_checkpoint: patch.investigation_checkpoint.clone(),
|
||||
job_bindings: patch.job_bindings.clone(),
|
||||
acceptance_receipts: patch.acceptance_receipts.clone(),
|
||||
runtime_links: patch.runtime_links.clone(),
|
||||
observations: patch.observations.clone(),
|
||||
evidence: patch.evidence.clone(),
|
||||
churn: patch.churn.clone(),
|
||||
mode: patch.mode.clone(),
|
||||
planning: patch.planning.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_view_lens_to_core(lens: ThreadEpiphanyViewLens) -> EpiphanyViewLens {
|
||||
match lens {
|
||||
ThreadEpiphanyViewLens::Scene => EpiphanyViewLens::Scene,
|
||||
ThreadEpiphanyViewLens::Jobs => EpiphanyViewLens::Jobs,
|
||||
ThreadEpiphanyViewLens::Roles => EpiphanyViewLens::Roles,
|
||||
ThreadEpiphanyViewLens::Planning => EpiphanyViewLens::Planning,
|
||||
ThreadEpiphanyViewLens::Pressure => EpiphanyViewLens::Pressure,
|
||||
ThreadEpiphanyViewLens::Reorient => EpiphanyViewLens::Reorient,
|
||||
ThreadEpiphanyViewLens::Crrc => EpiphanyViewLens::Crrc,
|
||||
ThreadEpiphanyViewLens::Coordinator => EpiphanyViewLens::Coordinator,
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_graph_query_kind_to_core(kind: ThreadEpiphanyGraphQueryKind) -> EpiphanyGraphQueryKind {
|
||||
match kind {
|
||||
ThreadEpiphanyGraphQueryKind::Node => EpiphanyGraphQueryKind::Node,
|
||||
ThreadEpiphanyGraphQueryKind::Path => EpiphanyGraphQueryKind::Path,
|
||||
ThreadEpiphanyGraphQueryKind::FrontierNeighborhood => {
|
||||
EpiphanyGraphQueryKind::FrontierNeighborhood
|
||||
}
|
||||
ThreadEpiphanyGraphQueryKind::Neighbors => EpiphanyGraphQueryKind::Neighbors,
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_graph_query_direction_to_core(
|
||||
direction: ThreadEpiphanyGraphQueryDirection,
|
||||
) -> EpiphanyGraphQueryDirection {
|
||||
match direction {
|
||||
ThreadEpiphanyGraphQueryDirection::Incoming => EpiphanyGraphQueryDirection::Incoming,
|
||||
ThreadEpiphanyGraphQueryDirection::Outgoing => EpiphanyGraphQueryDirection::Outgoing,
|
||||
ThreadEpiphanyGraphQueryDirection::Both => EpiphanyGraphQueryDirection::Both,
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_role_worker_launch_document_to_core(
|
||||
document: ThreadEpiphanyRoleWorkerLaunchDocument,
|
||||
) -> EpiphanyRoleWorkerLaunchDocument {
|
||||
EpiphanyRoleWorkerLaunchDocument {
|
||||
thread_id: document.thread_id,
|
||||
role_id: document.role_id,
|
||||
state_revision: document.state_revision,
|
||||
objective: document.objective,
|
||||
active_subgoal_id: document.active_subgoal_id,
|
||||
active_subgoals: document.active_subgoals,
|
||||
active_graph_node_ids: document.active_graph_node_ids,
|
||||
investigation_checkpoint: document.investigation_checkpoint,
|
||||
scratch: document.scratch,
|
||||
invariants: document.invariants,
|
||||
graphs: document.graphs,
|
||||
recent_evidence: document.recent_evidence,
|
||||
recent_observations: document.recent_observations,
|
||||
graph_frontier: document.graph_frontier,
|
||||
graph_checkpoint: document.graph_checkpoint,
|
||||
planning: document.planning,
|
||||
churn: document.churn,
|
||||
}
|
||||
}
|
||||
|
||||
fn protocol_reorient_worker_launch_document_to_core(
|
||||
document: ThreadEpiphanyReorientWorkerLaunchDocument,
|
||||
) -> EpiphanyReorientWorkerLaunchDocument {
|
||||
EpiphanyReorientWorkerLaunchDocument {
|
||||
thread_id: document.thread_id,
|
||||
mode: document.mode,
|
||||
checkpoint_id: document.checkpoint_id,
|
||||
checkpoint_kind: document.checkpoint_kind,
|
||||
checkpoint_disposition: document.checkpoint_disposition,
|
||||
checkpoint_focus: document.checkpoint_focus,
|
||||
checkpoint_summary: document.checkpoint_summary,
|
||||
checkpoint_next_action: document.checkpoint_next_action,
|
||||
checkpoint_open_questions: document.checkpoint_open_questions,
|
||||
checkpoint_evidence_ids: document.checkpoint_evidence_ids,
|
||||
checkpoint_code_refs: document.checkpoint_code_refs,
|
||||
decision_reasons: document.decision_reasons,
|
||||
decision_note: document.decision_note,
|
||||
pressure_level: document.pressure_level,
|
||||
retrieval_status: document.retrieval_status,
|
||||
graph_status: document.graph_status,
|
||||
watcher_status: document.watcher_status,
|
||||
checkpoint_dirty_paths: document.checkpoint_dirty_paths,
|
||||
checkpoint_changed_paths: document.checkpoint_changed_paths,
|
||||
scratch: document.scratch,
|
||||
graphs: document.graphs,
|
||||
recent_evidence: document.recent_evidence,
|
||||
recent_observations: document.recent_observations,
|
||||
active_frontier_node_ids: document.active_frontier_node_ids,
|
||||
linked_subgoal_ids: document.linked_subgoal_ids,
|
||||
linked_graph_node_ids: document.linked_graph_node_ids,
|
||||
}
|
||||
}
|
||||
|
|
@ -50,26 +50,6 @@ use crate::runtime_results::map_protocol_role_result_status;
|
|||
use crate::scene::map_core_epiphany_scene_action;
|
||||
use crate::scene::map_epiphany_scene;
|
||||
|
||||
pub fn map_core_epiphany_view_lenses(lenses: Vec<ThreadEpiphanyViewLens>) -> Vec<EpiphanyViewLens> {
|
||||
lenses
|
||||
.into_iter()
|
||||
.map(map_core_epiphany_view_lens)
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn map_core_epiphany_view_lens(lens: ThreadEpiphanyViewLens) -> EpiphanyViewLens {
|
||||
match lens {
|
||||
ThreadEpiphanyViewLens::Scene => EpiphanyViewLens::Scene,
|
||||
ThreadEpiphanyViewLens::Jobs => EpiphanyViewLens::Jobs,
|
||||
ThreadEpiphanyViewLens::Roles => EpiphanyViewLens::Roles,
|
||||
ThreadEpiphanyViewLens::Planning => EpiphanyViewLens::Planning,
|
||||
ThreadEpiphanyViewLens::Pressure => EpiphanyViewLens::Pressure,
|
||||
ThreadEpiphanyViewLens::Reorient => EpiphanyViewLens::Reorient,
|
||||
ThreadEpiphanyViewLens::Crrc => EpiphanyViewLens::Crrc,
|
||||
ThreadEpiphanyViewLens::Coordinator => EpiphanyViewLens::Coordinator,
|
||||
}
|
||||
}
|
||||
|
||||
fn map_protocol_epiphany_view_lens(lens: EpiphanyViewLens) -> ThreadEpiphanyViewLens {
|
||||
match lens {
|
||||
EpiphanyViewLens::Scene => ThreadEpiphanyViewLens::Scene,
|
||||
|
|
|
|||
|
|
@ -75,12 +75,10 @@ remembers doctrine; the branch remembers the blade.
|
|||
- Coordinator status derivation now receives core `EpiphanyCrrcResultStatus` for reorient result state; `ThreadEpiphanyReorientResultStatus` is projection-only for coordinator/view responses.
|
||||
- Coordinator view response assembly now receives core reorient state and role-board status; `ThreadEpiphanyReorientStateStatus` / `ThreadEpiphanyRoleLane` are projected inside the response builder.
|
||||
- Coordinator judgment is no longer bridge-owned. `epiphany-core` now exposes `EpiphanyCoordinatorStatusInput` -> `EpiphanyCoordinatorStatus`; the bridge gathers runtime snapshots and accepted-finding facts, then core derives source signals and the coordinator decision. Reorient worker launch composition is also core-owned through `EpiphanyReorientLaunchRequestInput` -> `EpiphanyJobLaunchRequest`; bridge supplies the prompt instruction plus retained compatibility binding/owner constants and performs the host launch side effect.
|
||||
- Coordinator finding signals are also core-owned. `derive_coordinator_finding_signals` derives modeling/verification/reorient accepted, reviewable, coverage, verdict, and evidence sequencing facts from typed findings plus `EpiphanyThreadState`; the bridge now loads snapshots/state and projects legacy JSON-RPC responses instead of keeping a duplicate acceptance tribunal.
|
||||
- View lens selector semantics are core-owned now. `EpiphanyViewLens`, default view lenses, and lens dependency planning live in `epiphany-core`; app-server converts JSON-RPC lens params to core selectors and asks core which jobs/pressure/runtime/reorientation facts must be loaded.
|
||||
- Context and graph-query request conversion now belongs to the app-server JSON-RPC wall. `epiphany-codex-bridge::context` receives core `EpiphanyContextParams` / `EpiphanyGraphQuery` and only projects core context/query views back into legacy response DTOs.
|
||||
- Distill request conversion also belongs to the app-server wall. The bridge distill response builder consumes core `EpiphanyDistillInput`; `ThreadEpiphanyDistillParams` should not re-enter bridge policy.
|
||||
- Generic job-launch document conversion also belongs to app-server. `ThreadEpiphanyWorkerLaunchDocument` is converted to core `EpiphanyWorkerLaunchDocument` before bridge launch/mutation law runs.
|
||||
- Generic update/promote patch conversion also belongs to app-server. `ThreadEpiphanyUpdatePatch` is converted to core `EpiphanyRoleStatePatchDocument` before mutation service calls; bridge mutation keeps legacy response patch projection only.
|
||||
- Coordinator finding signals are also core-owned. `derive_coordinator_finding_signals` derives modeling/verification/reorient accepted, reviewable, coverage, verdict, and evidence sequencing facts from typed findings plus `EpiphanyThreadState`; the bridge now loads snapshots/state and projects Codex JSON-RPC responses instead of keeping a duplicate acceptance tribunal.
|
||||
- View lens selector semantics are core-owned now. `EpiphanyViewLens`, default view lenses, and lens dependency planning live in `epiphany-core`; `epiphany-codex-bridge::protocol_edge` converts Codex JSON-RPC lens params to core selectors and exposes the core dependency plan so app-server only decides which host facts to load.
|
||||
- Correction: app-server must not own Epiphany request mapping. Codex JSON-RPC request DTO conversion now lives in `epiphany-codex-bridge::protocol_edge`; vendored app-server calls those edge adapters and no longer depends directly on `epiphany-core`.
|
||||
- Context, graph-query, distill, generic job-launch document, and generic update/promote patch request cargo now enters bridge as core `EpiphanyContextParams`, `EpiphanyGraphQuery`, `EpiphanyDistillInput`, `EpiphanyWorkerLaunchDocument`, and `EpiphanyRoleStatePatchDocument`.
|
||||
- MCP remains JSON because MCP is a JSON protocol. The latest processor cut only moved MCP refresh/OAuth/status/resource/tool-call route handling into `codex_message_processor/mcp_routes.rs`, reducing the root processor to about 8,977 lines; it did not claim MCP payloads are CultNet or make MCP an Epiphany-owned runtime contract.
|
||||
- Codex account auth route handling remains in vendored Codex but now lives in `codex_message_processor/auth_routes.rs`: API-key login, ChatGPT browser/device-code/external-token login, logout, auth status, account, rate limits, and add-credits nudge handling. This preserves Codex ownership of subscription auth while cutting the root processor to about 8,094 lines.
|
||||
- One-off command execution and command stream write/resize/terminate route handling now live in `codex_message_processor/command_routes.rs`; `CommandExecManager` remains the lifecycle owner, while the root processor is about 7,800 lines.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -381,17 +381,13 @@ current_status:
|
|||
sequencing facts are no longer bridge helper law. View lens selector
|
||||
semantics also moved into core: `EpiphanyViewLens`, default lens selection,
|
||||
and lens dependency planning now decide which host facts app-server/bridge
|
||||
need to load before legacy response projection. Context and graph-query
|
||||
request DTO conversion moved to the app-server JSON-RPC wall, so the bridge
|
||||
receives core `EpiphanyContextParams` / `EpiphanyGraphQuery` documents
|
||||
instead of owning request-side protocol mapping. Distill request DTO
|
||||
conversion also moved to the app-server wall; bridge distill response
|
||||
construction receives core `EpiphanyDistillInput`. Generic job launch
|
||||
document conversion moved to app-server too; bridge launch receives core
|
||||
`EpiphanyWorkerLaunchDocument` instead of protocol worker launch cargo.
|
||||
Generic update/promote patch conversion moved to app-server as well; bridge
|
||||
mutation receives core `EpiphanyRoleStatePatchDocument` and keeps only
|
||||
legacy response patch projection.
|
||||
need to load before Codex JSON-RPC response projection. The mistaken
|
||||
vendored app-server ownership of Epiphany request mapping was corrected:
|
||||
app-server now calls `epiphany-codex-bridge::protocol_edge`, while the
|
||||
bridge-owned protocol edge converts Codex JSON-RPC request DTOs into core
|
||||
`EpiphanyContextParams`, `EpiphanyGraphQuery`, `EpiphanyDistillInput`,
|
||||
`EpiphanyWorkerLaunchDocument`, and `EpiphanyRoleStatePatchDocument`.
|
||||
Vendored app-server no longer depends directly on `epiphany-core`.
|
||||
Reorient worker launch-request/document
|
||||
composition also moved behind a typed core seam
|
||||
(`EpiphanyReorientLaunchRequestInput` -> `EpiphanyJobLaunchRequest`);
|
||||
|
|
|
|||
1
vendor/codex/codex-rs/Cargo.lock
generated
vendored
1
vendor/codex/codex-rs/Cargo.lock
generated
vendored
|
|
@ -1913,7 +1913,6 @@ dependencies = [
|
|||
"constant_time_eq 0.3.1",
|
||||
"core_test_support",
|
||||
"epiphany-codex-bridge",
|
||||
"epiphany-core",
|
||||
"futures",
|
||||
"gethostname",
|
||||
"hmac 0.12.1",
|
||||
|
|
|
|||
1
vendor/codex/codex-rs/app-server/Cargo.toml
vendored
1
vendor/codex/codex-rs/app-server/Cargo.toml
vendored
|
|
@ -61,7 +61,6 @@ codex-utils-json-to-toml = { workspace = true }
|
|||
codex-utils-rustls-provider = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
epiphany-codex-bridge = { path = "../../../../epiphany-codex-bridge" }
|
||||
epiphany-core = { path = "../../../../epiphany-core" }
|
||||
clap = { workspace = true, features = ["derive"] }
|
||||
constant_time_eq = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -32,15 +32,13 @@ 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_reorient;
|
||||
use epiphany_codex_bridge::mutation_service::launch_thread_epiphany_role;
|
||||
use epiphany_codex_bridge::protocol_edge::protocol_update_patch_to_core;
|
||||
use epiphany_codex_bridge::protocol_edge::protocol_worker_launch_document_to_core;
|
||||
use epiphany_codex_bridge::results::map_core_role_result_role_id;
|
||||
use epiphany_codex_bridge::results::map_protocol_reorient_finding;
|
||||
use epiphany_codex_bridge::results::map_protocol_role_finding;
|
||||
use epiphany_codex_bridge::retrieve::epiphany_retrieval_state_for_paths;
|
||||
use epiphany_codex_bridge::retrieve::index_epiphany_retrieval_for_paths;
|
||||
use epiphany_core::EpiphanyReorientWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyRoleStatePatchDocument;
|
||||
use epiphany_core::EpiphanyRoleWorkerLaunchDocument;
|
||||
use epiphany_core::EpiphanyWorkerLaunchDocument;
|
||||
use std::sync::Arc;
|
||||
|
||||
use super::CodexMessageProcessor;
|
||||
|
|
@ -482,7 +480,7 @@ impl CodexMessageProcessor {
|
|||
};
|
||||
|
||||
let host = EpiphanyCodexThreadHost::new(thread.as_ref());
|
||||
let core_patch = thread_epiphany_update_patch_to_core(&patch);
|
||||
let core_patch = protocol_update_patch_to_core(&patch);
|
||||
let applied = match apply_thread_epiphany_promote(
|
||||
&host,
|
||||
expected_revision,
|
||||
|
|
@ -562,7 +560,7 @@ impl CodexMessageProcessor {
|
|||
};
|
||||
|
||||
let host = EpiphanyCodexThreadHost::new(thread.as_ref());
|
||||
let core_patch = thread_epiphany_update_patch_to_core(&patch);
|
||||
let core_patch = protocol_update_patch_to_core(&patch);
|
||||
let applied = match apply_thread_epiphany_update(&host, expected_revision, core_patch).await
|
||||
{
|
||||
Ok(applied) => applied,
|
||||
|
|
@ -625,7 +623,7 @@ impl CodexMessageProcessor {
|
|||
};
|
||||
|
||||
let host = EpiphanyCodexThreadHost::new(thread.as_ref());
|
||||
let core_launch_document = thread_epiphany_worker_launch_document_to_core(launch_document);
|
||||
let core_launch_document = protocol_worker_launch_document_to_core(launch_document);
|
||||
let applied = match launch_thread_epiphany_job(
|
||||
&host,
|
||||
build_epiphany_job_launch_request(
|
||||
|
|
@ -796,102 +794,6 @@ fn thread_epiphany_job_from_surface(
|
|||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_worker_launch_document_to_core(
|
||||
document: ThreadEpiphanyWorkerLaunchDocument,
|
||||
) -> EpiphanyWorkerLaunchDocument {
|
||||
match document {
|
||||
ThreadEpiphanyWorkerLaunchDocument::Role(document) => EpiphanyWorkerLaunchDocument::Role(
|
||||
thread_epiphany_role_worker_launch_document_to_core(document),
|
||||
),
|
||||
ThreadEpiphanyWorkerLaunchDocument::Reorient(document) => {
|
||||
EpiphanyWorkerLaunchDocument::Reorient(
|
||||
thread_epiphany_reorient_worker_launch_document_to_core(document),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_update_patch_to_core(
|
||||
patch: &ThreadEpiphanyUpdatePatch,
|
||||
) -> EpiphanyRoleStatePatchDocument {
|
||||
EpiphanyRoleStatePatchDocument {
|
||||
objective: patch.objective.clone(),
|
||||
active_subgoal_id: patch.active_subgoal_id.clone(),
|
||||
subgoals: patch.subgoals.clone(),
|
||||
invariants: patch.invariants.clone(),
|
||||
graphs: patch.graphs.clone(),
|
||||
graph_frontier: patch.graph_frontier.clone(),
|
||||
graph_checkpoint: patch.graph_checkpoint.clone(),
|
||||
scratch: patch.scratch.clone(),
|
||||
investigation_checkpoint: patch.investigation_checkpoint.clone(),
|
||||
job_bindings: patch.job_bindings.clone(),
|
||||
acceptance_receipts: patch.acceptance_receipts.clone(),
|
||||
runtime_links: patch.runtime_links.clone(),
|
||||
observations: patch.observations.clone(),
|
||||
evidence: patch.evidence.clone(),
|
||||
churn: patch.churn.clone(),
|
||||
mode: patch.mode.clone(),
|
||||
planning: patch.planning.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_role_worker_launch_document_to_core(
|
||||
document: ThreadEpiphanyRoleWorkerLaunchDocument,
|
||||
) -> EpiphanyRoleWorkerLaunchDocument {
|
||||
EpiphanyRoleWorkerLaunchDocument {
|
||||
thread_id: document.thread_id,
|
||||
role_id: document.role_id,
|
||||
state_revision: document.state_revision,
|
||||
objective: document.objective,
|
||||
active_subgoal_id: document.active_subgoal_id,
|
||||
active_subgoals: document.active_subgoals,
|
||||
active_graph_node_ids: document.active_graph_node_ids,
|
||||
investigation_checkpoint: document.investigation_checkpoint,
|
||||
scratch: document.scratch,
|
||||
invariants: document.invariants,
|
||||
graphs: document.graphs,
|
||||
recent_evidence: document.recent_evidence,
|
||||
recent_observations: document.recent_observations,
|
||||
graph_frontier: document.graph_frontier,
|
||||
graph_checkpoint: document.graph_checkpoint,
|
||||
planning: document.planning,
|
||||
churn: document.churn,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_reorient_worker_launch_document_to_core(
|
||||
document: ThreadEpiphanyReorientWorkerLaunchDocument,
|
||||
) -> EpiphanyReorientWorkerLaunchDocument {
|
||||
EpiphanyReorientWorkerLaunchDocument {
|
||||
thread_id: document.thread_id,
|
||||
mode: document.mode,
|
||||
checkpoint_id: document.checkpoint_id,
|
||||
checkpoint_kind: document.checkpoint_kind,
|
||||
checkpoint_disposition: document.checkpoint_disposition,
|
||||
checkpoint_focus: document.checkpoint_focus,
|
||||
checkpoint_summary: document.checkpoint_summary,
|
||||
checkpoint_next_action: document.checkpoint_next_action,
|
||||
checkpoint_open_questions: document.checkpoint_open_questions,
|
||||
checkpoint_evidence_ids: document.checkpoint_evidence_ids,
|
||||
checkpoint_code_refs: document.checkpoint_code_refs,
|
||||
decision_reasons: document.decision_reasons,
|
||||
decision_note: document.decision_note,
|
||||
pressure_level: document.pressure_level,
|
||||
retrieval_status: document.retrieval_status,
|
||||
graph_status: document.graph_status,
|
||||
watcher_status: document.watcher_status,
|
||||
checkpoint_dirty_paths: document.checkpoint_dirty_paths,
|
||||
checkpoint_changed_paths: document.checkpoint_changed_paths,
|
||||
scratch: document.scratch,
|
||||
graphs: document.graphs,
|
||||
recent_evidence: document.recent_evidence,
|
||||
recent_observations: document.recent_observations,
|
||||
active_frontier_node_ids: document.active_frontier_node_ids,
|
||||
linked_subgoal_ids: document.linked_subgoal_ids,
|
||||
linked_graph_node_ids: document.linked_graph_node_ids,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_reorient_state_status(
|
||||
status: EpiphanyReorientStateStatus,
|
||||
) -> ThreadEpiphanyReorientStateStatus {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,15 @@ use epiphany_codex_bridge::cultnet::EpiphanySurfaceSource;
|
|||
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::protocol_edge::core_epiphany_view_needs_jobs;
|
||||
use epiphany_codex_bridge::protocol_edge::core_epiphany_view_needs_pressure;
|
||||
use epiphany_codex_bridge::protocol_edge::core_epiphany_view_needs_reorientation_inputs;
|
||||
use epiphany_codex_bridge::protocol_edge::core_epiphany_view_needs_runtime_store;
|
||||
use epiphany_codex_bridge::protocol_edge::default_core_epiphany_view_lenses;
|
||||
use epiphany_codex_bridge::protocol_edge::protocol_context_params_to_core;
|
||||
use epiphany_codex_bridge::protocol_edge::protocol_distill_params_to_core;
|
||||
use epiphany_codex_bridge::protocol_edge::protocol_graph_query_to_core;
|
||||
use epiphany_codex_bridge::protocol_edge::protocol_view_lenses_to_core;
|
||||
use epiphany_codex_bridge::results::map_core_role_result_role_id;
|
||||
use epiphany_codex_bridge::retrieve::epiphany_retrieval_state_for_paths;
|
||||
use epiphany_codex_bridge::retrieve::map_epiphany_retrieve_response;
|
||||
|
|
@ -20,7 +29,6 @@ use epiphany_codex_bridge::view::EpiphanyReorientResultResponseInput;
|
|||
use epiphany_codex_bridge::view::EpiphanyRoleResultResponseInput;
|
||||
use epiphany_codex_bridge::view::EpiphanyViewResponseInput;
|
||||
use epiphany_codex_bridge::view::derive_epiphany_freshness_surface;
|
||||
use epiphany_codex_bridge::view::map_core_epiphany_view_lenses;
|
||||
use epiphany_codex_bridge::view::map_epiphany_context_response;
|
||||
use epiphany_codex_bridge::view::map_epiphany_distill_response;
|
||||
use epiphany_codex_bridge::view::map_epiphany_graph_query_response;
|
||||
|
|
@ -28,16 +36,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::EpiphanyContextParams;
|
||||
use epiphany_core::EpiphanyDistillInput;
|
||||
use epiphany_core::EpiphanyGraphQuery;
|
||||
use epiphany_core::EpiphanyGraphQueryDirection;
|
||||
use epiphany_core::EpiphanyGraphQueryKind;
|
||||
use epiphany_core::default_epiphany_view_lenses;
|
||||
use epiphany_core::epiphany_view_needs_jobs;
|
||||
use epiphany_core::epiphany_view_needs_pressure;
|
||||
use epiphany_core::epiphany_view_needs_reorientation_inputs;
|
||||
use epiphany_core::epiphany_view_needs_runtime_store;
|
||||
|
||||
use super::CodexMessageProcessor;
|
||||
use super::ConnectionRequestId;
|
||||
|
|
@ -53,9 +51,9 @@ impl CodexMessageProcessor {
|
|||
) {
|
||||
let ThreadEpiphanyViewParams { thread_id, lenses } = params;
|
||||
let lenses = if lenses.is_empty() {
|
||||
default_epiphany_view_lenses()
|
||||
default_core_epiphany_view_lenses()
|
||||
} else {
|
||||
map_core_epiphany_view_lenses(lenses)
|
||||
protocol_view_lenses_to_core(lenses)
|
||||
};
|
||||
|
||||
let thread_uuid = match ThreadId::from_string(&thread_id) {
|
||||
|
|
@ -81,9 +79,9 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let needs_jobs = epiphany_view_needs_jobs(&lenses);
|
||||
let needs_reorientation_inputs = epiphany_view_needs_reorientation_inputs(&lenses);
|
||||
let needs_pressure = epiphany_view_needs_pressure(&lenses);
|
||||
let needs_jobs = core_epiphany_view_needs_jobs(&lenses);
|
||||
let needs_reorientation_inputs = core_epiphany_view_needs_reorientation_inputs(&lenses);
|
||||
let needs_pressure = core_epiphany_view_needs_pressure(&lenses);
|
||||
let retrieval_override = if (needs_jobs || needs_reorientation_inputs)
|
||||
&& thread
|
||||
.epiphany_state
|
||||
|
|
@ -128,7 +126,7 @@ impl CodexMessageProcessor {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let runtime_store_path = if epiphany_view_needs_runtime_store(&lenses) {
|
||||
let runtime_store_path = if core_epiphany_view_needs_runtime_store(&lenses) {
|
||||
if let Some(loaded_thread) = loaded_thread.as_ref() {
|
||||
Some(loaded_thread.epiphany_runtime_spine_store_path().await)
|
||||
} else {
|
||||
|
|
@ -315,7 +313,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let core_params = thread_epiphany_context_params_to_core(¶ms);
|
||||
let core_params = protocol_context_params_to_core(¶ms);
|
||||
let response = map_epiphany_context_response(
|
||||
thread_id,
|
||||
loaded,
|
||||
|
|
@ -353,7 +351,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let core_query = thread_epiphany_graph_query_to_core(¶ms.query);
|
||||
let core_query = protocol_graph_query_to_core(¶ms.query);
|
||||
let response = map_epiphany_graph_query_response(
|
||||
thread_id,
|
||||
loaded,
|
||||
|
|
@ -514,7 +512,7 @@ impl CodexMessageProcessor {
|
|||
.await
|
||||
.map(|state| state.revision)
|
||||
.unwrap_or(0);
|
||||
let input = thread_epiphany_distill_params_to_core(params);
|
||||
let input = protocol_distill_params_to_core(params);
|
||||
let response = match map_epiphany_distill_response(expected_revision, input) {
|
||||
Ok(response) => response,
|
||||
Err(err) => {
|
||||
|
|
@ -586,80 +584,6 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_context_params_to_core(
|
||||
params: &ThreadEpiphanyContextParams,
|
||||
) -> EpiphanyContextParams {
|
||||
EpiphanyContextParams {
|
||||
graph_node_ids: params.graph_node_ids.clone(),
|
||||
graph_edge_ids: params.graph_edge_ids.clone(),
|
||||
observation_ids: params.observation_ids.clone(),
|
||||
evidence_ids: params.evidence_ids.clone(),
|
||||
include_active_frontier: params.include_active_frontier,
|
||||
include_linked_evidence: params.include_linked_evidence,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_distill_params_to_core(
|
||||
params: ThreadEpiphanyDistillParams,
|
||||
) -> EpiphanyDistillInput {
|
||||
let ThreadEpiphanyDistillParams {
|
||||
source_kind,
|
||||
status,
|
||||
text,
|
||||
subject,
|
||||
evidence_kind,
|
||||
code_refs,
|
||||
..
|
||||
} = params;
|
||||
EpiphanyDistillInput {
|
||||
source_kind,
|
||||
status,
|
||||
text,
|
||||
subject,
|
||||
evidence_kind,
|
||||
code_refs,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_graph_query_to_core(query: &ThreadEpiphanyGraphQuery) -> EpiphanyGraphQuery {
|
||||
EpiphanyGraphQuery {
|
||||
kind: thread_epiphany_graph_query_kind_to_core(query.kind),
|
||||
node_ids: query.node_ids.clone(),
|
||||
edge_ids: query.edge_ids.clone(),
|
||||
paths: query.paths.clone(),
|
||||
symbols: query.symbols.clone(),
|
||||
edge_kinds: query.edge_kinds.clone(),
|
||||
direction: query
|
||||
.direction
|
||||
.map(thread_epiphany_graph_query_direction_to_core),
|
||||
depth: query.depth,
|
||||
include_links: query.include_links,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_graph_query_kind_to_core(
|
||||
kind: ThreadEpiphanyGraphQueryKind,
|
||||
) -> EpiphanyGraphQueryKind {
|
||||
match kind {
|
||||
ThreadEpiphanyGraphQueryKind::Node => EpiphanyGraphQueryKind::Node,
|
||||
ThreadEpiphanyGraphQueryKind::Path => EpiphanyGraphQueryKind::Path,
|
||||
ThreadEpiphanyGraphQueryKind::FrontierNeighborhood => {
|
||||
EpiphanyGraphQueryKind::FrontierNeighborhood
|
||||
}
|
||||
ThreadEpiphanyGraphQueryKind::Neighbors => EpiphanyGraphQueryKind::Neighbors,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_graph_query_direction_to_core(
|
||||
direction: ThreadEpiphanyGraphQueryDirection,
|
||||
) -> EpiphanyGraphQueryDirection {
|
||||
match direction {
|
||||
ThreadEpiphanyGraphQueryDirection::Incoming => EpiphanyGraphQueryDirection::Incoming,
|
||||
ThreadEpiphanyGraphQueryDirection::Outgoing => EpiphanyGraphQueryDirection::Outgoing,
|
||||
ThreadEpiphanyGraphQueryDirection::Both => EpiphanyGraphQueryDirection::Both,
|
||||
}
|
||||
}
|
||||
|
||||
fn thread_epiphany_freshness_response_from_surface(
|
||||
surface: EpiphanyFreshnessSurface,
|
||||
) -> ThreadEpiphanyFreshnessResponse {
|
||||
|
|
|
|||
Reference in a new issue