Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,44 @@ The interface reference is the Hub in the neighboring `thinker` repository:
`crates/ff-hub/hub-ui/src/modules/App.tsx` (agent order and divider) and
`packages/coreinfra-ui/src/hub-sidebar-footer.tsx` (account menu and theme controls).

### Overview and initial setup

**Обзор** is the default full-window page, above **Агенты** in the sidebar.
The three action cards use the live account and detection state:

- **Подключите свой аккаунт** becomes the selected hub and account identity after sign-in.
- **Установите агентов** becomes available after sign-in.
- **Настройте агентов** requires sign-in and at least one detected agent.

On first launch, navigation is hidden. «Пропустить быструю настройку» beside
«Начало работы» reveals it and remembers the choice across launches. Overview
remains accessible from the sidebar. Configuration reuses the regular agent form
and plan confirmation; multiple installed agents always show a selection first.
The final action launches the configured desktop app or CLI.

Connection options are ordered API access, subscription, then without CoreInfra.
Token selection is automatic: reuse the configured token if it belongs to the
selected Hub, otherwise reuse the oldest token named for the agent, or create one
on confirmation. A note shows its name instead of a selector. Claude Desktop's
subscription uses the existing Wizard proxy-token flow. «Завершить настройку»
opens the change plan and confirms it before the launch step.

Downloads run in the backend and preserve explicit pauses across dialog closes.
Installing requires a separate «Установить» confirmation; «Отмена» retains the
archive. Installed apps show their version and offer an update check. Completed
installs and checks close with «Готово».

Choosing a subscription offers to enable the system proxy if it is off.
Only «Включить» changes OS settings; cancel keeps the selected mode. The prompt
does not overwrite another proxy. Disable it in Settings → System proxy.

