aKode: rimossi /app e i controlli dell'app Desktop

L'app Desktop di OpenAI non esiste per aKode: eliminati il comando /app
(variante, descrizione, dispatch, composer, evento OpenDesktopThread e
apertura codex:// / OpenAI.Codex), i controlli desktop di `akode doctor`
con i relativi test e snapshot. Le esclusioni antivirus indicate dal
doctor ora citano il binario akode invece della Codex app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andrea.difonzo
2026-11-11 14:56:17 +01:00
parent ac3f65985d
commit 25de1e70dc
24 changed files with 8 additions and 1643 deletions

View File

@@ -1556,9 +1556,6 @@ impl App {
AppEvent::OpenUrlInBrowser { url } => {
self.open_url_in_browser(url);
}
AppEvent::OpenDesktopThread { thread_id } => {
self.open_desktop_thread(thread_id);
}
AppEvent::PetSelected { pet_id } => {
self.handle_pet_selected(tui, pet_id);
}

View File

@@ -1,4 +1,4 @@
//! Terminal history, desktop handoff, and clear-screen UI helpers for the TUI app.
//! Terminal history and clear-screen UI helpers for the TUI app.
//!
//! This module owns rendering the fresh session header, clearing inline or alternate-screen UI
//! state, and resetting transcript-related app state after `/clear` or Ctrl-L. Owned-screen sessions
@@ -7,8 +7,6 @@
use super::*;
use crate::terminal_hyperlinks::HyperlinkLine;
const DESKTOP_THREAD_OPENED_MESSAGE: &str = "Opened this session in the Desktop app.";
/// Lines of the most recently committed history cell, kept so reflow and restore can be verified.
pub(super) struct RenderedHistoryTail {
#[cfg_attr(not(test), allow(dead_code))]
@@ -119,20 +117,6 @@ impl App {
}
}
pub(super) fn open_desktop_thread(&mut self, thread_id: ThreadId) {
let url = format!("codex://threads/{thread_id}");
if let Err(err) = open_desktop_thread_url(&url) {
self.chat_widget
.add_error_message(desktop_thread_open_error_message(&err));
return;
}
self.chat_widget.add_info_message(
DESKTOP_THREAD_OPENED_MESSAGE.to_string(),
/*hint*/ None,
);
}
pub(super) fn clear_ui_header_lines_with_version(
&self,
width: u16,
@@ -259,107 +243,6 @@ impl App {
}
}
fn desktop_thread_open_error_message(err: &str) -> String {
format!(
"Failed to open this session in the Desktop app: {err}. Install or launch the Desktop app and try again."
)
}
#[cfg(target_os = "macos")]
fn open_desktop_thread_url(url: &str) -> Result<(), String> {
let status = std::process::Command::new("open")
.arg(url)
.status()
.map_err(|err| format!("failed to invoke `open`: {err}"))?;
if status.success() {
Ok(())
} else {
Err(format!("`open {url}` exited with {status}"))
}
}
#[cfg(target_os = "windows")]
fn open_desktop_thread_url(url: &str) -> Result<(), String> {
let script = windows_desktop_app_launch_script(url);
let output = std::process::Command::new("powershell.exe")
.arg("-NoProfile")
.arg("-Command")
.arg(&script)
.output()
.map_err(|err| format!("failed to launch the Desktop app through PowerShell: {err}"))?;
if output.status.success() {
return Ok(());
}
let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();
if stderr.is_empty() {
Err(format!(
"failed to launch the Desktop app through PowerShell with {}",
output.status
))
} else {
Err(stderr)
}
}
#[cfg(target_os = "windows")]
fn windows_desktop_app_launch_script(url: &str) -> String {
let url = powershell_single_quoted_string(url);
format!(
r#"
$ErrorActionPreference = 'Stop'
$url = {url}
$package = Get-AppxPackage -Name OpenAI.Codex -ErrorAction SilentlyContinue
if ($null -eq $package) {{
Write-Error 'Desktop app package is not installed'
exit 1
}}
$manifest = Get-AppxPackageManifest -Package $package.PackageFullName
$application = $manifest.Package.Applications.Application |
Where-Object {{
@($_.Extensions.Extension) | Where-Object {{
$_.Category -eq 'windows.protocol' -and $_.Protocol.Name -eq 'codex'
}}
}} |
Select-Object -First 1
if ($null -eq $application -or [string]::IsNullOrWhiteSpace($application.Executable)) {{
Write-Error 'Desktop app package does not declare a codex protocol executable'
exit 1
}}
# Launch the package-declared protocol executable rather than an internal Electron shim.
# Windows can deny direct starts of internal executables under WindowsApps.
$exe = Join-Path $package.InstallLocation $application.Executable
$appDir = Split-Path -Parent $exe
$app = Join-Path $appDir 'resources\app.asar'
if (-not (Test-Path $exe)) {{
Write-Error "Desktop app executable not found at $exe"
exit 1
}}
if (-not (Test-Path $app)) {{
Write-Error "Desktop app bundle not found at $app"
exit 1
}}
Start-Process -FilePath $exe -WorkingDirectory $appDir -ArgumentList @('resources\app.asar', $url)
"#
)
}
#[cfg(target_os = "windows")]
fn powershell_single_quoted_string(value: &str) -> String {
format!("'{}'", value.replace('\'', "''"))
}
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
fn open_desktop_thread_url(_url: &str) -> Result<(), String> {
Err("The Desktop app is only available on macOS and Windows".to_string())
}
#[cfg(test)]
#[path = "history_ui_tests.rs"]
mod tests;

View File

@@ -1,38 +1,11 @@
//! Desktop handoff output and clear-screen history reset behavior.
//! Clear-screen history reset behavior.
use super::*;
use crate::app::tests::make_test_app_with_channels;
use crate::history_cell;
use crate::history_cell::HistoryCell;
use crate::history_cell::PlainHistoryCell;
use pretty_assertions::assert_eq;
#[test]
fn desktop_thread_opened_history_snapshot() {
let cell = history_cell::new_info_event(
DESKTOP_THREAD_OPENED_MESSAGE.to_string(),
/*hint*/ None,
);
insta::assert_snapshot!("desktop_thread_opened_history", render_cell(&cell));
}
#[test]
fn desktop_thread_open_error_history_snapshot() {
let cell = history_cell::new_error_event(desktop_thread_open_error_message("launch failed"));
insta::assert_snapshot!("desktop_thread_open_error_history", render_cell(&cell));
}
fn render_cell(cell: &impl HistoryCell) -> String {
let lines = cell.display_lines(/*width*/ 80);
lines
.iter()
.map(ToString::to_string)
.collect::<Vec<_>>()
.join("\n")
}
#[tokio::test]
async fn viewed_image_links_follow_workspace_locality() -> Result<()> {
let dir = tempfile::tempdir()?;

View File

@@ -1,5 +0,0 @@
---
source: tui/src/app/history_ui_tests.rs
expression: render_cell(&cell)
---
■ Failed to open this session in the Desktop app: launch failed. Install or launch the Desktop app and try again.

View File

@@ -1,5 +0,0 @@
---
source: tui/src/app/history_ui_tests.rs
expression: render_cell(&cell)
---
• Opened this session in the Desktop app.

View File

@@ -847,11 +847,6 @@ pub(crate) enum AppEvent {
url: String,
},
/// Open the current thread in Codex Desktop.
OpenDesktopThread {
thread_id: ThreadId,
},
/// Persist a pet selection and reload the ambient pet.
PetSelected {
pet_id: String,

View File

@@ -526,7 +526,6 @@ fn parent_owned_command_is_allowed(command: SlashCommand, args: &str) -> bool {
| SlashCommand::New
| SlashCommand::Clear
| SlashCommand::Resume
| SlashCommand::App
| SlashCommand::Side
| SlashCommand::Btw
| SlashCommand::Agents

View File

@@ -510,25 +510,6 @@ mod tests {
);
}
#[cfg(any(target_os = "macos", target_os = "windows"))]
#[test]
fn app_command_popup_snapshot() {
let mut popup = CommandPopup::new(CommandPopupFlags::default(), Vec::new());
popup.on_composer_text_change("/app".to_string());
let width = 72;
let area = Rect::new(
/*x*/ 0,
/*y*/ 0,
width,
popup.calculate_required_height(width),
);
let mut buf = Buffer::empty(area);
popup.render_ref(area, &mut buf);
insta::assert_snapshot!("command_popup_app", format!("{buf:?}"));
}
#[cfg(any(target_os = "macos", target_os = "windows"))]
#[test]
fn voice_command_popup_snapshot() {

View File

@@ -1,21 +0,0 @@
---
source: tui/src/bottom_pane/command_popup.rs
expression: "format!(\"{buf:?}\")"
---
Buffer {
area: Rect { x: 0, y: 0, width: 72, height: 2 },
content: [
"› /app continue this session in the Desktop app ",
" /approve approve one retry of a recent auto-review denial ",
],
styles: [
x: 0, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD | REVERSED,
x: 12, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: REVERSED,
x: 52, y: 0, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD | REVERSED,
x: 0, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 3, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: BOLD,
x: 6, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
x: 12, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: DIM,
x: 60, y: 1, fg: Reset, bg: Reset, underline: Reset, modifier: NONE,
]
}

View File

@@ -293,16 +293,6 @@ impl ChatWidget {
SlashCommand::Worktree => {
self.show_managed_worktree_picker();
}
SlashCommand::App => {
let Some(thread_id) = self.thread_id else {
self.add_error_message(
"Session is still starting; try /app again in a moment.".to_string(),
);
return;
};
self.app_event_tx
.send(AppEvent::OpenDesktopThread { thread_id });
}
SlashCommand::Init => {
const INIT_PROMPT: &str = include_str!("../../assets/prompt_for_init_command.md");
// The transcript and prompt history show what was typed; the model gets the
@@ -1250,7 +1240,6 @@ impl ChatWidget {
| SlashCommand::Raw
| SlashCommand::Vim
| SlashCommand::Diff
| SlashCommand::App
| SlashCommand::Rename
| SlashCommand::Voice
| SlashCommand::Recap

View File

@@ -1,5 +0,0 @@
---
source: tui/src/chatwidget/tests/slash_commands.rs
expression: "lines_to_single_string(&cells[0])"
---
■ Session is still starting; try /app again in a moment.

View File

@@ -3072,36 +3072,6 @@ async fn slash_fork_with_name_requests_named_fork() {
);
}
#[tokio::test]
async fn slash_app_requests_desktop_handoff() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
let thread_id = ThreadId::new();
chat.thread_id = Some(thread_id);
chat.dispatch_command(SlashCommand::App);
assert_matches!(
rx.try_recv(),
Ok(AppEvent::OpenDesktopThread {
thread_id: actual_thread_id,
}) if actual_thread_id == thread_id
);
}
#[tokio::test]
async fn slash_app_without_thread_id_shows_starting_error() {
let (mut chat, mut rx, _op_rx) = make_chatwidget_manual(/*model_override*/ None).await;
chat.dispatch_command(SlashCommand::App);
let cells = drain_insert_history(&mut rx);
assert_eq!(cells.len(), 1, "expected app startup error");
assert_chatwidget_snapshot!(
"slash_app_without_thread_id_shows_starting_error",
lines_to_single_string(&cells[0])
);
}
#[tokio::test]
async fn slash_pwd_and_cwd_alias_display_current_working_directory_from_composer() {
let mut output = Vec::new();

View File

@@ -35,7 +35,6 @@ pub enum SlashCommand {
Resume,
Fork,
Worktree,
App,
Init,
Compact,
Config,
@@ -104,7 +103,6 @@ impl SlashCommand {
SlashCommand::Clear => "clear the terminal and start a new chat",
SlashCommand::Fork => "fork the current chat",
SlashCommand::Worktree => "start or continue a conversation in a new worktree",
SlashCommand::App => "continue this session in the Desktop app",
SlashCommand::Quit | SlashCommand::Exit => "exit aKode",
SlashCommand::Copy => "copy the last response or part of it",
SlashCommand::Export => "export the conversation as markdown",
@@ -282,7 +280,6 @@ impl SlashCommand {
| SlashCommand::DebugConfig
| SlashCommand::Ps
| SlashCommand::Stop
| SlashCommand::App
| SlashCommand::Goal
| SlashCommand::Voice
| SlashCommand::Mcp
@@ -309,7 +306,6 @@ impl SlashCommand {
fn is_visible(self) -> bool {
match self {
SlashCommand::Copy => !cfg!(target_os = "android"),
SlashCommand::App => cfg!(any(target_os = "macos", target_os = "windows")),
SlashCommand::Voice => true,
SlashCommand::Rollout | SlashCommand::TestApproval => cfg!(debug_assertions),
_ => true,
@@ -357,7 +353,6 @@ mod tests {
assert!(SlashCommand::Raw.available_during_task());
assert!(SlashCommand::Raw.available_in_side_conversation());
assert!(SlashCommand::Raw.supports_inline_args());
assert!(SlashCommand::App.available_during_task());
}
#[test]