feat(sys): compare install sources and review alternatives
Some checks failed
ci / test (push) Has been cancelled
Some checks failed
ci / test (push) Has been cancelled
This commit is contained in:
parent
41640d0f6b
commit
12f365e38f
13 changed files with 525 additions and 20 deletions
|
|
@ -5,6 +5,18 @@ this file is the curated, human-readable summary.
|
||||||
|
|
||||||
## Unreleased — Fast defaults with user-controlled source builds
|
## Unreleased — Fast defaults with user-controlled source builds
|
||||||
|
|
||||||
|
- **Cross-lane install comparison (2026-10-03).** A plain install request now
|
||||||
|
searches the configured Portage, Flatpak, Snap, AppImage, Nix and staged-ebuild
|
||||||
|
catalogues before the connected model recommends a source. A multiword name
|
||||||
|
gets a labelled broader search in lanes with no full-name match. The Assistant
|
||||||
|
shows each lane's results or failure state with the recommended plan, and a
|
||||||
|
user can select another package result to prepare a fresh, exact-ID and
|
||||||
|
exact-source approval plan. AppImage catalogue entries remain leads until an
|
||||||
|
artifact URL and SHA-256 are pinned. Source-constrained requests keep their
|
||||||
|
constraint. A disposable VM displayed all six lanes for `install chatgpt
|
||||||
|
desktop` and staged separate Snap and Nix alternatives; the plan was
|
||||||
|
cancelled without installing a package.
|
||||||
|
|
||||||
- **Natural install requests find reviewed overlays (2026-10-03).** The
|
- **Natural install requests find reviewed overlays (2026-10-03).** The
|
||||||
Assistant checks for an exact external Portage package when it prepares a
|
Assistant checks for an exact external Portage package when it prepares a
|
||||||
non-Portage plan or cannot prepare a local plan. A request such as “install
|
non-Portage plan or cannot prepare a local plan. A request such as “install
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,23 @@
|
||||||
Rolling note between work sessions. **Update this file before you finish**, then
|
Rolling note between work sessions. **Update this file before you finish**, then
|
||||||
commit it. It should be short and current; use `git log` for detail.
|
commit it. It should be short and current; use `git log` for detail.
|
||||||
|
|
||||||
|
- **Cross-lane install comparison (2026-10-03):** A plain install now performs
|
||||||
|
read-only searches across the configured package catalogues before asking
|
||||||
|
the model to recommend a candidate. The Assistant shows per-lane results,
|
||||||
|
failures and availability, and selecting another listed source stages a
|
||||||
|
separate exact-source review through the legacy planner. AppImage catalogue
|
||||||
|
links remain non-installable leads. `make check`, dynamic and static release
|
||||||
|
builds passed. In the disposable VM, `install chatgpt desktop` produced a Snap
|
||||||
|
recommendation and six-lane comparison; the broader search found 17 Nix
|
||||||
|
results. Reviewing Snap `chatgpt-desktop-client` and Nix `chatgpt` staged
|
||||||
|
distinct exact-source plans. The final plan was cancelled. No package or
|
||||||
|
repository was installed. VM preview used the user-local static `sys`
|
||||||
|
(SHA-256 `d9172c81098ba23b6d37a9480fdb25aecc8fb0c646191fd4be2f30a35ef68f59`)
|
||||||
|
and Assistant QML override. `sys.new` was renamed to `sys`; a subsequent
|
||||||
|
`sha256sum sys` in the VM matched that build hash. Privileged alternative
|
||||||
|
execution remains unverified.
|
||||||
|
|
||||||
|
|
||||||
- **Natural ChatGPT Desktop request (2026-10-03):** The user clarified that the
|
- **Natural ChatGPT Desktop request (2026-10-03):** The user clarified that the
|
||||||
bad result was the Assistant's AppImage fallback for “I want to install
|
bad result was the Assistant's AppImage fallback for “I want to install
|
||||||
chatgpt desktop,” not the Send button. The unavailable install path now looks
|
chatgpt desktop,” not the Send button. The unavailable install path now looks
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,22 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
|
||||||
|
|
||||||
## Matrix
|
## Matrix
|
||||||
|
|
||||||
|
Cross-lane Assistant install comparison (2026-10-03): unqualified installs
|
||||||
|
search every configured package catalogue before AI selection. The result
|
||||||
|
states are kept distinct, and the desktop card offers exact-source review of
|
||||||
|
other catalogue matches without running an install. AppImage catalogue leads
|
||||||
|
cannot be directly selected. **Implemented, unit tested, and visually verified
|
||||||
|
in the disposable VM.** The user-local static `sys` (SHA-256
|
||||||
|
`d9172c81098ba23b6d37a9480fdb25aecc8fb0c646191fd4be2f30a35ef68f59`)
|
||||||
|
and Assistant QML override returned a Snap recommendation for `install chatgpt
|
||||||
|
desktop` with six source lanes. The comparison showed 6 Flatpak, 10 Snap, 1
|
||||||
|
AppImage lead, and 17 Nix results after the labelled broader search; Portage
|
||||||
|
was empty. Selecting `chatgpt-desktop-client` from Snap and `chatgpt` from Nix
|
||||||
|
each staged a plan naming the exact selected source. The final plan was
|
||||||
|
cancelled; no package or repository was installed. Privileged execution of
|
||||||
|
these alternatives remains unverified.
|
||||||
|
|
||||||
|
|
||||||
Natural external package discovery (2026-10-03): the Assistant checks GPO for
|
Natural external package discovery (2026-10-03): the Assistant checks GPO for
|
||||||
an exact package-name match after a non-Portage plan or an unavailable install
|
an exact package-name match after a non-Portage plan or an unavailable install
|
||||||
and runs the same overlay review as an explicit GPO link. Reviewed repository
|
and runs the same overlay review as an explicit GPO link. Reviewed repository
|
||||||
|
|
|
||||||
13
docs/SYS.md
13
docs/SYS.md
|
|
@ -109,6 +109,19 @@ identify -> evidence -> AI investigation -> proposed selection
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Unqualified** installation consults the connected model. The model may
|
- **Unqualified** installation consults the connected model. The model may
|
||||||
|
first receive a read-only search across the configured Portage, Flatpak,
|
||||||
|
Snap, AppImage, Nix and staged-ebuild catalogues. Each source reports actual
|
||||||
|
matches, no matches, an unavailable backend, or a failed lookup; catalog
|
||||||
|
results are leads rather than verified artifacts. For a multiword name, an
|
||||||
|
empty lane also searches the first term and labels those broader results.
|
||||||
|
The model compares these
|
||||||
|
findings before recommending a source. The desktop Assistant shows the
|
||||||
|
source results alongside the recommended plan. Selecting a different result
|
||||||
|
re-resolves the exact displayed package ID and prepares a new source-specific
|
||||||
|
plan for approval; it never executes directly. A changed ID is refused.
|
||||||
|
AppImage catalog leads have no direct install button because acquisition
|
||||||
|
requires a pinned artifact URL and SHA-256. Source-constrained requests only
|
||||||
|
investigate the selected lane. The model may
|
||||||
request bounded, read-only evidence (`discover_candidates`,
|
request bounded, read-only evidence (`discover_candidates`,
|
||||||
`inspect_candidate`, `check_backend`, `inspect_installation`) and may ask one
|
`inspect_candidate`, `check_backend`, `inspect_installation`) and may ask one
|
||||||
bounded question about your intent. It returns a structured proposal naming a
|
bounded question about your intent. It returns a structured proposal naming a
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,11 @@ Rules: compare suitable options across lanes; do NOT choose a lane merely becaus
|
||||||
application is a desktop app (Flatpak/Snap) or a developer tool (Nix) — base the choice on \
|
application is a desktop app (Flatpak/Snap) or a developer tool (Nix) — base the choice on \
|
||||||
the machine facts, the user's requirement, permissions, confinement, integration, size, \
|
the machine facts, the user's requirement, permissions, confinement, integration, size, \
|
||||||
measured compile time and update behaviour. Never invent a candidate id, version, size, \
|
measured compile time and update behaviour. Never invent a candidate id, version, size, \
|
||||||
checksum, availability or compatibility: use only what discover_candidates returned. \
|
checksum, availability or compatibility: use only IDs returned by read-only discovery. \
|
||||||
|
The system may also supply a cross-lane catalogue before this conversation. Its IDs are \
|
||||||
|
read-only leads you may inspect, not verified install candidates. If inspection confirms an \
|
||||||
|
available candidate and the resolver accepts it, propose the best one with its tradeoffs; \
|
||||||
|
reserve unavailable for when no such candidate remains. \
|
||||||
Portage owns the kernel, drivers, systemd, the host graphics/audio stack and boot tooling. \
|
Portage owns the kernel, drivers, systemd, the host graphics/audio stack and boot tooling. \
|
||||||
Prefer an existing installation and the user's saved preference; never migrate or duplicate \
|
Prefer an existing installation and the user's saved preference; never migrate or duplicate \
|
||||||
silently. If the user asked for a specific backend, investigate only that lane and honour it. \
|
silently. If the user asked for a specific backend, investigate only that lane and honour it. \
|
||||||
|
|
@ -367,6 +371,27 @@ pub fn investigate_install(
|
||||||
session: &dyn InstallSession,
|
session: &dyn InstallSession,
|
||||||
validate: &dyn Fn(&InstallProposal) -> Result<(), String>,
|
validate: &dyn Fn(&InstallProposal) -> Result<(), String>,
|
||||||
limits: &Limits,
|
limits: &Limits,
|
||||||
|
) -> Result<InstallProposal, AiError> {
|
||||||
|
investigate_install_with_discovery(
|
||||||
|
provider, endpoint, model, facts, request, transport, session, validate, limits, false,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The caller has already supplied a read-only, cross-lane catalogue report
|
||||||
|
/// in `request`. Count it as candidate discovery when the model concludes that
|
||||||
|
/// no verified installation is available.
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub fn investigate_install_with_discovery(
|
||||||
|
provider: ProviderKind,
|
||||||
|
endpoint: &str,
|
||||||
|
model: &str,
|
||||||
|
facts: &SystemFacts,
|
||||||
|
request: &str,
|
||||||
|
transport: &dyn ModelTransport,
|
||||||
|
session: &dyn InstallSession,
|
||||||
|
validate: &dyn Fn(&InstallProposal) -> Result<(), String>,
|
||||||
|
limits: &Limits,
|
||||||
|
initial_discovery: bool,
|
||||||
) -> Result<InstallProposal, AiError> {
|
) -> Result<InstallProposal, AiError> {
|
||||||
if provider == ProviderKind::None {
|
if provider == ProviderKind::None {
|
||||||
return Err(AiError::ProviderUnavailable(
|
return Err(AiError::ProviderUnavailable(
|
||||||
|
|
@ -380,7 +405,7 @@ pub fn investigate_install(
|
||||||
let mut repeated: std::collections::BTreeMap<String, usize> = std::collections::BTreeMap::new();
|
let mut repeated: std::collections::BTreeMap<String, usize> = std::collections::BTreeMap::new();
|
||||||
let mut turns = 0usize;
|
let mut turns = 0usize;
|
||||||
let mut malformed_replies = 0usize;
|
let mut malformed_replies = 0usize;
|
||||||
let mut discovered_candidates = false;
|
let mut discovered_candidates = initial_discovery;
|
||||||
let mut inspected = std::collections::BTreeSet::new();
|
let mut inspected = std::collections::BTreeSet::new();
|
||||||
|
|
||||||
while turns < limits.max_turns {
|
while turns < limits.max_turns {
|
||||||
|
|
@ -800,6 +825,22 @@ mod tests {
|
||||||
.unwrap_err();
|
.unwrap_err();
|
||||||
assert!(early_error.to_string().contains("requires read-only"));
|
assert!(early_error.to_string().contains("requires read-only"));
|
||||||
|
|
||||||
|
let catalogued = crate::provider::ScriptedTransport::new(vec![chat_response(unavailable)]);
|
||||||
|
let catalogued_error = investigate_install_with_discovery(
|
||||||
|
ProviderKind::Local,
|
||||||
|
"http://127.0.0.1:11434/v1/chat/completions",
|
||||||
|
"m",
|
||||||
|
&facts(),
|
||||||
|
"install etcher; cross-lane catalogue: no verified candidates",
|
||||||
|
&catalogued,
|
||||||
|
&session,
|
||||||
|
&|_| panic!("no proposal may be validated"),
|
||||||
|
&Limits::default(),
|
||||||
|
true,
|
||||||
|
)
|
||||||
|
.unwrap_err();
|
||||||
|
assert!(matches!(catalogued_error, AiError::NoVerifiedCandidate(_)));
|
||||||
|
|
||||||
let investigated = crate::provider::ScriptedTransport::new(vec![
|
let investigated = crate::provider::ScriptedTransport::new(vec![
|
||||||
chat_response(
|
chat_response(
|
||||||
r#"{"version":2,"kind":"investigate","requests":[{"action":"discover_candidates","query":"etcher"}]}"#,
|
r#"{"version":2,"kind":"investigate","requests":[{"action":"discover_candidates","query":"etcher"}]}"#,
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ use phoebus_ai::install::{Evidence, InstallProposal, InstallSession};
|
||||||
use phoebus_ai::provider::{ModelTransport, ProviderKind, SystemFacts};
|
use phoebus_ai::provider::{ModelTransport, ProviderKind, SystemFacts};
|
||||||
use phoebus_ai::AiError;
|
use phoebus_ai::AiError;
|
||||||
use phoebus_core::action::SystemAction;
|
use phoebus_core::action::SystemAction;
|
||||||
|
use phoebus_core::catalog::CatalogReport;
|
||||||
use phoebus_core::effects::{EffectKind, EffectSource, PackageEffect, ResolvedPlan};
|
use phoebus_core::effects::{EffectKind, EffectSource, PackageEffect, ResolvedPlan};
|
||||||
use phoebus_core::selection::{Backend, Candidate, Need, PackageKind, Rejected};
|
use phoebus_core::selection::{Backend, Candidate, Need, PackageKind, Rejected};
|
||||||
|
|
||||||
|
|
@ -39,6 +40,8 @@ pub struct InstallRequest {
|
||||||
pub requirements: Vec<String>,
|
pub requirements: Vec<String>,
|
||||||
/// An explicit backend constraint (`--flatpak`, `--portage`, ...).
|
/// An explicit backend constraint (`--flatpak`, `--portage`, ...).
|
||||||
pub backend: Option<Backend>,
|
pub backend: Option<Backend>,
|
||||||
|
/// Read-only cross-lane search gathered by the caller for an unconstrained request.
|
||||||
|
pub catalog: Option<CatalogReport>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InstallRequest {
|
impl InstallRequest {
|
||||||
|
|
@ -51,6 +54,7 @@ impl InstallRequest {
|
||||||
requires_proprietary: false,
|
requires_proprietary: false,
|
||||||
requirements: Vec::new(),
|
requirements: Vec::new(),
|
||||||
backend: None,
|
backend: None,
|
||||||
|
catalog: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -802,7 +806,7 @@ pub fn resolve_with_ai(
|
||||||
appimage_discovery_guidance(exec, root, &request.application),
|
appimage_discovery_guidance(exec, root, &request.application),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let phrase = format!(
|
let mut phrase = format!(
|
||||||
"install {}{}{}",
|
"install {}{}{}",
|
||||||
request.application,
|
request.application,
|
||||||
if request.gui {
|
if request.gui {
|
||||||
|
|
@ -815,6 +819,51 @@ pub fn resolve_with_ai(
|
||||||
.map(|backend| format!("; only use the {} backend", backend.as_str()))
|
.map(|backend| format!("; only use the {} backend", backend.as_str()))
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
|
if request.backend.is_none() {
|
||||||
|
if let Some(report) = &request.catalog {
|
||||||
|
phrase.push_str("\nCross-lane catalogue search (read-only leads; inspect the exact candidate before proposing). Compare every lane's result and explain the recommended source and material tradeoffs:\n");
|
||||||
|
for source in &report.sources {
|
||||||
|
let state = if !source.supported {
|
||||||
|
"unavailable"
|
||||||
|
} else if !source.ok {
|
||||||
|
"failed"
|
||||||
|
} else if source.entries.is_empty() {
|
||||||
|
"no results"
|
||||||
|
} else {
|
||||||
|
"results"
|
||||||
|
};
|
||||||
|
phrase.push_str(&format!(
|
||||||
|
"{}: {} — {}\n",
|
||||||
|
source.backend.as_str(),
|
||||||
|
state,
|
||||||
|
source.note.chars().take(200).collect::<String>()
|
||||||
|
));
|
||||||
|
for entry in source.entries.iter().take(8) {
|
||||||
|
let description = entry.description.as_deref().unwrap_or("");
|
||||||
|
let description: String = description.chars().take(100).collect();
|
||||||
|
phrase.push_str(&format!(
|
||||||
|
" {} {} {}\n",
|
||||||
|
entry.id.chars().take(150).collect::<String>(),
|
||||||
|
entry
|
||||||
|
.version
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or("")
|
||||||
|
.chars()
|
||||||
|
.take(40)
|
||||||
|
.collect::<String>(),
|
||||||
|
description
|
||||||
|
));
|
||||||
|
}
|
||||||
|
if source.entries.len() > 8 {
|
||||||
|
phrase.push_str(&format!(
|
||||||
|
" ... {} more results\n",
|
||||||
|
source.entries.len() - 8
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
phrase.push_str("AppImage catalogue links are leads only and require a pinned artifact URL and SHA-256 before installation.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
// The validator both checks the proposal against real metadata and stashes
|
// The validator both checks the proposal against real metadata and stashes
|
||||||
// the resolved plan, so we do not resolve twice.
|
// the resolved plan, so we do not resolve twice.
|
||||||
let validated: std::cell::RefCell<Option<ResolvedInstall>> = std::cell::RefCell::new(None);
|
let validated: std::cell::RefCell<Option<ResolvedInstall>> = std::cell::RefCell::new(None);
|
||||||
|
|
@ -828,7 +877,7 @@ pub fn resolve_with_ai(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let outcome = phoebus_ai::install::investigate_install(
|
let outcome = phoebus_ai::install::investigate_install_with_discovery(
|
||||||
ai.provider,
|
ai.provider,
|
||||||
&ai.endpoint,
|
&ai.endpoint,
|
||||||
&ai.model,
|
&ai.model,
|
||||||
|
|
@ -838,6 +887,7 @@ pub fn resolve_with_ai(
|
||||||
session,
|
session,
|
||||||
&validator,
|
&validator,
|
||||||
&ai.limits,
|
&ai.limits,
|
||||||
|
request.backend.is_none() && request.catalog.is_some(),
|
||||||
)
|
)
|
||||||
.map_err(|error| match error {
|
.map_err(|error| match error {
|
||||||
AiError::NoVerifiedCandidate(_) => ExecError::operation(
|
AiError::NoVerifiedCandidate(_) => ExecError::operation(
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,33 @@ fn snap_target_usable(exec: &Exec, root: &Path) -> bool {
|
||||||
/// Cross-source package search. `filter` constrains the search to one lane.
|
/// Cross-source package search. `filter` constrains the search to one lane.
|
||||||
pub fn search(exec: &Exec, root: &Path, query: &str, filter: Option<Backend>) -> CatalogReport {
|
pub fn search(exec: &Exec, root: &Path, query: &str, filter: Option<Backend>) -> CatalogReport {
|
||||||
let mut report = CatalogReport::new(query);
|
let mut report = CatalogReport::new(query);
|
||||||
|
let broader = query
|
||||||
|
.split_whitespace()
|
||||||
|
.next()
|
||||||
|
.filter(|term| *term != query);
|
||||||
for lane in selected_lanes(filter) {
|
for lane in selected_lanes(filter) {
|
||||||
let source = match lane {
|
let mut source = search_lane(exec, root, query, lane);
|
||||||
|
if source.ok && source.entries.is_empty() {
|
||||||
|
if let Some(term) = broader {
|
||||||
|
let fallback = search_lane(exec, root, term, lane);
|
||||||
|
if fallback.ok && !fallback.entries.is_empty() {
|
||||||
|
source = fallback;
|
||||||
|
source.note = format!(
|
||||||
|
"{}; no full-name match, broadened search to `{term}`",
|
||||||
|
source.note
|
||||||
|
);
|
||||||
|
} else if !fallback.ok {
|
||||||
|
source.note.push_str("; broader search did not answer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
report.push(source);
|
||||||
|
}
|
||||||
|
report
|
||||||
|
}
|
||||||
|
|
||||||
|
fn search_lane(exec: &Exec, root: &Path, query: &str, lane: Backend) -> SourceReport {
|
||||||
|
match lane {
|
||||||
Backend::PortageSource | Backend::PortageBinary | Backend::PortageVendor => {
|
Backend::PortageSource | Backend::PortageBinary | Backend::PortageVendor => {
|
||||||
search_portage(exec, root, query, lane)
|
search_portage(exec, root, query, lane)
|
||||||
}
|
}
|
||||||
|
|
@ -127,10 +152,7 @@ pub fn search(exec: &Exec, root: &Path, query: &str, filter: Option<Backend>) ->
|
||||||
Backend::AppImage => search_appimage(exec, root, query, lane),
|
Backend::AppImage => search_appimage(exec, root, query, lane),
|
||||||
Backend::Nix => search_nix(exec, root, query, lane),
|
Backend::Nix => search_nix(exec, root, query, lane),
|
||||||
Backend::CustomEbuild => search_ebuild(root, query, lane),
|
Backend::CustomEbuild => search_ebuild(root, query, lane),
|
||||||
};
|
|
||||||
report.push(source);
|
|
||||||
}
|
}
|
||||||
report
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn search_portage(exec: &Exec, root: &Path, query: &str, backend: Backend) -> SourceReport {
|
fn search_portage(exec: &Exec, root: &Path, query: &str, backend: Backend) -> SourceReport {
|
||||||
|
|
@ -360,7 +382,7 @@ fn search_flatpak(exec: &Exec, root: &Path, query: &str, backend: Backend) -> So
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|cols| {
|
.filter_map(|cols| {
|
||||||
let id = cols.first()?.clone();
|
let id = cols.first()?.clone();
|
||||||
if id.is_empty() {
|
if !phoebus_core::action::valid_flatpak_app_id(&id) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let mut entry = CatalogEntry::new(backend, &id).installed(installed.contains(&id));
|
let mut entry = CatalogEntry::new(backend, &id).installed(installed.contains(&id));
|
||||||
|
|
@ -2757,6 +2779,51 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn flatpak_no_matches_message_is_not_a_catalog_entry() {
|
||||||
|
let runner = RecordingRunner::new();
|
||||||
|
runner.set_response("chroot", ok("No matches found\n"));
|
||||||
|
let exec = make_exec(runner);
|
||||||
|
let root = Path::new(&exec.root);
|
||||||
|
install_fake_tool(root, "flatpak");
|
||||||
|
let report = search(&exec, root, "missing-app", Some(Backend::Flatpak));
|
||||||
|
assert!(report.sources[0].ok);
|
||||||
|
assert!(report.sources[0].entries.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn multiword_search_broadens_an_empty_lane_and_labels_the_fallback() {
|
||||||
|
struct SearchFallbackRunner;
|
||||||
|
impl crate::command::ProcessRunner for SearchFallbackRunner {
|
||||||
|
fn execute(&self, spec: &CommandSpec) -> Result<CommandOutput> {
|
||||||
|
let output = if spec.args.last().map(String::as_str) == Some("chatgpt desktop") {
|
||||||
|
"No matches found\n"
|
||||||
|
} else if spec.args.last().map(String::as_str) == Some("chatgpt") {
|
||||||
|
"com.example.ChatGPT\t1.0\tChatGPT Desktop\n"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
};
|
||||||
|
Ok(ok(output))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let path = tempfile::tempdir().unwrap().keep();
|
||||||
|
let root = path.join("root");
|
||||||
|
install_fake_tool(&root, "flatpak");
|
||||||
|
let logger = Logger::open(path.join("l.log"), Redactor::new(), false);
|
||||||
|
let exec = Exec::new(
|
||||||
|
Box::new(SearchFallbackRunner),
|
||||||
|
logger,
|
||||||
|
false,
|
||||||
|
root.clone(),
|
||||||
|
path,
|
||||||
|
);
|
||||||
|
let report = search(&exec, &root, "chatgpt desktop", Some(Backend::Flatpak));
|
||||||
|
assert_eq!(report.sources[0].entries[0].id, "com.example.ChatGPT");
|
||||||
|
assert!(report.sources[0]
|
||||||
|
.note
|
||||||
|
.contains("broadened search to `chatgpt`"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn apply_updates_never_runs_host_snap_for_an_alternate_root() {
|
fn apply_updates_never_runs_host_snap_for_an_alternate_root() {
|
||||||
let runner = RecordingRunner::new();
|
let runner = RecordingRunner::new();
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ use phoebus_ai::install::{Evidence, InstallSession};
|
||||||
use phoebus_ai::provider::{ModelTransport, ProviderKind, SystemFacts};
|
use phoebus_ai::provider::{ModelTransport, ProviderKind, SystemFacts};
|
||||||
use phoebus_ai::AiError;
|
use phoebus_ai::AiError;
|
||||||
use phoebus_core::action::{parse_natural, OverlayReview, SystemAction};
|
use phoebus_core::action::{parse_natural, OverlayReview, SystemAction};
|
||||||
|
use phoebus_core::catalog::CatalogReport;
|
||||||
use phoebus_core::selection::Backend;
|
use phoebus_core::selection::Backend;
|
||||||
use phoebus_core::{AiBackend, InstallConfig, Preferences};
|
use phoebus_core::{AiBackend, InstallConfig, Preferences};
|
||||||
use phoebus_executor::chooser;
|
use phoebus_executor::chooser;
|
||||||
|
|
@ -274,6 +275,46 @@ fn plan_response(id: u64, kind: &str, plan: &PreparedPlan) -> BridgeResponse {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Keep the review bounded while preserving each lane's actual search state.
|
||||||
|
/// Catalogue hits are leads; selecting one resolves and checks it afresh.
|
||||||
|
fn catalog_sources_for_review(report: &CatalogReport) -> Value {
|
||||||
|
json!(report
|
||||||
|
.sources
|
||||||
|
.iter()
|
||||||
|
.map(|source| {
|
||||||
|
let mut entries = source.entries.clone();
|
||||||
|
let query = report.query.to_ascii_lowercase().replace(' ', "-");
|
||||||
|
entries.sort_by_key(|entry| {
|
||||||
|
let id = entry.id.to_ascii_lowercase();
|
||||||
|
let name = id.rsplit('/').next().unwrap_or(&id);
|
||||||
|
let name = name.rsplit('.').next().unwrap_or(name);
|
||||||
|
if name == query {
|
||||||
|
0
|
||||||
|
} else if name.starts_with(&query) {
|
||||||
|
1
|
||||||
|
} else {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
});
|
||||||
|
json!({
|
||||||
|
"backend": source.backend.as_str(),
|
||||||
|
"status": if !source.supported { "unavailable" }
|
||||||
|
else if !source.ok { "failed" }
|
||||||
|
else if source.entries.is_empty() { "empty" } else { "results" },
|
||||||
|
"note": source.note,
|
||||||
|
"total": source.entries.len(),
|
||||||
|
"entries": entries.into_iter().take(8).map(|entry| json!({
|
||||||
|
"id": entry.id,
|
||||||
|
"version": entry.version,
|
||||||
|
"description": entry.description,
|
||||||
|
"installed": entry.installed,
|
||||||
|
"selectable": source.backend != Backend::AppImage,
|
||||||
|
})).collect::<Vec<_>>(),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>())
|
||||||
|
}
|
||||||
|
|
||||||
fn general_response(exec: &Exec, root: &Path, id: u64, plan: &PreparedPlan) -> BridgeResponse {
|
fn general_response(exec: &Exec, root: &Path, id: u64, plan: &PreparedPlan) -> BridgeResponse {
|
||||||
if !plan.actions.iter().any(SystemAction::is_mutating) {
|
if !plan.actions.iter().any(SystemAction::is_mutating) {
|
||||||
let mut answer = plan.summary.clone();
|
let mut answer = plan.summary.clone();
|
||||||
|
|
@ -511,6 +552,28 @@ pub fn handle_request(
|
||||||
Err(e) => BridgeResponse::err(id, e.to_string()),
|
Err(e) => BridgeResponse::err(id, e.to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"select_catalog_source" => {
|
||||||
|
let Some(id_text) = req.application else {
|
||||||
|
return BridgeResponse::err(id, "missing selected package ID");
|
||||||
|
};
|
||||||
|
let Some(backend) = req.backend.as_deref().and_then(Backend::parse) else {
|
||||||
|
return BridgeResponse::err(id, "missing selected package source");
|
||||||
|
};
|
||||||
|
if backend == Backend::AppImage
|
||||||
|
|| !phoebus_core::action::valid_candidate_id(backend, &id_text)
|
||||||
|
{
|
||||||
|
return BridgeResponse::err(
|
||||||
|
id,
|
||||||
|
"the selected catalogue entry cannot be prepared as an install plan",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let mut install_req = InstallRequest::new(&id_text);
|
||||||
|
install_req.backend = Some(backend);
|
||||||
|
match service::plan_selected_install(plans, exec, root, &install_req) {
|
||||||
|
Ok(plan) => plan_response(id, "install", &plan),
|
||||||
|
Err(e) => BridgeResponse::err(id, e.to_string()),
|
||||||
|
}
|
||||||
|
}
|
||||||
"legacy_execute" => {
|
"legacy_execute" => {
|
||||||
let action = if let Some(val) = req.action {
|
let action = if let Some(val) = req.action {
|
||||||
match serde_json::from_value::<SystemAction>(val) {
|
match serde_json::from_value::<SystemAction>(val) {
|
||||||
|
|
@ -733,6 +796,11 @@ fn plan_and_respond_install(
|
||||||
}
|
}
|
||||||
let mut install_req = InstallRequest::new(app);
|
let mut install_req = InstallRequest::new(app);
|
||||||
install_req.backend = constrained_backend;
|
install_req.backend = constrained_backend;
|
||||||
|
if constrained_backend.is_none() {
|
||||||
|
let phase = exec.progress_phase("Searching every package lane");
|
||||||
|
install_req.catalog = Some(query::search(exec, root, app, None));
|
||||||
|
phase.complete();
|
||||||
|
}
|
||||||
let session = BridgeSession { exec, root };
|
let session = BridgeSession { exec, root };
|
||||||
|
|
||||||
let result = with_bridge_ai(exec, root, |ai, facts| {
|
let result = with_bridge_ai(exec, root, |ai, facts| {
|
||||||
|
|
@ -757,6 +825,15 @@ fn plan_and_respond_install(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
let mut response = plan_response(id, "install", &plan);
|
let mut response = plan_response(id, "install", &plan);
|
||||||
|
if let (Some(catalog), Some(result)) = (
|
||||||
|
install_req.catalog.as_ref(),
|
||||||
|
response.result.as_mut().and_then(Value::as_object_mut),
|
||||||
|
) {
|
||||||
|
result.insert(
|
||||||
|
"catalog_sources".into(),
|
||||||
|
catalog_sources_for_review(catalog),
|
||||||
|
);
|
||||||
|
}
|
||||||
if constrained_backend.is_none()
|
if constrained_backend.is_none()
|
||||||
&& plan
|
&& plan
|
||||||
.candidate
|
.candidate
|
||||||
|
|
@ -790,7 +867,18 @@ fn plan_and_respond_install(
|
||||||
Ok(Err(phoebus_executor::ExecError::Operation {
|
Ok(Err(phoebus_executor::ExecError::Operation {
|
||||||
stage, operation, ..
|
stage, operation, ..
|
||||||
})) if stage == "install" && operation == "plan unavailable" => {
|
})) if stage == "install" && operation == "plan unavailable" => {
|
||||||
unavailable_install_response(exec, root, id, app, constrained_backend)
|
let mut response =
|
||||||
|
unavailable_install_response(exec, root, id, app, constrained_backend);
|
||||||
|
if let (Some(catalog), Some(result)) = (
|
||||||
|
install_req.catalog.as_ref(),
|
||||||
|
response.result.as_mut().and_then(Value::as_object_mut),
|
||||||
|
) {
|
||||||
|
result.insert(
|
||||||
|
"catalog_sources".into(),
|
||||||
|
catalog_sources_for_review(catalog),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
response
|
||||||
}
|
}
|
||||||
Ok(Err(e)) => BridgeResponse::err(id, e.to_string()),
|
Ok(Err(e)) => BridgeResponse::err(id, e.to_string()),
|
||||||
Err(e) => BridgeResponse::err(id, e),
|
Err(e) => BridgeResponse::err(id, e),
|
||||||
|
|
@ -1084,7 +1172,7 @@ fn bridge_request_label(op: &str) -> Option<&'static str> {
|
||||||
match op {
|
match op {
|
||||||
"ask" => Some("Investigating your request"),
|
"ask" => Some("Investigating your request"),
|
||||||
"execute" | "legacy_execute" | "undo" => Some("Executing the reviewed action"),
|
"execute" | "legacy_execute" | "undo" => Some("Executing the reviewed action"),
|
||||||
"legacy_install" => Some("Checking the selected package"),
|
"legacy_install" | "select_catalog_source" => Some("Checking the selected package"),
|
||||||
"updates" => Some("Checking package updates"),
|
"updates" => Some("Checking package updates"),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
@ -1125,6 +1213,7 @@ fn write_protocol_line(lock: &Mutex<()>, line: &str) -> std::io::Result<()> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use phoebus_core::catalog::{CatalogEntry, SourceReport};
|
||||||
use phoebus_core::Redactor;
|
use phoebus_core::Redactor;
|
||||||
use phoebus_executor::command::RecordingRunner;
|
use phoebus_executor::command::RecordingRunner;
|
||||||
use phoebus_executor::Logger;
|
use phoebus_executor::Logger;
|
||||||
|
|
@ -1142,6 +1231,31 @@ mod tests {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cross_lane_review_keeps_failures_and_only_offers_resolvable_lanes() {
|
||||||
|
let mut report = CatalogReport::new("chatgpt desktop");
|
||||||
|
report.push(SourceReport::ok(
|
||||||
|
Backend::Snap,
|
||||||
|
"Snap Store search",
|
||||||
|
vec![
|
||||||
|
CatalogEntry::new(Backend::Snap, "unrelated-tool"),
|
||||||
|
CatalogEntry::new(Backend::Snap, "chatgpt-desktop"),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
report.push(SourceReport::failed(Backend::Nix, "registry unavailable"));
|
||||||
|
report.push(SourceReport::ok(
|
||||||
|
Backend::AppImage,
|
||||||
|
"unverified catalog leads",
|
||||||
|
vec![CatalogEntry::new(Backend::AppImage, "chatgpt-desktop")],
|
||||||
|
));
|
||||||
|
|
||||||
|
let review = catalog_sources_for_review(&report);
|
||||||
|
assert_eq!(review[0]["entries"][0]["id"], "chatgpt-desktop");
|
||||||
|
assert_eq!(review[0]["entries"][0]["selectable"], true);
|
||||||
|
assert_eq!(review[1]["status"], "failed");
|
||||||
|
assert_eq!(review[2]["entries"][0]["selectable"], false);
|
||||||
|
}
|
||||||
|
|
||||||
fn request(op: &str) -> BridgeRequest {
|
fn request(op: &str) -> BridgeRequest {
|
||||||
BridgeRequest {
|
BridgeRequest {
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,7 @@ pub mod validation;
|
||||||
pub use execution::{execute_plan, execute_plan_privileged};
|
pub use execution::{execute_plan, execute_plan_privileged};
|
||||||
pub use plan::{
|
pub use plan::{
|
||||||
build_removal_plan, format_recommendation, plan_general, plan_install, plan_legacy_install,
|
build_removal_plan, format_recommendation, plan_general, plan_install, plan_legacy_install,
|
||||||
plan_overlay, plan_removal, plan_removal_with_ai, select_removal_copy, PlanStore,
|
plan_overlay, plan_removal, plan_removal_with_ai, plan_selected_install, select_removal_copy,
|
||||||
|
PlanStore,
|
||||||
};
|
};
|
||||||
pub use validation::{compute_plan_digest, seal_plan, validate_prepared_plan};
|
pub use validation::{compute_plan_digest, seal_plan, validate_prepared_plan};
|
||||||
|
|
|
||||||
|
|
@ -381,7 +381,16 @@ pub fn plan_install(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let resolved = install::resolve_with_ai(exec, root, request, session, ai, facts)?;
|
let mut request = request.clone();
|
||||||
|
if request.backend.is_none() && request.catalog.is_none() {
|
||||||
|
request.catalog = Some(phoebus_executor::query::search(
|
||||||
|
exec,
|
||||||
|
root,
|
||||||
|
&request.application,
|
||||||
|
None,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
let resolved = install::resolve_with_ai(exec, root, &request, session, ai, facts)?;
|
||||||
build_install_plan(plans, root, resolved, PlanKind::Install)
|
build_install_plan(plans, root, resolved, PlanKind::Install)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -403,6 +412,29 @@ pub fn plan_legacy_install(
|
||||||
build_install_plan(plans, root, resolved, PlanKind::LegacyInstall)
|
build_install_plan(plans, root, resolved, PlanKind::LegacyInstall)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Prepare a user-selected catalogue entry. Friendly-name matching may find a
|
||||||
|
/// different package after a catalogue changes, so require the exact ID that
|
||||||
|
/// was displayed before exposing an approval plan.
|
||||||
|
pub fn plan_selected_install(
|
||||||
|
plans: &PlanStore,
|
||||||
|
exec: &Exec,
|
||||||
|
root: &Path,
|
||||||
|
request: &InstallRequest,
|
||||||
|
) -> Result<PreparedPlan> {
|
||||||
|
let resolved = install::resolve_explicit(exec, root, request)?;
|
||||||
|
if resolved.candidate.id != request.application {
|
||||||
|
return Err(ExecError::operation(
|
||||||
|
"service",
|
||||||
|
"select catalogue candidate",
|
||||||
|
format!(
|
||||||
|
"the selected package `{}` now resolves to `{}`; search again before approving",
|
||||||
|
request.application, resolved.candidate.id
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
build_install_plan(plans, root, resolved, PlanKind::LegacyInstall)
|
||||||
|
}
|
||||||
|
|
||||||
fn build_install_plan(
|
fn build_install_plan(
|
||||||
plans: &PlanStore,
|
plans: &PlanStore,
|
||||||
root: &Path,
|
root: &Path,
|
||||||
|
|
|
||||||
|
|
@ -568,6 +568,26 @@ fn install_fake_flatpak(root: &Path) {
|
||||||
std::fs::set_permissions(&flatpak, std::fs::Permissions::from_mode(0o755)).unwrap();
|
std::fs::set_permissions(&flatpak, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn selected_catalog_source_refuses_a_different_resolved_id() {
|
||||||
|
let root = tempdir().unwrap();
|
||||||
|
let exec = make_exec_with_runner(
|
||||||
|
root.path(),
|
||||||
|
Box::new(FlatpakRunner {
|
||||||
|
installed: std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
||||||
|
mark_on_install: false,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
install_fake_flatpak(root.path());
|
||||||
|
let store = PlanStore::with_dir(tempdir().unwrap().keep());
|
||||||
|
let mut request = InstallRequest::new("firefox");
|
||||||
|
request.backend = Some(Backend::Flatpak);
|
||||||
|
let error = plan_selected_install(&store, &exec, root.path(), &request).unwrap_err();
|
||||||
|
assert!(error
|
||||||
|
.to_string()
|
||||||
|
.contains("now resolves to `org.mozilla.firefox`"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn install_verification_failure_finishes_the_transaction_as_failed() {
|
fn install_verification_failure_finishes_the_transaction_as_failed() {
|
||||||
let root = tempdir().unwrap();
|
let root = tempdir().unwrap();
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,12 @@ Singleton {
|
||||||
call("execute", { plan_id: planId, digest: digest, yes: yes }, cb, onProgress);
|
call("execute", { plan_id: planId, digest: digest, yes: yes }, cb, onProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
function legacyInstall(application, backend, cb) {
|
function legacyInstall(application, backend, cb, onProgress) {
|
||||||
call("legacy_install", { application: application, backend: backend }, cb);
|
call("legacy_install", { application: application, backend: backend }, cb, onProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectCatalogSource(packageId, backend, cb, onProgress) {
|
||||||
|
call("select_catalog_source", { application: packageId, backend: backend }, cb, onProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
function legacyExecute(phrase, action, yes, cb) {
|
function legacyExecute(phrase, action, yes, cb) {
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,29 @@ ShellRoot {
|
||||||
}, progress => shell.recordActivity(index, progress));
|
}, progress => shell.recordActivity(index, progress));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function chooseCatalogSource(index, backend, packageId) {
|
||||||
|
if (shell.busy)
|
||||||
|
return;
|
||||||
|
const previous = shell.conversation[index] ? shell.conversation[index].data : null;
|
||||||
|
shell.busy = true;
|
||||||
|
shell.statusText = "Checking " + packageId + " from " + backend + "...";
|
||||||
|
AssistantBridge.selectCatalogSource(packageId, backend, reply => {
|
||||||
|
shell.busy = false;
|
||||||
|
if (!reply.ok) {
|
||||||
|
shell.statusText = "That source could not be prepared";
|
||||||
|
shell.updateMessage(index, { source_error: reply.error || "Source review failed" });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const result = reply.result || {};
|
||||||
|
result.user_selected_source = true;
|
||||||
|
result.catalog_sources = previous ? previous.catalog_sources : [];
|
||||||
|
result.external_overlay_options = previous ? previous.external_overlay_options : [];
|
||||||
|
result.external_overlay_atom = previous ? previous.external_overlay_atom : "";
|
||||||
|
shell.statusText = "Selected source ready for approval";
|
||||||
|
shell.finishMessage(index, result.recommendation || result.summary || "Review this source", result);
|
||||||
|
}, progress => shell.recordActivity(index, progress));
|
||||||
|
}
|
||||||
|
|
||||||
function cancelPlan(index) {
|
function cancelPlan(index) {
|
||||||
// Cancelling is purely local: nothing reaches the privileged broker.
|
// Cancelling is purely local: nothing reaches the privileged broker.
|
||||||
shell.updateMessage(index, { state: "cancelled" });
|
shell.updateMessage(index, { state: "cancelled" });
|
||||||
|
|
@ -675,6 +698,21 @@ ShellRoot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: !!(modelData.data && modelData.data.kind === "install"
|
||||||
|
&& modelData.data.chosen)
|
||||||
|
text: {
|
||||||
|
const d = modelData.data || {};
|
||||||
|
return (d.user_selected_source ? "Selected source: " : "Recommended source: ")
|
||||||
|
+ (d.source || d.backend || "unknown")
|
||||||
|
+ " • " + (d.chosen ? d.chosen.id : "");
|
||||||
|
}
|
||||||
|
color: Theme.accent
|
||||||
|
font.bold: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: !!(modelData.data && modelData.data.external_overlay_options
|
visible: !!(modelData.data && modelData.data.external_overlay_options
|
||||||
|
|
@ -684,6 +722,86 @@ ShellRoot {
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: catalogChoices
|
||||||
|
property bool expanded: false
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: !!(modelData.data && modelData.data.catalog_sources
|
||||||
|
&& modelData.data.catalog_sources.length > 0)
|
||||||
|
spacing: 5
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: "Package sources checked: "
|
||||||
|
+ (modelData.data ? modelData.data.catalog_sources.length : 0)
|
||||||
|
color: Theme.text
|
||||||
|
font.bold: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
PhoebusButton {
|
||||||
|
label: catalogChoices.expanded ? "Hide options" : "Compare options"
|
||||||
|
onClicked: catalogChoices.expanded = !catalogChoices.expanded
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Repeater {
|
||||||
|
model: catalogChoices.expanded && modelData.data
|
||||||
|
? (modelData.data.catalog_sources || []) : []
|
||||||
|
delegate: ColumnLayout {
|
||||||
|
id: catalogLane
|
||||||
|
required property var modelData
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 3
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: modelData.backend + " • " + (modelData.status === "results"
|
||||||
|
? modelData.total + " result(s)" : modelData.status)
|
||||||
|
color: Theme.text
|
||||||
|
font.bold: true
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: modelData.note || ""
|
||||||
|
color: Theme.muted
|
||||||
|
font.pixelSize: 11
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
Repeater {
|
||||||
|
model: modelData.entries || []
|
||||||
|
delegate: RowLayout {
|
||||||
|
required property var modelData
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: 6
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: modelData.id + (modelData.version ? " " + modelData.version : "")
|
||||||
|
+ (modelData.description ? " — " + modelData.description : "")
|
||||||
|
color: Theme.muted
|
||||||
|
font.pixelSize: 11
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
PhoebusButton {
|
||||||
|
visible: modelData.selectable
|
||||||
|
label: "Review"
|
||||||
|
actionEnabled: !shell.busy
|
||||||
|
onClicked: shell.chooseCatalogSource(messageCard.messageIndex,
|
||||||
|
catalogLane.modelData.backend, modelData.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: !!(modelData.data && modelData.data.source_error)
|
||||||
|
text: modelData.data ? (modelData.data.source_error || "") : ""
|
||||||
|
color: Theme.warning
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: !!(modelData.data && modelData.data.external_overlay_note)
|
visible: !!(modelData.data && modelData.data.external_overlay_note)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue