mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Removed remaining core events from tui_app_server (#14942)
This commit is contained in:
@@ -740,6 +740,7 @@ impl ChatComposer {
|
||||
/// composer rehydrates the entry immediately. This path intentionally routes through
|
||||
/// [`Self::apply_history_entry`] so cursor placement remains aligned with keyboard history
|
||||
/// recall semantics.
|
||||
#[cfg(test)]
|
||||
pub(crate) fn on_history_entry_response(
|
||||
&mut self,
|
||||
log_id: u64,
|
||||
|
||||
@@ -237,6 +237,7 @@ impl ChatComposerHistory {
|
||||
}
|
||||
|
||||
/// Integrate a GetHistoryEntryResponse event.
|
||||
#[cfg(test)]
|
||||
pub fn on_entry_response(
|
||||
&mut self,
|
||||
log_id: u64,
|
||||
|
||||
@@ -5,6 +5,8 @@ use std::path::PathBuf;
|
||||
use codex_app_server_protocol::McpElicitationEnumSchema;
|
||||
use codex_app_server_protocol::McpElicitationPrimitiveSchema;
|
||||
use codex_app_server_protocol::McpElicitationSingleSelectEnumSchema;
|
||||
use codex_app_server_protocol::McpServerElicitationRequest;
|
||||
use codex_app_server_protocol::McpServerElicitationRequestParams;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::approvals::ElicitationAction;
|
||||
use codex_protocol::approvals::ElicitationRequest;
|
||||
@@ -201,6 +203,36 @@ impl FooterTip {
|
||||
}
|
||||
|
||||
impl McpServerElicitationFormRequest {
|
||||
pub(crate) fn from_app_server_request(
|
||||
thread_id: ThreadId,
|
||||
request_id: McpRequestId,
|
||||
request: McpServerElicitationRequestParams,
|
||||
) -> Option<Self> {
|
||||
let McpServerElicitationRequestParams {
|
||||
server_name,
|
||||
request,
|
||||
..
|
||||
} = request;
|
||||
let McpServerElicitationRequest::Form {
|
||||
meta,
|
||||
message,
|
||||
requested_schema,
|
||||
} = request
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let requested_schema = serde_json::to_value(requested_schema).ok()?;
|
||||
Self::from_parts(
|
||||
thread_id,
|
||||
server_name,
|
||||
request_id,
|
||||
meta,
|
||||
message,
|
||||
requested_schema,
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn from_event(
|
||||
thread_id: ThreadId,
|
||||
request: ElicitationRequestEvent,
|
||||
@@ -214,6 +246,24 @@ impl McpServerElicitationFormRequest {
|
||||
return None;
|
||||
};
|
||||
|
||||
Self::from_parts(
|
||||
thread_id,
|
||||
request.server_name,
|
||||
request.id,
|
||||
meta,
|
||||
message,
|
||||
requested_schema,
|
||||
)
|
||||
}
|
||||
|
||||
fn from_parts(
|
||||
thread_id: ThreadId,
|
||||
server_name: String,
|
||||
request_id: McpRequestId,
|
||||
meta: Option<Value>,
|
||||
message: String,
|
||||
requested_schema: Value,
|
||||
) -> Option<Self> {
|
||||
let tool_suggestion = parse_tool_suggestion_request(meta.as_ref());
|
||||
let is_tool_approval = meta
|
||||
.as_ref()
|
||||
@@ -313,8 +363,8 @@ impl McpServerElicitationFormRequest {
|
||||
|
||||
Some(Self {
|
||||
thread_id,
|
||||
server_name: request.server_name,
|
||||
request_id: request.id,
|
||||
server_name,
|
||||
request_id,
|
||||
message,
|
||||
approval_display_params,
|
||||
response_mode,
|
||||
|
||||
@@ -1073,6 +1073,7 @@ impl BottomPane {
|
||||
|| self.composer.is_in_paste_burst()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn on_history_entry_response(
|
||||
&mut self,
|
||||
log_id: u64,
|
||||
|
||||
Reference in New Issue
Block a user