mirror of
https://github.com/TommyFang2077/dsh-desktop.git
synced 2026-08-17 09:06:36 +08:00
revert: drop the AgentRQ plugin from the desktop shell
It is a remote human-in-the-loop task queue with per-workspace tokens, not a chat-native dsh plugin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,11 +10,6 @@ pub const PACKAGE: &str = "@liustack/modlens";
|
||||
pub const VISION_PACKAGE: &str = "dsh-desktop-vision";
|
||||
pub const MODLENS_VERSION: &str = "3.16.6";
|
||||
pub const HIDE_PLAIN_TWINS_JS: &str = include_str!("../../../ui/inject/hide-twins.js");
|
||||
pub const AGENTRQ_PACKAGE: &str = "agentrq";
|
||||
pub const AGENTRQ_VERSION: &str = "0.2.1";
|
||||
|
||||
const AGENTRQ_PACKAGE_FILES: &[&str] =
|
||||
&["package.json", "cordis.patch.yml", "LICENSE", "README.md"];
|
||||
|
||||
pub const MANAGED_OVERLAY: &str = "\
|
||||
# dsh-desktop manages this modlens overlay (wrap every text-only model).
|
||||
@@ -61,50 +56,12 @@ pub fn bundled_vision_plugin(paths: &BundledPaths) -> Option<PathBuf> {
|
||||
.filter(|p| p.join("client.js").is_file())
|
||||
}
|
||||
|
||||
pub fn bundled_agentrq_plugin(paths: &BundledPaths) -> Option<PathBuf> {
|
||||
paths
|
||||
.find_dir("agentrq", "package.json")
|
||||
.or_else(|| paths.find_dir("plugins/agentrq", "package.json"))
|
||||
.filter(|p| p.join("lib/index.js").is_file())
|
||||
}
|
||||
|
||||
pub fn bundled_modlens_prefix(paths: &BundledPaths) -> Option<PathBuf> {
|
||||
paths
|
||||
.find_dir("modlens", "node_modules/@liustack/modlens")
|
||||
.or_else(|| paths.find_dir("vendor/modlens", "node_modules/@liustack/modlens"))
|
||||
}
|
||||
|
||||
fn install_agentrq_plugin(paths: &BundledPaths, profile: &Path) -> bool {
|
||||
let Some(src) = bundled_agentrq_plugin(paths) else {
|
||||
return false;
|
||||
};
|
||||
let dest = profile.join("node_modules").join(AGENTRQ_PACKAGE);
|
||||
let up_to_date =
|
||||
dest.join("lib/index.js").is_file() && read_pkg_version(&dest) == read_pkg_version(&src);
|
||||
if !up_to_date && copy_agentrq_package(&src, &dest).is_err() {
|
||||
return false;
|
||||
}
|
||||
let fallback = dsh_home()
|
||||
.join("profiles/node_modules")
|
||||
.join(AGENTRQ_PACKAGE);
|
||||
let _ = replace_symlink(&fallback, &dest);
|
||||
true
|
||||
}
|
||||
|
||||
fn copy_agentrq_package(src: &Path, dest: &Path) -> std::io::Result<()> {
|
||||
if dest.exists() {
|
||||
std::fs::remove_dir_all(dest)?;
|
||||
}
|
||||
std::fs::create_dir_all(dest)?;
|
||||
for name in AGENTRQ_PACKAGE_FILES {
|
||||
let from = src.join(name);
|
||||
if from.is_file() {
|
||||
std::fs::copy(&from, dest.join(name))?;
|
||||
}
|
||||
}
|
||||
copy_tree(&src.join("lib"), &dest.join("lib"), true)
|
||||
}
|
||||
|
||||
fn install_into_profile(src_prefix: &Path, profile: &Path) -> std::io::Result<()> {
|
||||
let dest_pkg = package_dir(profile);
|
||||
copy_tree(&package_dir(src_prefix), &dest_pkg, true)?;
|
||||
@@ -366,17 +323,10 @@ fn ensure_modlens_inner(
|
||||
) -> std::io::Result<ModlensEnsureResult> {
|
||||
std::fs::create_dir_all(profile)?;
|
||||
let vision_ok = install_vision_plugin(paths, profile);
|
||||
let agentrq_ok = install_agentrq_plugin(paths, profile);
|
||||
let mut packages = BTreeMap::new();
|
||||
if vision_ok {
|
||||
packages.insert(VISION_PACKAGE.to_string(), "0.1.0".into());
|
||||
}
|
||||
if agentrq_ok {
|
||||
let version = bundled_agentrq_plugin(paths)
|
||||
.and_then(|p| read_pkg_version(&p))
|
||||
.unwrap_or_else(|| AGENTRQ_VERSION.to_string());
|
||||
packages.insert(AGENTRQ_PACKAGE.to_string(), version);
|
||||
}
|
||||
if src.is_none() && installed.is_none() {
|
||||
if !packages.is_empty() {
|
||||
ensure_manifest(profile, &packages)?;
|
||||
@@ -524,44 +474,4 @@ ui-theme:
|
||||
assert!(HIDE_PLAIN_TWINS_JS.contains("(modlens vision)"));
|
||||
assert!(HIDE_PLAIN_TWINS_JS.contains("MutationObserver"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn agentrq_bundle_requires_built_entry() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
let src = root.path().join("agentrq");
|
||||
std::fs::create_dir_all(&src).unwrap();
|
||||
std::fs::write(
|
||||
src.join("package.json"),
|
||||
r#"{"name":"agentrq","version":"0.2.1"}"#,
|
||||
)
|
||||
.unwrap();
|
||||
let paths = BundledPaths::default().with_resource_dir(root.path().to_path_buf());
|
||||
assert!(bundled_agentrq_plugin(&paths).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn agentrq_install_copies_package_not_sources() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
let src = root.path().join("agentrq");
|
||||
std::fs::create_dir_all(src.join("lib")).unwrap();
|
||||
std::fs::create_dir_all(src.join("src")).unwrap();
|
||||
std::fs::write(
|
||||
src.join("package.json"),
|
||||
r#"{"name":"agentrq","version":"0.2.1"}"#,
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(src.join("lib/index.js"), "export const name = 'agentrq'\n").unwrap();
|
||||
std::fs::write(src.join("src/index.ts"), "should not be copied\n").unwrap();
|
||||
std::fs::write(src.join("cordis.patch.yml"), "- insert: []\n").unwrap();
|
||||
|
||||
let profile = tempfile::tempdir().unwrap();
|
||||
let paths = BundledPaths::default().with_resource_dir(root.path().to_path_buf());
|
||||
assert!(install_agentrq_plugin(&paths, profile.path()));
|
||||
|
||||
let dest = profile.path().join("node_modules/agentrq");
|
||||
assert!(dest.join("lib/index.js").is_file());
|
||||
assert!(dest.join("package.json").is_file());
|
||||
assert!(dest.join("cordis.patch.yml").is_file());
|
||||
assert!(!dest.join("src").exists());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ pub fn is_flatpak() -> bool {
|
||||
Path::new("/.flatpak-info").exists()
|
||||
}
|
||||
|
||||
/// Roots that may contain bundled ModLens / presets / vision / AgentRQ plugins.
|
||||
/// Roots that may contain bundled ModLens / presets / vision plugin.
|
||||
///
|
||||
/// Search order: extra roots (Tauri resource dir), `$XDG_DATA_HOME/dsh-desktop`,
|
||||
/// `/app/share/dsh-desktop`, `/usr/share/dsh-desktop`, `~/.local/share/dsh-desktop`,
|
||||
|
||||
Reference in New Issue
Block a user