The [Wizard demo](https://coreinfra.ru/wizard) loads only after a click; its poster
is local. `coreinfra.ru/assets/wizard/` is allowed in both Tauri media CSPs.
Controls use Catalyst with 14 px text. Card surfaces stay neutral; drawings gain
color on hover/focus. The first account-card hover plays the marker animation
once per launch; newly unlocked steps circle only their buttons. Animations
respect Reduced Motion.

## License

Except where separately noted, CoreInfra Wizard's original source code is licensed under the [Mozilla Public License, v. 2.0](LICENSE). If a copy of the MPL was not distributed with this project, you can obtain one at <https://mozilla.org/MPL/2.0/>.
Expand Down
2 changes: 1 addition & 1 deletion crates/wizard-core/src/agents/desktop_install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod download;
mod running;

pub use download::{DownloadProgress, SavedDownload, download_release, saved_download};
pub use running::{open_first_install, running_apps};
pub use running::{open_existing, open_first_install, running_apps};

use super::TokenAgent;
#[cfg(target_os = "macos")]
Expand Down
73 changes: 54 additions & 19 deletions crates/wizard-core/src/agents/desktop_install/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
//! Wizard only asks applications to quit: an application that refuses or hangs keeps running,
//! and the installation then fails as if the user had not agreed to close it.

use super::Target;
#[cfg(target_os = "macos")]
use super::command_output;
use super::{DesktopApp, Target};
use crate::agents::{AgentDetection, detection};
#[cfg(target_os = "macos")]
use crate::platform::macos::{app_is_running, read_app_info, request_app_quit, running_app_paths};
#[cfg(target_os = "macos")]
use core::time::Duration;
use std::path::Path;
#[cfg(any(target_os = "macos", target_os = "linux"))]
use std::path::PathBuf;
#[cfg(target_os = "macos")]
Expand Down Expand Up @@ -168,7 +170,7 @@ impl Reopen {

#[cfg(target_os = "windows")]
if self.package && !windows::package_running(&target.app.spec().package) {
match windows::open_package(&target.app.spec().package) {
match windows::open_package(&target.app.spec().package, None) {
Ok(()) => log::info!("{} opened again after installation", target.app.product()),
Err(error) => report(target.app.product(), &error),
}
Expand Down Expand Up @@ -213,32 +215,54 @@ pub fn open_first_install(target: &Target) -> Option<String> {
}
}

/// Opens the installed application, or brings it to the front when it already runs.
/// Re-detects before launching: an installer target can name a future path or a different
/// application being replaced. Launch must use the same app that discovery showed in the UI.
/// Call from a Tokio blocking worker.
pub fn open_existing(app: DesktopApp, last_path: Option<&Path>) -> anyhow::Result<()> {
let agent = match app {
DesktopApp::Claude => detection::DesktopAgent::Claude,
DesktopApp::ChatGpt => detection::DesktopAgent::Codex,
};
match detection::detect_desktop(agent, last_path) {
AgentDetection::Found(info) => open_application(app, Some(&info.path)),
AgentDetection::NotFound => {
anyhow::bail!("Агент больше не найден. Вернитесь к выбору агента.")
}
AgentDetection::Error(error) => anyhow::bail!("Не удалось найти агента: {error}"),
}
}

/// Opens the just-installed application, or brings it to the front when it already runs.
fn open_installed(target: &Target) -> anyhow::Result<()> {
open_application(target.app, target.path.as_deref())
}

fn open_application(app: DesktopApp, path: Option<&Path>) -> anyhow::Result<()> {
#[cfg(target_os = "macos")]
let opened = {
let path = target
.path
.as_deref()
.ok_or_else(|| anyhow::anyhow!("не указан путь установки"))?;
let _ = app;
let path = path.ok_or_else(|| anyhow::anyhow!("не указан путь установки"))?;
command_output(
Command::new("/usr/bin/open").arg(path),
&format!("Не удалось открыть {}", path.display()),
)
.map(drop)
};
#[cfg(target_os = "windows")]
let opened = windows::open_package(&target.app.spec().package);
let opened = windows::open_package(&app.spec().package, path);
#[cfg(target_os = "linux")]
let opened = {
// Installation fails for ChatGPT here, so the launcher is always Claude's.
debug_assert_eq!(target.app, super::DesktopApp::Claude);
linux::open(std::path::Path::new(linux::LAUNCHER), &[])
let path = match path {
Some(path) => path,
None if app == DesktopApp::Claude => Path::new(linux::LAUNCHER),
None => anyhow::bail!("Не указан путь приложения"),
};
linux::open(path, &[])
};
#[cfg(not(any(target_os = "macos", target_os = "windows", target_os = "linux")))]
let opened = {
let _ = target;
Ok(())
let _ = (app, path);
anyhow::bail!("Запуск приложения на этой платформе не поддерживается")
};
opened
}
Expand Down Expand Up @@ -350,19 +374,30 @@ mod windows {
}

/// Starts the package's application as the user, like its Start menu entry.
pub(super) fn open_package(package: &WindowsPackage) -> Result<()> {
pub(super) fn open_package(
package: &WindowsPackage,
detected: Option<&std::path::Path>,
) -> Result<()> {
let script = r"
$ErrorActionPreference = 'Stop'
$package = $env:WIZARD_DESKTOP_PACKAGE | ConvertFrom-Json
$installed = @(Get-AppxPackage -Name $package.name | Where-Object { $_.Publisher -ceq $package.publisher })
if ($installed.Count -eq 0) { exit 2 }
$application = @((Get-AppxPackageManifest -Package $installed[0].PackageFullName).Package.Applications.Application)[0]
if ($null -eq $application) { exit 3 }
Start-Process -FilePath ('shell:AppsFolder\' + $installed[0].PackageFamilyName + '!' + $application.Id)
$names = @($package.name)
if ($package.path -and $package.name -eq 'Claude') { $names += 'AnthropicPBC.Claude' }
$installed = @(foreach ($name in $names) { Get-AppxPackage -Name $name | Where-Object { $_.Publisher -ceq $package.publisher } })
foreach ($candidate in ($installed | Sort-Object Version -Descending)) {
$applications = @((Get-AppxPackageManifest -Package $candidate.PackageFullName).Package.Applications.Application)
foreach ($application in $applications) {
if ($package.path -and (Join-Path $candidate.InstallLocation $application.Executable) -ine $package.path) { continue }
Start-Process -FilePath ('shell:AppsFolder\' + $candidate.PackageFamilyName + '!' + $application.Id)
exit 0
}
}
exit 2
";
let parameters = serde_json::json!({
"name": package.name,
"publisher": package.publisher,
"path": detected,
})
.to_string();
command_output(
Expand Down
Loading
Loading