CI / fmt (rustfmt --check) (push) Waiting to run
CI / clippy (ubuntu-latest) (push) Waiting to run
CI / clippy (windows-latest) (push) Waiting to run
CI / test (ubuntu-latest) (push) Waiting to run
CI / test (windows-latest) (push) Waiting to run
CI / build release (ubuntu-latest) (push) Waiting to run
CI / build release (windows-latest) (push) Waiting to run
CI / runtime smoke (ubuntu x64, xvfb) (push) Waiting to run
CI / runtime smoke (macos arm64, probe) (push) Skipped
CI / update-e2e (windows x64) (push) Waiting to run
GPU evidence / GPU 判据自测(不需 GPU;跳过 ≠ 已验证) (push) Waiting to run
GPU evidence / GPU 证据 — 探测可用产物与硬件适配器 (push) Waiting to run
Guards / core 零 UI 守门 (push) Waiting to run
Guards / presenter 零 UI 守门 (push) Waiting to run
Guards / design 零第三方依赖守门 (push) Waiting to run
Guards / unsafe 落点守门(集合必须恰好等于期望) (push) Waiting to run
Guards / 文件行数 ≤400 守门 (push) Waiting to run
Guards / 依赖许可与来源(cargo-deny) (push) Waiting to run
Release guard / 发布标记语义守门(push tag → 稳定版) (push) Waiting to run
Signing status(播报,不是门禁) / 判据自测(三行/退出码/变异重放/接线) (push) Waiting to run
Signing status(播报,不是门禁) / 签名就绪度(播报) (push) Waiting to run
Release / 选槽位(默认四个:Windows 两档 + Linux 两档) (push) Waiting to run
63 lines
2.0 KiB
Rust
63 lines
2.0 KiB
Rust
//! 端口装配:把 `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()).with_legacy(ctx.legacy_sessions_root()),
|
||
),
|
||
diagnose: Arc::new(
|
||
CoreDiagnose::new(ctx.sessions_root()).with_legacy(ctx.legacy_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
|
||
}
|