Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(marketplace): install an entry by name, skill or plugin, over one route
Haraldde6e00348a7f
diff --git a/jarvis/ui/web/marketplace_routes.py b/jarvis/ui/web/marketplace_routes.pyindex 2aa897d67f..e296f1af7f 100644--- a/jarvis/ui/web/marketplace_routes.py+++ b/jarvis/ui/web/marketplace_routes.py@@ -8,6 +8,7 @@ Endpoints:DELETE /api/marketplace/plugins/{id} — disconnectGET /api/marketplace/community — community index browsePOST /api/marketplace/community/refresh — force index re-fetch+ POST /api/marketplace/community/install/{id} — install by name (skill OR plugin)POST /api/marketplace/community/plugins/{id}/install — one-click installDELETE /api/marketplace/community/plugins/{id} — uninstall + revoke"""@@ -843,11 +844,13 @@ async def community_refresh(response: Response) -> dict[str, Any]:return _community_payload(index, status)[email protected]("/community/plugins/{plugin_id}/install")-async def community_install(plugin_id: str) -> dict[str, Any]:- """One-click install: convert the manifest, persist the catalog entry and- usage card, refresh the live registry. The plugin then behaves exactly- like a seed plugin (connect flows, relevance gate, worker bridge)."""+async def _install_community_plugin(plugin_id: str) -> dict[str, Any]:+ """Install one community plugin; return its catalog item.++ Shared by the id-specific route and the by-name installer below, so both+ enforce the SAME preconditions (index membership, seed-id collision,+ manifest validity) instead of drifting into two install semantics.+ """from jarvis.marketplace import community_sourcefrom jarvis.marketplace.agent_plugins_loader import (AgentPluginError,@@ -909,9 +912,123 @@ async def community_install(plugin_id: str) -> dict[str, Any]:_refresh_plugin_in_live_registry(spec.id)item = spec.model_dump(mode="json")item["status"] = "not_connected"+ return item++[email protected]("/community/plugins/{plugin_id}/install")+async def community_install(plugin_id: str) -> dict[str, Any]:+ """One-click install: convert the manifest, persist the catalog entry and+ usage card, refresh the live registry. The plugin then behaves exactly+ like a seed plugin (connect flows, relevance gate, worker bridge)."""+ item = await _install_community_plugin(plugin_id)return {"ok": True, "plugin": item}+# States a freshly parsed skill can carry that mean "Jarvis will actually use+# this" — the registry treats VALIDATED and ACTIVE alike (see+# jarvis/skills/registry.py::active_skills). DRAFT means the file parsed but+# failed validation, i.e. installed yet dead.+_SKILL_READY_STATES = frozenset({"active", "validated"})+++async def _install_community_skill(entry: Any, request: Request) -> dict[str, Any]:+ """Download + register one community skill; return the by-name result shape.++ Delegates to the existing catalog-install route function so there is+ exactly ONE skill install path (download guards, name-slug check, registry+ hot-swap) rather than a second copy that can drift.+ """+ from jarvis.ui.web.skills_routes import SkillInstallBody, install_from_catalog++ body = SkillInstallBody(+ name=entry.name,+ raw_url=entry.raw_url,+ source_url=entry.source_url or "",+ title=entry.title or entry.name,+ )+ result = await install_from_catalog(body, request)+ summary = result.get("skill") or {}+ state = str(summary.get("state") or "draft")+ return {+ "ok": True,+ "kind": "skill",+ "id": entry.name,+ "title": entry.title or entry.name,+ "publisher": entry.publisher,+ "version": entry.version,+ "source_url": entry.source_url,+ "location": result.get("path") or "",+ "state": state,+ # A skill needs no credentials and no connect step: once the file+ # parses and validates, asking for it is enough.+ "ready": state in _SKILL_READY_STATES,+ "problem": summary.get("error") or result.get("reload_warning"),+ "next_action": "none" if state in _SKILL_READY_STATES else "repair",+ }+++def _install_by_name_404(item_id: str, index: Any) -> HTTPException:+ """404 that names the closest existing entry instead of a dead end."""+ import difflib++ names: list[str] = []+ if index is not None:+ names = [e.name for e in index.plugins] + [s.name for s in index.skills]+ close = difflib.get_close_matches(item_id, names, n=1, cutoff=0.6)+ hint = f" Closest match: {close[0]!r}." if close else ""+ return HTTPException(+ status_code=404,+ detail=(+ f"No skill or plugin named {item_id!r} in the community "+ f"marketplace.{hint}"+ ),+ )++[email protected]("/community/install/{item_id}")+async def community_install_by_name(item_id: str, request: Request) -> dict[str, Any]:+ """Install a marketplace entry by name — skill or plugin, one call.++ The one-liner a downloader copies off a marketplace page+ (``jarvis marketplace install <name>``) never says which of the two an+ entry is, so the KIND is resolved here and both kinds answer in one shape:+ what landed, where it landed, whether it is usable right now, and what is+ still missing. Every surface (CLI, desktop, an agent driving the API) can+ therefore report an honest status instead of a bare 200.+ """+ from jarvis.marketplace import community_source++ index, _ = await community_source.get_index()+ plugin_entry = skill_entry = None+ if index is not None:+ plugin_entry = next((e for e in index.plugins if e.name == item_id), None)+ skill_entry = next((s for s in index.skills if s.name == item_id), None)+ if plugin_entry is None and skill_entry is None:+ raise _install_by_name_404(item_id, index)++ if skill_entry is not None:+ return await _install_community_skill(skill_entry, request)++ item = await _install_community_plugin(item_id)+ return {+ "ok": True,+ "kind": "plugin",+ "id": item.get("id", item_id),+ "title": item.get("display_name") or item_id,+ "publisher": item.get("publisher"),+ "version": item.get("version"),+ "source_url": item.get("source_url"),+ "location": "",+ "state": "not_connected",+ # A plugin talks to somebody else's service: installed is not the same+ # as usable, and saying otherwise is the exact confusion this route exists to kill.+ "ready": False,+ "problem": None,+ "next_action": "connect",+ "plugin": item,+ }++@router.delete("/community/plugins/{plugin_id}")async def community_uninstall(plugin_id: str) -> dict[str, Any]:"""Remove an installed community plugin: revoke + drop stored tokens,diff --git a/jarvis/ui/web/skills_routes.py b/jarvis/ui/web/skills_routes.pyindex 151ddc6e72..0f5df769a9 100644--- a/jarvis/ui/web/skills_routes.py+++ b/jarvis/ui/web/skills_routes.py@@ -1470,7 +1470,24 @@ async def install_from_catalog("reload_warning": str(exc),}- installed = reg.get(body.name)+ try:+ installed = reg.get(body.name)+ except KeyError as exc:+ # The download succeeded and the file is on disk, but the loader keys a+ # skill by its FRONTMATTER name (falling back to the file stem), so a+ # missing/unreadable frontmatter means nothing was registered under the+ # requested name. Saying so — with the path — beats the bare 500 an+ # uncaught KeyError produced, which told the user nothing about the+ # file now sitting in their skills folder.+ raise HTTPException(+ status_code=422,+ detail=(+ f"Downloaded to {target_path}, but it is not a usable skill: "+ f"Jarvis found no skill named '{body.name}' in it (the "+ "frontmatter is missing or unreadable). Delete that folder or "+ "fix the file."+ ),+ ) from excreturn {"ok": True,"name": body.name,diff --git a/tests/unit/marketplace/test_community_routes.py b/tests/unit/marketplace/test_community_routes.pyindex 511d7227c2..e0c5c7264b 100644--- a/tests/unit/marketplace/test_community_routes.py+++ b/tests/unit/marketplace/test_community_routes.py@@ -229,3 +229,176 @@ async def test_refresh_bypasses_ttl(community_env: Path, monkeypatch: pytest.Monresp = await client.post("/api/marketplace/community/refresh")assert resp.status_code == 200assert calls == [True]+++# ----------------------------------------------------------------------+# Install by name (skill OR plugin) — the published one-liner+# ----------------------------------------------------------------------++_SKILL_MD = """---+schema_version: "1"+name: three-point-check+version: "1.0.0"+description: Summarize any topic in exactly three bullets plus a takeaway.+when_to_use: When someone asks for a brief, a TLDR, or the short version.+category: productivity+---++# Three Point Check++Produce three bullets and one takeaway line.+"""+++def _client_with_skills(skills_root: Path) -> tuple[httpx.AsyncClient, Any]:+ """Test client whose app carries a real SkillRegistry (skill installs need it)."""+ from jarvis.skills.registry import SkillRegistry++ app = FastAPI()+ app.include_router(router)+ registry = SkillRegistry(root=skills_root)+ registry.reload_sync()+ app.state.skill_registry = registry+ client = httpx.AsyncClient(+ transport=httpx.ASGITransport(app=app), base_url="http://test"+ )+ return client, registry+++def offline_skill_download(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):+ """Write the SKILL.md locally instead of fetching it (no network in tests).++ The download itself — https-only, slug-only, path containment — is covered+ in tests/unit/marketplace/test_community_hardening.py; here we only need a+ file on disk so the registry parse + lifecycle state are the REAL ones.+ """+ from jarvis.skills.finder import SkillFinder++ async def fake_install(self: Any, candidate: Any) -> Path:+ target_dir = tmp_path / "skills" / candidate.name+ target_dir.mkdir(parents=True, exist_ok=True)+ target = target_dir / "SKILL.md"+ target.write_text(_SKILL_MD, encoding="utf-8")+ return target++ monkeypatch.setattr(SkillFinder, "install", fake_install)+++async def test_install_by_name_installs_a_skill_and_reports_it_ready(+ community_env: Path, offline_skill_download: None+) -> None:+ client, _ = _client_with_skills(community_env / "skills")+ async with client:+ resp = await client.post(+ "/api/marketplace/community/install/three-point-check"+ )+ assert resp.status_code == 200+ data = resp.json()+ assert data["kind"] == "skill"+ assert data["id"] == "three-point-check"+ assert data["title"] == "Three Point Check"+ # A valid skill is live the moment it parses — the CLI reports exactly this.+ assert data["state"] == "validated"+ assert data["ready"] is True+ assert data["next_action"] == "none"+ assert data["problem"] is None+ assert data["location"].endswith("SKILL.md")+ assert (community_env / "skills" / "three-point-check" / "SKILL.md").exists()+++def _broken_download(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, content: str+) -> None:+ from jarvis.skills.finder import SkillFinder++ async def fake_install(self: Any, candidate: Any) -> Path:+ target_dir = tmp_path / "skills" / candidate.name+ target_dir.mkdir(parents=True, exist_ok=True)+ target = target_dir / "SKILL.md"+ target.write_text(content, encoding="utf-8")+ return target++ monkeypatch.setattr(SkillFinder, "install", fake_install)+++async def test_install_by_name_reports_a_broken_skill_as_not_ready(+ community_env: Path, monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ """A file that lands but fails validation must NOT be reported as usable."""+ _broken_download(+ monkeypatch,+ tmp_path,+ _SKILL_MD.replace(+ "category: productivity",+ "category: productivity\ntriggers:\n - type: voice\n",+ ),+ )+ client, _ = _client_with_skills(community_env / "skills")+ async with client:+ resp = await client.post(+ "/api/marketplace/community/install/three-point-check"+ )+ assert resp.status_code == 200+ data = resp.json()+ assert data["ready"] is False+ assert data["state"] == "draft"+ assert data["next_action"] == "repair"+ assert "pattern" in (data["problem"] or "")+++async def test_install_by_name_unreadable_file_422_names_the_path(+ community_env: Path, monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ """No frontmatter at all: the file lands under no known name — say so.++ The loader keys a skill by its frontmatter name, so such a download+ registers under nothing the caller asked for. That used to surface as an+ uncaught KeyError (HTTP 500) that never mentioned the downloaded file.+ """+ _broken_download(monkeypatch, tmp_path, "no frontmatter at all\n")+ client, _ = _client_with_skills(community_env / "skills")+ async with client:+ resp = await client.post(+ "/api/marketplace/community/install/three-point-check"+ )+ assert resp.status_code == 422+ detail = resp.json()["detail"]+ assert "SKILL.md" in detail+ assert "three-point-check" in detail+++async def test_install_by_name_installs_a_plugin_as_not_connected(+ community_env: Path,+) -> None:+ client, _ = _client_with_skills(community_env / "skills")+ async with client:+ resp = await client.post("/api/marketplace/community/install/todo-fox")+ assert resp.status_code == 200+ data = resp.json()+ assert data["kind"] == "plugin"+ assert data["title"] == "TodoFox"+ # Installed is NOT usable for a plugin: it still needs the user's account.+ assert data["ready"] is False+ assert data["state"] == "not_connected"+ assert data["next_action"] == "connect"+ assert data["plugin"]["id"] == "todo-fox"+++async def test_install_by_name_unknown_entry_404_names_the_closest_match(+ community_env: Path,+) -> None:+ client, _ = _client_with_skills(community_env / "skills")+ async with client:+ resp = await client.post(+ "/api/marketplace/community/install/three-point-chek"+ )+ assert resp.status_code == 404+ detail = resp.json()["detail"]+ assert "three-point-chek" in detail+ assert "three-point-check" in detail