feat(sys): search AppImage community catalog
Some checks are pending
ci / test (push) Waiting to run
Some checks are pending
ci / test (push) Waiting to run
This commit is contained in:
parent
a05eae850d
commit
71dd1f6c5d
11 changed files with 535 additions and 26 deletions
|
|
@ -5,6 +5,20 @@ this file is the curated, human-readable summary.
|
||||||
|
|
||||||
## Unreleased — Fast defaults with user-controlled source builds
|
## Unreleased — Fast defaults with user-controlled source builds
|
||||||
|
|
||||||
|
- **AppImage catalog search (2026-10-03).** `sys search <term> --legacy
|
||||||
|
--appimage` now combines managed images with matching leads from the
|
||||||
|
AppImage project's community feed. Results include readable descriptions
|
||||||
|
and HTTPS catalog pages, and are visibly labeled `catalog lead`. This is
|
||||||
|
discovery only: AppImage acquisition still requires a reviewed artifact URL
|
||||||
|
and SHA-256. Offline catalog failures are reported rather than called empty.
|
||||||
|
Host and running-VM Firefox searches returned seven leads; a VM search for
|
||||||
|
`balenaEtcher` found the catalog's `Etcher` listing. Explicit AppImage
|
||||||
|
install requests now show those leads and the pinning requirement instead
|
||||||
|
of entering an impossible install plan loop. Oversized model investigations
|
||||||
|
get a bounded correction, and requested backend constraints reach the model.
|
||||||
|
No image was installed. Feed parsing, offline handling, command bounds,
|
||||||
|
bridge routing, and the Rust suite pass.
|
||||||
|
|
||||||
- **Assistant request feedback (2026-10-03).** The installed assistant now
|
- **Assistant request feedback (2026-10-03).** The installed assistant now
|
||||||
displays a working card and elapsed time immediately after a request, then
|
displays a working card and elapsed time immediately after a request, then
|
||||||
replaces that card with the result or error. An update check can no longer
|
replaces that card with the result or error. An update check can no longer
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,31 @@
|
||||||
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.
|
||||||
|
|
||||||
|
- **AppImage community search (2026-10-03):** The previous `sys search`
|
||||||
|
AppImage lane showed only Phoebus-managed files. It now also reads the
|
||||||
|
AppImage project's HTTPS community feed on the running system, ranks matching
|
||||||
|
names and descriptions, removes feed HTML from displayed descriptions, and
|
||||||
|
labels each remote result `catalog lead`. Search never converts such a lead
|
||||||
|
into an install candidate; `appimage_acquire` still requires a reviewed
|
||||||
|
artifact URL and SHA-256. Offline feed failure remains explicit. The user's
|
||||||
|
`balenaEtcher` query matches the feed's `Etcher` listing. Explicit AppImage
|
||||||
|
install requests now return catalog information and the pinning requirement
|
||||||
|
without invoking the model to draft an impossible plan; the exact assistant
|
||||||
|
phrase has a bridge regression test. Other install requests pass the selected
|
||||||
|
backend to the model, and an over-six investigation batch gets a correction
|
||||||
|
instead of an immediate error. In the running VM, `sys search firefox
|
||||||
|
--legacy --appimage` returned seven leads in 0.9 s and `sys search
|
||||||
|
balenaEtcher --legacy --appimage` found `Etcher`; screenshots:
|
||||||
|
`/var/tmp/phoebus-vm/appimage-search-vm.png` and
|
||||||
|
`/var/tmp/phoebus-vm/appimage-etcher-vm.png`. A terminal AppImage install
|
||||||
|
request displayed the lead and pinned-acquisition guidance without making a
|
||||||
|
plan (`/var/tmp/phoebus-vm/appimage-install-guidance.png`). The assistant
|
||||||
|
window was restarted and reconnected to the user-local bridge. The final
|
||||||
|
`~/.local/bin/sys` SHA-256 is
|
||||||
|
`420de1fd4698657c1f6740eb4c6fe54bb54908014b2e408e8bd1dfe3ce3b740f`;
|
||||||
|
its root-owned `/usr/local/bin/sys` remains older. No AppImage was installed.
|
||||||
|
A fresh ISO and root binary update still await the VM disk-space gate.
|
||||||
|
|
||||||
- **Assistant request delay (2026-10-03):** In the running encrypted VM, the
|
- **Assistant request delay (2026-10-03):** In the running encrypted VM, the
|
||||||
assistant accepted "i want to install chatgpt desktop" at 12:34 and did not
|
assistant accepted "i want to install chatgpt desktop" at 12:34 and did not
|
||||||
show a response until about 12:41. The old phrase parser sent it to general
|
show a response until about 12:41. The old phrase parser sent it to general
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,26 @@ disposable VM; `serial-driver.py recovery` now automates the same check.
|
||||||
|
|
||||||
## Matrix
|
## Matrix
|
||||||
|
|
||||||
|
AppImage catalog discovery (2026-10-03): `sys search <term> --legacy
|
||||||
|
--appimage` searches managed images and the AppImage community feed on the
|
||||||
|
running system. Remote matches are `catalog lead` entries with a catalog page
|
||||||
|
and cannot become install candidates without an independently pinned artifact
|
||||||
|
URL and SHA-256. The feed parser, offline failure, bounded curl call, and
|
||||||
|
rendering have unit tests. An explicit AppImage install request now returns
|
||||||
|
catalog information and the pinning requirement, with no model plan or
|
||||||
|
installation; the bridge path is unit-tested for the user's exact
|
||||||
|
`balenaEtcher with appimage` phrase. The model receives any explicit backend
|
||||||
|
constraint, and oversized investigation batches get a bounded correction.
|
||||||
|
The release/static binaries were built, and the running VM's user-local `sys`
|
||||||
|
displayed seven Firefox leads in 0.9 seconds
|
||||||
|
(`/var/tmp/phoebus-vm/appimage-search-vm.png`), then matched `balenaEtcher`
|
||||||
|
to `Etcher` (`/var/tmp/phoebus-vm/appimage-etcher-vm.png`). A VM terminal
|
||||||
|
install request returned catalog guidance without an install plan
|
||||||
|
(`/var/tmp/phoebus-vm/appimage-install-guidance.png`). The assistant window
|
||||||
|
was restarted and reconnected to the updated user-local bridge. The
|
||||||
|
root-owned `/usr/local/bin/sys` remains older until a fresh install; no
|
||||||
|
AppImage was installed.
|
||||||
|
|
||||||
Assistant request feedback (2026-10-03): a connected assistant in the
|
Assistant request feedback (2026-10-03): a connected assistant in the
|
||||||
disposable VM accepted "i want to install chatgpt desktop" at 12:34 and
|
disposable VM accepted "i want to install chatgpt desktop" at 12:34 and
|
||||||
returned a reviewed plan at about 12:41, without installing. During the wait
|
returned a reviewed plan at about 12:41, without installing. During the wait
|
||||||
|
|
@ -308,7 +328,7 @@ A fresh install with these defaults is not yet verified.
|
||||||
| `sys` consistent target-root execution | yes | yes | no | no |
|
| `sys` consistent target-root execution | yes | yes | no | no |
|
||||||
| `sys` validation at the execution boundary | yes | yes | no | n/a |
|
| `sys` validation at the execution boundary | yes | yes | no | n/a |
|
||||||
| `sys ask` truthful failure (nonzero, stop, record) | yes | yes | no | n/a |
|
| `sys ask` truthful failure (nonzero, stop, record) | yes | yes | no | n/a |
|
||||||
| Unified package search (`sys search`, all lanes, `--legacy`) | yes | yes (cross-lane; unavailable/failed/empty distinguished; source filter) | yes (`serial-boot-20261001T171419Z-1f7973dd`: all six source selectors and unified search) | no |
|
| Unified package search (`sys search`, all lanes, `--legacy`) | yes | yes (cross-lane; unavailable/failed/empty distinguished; source filter; AppImage catalog leads) | yes (`serial-boot-20261001T171419Z-1f7973dd`: all six selectors; 2026-10-03 running VM: AppImage feed returned seven Firefox leads) | no |
|
||||||
| Installed-package inventory (`sys list`, all lanes, `--legacy`) | yes | yes (VDB/Flatpak/Snap/AppImage; **Nix active-profile packages** vs generations/store; custom ebuild never double-counted) | yes (VM read-only group) | no |
|
| Installed-package inventory (`sys list`, all lanes, `--legacy`) | yes | yes (VDB/Flatpak/Snap/AppImage; **Nix active-profile packages** vs generations/store; custom ebuild never double-counted) | yes (VM read-only group) | no |
|
||||||
| Package information (`sys info`, `--legacy`) | yes | yes (installed/available, version/deps/size/provenance; ambiguity flagged) | yes (VM read-only group) | no |
|
| Package information (`sys info`, `--legacy`) | yes | yes (installed/available, version/deps/size/provenance; ambiguity flagged) | yes (VM read-only group) | no |
|
||||||
| Cross-source update check/apply (`sys updates`, `apply updates`) | yes | yes (exact per-source transactions with full Flatpak commits/snap revisions, pinned and revalidated; manual/project-specific refused; unchecked and failed lanes never claim freshness) | 2026-10-01 six-lane `sys updates` matrix PASS=75 and manual AppImage/Nix/custom-ebuild honesty checks; earlier Flatpak reviewed pinned update and Portage update VM-verified; direct Snap refresh completed with no newer revision, exact Snap apply-updates transaction unit-tested only | no |
|
| Cross-source update check/apply (`sys updates`, `apply updates`) | yes | yes (exact per-source transactions with full Flatpak commits/snap revisions, pinned and revalidated; manual/project-specific refused; unchecked and failed lanes never claim freshness) | 2026-10-01 six-lane `sys updates` matrix PASS=75 and manual AppImage/Nix/custom-ebuild honesty checks; earlier Flatpak reviewed pinned update and Portage update VM-verified; direct Snap refresh completed with no newer revision, exact Snap apply-updates transaction unit-tested only | no |
|
||||||
|
|
|
||||||
21
docs/SYS.md
21
docs/SYS.md
|
|
@ -301,8 +301,14 @@ enters the connected model, which answers from **bounded, read-only evidence**
|
||||||
(search, inventory, information, update checks). A source flag
|
(search, inventory, information, update checks). A source flag
|
||||||
(`--portage`/`--flatpak`/`--nix`/`--snap`/`--appimage`/`--ebuild`) constrains the
|
(`--portage`/`--flatpak`/`--nix`/`--snap`/`--appimage`/`--ebuild`) constrains the
|
||||||
AI workflow: lane-selectable queries are rewritten to that lane and an action
|
AI workflow: lane-selectable queries are rewritten to that lane and an action
|
||||||
for any other lane is refused. It never bypasses the model. `--legacy` runs the
|
for any other lane is refused. `--legacy` runs the same typed action
|
||||||
same typed action deterministically with no model interaction.
|
deterministically with no model interaction.
|
||||||
|
|
||||||
|
Explicit AppImage **install** requests are a discovery-only exception: the
|
||||||
|
community catalog has no pinned artifact hash, so `sys` and the desktop
|
||||||
|
assistant show matching leads and the import/acquire requirements without
|
||||||
|
creating an install plan. A catalog match cannot be installed through
|
||||||
|
`sys install <name> --legacy --appimage` either.
|
||||||
|
|
||||||
Every result distinguishes three honest states per lane: **unavailable**
|
Every result distinguishes three honest states per lane: **unavailable**
|
||||||
(tooling absent), **failed** (the tool ran and did not answer), and **empty**
|
(tooling absent), **failed** (the tool ran and did not answer), and **empty**
|
||||||
|
|
@ -333,6 +339,7 @@ separate updater widget.
|
||||||
```sh
|
```sh
|
||||||
sys search firefox --legacy # every source
|
sys search firefox --legacy # every source
|
||||||
sys search firefox --legacy --flatpak # one source
|
sys search firefox --legacy --flatpak # one source
|
||||||
|
sys search firefox --legacy --appimage # managed images + community catalog leads
|
||||||
sys search chatgpt --legacy --overlays --portage # configured Portage + external GPO leads
|
sys search chatgpt --legacy --overlays --portage # configured Portage + external GPO leads
|
||||||
sys list --legacy # installed inventory, all lanes
|
sys list --legacy # installed inventory, all lanes
|
||||||
sys list vim --legacy --portage # inventory, source + text filter
|
sys list vim --legacy --portage # inventory, source + text filter
|
||||||
|
|
@ -355,6 +362,14 @@ lookup has an eight-second limit; a network failure leaves local results
|
||||||
available. `--overlays` is restricted to deterministic `search --legacy` and
|
available. `--overlays` is restricted to deterministic `search --legacy` and
|
||||||
cannot be combined with a non-Portage source flag.
|
cannot be combined with a non-Portage source flag.
|
||||||
|
|
||||||
|
AppImage searches include Phoebus-managed images and read-only leads from the
|
||||||
|
AppImage project's community catalog when online. Leads show a catalog page
|
||||||
|
when supplied, but the catalog does not provide a pinned artifact and hash.
|
||||||
|
They are labeled `catalog lead` and cannot be installed from a search result;
|
||||||
|
`appimage_acquire` still needs an independently reviewed HTTPS artifact URL and
|
||||||
|
SHA-256. An unavailable catalog is reported as a lookup failure, while managed
|
||||||
|
images remain visible. Alternate-root searches inspect only managed images.
|
||||||
|
|
||||||
During a terminal mutation, `sys` shows the package manager's output as it
|
During a terminal mutation, `sys` shows the package manager's output as it
|
||||||
arrives: Portage build and merge logs, Flatpak transaction progress, Snap
|
arrives: Portage build and merge logs, Flatpak transaction progress, Snap
|
||||||
operations, Nix realisation, custom ebuild builds, and AppImage downloads.
|
operations, Nix realisation, custom ebuild builds, and AppImage downloads.
|
||||||
|
|
@ -364,7 +379,7 @@ return a composed report; the broker and assistant protocols keep their
|
||||||
structured output.
|
structured output.
|
||||||
|
|
||||||
- **Search** covers Portage (`emerge --search`), Flatpak remote search, the Snap
|
- **Search** covers Portage (`emerge --search`), Flatpak remote search, the Snap
|
||||||
Store, Phoebus-managed AppImages, Nix (`nix search`, when online) and staged
|
Store, Phoebus-managed AppImages plus online community catalog leads, Nix (`nix search`, when online) and staged
|
||||||
custom ebuilds. Entries show source, identity, version, description and
|
custom ebuilds. Entries show source, identity, version, description and
|
||||||
installed status where the backend provides them.
|
installed status where the backend provides them.
|
||||||
- **Inventory** covers the Portage VDB, `flatpak list`, `snap list`,
|
- **Inventory** covers the Portage VDB, `flatpak list`, `snap list`,
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,9 @@ measured compile time and update behaviour. Never invent a candidate id, version
|
||||||
checksum, availability or compatibility: use only what discover_candidates returned. \
|
checksum, availability or compatibility: use only what discover_candidates returned. \
|
||||||
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, honour it. When you have enough \
|
silently. If the user asked for a specific backend, investigate only that lane and honour it. \
|
||||||
evidence, propose.";
|
AppImage catalog leads are discovery links and cannot be proposed as verified install candidates. \
|
||||||
|
Request at most six read-only actions per turn. When you have enough evidence, propose.";
|
||||||
|
|
||||||
/// Build the first request of the investigation.
|
/// Build the first request of the investigation.
|
||||||
pub fn build_open_request(
|
pub fn build_open_request(
|
||||||
|
|
@ -388,10 +389,21 @@ pub fn investigate_install(
|
||||||
return Err(AiError::Rejected("empty investigation request".into()));
|
return Err(AiError::Rejected("empty investigation request".into()));
|
||||||
}
|
}
|
||||||
if requests.len() > limits.max_requests_per_turn {
|
if requests.len() > limits.max_requests_per_turn {
|
||||||
return Err(AiError::Rejected(format!(
|
chat.messages.push(ChatMessage {
|
||||||
"too many investigation requests in one turn (max {})",
|
role: "assistant".into(),
|
||||||
|
content: content.clone(),
|
||||||
|
});
|
||||||
|
chat.messages.push(ChatMessage {
|
||||||
|
role: "user".into(),
|
||||||
|
content: format!(
|
||||||
|
"You requested {} read-only actions, but the limit is {} per turn. \
|
||||||
|
None were run. Request only the evidence needed for the user's \
|
||||||
|
chosen backend, within the limit.",
|
||||||
|
requests.len(),
|
||||||
limits.max_requests_per_turn
|
limits.max_requests_per_turn
|
||||||
)));
|
),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
for request in &requests {
|
for request in &requests {
|
||||||
if !is_investigation_action(request) {
|
if !is_investigation_action(request) {
|
||||||
|
|
@ -664,15 +676,21 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn too_many_requests_in_a_turn_are_refused() {
|
fn too_many_requests_get_a_correction_without_running_them() {
|
||||||
let transport = crate::provider::ScriptedTransport::new(vec![chat_response(
|
let transport = crate::provider::ScriptedTransport::new(vec![
|
||||||
|
chat_response(
|
||||||
r#"{"version":2,"kind":"investigate","requests":[{"action":"check_backend","backend":"flatpak"},{"action":"check_backend","backend":"nix"},{"action":"check_backend","backend":"snap"},{"action":"check_backend","backend":"appimage"},{"action":"check_backend","backend":"portage-source"},{"action":"check_backend","backend":"portage-binary"},{"action":"check_backend","backend":"custom-ebuild"}]}"#,
|
r#"{"version":2,"kind":"investigate","requests":[{"action":"check_backend","backend":"flatpak"},{"action":"check_backend","backend":"nix"},{"action":"check_backend","backend":"snap"},{"action":"check_backend","backend":"appimage"},{"action":"check_backend","backend":"portage-source"},{"action":"check_backend","backend":"portage-binary"},{"action":"check_backend","backend":"custom-ebuild"}]}"#,
|
||||||
)]);
|
),
|
||||||
|
chat_response(
|
||||||
|
r#"{"version":2,"kind":"investigate","requests":[{"action":"check_backend","backend":"appimage"}]}"#,
|
||||||
|
),
|
||||||
|
chat_response(ok_proposal()),
|
||||||
|
]);
|
||||||
let session = Sessions {
|
let session = Sessions {
|
||||||
evidence: std::cell::RefCell::new(Vec::new()),
|
evidence: std::cell::RefCell::new(Vec::new()),
|
||||||
answer: None,
|
answer: None,
|
||||||
};
|
};
|
||||||
let err = investigate_install(
|
let proposal = investigate_install(
|
||||||
ProviderKind::Local,
|
ProviderKind::Local,
|
||||||
"http://127.0.0.1:11434/v1/chat/completions",
|
"http://127.0.0.1:11434/v1/chat/completions",
|
||||||
"m",
|
"m",
|
||||||
|
|
@ -683,9 +701,11 @@ mod tests {
|
||||||
&|_| Ok(()),
|
&|_| Ok(()),
|
||||||
&Limits::default(),
|
&Limits::default(),
|
||||||
)
|
)
|
||||||
.unwrap_err();
|
.unwrap();
|
||||||
assert!(err.to_string().contains("too many"));
|
assert_eq!(proposal.candidate, "org.mozilla.firefox");
|
||||||
assert!(session.evidence.borrow().is_empty());
|
assert_eq!(session.evidence.borrow().len(), 1);
|
||||||
|
assert_eq!(session.evidence.borrow()[0].len(), 1);
|
||||||
|
assert!(transport.requests()[1].contains("None were run"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,10 @@ pub struct CatalogEntry {
|
||||||
/// separately and are not "installed packages".
|
/// separately and are not "installed packages".
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub scope: Option<String>,
|
pub scope: Option<String>,
|
||||||
|
/// Upstream information/download page, if the source provides one. A page
|
||||||
|
/// link is not a verified artifact URL or an installation candidate.
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CatalogEntry {
|
impl CatalogEntry {
|
||||||
|
|
@ -41,6 +45,7 @@ impl CatalogEntry {
|
||||||
description: None,
|
description: None,
|
||||||
installed: false,
|
installed: false,
|
||||||
scope: None,
|
scope: None,
|
||||||
|
url: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,6 +68,11 @@ impl CatalogEntry {
|
||||||
self.scope = Some(scope.into());
|
self.scope = Some(scope.into());
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn url(mut self, url: impl Into<String>) -> Self {
|
||||||
|
self.url = Some(url.into());
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The result for one lane.
|
/// The result for one lane.
|
||||||
|
|
@ -192,6 +202,9 @@ impl CatalogReport {
|
||||||
out.push_str(&format!(" — {description}"));
|
out.push_str(&format!(" — {description}"));
|
||||||
}
|
}
|
||||||
out.push('\n');
|
out.push('\n');
|
||||||
|
if let Some(url) = &entry.url {
|
||||||
|
out.push_str(&format!(" catalog page: {url}\n"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use phoebus_core::selection::{Backend, Candidate, Need, PackageKind, Rejected};
|
||||||
|
|
||||||
use crate::error::{ExecError, Result};
|
use crate::error::{ExecError, Result};
|
||||||
use crate::exec::Exec;
|
use crate::exec::Exec;
|
||||||
use crate::{actions, chooser};
|
use crate::{actions, chooser, query};
|
||||||
|
|
||||||
/// A caller-provided question/answer function (terminal prompt in `sys`).
|
/// A caller-provided question/answer function (terminal prompt in `sys`).
|
||||||
pub type AskFn<'a> = dyn Fn(&str) -> Option<String> + 'a;
|
pub type AskFn<'a> = dyn Fn(&str) -> Option<String> + 'a;
|
||||||
|
|
@ -674,6 +674,35 @@ pub struct AiInstall<'a> {
|
||||||
pub limits: phoebus_ai::install::Limits,
|
pub limits: phoebus_ai::install::Limits,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Catalog matches are discovery links, not verified AppImage artifacts. Give
|
||||||
|
/// an explicit, useful result for a requested AppImage lane instead of asking
|
||||||
|
/// the model to produce an install plan that cannot pass deterministic review.
|
||||||
|
pub fn appimage_discovery_guidance(exec: &Exec, root: &Path, application: &str) -> String {
|
||||||
|
let report = query::search(exec, root, application, Some(Backend::AppImage));
|
||||||
|
let source = &report.sources[0];
|
||||||
|
let mut answer = format!("AppImage search for {application}: ");
|
||||||
|
if !source.ok {
|
||||||
|
answer.push_str(&format!("{}.", source.note));
|
||||||
|
} else if source.entries.is_empty() {
|
||||||
|
answer.push_str("no catalog or managed image matches were found.");
|
||||||
|
} else {
|
||||||
|
answer.push_str(&format!("{} match(es).", source.entries.len()));
|
||||||
|
for entry in source.entries.iter().take(3) {
|
||||||
|
answer.push_str(&format!("\n• {}", entry.id));
|
||||||
|
if entry.installed {
|
||||||
|
answer.push_str(" (already managed)");
|
||||||
|
} else {
|
||||||
|
answer.push_str(" (catalog lead)");
|
||||||
|
}
|
||||||
|
if let Some(url) = &entry.url {
|
||||||
|
answer.push_str(&format!(" — {url}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
answer.push_str("\nThe catalog has no verified artifact hash, so it cannot create an install plan. To install an AppImage, import a file you obtained or provide a reviewed HTTPS artifact URL and SHA-256 for appimage_acquire. No image was installed.");
|
||||||
|
answer
|
||||||
|
}
|
||||||
|
|
||||||
/// Run the AI investigation and validate its proposal deterministically.
|
/// Run the AI investigation and validate its proposal deterministically.
|
||||||
pub fn resolve_with_ai(
|
pub fn resolve_with_ai(
|
||||||
exec: &Exec,
|
exec: &Exec,
|
||||||
|
|
@ -683,14 +712,25 @@ pub fn resolve_with_ai(
|
||||||
ai: &AiInstall<'_>,
|
ai: &AiInstall<'_>,
|
||||||
facts: &SystemFacts,
|
facts: &SystemFacts,
|
||||||
) -> Result<ResolvedInstall> {
|
) -> Result<ResolvedInstall> {
|
||||||
|
if request.backend == Some(Backend::AppImage) {
|
||||||
|
return Err(ExecError::operation(
|
||||||
|
"install",
|
||||||
|
"AppImage discovery",
|
||||||
|
appimage_discovery_guidance(exec, root, &request.application),
|
||||||
|
));
|
||||||
|
}
|
||||||
let phrase = format!(
|
let phrase = format!(
|
||||||
"install {}{}",
|
"install {}{}{}",
|
||||||
request.application,
|
request.application,
|
||||||
if request.gui {
|
if request.gui {
|
||||||
" (graphical application)"
|
" (graphical application)"
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
},
|
||||||
|
request
|
||||||
|
.backend
|
||||||
|
.map(|backend| format!("; only use the {} backend", backend.as_str()))
|
||||||
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
// 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.
|
||||||
|
|
@ -1099,6 +1139,33 @@ mod tests {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ai_install_request_names_the_explicit_backend() {
|
||||||
|
let version = std::sync::Arc::new(std::sync::atomic::AtomicU32::new(128));
|
||||||
|
let exec = arg_exec(version, false);
|
||||||
|
let root = Path::new(&exec.root);
|
||||||
|
let mut request = InstallRequest::new("firefox");
|
||||||
|
request.backend = Some(Backend::Flatpak);
|
||||||
|
let transport =
|
||||||
|
phoebus_ai::provider::ScriptedTransport::new(vec![proposal("org.mozilla.firefox")]);
|
||||||
|
resolve_with_ai(&exec, root, &request, &NoAsk, &ai(&transport), &facts()).unwrap();
|
||||||
|
assert!(transport.requests()[0].contains("only use the flatpak backend"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn explicit_appimage_request_returns_discovery_guidance_without_model_calls() {
|
||||||
|
let version = std::sync::Arc::new(std::sync::atomic::AtomicU32::new(128));
|
||||||
|
let exec = arg_exec(version, false);
|
||||||
|
let root = Path::new(&exec.root);
|
||||||
|
let mut request = InstallRequest::new("Etcher");
|
||||||
|
request.backend = Some(Backend::AppImage);
|
||||||
|
let transport = phoebus_ai::provider::ScriptedTransport::new(vec![]);
|
||||||
|
let err =
|
||||||
|
resolve_with_ai(&exec, root, &request, &NoAsk, &ai(&transport), &facts()).unwrap_err();
|
||||||
|
assert!(err.to_string().contains("no verified artifact hash"));
|
||||||
|
assert!(transport.requests().is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_fabricated_candidate_is_rejected_and_the_model_revises() {
|
fn a_fabricated_candidate_is_rejected_and_the_model_revises() {
|
||||||
let version = std::sync::Arc::new(std::sync::atomic::AtomicU32::new(128));
|
let version = std::sync::Arc::new(std::sync::atomic::AtomicU32::new(128));
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ pub fn search(exec: &Exec, root: &Path, query: &str, filter: Option<Backend>) ->
|
||||||
}
|
}
|
||||||
Backend::Flatpak => search_flatpak(exec, root, query, lane),
|
Backend::Flatpak => search_flatpak(exec, root, query, lane),
|
||||||
Backend::Snap => search_snap(exec, root, query, lane),
|
Backend::Snap => search_snap(exec, root, query, lane),
|
||||||
Backend::AppImage => search_appimage(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),
|
||||||
};
|
};
|
||||||
|
|
@ -416,9 +416,114 @@ fn search_snap(exec: &Exec, root: &Path, query: &str, backend: Backend) -> Sourc
|
||||||
SourceReport::ok(backend, "Snap Store search", entries)
|
SourceReport::ok(backend, "Snap Store search", entries)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn search_appimage(root: &Path, query: &str, backend: Backend) -> SourceReport {
|
const APPIMAGE_FEED_URL: &str = "https://appimage.github.io/feed.json";
|
||||||
|
const APPIMAGE_FEED_MAX_RESULTS: usize = 30;
|
||||||
|
|
||||||
|
fn appimage_description(raw: &str) -> String {
|
||||||
|
let mut plain = String::with_capacity(raw.len().min(512));
|
||||||
|
let mut in_tag = false;
|
||||||
|
for ch in raw.chars() {
|
||||||
|
match ch {
|
||||||
|
'<' => {
|
||||||
|
in_tag = true;
|
||||||
|
plain.push(' ');
|
||||||
|
}
|
||||||
|
'>' if in_tag => in_tag = false,
|
||||||
|
_ if !in_tag && !ch.is_control() => plain.push(ch),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plain
|
||||||
|
.replace("&", "&")
|
||||||
|
.replace("'", "'")
|
||||||
|
.replace("'", "'")
|
||||||
|
.replace(""", "\"")
|
||||||
|
.replace("<", "<")
|
||||||
|
.replace(">", ">")
|
||||||
|
.split_whitespace()
|
||||||
|
.take(36)
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(" ")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The community feed indexes publisher pages, not immutable AppImage files.
|
||||||
|
/// These are discovery leads only: `appimage_acquire` still requires an
|
||||||
|
/// independently reviewed URL and SHA-256.
|
||||||
|
fn parse_appimage_feed(text: &str, query: &str) -> std::result::Result<Vec<CatalogEntry>, String> {
|
||||||
|
let feed: serde_json::Value =
|
||||||
|
serde_json::from_str(text).map_err(|_| "AppImage catalog returned invalid JSON")?;
|
||||||
|
let items = feed
|
||||||
|
.get("items")
|
||||||
|
.and_then(serde_json::Value::as_array)
|
||||||
|
.ok_or("AppImage catalog has no items array")?;
|
||||||
|
let needle = query.trim().to_ascii_lowercase().replace(['_', '-'], " ");
|
||||||
|
if needle.is_empty() {
|
||||||
|
return Ok(Vec::new());
|
||||||
|
}
|
||||||
|
let terms: Vec<&str> = needle.split_whitespace().collect();
|
||||||
|
let mut matches = Vec::new();
|
||||||
|
for item in items {
|
||||||
|
let Some(name) = item.get("name").and_then(serde_json::Value::as_str) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let name = name.trim();
|
||||||
|
if name.is_empty() || name.len() > 120 || name.chars().any(char::is_control) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let description = appimage_description(
|
||||||
|
item.get("description")
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.unwrap_or(""),
|
||||||
|
);
|
||||||
|
let normalized_name = name.to_ascii_lowercase().replace(['_', '-'], " ");
|
||||||
|
let rank = if normalized_name == needle {
|
||||||
|
0
|
||||||
|
} else if normalized_name.contains(&needle) {
|
||||||
|
1
|
||||||
|
} else if terms.iter().all(|term| normalized_name.contains(term)) {
|
||||||
|
2
|
||||||
|
} else if normalized_name.len() >= 5 && needle.ends_with(&normalized_name) {
|
||||||
|
3
|
||||||
|
} else if description.to_ascii_lowercase().contains(&needle) {
|
||||||
|
4
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let mut entry = CatalogEntry::new(Backend::AppImage, name).scope("catalog lead");
|
||||||
|
if !description.is_empty() {
|
||||||
|
entry = entry.description(description);
|
||||||
|
}
|
||||||
|
if let Some(url) = item
|
||||||
|
.get("links")
|
||||||
|
.and_then(serde_json::Value::as_array)
|
||||||
|
.into_iter()
|
||||||
|
.flatten()
|
||||||
|
.find(|link| link.get("type").and_then(serde_json::Value::as_str) == Some("Download"))
|
||||||
|
.and_then(|link| link.get("url"))
|
||||||
|
.and_then(serde_json::Value::as_str)
|
||||||
|
.filter(|url| {
|
||||||
|
url.starts_with("https://")
|
||||||
|
&& url.len() <= 2048
|
||||||
|
&& !url.chars().any(char::is_whitespace)
|
||||||
|
&& !url.chars().any(char::is_control)
|
||||||
|
})
|
||||||
|
{
|
||||||
|
entry = entry.url(url);
|
||||||
|
}
|
||||||
|
matches.push((rank, entry));
|
||||||
|
}
|
||||||
|
matches.sort_by(|(rank_a, a), (rank_b, b)| rank_a.cmp(rank_b).then_with(|| a.id.cmp(&b.id)));
|
||||||
|
matches.dedup_by(|(_, a), (_, b)| a.id.eq_ignore_ascii_case(&b.id));
|
||||||
|
Ok(matches
|
||||||
|
.into_iter()
|
||||||
|
.take(APPIMAGE_FEED_MAX_RESULTS)
|
||||||
|
.map(|(_, entry)| entry)
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn search_appimage(exec: &Exec, root: &Path, query: &str, backend: Backend) -> SourceReport {
|
||||||
let lower = query.to_ascii_lowercase();
|
let lower = query.to_ascii_lowercase();
|
||||||
let entries = appimage::list(root)
|
let mut entries: Vec<CatalogEntry> = appimage::list(root)
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|r| {
|
.filter(|r| {
|
||||||
|
|
@ -432,7 +537,79 @@ fn search_appimage(root: &Path, query: &str, backend: Backend) -> SourceReport {
|
||||||
.installed(true)
|
.installed(true)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
SourceReport::ok(backend, "Phoebus-managed AppImages", entries)
|
if !crate::actions::is_host_root(root) {
|
||||||
|
return SourceReport::ok(
|
||||||
|
backend,
|
||||||
|
"managed AppImages in the target; online catalog searches require the running system",
|
||||||
|
entries,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
let out = match capture(
|
||||||
|
exec,
|
||||||
|
root,
|
||||||
|
"curl",
|
||||||
|
&[
|
||||||
|
"--fail",
|
||||||
|
"--silent",
|
||||||
|
"--show-error",
|
||||||
|
"--location",
|
||||||
|
"--proto",
|
||||||
|
"=https",
|
||||||
|
"--proto-redir",
|
||||||
|
"=https",
|
||||||
|
"--connect-timeout",
|
||||||
|
"3",
|
||||||
|
"--max-time",
|
||||||
|
"8",
|
||||||
|
"--max-filesize",
|
||||||
|
"4194304",
|
||||||
|
APPIMAGE_FEED_URL,
|
||||||
|
],
|
||||||
|
) {
|
||||||
|
Ok(out) if out.success => out,
|
||||||
|
Ok(_) => return appimage_catalog_unavailable(backend, entries, "catalog download failed"),
|
||||||
|
Err(e) if is_unavailable(&e) => {
|
||||||
|
return appimage_catalog_unavailable(backend, entries, "curl is unavailable")
|
||||||
|
}
|
||||||
|
Err(_) => return appimage_catalog_unavailable(backend, entries, "catalog lookup failed"),
|
||||||
|
};
|
||||||
|
let remote = match parse_appimage_feed(&out.stdout_lossy(), query) {
|
||||||
|
Ok(remote) => remote,
|
||||||
|
Err(reason) => return appimage_catalog_unavailable(backend, entries, reason),
|
||||||
|
};
|
||||||
|
for entry in remote {
|
||||||
|
if !entries
|
||||||
|
.iter()
|
||||||
|
.any(|installed| installed.id.eq_ignore_ascii_case(&entry.id))
|
||||||
|
{
|
||||||
|
entries.push(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SourceReport::ok(
|
||||||
|
backend,
|
||||||
|
"Phoebus-managed images and appimage.github.io leads; catalog entries are not verified install candidates",
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn appimage_catalog_unavailable(
|
||||||
|
backend: Backend,
|
||||||
|
entries: Vec<CatalogEntry>,
|
||||||
|
reason: impl AsRef<str>,
|
||||||
|
) -> SourceReport {
|
||||||
|
let note = format!(
|
||||||
|
"{reason}; AppImage catalog unavailable",
|
||||||
|
reason = reason.as_ref()
|
||||||
|
);
|
||||||
|
if entries.is_empty() {
|
||||||
|
SourceReport::failed(backend, note)
|
||||||
|
} else {
|
||||||
|
SourceReport::ok(
|
||||||
|
backend,
|
||||||
|
format!("{note}; showing managed images only"),
|
||||||
|
entries,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn search_nix(exec: &Exec, root: &Path, query: &str, backend: Backend) -> SourceReport {
|
fn search_nix(exec: &Exec, root: &Path, query: &str, backend: Backend) -> SourceReport {
|
||||||
|
|
@ -1816,6 +1993,81 @@ mod tests {
|
||||||
assert!(search_external_overlays(&exec, Path::new("/"), "chatgpt").is_err());
|
assert!(search_external_overlays(&exec, Path::new("/"), "chatgpt").is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const APPIMAGE_FEED: &str = r#"{"version":1,"items":[
|
||||||
|
{"name":"Chatty_Desktop","description":"A desktop chat client","links":[{"type":"Download","url":"https://example.org/chatty/releases"}]},
|
||||||
|
{"name":"Desktop_Chatty","description":"Another client","links":[{"type":"Download","url":"http://example.org/insecure"}]},
|
||||||
|
{"name":"Notes","description":"<p>A chatty desktop note taker & organizer</p>","links":[]},
|
||||||
|
{"name":"\u001b[31mbad","description":"chatty desktop","links":[]}
|
||||||
|
]}"#;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn appimage_feed_results_are_ranked_and_labeled_as_leads() {
|
||||||
|
let matches = parse_appimage_feed(APPIMAGE_FEED, "chatty desktop").unwrap();
|
||||||
|
assert_eq!(matches.len(), 3);
|
||||||
|
assert_eq!(matches[0].id, "Chatty_Desktop");
|
||||||
|
assert_eq!(matches[0].scope.as_deref(), Some("catalog lead"));
|
||||||
|
assert!(!matches[0].installed);
|
||||||
|
assert_eq!(matches[0].version, None);
|
||||||
|
assert_eq!(
|
||||||
|
matches[0].url.as_deref(),
|
||||||
|
Some("https://example.org/chatty/releases")
|
||||||
|
);
|
||||||
|
assert_eq!(matches[1].id, "Desktop_Chatty");
|
||||||
|
assert_eq!(matches[1].url, None, "HTTP links are not exposed");
|
||||||
|
assert_eq!(matches[2].id, "Notes");
|
||||||
|
assert_eq!(
|
||||||
|
matches[2].description.as_deref(),
|
||||||
|
Some("A chatty desktop note taker & organizer")
|
||||||
|
);
|
||||||
|
assert!(parse_appimage_feed(r#"{"items":{}}"#, "chatty").is_err());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn appimage_feed_finds_a_product_when_query_includes_its_vendor() {
|
||||||
|
let feed = r#"{"items":[{"name":"Etcher","description":"Flash OS images","links":[]}]}"#;
|
||||||
|
let matches = parse_appimage_feed(feed, "balenaEtcher").unwrap();
|
||||||
|
assert_eq!(matches.len(), 1);
|
||||||
|
assert_eq!(matches[0].id, "Etcher");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn appimage_search_fetches_bounded_catalog_and_reports_offline_failure() {
|
||||||
|
let runner = RecordingRunner::new();
|
||||||
|
runner.set_response("curl", ok(APPIMAGE_FEED));
|
||||||
|
let exec = make_exec(runner.clone());
|
||||||
|
let report = search(
|
||||||
|
&exec,
|
||||||
|
Path::new("/"),
|
||||||
|
"chatty desktop",
|
||||||
|
Some(Backend::AppImage),
|
||||||
|
);
|
||||||
|
let source = &report.sources[0];
|
||||||
|
assert!(source.ok);
|
||||||
|
assert_eq!(source.entries.len(), 3);
|
||||||
|
assert!(source.note.contains("not verified install candidates"));
|
||||||
|
assert!(report
|
||||||
|
.render()
|
||||||
|
.contains("catalog page: https://example.org/chatty/releases"));
|
||||||
|
let calls = runner.recorded();
|
||||||
|
assert_eq!(calls.len(), 1);
|
||||||
|
assert_eq!(calls[0].program, "curl");
|
||||||
|
assert!(calls[0].args.iter().any(|arg| arg == "--max-time"));
|
||||||
|
assert!(calls[0].args.iter().any(|arg| arg == "--max-filesize"));
|
||||||
|
assert!(calls[0].args.iter().any(|arg| arg == APPIMAGE_FEED_URL));
|
||||||
|
|
||||||
|
let offline = RecordingRunner::new();
|
||||||
|
offline.fail("curl", "offline");
|
||||||
|
let exec = make_exec(offline);
|
||||||
|
let report = search(
|
||||||
|
&exec,
|
||||||
|
Path::new("/"),
|
||||||
|
"chatty desktop",
|
||||||
|
Some(Backend::AppImage),
|
||||||
|
);
|
||||||
|
assert!(!report.sources[0].ok);
|
||||||
|
assert!(report.sources[0].note.contains("catalog unavailable"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_failed_search_is_not_reported_as_empty() {
|
fn a_failed_search_is_not_reported_as_empty() {
|
||||||
let runner = RecordingRunner::new();
|
let runner = RecordingRunner::new();
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,17 @@ fn plan_and_respond_install(
|
||||||
query: &str,
|
query: &str,
|
||||||
conv_path: &Path,
|
conv_path: &Path,
|
||||||
) -> BridgeResponse {
|
) -> BridgeResponse {
|
||||||
|
if constrained_backend == Some(Backend::AppImage) {
|
||||||
|
return BridgeResponse::ok(
|
||||||
|
id,
|
||||||
|
json!({
|
||||||
|
"kind": "info",
|
||||||
|
"state": "info",
|
||||||
|
"application": app,
|
||||||
|
"recommendation": phoebus_executor::install::appimage_discovery_guidance(exec, root, app),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
let mut install_req = InstallRequest::new(app);
|
let mut install_req = InstallRequest::new(app);
|
||||||
install_req.backend = constrained_backend;
|
install_req.backend = constrained_backend;
|
||||||
let session = BridgeSession { exec, root };
|
let session = BridgeSession { exec, root };
|
||||||
|
|
@ -970,6 +981,48 @@ mod tests {
|
||||||
assert_eq!(parse_install_phrase("why is audio broken"), None);
|
assert_eq!(parse_install_phrase("why is audio broken"), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn appimage_install_request_returns_catalog_information_without_a_plan() {
|
||||||
|
let root = tempdir().unwrap();
|
||||||
|
let exec = make_test_exec(root.path());
|
||||||
|
let plans = PlanStore::with_dir(tempdir().unwrap().keep());
|
||||||
|
let response = plan_and_respond_install(
|
||||||
|
&plans,
|
||||||
|
&exec,
|
||||||
|
root.path(),
|
||||||
|
7,
|
||||||
|
"Etcher",
|
||||||
|
Some(Backend::AppImage),
|
||||||
|
"install Etcher with appimage",
|
||||||
|
&root.path().join("history.json"),
|
||||||
|
);
|
||||||
|
assert!(response.ok);
|
||||||
|
let result = response.result.unwrap();
|
||||||
|
assert_eq!(result["kind"], "info");
|
||||||
|
assert!(result.get("plan_id").is_none());
|
||||||
|
assert!(result["recommendation"]
|
||||||
|
.as_str()
|
||||||
|
.unwrap()
|
||||||
|
.contains("no verified artifact hash"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn natural_appimage_install_phrase_reaches_catalog_information() {
|
||||||
|
let root = tempdir().unwrap();
|
||||||
|
let exec = make_test_exec(root.path());
|
||||||
|
let plans = PlanStore::with_dir(tempdir().unwrap().keep());
|
||||||
|
let mut req = request("ask");
|
||||||
|
req.request = Some("i want to install balenaEtcher with appimage".into());
|
||||||
|
let response = handle_request(&exec, root.path(), &plans, req);
|
||||||
|
assert!(response.ok);
|
||||||
|
let result = response.result.unwrap();
|
||||||
|
assert_eq!(result["kind"], "info");
|
||||||
|
assert!(result["recommendation"]
|
||||||
|
.as_str()
|
||||||
|
.unwrap()
|
||||||
|
.contains("AppImage search for balenaetcher"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_removal_phrase() {
|
fn test_parse_removal_phrase() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ use phoebus_core::transaction::{TransactionOutcome, TransactionRecord};
|
||||||
use phoebus_core::{AiBackend, InstallConfig, Redactor};
|
use phoebus_core::{AiBackend, InstallConfig, Redactor};
|
||||||
use phoebus_executor::install::{AiInstall, ExecutorSession, InstallRequest};
|
use phoebus_executor::install::{AiInstall, ExecutorSession, InstallRequest};
|
||||||
use phoebus_executor::{
|
use phoebus_executor::{
|
||||||
actions, authorize, chooser, probe, query, transaction, AutoConfirm, Confirmation,
|
actions, authorize, chooser, install, probe, query, transaction, AutoConfirm, Confirmation,
|
||||||
DestructiveAuthorization, Exec, Logger, RealRunner, Result,
|
DestructiveAuthorization, Exec, Logger, RealRunner, Result,
|
||||||
};
|
};
|
||||||
use phoebus_installer::approval;
|
use phoebus_installer::approval;
|
||||||
|
|
@ -938,6 +938,13 @@ fn print_install_offer(cli: &Cli, exec: &Exec, application: &str) {
|
||||||
|
|
||||||
fn print_explicit_install_recovery(exec: &Exec, root: &Path, application: &str, backend: Backend) {
|
fn print_explicit_install_recovery(exec: &Exec, root: &Path, application: &str, backend: Backend) {
|
||||||
let lane = backend_flag_name(backend);
|
let lane = backend_flag_name(backend);
|
||||||
|
if backend == Backend::AppImage {
|
||||||
|
eprintln!(
|
||||||
|
"{}",
|
||||||
|
install::appimage_discovery_guidance(exec, root, application)
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if application.split_whitespace().count() > 1 {
|
if application.split_whitespace().count() > 1 {
|
||||||
eprintln!("`{application}` is a description, not an exact package identifier.");
|
eprintln!("`{application}` is a description, not an exact package identifier.");
|
||||||
let words: Vec<_> = application.split_whitespace().collect();
|
let words: Vec<_> = application.split_whitespace().collect();
|
||||||
|
|
@ -990,6 +997,13 @@ fn run_install(
|
||||||
application: &str,
|
application: &str,
|
||||||
backend: Option<Backend>,
|
backend: Option<Backend>,
|
||||||
) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||||
|
if backend == Some(Backend::AppImage) {
|
||||||
|
eprintln!(
|
||||||
|
"{}",
|
||||||
|
install::appimage_discovery_guidance(exec, &cli.root, application)
|
||||||
|
);
|
||||||
|
return Err("AppImage catalog results cannot create an install plan".into());
|
||||||
|
}
|
||||||
let mut request = InstallRequest::new(application);
|
let mut request = InstallRequest::new(application);
|
||||||
request.backend = backend;
|
request.backend = backend;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -408,6 +408,22 @@ fn source_flag_without_legacy_enters_ai_workflow_and_suggests_legacy() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn appimage_install_searches_without_inventing_an_install_plan() {
|
||||||
|
let root = tempfile::tempdir().expect("temp root");
|
||||||
|
let out = sys()
|
||||||
|
.env("PHOEBUS_AI_PROVIDER", "none")
|
||||||
|
.arg("--root")
|
||||||
|
.arg(root.path())
|
||||||
|
.args(["install", "balenaEtcher", "--appimage"])
|
||||||
|
.output()
|
||||||
|
.expect("run sys");
|
||||||
|
assert!(!out.status.success());
|
||||||
|
let stderr = String::from_utf8_lossy(&out.stderr);
|
||||||
|
assert!(stderr.contains("no verified artifact hash"), "{stderr}");
|
||||||
|
assert!(!stderr.contains("--legacy --appimage"), "{stderr}");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn natural_install_lane_is_not_part_of_the_package_name() {
|
fn natural_install_lane_is_not_part_of_the_package_name() {
|
||||||
let root = tempfile::tempdir().expect("temp root");
|
let root = tempfile::tempdir().expect("temp root");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue