Skip to content

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.

feat(marketplace): the store stays live, a lone SKILL.md is a package, and a wallpaper can be dropped into the Studio

rubenluetke10-beepc46b389fdad9
diff --git a/jarvis/marketplace/community_source.py b/jarvis/marketplace/community_source.py
index 9f83aaec89..62c4d76ed6 100644
--- a/jarvis/marketplace/community_source.py
+++ b/jarvis/marketplace/community_source.py
@@ -32,10 +32,13 @@ logger = logging.getLogger(__name__)
_CACHE_PATH = Path(__file__).resolve().parent.parent.parent / "data" / "marketplace_index.json"
_FETCH_TIMEOUT = httpx.Timeout(connect=3.0, read=10.0, write=10.0, pool=10.0)
-# How long a fetched index stays fresh before a view-open refetches it. The
-# refresh endpoint bypasses this; publishing latency is CI-bound (~minutes),
-# so a quarter hour keeps browsing snappy without hammering the host.
-_CACHE_TTL_SECONDS = 900.0
+# How long a fetched index stays fresh before the next read revalidates it.
+# The refresh endpoint bypasses this. Two minutes, not fifteen: the store view
+# polls while it is open so a fresh publish shows up on its own, and the
+# revalidation is a conditional GET (If-None-Match) — GitHub Pages answers a
+# 304 with no body when nothing changed, so the short TTL costs the host a
+# few hundred bytes per window, not a re-download of the index.
+_CACHE_TTL_SECONDS = 120.0
# One in-process fetch at a time — a double view-open must not race two
# downloads into the same cache file.
@@ -260,10 +263,17 @@ def index_url() -> str:
return MarketplaceConfig().community_index_url
-def _read_cache() -> tuple[float, CommunityIndex] | None:
+def _read_cache_raw() -> tuple[float, CommunityIndex, str | None] | None:
+ """``(fetched_at, index, etag)`` — ``etag`` is None for a cache written
+ before validators were stored, or when the host sent none."""
try:
raw = json.loads(_CACHE_PATH.read_text(encoding="utf-8-sig"))
- return float(raw["fetched_at"]), CommunityIndex.model_validate(raw["index"])
+ etag = raw.get("etag")
+ return (
+ float(raw["fetched_at"]),
+ CommunityIndex.model_validate(raw["index"]),
+ str(etag) if isinstance(etag, str) and etag else None,
+ )
except FileNotFoundError:
return None # no cache yet — the caller fetches the index
except (OSError, ValueError, KeyError, ValidationError) as exc:
@@ -271,18 +281,28 @@ def _read_cache() -> tuple[float, CommunityIndex] | None:
return None
-def _write_cache(index: CommunityIndex) -> None:
- """Atomic tmp+replace, like every other data/ writer in this repo."""
+def _read_cache() -> tuple[float, CommunityIndex] | None:
+ hit = _read_cache_raw()
+ return (hit[0], hit[1]) if hit else None
+
+
+def _write_cache(index: CommunityIndex, etag: str | None = None) -> None:
+ """Atomic tmp+replace, like every other data/ writer in this repo.
+
+ ``etag`` is the host's validator for this exact body; the next refresh
+ after the TTL sends it back as ``If-None-Match`` so an unchanged index
+ costs a 304 instead of a download.
+ """
try:
_CACHE_PATH.parent.mkdir(parents=True, exist_ok=True)
tmp = _CACHE_PATH.with_suffix(".json.tmp")
- tmp.write_text(
- json.dumps(
- {"fetched_at": time.time(), "index": index.model_dump(mode="json")},
- ensure_ascii=False,
- ),
- encoding="utf-8",
- )
+ payload: dict[str, Any] = {
+ "fetched_at": time.time(),
+ "index": index.model_dump(mode="json"),
+ }
+ if etag:
+ payload["etag"] = etag
+ tmp.write_text(json.dumps(payload, ensure_ascii=False), encoding="utf-8")
tmp.replace(_CACHE_PATH)
except OSError as exc:
# A read-only disk costs persistence, not the current browse.
@@ -303,7 +323,8 @@ async def get_index(
"""Return ``(index, status)`` with status one of:
- ``"disabled"`` — no index URL configured
- - ``"fresh"`` — served straight from a within-TTL cache
+ - ``"fresh"`` — served from a within-TTL cache, or the host confirmed
+ the cached body is still current (304 Not Modified)
- ``"fetched"`` — downloaded and cached just now
- ``"stale"`` — network failed; serving the outdated cache honestly
- ``"unavailable"`` — network failed and there is no cache at all
@@ -313,10 +334,17 @@ async def get_index(
return None, "disabled"
async with _fetch_lock:
- hit = _read_cache()
+ raw_hit = _read_cache_raw()
+ hit = (raw_hit[0], raw_hit[1]) if raw_hit else None
+ etag = raw_hit[2] if raw_hit else None
if hit and not force and (time.time() - hit[0]) < _CACHE_TTL_SECONDS:
return hit[1], "fresh"
+ # Revalidate rather than re-download when we hold the host's validator.
+ # An explicit refresh (force) asks for the body outright — the user
+ # pressed the button because they suspect the cache, so a "still the
+ # same" answer from a CDN edge would be the wrong kind of reassurance.
+ headers = {"If-None-Match": etag} if (etag and hit and not force) else {}
try:
# The index URL is configuration, but its redirects are not: the
# host on the other end picks them, so the chain stays on https.
@@ -326,16 +354,21 @@ async def get_index(
transport=transport,
**https_only_async(),
) as client:
- response = await client.get(url)
+ response = await client.get(url, headers=headers)
+ if response.status_code == 304 and hit:
+ # Same body as cached: stamp it fresh for another TTL.
+ _write_cache(hit[1], etag)
+ return hit[1], "fresh"
response.raise_for_status()
index = CommunityIndex.model_validate(response.json())
+ new_etag = response.headers.get("etag") or None
except (httpx.HTTPError, ValueError, ValidationError) as exc:
logger.warning("community index: fetch failed (%s)", exc)
if hit:
return hit[1], "stale"
return None, "unavailable"
- _write_cache(index)
+ _write_cache(index, new_etag)
return index, "fetched"
diff --git a/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.test.tsx b/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.test.tsx
index 82cc957e7d..2c8ab267d8 100644
--- a/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.test.tsx
@@ -33,16 +33,27 @@ function stubServer(identity: PublishIdentityWire, opts?: { validateErrors?: unk
const json = (body: unknown, ok = true, status = 200) => ({ ok, status, json: async () => body });
vi.stubGlobal(
"fetch",
- vi.fn(async (input: unknown, init?: { method?: string; body?: string }) => {
+ vi.fn(async (input: unknown, init?: { method?: string; body?: string | FormData }) => {
const url = String(input);
const method = (init?.method ?? "GET").toUpperCase();
- calls.push({ url, body: init?.body ? JSON.parse(init.body) : undefined });
+ calls.push({
+ url,
+ body: typeof init?.body === "string" ? JSON.parse(init.body) : init?.body,
+ });
if (url === "/api/marketplace/publish/identity" && method === "GET") return json(identity);
+ if (url === "/api/wallpapers/uploads" && method === "POST") {
+ // The picker's own upload route: the dropped picture comes back as a
+ // fresh "own" upload the lane can hand straight to the share dialog.
+ return json({ id: "u0000000000000003", title: "Dropped", theme: "dark", createdAt: 3, source: "own" });
+ }
if (url === "/api/marketplace/publish/validate") {
return json({ ok: !(opts?.validateErrors?.length), errors: opts?.validateErrors ?? [] });
}
if (url === "/api/marketplace/publish/submit") {
- const body = JSON.parse(init?.body ?? "{}") as { name: string; version: string };
+ const body = JSON.parse(typeof init?.body === "string" ? init.body : "{}") as {
+ name: string;
+ version: string;
+ };
return json(
{
ok: true,
@@ -183,11 +194,44 @@ describe("PublishStudio", () => {
expect(await screen.findByText(/Publishing is disabled/)).toBeTruthy();
});
+ it("offers a single-file door next to the folder one, and a lone SKILL.md lands in the form", async () => {
+ stubServer(SIGNED_IN);
+ renderStudio();
+ await screen.findByTestId("studio-door-folder");
+ // The link is the visible promise that a skill does not need a folder.
+ expect(screen.getByTestId("studio-door-skill-file")).toBeTruthy();
+ const input = screen.getByTestId("studio-skill-file-input") as HTMLInputElement;
+ expect(input.hasAttribute("webkitdirectory")).toBe(false);
+
+ const file = new File(
+ ["---\nname: todo-triage\ndescription: Sort tasks.\n---\n\nGroup by due date.\n"],
+ "todo-triage.md",
+ { type: "text/markdown" },
+ );
+ fireEvent.change(input, { target: { files: [file] } });
+ await screen.findByTestId("studio-form");
+ // Read as a skill, name from the frontmatter — not a plugin with a missing manifest.
+ expect((screen.getByTestId("studio-name") as HTMLInputElement).value).toBe("todo-triage");
+ });
+
+ it("takes a dropped picture in the wallpaper lane and opens the share form on it", async () => {
+ const calls = stubServer(SIGNED_IN);
+ renderStudio(() => undefined, "wallpapers");
+ const drop = await screen.findByTestId("studio-wallpaper-drop");
+ const file = new File(["png-bytes"], "sunset.png", { type: "image/png" });
+ fireEvent.drop(drop, { dataTransfer: { files: [file] } });
+
+ expect(await screen.findByTestId("publish-wallpaper-dialog")).toBeTruthy();
+ const upload = calls.find((c) => c.url === "/api/wallpapers/uploads" && c.body instanceof FormData);
+ expect(upload).toBeTruthy();
+ expect((upload?.body as FormData).get("file")).toBeInstanceOf(File);
+ });
+
it("speaks German when the UI does", async () => {
stubServer(SIGNED_IN);
setUiLanguage("de");
renderStudio();
- expect(await screen.findByText("Paketordner ablegen")).toBeTruthy(); // i18n-allow
+ expect(await screen.findByText(/Paketordner ablegen/)).toBeTruthy(); // i18n-allow
expect(screen.getByText("Im Marketplace veröffentlichen")).toBeTruthy(); // i18n-allow
});
});
diff --git a/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.tsx b/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.tsx
index 05c2aa279f..48022db638 100644
--- a/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.tsx
+++ b/jarvis/ui/web/frontend/src/components/marketplace/PublishStudio.tsx
@@ -14,6 +14,7 @@ import {
Plug,
Search,
Sparkles,
+ Upload,
UploadCloud,
X,
} from "lucide-react";
@@ -28,7 +29,11 @@ import {
} from "@/components/marketplace/PublishIdentity";
import { PublishWallpaperDialog } from "@/components/wallpaper/PublishWallpaperDialog";
import { thumbUrlFor, type WallpaperEntry } from "@/hooks/useWallpaperCatalog";
-import { uploadAsEntry, useWallpaperUploads } from "@/hooks/useWallpaperUploads";
+import {
+ uploadAsEntry,
+ useUploadMutations,
+ useWallpaperUploads,
+} from "@/hooks/useWallpaperUploads";
import { fill, useLocaleChunk, useT } from "@/i18n";
import { openExternalUrl } from "@/lib/openExternal";
import { cn } from "@/lib/utils";
@@ -533,6 +538,11 @@ function SourcePicker({
const [busy, setBusy] = useState(false);
const [dropError, setDropError] = useState<string | null>(null);
const pickerRef = useRef<HTMLInputElement | null>(null);
+ // A second picker for the one-file case: a `webkitdirectory` input can only
+ // ever choose a directory, so without this a skill author who has exactly
+ // one SKILL.md on disk reads the door as "plugins only" (it is not — the
+ // drop zone has always taken a lone file; only the click path refused it).
+ const filePickerRef = useRef<HTMLInputElement | null>(null);
const handleFiles = async (
load: () => Promise<Parameters<typeof folderToDraft>[0]>,
@@ -605,6 +615,19 @@ function SourcePicker({
<p className="mt-1 text-xs leading-relaxed text-muted-foreground">
{t("marketplace.studio_door_folder_hint")}
</p>
+ <button
+ type="button"
+ data-testid="studio-door-skill-file"
+ className="mt-3 inline-flex w-fit items-center gap-1.5 text-xs font-medium text-primary underline-offset-4 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ onClick={(e) => {
+ // The tile itself opens the folder picker — this link must not.
+ e.stopPropagation();
+ filePickerRef.current?.click();
+ }}
+ >
+ <FileText className="h-3.5 w-3.5" />
+ {t("marketplace.studio_door_skill_file")}
+ </button>
<input
ref={pickerRef}
type="file"
@@ -623,6 +646,24 @@ function SourcePicker({
e.currentTarget.value = "";
}}
/>
+ <input
+ ref={filePickerRef}
+ type="file"
+ accept=".md,text/markdown,.json,application/json"
+ multiple
+ className="hidden"
+ data-testid="studio-skill-file-input"
+ onChange={(e) => {
+ const list = e.currentTarget.files;
+ if (list && list.length > 0) {
+ void handleFiles(
+ () => Promise.resolve(collectPickedFiles(list)),
+ t("marketplace.studio_origin_file"),
+ );
+ }
+ e.currentTarget.value = "";
+ }}
+ />
</div>
<Door
@@ -1062,6 +1103,16 @@ function WallpaperLane({
() => (uploads ?? []).filter((u) => u.source !== "marketplace").map(uploadAsEntry),
[uploads],
);
+ // Adding a picture right here, not only in the Wallpaper section: the same
+ // upload the picker uses (it lands in "Yours" there too), and the share
+ // dialog opens on it straight away — drop, title, publish, three steps.
+ const { add } = useUploadMutations();
+ const [dragOver, setDragOver] = useState(false);
+ const imagePickerRef = useRef<HTMLInputElement | null>(null);
+ const addAndShare = (file: File | undefined) => {
+ if (!file) return;
+ add.mutate(file, { onSuccess: (upload) => setShareItem(uploadAsEntry(upload)) });
+ };
return (
<section className="space-y-4">
<PublishIdentityCard
@@ -1069,6 +1120,66 @@ function WallpaperLane({
loading={identityLoading}
blurb={t("marketplace.share_identity_blurb")}
/>
+ <div
+ role="button"
+ tabIndex={0}
+ aria-label={t("marketplace.studio_wallpapers_add")}
+ data-testid="studio-wallpaper-drop"
+ onClick={() => imagePickerRef.current?.click()}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") imagePickerRef.current?.click();
+ }}
+ onDragOver={(e) => {
+ e.preventDefault();
+ setDragOver(true);
+ }}
+ onDragLeave={() => setDragOver(false)}
+ onDrop={(e) => {
+ e.preventDefault();
+ setDragOver(false);
+ addAndShare(e.dataTransfer.files?.[0]);
+ }}
+ className={cn(
+ "flex cursor-pointer items-center gap-4 rounded-2xl border border-dashed p-4 text-left transition-colors",
+ "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ dragOver
+ ? "border-primary bg-primary/10"
+ : "border-border bg-gradient-to-br from-primary/10 via-card to-card hover:border-primary/50",
+ )}
+ >
+ <span className="grid h-11 w-11 shrink-0 place-items-center rounded-xl bg-primary text-primary-foreground shadow-lg">
+ {add.isPending ? (
+ <Loader2 className="h-5 w-5 animate-spin" />
+ ) : (
+ <Upload className="h-5 w-5" />
+ )}
+ </span>
+ <span className="min-w-0">
+ <span className="block font-display text-sm font-semibold tracking-tight text-foreground">
+ {t("marketplace.studio_wallpapers_add")}
+ </span>
+ <span className="mt-0.5 block text-xs leading-relaxed text-muted-foreground">
+ {t("marketplace.studio_wallpapers_add_hint")}
+ </span>
+ </span>
+ <input
+ ref={imagePickerRef}
+ type="file"
+ accept="image/png,image/jpeg,image/webp,image/gif,image/bmp"
+ className="hidden"
+ data-testid="studio-wallpaper-file-input"
+ onChange={(e) => {
+ addAndShare(e.currentTarget.files?.[0]);
+ e.currentTarget.value = "";
+ }}
+ />
+ </div>
+ {add.error && (
+ <p className="flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-2 py-1.5 text-xs text-destructive">
+ <AlertTriangle className="mt-0.5 h-3.5 w-3.5 shrink-0" />
+ {add.error.message}
+ </p>
+ )}
<div className="flex flex-wrap items-baseline gap-2">
<span className="text-xs font-semibold uppercase tracking-wider text-foreground">
{t("marketplace.studio_wallpapers_label")}
@@ -1596,6 +1707,14 @@ function PublishedCard({
}) {
const [live, setLive] = useState(false);
const [waitedOut, setWaitedOut] = useState(false);
+ const queryClient = useQueryClient();
+
+ // The moment the feed lists the entry, the store behind this overlay must
+ // list it too — the status poll above already forced the server cache, so
+ // refetching the view's query is what makes "live" visibly true.
+ useEffect(() => {
+ if (live) void queryClient.invalidateQueries({ queryKey: ["marketplace-community"] });
+ }, [live, queryClient]);
useEffect(() => {
if (live) return;
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/marketplace/de.json b/jarvis/ui/web/frontend/src/i18n/locales/marketplace/de.json
index 03f57196c1..23bbb25190 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/marketplace/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/marketplace/de.json
@@ -48,14 +48,16 @@
"studio_disabled": "Veröffentlichen ist in dieser Installation abgeschaltet — es ist kein Publish-Endpunkt konfiguriert.",
"studio_source_label": "Wähle eine Tür",
"studio_source_hint": "was drin ist, entscheidet, ob daraus ein Skill oder eine Plugin-Karte wird",
- "studio_door_folder": "Paketordner ablegen",
- "studio_door_folder_hint": "Zieh den Ordner hierher oder klicke, um ihn zu wählen. plugin.json, mcp.json und gebündelte Skills werden automatisch gelesen — hochgeladen wird erst, wenn du auf Veröffentlichen drückst.",
+ "studio_door_folder": "Paketordner ablegen — oder eine einzelne SKILL.md",
+ "studio_door_folder_hint": "Zieh den Ordner oder die Datei hierher oder klicke, um einen Ordner zu wählen. plugin.json, mcp.json und gebündelte Skills werden automatisch gelesen; eine einzelne SKILL.md wird zum Skill. Hochgeladen wird erst, wenn du auf Veröffentlichen drückst.",
+ "studio_door_skill_file": "…oder eine einzelne SKILL.md-Datei wählen",
+ "studio_origin_file": "deine Datei",
"studio_door_github": "Aus GitHub importieren",
"studio_door_github_hint": "Durchsuche deine öffentlichen Repositories, wähle das Paket, prüfe es zuerst.",
"studio_door_blank": "Von vorn beginnen",
"studio_door_blank_hint": "Direkt im Formular schreiben — am besten für einen einzelnen Skill.",
"studio_door_wallpaper": "Ein Wallpaper teilen",
- "studio_door_wallpaper_hint": "Veröffentliche eines deiner eigenen Bilder aus der Wallpaper-Auswahl — die Community kann es mit einem Klick übernehmen.",
+ "studio_door_wallpaper_hint": "Leg ein Bild ab oder wähle eines deiner eigenen — die Community kann es mit einem Klick übernehmen.",
"studio_origin_folder": "deinem Ordner",
"studio_err_folder": "Der Ordner konnte nicht gelesen werden.",
"studio_err_plugin_json": "plugin.json ist kein gültiges JSON",
@@ -87,7 +89,9 @@
"studio_err_resolve": "Das Repository konnte nicht aufgelöst werden.",
"studio_wallpapers_label": "Deine Bilder",
"studio_wallpapers_hint": "nur Bilder, die du selbst mitgebracht hast — ein installiertes Community-Wallpaper ist die Arbeit von jemand anderem",
- "studio_wallpapers_empty": "Du hast noch kein eigenes Wallpaper hinzugefügt. Füge eines in der Wallpaper-Sektion hinzu und teile es dann von hier aus.",
+ "studio_wallpapers_empty": "Noch keine eigenen Bilder — leg oben eines ab oder füge eines in der Wallpaper-Sektion hinzu und teile es dann von hier aus.",
+ "studio_wallpapers_add": "Bild hinzufügen",
+ "studio_wallpapers_add_hint": "Zieh ein Bild hierher oder klicke, um eines zu wählen — PNG, JPEG, WebP, GIF oder BMP, bis 40 MB. Es landet in deiner Wallpaper-Sektion, und das Teilen-Formular öffnet sich sofort.",
"studio_form_label": "Was du veröffentlichst",
"studio_prefilled_from": "Geladen aus {origin} — prüfe die Felder, dann checken und veröffentlichen.",
"studio_f_name": "Paketname",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/marketplace/en.json b/jarvis/ui/web/frontend/src/i18n/locales/marketplace/en.json
index 67eb284ea8..f07808019e 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/marketplace/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/marketplace/en.json
@@ -48,14 +48,16 @@
"studio_disabled": "Publishing is disabled in this deployment — no publish endpoint is configured.",
"studio_source_label": "Pick a door",
"studio_source_hint": "what is inside decides whether it becomes a skill or a plugin card",
- "studio_door_folder": "Drop a package folder",
- "studio_door_folder_hint": "Drag the folder here or click to choose it. plugin.json, mcp.json and bundled skills are read automatically — nothing is uploaded until you press Publish.",
+ "studio_door_folder": "Drop a package folder — or a single SKILL.md",
+ "studio_door_folder_hint": "Drag the folder or the file here, or click to choose a folder. plugin.json, mcp.json and bundled skills are read automatically; a lone SKILL.md becomes a skill. Nothing is uploaded until you press Publish.",
+ "studio_door_skill_file": "…or pick a single SKILL.md file",
+ "studio_origin_file": "your file",
"studio_door_github": "Import from GitHub",
"studio_door_github_hint": "Browse your public repositories, pick the package, review it first.",
"studio_door_blank": "Start from scratch",
"studio_door_blank_hint": "Write it in the form — best for a single skill.",
"studio_door_wallpaper": "Share a wallpaper",
- "studio_door_wallpaper_hint": "Publish one of your own pictures from the wallpaper picker — the community can add it in one click.",
+ "studio_door_wallpaper_hint": "Drop a picture or pick one of your own — the community can add it in one click.",
"studio_origin_folder": "your folder",
"studio_err_folder": "Could not read the folder.",
"studio_err_plugin_json": "plugin.json is not valid JSON",
@@ -87,7 +89,9 @@
"studio_err_resolve": "Could not resolve the repository.",
"studio_wallpapers_label": "Your pictures",
"studio_wallpapers_hint": "only pictures you brought yourself — an installed community wallpaper is somebody else's work",
- "studio_wallpapers_empty": "You have not added a wallpaper of your own yet. Add one in the Wallpaper section, then share it from here.",
+ "studio_wallpapers_empty": "No pictures of your own yet — drop one above, or add one in the Wallpaper section and share it from here.",
+ "studio_wallpapers_add": "Add a picture",
+ "studio_wallpapers_add_hint": "Drag an image here or click to choose one — PNG, JPEG, WebP, GIF or BMP, up to 40 MB. It lands in your Wallpaper section, and the share form opens right away.",
"studio_form_label": "What you are publishing",
"studio_prefilled_from": "Loaded from {origin} — review the fields, then check and publish.",
"studio_f_name": "Package name",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/marketplace/es.json b/jarvis/ui/web/frontend/src/i18n/locales/marketplace/es.json
index ceb3633a5e..5bccde243f 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/marketplace/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/marketplace/es.json
@@ -48,14 +48,16 @@
"studio_disabled": "La publicación está desactivada en esta instalación: no hay ningún endpoint de publicación configurado.",
"studio_source_label": "Elige una puerta",
"studio_source_hint": "lo que hay dentro decide si se convierte en skill o en tarjeta de plugin",
- "studio_door_folder": "Suelta la carpeta del paquete",
- "studio_door_folder_hint": "Arrastra la carpeta aquí o haz clic para elegirla. plugin.json, mcp.json y las skills incluidas se leen automáticamente; no se sube nada hasta que pulses Publicar.",
+ "studio_door_folder": "Suelta la carpeta del paquete — o un único SKILL.md",
+ "studio_door_folder_hint": "Arrastra la carpeta o el archivo aquí, o haz clic para elegir una carpeta. plugin.json, mcp.json y las skills incluidas se leen automáticamente; un SKILL.md suelto se convierte en una skill. No se sube nada hasta que pulses Publicar.",
+ "studio_door_skill_file": "…o elige un único archivo SKILL.md",
+ "studio_origin_file": "tu archivo",
"studio_door_github": "Importar desde GitHub",
"studio_door_github_hint": "Explora tus repositorios públicos, elige el paquete y revísalo primero.",
"studio_door_blank": "Empezar desde cero",
"studio_door_blank_hint": "Escríbelo en el formulario: ideal para una sola skill.",
"studio_door_wallpaper": "Compartir un fondo de pantalla",
- "studio_door_wallpaper_hint": "Publica una de tus propias imágenes desde el selector de fondos; la comunidad puede añadirla con un clic.",
+ "studio_door_wallpaper_hint": "Suelta una imagen o elige una de las tuyas; la comunidad puede añadirla con un clic.",
"studio_origin_folder": "tu carpeta",
"studio_err_folder": "No se pudo leer la carpeta.",
"studio_err_plugin_json": "plugin.json no es JSON válido",
@@ -87,7 +89,9 @@
"studio_err_resolve": "No se pudo resolver el repositorio.",
"studio_wallpapers_label": "Tus imágenes",
"studio_wallpapers_hint": "solo imágenes que trajiste tú; un fondo instalado desde la comunidad es obra de otra persona",
- "studio_wallpapers_empty": "Todavía no has añadido ningún fondo propio. Añade uno en la sección Fondo de pantalla y compártelo desde aquí.",
+ "studio_wallpapers_empty": "Todavía no tienes imágenes propias: suelta una arriba, o añade una en la sección Fondo de pantalla y compártela desde aquí.",
+ "studio_wallpapers_add": "Añadir una imagen",
+ "studio_wallpapers_add_hint": "Arrastra una imagen aquí o haz clic para elegirla: PNG, JPEG, WebP, GIF o BMP, hasta 40 MB. Queda en tu sección Fondo de pantalla y el formulario para compartir se abre de inmediato.",
"studio_form_label": "Lo que estás publicando",
"studio_prefilled_from": "Cargado desde {origin}: revisa los campos, luego comprueba y publica.",
"studio_f_name": "Nombre del paquete",
diff --git a/jarvis/ui/web/frontend/src/lib/packageFolder.test.ts b/jarvis/ui/web/frontend/src/lib/packageFolder.test.ts
index 6ca7be44aa..bed32fd6c1 100644
--- a/jarvis/ui/web/frontend/src/lib/packageFolder.test.ts
+++ b/jarvis/ui/web/frontend/src/lib/packageFolder.test.ts
@@ -67,6 +67,27 @@ describe("folderToDraft — the folder is the classification (publishing-plan.md
);
});
+ it("reads a lone SKILL.md file as the skill — no wrapping folder required", async () => {
+ const draft = await folderToDraft([namedFile("SKILL.md", SKILL_MD)]);
+ expect(draft.kind).toBe("skill");
+ expect(draft.name).toBe("todo-triage"); // from the frontmatter, not "SKILL"
+ expect(draft.skill_md).toBe(SKILL_MD);
+ });
+
+ it("accepts a lone Markdown file under any name once it opens with frontmatter, naming it from the file", async () => {
+ const noName = SKILL_MD.replace("name: todo-triage\n", "");
+ const draft = await folderToDraft([namedFile("Todo Triage.md", noName)]);
+ expect(draft.kind).toBe("skill");
+ expect(draft.name).toBe("todo-triage");
+ expect(draft.title).toBe("Todo Triage");
+ });
+
+ it("does not mistake a lone README.md without frontmatter for a skill", async () => {
+ await expect(folderToDraft([namedFile("notes.md", "# just notes")])).rejects.toThrow(
+ /named SKILL\.md or starts with YAML frontmatter/,
+ );
+ });
+
it("warns instead of dropping bundled skills once the 10-skill cap is exceeded", async () => {
const files = [namedFile("plugin.json", PLUGIN_JSON)];
for (let i = 0; i < 11; i++) {
diff --git a/jarvis/ui/web/frontend/src/lib/packageFolder.ts b/jarvis/ui/web/frontend/src/lib/packageFolder.ts
index adf5a91516..ba30cd6004 100644
--- a/jarvis/ui/web/frontend/src/lib/packageFolder.ts
+++ b/jarvis/ui/web/frontend/src/lib/packageFolder.ts
@@ -50,7 +50,7 @@ export const MAX_SKILL_MD_BYTES = 64 * 1024;
/** Files worth reading at all — everything else in the folder is ignored. */
const INTERESTING = /(^|\/)(plugin\.json|mcp\.json|SKILL\.md|usage-card\.md)$/;
-function readText(file: File): Promise<string> {
+function readText(file: Blob): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(String(reader.result ?? ""));
@@ -163,9 +163,51 @@ function normalizePaths(files: NamedFile[]): NamedFile[] {
return files;
}
+/**
+ * A lone Markdown file IS the skill. "Drop a SKILL.md" must not demand a
+ * wrapping folder — a skill genuinely is one file (publishing-plan.md §3),
+ * and the file name need not be SKILL.md either: `todo-triage.md` dropped on
+ * the door is the same intent. The file is re-addressed to the canonical path
+ * so detection below stays one code path; its stem seeds the package name
+ * when the frontmatter has none (a literal "SKILL" is not a name).
+ */
+async function loneSkillFile(
+ files: NamedFile[],
+): Promise<{ files: NamedFile[]; stem: string } | null> {
+ if (files.length !== 1) return null;
+ const only = files[0];
+ const base = only.path.split("/").pop() ?? only.path;
+ if (!/\.md$/i.test(base)) return null;
+ const stem = base.replace(/\.md$/i, "");
+ const named = /^skill$/i.test(stem);
+ // A README.md dropped by mistake is not a skill: only the canonical name or
+ // a frontmatter opener says "this file is the package".
+ if (!named && only.file.size <= MAX_READ_BYTES) {
+ const head = await readText(only.file.slice(0, 16));
+ if (!head.replace(/^/, "").startsWith("---")) return null;
+ } else if (!named) {
+ return null;
+ }
+ return {
+ files: [{ path: "SKILL.md", file: only.file }],
+ stem: named ? "" : stem,
+ };
+}
+
+/** "Todo Triage.md" → "todo-triage": the store's name rule, applied to a
+ * file name so the form opens with something the Check will accept. */
+function slugFromStem(stem: string): string {
+ return stem
+ .toLowerCase()
+ .replace(/[^a-z0-9.-]+/g, "-")
+ .replace(/-{2,}/g, "-")
+ .replace(/^[-.]+|[-.]+$/g, "");
+}
+
/** Turn the recognized files of a package directory into a prefilled draft. */
export async function folderToDraft(input: NamedFile[]): Promise<FolderDraft> {
- const files = normalizePaths(input).filter(
+ const lone = await loneSkillFile(input);
+ const files = (lone ? lone.files : normalizePaths(input)).filter(
(f) => INTERESTING.test(f.path) && f.file.size <= MAX_READ_BYTES,
);
const warnings: string[] = [];
@@ -240,13 +282,15 @@ export async function folderToDraft(input: NamedFile[]): Promise<FolderDraft> {
byPath("SKILL.md") ?? files.find((f) => f.path.endsWith("/SKILL.md")) ?? undefined;
if (!skillFile) {
throw new Error(
- "No plugin.json and no SKILL.md found — a package folder needs one of the two at its top level.",
+ "No plugin.json and no SKILL.md found — a package folder needs one of the two at its " +
+ "top level. A single file works too when it is named SKILL.md or starts with YAML " +
+ "frontmatter (---).",
);
}
draft.skill_md = await read(skillFile);
const fm = frontmatterValues(draft.skill_md);
const dirName = skillFile.path.includes("/") ? skillFile.path.split("/")[0] : "";
- draft.name = fm.name || dirName;
+ draft.name = fm.name || dirName || (lone ? slugFromStem(lone.stem) : "");
if (fm.version) draft.version = fm.version;
draft.description = fm.description ?? "";
draft.title =
diff --git a/jarvis/ui/web/frontend/src/views/MarketplaceView.tsx b/jarvis/ui/web/frontend/src/views/MarketplaceView.tsx
index cf25fe5e0a..7e3f9ab360 100644
--- a/jarvis/ui/web/frontend/src/views/MarketplaceView.tsx
+++ b/jarvis/ui/web/frontend/src/views/MarketplaceView.tsx
@@ -217,6 +217,13 @@ export function MarketplaceView() {
const { data, isLoading, error } = useQuery({
queryKey: ["marketplace-community"],
queryFn: fetchCommunity,
+ // The store stays live while it is open: a publish that just merged shows
+ // up on its own instead of waiting for the refresh button. Cheap on
+ // purpose — the server answers from its cache inside the TTL and
+ // revalidates with a conditional GET (304) after it, so this never
+ // re-downloads an unchanged index. Paused while the window is hidden.
+ refetchInterval: 60_000,
+ refetchIntervalInBackground: false,
});
const refresh = useMutation({
diff --git a/tests/unit/marketplace/test_community_source.py b/tests/unit/marketplace/test_community_source.py
index 85fa6a107d..a11552c3eb 100644
--- a/tests/unit/marketplace/test_community_source.py
+++ b/tests/unit/marketplace/test_community_source.py
@@ -63,6 +63,18 @@ def _seed_corrupt_cache(path: Path) -> None:
path.write_text("{not json", encoding="utf-8")
+def _seed_cache_with_etag(
+ path: Path, payload: dict[str, Any], fetched_at: float, etag: str
+) -> None:
+ path.write_text(
+ json.dumps({"fetched_at": fetched_at, "index": payload, "etag": etag}), encoding="utf-8"
+ )
+
+
+def _raw_cache(path: Path) -> dict[str, Any]:
+ return json.loads(path.read_text(encoding="utf-8")) # type: ignore[no-any-return]
+
+
async def test_fetch_validates_and_caches(cache_path: Path) -> None:
def handler(request: httpx.Request) -> httpx.Response:
return httpx.Response(200, json=_index_payload())
@@ -149,3 +161,67 @@ def test_config_default_points_at_registry_pages() -> None:
assert MarketplaceConfig().community_index_url.startswith("https://")
assert MarketplaceConfig().community_index_url.endswith("/index.json")
+
+
+# ---------------------------------------------------------------------------
+# Revalidation: the store view polls while open, so the TTL is short and an
+# unchanged index must cost the host a 304, not a download.
+# ---------------------------------------------------------------------------
+
+
+async def test_fetch_stores_the_hosts_etag(cache_path: Path) -> None:
+ def handler(request: httpx.Request) -> httpx.Response:
+ return httpx.Response(200, json=_index_payload(revision=4), headers={"ETag": '"rev4"'})
+
+ _, status = await community_source.get_index(transport=_transport(handler))
+ assert status == "fetched"
+ assert _raw_cache(cache_path)["etag"] == '"rev4"'
+
+
+async def test_expired_cache_revalidates_and_304_keeps_it(cache_path: Path) -> None:
+ _seed_cache_with_etag(cache_path, _index_payload(revision=5), 0.0, '"rev5"')
+ seen: list[str | None] = []
+
+ def handler(request: httpx.Request) -> httpx.Response:
+ seen.append(request.headers.get("If-None-Match"))
+ return httpx.Response(304)
+
+ index, status = await community_source.get_index(transport=_transport(handler))
+ assert seen == ['"rev5"']
+ assert status == "fresh"
+ assert index is not None and index.revision == 5
+ # Stamped fresh again: the next read inside the TTL must not touch the network.
+ raw = _raw_cache(cache_path)
+ assert time.time() - float(raw["fetched_at"]) < 5.0
+ assert raw["etag"] == '"rev5"'
+
+
+async def test_expired_cache_with_changed_body_is_fetched(cache_path: Path) -> None:
+ _seed_cache_with_etag(cache_path, _index_payload(revision=5), 0.0, '"rev5"')
+
+ def handler(request: httpx.Request) -> httpx.Response:
+ assert request.headers.get("If-None-Match") == '"rev5"'
+ return httpx.Response(200, json=_index_payload(revision=6), headers={"ETag": '"rev6"'})
+
+ index, status = await community_source.get_index(transport=_transport(handler))
+ assert status == "fetched"
+ assert index is not None and index.revision == 6
+ assert _raw_cache(cache_path)["etag"] == '"rev6"'
+
+
+async def test_force_asks_for_the_body_not_a_304(cache_path: Path) -> None:
+ _seed_cache_with_etag(cache_path, _index_payload(revision=5), time.time(), '"rev5"')
+
+ def handler(request: httpx.Request) -> httpx.Response:
+ assert "If-None-Match" not in request.headers
+ return httpx.Response(200, json=_index_payload(revision=7))
+
+ index, status = await community_source.get_index(force=True, transport=_transport(handler))
+ assert status == "fetched"
+ assert index is not None and index.revision == 7
+
+
+async def test_legacy_cache_without_etag_still_reads(cache_path: Path) -> None:
+ _seed_cache(cache_path, _index_payload(revision=8), time.time())
+ assert community_source.cached_index() is not None
+ assert community_source.cached_index().revision == 8 # type: ignore[union-attr]