Files
Unlucky-Launcher/crates/cli/src/commands/agent/ports/mod.rs
T
AskaEth 8a8e5ca0c0
CI / runtime smoke (macos arm64, probe) (push) Skipped
CI / fmt (rustfmt --check) (push) Canceled after 0s
CI / clippy (ubuntu-latest) (push) Canceled after 0s
CI / clippy (windows-latest) (push) Canceled after 0s
CI / test (ubuntu-latest) (push) Canceled after 0s
CI / test (windows-latest) (push) Canceled after 0s
CI / build release (ubuntu-latest) (push) Canceled after 0s
CI / build release (windows-latest) (push) Canceled after 0s
CI / runtime smoke (ubuntu x64, xvfb) (push) Canceled after 0s
Guards / core 零 UI 守门 (push) Canceled after 0s
Guards / presenter 零 UI 守门 (push) Canceled after 0s
Guards / design 零第三方依赖守门 (push) Canceled after 0s
Guards / unsafe 落点守门(集合必须恰好一个文件) (push) Canceled after 0s
Guards / 文件行数 ≤400 守门 (push) Canceled after 0s
Guards / 依赖许可与来源(cargo-deny) (push) Canceled after 0s
Unlucky Launcher v0.2.0
首个 iced + Material 3 Expressive 版本的源码快照。
完整历史与日常提交在 dev 分支;main 只放阶段性快照。
2026-11-05 14:22:11 +08:00

59 lines
1.9 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! 端口装配:把 `unlucky-core` 的实现塞进 agent 的五个端口。
//!
//! 为什么这一层在 CLI 而不在 agent:agent 只知道 trait(`#!` 依赖倒置),
//! `crates/app` 是 GUI 的装配处,而 `ull agent serve` 是**headless 的另一个装配入口**。
//! 放这里让 CLI 自洽,也让 GUI 后续复用同一批适配器(把本目录上移到 app 是一次纯搬家)。
//!
//! 每个文件一个端口,与 `crates/agent/src/port*.rs` 一一对应,读起来不用跳来跳去。
pub mod accounts;
pub mod diagnose;
pub mod events;
pub mod game;
pub mod session;
pub mod setting;
use std::sync::Arc;
use unlucky_agent::port::Ports;
use unlucky_core::platform::data_dir::DataMode;
use unlucky_core::platform::paths::Platform;
use crate::context::Ctx;
pub use accounts::CoreAccounts;
pub use diagnose::CoreDiagnose;
pub use game::CoreGame;
pub use session::CoreSessions;
pub use setting::CoreSetting;
/// 按一次 CLI 上下文装配五个端口。
#[must_use]
pub fn build(ctx: &Ctx) -> Ports {
Ports {
// 数据根键(`core.*`)落便携目录那份,与 `Ctx::resolve` 同源——CLI `config set`
// 与 AI `set_config` 共用 `Ctx` 给出的两个落点(finding …-agent-settingport-core-ai)。
setting: Arc::new(CoreSetting::split(
ctx.launcher_config(),
ctx.portable_launcher_config(),
)),
sessions: Arc::new(CoreSessions::new(ctx.sessions_root())),
diagnose: Arc::new(CoreDiagnose::new(ctx.sessions_root())),
game: Arc::new(CoreGame::new(
ctx.layout(),
ctx.game(),
data_mode(ctx),
platform(ctx),
)),
accounts: Arc::new(CoreAccounts::new(ctx.auth_data())),
}
}
pub(crate) fn data_mode(ctx: &Ctx) -> DataMode {
ctx.data.mode
}
pub(crate) fn platform(ctx: &Ctx) -> Platform {
ctx.platform
}